summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2013-02-21 22:56:21 +0100
committerMichael Stahl <mstahl@redhat.com>2013-02-22 16:41:42 +0000
commit5dff2d0822bb299c134a05a64747ce1bb42ad7cd (patch)
tree1d009c840964cd7ae64cb7297393603df5005149 /vcl
parent6b59ccd5d4edb981496122a2d78cedaa052f0c70 (diff)
Replace duplicate code from ImplToolItem constructors with init method
Change-Id: I2e2950045d8970eec3d1e04269bfe2ecbc9c3e6f Reviewed-on: https://gerrit.libreoffice.org/2267 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/toolbox.h3
-rw-r--r--vcl/source/window/toolbox2.cxx69
2 files changed, 18 insertions, 54 deletions
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 0547e578b257..7fa82d9da609 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 081f524d0d34..85f7ca9c8830 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);
}
// -----------------------------------------------------------------------