diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 12:18:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-22 10:08:35 +0200 |
commit | 3ff9582704a024b4a89da9a63322e117157b5857 (patch) | |
tree | 67eb7c2bfd188ed3f62afe088e7856c78f29c163 /oox/source | |
parent | e9affc204c1d330b2a7873f44b3f575bcccdf4dc (diff) |
make oox::OptValue::assignIfUsed a free function
as a step towards making OptValue into std::optional.
Change-Id: I3eae4034a846dd63a16e501abe4a6eba9d186a49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136266
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/effectproperties.cxx | 14 | ||||
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 46 | ||||
-rw-r--r-- | oox/source/drawingml/lineproperties.cxx | 16 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterproperties.cxx | 26 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 46 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 10 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 20 |
7 files changed, 89 insertions, 89 deletions
diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx index 88d69a16d177..579f4e1ab0ac 100644 --- a/oox/source/drawingml/effectproperties.cxx +++ b/oox/source/drawingml/effectproperties.cxx @@ -21,23 +21,23 @@ namespace oox::drawingml { void EffectGlowProperties ::assignUsed(const EffectGlowProperties& rSourceProps) { - moGlowRad.assignIfUsed( rSourceProps.moGlowRad ); + assignIfUsed( moGlowRad, rSourceProps.moGlowRad ); moGlowColor.assignIfUsed( rSourceProps.moGlowColor ); } void EffectSoftEdgeProperties::assignUsed(const EffectSoftEdgeProperties& rSourceProps) { - moRad.assignIfUsed(rSourceProps.moRad); + assignIfUsed(moRad, rSourceProps.moRad); } void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourceProps) { - moShadowDist.assignIfUsed( rSourceProps.moShadowDist ); - moShadowDir.assignIfUsed( rSourceProps.moShadowDir ); - moShadowSx.assignIfUsed( rSourceProps.moShadowSx ); - moShadowSy.assignIfUsed( rSourceProps.moShadowSy ); + assignIfUsed( moShadowDist, rSourceProps.moShadowDist ); + assignIfUsed( moShadowDir, rSourceProps.moShadowDir ); + assignIfUsed( moShadowSx, rSourceProps.moShadowSx ); + assignIfUsed( moShadowSy, rSourceProps.moShadowSy ); moShadowColor.assignIfUsed( rSourceProps.moShadowColor ); - moShadowBlur.assignIfUsed( rSourceProps.moShadowBlur ); + assignIfUsed( moShadowBlur, rSourceProps.moShadowBlur ); } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index b26c42b85759..f315f0182245 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -292,51 +292,51 @@ void GradientFillProperties::assignUsed( const GradientFillProperties& rSourcePr { if( !rSourceProps.maGradientStops.empty() ) maGradientStops = rSourceProps.maGradientStops; - moFillToRect.assignIfUsed( rSourceProps.moFillToRect ); - moTileRect.assignIfUsed( rSourceProps.moTileRect ); - moGradientPath.assignIfUsed( rSourceProps.moGradientPath ); - moShadeAngle.assignIfUsed( rSourceProps.moShadeAngle ); - moShadeFlip.assignIfUsed( rSourceProps.moShadeFlip ); - moShadeScaled.assignIfUsed( rSourceProps.moShadeScaled ); - moRotateWithShape.assignIfUsed( rSourceProps.moRotateWithShape ); + assignIfUsed( moFillToRect, rSourceProps.moFillToRect ); + assignIfUsed( moTileRect, rSourceProps.moTileRect ); + assignIfUsed( moGradientPath, rSourceProps.moGradientPath ); + assignIfUsed( moShadeAngle, rSourceProps.moShadeAngle ); + assignIfUsed( moShadeFlip, rSourceProps.moShadeFlip ); + assignIfUsed( moShadeScaled, rSourceProps.moShadeScaled ); + assignIfUsed( moRotateWithShape, rSourceProps.moRotateWithShape ); } void PatternFillProperties::assignUsed( const PatternFillProperties& rSourceProps ) { maPattFgColor.assignIfUsed( rSourceProps.maPattFgColor ); maPattBgColor.assignIfUsed( rSourceProps.maPattBgColor ); - moPattPreset.assignIfUsed( rSourceProps.moPattPreset ); + assignIfUsed( moPattPreset, rSourceProps.moPattPreset ); } void BlipFillProperties::assignUsed( const BlipFillProperties& rSourceProps ) { if(rSourceProps.mxFillGraphic.is()) mxFillGraphic = rSourceProps.mxFillGraphic; - moBitmapMode.assignIfUsed( rSourceProps.moBitmapMode ); - moFillRect.assignIfUsed( rSourceProps.moFillRect ); - moTileOffsetX.assignIfUsed( rSourceProps.moTileOffsetX ); - moTileOffsetY.assignIfUsed( rSourceProps.moTileOffsetY ); - moTileScaleX.assignIfUsed( rSourceProps.moTileScaleX ); - moTileScaleY.assignIfUsed( rSourceProps.moTileScaleY ); - moTileAlign.assignIfUsed( rSourceProps.moTileAlign ); - moTileFlip.assignIfUsed( rSourceProps.moTileFlip ); - moRotateWithShape.assignIfUsed( rSourceProps.moRotateWithShape ); - moColorEffect.assignIfUsed( rSourceProps.moColorEffect ); - moBrightness.assignIfUsed( rSourceProps.moBrightness ); - moContrast.assignIfUsed( rSourceProps.moContrast ); + assignIfUsed( moBitmapMode, rSourceProps.moBitmapMode ); + assignIfUsed( moFillRect, rSourceProps.moFillRect ); + assignIfUsed( moTileOffsetX, rSourceProps.moTileOffsetX ); + assignIfUsed( moTileOffsetY, rSourceProps.moTileOffsetY ); + assignIfUsed( moTileScaleX, rSourceProps.moTileScaleX ); + assignIfUsed( moTileScaleY, rSourceProps.moTileScaleY ); + assignIfUsed( moTileAlign, rSourceProps.moTileAlign ); + assignIfUsed( moTileFlip, rSourceProps.moTileFlip ); + assignIfUsed( moRotateWithShape, rSourceProps.moRotateWithShape ); + assignIfUsed( moColorEffect, rSourceProps.moColorEffect ); + assignIfUsed( moBrightness, rSourceProps.moBrightness ); + assignIfUsed( moContrast, rSourceProps.moContrast ); maColorChangeFrom.assignIfUsed( rSourceProps.maColorChangeFrom ); maColorChangeTo.assignIfUsed( rSourceProps.maColorChangeTo ); maDuotoneColors[0].assignIfUsed( rSourceProps.maDuotoneColors[0] ); maDuotoneColors[1].assignIfUsed( rSourceProps.maDuotoneColors[1] ); maEffect.assignUsed( rSourceProps.maEffect ); - moAlphaModFix.assignIfUsed(rSourceProps.moAlphaModFix); + assignIfUsed(moAlphaModFix, rSourceProps.moAlphaModFix); } void FillProperties::assignUsed( const FillProperties& rSourceProps ) { - moFillType.assignIfUsed( rSourceProps.moFillType ); + assignIfUsed( moFillType, rSourceProps.moFillType ); maFillColor.assignIfUsed( rSourceProps.maFillColor ); - moUseBgFill.assignIfUsed( rSourceProps.moUseBgFill ); + assignIfUsed( moUseBgFill, rSourceProps.moUseBgFill ); maGradientProps.assignUsed( rSourceProps.maGradientProps ); maPatternProps.assignUsed( rSourceProps.maPatternProps ); maBlipProps.assignUsed( rSourceProps.maBlipProps ); diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 4cd83045840a..3e32944825a0 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -410,9 +410,9 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, void LineArrowProperties::assignUsed( const LineArrowProperties& rSourceProps ) { - moArrowType.assignIfUsed( rSourceProps.moArrowType ); - moArrowWidth.assignIfUsed( rSourceProps.moArrowWidth ); - moArrowLength.assignIfUsed( rSourceProps.moArrowLength ); + assignIfUsed( moArrowType, rSourceProps.moArrowType ); + assignIfUsed( moArrowWidth, rSourceProps.moArrowWidth ); + assignIfUsed( moArrowLength, rSourceProps.moArrowLength ); } void LineProperties::assignUsed( const LineProperties& rSourceProps ) @@ -422,11 +422,11 @@ void LineProperties::assignUsed( const LineProperties& rSourceProps ) maLineFill.assignUsed( rSourceProps.maLineFill ); if( !rSourceProps.maCustomDash.empty() ) maCustomDash = rSourceProps.maCustomDash; - moLineWidth.assignIfUsed( rSourceProps.moLineWidth ); - moPresetDash.assignIfUsed( rSourceProps.moPresetDash ); - moLineCompound.assignIfUsed( rSourceProps.moLineCompound ); - moLineCap.assignIfUsed( rSourceProps.moLineCap ); - moLineJoint.assignIfUsed( rSourceProps.moLineJoint ); + assignIfUsed( moLineWidth, rSourceProps.moLineWidth ); + assignIfUsed( moPresetDash, rSourceProps.moPresetDash ); + assignIfUsed( moLineCompound, rSourceProps.moLineCompound ); + assignIfUsed( moLineCap, rSourceProps.moLineCap ); + assignIfUsed( moLineJoint, rSourceProps.moLineJoint ); } void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 0406d7fa72b0..7cae52fcfd97 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -53,19 +53,19 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource maSymbolFont.assignIfUsed( rSourceProps.maSymbolFont ); maHighlightColor.assignIfUsed( rSourceProps.maHighlightColor ); maUnderlineColor.assignIfUsed( rSourceProps.maUnderlineColor ); - moLang.assignIfUsed( rSourceProps.moLang ); - moHeight.assignIfUsed( rSourceProps.moHeight ); - moFontScale.assignIfUsed(rSourceProps.moFontScale); - moSpacing.assignIfUsed( rSourceProps.moSpacing ); - moUnderline.assignIfUsed( rSourceProps.moUnderline ); - moBaseline.assignIfUsed( rSourceProps.moBaseline ); - moStrikeout.assignIfUsed( rSourceProps.moStrikeout ); - moCaseMap.assignIfUsed( rSourceProps.moCaseMap ); - moBold.assignIfUsed( rSourceProps.moBold ); - moItalic.assignIfUsed( rSourceProps.moItalic ); - moUnderlineLineFollowText.assignIfUsed( rSourceProps.moUnderlineLineFollowText ); - moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText ); - moTextOutlineProperties.assignIfUsed(rSourceProps.moTextOutlineProperties); + assignIfUsed( moLang, rSourceProps.moLang ); + assignIfUsed( moHeight, rSourceProps.moHeight ); + assignIfUsed( moFontScale, rSourceProps.moFontScale); + assignIfUsed( moSpacing, rSourceProps.moSpacing ); + assignIfUsed( moUnderline, rSourceProps.moUnderline ); + assignIfUsed( moBaseline, rSourceProps.moBaseline ); + assignIfUsed( moStrikeout, rSourceProps.moStrikeout ); + assignIfUsed( moCaseMap, rSourceProps.moCaseMap ); + assignIfUsed( moBold, rSourceProps.moBold ); + assignIfUsed( moItalic, rSourceProps.moItalic ); + assignIfUsed( moUnderlineLineFollowText, rSourceProps.moUnderlineLineFollowText ); + assignIfUsed( moUnderlineFillFollowText, rSourceProps.moUnderlineFillFollowText ); + assignIfUsed( moTextOutlineProperties, rSourceProps.moTextOutlineProperties); maTextEffectsProperties = rSourceProps.maTextEffectsProperties; maFillProperties.assignUsed( rSourceProps.maFillProperties ); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 5ac7eade0521..da922ab91370 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -675,23 +675,23 @@ sal_Int32 lclGetDmlLineJoint( const OptValue< sal_Int32 >& roJoinStyle ) void StrokeArrowModel::assignUsed( const StrokeArrowModel& rSource ) { - moArrowType.assignIfUsed( rSource.moArrowType ); - moArrowWidth.assignIfUsed( rSource.moArrowWidth ); - moArrowLength.assignIfUsed( rSource.moArrowLength ); + assignIfUsed( moArrowType, rSource.moArrowType ); + assignIfUsed( moArrowWidth, rSource.moArrowWidth ); + assignIfUsed( moArrowLength, rSource.moArrowLength ); } void StrokeModel::assignUsed( const StrokeModel& rSource ) { - moStroked.assignIfUsed( rSource.moStroked ); + assignIfUsed( moStroked, rSource.moStroked ); maStartArrow.assignUsed( rSource.maStartArrow ); maEndArrow.assignUsed( rSource.maEndArrow ); - moColor.assignIfUsed( rSource.moColor ); - moOpacity.assignIfUsed( rSource.moOpacity ); - moWeight.assignIfUsed( rSource.moWeight ); - moDashStyle.assignIfUsed( rSource.moDashStyle ); - moLineStyle.assignIfUsed( rSource.moLineStyle ); - moEndCap.assignIfUsed( rSource.moEndCap ); - moJoinStyle.assignIfUsed( rSource.moJoinStyle ); + assignIfUsed( moColor, rSource.moColor ); + assignIfUsed( moOpacity, rSource.moOpacity ); + assignIfUsed( moWeight, rSource.moWeight ); + assignIfUsed( moDashStyle, rSource.moDashStyle ); + assignIfUsed( moLineStyle, rSource.moLineStyle ); + assignIfUsed( moEndCap, rSource.moEndCap ); + assignIfUsed( moJoinStyle, rSource.moJoinStyle ); } void StrokeModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const @@ -722,18 +722,18 @@ void StrokeModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper void FillModel::assignUsed( const FillModel& rSource ) { - moFilled.assignIfUsed( rSource.moFilled ); - moColor.assignIfUsed( rSource.moColor ); - moOpacity.assignIfUsed( rSource.moOpacity ); - moColor2.assignIfUsed( rSource.moColor2 ); - moOpacity2.assignIfUsed( rSource.moOpacity2 ); - moType.assignIfUsed( rSource.moType ); - moAngle.assignIfUsed( rSource.moAngle ); - moFocus.assignIfUsed( rSource.moFocus ); - moFocusPos.assignIfUsed( rSource.moFocusPos ); - moFocusSize.assignIfUsed( rSource.moFocusSize ); - moBitmapPath.assignIfUsed( rSource.moBitmapPath ); - moRotate.assignIfUsed( rSource.moRotate ); + assignIfUsed( moFilled, rSource.moFilled ); + assignIfUsed( moColor, rSource.moColor ); + assignIfUsed( moOpacity, rSource.moOpacity ); + assignIfUsed( moColor2, rSource.moColor2 ); + assignIfUsed( moOpacity2, rSource.moOpacity2 ); + assignIfUsed( moType, rSource.moType ); + assignIfUsed( moAngle, rSource.moAngle ); + assignIfUsed( moFocus, rSource.moFocus ); + assignIfUsed( moFocusPos, rSource.moFocusPos ); + assignIfUsed( moFocusSize, rSource.moFocusSize ); + assignIfUsed( moBitmapPath, rSource.moBitmapPath ); + assignIfUsed( moRotate, rSource.moRotate ); } static void lcl_setGradientStop( std::multimap< double, Color >& rMap, const double fKey, const Color& rValue ) { diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index e79da70bcc6e..97c51325c5fd 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -136,15 +136,15 @@ ShapeTypeModel::ShapeTypeModel(): void ShapeTypeModel::assignUsed( const ShapeTypeModel& rSource ) { - moShapeType.assignIfUsed( rSource.moShapeType ); - moCoordPos.assignIfUsed( rSource.moCoordPos ); - moCoordSize.assignIfUsed( rSource.moCoordSize ); + assignIfUsed( moShapeType, rSource.moShapeType ); + assignIfUsed( moCoordPos, rSource.moCoordPos ); + assignIfUsed( moCoordSize, rSource.moCoordSize ); /* The style properties position, left, top, width, height, margin-left, margin-top are not derived from shape template to shape. */ maStrokeModel.assignUsed( rSource.maStrokeModel ); maFillModel.assignUsed( rSource.maFillModel ); - moGraphicPath.assignIfUsed( rSource.moGraphicPath ); - moGraphicTitle.assignIfUsed( rSource.moGraphicTitle ); + assignIfUsed( moGraphicPath, rSource.moGraphicPath ); + assignIfUsed( moGraphicTitle, rSource.moGraphicTitle ); } ShapeType::ShapeType( Drawing& rDrawing ) : diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index de6bf421288d..a75940a272fe 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -349,16 +349,16 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A if( isRootElement() ) switch( nElement ) { case VML_TOKEN( stroke ): - mrTypeModel.maStrokeModel.moStroked.assignIfUsed( lclDecodeBool( rAttribs, XML_on ) ); + assignIfUsed( mrTypeModel.maStrokeModel.moStroked, lclDecodeBool( rAttribs, XML_on ) ); mrTypeModel.maStrokeModel.maStartArrow.moArrowType = rAttribs.getToken( XML_startarrow ); mrTypeModel.maStrokeModel.maStartArrow.moArrowWidth = rAttribs.getToken( XML_startarrowwidth ); mrTypeModel.maStrokeModel.maStartArrow.moArrowLength = rAttribs.getToken( XML_startarrowlength ); mrTypeModel.maStrokeModel.maEndArrow.moArrowType = rAttribs.getToken( XML_endarrow ); mrTypeModel.maStrokeModel.maEndArrow.moArrowWidth = rAttribs.getToken( XML_endarrowwidth ); mrTypeModel.maStrokeModel.maEndArrow.moArrowLength = rAttribs.getToken( XML_endarrowlength ); - mrTypeModel.maStrokeModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) ); + assignIfUsed( mrTypeModel.maStrokeModel.moColor, rAttribs.getString( XML_color ) ); mrTypeModel.maStrokeModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 ); - mrTypeModel.maStrokeModel.moWeight.assignIfUsed( rAttribs.getString( XML_weight ) ); + assignIfUsed( mrTypeModel.maStrokeModel.moWeight, rAttribs.getString( XML_weight ) ); mrTypeModel.maStrokeModel.moDashStyle = rAttribs.getString( XML_dashstyle ); mrTypeModel.maStrokeModel.moLineStyle = rAttribs.getToken( XML_linestyle ); mrTypeModel.maStrokeModel.moEndCap = rAttribs.getToken( XML_endcap ); @@ -369,8 +369,8 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A // in DOCX shapes use r:id for the relationship id // in XLSX they use o:relid bool bHasORelId = rAttribs.hasAttribute( O_TOKEN(relid) ); - mrTypeModel.maFillModel.moFilled.assignIfUsed( lclDecodeBool( rAttribs, XML_on ) ); - mrTypeModel.maFillModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) ); + assignIfUsed( mrTypeModel.maFillModel.moFilled, lclDecodeBool( rAttribs, XML_on ) ); + assignIfUsed( mrTypeModel.maFillModel.moColor, rAttribs.getString( XML_color ) ); mrTypeModel.maFillModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 ); mrTypeModel.maFillModel.moColor2 = rAttribs.getString( XML_color2 ); mrTypeModel.maFillModel.moOpacity2 = lclDecodeOpacity( rAttribs, XML_opacity2, 1.0 ); @@ -436,15 +436,15 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A { mrTypeModel.maShadowModel.mbHasShadow = true; mrTypeModel.maShadowModel.moShadowOn = lclDecodeBool(rAttribs, XML_on).get(false); - mrTypeModel.maShadowModel.moColor.assignIfUsed(rAttribs.getString(XML_color)); - mrTypeModel.maShadowModel.moOffset.assignIfUsed(rAttribs.getString(XML_offset)); + assignIfUsed(mrTypeModel.maShadowModel.moColor, rAttribs.getString(XML_color)); + assignIfUsed(mrTypeModel.maShadowModel.moOffset, rAttribs.getString(XML_offset)); mrTypeModel.maShadowModel.moOpacity = lclDecodePercent(rAttribs, XML_opacity, 1.0); } break; case VML_TOKEN( textpath ): - mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string)); - mrTypeModel.maTextpathModel.moStyle.assignIfUsed(rAttribs.getString(XML_style)); - mrTypeModel.maTextpathModel.moTrim.assignIfUsed(lclDecodeBool(rAttribs, XML_trim)); + assignIfUsed(mrTypeModel.maTextpathModel.moString, rAttribs.getString(XML_string)); + assignIfUsed(mrTypeModel.maTextpathModel.moStyle, rAttribs.getString(XML_style)); + assignIfUsed(mrTypeModel.maTextpathModel.moTrim, lclDecodeBool(rAttribs, XML_trim)); break; } return nullptr; |