diff options
author | Renato Ferreira <renato.wolp@gmail.com> | 2014-12-04 07:16:54 -0500 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-12-05 15:57:52 +0000 |
commit | 170dbaf19f856085f0e1d2a4679248d55c7ba1d7 (patch) | |
tree | 711a4d05120485f14d040679bc0fce54bbfc5d12 /sc/source/ui/inc | |
parent | 718086d2e0fa0a8774554c395594c2312fd30694 (diff) |
Refactor + minor bugfix in conditional formatting
Use lookup table to translate between listbox positions
and condition modes in the condformat dialog. Use function
to get the number of necessary edit fields instead
of hard-coded if/switch statements.
Fixed minor bug where conditions with no parameter, after
created, would cause one edit field to appear when
opening the dialog, even though it is not used, and would
correctly disappear after selecting the option in the
listbox again.
Change-Id: I7310674162acc33825233866aac3196905dfe8ab
Reviewed-on: https://gerrit.libreoffice.org/13300
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/ui/inc')
-rw-r--r-- | sc/source/ui/inc/condformatdlgentry.hxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index bc4d79b8dce8..99b3c7f3fd92 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -93,6 +93,10 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener SvxFontPrevWindow maWdPreview; bool mbIsInStyleCreate; + static const sal_Int32 NUM_COND_ENTRIES = 24; + // Lookup table from positions in maLbCondType to the condition mode enum + static const ScConditionMode mpEntryToCond[NUM_COND_ENTRIES]; + ScFormatEntry* createConditionEntry() const; virtual OUString GetExpressionString() SAL_OVERRIDE; @@ -100,6 +104,13 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener DECL_LINK( StyleSelectHdl, void* ); DECL_LINK( ConditionTypeSelectHdl, void* ); + // Searches the lookup table for the entry position, given condition mode + sal_Int32 ConditionModeToEntryPos( ScConditionMode eMode ) const; + // Accesses the lookup table for the condition mode, given entry position + ScConditionMode EntryPosToConditionMode( sal_Int32 aEntryPos ) const; + // Returns the number of edit fields used for a given condition mode + sal_Int32 GetNumberEditFields( ScConditionMode eMode ) const; + public: ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); |