summaryrefslogtreecommitdiff
path: root/svx/source
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 /svx/source
parent69e233b75a024de60b677f2226d810cb11fe8f94 (diff)
refactor TreeListBox to use RenderContext
Change-Id: I901a1f1f9732fb66718dca34c698a851e5b0d87f
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/dialog/ctredlin.cxx14
-rw-r--r--svx/source/dialog/docrecovery.cxx28
-rw-r--r--svx/source/dialog/fontlb.cxx27
-rw-r--r--svx/source/form/filtnav.cxx52
-rw-r--r--svx/source/inc/docrecovery.hxx4
5 files changed, 61 insertions, 64 deletions
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 27d580a2000c..457bfddedb6d 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -79,18 +79,16 @@ SvLBoxItem* SvLBoxColorString::Create() const
return new SvLBoxColorString;
}
-void SvLBoxColorString::Paint(
- const Point& rPos, SvTreeListBox& rDev,
- const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
+void SvLBoxColorString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
{
- Color aColor=rDev.GetTextColor();
- Color a2Color=aColor;
+ Color aColor = rRenderContext.GetTextColor();
if (!pView->IsSelected())
{
- rDev.SetTextColor(aPrivColor);
+ rRenderContext.SetTextColor(aPrivColor);
}
- SvLBoxString::Paint(rPos, rDev, pView, pEntry);
- rDev.SetTextColor(a2Color);
+ SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry);
+ rRenderContext.SetTextColor(aColor);
}
SvxRedlinTable::SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits)
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index b7b32b35f6cf..f431a55334b0 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -767,45 +767,45 @@ RecovDocListEntry::RecovDocListEntry( SvTreeListEntry* pEntry,
}
-void RecovDocListEntry::Paint(
- const Point& aPos, SvTreeListBox& aDevice, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
+void RecovDocListEntry::Paint(const Point& aPos, SvTreeListBox& aDevice, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
- const Image* pImg = 0;
- const OUString* pTxt = 0;
- RecovDocList* pList = static_cast< RecovDocList* >(&aDevice);
+ const Image* pImg = 0;
+ const OUString* pTxt = 0;
+ RecovDocList* pList = static_cast<RecovDocList*>(&aDevice);
- TURLInfo* pInfo = static_cast<TURLInfo*>(pEntry->GetUserData());
- switch(pInfo->RecoveryState)
+ TURLInfo* pInfo = static_cast<TURLInfo*>(pEntry->GetUserData());
+ switch (pInfo->RecoveryState)
{
- case E_SUCCESSFULLY_RECOVERED :
+ case E_SUCCESSFULLY_RECOVERED:
{
pImg = &pList->m_aGreenCheckImg;
pTxt = &pList->m_aSuccessRecovStr;
}
break;
- case E_ORIGINAL_DOCUMENT_RECOVERED : // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow
+ case E_ORIGINAL_DOCUMENT_RECOVERED: // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow
{
pImg = &pList->m_aYellowCheckImg;
pTxt = &pList->m_aOrigDocRecovStr;
}
break;
- case E_RECOVERY_FAILED :
+ case E_RECOVERY_FAILED:
{
pImg = &pList->m_aRedCrossImg;
pTxt = &pList->m_aRecovFailedStr;
}
break;
- case E_RECOVERY_IS_IN_PROGRESS :
+ case E_RECOVERY_IS_IN_PROGRESS:
{
pImg = 0;
pTxt = &pList->m_aRecovInProgrStr;
}
break;
- case E_NOT_RECOVERED_YET :
+ case E_NOT_RECOVERED_YET:
{
pImg = 0;
pTxt = &pList->m_aNotRecovYetStr;
@@ -814,14 +814,14 @@ void RecovDocListEntry::Paint(
}
if (pImg)
- aDevice.DrawImage(aPos, *pImg);
+ rRenderContext.DrawImage(aPos, *pImg);
if (pTxt)
{
Point aPnt(aPos);
aPnt.X() += pList->m_aGreenCheckImg.GetSizePixel().Width();
aPnt.X() += 10;
- aDevice.DrawText(aPnt, *pTxt);
+ rRenderContext.DrawText(aPnt, *pTxt);
}
}
diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx
index d36bc4291d44..6b7d1ada0859 100644
--- a/svx/source/dialog/fontlb.cxx
+++ b/svx/source/dialog/fontlb.cxx
@@ -37,36 +37,35 @@ SvLBoxFontString::SvLBoxFontString(
maFont( rFont ),
mbUseColor( pColor != NULL )
{
- SetText( rString );
- if( pColor )
- maFont.SetColor( *pColor );
+ SetText(rString);
+ if(pColor)
+ maFont.SetColor(*pColor);
}
SvLBoxFontString::~SvLBoxFontString()
{
}
-
SvLBoxItem* SvLBoxFontString::Create() const
{
return new SvLBoxFontString;
}
-void SvLBoxFontString::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
+void SvLBoxFontString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
{
- vcl::Font aOldFont( rDev.GetFont() );
- vcl::Font aNewFont( maFont );
+ rRenderContext.Push(PushFlags::FONT);
+ vcl::Font aNewFont(maFont);
bool bSel = pView->IsSelected();
- if( !mbUseColor || bSel ) // selection always gets highlight color
+ if (!mbUseColor || bSel) // selection always gets highlight color
{
- const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
- aNewFont.SetColor( bSel ? rSett.GetHighlightTextColor() : rSett.GetFieldTextColor() );
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ aNewFont.SetColor(bSel ? rStyleSettings.GetHighlightTextColor() : rStyleSettings.GetFieldTextColor());
}
- rDev.SetFont( aNewFont );
- SvLBoxString::Paint(rPos, rDev, pView, pEntry);
- rDev.SetFont( aOldFont );
+ rRenderContext.SetFont(aNewFont);
+ SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry);
+ rRenderContext.Pop();
}
void SvLBoxFontString::InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData )
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index b255e72a84d9..906a6ffec33c 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1014,43 +1014,42 @@ public:
FmFilterItemsString( 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;
virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) SAL_OVERRIDE;
};
const int nxDBmp = 12;
-void FmFilterItemsString::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
+void FmFilterItemsString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
FmFilterItems* pRow = static_cast<FmFilterItems*>(pEntry->GetUserData());
FmFormItem* pForm = static_cast<FmFormItem*>(pRow->GetParent());
// current filter is significant painted
const bool bIsCurrentFilter = pForm->GetChildren()[ pForm->GetFilterController()->getActiveTerm() ] == pRow;
- if ( bIsCurrentFilter )
+ if (bIsCurrentFilter)
{
- rDev.Push( PushFlags::LINECOLOR );
+ rRenderContext.Push(PushFlags::LINECOLOR);
+ rRenderContext.SetLineColor(rRenderContext.GetTextColor());
- rDev.SetLineColor( rDev.GetTextColor() );
+ Rectangle aRect(rPos, GetSize(&rDev, pEntry));
+ Point aFirst(rPos.X(), aRect.Bottom() - 6);
+ Point aSecond(aFirst .X() + 2, aFirst.Y() + 3);
- Rectangle aRect( rPos, GetSize( &rDev, pEntry ) );
- Point aFirst( rPos.X(), aRect.Bottom() - 6 );
- Point aSecond(aFirst .X() + 2, aFirst.Y() + 3 );
-
- rDev.DrawLine( aFirst, aSecond );
+ rRenderContext.DrawLine(aFirst, aSecond);
aFirst = aSecond;
aFirst.X() += 1;
aSecond.X() += 6;
aSecond.Y() -= 5;
- rDev.DrawLine( aFirst, aSecond );
-
- rDev.Pop();
+ rRenderContext.DrawLine(aFirst, aSecond);
+ rRenderContext.Pop();
}
- rDev.DrawText( Point(rPos.X() + nxDBmp, rPos.Y()), GetText() );
+ rRenderContext.DrawText(Point(rPos.X() + nxDBmp, rPos.Y()), GetText());
}
@@ -1070,13 +1069,14 @@ class FmFilterString : public SvLBoxString
public:
FmFilterString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr, const OUString& aName)
- :SvLBoxString(pEntry,nFlags,rStr)
- ,m_aName(aName)
+ : SvLBoxString(pEntry,nFlags,rStr)
+ , m_aName(aName)
{
m_aName += ": ";
}
- 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;
virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) SAL_OVERRIDE;
};
@@ -1100,21 +1100,21 @@ void FmFilterString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
}
-void FmFilterString::Paint(
- const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
+void FmFilterString::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());
aFont.SetWeight(WEIGHT_BOLD);
- rDev.SetFont( aFont );
+ rRenderContext.SetFont(aFont);
Point aPos(rPos);
- rDev.DrawText( aPos, m_aName );
+ rRenderContext.DrawText(aPos, m_aName);
// position for the second text
aPos.X() += rDev.GetTextWidth(m_aName) + nxD;
- rDev.SetFont( aOldFont );
- rDev.DrawText( aPos, GetText() );
+ rRenderContext.Pop();
+ rDev.DrawText(aPos, GetText());
}
FmFilterNavigator::FmFilterNavigator( vcl::Window* pParent )
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
index 326260e42f52..207295015903 100644
--- a/svx/source/inc/docrecovery.hxx
+++ b/svx/source/inc/docrecovery.hxx
@@ -454,8 +454,8 @@ public:
/** @short TODO */
- 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;
};