summaryrefslogtreecommitdiffstats
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-21 15:27:33 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-04-21 15:27:33 +0100
commite367337e58047c4c69869330b36c1f027f5ca5f0 (patch)
tree465f7a5d478feae8a7e5e2894f1b26deb7dbcacd /svx
parentdraw all entries the same way (diff)
downloadcore-e367337e58047c4c69869330b36c1f027f5ca5f0.tar.gz
core-e367337e58047c4c69869330b36c1f027f5ca5f0.zip
split out the code that sets up the device for each entry
Change-Id: Iad426e1cb1eaac24edf1e7bb61307f29d33d8786
Diffstat (limited to 'svx')
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8817b224b1fd..a1c1c7d28cd3 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -158,6 +158,7 @@ private:
void ReleaseFocus();
Color TestColorsVisible(const Color &FontCol, const Color &BackCol);
+ void SetupEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
void UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
DECL_LINK( MenuSelectHdl, Menu * );
};
@@ -578,15 +579,9 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString
pDevice->DrawText(aPos, rStyleName);
}
-
-void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
+void SvxStyleBox_Impl::SetupEntry(const UserDrawEvent& rUDEvt, const OUString& rStyleName)
{
sal_uInt16 nItem = rUDEvt.GetItemId();
- OUString aStyleName( GetEntry( nItem ) );
-
- OutputDevice *pDevice = rUDEvt.GetDevice();
- pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
-
if (nItem == 0 || nItem == GetEntryCount() - 1)
{
Rectangle aRect(rUDEvt.GetRect());
@@ -605,7 +600,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
pStyle = pPool->First();
- while ( pStyle && OUString( pStyle->GetName() ) != aStyleName )
+ while (pStyle && pStyle->GetName() != rStyleName)
pStyle = pPool->Next();
}
@@ -618,6 +613,8 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
if ( pFontItem && pFontHeightItem )
{
+ OutputDevice *pDevice = rUDEvt.GetDevice();
+
Size aFontSize( 0, pFontHeightItem->GetHeight() );
Size aPixelSize( pDevice->LogicToPixel( aFontSize, pShell->GetMapUnit() ) );
@@ -743,6 +740,17 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
}
}
}
+}
+
+void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ sal_uInt16 nItem = rUDEvt.GetItemId();
+ OUString aStyleName( GetEntry( nItem ) );
+
+ OutputDevice *pDevice = rUDEvt.GetDevice();
+ pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
+
+ SetupEntry(rUDEvt, aStyleName);
UserDrawEntry(rUDEvt, aStyleName);
@@ -2097,7 +2105,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
{
const SfxStyleFamily eFamily = GetActFamily();
- sal_uInt16 nCount = pStyleSheetPool->Count();
+ sal_uInt16 nCount = pStyleSheetPool->Count();
SfxStyleSheetBase* pStyle = NULL;
bool bDoFill = false;