From 1a2479c93a013ba2d67319849869693bd01cf1ad Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sun, 17 May 2015 22:52:55 +0200 Subject: loplugin:staticmethods Change-Id: I441cafcd641477626eb8de9d4b35212fd29af248 --- sw/source/ui/envelp/labfmt.cxx | 108 ++++++++++++++++++++------------------ sw/source/ui/envelp/labfmt.hxx | 2 - sw/source/uibase/inc/swruler.hxx | 8 --- sw/source/uibase/misc/swruler.cxx | 51 +++++++++++------- 4 files changed, 87 insertions(+), 82 deletions(-) (limited to 'sw') diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index d578bf3b20a9..56ea2660fc61 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -43,6 +43,62 @@ using namespace ::com::sun::star::beans; #define ROUND(x) static_cast((x) + .5) +namespace { + +// Arrow or interval character +void DrawArrow(vcl::RenderContext& rRenderContext, const Point &rP1, const Point &rP2, bool bArrow) +{ + rRenderContext.DrawLine(rP1, rP2); + if (bArrow) + { + Point aArr[3]; + + // Arrow character + if (rP1.Y() == rP2.Y()) + { + // Horizontal + aArr[0].X() = rP2.X() - 5; + aArr[0].Y() = rP2.Y() - 2; + aArr[1].X() = rP2.X(); + aArr[1].Y() = rP2.Y(); + aArr[2].X() = rP2.X() - 5; + aArr[2].Y() = rP2.Y() + 2; + } + else + { + // Vertical + aArr[0].X() = rP2.X() - 2; + aArr[0].Y() = rP2.Y() - 5; + aArr[1].X() = rP2.X() + 2; + aArr[1].Y() = rP2.Y() - 5; + aArr[2].X() = rP2.X(); + aArr[2].Y() = rP2.Y(); + } + + const Color& rFieldTextColor = SwViewOption::GetFontColor(); + rRenderContext.SetFillColor(rFieldTextColor); + rRenderContext.DrawPolygon(Polygon(3, aArr)); + } + else + { + // Interval symbol + if (rP1.Y() == rP2.Y()) + { + // Horizontal + rRenderContext.DrawLine(Point(rP1.X(), rP1.Y() - 2), Point(rP1.X(), rP1.Y() + 2)); + rRenderContext.DrawLine(Point(rP2.X(), rP2.Y() - 2), Point(rP2.X(), rP2.Y() + 2)); + } + else + { + // Vertical + rRenderContext.DrawLine(Point(rP1.X() - 2, rP1.Y()), Point(rP1.X() + 2, rP1.Y())); + rRenderContext.DrawLine(Point(rP2.X() - 2, rP2.Y()), Point(rP2.X() + 2, rP2.Y())); + } + } +} + +} + SwLabPreview::SwLabPreview(vcl::Window* pParent) : Window(pParent, 0) , aGrayColor(COL_LIGHTGRAY) @@ -228,58 +284,6 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) } } -// Arrow or interval character -void SwLabPreview::DrawArrow(vcl::RenderContext& rRenderContext, const Point &rP1, const Point &rP2, bool bArrow) -{ - rRenderContext.DrawLine(rP1, rP2); - if (bArrow) - { - Point aArr[3]; - - // Arrow character - if (rP1.Y() == rP2.Y()) - { - // Horizontal - aArr[0].X() = rP2.X() - 5; - aArr[0].Y() = rP2.Y() - 2; - aArr[1].X() = rP2.X(); - aArr[1].Y() = rP2.Y(); - aArr[2].X() = rP2.X() - 5; - aArr[2].Y() = rP2.Y() + 2; - } - else - { - // Vertical - aArr[0].X() = rP2.X() - 2; - aArr[0].Y() = rP2.Y() - 5; - aArr[1].X() = rP2.X() + 2; - aArr[1].Y() = rP2.Y() - 5; - aArr[2].X() = rP2.X(); - aArr[2].Y() = rP2.Y(); - } - - const Color& rFieldTextColor = SwViewOption::GetFontColor(); - rRenderContext.SetFillColor(rFieldTextColor); - rRenderContext.DrawPolygon(Polygon(3, aArr)); - } - else - { - // Interval symbol - if (rP1.Y() == rP2.Y()) - { - // Horizontal - rRenderContext.DrawLine(Point(rP1.X(), rP1.Y() - 2), Point(rP1.X(), rP1.Y() + 2)); - rRenderContext.DrawLine(Point(rP2.X(), rP2.Y() - 2), Point(rP2.X(), rP2.Y() + 2)); - } - else - { - // Vertical - rRenderContext.DrawLine(Point(rP1.X() - 2, rP1.Y()), Point(rP1.X() + 2, rP1.Y())); - rRenderContext.DrawLine(Point(rP2.X() - 2, rP2.Y()), Point(rP2.X() + 2, rP2.Y())); - } - } -} - void SwLabPreview::UpdateItem(const SwLabItem& rItem) { aItem = rItem; diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx index 3097fd530263..db9826a0c429 100644 --- a/sw/source/ui/envelp/labfmt.hxx +++ b/sw/source/ui/envelp/labfmt.hxx @@ -58,8 +58,6 @@ class SwLabPreview : public vcl::Window virtual Size GetOptimalSize() const SAL_OVERRIDE; - void DrawArrow(vcl::RenderContext& rRenderContext, const Point& rP1, const Point& rP2, bool bArrow); - public: SwLabPreview(vcl::Window* pParent); diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx index 4136026ecba4..b31d33acaa18 100644 --- a/sw/source/uibase/inc/swruler.hxx +++ b/sw/source/uibase/inc/swruler.hxx @@ -88,14 +88,6 @@ protected: * Paint the comment control on VirtualDevice. */ void DrawCommentControl(vcl::RenderContext& rRenderContext); - /** - * Draw a little horizontal arrow tip on VirtualDevice. - * \param nX left coordinate of arrow - * \param nY top coordinate of arrow - * \param Color arrow color - * \param bPointRight if arrow should point to right. Otherwise, it will point left. - */ - 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 665ca0f6e08d..5eabc7c1589d 100644 --- a/sw/source/uibase/misc/swruler.cxx +++ b/sw/source/uibase/misc/swruler.cxx @@ -34,6 +34,37 @@ #define CONTROL_TRIANGLE_WIDTH 4 #define CONTROL_TRIANGLE_PAD 3 +namespace { + +/** + * Draw a little horizontal arrow tip on VirtualDevice. + * \param nX left coordinate of arrow + * \param nY top coordinate of arrow + * \param Color arrow color + * \param bPointRight if arrow should point to right. Otherwise, it will point left. + */ +void ImplDrawArrow(vcl::RenderContext& rRenderContext, long nX, long nY, const Color& rColor, bool bPointRight) +{ + rRenderContext.SetLineColor(); + rRenderContext.SetFillColor(rColor); + if (bPointRight) + { + 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 + { + 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)); + } +} + +} + // Constructor SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEditWin* pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle) : SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle | WB_HSCROLL) @@ -155,26 +186,6 @@ void SwCommentRuler::DrawCommentControl(vcl::RenderContext& rRenderContext) rRenderContext.DrawOutDev(aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), *maVirDev.get()); } -void SwCommentRuler::ImplDrawArrow(vcl::RenderContext& rRenderContext, long nX, long nY, const Color& rColor, bool bPointRight) -{ - rRenderContext.SetLineColor(); - rRenderContext.SetFillColor(rColor); - if (bPointRight) - { - 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 - { - 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)); - } -} - // Just accept double-click outside comment control void SwCommentRuler::Command( const CommandEvent& rCEvt ) { -- cgit