summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-14 18:33:31 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-15 08:56:25 +0900
commit85b7494e34ccf6b56d68554b7f32c0bebe5a6fed (patch)
tree58057860cbb12f90cf9ba4bb476f71b0f209fda0 /sc
parent763858b2ce2d5751bbf533b21847a5fd9b5fec61 (diff)
refactor ScTabSplitter to use RenderContext
Change-Id: I0822bf2fc8752efa16add193b2860c6f9f9668e3
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/tabsplit.cxx59
1 files changed, 30 insertions, 29 deletions
diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx
index 785329aaff6b..0a5710075fa1 100644
--- a/sc/source/ui/view/tabsplit.cxx
+++ b/sc/source/ui/view/tabsplit.cxx
@@ -24,11 +24,11 @@
#include <vcl/settings.hxx>
ScTabSplitter::ScTabSplitter( vcl::Window* pParent, WinBits nWinStyle, ScViewData* pData ) :
- Splitter( pParent, nWinStyle ),
+ Splitter(pParent, nWinStyle),
pViewData(pData)
{
SetFixed(false);
- EnableRTL( false );
+ EnableRTL(false);
}
ScTabSplitter::~ScTabSplitter()
@@ -54,10 +54,10 @@ void ScTabSplitter::SetFixed(bool bSet)
SetPointer(POINTER_VSPLIT);
}
-void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
{
- const Color oldFillCol = GetFillColor();
- const Color oldLineCol = GetLineColor();
+ rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
if (IsHorizontal())
{
@@ -65,24 +65,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
{
case SC_SPLIT_NONE:
{
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
// Draw handle
- SetLineColor(Color(COL_BLACK));
- SetFillColor(Color(COL_BLACK));
- const long xc = rRect.Right()+rRect.Left();
- const long h4 = rRect.GetHeight()/4;
+ rRenderContext.SetLineColor(Color(COL_BLACK));
+ rRenderContext.SetFillColor(Color(COL_BLACK));
+ const long xc = rRect.Right() + rRect.Left();
+ const long h4 = rRect.GetHeight() / 4;
// First xc fraction is truncated, second one is rounded. This will draw a centered line
// in handlers with odd width and a centered rectangle in those with even width.
- DrawRect(Rectangle(Point(xc/2, rRect.Top()+h4), Point((xc+1)/2, rRect.Bottom()-h4)));
+ rRenderContext.DrawRect(Rectangle(Point(xc / 2, rRect.Top() + h4),
+ Point((xc + 1) / 2, rRect.Bottom() - h4)));
break;
}
case SC_SPLIT_NORMAL:
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
break;
case SC_SPLIT_FIX:
// Nothing to draw
@@ -95,24 +96,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
{
case SC_SPLIT_NONE:
{
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
// Draw handle
- SetLineColor(Color(COL_BLACK));
- SetFillColor(Color(COL_BLACK));
- const long yc = rRect.Top()+rRect.Bottom();
- const long w4 = rRect.GetWidth()/4;
+ rRenderContext.SetLineColor(Color(COL_BLACK));
+ rRenderContext.SetFillColor(Color(COL_BLACK));
+ const long yc = rRect.Top() + rRect.Bottom();
+ const long w4 = rRect.GetWidth() / 4;
// First yc fraction is truncated, second one is rounded. This will draw a centered line
// in handlers with odd height and a centered rectangle in those with even height.
- DrawRect(Rectangle(Point(rRect.Left()+w4, yc/2), Point(rRect.Right()-w4, (yc+1)/2)));
+ DrawRect(Rectangle(Point(rRect.Left() + w4, yc / 2),
+ Point(rRect.Right() - w4, (yc + 1) / 2)));
break;
}
case SC_SPLIT_NORMAL:
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
break;
case SC_SPLIT_FIX:
// Nothing to draw
@@ -120,8 +122,7 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
}
}
- SetFillColor(oldFillCol);
- SetLineColor(oldLineCol);
+ rRenderContext.Pop();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */