summaryrefslogtreecommitdiffstats
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-10 15:32:29 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-11 06:55:33 +0000
commitf09ab2ccb8bbbcf9b9db3cec94ce9b59f901a1c6 (patch)
treed3e6599fbc2d6193f5f1340afcb8ab8fbf9634ef /svtools
parentconvert MappingType to scoped enum (diff)
downloadcore-f09ab2ccb8bbbcf9b9db3cec94ce9b59f901a1c6.tar.gz
core-f09ab2ccb8bbbcf9b9db3cec94ce9b59f901a1c6.zip
convert RULER_INDENT to scoped enum
Also separate out the INVISIBLE flag into it's own bit, because the constant is shared with other fields. Also fix some dubious code in SVX that was setting stuff on the field that meant nothing. Change-Id: If460be575eee38b8e9f01af4d73f93f6426c604f Reviewed-on: https://gerrit.libreoffice.org/24853 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/ruler.cxx33
1 files changed, 14 insertions, 19 deletions
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 81c551d2deb4..050cce79caf4 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -789,13 +789,10 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
}
}
-void Ruler::ImplDrawIndent(vcl::RenderContext& rRenderContext, const tools::Polygon& rPoly, sal_uInt16 nStyle, bool bIsHit)
+void Ruler::ImplDrawIndent(vcl::RenderContext& rRenderContext, const tools::Polygon& rPoly, bool bIsHit)
{
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- if (nStyle & RULER_STYLE_INVISIBLE)
- return;
-
rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
rRenderContext.SetFillColor(bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor());
rRenderContext.DrawPolygon(rPoly);
@@ -812,23 +809,22 @@ void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long
for (j = 0; j < mpData->pIndents.size(); j++)
{
- if (mpData->pIndents[j].nStyle & RULER_STYLE_INVISIBLE)
+ if (mpData->pIndents[j].bInvisible)
continue;
- sal_uInt16 nStyle = mpData->pIndents[j].nStyle;
- sal_uInt16 nIndentStyle = nStyle & RULER_INDENT_STYLE;
+ RulerIndentStyle nIndentStyle = mpData->pIndents[j].nStyle;
n = mpData->pIndents[j].nPos+mpData->nNullVirOff;
if ((n >= nMin) && (n <= nMax))
{
- if (nIndentStyle == RULER_INDENT_BORDER)
+ if (nIndentStyle == RulerIndentStyle::Border)
{
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
ImplVDrawLine(rRenderContext, n, nVirTop + 1, n, nVirBottom - 1);
}
- else if (nIndentStyle == RULER_INDENT_BOTTOM)
+ else if (nIndentStyle == RulerIndentStyle::Bottom)
{
aPoly.SetPoint(Point(n + 0, nVirBottom - nIndentHeight), 0);
aPoly.SetPoint(Point(n - nIndentWidth2, nVirBottom - 3), 1);
@@ -855,7 +851,7 @@ void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long
aPoly[i] = aSet;
}
}
- if (RULER_INDENT_BORDER != nIndentStyle)
+ if (RulerIndentStyle::Border != nIndentStyle)
{
bool bIsHit = false;
if(mxCurrentHitTest.get() != nullptr && mxCurrentHitTest->eType == RULER_TYPE_INDENT)
@@ -866,7 +862,7 @@ void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long
{
bIsHit = mnDragAryPos == j;
}
- ImplDrawIndent(rRenderContext, aPoly, nStyle, bIsHit);
+ ImplDrawIndent(rRenderContext, aPoly, bIsHit);
}
}
}
@@ -1476,7 +1472,7 @@ void Ruler::ImplUpdate( bool bMustCalc )
}
bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest,
- bool bRequireStyle, sal_uInt16 nRequiredStyle ) const
+ bool bRequireStyle, RulerIndentStyle nRequiredStyle ) const
{
sal_Int32 i;
sal_uInt16 nStyle;
@@ -1586,14 +1582,13 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest,
for ( i = mpData->pIndents.size(); i; i-- )
{
- nStyle = mpData->pIndents[i-1].nStyle;
- if ( (! bRequireStyle || nStyle == nRequiredStyle) &&
- !(nStyle & RULER_STYLE_INVISIBLE) )
+ RulerIndentStyle nIndentStyle = mpData->pIndents[i-1].nStyle;
+ if ( (! bRequireStyle || nIndentStyle == nRequiredStyle) &&
+ !mpData->pIndents[i-1].bInvisible )
{
- nStyle &= RULER_INDENT_STYLE;
n1 = mpData->pIndents[i-1].nPos;
- if ( (nStyle == RULER_INDENT_BOTTOM) != !bIsHori )
+ if ( (nIndentStyle == RulerIndentStyle::Bottom) != !bIsHori )
{
aRect.Left() = n1-nIndentWidth2;
aRect.Right() = n1+nIndentWidth2;
@@ -1781,12 +1776,12 @@ bool Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType,
{
Point aPos = rPos;
bool bRequiredStyle = false;
- sal_uInt16 nRequiredStyle = 0;
+ RulerIndentStyle nRequiredStyle = RulerIndentStyle::Top;
if (eDragType == RULER_TYPE_INDENT)
{
bRequiredStyle = true;
- nRequiredStyle = RULER_INDENT_BOTTOM;
+ nRequiredStyle = RulerIndentStyle::Bottom;
}
if ( mnWinStyle & WB_HORZ )