diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-11 09:41:13 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-11 10:03:29 +0900 |
commit | 25a0bd7b909fb8c87387d1413060f6c4ba5a51bd (patch) | |
tree | 69d3cdabb9c74ef29dd6e031156e09121e0eba39 /sw | |
parent | 69e233b75a024de60b677f2226d810cb11fe8f94 (diff) |
refactor TreeListBox to use RenderContext
Change-Id: I901a1f1f9732fb66718dca34c698a851e5b0d87f
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/inc/conttree.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 29 | ||||
-rw-r--r-- | sw/source/uibase/utlui/glbltree.cxx | 26 |
3 files changed, 28 insertions, 32 deletions
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index faf669d7136a..9421f16c1926 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -216,9 +216,8 @@ public: { } - 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; }; namespace sfx2 { class DocumentInserter; } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 1a08cde77132..5d2d3a412a89 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3463,9 +3463,8 @@ public: SwContentLBoxString( 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 SwContentTree::InitEntry(SvTreeListEntry* pEntry, @@ -3479,20 +3478,18 @@ void SwContentTree::InitEntry(SvTreeListEntry* pEntry, pEntry->ReplaceItem( pStr, nColToHilite ); } -void SwContentLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) +void SwContentLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { - if(lcl_IsContent(pEntry) && - static_cast<SwContent *>(pEntry->GetUserData())->IsInvisible()) + if (lcl_IsContent(pEntry) && static_cast<SwContent *>(pEntry->GetUserData())->IsInvisible()) { - vcl::Font aOldFont( rDev.GetFont()); + vcl::Font aOldFont(rRenderContext.GetFont()); vcl::Font aFont(aOldFont); - Color aCol( COL_LIGHTGRAY ); - aFont.SetColor( aCol ); - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - rDev.SetFont( aOldFont ); + Color aCol(COL_LIGHTGRAY); + aFont.SetColor(aCol); + rRenderContext.SetFont(aFont ); + rRenderContext.DrawText(rPos, GetText()); + rRenderContext.SetFont(aOldFont); } // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this /* @@ -3513,10 +3510,10 @@ void SwContentLBoxString::Paint( } */ else - SvLBoxString::Paint( rPos, rDev, pView, pEntry); + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); } -void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt ) +void SwContentTree::DataChanged(const DataChangedEvent& rDCEvt) { if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 38505c695eab..bf2b8fe79c55 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -1238,24 +1238,24 @@ void SwGlobalTree::InitEntry(SvTreeListEntry* pEntry, pEntry->ReplaceItem( pStr, nColToHilite ); } -void SwLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) +void SwLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { SwGlblDocContent* pCont = static_cast<SwGlblDocContent*>(pEntry->GetUserData()); - if(pCont->GetType() == GLBLDOC_SECTION && - !(pCont->GetSection())->IsConnectFlag() ) + if (pCont->GetType() == GLBLDOC_SECTION && + !(pCont->GetSection())->IsConnectFlag()) { - vcl::Font aOldFont( rDev.GetFont()); - vcl::Font aFont(aOldFont); - Color aCol( COL_LIGHTRED ); - aFont.SetColor( aCol ); - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - rDev.SetFont( aOldFont ); + rRenderContext.Push(PushFlags::FONT); + vcl::Font aOldFont(rRenderContext.GetFont()); + vcl::Font aFont(rRenderContext.GetFont()); + Color aCol(COL_LIGHTRED); + aFont.SetColor(aCol); + rRenderContext.SetFont(aFont); + rRenderContext.DrawText(rPos, GetText()); + rRenderContext.Pop(); } else - SvLBoxString::Paint( rPos, rDev, pView, pEntry); + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); } void SwGlobalTree::DataChanged( const DataChangedEvent& rDCEvt ) |