summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-30 16:50:00 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-30 17:44:34 +0100
commit47dd2c63f649828a833543e21d4eca5866ec9ebe (patch)
tree0b9a64485028cb9c7c0ffc52cad79033b2cb6209 /cppcanvas
parent6ddefb080b12f54f84a8de44347a9b1816972ad3 (diff)
Rewrite uses of boost::optional
...to only use functions that are also available for std::optional (in preparation for changing from boost::optional to std::optional): * uses of get are replaced with operator * or operator -> * uses of is_initialized are replaced with operator bool * uses of reset with an argument are replace with operator = (All of the replacements are also available for boost::optional "since forever", so this change should not break builds against old --with-system-boost. An alternative replacement for is_initialized would have been has_value, but that is only available since Boost 1.68.) Change-Id: I532687b6a5ee37dab28befb8e0eb05c22cbecf0f Reviewed-on: https://gerrit.libreoffice.org/84124 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx34
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx10
-rw-r--r--cppcanvas/source/tools/canvasgraphichelper.cxx2
-rw-r--r--cppcanvas/source/wrapper/implcanvas.cxx2
4 files changed, 24 insertions, 24 deletions
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 573ec4882eb3..7c4d91b1a8a2 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -745,7 +745,7 @@ namespace cppcanvas
{
rendering::FontRequest aFontRequest;
- if( rParms.mrParms.maFontName.is_initialized() )
+ if( rParms.mrParms.maFontName )
aFontRequest.FontDescription.FamilyName = *rParms.mrParms.maFontName;
else
aFontRequest.FontDescription.FamilyName = rFont.GetFamilyName();
@@ -757,11 +757,11 @@ namespace cppcanvas
// TODO(F2): improve vclenum->panose conversion
aFontRequest.FontDescription.FontDescription.Weight =
- rParms.mrParms.maFontWeight.is_initialized() ?
+ rParms.mrParms.maFontWeight ?
*rParms.mrParms.maFontWeight :
::canvas::tools::numeric_cast<sal_Int8>( ::basegfx::fround( rFont.GetWeight() ) );
aFontRequest.FontDescription.FontDescription.Letterform =
- rParms.mrParms.maFontLetterForm.is_initialized() ?
+ rParms.mrParms.maFontLetterForm ?
*rParms.mrParms.maFontLetterForm :
(rFont.GetItalic() == ITALIC_NONE) ? 0 : 9;
aFontRequest.FontDescription.FontDescription.Proportion =
@@ -1379,7 +1379,7 @@ namespace cppcanvas
break;
case MetaActionType::LINECOLOR:
- if( !rParms.maLineColor.is_initialized() )
+ if( !rParms.maLineColor )
{
setStateColor( static_cast<MetaLineColorAction*>(pCurrAct),
rStates.getState().isLineColorSet,
@@ -1396,7 +1396,7 @@ namespace cppcanvas
break;
case MetaActionType::FILLCOLOR:
- if( !rParms.maFillColor.is_initialized() )
+ if( !rParms.maFillColor )
{
setStateColor( static_cast<MetaFillColorAction*>(pCurrAct),
rStates.getState().isFillColorSet,
@@ -1414,7 +1414,7 @@ namespace cppcanvas
case MetaActionType::TEXTCOLOR:
{
- if( !rParms.maTextColor.is_initialized() )
+ if( !rParms.maTextColor )
{
// Text color is set unconditionally, thus, no
// use of setStateColor here
@@ -1434,7 +1434,7 @@ namespace cppcanvas
break;
case MetaActionType::TEXTFILLCOLOR:
- if( !rParms.maTextColor.is_initialized() )
+ if( !rParms.maTextColor )
{
setStateColor( static_cast<MetaTextFillColorAction*>(pCurrAct),
rStates.getState().isTextFillColorSet,
@@ -1451,7 +1451,7 @@ namespace cppcanvas
break;
case MetaActionType::TEXTLINECOLOR:
- if( !rParms.maTextColor.is_initialized() )
+ if( !rParms.maTextColor )
{
setStateColor( static_cast<MetaTextLineColorAction*>(pCurrAct),
rStates.getState().isTextLineColorSet,
@@ -1468,7 +1468,7 @@ namespace cppcanvas
break;
case MetaActionType::OVERLINECOLOR:
- if( !rParms.maTextColor.is_initialized() )
+ if( !rParms.maTextColor )
{
setStateColor( static_cast<MetaOverlineColorAction*>(pCurrAct),
rStates.getState().isTextOverlineColorSet,
@@ -1504,7 +1504,7 @@ namespace cppcanvas
// TODO(Q2): define and use appropriate enumeration types
rState.textReliefStyle = rFont.GetRelief();
rState.textOverlineStyle = static_cast<sal_Int8>(rFont.GetOverline());
- rState.textUnderlineStyle = rParms.maFontUnderline.is_initialized() ?
+ rState.textUnderlineStyle = rParms.maFontUnderline ?
(*rParms.maFontUnderline ? sal_Int8(LINESTYLE_SINGLE) : sal_Int8(LINESTYLE_NONE)) :
static_cast<sal_Int8>(rFont.GetUnderline());
rState.textStrikeoutStyle = static_cast<sal_Int8>(rFont.GetStrikeout());
@@ -2916,19 +2916,19 @@ namespace cppcanvas
}
// apply overrides from the Parameters struct
- if( rParams.maFillColor.is_initialized() )
+ if( rParams.maFillColor )
{
::cppcanvas::internal::OutDevState& rState = aStateStack.getState();
rState.isFillColorSet = true;
rState.fillColor = tools::intSRGBAToDoubleSequence( *rParams.maFillColor );
}
- if( rParams.maLineColor.is_initialized() )
+ if( rParams.maLineColor )
{
::cppcanvas::internal::OutDevState& rState = aStateStack.getState();
rState.isLineColorSet = true;
rState.lineColor = tools::intSRGBAToDoubleSequence( *rParams.maLineColor );
}
- if( rParams.maTextColor.is_initialized() )
+ if( rParams.maTextColor )
{
::cppcanvas::internal::OutDevState& rState = aStateStack.getState();
rState.isTextFillColorSet = true;
@@ -2939,10 +2939,10 @@ namespace cppcanvas
rState.textOverlineColor =
rState.textLineColor = tools::intSRGBAToDoubleSequence( *rParams.maTextColor );
}
- if( rParams.maFontName.is_initialized() ||
- rParams.maFontWeight.is_initialized() ||
- rParams.maFontLetterForm.is_initialized() ||
- rParams.maFontUnderline.is_initialized() )
+ if( rParams.maFontName ||
+ rParams.maFontWeight ||
+ rParams.maFontLetterForm ||
+ rParams.maFontUnderline )
{
::cppcanvas::internal::OutDevState& rState = aStateStack.getState();
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 25d899e6e3d9..f2b50e198606 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -2073,7 +2073,7 @@ namespace cppcanvas
rCanvas->getUNOCanvas()->getDevice(),
aResultingPolyPolygon ) );
- if( rParms.maTextTransformation.is_initialized() )
+ if( rParms.maTextTransformation )
{
return std::shared_ptr<Action>(
new OutlineAction(
@@ -2190,7 +2190,7 @@ namespace cppcanvas
rTextFillColor == aEmptyColor )
{
// nope
- if( rParms.maTextTransformation.is_initialized() )
+ if( rParms.maTextTransformation )
{
ret = std::shared_ptr<Action>( new TextAction(
aStartPoint,
@@ -2215,7 +2215,7 @@ namespace cppcanvas
else
{
// at least one of the effects requested
- if( rParms.maTextTransformation.is_initialized() )
+ if( rParms.maTextTransformation )
ret = std::shared_ptr<Action>( new EffectTextAction(
aStartPoint,
aReliefOffset,
@@ -2257,7 +2257,7 @@ namespace cppcanvas
rTextFillColor == aEmptyColor )
{
// nope
- if( rParms.maTextTransformation.is_initialized() )
+ if( rParms.maTextTransformation )
ret = std::shared_ptr<Action>( new TextArrayAction(
aStartPoint,
rText,
@@ -2280,7 +2280,7 @@ namespace cppcanvas
else
{
// at least one of the effects requested
- if( rParms.maTextTransformation.is_initialized() )
+ if( rParms.maTextTransformation )
ret = std::shared_ptr<Action>( new EffectTextArrayAction(
aStartPoint,
aReliefOffset,
diff --git a/cppcanvas/source/tools/canvasgraphichelper.cxx b/cppcanvas/source/tools/canvasgraphichelper.cxx
index d5ed22ee8ec9..d67efbe8e7ef 100644
--- a/cppcanvas/source/tools/canvasgraphichelper.cxx
+++ b/cppcanvas/source/tools/canvasgraphichelper.cxx
@@ -55,7 +55,7 @@ namespace cppcanvas
void CanvasGraphicHelper::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
{
// TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write
- maClipPolyPolygon.reset( rClipPoly );
+ maClipPolyPolygon = rClipPoly;
maRenderState.Clip.clear();
}
diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx
index 102902b71a14..c16e06375231 100644
--- a/cppcanvas/source/wrapper/implcanvas.cxx
+++ b/cppcanvas/source/wrapper/implcanvas.cxx
@@ -65,7 +65,7 @@ namespace cppcanvas
void ImplCanvas::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
{
// TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write
- maClipPolyPolygon.reset( rClipPoly );
+ maClipPolyPolygon = rClipPoly;
maViewState.Clip.clear();
}