summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/svtools/ruler.hxx41
-rw-r--r--svtools/source/control/ruler.cxx20
-rw-r--r--svx/source/dialog/svxruler.cxx12
3 files changed, 39 insertions, 34 deletions
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index ee6340c1e37d..0db49dc6561e 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -139,25 +139,25 @@ has to be passed. In the array, the following values have to be initialized:
long nWidth - column spacing in pixels (can also be 0, for example,
for table columns)
sal_uInt16 nStyle - bit style:
- RULER_BORDER_SIZEABLE
+ RulerBorderStyle::Sizeable
Column spacing can be changed. This flag should
only be set if the size of the spacing is changed,
not that of a cell.
- RULER_BORDER_MOVEABLE
+ RulerBorderStyle::Moveable
Column spacing/border can be moved. Whenever
table borders are to be moved, this flag should
be set instead of SIZEABLE (SIZEABLE indicates
that the size of a spacing, not that of a single
cell can be changed).
- RULER_BORDER_VARIABLE
+ RulerBorderStyle::Variable
Not all of the column spacings are equal
- RULER_BORDER_TABLE
+ RulerBorderStyle::Table
Table border. Whenever this style is set, the column
width must be 0.
- RULER_BORDER_SNAP
+ RulerBorderStyle::Snap
Auxiliary line. Whenever this style is set, the
column width must be 0.
- RULER_BORDER_MARGIN
+ RulerBorderStyle::Margin
Margin. Whenever this style is set, the column
width must be 0.
@@ -487,23 +487,28 @@ enum class RulerDragSize {
#define RULER_MARGIN_SIZEABLE ((sal_uInt16)0x0001)
-#define RULER_BORDER_SIZEABLE ((sal_uInt16)0x0001)
-#define RULER_BORDER_MOVEABLE ((sal_uInt16)0x0002)
-#define RULER_BORDER_VARIABLE ((sal_uInt16)0x0004)
-#define RULER_BORDER_TABLE ((sal_uInt16)0x0008)
-#define RULER_BORDER_SNAP ((sal_uInt16)0x0010)
-#define RULER_BORDER_MARGIN ((sal_uInt16)0x0020)
+enum class RulerBorderStyle {
+ Sizeable = 0x0001,
+ Moveable = 0x0002,
+ Variable = 0x0004,
+ Table = 0x0008,
+ Snap = 0x0010,
+ Margin = 0x0020,
+ Invisible = 0x0040
+};
+namespace o3tl {
+ template<> struct typed_flags<RulerBorderStyle> : is_typed_flags<RulerBorderStyle, 0x007f> {};
+}
struct RulerBorder
{
- long nPos;
- long nWidth;
- sal_uInt16 nStyle;
- long nMinPos; //minimum/maximum position, supported for table borders/rows
- long nMaxPos;
+ long nPos;
+ long nWidth;
+ RulerBorderStyle nStyle;
+ long nMinPos; //minimum/maximum position, supported for table borders/rows
+ long nMaxPos;
};
-
enum class RulerIndentStyle {
Top, Bottom, Border
};
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 243e93c27093..e97a0980435d 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -701,7 +701,7 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
for (i = 0; i < mpData->pBorders.size(); i++)
{
- if (mpData->pBorders[i].nStyle & RULER_STYLE_INVISIBLE)
+ if (mpData->pBorders[i].nStyle & RulerBorderStyle::Invisible)
continue;
n1 = mpData->pBorders[i].nPos + mpData->nNullVirOff;
@@ -727,7 +727,7 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
ImplVDrawLine(rRenderContext, n2, nVirTop, n2, nVirBottom);
- if (mpData->pBorders[i].nStyle & RULER_BORDER_VARIABLE)
+ if (mpData->pBorders[i].nStyle & RulerBorderStyle::Variable)
{
if (n2 - n1 > RULER_VAR_SIZE + 4)
{
@@ -754,7 +754,7 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
}
}
- if (mpData->pBorders[i].nStyle & RULER_BORDER_SIZEABLE)
+ if (mpData->pBorders[i].nStyle & RulerBorderStyle::Sizeable)
{
if (n2 - n1 > RULER_VAR_SIZE + 10)
{
@@ -772,9 +772,9 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
n = n1 + ((n2 - n1) / 2);
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
- if (mpData->pBorders[i].nStyle & RULER_BORDER_SNAP)
+ if (mpData->pBorders[i].nStyle & RulerBorderStyle::Snap)
ImplVDrawLine(rRenderContext, n, nVirTop, n, nVirBottom);
- else if (mpData->pBorders[i].nStyle & RULER_BORDER_MARGIN)
+ else if (mpData->pBorders[i].nStyle & RulerBorderStyle::Margin)
ImplVDrawLine(rRenderContext, n, nVirTop, n, nVirBottom);
else
{
@@ -1643,15 +1643,15 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest,
if ( (nX >= n1) && (nX <= n2) )
{
- nStyle = mpData->pBorders[i-1].nStyle;
- if ( !(nStyle & RULER_STYLE_INVISIBLE) )
+ RulerBorderStyle nBorderStyle = mpData->pBorders[i-1].nStyle;
+ if ( !(nBorderStyle & RulerBorderStyle::Invisible) )
{
pHitTest->eType = RULER_TYPE_BORDER;
pHitTest->nAryPos = i-1;
- if ( !(nStyle & RULER_BORDER_SIZEABLE) )
+ if ( !(nBorderStyle & RulerBorderStyle::Sizeable) )
{
- if ( nStyle & RULER_BORDER_MOVEABLE )
+ if ( nBorderStyle & RulerBorderStyle::Moveable )
{
pHitTest->bSizeBar = true;
pHitTest->mnDragSize = RulerDragSize::Move;
@@ -1683,7 +1683,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest,
}
else
{
- if ( nStyle & RULER_BORDER_MOVEABLE )
+ if ( nBorderStyle & RulerBorderStyle::Moveable )
{
pHitTest->bSizeBar = true;
pHitTest->mnDragSize = RulerDragSize::Move;
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 5695a3c10022..5994360f2b3d 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -319,7 +319,7 @@ SvxRuler::SvxRuler(
{
mpObjectBorders[nBorder].nPos = 0;
mpObjectBorders[nBorder].nWidth = 0;
- mpObjectBorders[nBorder].nStyle = RULER_BORDER_MOVEABLE;
+ mpObjectBorders[nBorder].nStyle = RulerBorderStyle::Moveable;
}
}
@@ -796,19 +796,19 @@ void SvxRuler::UpdateColumns()
{
mpBorders.resize(mxColumnItem->Count());
- sal_uInt16 nStyleFlags = RULER_BORDER_VARIABLE;
+ RulerBorderStyle nStyleFlags = RulerBorderStyle::Variable;
bool bProtectColumns =
mxRulerImpl->aProtectItem.IsSizeProtected() ||
mxRulerImpl->aProtectItem.IsPosProtected();
if( !bProtectColumns )
- nStyleFlags |= RULER_BORDER_MOVEABLE;
+ nStyleFlags |= RulerBorderStyle::Moveable;
if( mxColumnItem->IsTable() )
- nStyleFlags |= RULER_BORDER_TABLE;
+ nStyleFlags |= RulerBorderStyle::Table;
else if ( !bProtectColumns )
- nStyleFlags |= RULER_BORDER_SIZEABLE;
+ nStyleFlags |= RulerBorderStyle::Sizeable;
sal_uInt16 nBorders = mxColumnItem->Count();
@@ -819,7 +819,7 @@ void SvxRuler::UpdateColumns()
{
mpBorders[i].nStyle = nStyleFlags;
if(!mxColumnItem->At(i).bVisible)
- mpBorders[i].nStyle |= RULER_STYLE_INVISIBLE;
+ mpBorders[i].nStyle |= RulerBorderStyle::Invisible;
mpBorders[i].nPos = ConvertPosPixel(mxColumnItem->At(i).nEnd + lAppNullOffset);