From 25a0bd7b909fb8c87387d1413060f6c4ba5a51bd Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 11 May 2015 09:41:13 +0900 Subject: refactor TreeListBox to use RenderContext Change-Id: I901a1f1f9732fb66718dca34c698a851e5b0d87f --- svx/source/dialog/ctredlin.cxx | 14 ++++++-------- svx/source/dialog/docrecovery.cxx | 28 ++++++++++++++-------------- svx/source/dialog/fontlb.cxx | 27 +++++++++++++-------------- 3 files changed, 33 insertions(+), 36 deletions(-) (limited to 'svx/source/dialog') 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(&aDevice); - TURLInfo* pInfo = static_cast(pEntry->GetUserData()); - switch(pInfo->RecoveryState) + TURLInfo* pInfo = static_cast(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 ) -- cgit