summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-11 09:41:13 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-11 10:03:29 +0900
commit25a0bd7b909fb8c87387d1413060f6c4ba5a51bd (patch)
tree69d3cdabb9c74ef29dd6e031156e09121e0eba39 /cui
parent69e233b75a024de60b677f2226d810cb11fe8f94 (diff)
refactor TreeListBox to use RenderContext
Change-Id: I901a1f1f9732fb66718dca34c698a851e5b0d87f
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/acccfg.cxx12
-rw-r--r--cui/source/customize/cfg.cxx24
-rw-r--r--cui/source/customize/macropg.cxx35
-rw-r--r--cui/source/dialogs/thesdlg.cxx21
-rw-r--r--cui/source/dialogs/thesdlg_impl.hxx4
-rw-r--r--cui/source/options/optHeaderTabListbox.cxx22
-rw-r--r--cui/source/options/optlingu.cxx54
-rw-r--r--cui/source/tabpages/autocdlg.cxx42
8 files changed, 104 insertions, 110 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index e4d803dce9f8..42e2f98090df 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -624,8 +624,8 @@ public:
virtual ~SfxAccCfgLBoxString_Impl();
- virtual void Paint(
- const Point& aPos, SvTreeListBox& rDevice, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& aPos, SvTreeListBox& rDevice, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
@@ -636,8 +636,8 @@ SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl(SvTreeListEntry* pEntry, sal_
SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl()
{}
-void SfxAccCfgLBoxString_Impl::Paint(
- const Point& aPos, SvTreeListBox& rDevice, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
+void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
if (!pEntry)
return;
@@ -647,9 +647,9 @@ void SfxAccCfgLBoxString_Impl::Paint(
return;
if (pUserData->m_bIsConfigurable)
- rDevice.DrawText(aPos, GetText());
+ rRenderContext.DrawText(aPos, GetText());
else
- rDevice.DrawCtrlText(aPos, GetText(), 0, -1, TEXT_DRAW_DISABLE);
+ rRenderContext.DrawCtrlText(aPos, GetText(), 0, -1, TEXT_DRAW_DISABLE);
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index f902a15c10f0..435bc82555d1 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1327,18 +1327,18 @@ public:
virtual ~PopupPainter() { }
- virtual void Paint( const Point& rPos, SvTreeListBox& rOutDev,
- const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE
{
- SvLBoxString::Paint(rPos, rOutDev, pView, pEntry);
+ SvLBoxString::Paint(rPos, rOutDev, rRenderContext, pView, pEntry);
- Color aOldFillColor = rOutDev.GetFillColor();
+ rRenderContext.Push(PushFlags::FILLCOLOR);
- SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >( &rOutDev );
+ SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >(&rOutDev);
long nX = pTreeBox->GetSizePixel().Width();
ScrollBar* pVScroll = pTreeBox->GetVScroll();
- if ( pVScroll->IsVisible() )
+ if (pVScroll->IsVisible())
{
nX -= pVScroll->GetSizePixel().Width();
}
@@ -1350,23 +1350,23 @@ public:
long nHalfSize = nSize / 2;
long nY = rPos.Y() + nHalfSize;
- if ( aOldFillColor == COL_WHITE )
+ if (rRenderContext.GetFillColor() == COL_WHITE)
{
- rOutDev.SetFillColor( Color( COL_BLACK ) );
+ rRenderContext.SetFillColor(Color(COL_BLACK));
}
else
{
- rOutDev.SetFillColor( Color( COL_WHITE ) );
+ rRenderContext.SetFillColor(Color(COL_WHITE));
}
long n = 0;
- while ( n <= nHalfSize )
+ while (n <= nHalfSize)
{
- rOutDev.DrawRect( Rectangle( nX+n, nY+n, nX+n, nY+nSize-n ) );
+ rRenderContext.DrawRect(Rectangle(nX + n, nY + n, nX + n, nY + nSize - n));
++n;
}
- rOutDev.SetFillColor( aOldFillColor );
+ rRenderContext.Pop();
}
};
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index c675ef137ab3..b0b964c6f794 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -67,10 +67,10 @@ _SvxMacroTabPage_Impl::_SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet )
// attention, this array is indexed directly (0, 1, ...) in the code
static long nTabs[] =
- {
- 2, // Number of Tabs
- 0, 90
- };
+{
+ 2, // Number of Tabs
+ 0, 90
+};
#define TAB_WIDTH_MIN 10
@@ -450,8 +450,8 @@ class IconLBoxString : public SvLBoxString
public:
IconLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& sText,
Image* pMacroImg, Image* pComponentImg );
- virtual void Paint(
- const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
@@ -465,34 +465,33 @@ IconLBoxString::IconLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, cons
}
-void IconLBoxString::Paint(
- const Point& aPos, SvTreeListBox& aDevice, const SvViewDataEntry* /*pView*/,
- const SvTreeListEntry* /*pEntry*/)
+void IconLBoxString::Paint(const Point& aPos, SvTreeListBox& /*aDevice*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
{
- OUString aTxt( GetText() );
- if( !aTxt.isEmpty() )
+ OUString aTxt(GetText());
+ if (!aTxt.isEmpty())
{
- OUString aURL( aTxt );
- sal_Int32 nIndex = aURL.indexOf( aVndSunStarUNO );
+ OUString aURL(aTxt);
+ sal_Int32 nIndex = aURL.indexOf(aVndSunStarUNO);
bool bUNO = nIndex == 0;
const Image* pImg = bUNO ? m_pComponentImg : m_pMacroImg;
- aDevice.DrawImage( aPos, *pImg );
+ rRenderContext.DrawImage(aPos, *pImg);
OUString aPureMethod;
- if( bUNO )
+ if (bUNO)
{
- aPureMethod = aURL.copy( strlen(aVndSunStarUNO) );
+ aPureMethod = aURL.copy(strlen(aVndSunStarUNO));
}
else
{
- aPureMethod = aURL.copy( strlen(aVndSunStarScript) );
+ aPureMethod = aURL.copy(strlen(aVndSunStarScript));
aPureMethod = aPureMethod.copy( 0, aPureMethod.indexOf( '?' ) );
}
Point aPnt(aPos);
aPnt.X() += m_nxImageOffset;
- aDevice.DrawText( aPnt, aPureMethod );
+ rRenderContext.DrawText(aPnt, aPureMethod);
}
}
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index a8566ea5e015..781cb1542396 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -146,24 +146,23 @@ AlternativesString::AlternativesString(
{
}
-void AlternativesString::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
- const SvTreeListEntry* pEntry)
+void AlternativesString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
- AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry );
- Point aPos( rPos );
- vcl::Font aOldFont( rDev.GetFont());
+ AlternativesExtraData* pData = m_rControlImpl.GetExtraData(pEntry);
+ Point aPos(rPos);
+ rRenderContext.Push(PushFlags::FONT);
if (pData && pData->IsHeader())
{
- vcl::Font aFont( aOldFont );
- aFont.SetWeight( WEIGHT_BOLD );
- rDev.SetFont( aFont );
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
+ rRenderContext.SetFont(aFont);
aPos.X() = 0;
}
else
aPos.X() += 5;
- rDev.DrawText( aPos, GetText() );
- rDev.SetFont( aOldFont );
+ rRenderContext.DrawText(aPos, GetText());
+ rRenderContext.Pop();
}
ThesaurusAlternativesCtrl::ThesaurusAlternativesCtrl(vcl::Window* pParent)
diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx
index 8211897ef711..25b09f51d754 100644
--- a/cui/source/dialogs/thesdlg_impl.hxx
+++ b/cui/source/dialogs/thesdlg_impl.hxx
@@ -53,8 +53,8 @@ public:
AlternativesString( ThesaurusAlternativesCtrl &rControl,
SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr );
- virtual void Paint(
- const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
#endif
diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx
index 56f46dbc0ada..2162707f839a 100644
--- a/cui/source/options/optHeaderTabListbox.cxx
+++ b/cui/source/options/optHeaderTabListbox.cxx
@@ -34,23 +34,23 @@ public:
OptLBoxString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rTxt ) :
SvLBoxString( pEntry, nFlags, rTxt ) {}
- virtual void Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
-void OptLBoxString_Impl::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
+void OptLBoxString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
- vcl::Font aOldFont( rDev.GetFont() );
- vcl::Font aFont( aOldFont );
+ rRenderContext.Push(PushFlags::FONT);
+ vcl::Font aFont(rRenderContext.GetFont());
//detect readonly state by asking for a valid Image
- if(pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry)))
- aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
- rDev.SetFont( aFont );
- rDev.DrawText( rPos, GetText() );
- rDev.SetFont( aOldFont );
+ if (pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry)))
+ aFont.SetColor(Application::GetSettings().GetStyleSettings().GetDeactiveTextColor());
+ rRenderContext.SetFont(aFont);
+ rRenderContext.DrawText(rPos, GetText());
+ rRenderContext.Pop();
}
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 12ef87645a1b..3c535f85e544 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -263,28 +263,27 @@ public:
BrwStringDic_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags,
const OUString& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {}
- virtual void Paint(
- const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
-void BrwStringDic_Impl::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
- const SvTreeListEntry* pEntry)
+void BrwStringDic_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
ModuleUserData_Impl* pData = static_cast<ModuleUserData_Impl*>(pEntry->GetUserData());
Point aPos(rPos);
- vcl::Font aOldFont( rDev.GetFont());
- if(pData->IsParent())
+ rRenderContext.Push(PushFlags::FONT);
+ if (pData->IsParent())
{
- vcl::Font aFont( aOldFont );
- aFont.SetWeight( WEIGHT_BOLD );
- rDev.SetFont( aFont );
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
+ rRenderContext.SetFont(aFont);
aPos.X() = 0;
}
else
aPos.X() += 5;
- rDev.DrawText( aPos, GetText() );
- rDev.SetFont( aOldFont );
+ rRenderContext.DrawText(aPos, GetText());
+ rRenderContext.Pop();
}
/*--------------------------------------------------
@@ -441,36 +440,35 @@ public:
BrwString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags,
const OUString& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {}
- virtual void Paint(
- const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
-void BrwString_Impl::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
- const SvTreeListEntry* pEntry)
+void BrwString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
Point aPos(rPos);
aPos.X() += 20;
- rDev.DrawText( aPos, GetText() );
- if(pEntry->GetUserData())
+ rRenderContext.DrawText(aPos, GetText());
+ if (pEntry->GetUserData())
{
Point aNewPos(aPos);
- aNewPos.X() += rDev.GetTextWidth(GetText());
- vcl::Font aOldFont( rDev.GetFont());
- vcl::Font aFont( aOldFont );
- aFont.SetWeight( WEIGHT_BOLD );
+ aNewPos.X() += rRenderContext.GetTextWidth(GetText());
+ rRenderContext.Push(PushFlags::FONT);
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
//??? convert the lower byte from the user date into a string
- OptionsUserData aData( reinterpret_cast<sal_uLong>( pEntry->GetUserData() ) );
- if(aData.HasNumericValue())
+ OptionsUserData aData(reinterpret_cast<sal_uLong>(pEntry->GetUserData()));
+ if (aData.HasNumericValue())
{
OUStringBuffer sTxt;
sTxt.append(' ').append(static_cast<sal_Int32>(aData.GetNumericValue()));
- rDev.SetFont( aFont );
- rDev.DrawText( aNewPos, sTxt.makeStringAndClear() );
+ rRenderContext.SetFont(aFont);
+ rRenderContext.DrawText(aNewPos, sTxt.makeStringAndClear());
}
- rDev.SetFont( aOldFont );
+ rRenderContext.Pop();
}
}
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 35276a456461..259a28f05fb3 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -334,49 +334,47 @@ public:
OfaImpBrwString( SvTreeListEntry* pEntry, sal_uInt16 nFlags,
const OUString& rStr ) : SvLBoxString(pEntry,nFlags,rStr){}
- virtual void Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView,
- const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
};
-void OfaImpBrwString::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
- const SvTreeListEntry* pEntry)
+void OfaImpBrwString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
- rDev.DrawText( rPos, GetText() );
- if(pEntry->GetUserData())
+ rRenderContext.DrawText(rPos, GetText());
+ if (pEntry->GetUserData())
{
ImpUserData* pUserData = static_cast<ImpUserData*>(pEntry->GetUserData());
Point aNewPos(rPos);
- aNewPos.X() += rDev.GetTextWidth(GetText());
- vcl::Font aOldFont( rDev.GetFont());
- vcl::Font aFont( aOldFont );
- if(pUserData->pFont)
+ aNewPos.X() += rRenderContext.GetTextWidth(GetText());
+ vcl::Font aOldFont(rRenderContext.GetFont());
+ vcl::Font aFont(aOldFont);
+ if (pUserData->pFont)
{
aFont = *pUserData->pFont;
aFont.SetColor(aOldFont.GetColor());
aFont.SetSize(aOldFont.GetSize());
}
- aFont.SetWeight( WEIGHT_BOLD );
+ aFont.SetWeight(WEIGHT_BOLD);
bool bFett = true;
sal_Int32 nPos = 0;
do {
- OUString sTxt( pUserData->pString->getToken( 0, 1, nPos ));
+ OUString sTxt(pUserData->pString->getToken(0, 1, nPos));
- if( bFett )
- rDev.SetFont( aFont );
+ if (bFett)
+ rRenderContext.SetFont(aFont);
- rDev.DrawText( aNewPos, sTxt );
+ rRenderContext.DrawText(aNewPos, sTxt);
- if( -1 != nPos )
- aNewPos.X() += rDev.GetTextWidth( sTxt );
+ if (-1 != nPos)
+ aNewPos.X() += rRenderContext.GetTextWidth(sTxt);
- if( bFett )
- rDev.SetFont( aOldFont );
+ if (bFett)
+ rRenderContext.SetFont(aOldFont);
bFett = !bFett;
- } while( -1 != nPos );
+ } while(-1 != nPos);
}
}