[Libreoffice-commits] core.git: vcl/inc vcl/source

Chr. Rossmanith ChrRossmanith at gmx.de
Fri Feb 22 08:42:01 PST 2013


 vcl/inc/toolbox.h              |    3 +
 vcl/source/window/toolbox2.cxx |   69 ++++++++---------------------------------
 2 files changed, 18 insertions(+), 54 deletions(-)

New commits:
commit 5dff2d0822bb299c134a05a64747ce1bb42ad7cd
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Thu Feb 21 22:56:21 2013 +0100

    Replace duplicate code from ImplToolItem constructors with init method
    
    Change-Id: I2e2950045d8970eec3d1e04269bfe2ecbc9c3e6f
    Reviewed-on: https://gerrit.libreoffice.org/2267
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 0547e57..7fa82d9 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -107,6 +107,9 @@ struct ImplToolItem
 
     // returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars
     sal_Bool IsClipped() const;
+
+private:
+    void init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, sal_Bool bEmptyBtn);
 };
 
 namespace vcl
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 081f524..85f7ca9 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -86,24 +86,30 @@ ImplToolBoxPrivateData::~ImplToolBoxPrivateData()
 }
 
 // -----------------------------------------------------------------------
-ImplToolItem::ImplToolItem()
+void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits,
+                        sal_Bool bEmptyBtn)
 {
-    mnId            = 0;
+    mnId            = nItemId;
     mpWindow        = NULL;
     mpUserData      = NULL;
     meType          = TOOLBOXITEM_BUTTON;
-    mnBits          = 0;
+    mnBits          = nItemBits;
     meState         = STATE_NOCHECK;
     mbEnabled       = sal_True;
     mbVisible       = sal_True;
-    mbEmptyBtn      = sal_True;
+    mbEmptyBtn      = bEmptyBtn;
     mbShowWindow    = sal_False;
     mbBreak         = sal_False;
     mnSepSize       = TB_SEP_SIZE;
     mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
     mnImageAngle    = 0;
-    mbMirrorMode    = sal_False;
-    mbVisibleText   = sal_False;
+    mbMirrorMode    = false;
+    mbVisibleText   = false;
+}
+
+ImplToolItem::ImplToolItem()
+{
+    init(0, 0, sal_True);
 }
 
 // -----------------------------------------------------------------------
@@ -112,22 +118,7 @@ ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
                             ToolBoxItemBits nItemBits ) :
     maImage( rImage )
 {
-    mnId            = nItemId;
-    mpWindow        = NULL;
-    mpUserData      = NULL;
-    meType          = TOOLBOXITEM_BUTTON;
-    mnBits          = nItemBits;
-    meState         = STATE_NOCHECK;
-    mbEnabled       = sal_True;
-    mbVisible       = sal_True;
-    mbEmptyBtn      = sal_False;
-    mbShowWindow    = sal_False;
-    mbBreak         = sal_False;
-    mnSepSize       = TB_SEP_SIZE;
-    mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
-    mnImageAngle    = 0;
-    mbMirrorMode    = false;
-    mbVisibleText   = false;
+    init(nItemId, nItemBits, sal_False);
 }
 
 // -----------------------------------------------------------------------
@@ -136,22 +127,7 @@ ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const XubString& rText,
                             ToolBoxItemBits nItemBits ) :
     maText( rText )
 {
-    mnId            = nItemId;
-    mpWindow        = NULL;
-    mpUserData      = NULL;
-    meType          = TOOLBOXITEM_BUTTON;
-    mnBits          = nItemBits;
-    meState         = STATE_NOCHECK;
-    mbEnabled       = sal_True;
-    mbVisible       = sal_True;
-    mbEmptyBtn      = sal_False;
-    mbShowWindow    = sal_False;
-    mbBreak         = sal_False;
-    mnSepSize       = TB_SEP_SIZE;
-    mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
-    mnImageAngle    = 0;
-    mbMirrorMode    = false;
-    mbVisibleText   = false;
+    init(nItemId, nItemBits, sal_False);
 }
 
 // -----------------------------------------------------------------------
@@ -161,22 +137,7 @@ ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
     maImage( rImage ),
     maText( rText )
 {
-    mnId            = nItemId;
-    mpWindow        = NULL;
-    mpUserData      = NULL;
-    meType          = TOOLBOXITEM_BUTTON;
-    mnBits          = nItemBits;
-    meState         = STATE_NOCHECK;
-    mbEnabled       = sal_True;
-    mbVisible       = sal_True;
-    mbEmptyBtn      = sal_False;
-    mbShowWindow    = sal_False;
-    mbBreak         = sal_False;
-    mnSepSize       = TB_SEP_SIZE;
-    mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
-    mnImageAngle    = 0;
-    mbMirrorMode    = false;
-    mbVisibleText   = false;
+    init(nItemId, nItemBits, sal_False);
 }
 
 // -----------------------------------------------------------------------


More information about the Libreoffice-commits mailing list