Kaydet (Commit) 21a68e17 authored tarafından Noel Grandin's avatar Noel Grandin

convert TAB to scoped enum

and rename the SID constant to something more meaningful

Change-Id: Ic07888936df3d537158fd2fb671b0df11350d676
Reviewed-on: https://gerrit.libreoffice.org/24986Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 2c8fe2e7
......@@ -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 );
}
}
......
......@@ -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;
......
......@@ -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: */
......@@ -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
......
......@@ -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 )
......
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment