diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 13:17:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-27 11:32:42 +0200 |
commit | 04073c5fedd33654f242fecb7e39afb07cf0e273 (patch) | |
tree | 467852ad2c7ca41b90c89eff2b6c9e4ae5544617 /oox | |
parent | 5b21b65572610df88986e700b81f1156aff14f65 (diff) |
replace oox::OptValue with std::optional
Change-Id: I16e7179b2851640b4d73665685dcc1e84042ddaf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136270
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
26 files changed, 206 insertions, 206 deletions
diff --git a/oox/inc/drawingml/chart/axismodel.hxx b/oox/inc/drawingml/chart/axismodel.hxx index 6ecd411e1ed1..0c1799276083 100644 --- a/oox/inc/drawingml/chart/axismodel.hxx +++ b/oox/inc/drawingml/chart/axismodel.hxx @@ -57,13 +57,13 @@ struct AxisModel ShapeRef mxMajorGridLines; /// Major grid lines formatting. ShapeRef mxMinorGridLines; /// Minor grid lines formatting. NumberFormat maNumberFormat; /// Number format for axis tick labels. - OptValue< double > mofCrossesAt; /// Position on this axis where another axis crosses. - OptValue< double > mofMajorUnit; /// Unit for major tick marks on date/value axis. - OptValue< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis. - OptValue< double > mofLogBase; /// Logarithmic base for logarithmic axes. - OptValue< double > mofMax; /// Maximum axis value. - OptValue< double > mofMin; /// Minimum axis value. - OptValue< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis. + std::optional< double > mofCrossesAt; /// Position on this axis where another axis crosses. + std::optional< double > mofMajorUnit; /// Unit for major tick marks on date/value axis. + std::optional< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis. + std::optional< double > mofLogBase; /// Logarithmic base for logarithmic axes. + std::optional< double > mofMax; /// Maximum axis value. + std::optional< double > mofMin; /// Minimum axis value. + std::optional< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis. sal_Int32 mnAxisId; /// Unique axis identifier. sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right). sal_Int32 mnCrossAxisId; /// Identifier of a crossing axis. diff --git a/oox/inc/drawingml/chart/plotareamodel.hxx b/oox/inc/drawingml/chart/plotareamodel.hxx index 11990095378f..c635f99b4fe6 100644 --- a/oox/inc/drawingml/chart/plotareamodel.hxx +++ b/oox/inc/drawingml/chart/plotareamodel.hxx @@ -30,9 +30,9 @@ namespace oox::drawingml::chart { struct View3DModel { - OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width. - OptValue< sal_Int32 > monRotationX; /// Horizontal rotation in degrees. - OptValue< sal_Int32 > monRotationY; /// Vertical rotation in degrees. + std::optional< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width. + std::optional< sal_Int32 > monRotationX; /// Horizontal rotation in degrees. + std::optional< sal_Int32 > monRotationY; /// Vertical rotation in degrees. sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width. sal_Int32 mnPerspective; /// Eye distance to the 3D objects. bool mbRightAngled; /// True = right-angled axes in 3D view. diff --git a/oox/inc/drawingml/chart/seriesmodel.hxx b/oox/inc/drawingml/chart/seriesmodel.hxx index 34656a6daf4a..4f48115676f0 100644 --- a/oox/inc/drawingml/chart/seriesmodel.hxx +++ b/oox/inc/drawingml/chart/seriesmodel.hxx @@ -33,18 +33,18 @@ struct DataLabelModelBase ShapeRef mxShapeProp; /// Data label frame formatting. TextBodyRef mxTextProp; /// Data label text formatting. NumberFormat maNumberFormat; /// Number format for numeric data labels. - OptValue< OUString > moaSeparator;/// Separator between label components. - OptValue< sal_Int32 > monLabelPos; /// Data label position. - OptValue< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts. - OptValue< bool > mobShowCatName; /// True = show category name of data points. - OptValue< bool > mobShowLegendKey; /// True = show legend key of data series. - OptValue< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts. - OptValue< bool > mobShowSerName; /// True = show series name. - OptValue< bool > mobShowVal; /// True = show data point value. + std::optional< OUString > moaSeparator;/// Separator between label components. + std::optional< sal_Int32 > monLabelPos; /// Data label position. + std::optional< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts. + std::optional< bool > mobShowCatName; /// True = show category name of data points. + std::optional< bool > mobShowLegendKey; /// True = show legend key of data series. + std::optional< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts. + std::optional< bool > mobShowSerName; /// True = show series name. + std::optional< bool > mobShowVal; /// True = show data point value. /// True = the value from the <c15:datalabelsRange> corresponding to the /// index of this label is used as the label text. - OptValue< bool > mobShowDataLabelsRange; + std::optional< bool > mobShowDataLabelsRange; bool mbDeleted; /// True = data label(s) deleted. explicit DataLabelModelBase(bool bMSO2007Doc); @@ -142,9 +142,9 @@ struct TrendlineModel ShapeRef mxShapeProp; /// Trendline formatting. TrendlineLabelRef mxLabel; /// Trendline label text object. OUString maName; /// User-defined name of the trendline. - OptValue< double > mfBackward; /// Size of trendline before first data point. - OptValue< double > mfForward; /// Size of trendline behind last data point. - OptValue< double > mfIntercept; /// Crossing point with Y axis. + std::optional< double > mfBackward; /// Size of trendline before first data point. + std::optional< double > mfForward; /// Size of trendline behind last data point. + std::optional< double > mfIntercept; /// Crossing point with Y axis. sal_Int32 mnOrder; /// Polynomial order in range [2, 6]. sal_Int32 mnPeriod; /// Moving average period in range [2, 255]. sal_Int32 mnTypeId; /// Type of the trendline. @@ -163,10 +163,10 @@ struct DataPointModel ShapeRef mxShapeProp; /// Data point formatting. PictureOptionsRef mxPicOptions; /// Fill bitmap settings. ShapeRef mxMarkerProp; /// Data point marker formatting. - OptValue< sal_Int32 > monExplosion; /// Pie slice moved from pie center. - OptValue< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72). - OptValue< sal_Int32 > monMarkerSymbol; /// Series line marker symbol. - OptValue< bool > mobBubble3d; /// True = show bubbles with 3D shade. + std::optional< sal_Int32 > monExplosion; /// Pie slice moved from pie center. + std::optional< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72). + std::optional< sal_Int32 > monMarkerSymbol; /// Series line marker symbol. + std::optional< bool > mobBubble3d; /// True = show bubbles with 3D shade. sal_Int32 mnIndex; /// Unique data point index. bool mbInvertNeg; /// True = invert negative data points (not derived from series!). @@ -202,7 +202,7 @@ struct SeriesModel ShapeRef mxMarkerProp; /// Data point marker formatting. TextRef mxText; /// Series title source. DataLabelsRef mxLabels; /// Data point label settings for all points. - OptValue< sal_Int32 > monShape; /// 3D bar shape type. + std::optional< sal_Int32 > monShape; /// 3D bar shape type. sal_Int32 mnExplosion; /// Pie slice moved from pie center. sal_Int32 mnIndex; /// Series index used for automatic formatting. sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72). diff --git a/oox/inc/drawingml/customshapeproperties.hxx b/oox/inc/drawingml/customshapeproperties.hxx index ea9b9e9d53af..74369c5286d6 100644 --- a/oox/inc/drawingml/customshapeproperties.hxx +++ b/oox/inc/drawingml/customshapeproperties.hxx @@ -49,15 +49,15 @@ struct AdjustHandle pos; // depending to the type (polar or not): - OptValue< OUString > gdRef1; // gdRefX or gdRefR - OptValue< css::drawing::EnhancedCustomShapeParameter > + std::optional< OUString > gdRef1; // gdRefX or gdRefR + std::optional< css::drawing::EnhancedCustomShapeParameter > min1; // minX or minR - OptValue< css::drawing::EnhancedCustomShapeParameter > + std::optional< css::drawing::EnhancedCustomShapeParameter > max1; // maxX or maxR - OptValue< OUString > gdRef2; // gdRefY or gdRefAng - OptValue< css::drawing::EnhancedCustomShapeParameter > + std::optional< OUString > gdRef2; // gdRefY or gdRefAng + std::optional< css::drawing::EnhancedCustomShapeParameter > min2; // minX or minAng - OptValue< css::drawing::EnhancedCustomShapeParameter > + std::optional< css::drawing::EnhancedCustomShapeParameter > max2; // maxY or maxAng AdjustHandle( bool bPolar ) : polar( bPolar ) {}; @@ -110,7 +110,7 @@ public: std::vector< CustomShapeGuide >& getGuideList(){ return maGuideList; }; std::vector< AdjustHandle >& getAdjustHandleList(){ return maAdjustHandleList; }; std::vector< ConnectionSite >& getConnectionSiteList(){ return maConnectionSiteList; }; - OptValue< GeomRect >& getTextRect(){ return maTextRect; }; + std::optional< GeomRect >& getTextRect(){ return maTextRect; }; std::vector< Path2D >& getPath2DList(){ return maPath2DList; }; std::vector< css::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; }; void setMirroredX( bool bMirroredX ) { mbMirroredX = bMirroredX; }; @@ -137,7 +137,7 @@ private: std::vector< CustomShapeGuide > maGuideList; std::vector< AdjustHandle > maAdjustHandleList; std::vector< ConnectionSite > maConnectionSiteList; - OptValue< GeomRect > maTextRect; + std::optional< GeomRect > maTextRect; std::vector< Path2D > maPath2DList; std::vector< css::drawing::EnhancedCustomShapeSegment > diff --git a/oox/inc/drawingml/fillproperties.hxx b/oox/inc/drawingml/fillproperties.hxx index b4f3d00fabc6..9cef3c98f2b1 100644 --- a/oox/inc/drawingml/fillproperties.hxx +++ b/oox/inc/drawingml/fillproperties.hxx @@ -49,13 +49,13 @@ struct GradientFillProperties typedef ::std::multimap< double, Color > GradientStopMap; GradientStopMap maGradientStops; /// Gradient stops (colors/transparence). - OptValue< css::geometry::IntegerRectangle2D > moFillToRect; - OptValue< css::geometry::IntegerRectangle2D > moTileRect; - OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape. - OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients. - OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape. - OptValue< bool > moShadeScaled; /// True = scale gradient into shape. - OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape. + std::optional< css::geometry::IntegerRectangle2D > moFillToRect; + std::optional< css::geometry::IntegerRectangle2D > moTileRect; + std::optional< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape. + std::optional< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients. + std::optional< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape. + std::optional< bool > moShadeScaled; /// True = scale gradient into shape. + std::optional< bool > moRotateWithShape; /// True = rotate gradient with shape. /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const GradientFillProperties& rSourceProps ); @@ -65,7 +65,7 @@ struct PatternFillProperties { Color maPattFgColor; /// Pattern foreground color. Color maPattBgColor; /// Pattern background color. - OptValue< sal_Int32 > moPattPreset; /// Preset pattern type. + std::optional< sal_Int32 > moPattPreset; /// Preset pattern type. /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const PatternFillProperties& rSourceProps ); @@ -97,28 +97,28 @@ struct ArtisticEffectProperties struct BlipFillProperties { css::uno::Reference<css::graphic::XGraphic> mxFillGraphic; /// The fill graphic. - OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. - OptValue< css::geometry::IntegerRectangle2D > + std::optional< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. + std::optional< css::geometry::IntegerRectangle2D > moFillRect; /// Stretch fill offsets. - OptValue< css::geometry::IntegerRectangle2D > + std::optional< css::geometry::IntegerRectangle2D > moClipRect; - OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs). - OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs). - OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent). - OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent). - OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap. - OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles. - OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape. + std::optional< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs). + std::optional< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs). + std::optional< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent). + std::optional< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent). + std::optional< sal_Int32 > moTileAlign; /// Anchor point inside bitmap. + std::optional< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles. + std::optional< bool > moRotateWithShape; /// True = rotate bitmap with shape. // effects - OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect. - OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000]. - OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000]. + std::optional< sal_Int32 > moColorEffect; /// XML token for a color effect. + std::optional< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000]. + std::optional< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000]. Color maColorChangeFrom; /// Start color of color transformation. Color maColorChangeTo; /// Destination color of color transformation. Color maDuotoneColors[2]; /// Duotone Colors ArtisticEffectProperties maEffect; /// Artistic effect, not supported by core. - OptValue<sal_Int32> moAlphaModFix; ///< Alpha Modulate Fixed Effect. + std::optional<sal_Int32> moAlphaModFix; ///< Alpha Modulate Fixed Effect. /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const BlipFillProperties& rSourceProps ); @@ -126,9 +126,9 @@ struct BlipFillProperties struct FillProperties { - OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token). + std::optional< sal_Int32 > moFillType; /// Fill type (OOXML token). Color maFillColor; /// Solid fill color and transparence. - OptValue< bool > moUseBgFill; /// Whether the background is used as fill type + std::optional< bool > moUseBgFill; /// Whether the background is used as fill type GradientFillProperties maGradientProps; /// Properties for gradient fills. PatternFillProperties maPatternProps; /// Properties for pattern fills. BlipFillProperties maBlipProps; /// Properties for bitmap fills. diff --git a/oox/inc/drawingml/lineproperties.hxx b/oox/inc/drawingml/lineproperties.hxx index 214aadba12e9..f2d37a7f8a9f 100644 --- a/oox/inc/drawingml/lineproperties.hxx +++ b/oox/inc/drawingml/lineproperties.hxx @@ -39,9 +39,9 @@ class ShapePropertyMap; struct LineArrowProperties { - OptValue< sal_Int32 > moArrowType; - OptValue< sal_Int32 > moArrowWidth; - OptValue< sal_Int32 > moArrowLength; + std::optional< sal_Int32 > moArrowType; + std::optional< sal_Int32 > moArrowWidth; + std::optional< sal_Int32 > moArrowLength; /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const LineArrowProperties& rSourceProps ); @@ -56,11 +56,11 @@ struct LineProperties LineArrowProperties maEndArrow; /// End line arrow style. FillProperties maLineFill; /// Line fill (solid, gradient, ...). DashStopVector maCustomDash; /// User-defined line dash style. - OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs). - OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token). - OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token). - OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token). - OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token). + std::optional< sal_Int32 > moLineWidth; /// Line width (EMUs). + std::optional< sal_Int32 > moPresetDash; /// Preset dash (OOXML token). + std::optional< sal_Int32 > moLineCompound; /// Line compound type (OOXML token). + std::optional< sal_Int32 > moLineCap; /// Line cap (OOXML token). + std::optional< sal_Int32 > moLineJoint; /// Line joint type (OOXML token). /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const LineProperties& rSourceProps ); diff --git a/oox/inc/drawingml/shape3dproperties.hxx b/oox/inc/drawingml/shape3dproperties.hxx index c43e643aae5c..80bc01271ece 100644 --- a/oox/inc/drawingml/shape3dproperties.hxx +++ b/oox/inc/drawingml/shape3dproperties.hxx @@ -32,37 +32,37 @@ namespace oox::drawingml { struct RotationProperties { - OptValue< sal_Int32 > mnLatitude; - OptValue< sal_Int32 > mnLongitude; - OptValue< sal_Int32 > mnRevolution; + std::optional< sal_Int32 > mnLatitude; + std::optional< sal_Int32 > mnLongitude; + std::optional< sal_Int32 > mnRevolution; }; struct BevelProperties { - OptValue< sal_Int32 > mnPreset; - OptValue< sal_Int32 > mnWidth; - OptValue< sal_Int32 > mnHeight; + std::optional< sal_Int32 > mnPreset; + std::optional< sal_Int32 > mnWidth; + std::optional< sal_Int32 > mnHeight; }; struct Generic3DProperties { - OptValue< sal_Int32 > mnPreset; - OptValue< float > mfFieldOfVision; - OptValue< float > mfZoom; - OptValue< sal_Int32 > mnLightRigDirection; - OptValue< sal_Int32 > mnLightRigType; + std::optional< sal_Int32 > mnPreset; + std::optional< float > mfFieldOfVision; + std::optional< float > mfZoom; + std::optional< sal_Int32 > mnLightRigDirection; + std::optional< sal_Int32 > mnLightRigType; RotationProperties maCameraRotation; RotationProperties maLightRigRotation; - OptValue< sal_Int32 > mnExtrusionH; - OptValue< sal_Int32 > mnContourW; - OptValue< sal_Int32 > mnShapeZ; - OptValue< sal_Int32 > mnMaterial; + std::optional< sal_Int32 > mnExtrusionH; + std::optional< sal_Int32 > mnContourW; + std::optional< sal_Int32 > mnShapeZ; + std::optional< sal_Int32 > mnMaterial; Color maExtrusionColor; Color maContourColor; - OptValue< BevelProperties > maTopBevelProperties; - OptValue< BevelProperties > maBottomBevelProperties; + std::optional< BevelProperties > maTopBevelProperties; + std::optional< BevelProperties > maBottomBevelProperties; static OUString getCameraPrstName( sal_Int32 nElement ); static OUString getLightRigName( sal_Int32 nElement ); diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx index 7cc1b9d8041c..8d115848f6ec 100644 --- a/oox/inc/drawingml/textbodyproperties.hxx +++ b/oox/inc/drawingml/textbodyproperties.hxx @@ -34,9 +34,9 @@ namespace oox::drawingml { struct TextBodyProperties { PropertyMap maPropertyMap; - OptValue< sal_Int32 > moRotation; + std::optional< sal_Int32 > moRotation; bool mbAnchorCtr; - OptValue< sal_Int32 > moVert; + std::optional< sal_Int32 > moVert; bool moUpright = false; std::array<std::optional<sal_Int32>, 4> moInsets; std::optional< sal_Int32 > moTextOffUpper; diff --git a/oox/inc/drawingml/textcharacterproperties.hxx b/oox/inc/drawingml/textcharacterproperties.hxx index 49d4125698a4..40842585d10a 100644 --- a/oox/inc/drawingml/textcharacterproperties.hxx +++ b/oox/inc/drawingml/textcharacterproperties.hxx @@ -45,20 +45,20 @@ struct TextCharacterProperties TextFont maSymbolFont; Color maUnderlineColor; Color maHighlightColor; - OptValue< OUString > moLang; - OptValue< sal_Int32 > moHeight; + std::optional< OUString > moLang; + std::optional< sal_Int32 > moHeight; /// If a font scale has to be applied manually to moHeight. - OptValue< double > moFontScale; - OptValue< sal_Int32 > moSpacing; - OptValue< sal_Int32 > moUnderline; - OptValue< sal_Int32 > moBaseline; - OptValue< sal_Int32 > moStrikeout; - OptValue< sal_Int32 > moCaseMap; - OptValue< bool > moBold; - OptValue< bool > moItalic; - OptValue< bool > moUnderlineLineFollowText; - OptValue< bool > moUnderlineFillFollowText; - OptValue<LineProperties> moTextOutlineProperties; + std::optional< double > moFontScale; + std::optional< sal_Int32 > moSpacing; + std::optional< sal_Int32 > moUnderline; + std::optional< sal_Int32 > moBaseline; + std::optional< sal_Int32 > moStrikeout; + std::optional< sal_Int32 > moCaseMap; + std::optional< bool > moBold; + std::optional< bool > moItalic; + std::optional< bool > moUnderlineLineFollowText; + std::optional< bool > moUnderlineFillFollowText; + std::optional<LineProperties> moTextOutlineProperties; FillProperties maFillProperties; /// Set if there was a property set that alters run visually during import diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 8d6ba3fab509..ba22dc5e028e 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -53,7 +53,7 @@ using namespace ::com::sun::star::uno; namespace { -void lclSetValueOrClearAny( Any& orAny, const OptValue< double >& rofValue ) +void lclSetValueOrClearAny( Any& orAny, const std::optional< double >& rofValue ) { if( rofValue.has_value() ) orAny <<= rofValue.value(); else orAny.clear(); } @@ -76,7 +76,7 @@ sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit ) return TimeUnit::DAY; } -void lclConvertTimeInterval( Any& orInterval, const OptValue< double >& rofUnit, sal_Int32 nTimeUnit ) +void lclConvertTimeInterval( Any& orInterval, const std::optional< double >& rofUnit, sal_Int32 nTimeUnit ) { if( rofUnit.has_value() && (1.0 <= rofUnit.value()) && (rofUnit.value() <= SAL_MAX_INT32) ) orInterval <<= css::chart::TimeInterval( static_cast< sal_Int32 >( rofUnit.value() ), lclGetApiTimeUnit( nTimeUnit ) ); diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 03e97d3e3339..1e00618ae411 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -319,8 +319,8 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat if( nParagraphs > 1 ) nSequenceSize += nParagraphs - 1; - OptValue< OUString > oaLabelText; - OptValue< OUString > oaCellRange; + std::optional< OUString > oaLabelText; + std::optional< OUString > oaCellRange; if (mrModel.mobShowDataLabelsRange.value_or(false)) { const DataSourceModel* pLabelSource = mrModel.mrParent.mpLabelsSource; diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx index 81e077d58c4c..4029b5750ccb 100644 --- a/oox/source/drawingml/colorchoicecontext.cxx +++ b/oox/source/drawingml/colorchoicecontext.cxx @@ -63,7 +63,7 @@ void ColorValueContext::onStartElement( const AttributeList& rAttribs ) case A_TOKEN( schemeClr ): { mrColor.setSchemeClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); - oox::OptValue<OUString> sSchemeName = rAttribs.getString( XML_val ); + std::optional<OUString> sSchemeName = rAttribs.getString( XML_val ); if( sSchemeName.has_value() ) mrColor.setSchemeName( *sSchemeName ); } diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx index 97c46c25365c..1c060cb90665 100644 --- a/oox/source/drawingml/diagram/datamodelcontext.cxx +++ b/oox/source/drawingml/diagram/datamodelcontext.cxx @@ -115,7 +115,7 @@ public: case DGM_TOKEN( hierBranch ): { // need to convert from oox::OptValue to std::optional since 1st is not available in svx - const OptValue< sal_Int32 > aOptVal(rAttribs.getToken( XML_val )); + const std::optional< sal_Int32 > aOptVal(rAttribs.getToken( XML_val )); if(aOptVal.has_value()) mrPoint.moHierarchyBranch = aOptVal.value(); break; diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 3714c239f9ef..c38ea30e5d6f 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -45,10 +45,10 @@ using namespace ::oox::core; namespace { /// Looks up the value of the rInternalName -> nProperty key in rProperties. -oox::OptValue<sal_Int32> findProperty(const oox::drawingml::LayoutPropertyMap& rProperties, +std::optional<sal_Int32> findProperty(const oox::drawingml::LayoutPropertyMap& rProperties, const OUString& rInternalName, sal_Int32 nProperty) { - oox::OptValue<sal_Int32> oRet; + std::optional<sal_Int32> oRet; auto it = rProperties.find(rInternalName); if (it != rProperties.end()) @@ -1515,12 +1515,12 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& bool bScaleDownEmptySpacing = false; if (nDir == XML_fromL || nDir == XML_fromR) { - oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); + std::optional<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); bScaleDownEmptySpacing = oWidth.has_value() && oWidth.value() > 0; } if (!bScaleDownEmptySpacing && (nDir == XML_fromT || nDir == XML_fromB)) { - oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); + std::optional<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); bScaleDownEmptySpacing = oHeight.has_value() && oHeight.value() > 0; } if (bScaleDownEmptySpacing && aCurrShape->getChildren().empty()) @@ -1568,8 +1568,8 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& awt::Size aTotalSize; for (const auto & aCurrShape : rShape->getChildren()) { - oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); - oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); + std::optional<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); + std::optional<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); awt::Size aSize = aChildSize; if (oWidth.has_value()) aSize.Width = oWidth.value(); @@ -1594,8 +1594,8 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& for (auto& aCurrShape : rShape->getChildren()) { // Extract properties relevant for this shape from constraints. - oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); - oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); + std::optional<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); + std::optional<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); awt::Size aSize = aChildSize; if (oWidth.has_value()) diff --git a/oox/source/drawingml/effectproperties.hxx b/oox/source/drawingml/effectproperties.hxx index b588b9f7cffa..54c7068ef5c6 100644 --- a/oox/source/drawingml/effectproperties.hxx +++ b/oox/source/drawingml/effectproperties.hxx @@ -21,7 +21,7 @@ namespace oox::drawingml { struct EffectGlowProperties { - OptValue< sal_Int64 > moGlowRad; // size of glow effect + std::optional< sal_Int64 > moGlowRad; // size of glow effect Color moGlowColor; // TODO saturation and luminance missing @@ -30,19 +30,19 @@ struct EffectGlowProperties struct EffectSoftEdgeProperties { - OptValue<sal_Int64> moRad; // size of effect + std::optional<sal_Int64> moRad; // size of effect void assignUsed(const EffectSoftEdgeProperties& rSourceProps); }; struct EffectShadowProperties { - OptValue< sal_Int64 > moShadowDist; - OptValue< sal_Int64 > moShadowDir; - OptValue< sal_Int64 > moShadowSx; - OptValue< sal_Int64 > moShadowSy; + std::optional< sal_Int64 > moShadowDist; + std::optional< sal_Int64 > moShadowDir; + std::optional< sal_Int64 > moShadowSx; + std::optional< sal_Int64 > moShadowSy; Color moShadowColor; - OptValue< sal_Int64 > moShadowBlur; // size of blur effect + std::optional< sal_Int64 > moShadowBlur; // size of blur effect /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const EffectShadowProperties& rSourceProps ); diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index b0d05f61bd48..d1e5a7669227 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -148,7 +148,7 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement case A_TOKEN( prstTxWarp ): // CT_PresetTextShape if( mpShapePtr ) { - const OptValue<OUString> sPrst = rAttribs.getString( XML_prst ); + const std::optional<OUString> sPrst = rAttribs.getString( XML_prst ); if( sPrst.has_value() ) { mrTextBodyProp.msPrst = sPrst.value(); diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 8a8c30db61cb..8cbeee66408a 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -279,7 +279,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl return new TextCharacterPropertiesContext( *this, rAttribs, mrTextParagraphProperties.getTextCharacterProperties() ); case W_TOKEN( jc ): { - OptValue< OUString > oParaAdjust = rAttribs.getString( W_TOKEN(val) ); + std::optional< OUString > oParaAdjust = rAttribs.getString( W_TOKEN(val) ); if( oParaAdjust.has_value() && !oParaAdjust.value().isEmpty() ) { const OUString& sParaAdjust = oParaAdjust.value(); @@ -299,7 +299,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl // Spacing before if( !rAttribs.getBool(W_TOKEN(beforeAutospacing), false) ) { - OptValue<sal_Int32> oBefore = rAttribs.getInteger(W_TOKEN(before)); + std::optional<sal_Int32> oBefore = rAttribs.getInteger(W_TOKEN(before)); if (oBefore.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); @@ -309,7 +309,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl } else { - OptValue<sal_Int32> oBeforeLines = rAttribs.getInteger(W_TOKEN(beforeLines)); + std::optional<sal_Int32> oBeforeLines = rAttribs.getInteger(W_TOKEN(beforeLines)); if (oBeforeLines.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); @@ -323,7 +323,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl // Spacing after if( !rAttribs.getBool(W_TOKEN(afterAutospacing), false) ) { - OptValue<sal_Int32> oAfter = rAttribs.getInteger(W_TOKEN(after)); + std::optional<sal_Int32> oAfter = rAttribs.getInteger(W_TOKEN(after)); if (oAfter.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); @@ -333,7 +333,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl } else { - OptValue<sal_Int32> oAfterLines = rAttribs.getInteger(W_TOKEN(afterLines)); + std::optional<sal_Int32> oAfterLines = rAttribs.getInteger(W_TOKEN(afterLines)); if (oAfterLines.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); @@ -345,8 +345,8 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl } // Line spacing - OptValue<OUString> oLineRule = rAttribs.getString(W_TOKEN(lineRule)); - OptValue<sal_Int32> oLineSpacing = rAttribs.getInteger(W_TOKEN(line)); + std::optional<OUString> oLineRule = rAttribs.getString(W_TOKEN(lineRule)); + std::optional<sal_Int32> oLineSpacing = rAttribs.getInteger(W_TOKEN(line)); if (oLineSpacing.has_value()) { TextSpacing& rLineSpacing = mrTextParagraphProperties.getLineSpacing(); diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 2ee3ced80c5b..043f0689fd40 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -160,18 +160,18 @@ oox::drawingml::Color AttributeList::getHighlightColor(sal_Int32 nAttrToken) con // optional return values ----------------------------------------------------- -OptValue< sal_Int32 > AttributeList::getToken( sal_Int32 nAttrToken ) const +std::optional< sal_Int32 > AttributeList::getToken( sal_Int32 nAttrToken ) const { sal_Int32 nToken = mxAttribs->getOptionalValueToken( nAttrToken, XML_TOKEN_INVALID ); - return nToken == XML_TOKEN_INVALID ? OptValue< sal_Int32 >() : OptValue< sal_Int32 >( nToken ); + return nToken == XML_TOKEN_INVALID ? std::optional< sal_Int32 >() : std::optional< sal_Int32 >( nToken ); } -OptValue< OUString > AttributeList::getString( sal_Int32 nAttrToken ) const +std::optional< OUString > AttributeList::getString( sal_Int32 nAttrToken ) const { // check if the attribute exists (empty string may be different to missing attribute) if( mxAttribs->hasAttribute( nAttrToken ) ) - return OptValue< OUString >( mxAttribs->getOptionalValue( nAttrToken ) ); - return OptValue< OUString >(); + return std::optional< OUString >( mxAttribs->getOptionalValue( nAttrToken ) ); + return std::optional< OUString >(); } OUString AttributeList::getStringDefaulted( sal_Int32 nAttrToken ) const @@ -182,93 +182,93 @@ OUString AttributeList::getStringDefaulted( sal_Int32 nAttrToken ) const return OUString(); } -OptValue< OUString > AttributeList::getXString( sal_Int32 nAttrToken ) const +std::optional< OUString > AttributeList::getXString( sal_Int32 nAttrToken ) const { // check if the attribute exists (empty string may be different to missing attribute) if( mxAttribs->hasAttribute( nAttrToken ) ) - return OptValue< OUString >( AttributeConversion::decodeXString( mxAttribs->getOptionalValue( nAttrToken ) ) ); - return OptValue< OUString >(); + return std::optional< OUString >( AttributeConversion::decodeXString( mxAttribs->getOptionalValue( nAttrToken ) ) ); + return std::optional< OUString >(); } -OptValue< double > AttributeList::getDouble( sal_Int32 nAttrToken ) const +std::optional< double > AttributeList::getDouble( sal_Int32 nAttrToken ) const { double nValue; bool bValid = getAttribList()->getAsDouble( nAttrToken, nValue ); - return bValid ? OptValue< double >( nValue ) : OptValue< double >(); + return bValid ? std::optional< double >( nValue ) : std::optional< double >(); } -OptValue< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) const +std::optional< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) const { sal_Int32 nValue; bool bValid = getAttribList()->getAsInteger( nAttrToken, nValue ); - return bValid ? OptValue< sal_Int32 >( nValue ) : OptValue< sal_Int32 >(); + return bValid ? std::optional< sal_Int32 >( nValue ) : std::optional< sal_Int32 >(); } -OptValue< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) const +std::optional< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); bool bValid = !aValue.isEmpty(); - return bValid ? OptValue< sal_uInt32 >( AttributeConversion::decodeUnsigned( aValue ) ) : OptValue< sal_uInt32 >(); + return bValid ? std::optional< sal_uInt32 >( AttributeConversion::decodeUnsigned( aValue ) ) : std::optional< sal_uInt32 >(); } -OptValue< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const +std::optional< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); bool bValid = !aValue.isEmpty(); - return bValid ? OptValue< sal_Int64 >( AttributeConversion::decodeHyper( aValue ) ) : OptValue< sal_Int64 >(); + return bValid ? std::optional< sal_Int64 >( AttributeConversion::decodeHyper( aValue ) ) : std::optional< sal_Int64 >(); } -OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const +std::optional< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); bool bValid = !aValue.isEmpty(); - return bValid ? OptValue< sal_Int32 >( AttributeConversion::decodeIntegerHex( aValue ) ) : OptValue< sal_Int32 >(); + return bValid ? std::optional< sal_Int32 >( AttributeConversion::decodeIntegerHex( aValue ) ) : std::optional< sal_Int32 >(); } -OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const +std::optional< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const { const char *pAttr; // catch the common cases as quickly as possible first bool bHasAttr = getAttribList()->getAsChar( nAttrToken, pAttr ); if( !bHasAttr ) - return OptValue< bool >(); + return std::optional< bool >(); if( !strcmp( pAttr, "false" ) ) - return OptValue< bool >( false ); + return std::optional< bool >( false ); if( !strcmp( pAttr, "true" ) ) - return OptValue< bool >( true ); + return std::optional< bool >( true ); // now for all the crazy stuff // boolean attributes may be "t", "f", "true", "false", "on", "off", "1", or "0" switch( getToken( nAttrToken, XML_TOKEN_INVALID ) ) { - case XML_t: return OptValue< bool >( true ); // used in VML - case XML_true: return OptValue< bool >( true ); - case XML_on: return OptValue< bool >( true ); - case XML_f: return OptValue< bool >( false ); // used in VML - case XML_false: return OptValue< bool >( false ); - case XML_off: return OptValue< bool >( false ); + case XML_t: return std::optional< bool >( true ); // used in VML + case XML_true: return std::optional< bool >( true ); + case XML_on: return std::optional< bool >( true ); + case XML_f: return std::optional< bool >( false ); // used in VML + case XML_false: return std::optional< bool >( false ); + case XML_off: return std::optional< bool >( false ); } - OptValue< sal_Int32 > onValue = getInteger( nAttrToken ); - return onValue.has_value() ? OptValue< bool >( onValue.value() != 0 ) : OptValue< bool >(); + std::optional< sal_Int32 > onValue = getInteger( nAttrToken ); + return onValue.has_value() ? std::optional< bool >( onValue.value() != 0 ) : std::optional< bool >(); } -OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const +std::optional< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); util::DateTime aDateTime; bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') && (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':'); if (!bValid) - return OptValue< util::DateTime >(); + return std::optional< util::DateTime >(); aDateTime.Year = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 0, 4 )) ); aDateTime.Month = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 5, 2 )) ); aDateTime.Day = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 8, 2 )) ); aDateTime.Hours = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 11, 2 )) ); aDateTime.Minutes = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 14, 2 )) ); aDateTime.Seconds = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 17, 2 )) ); - return OptValue< util::DateTime >( aDateTime ); + return std::optional< util::DateTime >( aDateTime ); } // defaulted return values ---------------------------------------------------- diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx index 4b6c19a53145..352eded1fa27 100644 --- a/oox/source/ppt/layoutfragmenthandler.cxx +++ b/oox/source/ppt/layoutfragmenthandler.cxx @@ -53,7 +53,7 @@ ContextHandlerRef LayoutFragmentHandler::onCreateContext( sal_Int32 aElementToke { mpSlidePersistPtr->setLayoutValueToken( rAttribs.getToken( XML_type, 0 ) ); // CT_SlideLayoutType - OptValue< bool > aShowMasterShapes = rAttribs.getBool( XML_showMasterSp ); + std::optional< bool > aShowMasterShapes = rAttribs.getBool( XML_showMasterSp ); if( aShowMasterShapes.has_value() && !aShowMasterShapes.value() ) { mpSlidePersistPtr->hideShapesAsMasterShapes(); } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index cecd2796b734..ffa337b4de9a 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -683,7 +683,7 @@ namespace // 5. ph with the same oSubTypeIndex oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, sal_Int32 nSecondSubType, - const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly ) + const std::optional< sal_Int32 >& oSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly ) { class Placeholders { @@ -693,7 +693,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, sal { } - void add(const oox::drawingml::ShapePtr& aShape, sal_Int32 nFirstSubType, sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& oSubTypeIndex) + void add(const oox::drawingml::ShapePtr& aShape, sal_Int32 nFirstSubType, sal_Int32 nSecondSubType, const std::optional< sal_Int32 >& oSubTypeIndex) { if (!aShape) return; diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index 14b551864170..ac73be10ed9b 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -66,7 +66,7 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 aElementToken, con case PPT_TOKEN( ph ): { SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() ); - OptValue< sal_Int32 > oSubType( rAttribs.getToken( XML_type) ); + std::optional< sal_Int32 > oSubType( rAttribs.getToken( XML_type) ); sal_Int32 nSubType( rAttribs.getToken( XML_type, XML_obj ) ); oox::drawingml::ShapePtr pTmpPlaceholder; diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index a6447b376d15..a6b8202a4c61 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -82,7 +82,7 @@ SlideFragmentHandler::~SlideFragmentHandler() PropertyMap aPropMap; PropertySet aSlideProp( xSlide ); - OptValue<bool> aShowMasterShapes = rAttribs.getBool(XML_showMasterSp); + std::optional<bool> aShowMasterShapes = rAttribs.getBool(XML_showMasterSp); if (aShowMasterShapes.has_value() && !aShowMasterShapes.value()) xSet->setPropertyValue("IsBackgroundObjectsVisible", Any(false)); diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 6198127a4743..98d3375f7a1c 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -126,7 +126,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken std::optional<sal_Int32> oInsets[4]; for (std::size_t i = 0; i < SAL_N_ELEMENTS(aInsets); ++i) { - OptValue<OUString> oValue = rAttribs.getString(aInsets[i]); + std::optional<OUString> oValue = rAttribs.getString(aInsets[i]); if (oValue.has_value()) oInsets[i] = oox::drawingml::GetCoordinate(oValue.value()); else @@ -238,7 +238,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken { if (rAttribs.hasAttribute(XML_lIns)) { - OptValue<OUString> oValue = rAttribs.getString(aInsets[i]); + std::optional<OUString> oValue = rAttribs.getString(aInsets[i]); if (oValue.has_value()) pTextBody->getTextProperties().moInsets[i] = oox::drawingml::GetCoordinate(oValue.value()); @@ -279,7 +279,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY); if (xPropertySet.is()) { - oox::OptValue<OUString> presetShapeName = rAttribs.getString(XML_prst); + std::optional<OUString> presetShapeName = rAttribs.getString(XML_prst); const OUString& preset = presetShapeName.value(); comphelper::SequenceAsHashMap aCustomShapeGeometry( xPropertySet->getPropertyValue("CustomShapeGeometry")); @@ -298,7 +298,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken //for further processing. if (rAttribs.hasAttribute(XML_id)) { - OptValue<OUString> id = rAttribs.getString(XML_id); + std::optional<OUString> id = rAttribs.getString(XML_id); if (id.has_value()) { oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr; @@ -316,8 +316,8 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken //for further processing. mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(true); mpShapePtr->setTextBox(true); - OptValue<OUString> id = rAttribs.getString(XML_id); - OptValue<OUString> seq = rAttribs.getString(XML_seq); + std::optional<OUString> id = rAttribs.getString(XML_id); + std::optional<OUString> seq = rAttribs.getString(XML_seq); if (id.has_value() && seq.has_value()) { oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr; diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 00a346748531..c15a1fa3a658 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -223,7 +223,7 @@ sal_Int32 ConversionHelper::decodeMeasureToTwip(const GraphicHelper& rGraphicHel } Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, - const OptValue< OUString >& roVmlColor, const OptValue< double >& roVmlOpacity, + const std::optional< OUString >& roVmlColor, const std::optional< double >& roVmlOpacity, ::Color nDefaultRgb, ::Color nPrimaryRgb ) { Color aDmlColor; @@ -554,12 +554,12 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r namespace { -sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< OUString >& roValue, sal_Int64 nDefValue ) +sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const std::optional< OUString >& roValue, sal_Int64 nDefValue ) { return roValue.has_value() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.value(), 0, false, false ) : nDefValue; } -void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, LineProperties::DashStopVector& orCustomDash, const OptValue< OUString >& roDashStyle ) +void lclGetDmlLineDash( std::optional< sal_Int32 >& oroPresetDash, LineProperties::DashStopVector& orCustomDash, const std::optional< OUString >& roDashStyle ) { if( !roDashStyle.has_value() ) return; @@ -593,7 +593,7 @@ void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, LineProperties::Da } } -sal_Int32 lclGetDmlArrowType( const OptValue< sal_Int32 >& roArrowType ) +sal_Int32 lclGetDmlArrowType( const std::optional< sal_Int32 >& roArrowType ) { if( roArrowType.has_value() ) switch( roArrowType.value() ) { @@ -607,7 +607,7 @@ sal_Int32 lclGetDmlArrowType( const OptValue< sal_Int32 >& roArrowType ) return XML_none; } -sal_Int32 lclGetDmlArrowWidth( const OptValue< sal_Int32 >& roArrowWidth ) +sal_Int32 lclGetDmlArrowWidth( const std::optional< sal_Int32 >& roArrowWidth ) { if( roArrowWidth.has_value() ) switch( roArrowWidth.value() ) { @@ -618,7 +618,7 @@ sal_Int32 lclGetDmlArrowWidth( const OptValue< sal_Int32 >& roArrowWidth ) return XML_med; } -sal_Int32 lclGetDmlArrowLength( const OptValue< sal_Int32 >& roArrowLength ) +sal_Int32 lclGetDmlArrowLength( const std::optional< sal_Int32 >& roArrowLength ) { if( roArrowLength.has_value() ) switch( roArrowLength.value() ) { @@ -636,7 +636,7 @@ void lclConvertArrow( LineArrowProperties& orArrowProp, const StrokeArrowModel& orArrowProp.moArrowLength = lclGetDmlArrowLength( rStrokeArrow.moArrowLength ); } -sal_Int32 lclGetDmlLineCompound( const OptValue< sal_Int32 >& roLineStyle ) +sal_Int32 lclGetDmlLineCompound( const std::optional< sal_Int32 >& roLineStyle ) { if( roLineStyle.has_value() ) switch( roLineStyle.value() ) { @@ -649,7 +649,7 @@ sal_Int32 lclGetDmlLineCompound( const OptValue< sal_Int32 >& roLineStyle ) return XML_sng; } -sal_Int32 lclGetDmlLineCap( const OptValue< sal_Int32 >& roEndCap ) +sal_Int32 lclGetDmlLineCap( const std::optional< sal_Int32 >& roEndCap ) { if( roEndCap.has_value() ) switch( roEndCap.value() ) { @@ -660,7 +660,7 @@ sal_Int32 lclGetDmlLineCap( const OptValue< sal_Int32 >& roEndCap ) return XML_flat; // different defaults in VML (flat) and DrawingML (square) } -sal_Int32 lclGetDmlLineJoint( const OptValue< sal_Int32 >& roJoinStyle ) +sal_Int32 lclGetDmlLineJoint( const std::optional< sal_Int32 >& roJoinStyle ) { if( roJoinStyle.has_value() ) switch( roJoinStyle.value() ) { @@ -969,7 +969,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen } else if (aName == u"font-size") { - oox::OptValue<OUString> aOptString {OUString(aValue)}; + std::optional<OUString> aOptString {OUString(aValue)}; float nSize = drawingml::convertEmuToPoints(lclGetEmu(rGraphicHelper, aOptString, 1)); uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 63ece16c7046..bf62b725ff23 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -49,29 +49,29 @@ namespace { /** Returns the boolean value from the specified VML attribute (if present). */ -OptValue< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 nToken ) +std::optional< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 nToken ) { - OptValue< OUString > oValue = rAttribs.getString( nToken ); - if( oValue.has_value() ) return OptValue< bool >( ConversionHelper::decodeBool( oValue.value() ) ); - return OptValue< bool >(); + std::optional< OUString > oValue = rAttribs.getString( nToken ); + if( oValue.has_value() ) return std::optional< bool >( ConversionHelper::decodeBool( oValue.value() ) ); + return std::optional< bool >(); } /** Returns the percentage value from the specified VML attribute (if present). The value will be normalized (1.0 is returned for 100%). */ -OptValue< double > lclDecodePercent( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue ) +std::optional< double > lclDecodePercent( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue ) { - OptValue< OUString > oValue = rAttribs.getString( nToken ); - if( oValue.has_value() ) return OptValue< double >( ConversionHelper::decodePercent( oValue.value(), fDefValue ) ); - return OptValue< double >(); + std::optional< OUString > oValue = rAttribs.getString( nToken ); + if( oValue.has_value() ) return std::optional< double >( ConversionHelper::decodePercent( oValue.value(), fDefValue ) ); + return std::optional< double >(); } /** #119750# Special method for opacity; it *should* be a percentage value, but there are cases where a value relative to 0xffff (65536) is used, ending with an 'f' */ -OptValue< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue ) +std::optional< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue ) { - OptValue< OUString > oValue = rAttribs.getString( nToken ); + std::optional< OUString > oValue = rAttribs.getString( nToken ); double fRetval(fDefValue); if( oValue.has_value() ) @@ -92,15 +92,15 @@ OptValue< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 nT } } - return OptValue< double >(fRetval); + return std::optional< double >(fRetval); } /** Returns the integer value pair from the specified VML attribute (if present). */ -OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int32 nToken ) +std::optional< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int32 nToken ) { - OptValue< OUString > oValue = rAttribs.getString( nToken ); - OptValue< Int32Pair > oRetValue; + std::optional< OUString > oValue = rAttribs.getString( nToken ); + std::optional< Int32Pair > oRetValue; if( oValue.has_value() ) { std::u16string_view aValue1, aValue2; @@ -112,10 +112,10 @@ OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int /** Returns the percentage pair from the specified VML attribute (if present). */ -OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_Int32 nToken ) +std::optional< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_Int32 nToken ) { - OptValue< OUString > oValue = rAttribs.getString( nToken ); - OptValue< DoublePair > oRetValue; + std::optional< OUString > oValue = rAttribs.getString( nToken ); + std::optional< DoublePair > oRetValue; if( oValue.has_value() ) { std::u16string_view aValue1, aValue2; @@ -398,7 +398,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.moCropTop = rAttribs.getString(XML_croptop); // Gain / contrast. - OptValue<OUString> oGain = rAttribs.getString(XML_gain); + std::optional<OUString> oGain = rAttribs.getString(XML_gain); sal_Int32 nGain = 0x10000; if (oGain.has_value() && oGain.value().endsWith("f")) { @@ -413,7 +413,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.mnGain = nGain; // Blacklevel / brightness. - OptValue<OUString> oBlacklevel = rAttribs.getString(XML_blacklevel); + std::optional<OUString> oBlacklevel = rAttribs.getString(XML_blacklevel); sal_Int16 nBlacklevel = 0; if (oBlacklevel.has_value() && oBlacklevel.value().endsWith("f")) { @@ -450,10 +450,10 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A return nullptr; } -OptValue< OUString > ShapeTypeContext::decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const +std::optional< OUString > ShapeTypeContext::decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const { - OptValue< OUString > oFragmentPath; - OptValue< OUString > oRelId = rAttribs.getString( nToken ); + std::optional< OUString > oFragmentPath; + std::optional< OUString > oRelId = rAttribs.getString( nToken ); if( oRelId.has_value() ) oFragmentPath = getFragmentPathFromRelId( oRelId.value() ); return oFragmentPath; diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index c9cb789d28a9..768919c12a85 100644 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -72,14 +72,14 @@ TextPortionContext::TextPortionContext( ContextHandler2Helper const & rParent, break; case OOX_TOKEN(dml, blip): { - OptValue<OUString> oRelId = rAttribs.getString(R_TOKEN(embed)); + std::optional<OUString> oRelId = rAttribs.getString(R_TOKEN(embed)); if (oRelId.has_value()) mrTextBox.mrTypeModel.moGraphicPath = getFragmentPathFromRelId(oRelId.value()); } break; case VML_TOKEN(imagedata): { - OptValue<OUString> oRelId = rAttribs.getString(R_TOKEN(id)); + std::optional<OUString> oRelId = rAttribs.getString(R_TOKEN(id)); if (oRelId.has_value()) mrTextBox.mrTypeModel.moGraphicPath = getFragmentPathFromRelId(oRelId.value()); } |