summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-06-22 02:51:21 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-07-05 14:55:16 +0300
commit18992f308d7f1d9b972cb307666e4a4a18778eea (patch)
tree59c4feb67b847ebe750eb66e08b407b52decf227
parent4604a6a7cd66907fc29e01aacf2146f17fa19d34 (diff)
Convert NUM_PAGETYPE_ to a scoped enum
Change-Id: Iddc194a0d8f77e307c05bd3dfef1fc30568173c1
-rw-r--r--cui/source/tabpages/numpages.cxx10
-rw-r--r--include/svx/numvset.hxx12
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx29
-rw-r--r--svx/source/tbxctrls/bulletsnumbering.cxx5
4 files changed, 26 insertions, 30 deletions
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 569a006391fb..01e9d53ef63e 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -91,10 +91,6 @@ using namespace css::text;
using namespace css::container;
using namespace css::style;
-#define NUM_PAGETYPE_BULLET 0
-#define NUM_PAGETYPE_SINGLENUM 1
-#define NUM_PAGETYPE_NUM 2
-
#define SHOW_NUMBERING 0
#define SHOW_BULLET 1
#define SHOW_BITMAP 2
@@ -197,7 +193,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(vcl::Window* pParent,
{
SetExchangeSupport();
get(m_pExamplesVS, "valueset");
- m_pExamplesVS->init(NUM_PAGETYPE_SINGLENUM);
+ m_pExamplesVS->init(NumberingPageType::SINGLENUM);
m_pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
@@ -394,7 +390,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(vcl::Window* pParent,
{
SetExchangeSupport();
get(m_pExamplesVS, "valueset");
- m_pExamplesVS->init(NUM_PAGETYPE_BULLET),
+ m_pExamplesVS->init(NumberingPageType::BULLET),
m_pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
}
@@ -567,7 +563,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(vcl::Window* pParent,
SetExchangeSupport();
get(m_pExamplesVS, "valueset");
- m_pExamplesVS->init(NUM_PAGETYPE_NUM);
+ m_pExamplesVS->init(NumberingPageType::OUTLINE);
m_pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx
index aa4f87768d17..a3aac9734431 100644
--- a/include/svx/numvset.hxx
+++ b/include/svx/numvset.hxx
@@ -47,10 +47,18 @@ struct SvxBmpItemInfo
sal_uInt16 nItemId;
};
+enum class NumberingPageType
+{
+ BULLET,
+ SINGLENUM,
+ OUTLINE,
+ BITMAP
+};
+
class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
{
Color aLineColor;
- sal_uInt16 nPageType;
+ NumberingPageType ePageType;
bool bHTMLMode;
Rectangle aOrgRect;
VclPtr<VirtualDevice> pVDev;
@@ -68,7 +76,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
public:
SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP);
- void init(sal_uInt16 nType);
+ void init(NumberingPageType eType);
virtual ~SvxNumValueSet();
virtual void dispose() SAL_OVERRIDE;
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index b3855f692e7b..5d11b04cd47c 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -64,11 +64,6 @@ using namespace com::sun::star::text;
using namespace com::sun::star::container;
using namespace com::sun::star::style;
-#define NUM_PAGETYPE_BULLET 0
-#define NUM_PAGETYPE_SINGLENUM 1
-#define NUM_PAGETYPE_NUM 2
-#define NUM_PAGETYPE_BMP 3
-
static const sal_Char cNumberingType[] = "NumberingType";
static const sal_Char cValue[] = "Value";
static const sal_Char cParentNumbering[] = "ParentNumbering";
@@ -166,9 +161,9 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
aRuleFont.SetSize(aSize);
aRuleFont.SetColor(aTextColor);
aRuleFont.SetFillColor(aBackColor);
- if(nPageType == NUM_PAGETYPE_BULLET)
+ if(ePageType == NumberingPageType::BULLET)
aFont = aRuleFont;
- else if(nPageType == NUM_PAGETYPE_NUM)
+ else if(ePageType == NumberingPageType::OUTLINE)
{
aSize.Height() = nRectHeight/8;
}
@@ -192,7 +187,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
aLineColor.Invert();
pVDev->SetLineColor(aLineColor);
// Draw line only once
- if(nPageType != NUM_PAGETYPE_NUM)
+ if(ePageType != NumberingPageType::OUTLINE)
{
Point aStart(aBLPos.X() + nRectWidth *25 / 100,0);
Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0);
@@ -210,8 +205,8 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
*pVDev );
// Now comes the text
const OUString sValue(cValue);
- if( NUM_PAGETYPE_SINGLENUM == nPageType ||
- NUM_PAGETYPE_BULLET == nPageType )
+ if( NumberingPageType::SINGLENUM == ePageType ||
+ NumberingPageType::BULLET == ePageType )
{
Point aStart(aBLPos.X() + nRectWidth / 9,0);
for( sal_uInt16 i = 0; i < 3; i++ )
@@ -219,7 +214,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
sal_uInt16 nY = 11 + i * 33;
aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100;
OUString sText;
- if(nPageType == NUM_PAGETYPE_BULLET)
+ if(ePageType == NumberingPageType::BULLET)
{
sText = OUString( aBulletTypes[nItemId - 1] );
aStart.Y() -= pDev->GetTextHeight()/2;
@@ -250,7 +245,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
pDev->DrawText(aStart, sText);
}
}
- else if(NUM_PAGETYPE_NUM == nPageType )
+ else if(NumberingPageType::OUTLINE == ePageType )
{
// Outline numbering has to be painted into the virtual device
// to get correct lines
@@ -392,7 +387,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
SvxNumValueSet::SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits)
: ValueSet(pParent, nWinBits)
- , nPageType(0)
+ , ePageType(NumberingPageType::BULLET)
, bHTMLMode(false)
, pVDev(NULL)
{
@@ -400,17 +395,17 @@ SvxNumValueSet::SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits)
VCL_BUILDER_FACTORY_ARGS(SvxNumValueSet, WB_TABSTOP)
-void SvxNumValueSet::init(sal_uInt16 nType)
+void SvxNumValueSet::init(NumberingPageType eType)
{
aLineColor = COL_LIGHTGRAY;
- nPageType = nType;
+ ePageType = eType;
bHTMLMode = false;
pVDev = NULL;
SetColCount( 4 );
SetLineCount( 2 );
SetStyle( GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
- if(NUM_PAGETYPE_BULLET == nType)
+ if(NumberingPageType::BULLET == eType)
{
for ( sal_uInt16 i = 0; i < 8; i++ )
{
@@ -477,7 +472,7 @@ VCL_BUILDER_FACTORY_ARGS(SvxBmpNumValueSet, WB_TABSTOP)
void SvxBmpNumValueSet::init()
{
- SvxNumValueSet::init(NUM_PAGETYPE_BMP);
+ SvxNumValueSet::init(NumberingPageType::BITMAP);
bGrfNotFound = false;
GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
SetStyle( GetStyle() | WB_VSCROLL );
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index 894c67a69ff6..b61ec20dfc49 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -31,9 +31,6 @@
#include <vcl/toolbox.hxx>
#include <vcl/settings.hxx>
-#define NUM_PAGETYPE_BULLET 0
-#define NUM_PAGETYPE_SINGLENUM 1
-
class NumberingToolBoxControl;
class NumberingPopup : public svtools::ToolbarMenu
@@ -90,7 +87,7 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
{
WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT;
mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits );
- mpValueSet->init( mbBulletItem ? NUM_PAGETYPE_BULLET : NUM_PAGETYPE_SINGLENUM );
+ mpValueSet->init( mbBulletItem ? NumberingPageType::BULLET : NumberingPageType::SINGLENUM );
if ( !mbBulletItem )
{