diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-13 10:32:21 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-13 10:32:21 +0900 |
commit | 571e597bc3c91f29c75d804028268255c282764d (patch) | |
tree | 5becab9dd144c89f203b7047dde9b75ed2e75e24 /svx/source | |
parent | 6e4349411eea331e018c96952da8b6e49c469042 (diff) |
refactor LineWidthControl to use RenderContext
Change-Id: I5ca1a367c4eba0a2f39c2aa9702e3d3bd5b2477f
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/sidebar/line/LineWidthControl.cxx | 24 | ||||
-rw-r--r-- | svx/source/sidebar/line/LineWidthControl.hxx | 47 |
2 files changed, 37 insertions, 34 deletions
diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx index f8b062eaad38..611829325f8a 100644 --- a/svx/source/sidebar/line/LineWidthControl.cxx +++ b/svx/source/sidebar/line/LineWidthControl.cxx @@ -83,27 +83,25 @@ void LineWidthControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle { svx::sidebar::PopupControl::Paint(rRenderContext, rect); - Color aOldLineColor = GetLineColor(); - Color aOldFillColor = GetFillColor(); + rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR); - Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT )); - Size aSize( LogicToPixel( Size( CUSTOM_W, CUSTOM_H ), MAP_APPFONT )); - Rectangle aRect( aPos, aSize ); + Point aPos(rRenderContext.LogicToPixel(Point(CUSTOM_X, CUSTOM_Y), MAP_APPFONT)); + Size aSize(rRenderContext.LogicToPixel(Size(CUSTOM_W, CUSTOM_H), MAP_APPFONT)); + Rectangle aRect(aPos, aSize); aRect.Left() -= 1; aRect.Top() -= 1; aRect.Right() += 1; aRect.Bottom() += 1; - Color aLineColor(189,201,219); - if(!GetSettings().GetStyleSettings().GetHighContrastMode()) - SetLineColor(aLineColor); + Color aLineColor(189, 201, 219); + if (!GetSettings().GetStyleSettings().GetHighContrastMode()) + rRenderContext.SetLineColor(aLineColor); else - SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); - SetFillColor(COL_TRANSPARENT); - DrawRect(aRect); + rRenderContext.SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); + rRenderContext.SetFillColor(COL_TRANSPARENT); + rRenderContext.DrawRect(aRect); - SetLineColor(aOldLineColor); - SetFillColor(aOldFillColor); + rRenderContext.Pop(); } diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx index a1f5e43ccc0e..0b14574d995d 100644 --- a/svx/source/sidebar/line/LineWidthControl.hxx +++ b/svx/source/sidebar/line/LineWidthControl.hxx @@ -32,8 +32,7 @@ namespace svx { namespace sidebar { class LinePropertyPanel; -class LineWidthControl - : public svx::sidebar::PopupControl +class LineWidthControl : public svx::sidebar::PopupControl { public: LineWidthControl (vcl::Window* pParent, LinePropertyPanel& rPanel); @@ -41,30 +40,36 @@ public: virtual void dispose() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; - virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rect) SAL_OVERRIDE; + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& aRect) SAL_OVERRIDE; void SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit); - bool IsCloseByEdit() { return mbCloseByEdit;} - long GetTmpCustomWidth() { return mnTmpCustomWidth;} + bool IsCloseByEdit() + { + return mbCloseByEdit; + } + long GetTmpCustomWidth() + { + return mnTmpCustomWidth; + } private: - LinePropertyPanel& mrLinePropertyPanel; - SfxBindings* mpBindings; - VclPtr<LineWidthValueSet> maVSWidth; - VclPtr<FixedText> maFTCus; - VclPtr<FixedText> maFTWidth; - VclPtr<MetricField> maMFWidth; - SfxMapUnit meMapUnit; - OUString* rStr; - OUString mstrPT; - long mnCustomWidth; - bool mbCustom; - bool mbCloseByEdit; - long mnTmpCustomWidth; - bool mbVSFocus; + LinePropertyPanel& mrLinePropertyPanel; + SfxBindings* mpBindings; + VclPtr<LineWidthValueSet> maVSWidth; + VclPtr<FixedText> maFTCus; + VclPtr<FixedText> maFTWidth; + VclPtr<MetricField> maMFWidth; + SfxMapUnit meMapUnit; + OUString* rStr; + OUString mstrPT; + long mnCustomWidth; + bool mbCustom; + bool mbCloseByEdit; + long mnTmpCustomWidth; + bool mbVSFocus; - Image maIMGCus; - Image maIMGCusGray; + Image maIMGCus; + Image maIMGCusGray; void Initialize(); DECL_LINK(VSSelectHdl, void *); |