14 #include <compiler.hxx>
18 #include <document.hxx>
29 #include <tokenarray.hxx>
30 #include <stlpool.hxx>
36 #include <globstr.hrc>
37 #include <strings.hrc>
43 #define CommonWidgetWidth 10
47 , mxBuilder(
Application::CreateBuilder(pParent->GetContainer(), (
SfxViewShell::Current() &&
SfxViewShell::Current()->isLOKMobilePhone())?OUString(
"modules/scalc/ui/conditionalentrymobile.ui"):OUString(
"modules/scalc/ui/conditionalentry.ui")))
48 , mxBorder(mxBuilder->weld_widget(
"border"))
49 , mxGrid(mxBuilder->weld_container(
"grid"))
50 , mxFtCondNr(mxBuilder->weld_label(
"number"))
51 , mxFtCondition(mxBuilder->weld_label(
"condition"))
53 , maStrCondition(
ScResId(SCSTR_CONDITION))
54 , mxLbType(mxBuilder->weld_combo_box(
"type"))
73 maClickHdl.Call(*
this);
105 std::set<OUString> aStyleNames;
107 for (
SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
109 aStyleNames.insert(pStyle->GetName());
111 for(
const auto& rStyleName : aStyleNames)
149 , mxLbCondType(mxBuilder->weld_combo_box(
"typeis"))
150 , mxEdVal1(new
formula::RefEdit(mxBuilder->weld_entry(
"val1")))
151 , mxEdVal2(new
formula::RefEdit(mxBuilder->weld_entry(
"val2")))
152 , mxFtVal(mxBuilder->weld_label(
"valueft"))
153 , mxFtStyle(mxBuilder->weld_label(
"styleft"))
154 , mxLbStyle(mxBuilder->weld_combo_box(
"style"))
155 , mxWdPreviewWin(mxBuilder->weld_widget(
"previewwin"))
156 , mxWdPreview(new
weld::CustomWeld(*mxBuilder,
"preview", maWdPreview))
157 , mbIsInStyleCreate(false)
228 OUString aExpr1 =
mxEdVal1->GetText();
233 if (aExpr2.isEmpty())
246 OUString aFormula = rEdit.
get_text();
248 if( aFormula.isEmpty() )
250 mxFtVal->set_label(
ScResId(STR_ENTER_VALUE));
254 ScCompiler aComp( *mpDoc, maPos, mpDoc->GetGrammar() );
255 std::unique_ptr<ScTokenArray> ta(aComp.CompileString(aFormula));
258 if( ta->GetCodeError() != FormulaError::NONE || ( ta->GetLen() == 0 ) )
261 mxFtVal->set_label(
ScResId(STR_VALID_DEFERROR));
274 mxFtVal->set_label(
ScResId(STR_UNQUOTED_STRING));
279 mxFtVal->set_label(
"");
398 for (sal_Int32 i = rLbStyle.
get_count();
i > 1; --
i)
400 FillStyleListBox(pDoc, rLbStyle);
408 if(rHint.
GetId() == SfxHintId::StyleSheetModified)
422 SfxUInt16Item aFamilyItem( SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Para) );
424 css::uno::Any aAny(pDialogParent->
GetXWindow());
438 SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
439 { &aFamilyItem, &aRefItem }, { &aDialogParent });
447 for (
SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && !bFound; pStyle = aStyleIter.Next() )
449 const OUString&
aName = pStyle->GetName();
452 for( sal_Int32 i = 1, n = rLbStyle.
get_count();
i <=
n && !bFound; ++
i)
485 mbIsInStyleCreate =
true;
486 StyleSelect(
mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview);
487 mbIsInStyleCreate =
false;
494 , mxFtStyle(mxBuilder->weld_label(
"styleft"))
495 , mxLbStyle(mxBuilder->weld_combo_box(
"style"))
496 , mxWdPreviewWin(mxBuilder->weld_widget(
"previewwin"))
497 , mxWdPreview(new
weld::CustomWeld(*mxBuilder,
"preview", maWdPreview))
498 , mxEdFormula(new
formula::RefEdit(mxBuilder->weld_entry(
"formula")))
534 StyleSelect(
mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview);
540 if(aFormula.isEmpty())
581 OUString convertNumberToString(
double nVal,
const ScDocument* pDoc)
605 for (
auto& r : TypeIdMap)
607 if (sId.equalsAscii(r.sId))
624 const sal_Int32 nSize = rListBox.
get_count();
625 for (sal_Int32 i = 0;
i < nSize; ++
i)
627 if (getTypeForId(rListBox.
get_id(i)) == eType)
635 const sal_Int32
nPos = getEntryPos(rListBox, eType);
642 const sal_Int32 nPos = getEntryPos(rListBox, eType);
651 selectType(rLbType, rEntry.
GetType());
662 rEdit.
set_text(convertNumberToString(nVal, pDoc));
710 SetColorScaleEntry(pEntry, rType, rValue, pDoc, rPos);
720 , mxLbColorFormat(mxBuilder->weld_combo_box(
"colorformat"))
721 , mxLbEntryTypeMin(mxBuilder->weld_combo_box(
"colscalemin"))
722 , mxLbEntryTypeMax(mxBuilder->weld_combo_box(
"colscalemax"))
723 , mxEdMin(mxBuilder->weld_entry(
"edcolscalemin"))
724 , mxEdMax(mxBuilder->weld_entry(
"edcolscalemax"))
727 , mxFtMin(mxBuilder->weld_label(
"Label_minimum"))
728 , mxFtMax(mxBuilder->weld_label(
"Label_maximum"))
751 ScColorScaleEntries::const_iterator itr = pFormat->
begin();
833 if (&rBox == mxLbEntryTypeMin.get())
835 else if (&rBox == mxLbEntryTypeMax.get())
841 bool bEnableEdit =
true;
855 , mxLbColorFormat(mxBuilder->weld_combo_box(
"colorformat"))
856 , mxLbEntryTypeMin(mxBuilder->weld_combo_box(
"colscalemin"))
857 , mxLbEntryTypeMiddle(mxBuilder->weld_combo_box(
"colscalemiddle"))
858 , mxLbEntryTypeMax(mxBuilder->weld_combo_box(
"colscalemax"))
859 , mxEdMin(mxBuilder->weld_entry(
"edcolscalemin"))
860 , mxEdMiddle(mxBuilder->weld_entry(
"edcolscalemiddle"))
861 , mxEdMax(mxBuilder->weld_entry(
"edcolscalemax"))
865 , mxFtMin(mxBuilder->weld_label(
"Label_minimum"))
866 , mxFtMax(mxBuilder->weld_label(
"Label_maximum"))
891 ScColorScaleEntries::const_iterator itr = pFormat->
begin();
988 if(&rBox == mxLbEntryTypeMin.get())
990 else if(&rBox == mxLbEntryTypeMiddle.get())
991 pEd = mxEdMiddle.get();
992 else if(&rBox == mxLbEntryTypeMax.get())
998 bool bEnableEdit =
true;
1001 bEnableEdit =
false;
1012 sal_Int32 nSelectPos = mxLbCondType->get_active();
1014 switch(GetNumberEditFields(eMode))
1017 mxEdVal1->GetWidget()->hide();
1018 mxEdVal2->GetWidget()->hide();
1022 mxEdVal1->GetWidget()->show();
1023 mxEdVal2->GetWidget()->hide();
1027 mxEdVal1->GetWidget()->show();
1028 mxEdVal2->GetWidget()->show();
1040 selectType(rLbType, rEntry.
GetType());
1068 , mxLbColorFormat(mxBuilder->weld_combo_box(
"colorformat"))
1069 , mxLbDataBarMinType(mxBuilder->weld_combo_box(
"colscalemin"))
1070 , mxLbDataBarMaxType(mxBuilder->weld_combo_box(
"colscalemax"))
1071 , mxEdDataBarMin(mxBuilder->weld_entry(
"edcolscalemin"))
1072 , mxEdDataBarMax(mxBuilder->weld_entry(
"edcolscalemax"))
1073 , mxBtOptions(mxBuilder->weld_button(
"options"))
1074 , mxFtMin(mxBuilder->weld_label(
"Label_minimum"))
1075 , mxFtMax(mxBuilder->weld_label(
"Label_maximum"))
1180 mxEdDataBarMin->set_sensitive(
false);
1182 mxEdDataBarMin->set_sensitive(
true);
1185 mxEdDataBarMax->set_sensitive(
false);
1187 mxEdDataBarMax->set_sensitive(
true);
1192 SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *mxLbDataBarMinType,
1193 *mxEdDataBarMin, mpDoc, maPos);
1194 SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *mxLbDataBarMaxType,
1195 *mxEdDataBarMax, mpDoc, maPos);
1197 if (aDlg.run() ==
RET_OK)
1199 mpDataBarData.reset(aDlg.GetData());
1200 SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *mxLbDataBarMinType, *mxEdDataBarMin, mpDoc);
1201 SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *mxLbDataBarMaxType, *mxEdDataBarMax, mpDoc);
1202 DataBarTypeSelectHdl(*mxLbDataBarMinType);
1208 , mxLbDateEntry(mxBuilder->weld_combo_box(
"datetype"))
1209 , mxFtStyle(mxBuilder->weld_label(
"styleft"))
1210 , mxLbStyle(mxBuilder->weld_combo_box(
"style"))
1211 , mxWdPreviewWin(mxBuilder->weld_widget(
"previewwin"))
1212 , mxWdPreview(new
weld::CustomWeld(*mxBuilder,
"preview", maWdPreview))
1213 , mbIsInStyleCreate(false)
1226 sal_Int32 nPos =
static_cast<sal_Int32
>(pFormat->
GetDateType());
1271 if(rHint.
GetId() == SfxHintId::StyleSheetModified)
1294 mbIsInStyleCreate =
true;
1295 StyleSelect(
mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview);
1296 mbIsInStyleCreate =
false;
1319 mxGrid->set_grid_left_attach(0);
1320 mxGrid->set_grid_top_attach(nTop);
1329 : mxBuilder(
Application::CreateBuilder(pParent,
"modules/scalc/ui/conditionaliconset.ui"))
1330 , mxGrid(mxBuilder->weld_container(
"ConditionalIconSet"))
1331 , mxImgIcon(mxBuilder->weld_image(
"icon"))
1332 , mxFtEntry(mxBuilder->weld_label(
"label"))
1333 , mxEdEntry(mxBuilder->weld_entry(
"entry"))
1334 , mxLbEntryType(mxBuilder->weld_combo_box(
"listbox"))
1335 , mpContainer(pParent)
1379 sal_uInt32 nIndex = 0;
1418 , mxLbColorFormat(mxBuilder->weld_combo_box(
"colorformat"))
1419 , mxLbIconSetType(mxBuilder->weld_combo_box(
"iconsettype"))
1420 , mxIconParent(mxBuilder->weld_container(
"iconparent"))
1432 sal_Int32
nType =
static_cast<sal_Int32
>(eType);
1435 for (
size_t i = 0,
n = pIconSetFormatData->
m_Entries.size();
1465 sal_Int32 nPos = mxLbIconSetType->get_active();
1470 for(
size_t i = 0;
i < nElements; ++
i)
1473 maEntries[
i]->set_grid_top_attach(
i);
1474 maEntries[
i]->Show();
1476 maEntries[0]->SetFirstEntry();
#define LINK(Instance, Class, Member)
virtual void SetActive() override
virtual void SetActive() override
void Init(ScCondFormatDlg *pDialogParent)
std::unique_ptr< ScDataBarFormatData > mpDataBarData
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
virtual void Select() override
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
std::unique_ptr< weld::ComboBox > mxLbType
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMax
static sal_Int32 GetNumberEditFields(ScConditionMode eMode)
ScFormatEntry * createConditionEntry() const
std::unique_ptr< formula::RefEdit > mxEdVal2
std::unique_ptr< weld::Entry > mxEdDataBarMin
static const sal_Int32 NUM_COND_ENTRIES
ScFormatEntry * createFormulaEntry() const
virtual ~ScColorScale3FrmtEntry() override
std::unique_ptr< ContentProperties > pData
void insert_text(int pos, const OUString &rStr)
virtual ~ScColorScale2FrmtEntry() override
void SetIndex(sal_Int32 nIndex)
virtual OUString get_text(int pos) const =0
std::unique_ptr< ColorListBox > mxLbColMax
ScColorScale3FrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos, const ScColorScaleFormat *pFormat=nullptr)
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMiddle
std::unique_ptr< weld::CustomWeld > mxWdPreview
std::unique_ptr< weld::Label > mxFtEntry
std::unique_ptr< weld::ComboBox > mxLbDataBarMaxType
const OUString & GetStyle() const
virtual int find_text(const OUString &rStr) const =0
virtual void SetActive() override
virtual ScFormatEntry * GetEntry() const override
virtual OUString GetExpressionString() override
std::unique_ptr< ColorListBox > mxLbColMax
condformat::ScCondFormatDateType GetDateType() const
virtual OUString GetExpressionString()=0
ScColorScale2FrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos, const ScColorScaleFormat *pFormat=nullptr)
std::unique_ptr< weld::Entry > mxEdMiddle
virtual SfxItemSet & GetItemSet()
void SetValue(double nValue)
std::unique_ptr< weld::Entry > mxEdEntry
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
virtual OUString get_active_id() const =0
virtual void SetActive() override
virtual int get_active() const =0
std::unique_ptr< ColorListBox > mxLbColMin
virtual void set_text(const OUString &rText)=0
ScConditionMode GetOperation() const
virtual int get_count() const =0
IMPL_LINK_NOARG(ScCondFrmtEntry, EntrySelectHdl, const MouseEvent &, bool)
std::unique_ptr< weld::Entry > mxEdMax
std::unique_ptr< weld::ComboBox > mxLbCondType
virtual OUString GetExpressionString() override
virtual ~ScIconSetFrmtEntry() override
virtual ScFormatEntry * GetEntry() const override
const ScTokenArray * GetFormula() const
ScDataBarFrmtEntry(ScCondFormatList *pParemt, ScDocument *pDoc, const ScAddress &rPos, const ScDataBarFormat *pFormat=nullptr)
virtual void SetActive() override
virtual ScFormatEntry * GetEntry() const override
Link< ScCondFrmtEntry &, void > maClickHdl
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define CommonWidgetWidth
void SetColor(const Color &)
std::unique_ptr< weld::ComboBox > mxLbColorFormat
ScFormatEntry * createDatabarEntry() const
ScColorScaleEntryType GetType() const
std::unique_ptr< weld::Widget > mxBorder
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
std::unique_ptr< weld::Widget > mxWdPreviewWin
virtual OUString GetExpressionString() override
virtual void Deselect() override
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::ComboBox > mxLbColorFormat
std::unique_ptr< weld::Label > mxFtCondition
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTRED
std::unique_ptr< weld::CustomWeld > mxWdPreview
std::unique_ptr< weld::Entry > mxEdMin
void SelectEntry(const NamedColor &rColor)
std::unique_ptr< weld::Widget > mxWdPreviewWin
std::unique_ptr< weld::CustomWeld > mxWdPreview
void set_active_text(const OUString &rStr)
std::unique_ptr< weld::Label > mxFtMin
virtual OUString GetExpressionString() override
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::Label > mxFtMax
ScConditionFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, ScCondFormatDlg *pDialogParent, const ScAddress &rPos, const ScCondFormatEntry *pFormatEntry=nullptr)
SfxDispatcher * GetDispatcher() const
const Color & GetColor() const
ScFormatEntry * createColorscaleEntry() const
std::unique_ptr< weld::ComboBox > mxLbDateEntry
ScCondFormatList * mpParent
OUString GetExpression(const ScAddress &rCursor, sal_uInt16 nPos, sal_uInt32 nNumFmt=0, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
virtual OUString GetExpressionString() override
void set_grid_top_attach(int nTop)
std::unique_ptr< weld::Label > mxFtStyle
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
OUString ScResId(const char *pId)
std::unique_ptr< weld::Label > mxFtStyle
std::unique_ptr< weld::Label > mxFtMin
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
virtual void SetInactive() override
weld::Container * mpContainer
ScCondFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos)
virtual ~ScCondFrmtEntry()
virtual void set_active(int pos)=0
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
std::unique_ptr< weld::ComboBox > mxLbStyle
virtual void SetInactive() override
ScDateFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScCondDateFormatEntry *pFormat=nullptr)
std::unique_ptr< weld::ComboBox > mxLbIconSetType
std::unique_ptr< weld::Container > mxGrid
void SetFormula(const OUString &rFormula, ScDocument &rDoc, const ScAddress &rAddr, formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT)
~ScIconSetFrmtDataEntry()
virtual ScFormatEntry * GetEntry() const override
std::unique_ptr< weld::Entry > mxEdDataBarMax
static const ScConditionMode mpEntryToCond[NUM_COND_ENTRIES]
std::unique_ptr< weld::Label > mxFtMax
virtual OUString get_text() const =0
std::unique_ptr< weld::ComboBox > mxLbStyle
std::unique_ptr< weld::Image > mxImgIcon
std::unique_ptr< ColorListBox > mxLbColMin
virtual void SetInactive() override
RegionData_Impl * mpParent
virtual void SetInactive() override
virtual void set_message_type(EntryMessageType eType)=0
std::unique_ptr< weld::ComboBox > mxLbColorFormat
virtual ~ScDateFrmtEntry() override
Color const & GetSelectEntryColor() const
ScFormatEntry * createColorscaleEntry() const
static ScTabViewShell * GetActiveViewShell()
std::unique_ptr< weld::Label > mxFtCondNr
const OUString & GetStyleName() const
std::unique_ptr< formula::RefEdit > mxEdVal1
IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, formula::RefEdit &, rRefEdit, void)
std::unique_ptr< weld::ComboBox > mxLbDataBarMinType
OUString const maStrCondition
virtual void SetInactive() override
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMin
virtual OUString GetExpressionString() override
static sal_Int32 ConditionModeToEntryPos(ScConditionMode eMode)
void SetDateType(condformat::ScCondFormatDateType eType)
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
virtual ~ScFormulaFrmtEntry() override
std::unique_ptr< weld::Label > mxFtMax
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_YELLOW
std::unique_ptr< weld::Label > mxFtVal
virtual OUString get_id(int pos) const =0
std::unique_ptr< weld::Container > mxGrid
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
static ScConditionMode EntryPosToConditionMode(sal_Int32 aEntryPos)
std::unique_ptr< weld::ComboBox > mxLbStyle
std::unique_ptr< weld::ComboBox > mxLbEntryType
virtual ~ScConditionFrmtEntry() override
virtual void SetInactive() override
ScIconSetFrmtDataEntriesType maEntries
void SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBackgroundToCharacter)
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMax
virtual ~ScDataBarFrmtEntry() override
virtual void remove(int pos)=0
void append_text(const OUString &rStr)
std::unique_ptr< formula::RefEdit > mxEdFormula
void SetType(ScColorScaleEntryType eType)
ScFormulaFrmtEntry(ScCondFormatList *pParent, ScDocument *PDoc, ScCondFormatDlg *pDialogParent, const ScAddress &rPos, const ScCondFormatEntry *pFormatEntry=nullptr)
ScColorScaleEntry * CreateEntry(ScDocument &rDoc, const ScAddress &rPos) const
std::unique_ptr< ColorListBox > mxLbColMiddle
virtual ScFormatEntry * GetEntry() const override
ScIconSetFrmtEntry(ScCondFormatList *pParent, ScDocument *pDoc, const ScAddress &rPos, const ScIconSetFormat *pFormat=nullptr)
std::unique_ptr< weld::Button > mxBtOptions
std::unique_ptr< weld::Label > mxFtStyle
std::unique_ptr< weld::Container > mxIconParent
virtual void SetActive() override
std::unique_ptr< weld::Entry > mxEdMax
std::unique_ptr< weld::Label > mxFtMin
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
std::unique_ptr< weld::Widget > mxWdPreviewWin
ScIconSetFrmtDataEntry(weld::Container *pParent, ScIconSetType eType, const ScDocument *pDoc, sal_Int32 i, const ScColorScaleEntry *pEntry=nullptr)
void Init(ScCondFormatDlg *pDialogParent)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void SetActive() override
virtual void SetInactive() override
void SetStyleName(const OUString &rStyleName)
virtual OUString GetExpressionString() override
virtual OUString get_active_text() const =0
std::unique_ptr< weld::ComboBox > mxLbEntryTypeMin
std::unique_ptr< weld::ComboBox > mxLbColorFormat
std::unique_ptr< weld::Entry > mxEdMin
std::unique_ptr< weld::Builder > mxBuilder