diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-15 16:48:26 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-15 17:10:23 +0900 |
commit | a18d743fbcad62111667b60a61284eff5ca0835a (patch) | |
tree | b84de72e0f9b5b4c9ae4acc32c2431a7b22678d0 /sw | |
parent | ce17f392522ac9d77bd9ffb409a349f5e65efa83 (diff) |
refactor swruler to use RenderContext
Change-Id: I16e1888900478c000c4437299357276e20c197c0
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/inc/swruler.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/misc/swruler.cxx | 46 |
2 files changed, 25 insertions, 25 deletions
diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx index 8f5fb4659af8..4136026ecba4 100644 --- a/sw/source/uibase/inc/swruler.hxx +++ b/sw/source/uibase/inc/swruler.hxx @@ -87,7 +87,7 @@ protected: /** * Paint the comment control on VirtualDevice. */ - void DrawCommentControl(); + void DrawCommentControl(vcl::RenderContext& rRenderContext); /** * Draw a little horizontal arrow tip on VirtualDevice. * \param nX left coordinate of arrow @@ -95,7 +95,7 @@ protected: * \param Color arrow color * \param bPointRight if arrow should point to right. Otherwise, it will point left. */ - void ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight); + void ImplDrawArrow(vcl::RenderContext& rRenderContext, long nX, long nY, const Color& rColor, bool bPointRight); /** * Update the tooltip text. diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx index b462d36cb2b1..665ca0f6e08d 100644 --- a/sw/source/uibase/misc/swruler.cxx +++ b/sw/source/uibase/misc/swruler.cxx @@ -63,19 +63,19 @@ void SwCommentRuler::dispose() void SwCommentRuler::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { SvxRuler::Paint(rRenderContext, rRect); + // Don't draw if there is not any note - if ( mpViewShell->GetPostItMgr() - && mpViewShell->GetPostItMgr()->HasNotes() ) - DrawCommentControl(); + if (mpViewShell->GetPostItMgr() && mpViewShell->GetPostItMgr()->HasNotes()) + DrawCommentControl(rRenderContext); } -void SwCommentRuler::DrawCommentControl() +void SwCommentRuler::DrawCommentControl(vcl::RenderContext& rRenderContext) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes(); Rectangle aControlRect = GetCommentControlRegion(); - maVirDev->SetOutputSizePixel( aControlRect.GetSize() ); + maVirDev->SetOutputSizePixel(aControlRect.GetSize()); // Paint comment control background // TODO Check if these are best colors to be used @@ -148,30 +148,30 @@ void SwCommentRuler::DrawCommentControl() // Draw arrow // FIXME consistence of button colors. http://opengrok.libreoffice.org/xref/core/vcl/source/control/button.cxx#785 - Color aArrowColor = GetFadedColor( Color( COL_BLACK ), rStyleSettings.GetShadowColor() ); - ImplDrawArrow ( aArrowPos.X(), aArrowPos.Y(), aArrowColor, bArrowToRight ); + Color aArrowColor = GetFadedColor(Color(COL_BLACK), rStyleSettings.GetShadowColor()); + ImplDrawArrow(*maVirDev.get(), aArrowPos.X(), aArrowPos.Y(), aArrowColor, bArrowToRight); // Blit comment control - DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), *maVirDev.get() ); + rRenderContext.DrawOutDev(aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), *maVirDev.get()); } -void SwCommentRuler::ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight) +void SwCommentRuler::ImplDrawArrow(vcl::RenderContext& rRenderContext, long nX, long nY, const Color& rColor, bool bPointRight) { - maVirDev->SetLineColor(); - maVirDev->SetFillColor( rColor ); - if ( bPointRight ) + rRenderContext.SetLineColor(); + rRenderContext.SetFillColor(rColor); + if (bPointRight) { - maVirDev->DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) ); - maVirDev->DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) ); - maVirDev->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) ); - maVirDev->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); + rRenderContext.DrawRect(Rectangle(nX + 0, nY + 0, nX + 0, nY + 6) ); + rRenderContext.DrawRect(Rectangle(nX + 1, nY + 1, nX + 1, nY + 5) ); + rRenderContext.DrawRect(Rectangle(nX + 2, nY + 2, nX + 2, nY + 4) ); + rRenderContext.DrawRect(Rectangle(nX + 3, nY + 3, nX + 3, nY + 3) ); } else { - maVirDev->DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) ); - maVirDev->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) ); - maVirDev->DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) ); - maVirDev->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); + rRenderContext.DrawRect(Rectangle(nX + 0, nY + 3, nX + 0, nY + 3)); + rRenderContext.DrawRect(Rectangle(nX + 1, nY + 2, nX + 1, nY + 4)); + rRenderContext.DrawRect(Rectangle(nX + 2, nY + 1, nX + 2, nY + 5)); + rRenderContext.DrawRect(Rectangle(nX + 3, nY + 0, nX + 3, nY + 6)); } } @@ -281,11 +281,11 @@ Rectangle SwCommentRuler::GetCommentControlRegion() Color SwCommentRuler::GetFadedColor(const Color &rHighColor, const Color &rLowColor) { - if ( ! maFadeTimer.IsActive() ) + if (!maFadeTimer.IsActive()) return mbIsHighlighted ? rHighColor : rLowColor; Color aColor = rHighColor; - aColor.Merge( rLowColor, mnFadeRate * 255/100.f ); + aColor.Merge(rLowColor, mnFadeRate * 255 / 100.0f); return aColor; } |