Kaydet (Commit) 18992f30 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

Convert NUM_PAGETYPE_ to a scoped enum

Change-Id: Iddc194a0d8f77e307c05bd3dfef1fc30568173c1
üst 4604a6a7
...@@ -91,10 +91,6 @@ using namespace css::text; ...@@ -91,10 +91,6 @@ using namespace css::text;
using namespace css::container; using namespace css::container;
using namespace css::style; 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_NUMBERING 0
#define SHOW_BULLET 1 #define SHOW_BULLET 1
#define SHOW_BITMAP 2 #define SHOW_BITMAP 2
...@@ -197,7 +193,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(vcl::Window* pParent, ...@@ -197,7 +193,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(vcl::Window* pParent,
{ {
SetExchangeSupport(); SetExchangeSupport();
get(m_pExamplesVS, "valueset"); 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->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl)); m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
...@@ -394,7 +390,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(vcl::Window* pParent, ...@@ -394,7 +390,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(vcl::Window* pParent,
{ {
SetExchangeSupport(); SetExchangeSupport();
get(m_pExamplesVS, "valueset"); 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->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl)); m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
} }
...@@ -567,7 +563,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(vcl::Window* pParent, ...@@ -567,7 +563,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(vcl::Window* pParent,
SetExchangeSupport(); SetExchangeSupport();
get(m_pExamplesVS, "valueset"); 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->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl)); m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
......
...@@ -47,10 +47,18 @@ struct SvxBmpItemInfo ...@@ -47,10 +47,18 @@ struct SvxBmpItemInfo
sal_uInt16 nItemId; sal_uInt16 nItemId;
}; };
enum class NumberingPageType
{
BULLET,
SINGLENUM,
OUTLINE,
BITMAP
};
class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
{ {
Color aLineColor; Color aLineColor;
sal_uInt16 nPageType; NumberingPageType ePageType;
bool bHTMLMode; bool bHTMLMode;
Rectangle aOrgRect; Rectangle aOrgRect;
VclPtr<VirtualDevice> pVDev; VclPtr<VirtualDevice> pVDev;
...@@ -68,7 +76,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet ...@@ -68,7 +76,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
public: public:
SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP); SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP);
void init(sal_uInt16 nType); void init(NumberingPageType eType);
virtual ~SvxNumValueSet(); virtual ~SvxNumValueSet();
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
......
...@@ -64,11 +64,6 @@ using namespace com::sun::star::text; ...@@ -64,11 +64,6 @@ using namespace com::sun::star::text;
using namespace com::sun::star::container; using namespace com::sun::star::container;
using namespace com::sun::star::style; 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 cNumberingType[] = "NumberingType";
static const sal_Char cValue[] = "Value"; static const sal_Char cValue[] = "Value";
static const sal_Char cParentNumbering[] = "ParentNumbering"; static const sal_Char cParentNumbering[] = "ParentNumbering";
...@@ -166,9 +161,9 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -166,9 +161,9 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
aRuleFont.SetSize(aSize); aRuleFont.SetSize(aSize);
aRuleFont.SetColor(aTextColor); aRuleFont.SetColor(aTextColor);
aRuleFont.SetFillColor(aBackColor); aRuleFont.SetFillColor(aBackColor);
if(nPageType == NUM_PAGETYPE_BULLET) if(ePageType == NumberingPageType::BULLET)
aFont = aRuleFont; aFont = aRuleFont;
else if(nPageType == NUM_PAGETYPE_NUM) else if(ePageType == NumberingPageType::OUTLINE)
{ {
aSize.Height() = nRectHeight/8; aSize.Height() = nRectHeight/8;
} }
...@@ -192,7 +187,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -192,7 +187,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
aLineColor.Invert(); aLineColor.Invert();
pVDev->SetLineColor(aLineColor); pVDev->SetLineColor(aLineColor);
// Draw line only once // Draw line only once
if(nPageType != NUM_PAGETYPE_NUM) if(ePageType != NumberingPageType::OUTLINE)
{ {
Point aStart(aBLPos.X() + nRectWidth *25 / 100,0); Point aStart(aBLPos.X() + nRectWidth *25 / 100,0);
Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0); Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0);
...@@ -210,8 +205,8 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -210,8 +205,8 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
*pVDev ); *pVDev );
// Now comes the text // Now comes the text
const OUString sValue(cValue); const OUString sValue(cValue);
if( NUM_PAGETYPE_SINGLENUM == nPageType || if( NumberingPageType::SINGLENUM == ePageType ||
NUM_PAGETYPE_BULLET == nPageType ) NumberingPageType::BULLET == ePageType )
{ {
Point aStart(aBLPos.X() + nRectWidth / 9,0); Point aStart(aBLPos.X() + nRectWidth / 9,0);
for( sal_uInt16 i = 0; i < 3; i++ ) for( sal_uInt16 i = 0; i < 3; i++ )
...@@ -219,7 +214,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -219,7 +214,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
sal_uInt16 nY = 11 + i * 33; sal_uInt16 nY = 11 + i * 33;
aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100; aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100;
OUString sText; OUString sText;
if(nPageType == NUM_PAGETYPE_BULLET) if(ePageType == NumberingPageType::BULLET)
{ {
sText = OUString( aBulletTypes[nItemId - 1] ); sText = OUString( aBulletTypes[nItemId - 1] );
aStart.Y() -= pDev->GetTextHeight()/2; aStart.Y() -= pDev->GetTextHeight()/2;
...@@ -250,7 +245,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -250,7 +245,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
pDev->DrawText(aStart, sText); 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 // Outline numbering has to be painted into the virtual device
// to get correct lines // to get correct lines
...@@ -392,7 +387,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -392,7 +387,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
SvxNumValueSet::SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits) SvxNumValueSet::SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits)
: ValueSet(pParent, nWinBits) : ValueSet(pParent, nWinBits)
, nPageType(0) , ePageType(NumberingPageType::BULLET)
, bHTMLMode(false) , bHTMLMode(false)
, pVDev(NULL) , pVDev(NULL)
{ {
...@@ -400,17 +395,17 @@ SvxNumValueSet::SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits) ...@@ -400,17 +395,17 @@ SvxNumValueSet::SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits)
VCL_BUILDER_FACTORY_ARGS(SvxNumValueSet, WB_TABSTOP) VCL_BUILDER_FACTORY_ARGS(SvxNumValueSet, WB_TABSTOP)
void SvxNumValueSet::init(sal_uInt16 nType) void SvxNumValueSet::init(NumberingPageType eType)
{ {
aLineColor = COL_LIGHTGRAY; aLineColor = COL_LIGHTGRAY;
nPageType = nType; ePageType = eType;
bHTMLMode = false; bHTMLMode = false;
pVDev = NULL; pVDev = NULL;
SetColCount( 4 ); SetColCount( 4 );
SetLineCount( 2 ); SetLineCount( 2 );
SetStyle( GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); SetStyle( GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
if(NUM_PAGETYPE_BULLET == nType) if(NumberingPageType::BULLET == eType)
{ {
for ( sal_uInt16 i = 0; i < 8; i++ ) for ( sal_uInt16 i = 0; i < 8; i++ )
{ {
...@@ -477,7 +472,7 @@ VCL_BUILDER_FACTORY_ARGS(SvxBmpNumValueSet, WB_TABSTOP) ...@@ -477,7 +472,7 @@ VCL_BUILDER_FACTORY_ARGS(SvxBmpNumValueSet, WB_TABSTOP)
void SvxBmpNumValueSet::init() void SvxBmpNumValueSet::init()
{ {
SvxNumValueSet::init(NUM_PAGETYPE_BMP); SvxNumValueSet::init(NumberingPageType::BITMAP);
bGrfNotFound = false; bGrfNotFound = false;
GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS); GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
SetStyle( GetStyle() | WB_VSCROLL ); SetStyle( GetStyle() | WB_VSCROLL );
......
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
#include <vcl/toolbox.hxx> #include <vcl/toolbox.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#define NUM_PAGETYPE_BULLET 0
#define NUM_PAGETYPE_SINGLENUM 1
class NumberingToolBoxControl; class NumberingToolBoxControl;
class NumberingPopup : public svtools::ToolbarMenu class NumberingPopup : public svtools::ToolbarMenu
...@@ -90,7 +87,7 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController, ...@@ -90,7 +87,7 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
{ {
WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT; WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT;
mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits ); mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits );
mpValueSet->init( mbBulletItem ? NUM_PAGETYPE_BULLET : NUM_PAGETYPE_SINGLENUM ); mpValueSet->init( mbBulletItem ? NumberingPageType::BULLET : NumberingPageType::SINGLENUM );
if ( !mbBulletItem ) if ( !mbBulletItem )
{ {
......
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