[Libreoffice-commits] core.git: chart2/source cui/source include/svx sc/source
Noel Grandin
noelgrandin at gmail.com
Wed May 18 10:14:19 UTC 2016
chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx | 5 +-
cui/source/inc/tabstpge.hxx | 2 -
cui/source/tabpages/tabstpge.cxx | 30 ++++++++--------
include/svx/flagsdef.hxx | 29 +++++++++------
include/svx/svxids.hrc | 2 -
sc/source/ui/miscdlgs/textdlgs.cxx | 5 +-
6 files changed, 40 insertions(+), 33 deletions(-)
New commits:
commit 21a68e1745dec1f4c4fd5b90d3a58000ed11c324
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sat May 14 15:23:50 2016 +0200
convert TAB to scoped enum
and rename the SID constant to something more meaningful
Change-Id: Ic07888936df3d537158fd2fb671b0df11350d676
Reviewed-on: https://gerrit.libreoffice.org/24986
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
index 8d15fbc..1f9b6b5 100644
--- a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
+++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
@@ -57,8 +57,9 @@ void ShapeParagraphDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
if (nId == m_nTabPageId)
{
SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) );
- aSet.Put( SfxUInt16Item( SID_SVXTABULATORTABPAGE_CONTROLFLAGS,
- ( TABTYPE_ALL &~TABTYPE_LEFT ) | ( TABFILL_ALL &~TABFILL_NONE ) ) );
+ TabulatorDisableFlags nFlags(( TabulatorDisableFlags::TypeMask &~TabulatorDisableFlags::TypeLeft ) |
+ ( TabulatorDisableFlags::FillMask &~TabulatorDisableFlags::FillNone ));
+ aSet.Put( SfxUInt16Item( SID_SVXTABULATORTABPAGE_DISABLEFLAGS, (sal_uInt16)nFlags) );
rPage.PageCreated( aSet );
}
}
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index a91a080..ed39b6e 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -58,7 +58,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
- void DisableControls( const sal_uInt16 nFlag );
+ void DisableControls( const TabulatorDisableFlags nFlag );
protected:
virtual sfxpg DeactivatePage( SfxItemSet* pSet = nullptr ) override;
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index aa697b3..8de91ed 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -313,47 +313,47 @@ void SvxTabulatorTabPage::Reset(const SfxItemSet* rSet)
InitTabPos_Impl(nTabPos);
}
-void SvxTabulatorTabPage::DisableControls(const sal_uInt16 nFlag)
+void SvxTabulatorTabPage::DisableControls(const TabulatorDisableFlags nFlag)
{
- if ((TABTYPE_LEFT & nFlag) == TABTYPE_LEFT)
+ if (TabulatorDisableFlags::TypeLeft & nFlag)
{
m_pLeftTab->Disable();
m_pLeftWin->Disable();
}
- if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT )
+ if (TabulatorDisableFlags::TypeRight & nFlag)
{
m_pRightTab->Disable();
m_pRightWin->Disable();
}
- if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER )
+ if (TabulatorDisableFlags::TypeCenter & nFlag)
{
m_pCenterTab->Disable();
m_pCenterWin->Disable();
}
- if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL )
+ if (TabulatorDisableFlags::TypeDecimal & nFlag)
{
m_pDezTab->Disable();
m_pDezWin->Disable();
m_pDezCharLabel->Disable();
m_pDezChar->Disable();
}
- if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL )
+ if (TabulatorDisableFlags::TypeMask & nFlag)
m_pTypeFrame->Disable();
- if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE )
+ if (TabulatorDisableFlags::FillNone & nFlag)
m_pNoFillChar->Disable();
- if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT )
+ if (TabulatorDisableFlags::FillPoint & nFlag)
m_pFillPoints->Disable();
- if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE )
+ if (TabulatorDisableFlags::FillDashLine & nFlag)
m_pFillDashLine->Disable();
- if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE )
+ if (TabulatorDisableFlags::FillSolidLine & nFlag)
m_pFillSolidLine->Disable();
- if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL )
+ if (TabulatorDisableFlags::FillSpecial & nFlag)
{
m_pFillSpecial->Disable();
m_pFillChar->Disable();
}
- if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL )
- m_pFillFrame->Disable();
+ if (TabulatorDisableFlags::FillMask & nFlag)
+ m_pFillFrame->Disable();
}
SfxTabPage::sfxpg SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet )
@@ -689,9 +689,9 @@ IMPL_LINK_NOARG_TYPED(SvxTabulatorTabPage, ModifyHdl_Impl, Edit&, void)
void SvxTabulatorTabPage::PageCreated(const SfxAllItemSet& aSet)
{
- const SfxUInt16Item* pControlItem = aSet.GetItem<SfxUInt16Item>(SID_SVXTABULATORTABPAGE_CONTROLFLAGS, false);
+ const SfxUInt16Item* pControlItem = aSet.GetItem<SfxUInt16Item>(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, false);
if (pControlItem)
- DisableControls(pControlItem->GetValue());
+ DisableControls((TabulatorDisableFlags)pControlItem->GetValue());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/flagsdef.hxx b/include/svx/flagsdef.hxx
index 234623d..eedea33 100644
--- a/include/svx/flagsdef.hxx
+++ b/include/svx/flagsdef.hxx
@@ -94,18 +94,23 @@ enum SvxModeType
#define MM50 283 //from original svx/inc/paragrph.hxx
//--------------from original svx/inc/tabstpge.hxx
-#define TABTYPE_LEFT 0x0001
-#define TABTYPE_RIGHT 0x0002
-#define TABTYPE_CENTER 0x0004
-#define TABTYPE_DEZIMAL 0x0008
-#define TABTYPE_ALL 0x000F
-
-#define TABFILL_NONE 0x0010
-#define TABFILL_POINT 0x0020
-#define TABFILL_DASHLINE 0x0040
-#define TABFILL_SOLIDLINE 0x0080
-#define TABFILL_SPECIAL 0x0100
-#define TABFILL_ALL 0x01F0
+enum class TabulatorDisableFlags {
+ TypeLeft = 0x0001,
+ TypeRight = 0x0002,
+ TypeCenter = 0x0004,
+ TypeDecimal = 0x0008,
+ TypeMask = 0x000F,
+
+ FillNone = 0x0010,
+ FillPoint = 0x0020,
+ FillDashLine = 0x0040,
+ FillSolidLine = 0x0080,
+ FillSpecial = 0x0100,
+ FillMask = 0x01F0
+};
+namespace o3tl {
+ template<> struct typed_flags<TabulatorDisableFlags> : is_typed_flags<TabulatorDisableFlags, 0x1ff> {};
+}
#endif
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index bcdc8e9..39ef138 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -885,7 +885,7 @@
#define SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH ( SID_SVX_START + 1029 )
#define SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET ( SID_SVX_START + 1030 )
#define SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST ( SID_SVX_START + 1031 )
-#define SID_SVXTABULATORTABPAGE_CONTROLFLAGS ( SID_SVX_START + 1032 )
+#define SID_SVXTABULATORTABPAGE_DISABLEFLAGS ( SID_SVX_START + 1032 )
#define SID_SVXTEXTATTRPAGE_VIEW ( SID_SVX_START + 1033 )
#define SID_FLAG_TYPE ( SID_SVX_START + 1034 )
#define SID_SWMODE_TYPE ( SID_SVX_START + 1035 )
diff --git a/sc/source/ui/miscdlgs/textdlgs.cxx b/sc/source/ui/miscdlgs/textdlgs.cxx
index 478a37b..2f27de7 100644
--- a/sc/source/ui/miscdlgs/textdlgs.cxx
+++ b/sc/source/ui/miscdlgs/textdlgs.cxx
@@ -82,8 +82,9 @@ void ScParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
if (nId == m_nTabPageId)
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
- aSet.Put(SfxUInt16Item(SID_SVXTABULATORTABPAGE_CONTROLFLAGS,
- (TABTYPE_ALL &~TABTYPE_LEFT) | (TABFILL_ALL &~TABFILL_NONE)));
+ TabulatorDisableFlags nFlags((TabulatorDisableFlags::TypeMask &~TabulatorDisableFlags::TypeLeft) |
+ (TabulatorDisableFlags::FillMask &~TabulatorDisableFlags::FillNone));
+ aSet.Put(SfxUInt16Item(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, (sal_uInt16)nFlags));
rPage.PageCreated(aSet);
}
}
More information about the Libreoffice-commits
mailing list