diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-02 16:57:30 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-02 19:29:43 +0200 |
commit | fca99395ad3c3310aa04d5ff725b4a82fc17826e (patch) | |
tree | 2ba22aabf7af9d6259f539a5c9ca1819bc6c41b6 /sc | |
parent | d146b3cb76887a5f31970124762c045379592499 (diff) |
no need for dynamic array of XubStrings
Change-Id: I7a25917a2bec3ecd394444f057c892b3b02a4c3d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/sidebar/CellLineStyleControl.cxx | 31 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellLineStyleControl.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellLineStyleValueSet.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellLineStyleValueSet.hxx | 6 |
4 files changed, 21 insertions, 29 deletions
diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx index 339eff356dfb..39e140a82a39 100644 --- a/sc/source/ui/sidebar/CellLineStyleControl.cxx +++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx @@ -36,18 +36,12 @@ CellLineStyleControl::CellLineStyleControl(Window* pParent, CellAppearanceProper mrCellAppearancePropertyPanel(rPanel), maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)), maCellLineStyleValueSet(this, ScResId(VS_STYLE)), - mpStr(0), mbVSfocus(true) { Initialize(); FreeResource(); } -CellLineStyleControl::~CellLineStyleControl(void) -{ - delete[] mpStr; -} - void CellLineStyleControl::Initialize() { //maPushButtonMoreOptions.SetIcoPosX(2); @@ -63,21 +57,20 @@ void CellLineStyleControl::Initialize() maCellLineStyleValueSet.InsertItem(i); } - mpStr = new XubString[9]; - mpStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ).AppendAscii("pt"); - mpStr[1] = GetSettings().GetLocaleI18nHelper().GetNum( 250, 2 ).AppendAscii("pt"); - mpStr[2] = GetSettings().GetLocaleI18nHelper().GetNum( 400, 2 ).AppendAscii("pt"); - mpStr[3] = GetSettings().GetLocaleI18nHelper().GetNum( 500, 2 ).AppendAscii("pt"); - mpStr[4] = GetSettings().GetLocaleI18nHelper().GetNum( 110, 2 ).AppendAscii("pt"); - mpStr[5] = GetSettings().GetLocaleI18nHelper().GetNum( 260, 2 ).AppendAscii("pt"); - mpStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ).AppendAscii("pt"); - mpStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ).AppendAscii("pt"); - mpStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ).AppendAscii("pt"); - maCellLineStyleValueSet.SetUnit(mpStr); + maStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ).AppendAscii("pt"); + maStr[1] = GetSettings().GetLocaleI18nHelper().GetNum( 250, 2 ).AppendAscii("pt"); + maStr[2] = GetSettings().GetLocaleI18nHelper().GetNum( 400, 2 ).AppendAscii("pt"); + maStr[3] = GetSettings().GetLocaleI18nHelper().GetNum( 500, 2 ).AppendAscii("pt"); + maStr[4] = GetSettings().GetLocaleI18nHelper().GetNum( 110, 2 ).AppendAscii("pt"); + maStr[5] = GetSettings().GetLocaleI18nHelper().GetNum( 260, 2 ).AppendAscii("pt"); + maStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ).AppendAscii("pt"); + maStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ).AppendAscii("pt"); + maStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ).AppendAscii("pt"); + maCellLineStyleValueSet.SetUnit(&maStr[0]); - for(sal_uInt16 i = 1 ; i <= 9 ; i++) + for (sal_uInt16 i = 1; i <= CELL_LINE_STYLE_ENTRIES; ++i) { - maCellLineStyleValueSet.SetItemText(i, mpStr[i-1]); + maCellLineStyleValueSet.SetItemText(i, maStr[i-1]); } SetAllNoSel(); diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx index d7d47dad1f18..d2da90c2ff06 100644 --- a/sc/source/ui/sidebar/CellLineStyleControl.hxx +++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx @@ -32,7 +32,7 @@ private: CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; PushButton maPushButtonMoreOptions; CellLineStyleValueSet maCellLineStyleValueSet; - XubString* mpStr; + OUString maStr[CELL_LINE_STYLE_ENTRIES]; /// bitfield bool mbVSfocus : 1; @@ -45,7 +45,6 @@ private: public: CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); - virtual ~CellLineStyleControl(void); void GetFocus(); void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx index fc8e5e58bbae..b0935031a45e 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -27,7 +27,6 @@ CellLineStyleValueSet::CellLineStyleValueSet( Window* pParent, const ResId& rRes nSelItem(0), bCusEnable(false) { - strUnit = new XubString[9]; SetColCount( 1 ); SetLineCount( 9); } @@ -35,14 +34,13 @@ CellLineStyleValueSet::CellLineStyleValueSet( Window* pParent, const ResId& rRes CellLineStyleValueSet::~CellLineStyleValueSet() { delete pVDev; - delete[] strUnit; } -void CellLineStyleValueSet::SetUnit(XubString* str) +void CellLineStyleValueSet::SetUnit(const OUString* str) { - for(int i = 0; i < 9; i++) + for (int i = 0; i < CELL_LINE_STYLE_ENTRIES; ++i) { - strUnit[i] = str[i]; + maStrUnit[i] = str[i]; } } @@ -121,7 +119,7 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) pDev->SetFont(aFont); Point aStart(aBLPos.X() + nRectWidth * 7 / 9 - 5 , aBLPos.Y() + nRectHeight/6); - pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here, or the text will disapear + pDev->DrawText(aStart, maStrUnit[nItemId - 1]); //can't set TEXT_DRAW_ENDELLIPSIS here, or the text will disapear //draw line if( nSelItem == nItemId ) diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx index ebdfa53f2956..6044b998037f 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx @@ -21,6 +21,8 @@ #include <svtools/valueset.hxx> #include <vcl/image.hxx> +#define CELL_LINE_STYLE_ENTRIES 9 + namespace sc { namespace sidebar { class CellLineStyleValueSet : public ValueSet @@ -28,14 +30,14 @@ class CellLineStyleValueSet : public ValueSet private: VirtualDevice* pVDev; sal_uInt16 nSelItem; - XubString* strUnit; + OUString maStrUnit[CELL_LINE_STYLE_ENTRIES]; Image imgCus; bool bCusEnable; public: CellLineStyleValueSet( Window* pParent, const ResId& rResId); virtual ~CellLineStyleValueSet(); - void SetUnit(XubString* str); + void SetUnit(const OUString* str); void SetSelItem(sal_uInt16 nSel); sal_uInt16 GetSelItem(); void SetImage(Image img); |