[Libreoffice-commits] core.git: 2 commits - cui/source include/svx sc/source svx/source

Maxim Monastirsky momonasmon at gmail.com
Sun Jul 5 04:57:47 PDT 2015


 cui/source/tabpages/numpages.cxx         |   10 +++-------
 include/svx/numvset.hxx                  |   12 ++++++++++--
 sc/source/ui/cctrl/tbinsert.cxx          |    2 +-
 sc/source/ui/inc/tbinsert.hxx            |    4 +---
 svx/source/dialog/svxbmpnumvalueset.cxx  |   29 ++++++++++++-----------------
 svx/source/tbxctrls/bulletsnumbering.cxx |    5 +----
 6 files changed, 28 insertions(+), 34 deletions(-)

New commits:
commit 18992f308d7f1d9b972cb307666e4a4a18778eea
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Mon Jun 22 02:51:21 2015 +0300

    Convert NUM_PAGETYPE_ to a scoped enum
    
    Change-Id: Iddc194a0d8f77e307c05bd3dfef1fc30568173c1

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 569a006..01e9d53 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 aa4f8776..a3aac97 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 b3855f6..5d11b04 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 894c67a..b61ec20 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 )
     {
commit 4604a6a7cd66907fc29e01aacf2146f17fa19d34
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Jul 5 10:25:14 2015 +0300

    This one should override SfxToolBoxControl::Select
    
    We don't have there Select(bool) since
    c3a89936abc7967ebe8916ca83cb38f6837f9aa1.
    
    Change-Id: Id496725d82289d1be004bdc36195877c12f336b0

diff --git a/sc/source/ui/cctrl/tbinsert.cxx b/sc/source/ui/cctrl/tbinsert.cxx
index 2408618..267d5b9 100644
--- a/sc/source/ui/cctrl/tbinsert.cxx
+++ b/sc/source/ui/cctrl/tbinsert.cxx
@@ -93,7 +93,7 @@ VclPtr<SfxPopupWindow> ScTbxInsertCtrl::CreatePopupWindow()
     return NULL;
 }
 
-void ScTbxInsertCtrl::Select( bool /* bMod1 */ )
+void ScTbxInsertCtrl::Select( sal_uInt16 /*nSelectModifier*/ )
 {
     SfxViewShell*   pCurSh( SfxViewShell::Current() );
     SfxDispatcher*  pDispatch( 0 );
diff --git a/sc/source/ui/inc/tbinsert.hxx b/sc/source/ui/inc/tbinsert.hxx
index 71bdbdc..be21a4e 100644
--- a/sc/source/ui/inc/tbinsert.hxx
+++ b/sc/source/ui/inc/tbinsert.hxx
@@ -25,9 +25,7 @@
 class ScTbxInsertCtrl : public SfxToolBoxControl
 {
     sal_uInt16                  nLastSlotId;
-
-    using SfxToolBoxControl::Select;
-    void            Select( bool bMod1 = false );
+    void            Select( sal_uInt16 nSelectModifier ) SAL_OVERRIDE;
 
 public:
     SFX_DECL_TOOLBOX_CONTROL();


More information about the Libreoffice-commits mailing list