summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-06 14:48:16 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-10-13 17:45:57 +0200
commitaf5ebbf7835441c767f91a620f109ee6722e57bd (patch)
treec72b2a1ddb5aa0a0a369be7babd516a5592d5fac /cppcanvas
parent1156d11ef0bb2bc3d71ae9299656db4fed66f073 (diff)
create a macro library for implementing bit-flags types
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, changed from a macro- to a template-based solution. (Unfortunately MSVC 2012 does not support explicit conversion operators. Worked around that with explicit #ifs rather than some HAVE_EXPLICIT_CONVERSION_OPERATORS and SAL_EXPLICIT_CONVERSION_OPERATOR ainticipating we hopefully soon move to a baseline that requires unconditional support for them.) Change-Id: I4a89643b218d247e8e4a861faba458ec6dfe1396
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/inc/outdevstate.hxx2
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx36
2 files changed, 19 insertions, 19 deletions
diff --git a/cppcanvas/source/inc/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx
index 15d33ecd9969..339688a5aca2 100644
--- a/cppcanvas/source/inc/outdevstate.hxx
+++ b/cppcanvas/source/inc/outdevstate.hxx
@@ -58,7 +58,7 @@ namespace cppcanvas
fontRotation(0.0),
textEmphasisMarkStyle(EMPHASISMARK_NONE),
- pushFlags(PUSH_ALL),
+ pushFlags(PushFlags::ALL),
textDirection(::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT),
textAlignment(0), // TODO(Q2): Synchronize with implrenderer
// and possibly new rendering::TextAlignment
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 1437f32a0832..f44c2b0d721b 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -270,7 +270,7 @@ namespace cppcanvas
void VectorOfOutDevStates::popState()
{
- if( getState().pushFlags != PUSH_ALL )
+ if( getState().pushFlags != PushFlags::ALL )
{
// a state is pushed which is incomplete, i.e. does not
// restore everything to the previous stack level when
@@ -289,19 +289,19 @@ namespace cppcanvas
const OutDevState& rNewState( getState() );
- if( (aCalculatedNewState.pushFlags & PUSH_LINECOLOR) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::LINECOLOR) )
{
aCalculatedNewState.lineColor = rNewState.lineColor;
aCalculatedNewState.isLineColorSet = rNewState.isLineColorSet;
}
- if( (aCalculatedNewState.pushFlags & PUSH_FILLCOLOR) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::FILLCOLOR) )
{
aCalculatedNewState.fillColor = rNewState.fillColor;
aCalculatedNewState.isFillColorSet = rNewState.isFillColorSet;
}
- if( (aCalculatedNewState.pushFlags & PUSH_FONT) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::FONT) )
{
aCalculatedNewState.xFont = rNewState.xFont;
aCalculatedNewState.fontRotation = rNewState.fontRotation;
@@ -315,17 +315,17 @@ namespace cppcanvas
aCalculatedNewState.isTextOutlineModeSet = rNewState.isTextOutlineModeSet;
}
- if( (aCalculatedNewState.pushFlags & PUSH_TEXTCOLOR) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::TEXTCOLOR) )
{
aCalculatedNewState.textColor = rNewState.textColor;
}
- if( (aCalculatedNewState.pushFlags & PUSH_MAPMODE) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::MAPMODE) )
{
aCalculatedNewState.mapModeTransform = rNewState.mapModeTransform;
}
- if( (aCalculatedNewState.pushFlags & PUSH_CLIPREGION) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::CLIPREGION) )
{
aCalculatedNewState.clip = rNewState.clip;
aCalculatedNewState.clipRect = rNewState.clipRect;
@@ -333,40 +333,40 @@ namespace cppcanvas
}
// TODO(F2): Raster ops NYI
- // if( (aCalculatedNewState.pushFlags & PUSH_RASTEROP) )
+ // if( (aCalculatedNewState.pushFlags & PushFlags::RASTEROP) )
// {
// }
- if( (aCalculatedNewState.pushFlags & PUSH_TEXTFILLCOLOR) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::TEXTFILLCOLOR) )
{
aCalculatedNewState.textFillColor = rNewState.textFillColor;
aCalculatedNewState.isTextFillColorSet = rNewState.isTextFillColorSet;
}
- if( (aCalculatedNewState.pushFlags & PUSH_TEXTALIGN) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::TEXTALIGN) )
{
aCalculatedNewState.textReferencePoint = rNewState.textReferencePoint;
}
// TODO(F1): Refpoint handling NYI
- // if( (aCalculatedNewState.pushFlags & PUSH_REFPOINT) )
+ // if( (aCalculatedNewState.pushFlags & PushFlags::REFPOINT) )
// {
// }
- if( (aCalculatedNewState.pushFlags & PUSH_TEXTLINECOLOR) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::TEXTLINECOLOR) )
{
aCalculatedNewState.textLineColor = rNewState.textLineColor;
aCalculatedNewState.isTextLineColorSet = rNewState.isTextLineColorSet;
}
- if( (aCalculatedNewState.pushFlags & PUSH_TEXTLAYOUTMODE) )
+ if( (aCalculatedNewState.pushFlags & PushFlags::TEXTLAYOUTMODE) )
{
aCalculatedNewState.textAlignment = rNewState.textAlignment;
aCalculatedNewState.textDirection = rNewState.textDirection;
}
// TODO(F2): Text language handling NYI
- // if( (aCalculatedNewState.pushFlags & PUSH_TEXTLANGUAGE) )
+ // if( (aCalculatedNewState.pushFlags & PushFlags::TEXTLANGUAGE) )
// {
// }
@@ -730,7 +730,7 @@ namespace cppcanvas
// cannot currently use native canvas gradients, as a
// finite step size is given (this funny feature is not
// supported by the XCanvas API)
- rParms.mrStates.pushState(PUSH_ALL);
+ rParms.mrStates.pushState(PushFlags::ALL);
if( !bIsPolygonRectangle )
{
@@ -1520,7 +1520,7 @@ namespace cppcanvas
::cppcanvas::internal::OutDevState& rState = rStates.getState();
ComplexTextLayoutMode nBidiLayoutMode = nLayoutMode & (TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_BIDI_STRONG);
- if( nBidiLayoutMode == 0)
+ if( nBidiLayoutMode == TEXT_LAYOUT_DEFAULT)
rState.textDirection = rendering::TextDirection::WEAK_LEFT_TO_RIGHT;
else if( nBidiLayoutMode == TEXT_LAYOUT_BIDI_STRONG)
rState.textDirection = rendering::TextDirection::STRONG_LEFT_TO_RIGHT;
@@ -1590,7 +1590,7 @@ namespace cppcanvas
// Setup local transform, such that the
// metafile renders itself into the given
// output rectangle
- rStates.pushState(PUSH_ALL);
+ rStates.pushState(PushFlags::ALL);
rVDev.Push();
rVDev.SetMapMode( rSubstitute.GetPrefMapMode() );
@@ -2557,7 +2557,7 @@ namespace cppcanvas
{
MetaTextRectAction* pAct = static_cast<MetaTextRectAction*>(pCurrAct);
- rStates.pushState(PUSH_ALL);
+ rStates.pushState(PushFlags::ALL);
// use the VDev to break up the text rect
// action into readily formatted lines