diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 12:43:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-22 10:28:41 +0200 |
commit | 813939f8e392feff0b6eeeee1bae023bc9c98849 (patch) | |
tree | e130cecae68e9b2774a88755989bf4ece2e7a756 /oox/source | |
parent | 3ff9582704a024b4a89da9a63322e117157b5857 (diff) |
rename oox::OptValue::get(Type) to value_or
as a step towards replacing OptValue with std::optional
Change-Id: Ic4afaca87034b1b794432ee4261a6495058b26fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136268
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/chart/objectformatter.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/chart/plotareaconverter.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/chart/seriesconverter.cxx | 24 | ||||
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 28 | ||||
-rw-r--r-- | oox/source/drawingml/lineproperties.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/textbodyproperties.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterproperties.cxx | 16 | ||||
-rw-r--r-- | oox/source/helper/attributelist.cxx | 18 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 20 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 8 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 4 |
14 files changed, 85 insertions, 85 deletions
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index e04bfe5f0ae6..2ef67ebc683e 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1060,14 +1060,14 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef bool bStacked = false; if( bSupportsStacked ) { - sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz ); + sal_Int32 nVert = rxTextProp->getTextProperties().moVert.value_or( XML_horz ); bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); rPropSet.setProperty( PROP_StackCharacters, bStacked ); } /* Chart2 expects rotation angle as double value in range of [0,360). OOXML counts clockwise, Chart2 counts counterclockwise. */ - double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( nDefaultRotation ) ); + double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.value_or( nDefaultRotation ) ); // MS Office UI allows values only in range of [-90,90]. if ( fAngle < -5400000.0 || fAngle > 5400000.0 ) { diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index afbb28adee03..a30b3bdc6249 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -217,9 +217,9 @@ void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, if( rTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE ) { // Y rotation used as 'first pie slice angle' in 3D pie charts - rTypeGroup.convertPieRotation( aPropSet, mrModel.monRotationY.get( 0 ) ); + rTypeGroup.convertPieRotation( aPropSet, mrModel.monRotationY.value_or( 0 ) ); // X rotation a.k.a. elevation (map OOXML [0..90] to Chart2 [-90,0]) - nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.get( 15 ), 0, 90 ) - 90; + nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.value_or( 15 ), 0, 90 ) - 90; // no right-angled axes in pie charts bRightAngled = false; // ambient color (Gray 30%) @@ -230,9 +230,9 @@ void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, else // 3D bar/area/line charts { // Y rotation (OOXML [0..359], Chart2 [-179,180]) - nRotationY = mrModel.monRotationY.get( 20 ); + nRotationY = mrModel.monRotationY.value_or( 20 ); // X rotation a.k.a. elevation (OOXML [-90..90], Chart2 [-179,180]) - nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.get( 15 ), -90, 90 ); + nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.value_or( 15 ), -90, 90 ); // right-angled axes bRightAngled = mrModel.mbRightAngled; // ambient color (Gray 20%) diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index b4e8666ffdb9..e618e0695cf7 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -130,11 +130,11 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt rDataLabel.mobShowVal.has_value(); } - bool bShowValue = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( !bMSO2007Doc ); - bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( !bMSO2007Doc ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE); - bool bShowCateg = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.get( !bMSO2007Doc ); - bool bShowSerName = !rDataLabel.mbDeleted && rDataLabel.mobShowSerName.get( !bMSO2007Doc ); - bool bShowSymbol = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.get( !bMSO2007Doc ); + bool bShowValue = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.value_or( !bMSO2007Doc ); + bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.value_or( !bMSO2007Doc ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE); + bool bShowCateg = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.value_or( !bMSO2007Doc ); + bool bShowSerName = !rDataLabel.mbDeleted && rDataLabel.mobShowSerName.value_or( !bMSO2007Doc ); + bool bShowSymbol = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.value_or( !bMSO2007Doc ); // tdf#132174, tdf#136650: the inner data table has no own cell number format. if( bHasInternalData && bShowValue && !bShowPercent ) @@ -161,9 +161,9 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt // Set the data label separator to "new line" if the value is shown as percentage with a category name, // just like in MS-Office. In any other case the default separator will be a semicolon. if( bShowPercent && !bShowValue && ( bDataSeriesLabel || rDataLabel.moaSeparator.has_value() ) ) - rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.get( "\n" ) ); + rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.value_or( "\n" ) ); else if( bDataSeriesLabel || rDataLabel.moaSeparator.has_value() ) - rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.get( "; " ) ); + rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.value_or( "; " ) ); // data label placement (do not overwrite series placement, if no explicit point placement is present) if( !(bDataSeriesLabel || rDataLabel.monLabelPos.has_value()) ) @@ -171,7 +171,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt namespace csscd = ::com::sun::star::chart::DataLabelPlacement; sal_Int32 nPlacement = -1; - switch( rDataLabel.monLabelPos.get( XML_TOKEN_INVALID ) ) + switch( rDataLabel.monLabelPos.value_or( XML_TOKEN_INVALID ) ) { case XML_outEnd: nPlacement = csscd::OUTSIDE; break; case XML_inEnd: nPlacement = csscd::INSIDE; break; @@ -321,7 +321,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat OptValue< OUString > oaLabelText; OptValue< OUString > oaCellRange; - if (mrModel.mobShowDataLabelsRange.get(false)) + if (mrModel.mobShowDataLabelsRange.value_or(false)) { const DataSourceModel* pLabelSource = mrModel.mrParent.mpLabelsSource; if (pLabelSource && pLabelSource->mxDataSeq.is()) @@ -727,8 +727,8 @@ void DataPointConverter::convertFromModel( const Reference< XDataSeries >& rxDat // data point marker if( ( mrModel.monMarkerSymbol.has_value() && mrModel.monMarkerSymbol.get() != rSeries.mnMarkerSymbol ) || ( mrModel.monMarkerSize.has_value() && mrModel.monMarkerSize.get() != rSeries.mnMarkerSize ) ) - rTypeGroup.convertMarker( aPropSet, mrModel.monMarkerSymbol.get( rSeries.mnMarkerSymbol ), - mrModel.monMarkerSize.get( rSeries.mnMarkerSize ), mrModel.mxMarkerProp ); + rTypeGroup.convertMarker( aPropSet, mrModel.monMarkerSymbol.value_or( rSeries.mnMarkerSymbol ), + mrModel.monMarkerSize.value_or( rSeries.mnMarkerSize ), mrModel.mxMarkerProp ); // data point pie explosion if( mrModel.monExplosion.has_value() && mrModel.monExplosion.get() != rSeries.mnExplosion ) @@ -839,7 +839,7 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve rTypeGroup.convertLineSmooth( aSeriesProp, mrModel.mbSmooth ); #endif // 3D bar style (not possible to set at chart type -> set at all series) - rTypeGroup.convertBarGeometry( aSeriesProp, mrModel.monShape.get( rTypeGroup.getModel().mnShape ) ); + rTypeGroup.convertBarGeometry( aSeriesProp, mrModel.monShape.value_or( rTypeGroup.getModel().mnShape ) ); // pie explosion (restricted to [0%,100%] in Chart2) rTypeGroup.convertPieExplosion( aSeriesProp, mrModel.mnExplosion ); diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index f315f0182245..df2f09f03364 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -381,7 +381,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, case XML_noFill: { eFillStyle = FillStyle_NONE; - rPropMap.setProperty(ShapeProperty::FillUseSlideBackground, moUseBgFill.get(false)); + rPropMap.setProperty(ShapeProperty::FillUseSlideBackground, moUseBgFill.value_or(false)); } break; @@ -431,12 +431,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, } // "rotate with shape" set to false -> do not rotate - if ( !maGradientProps.moRotateWithShape.get( true ) ) + if ( !maGradientProps.moRotateWithShape.value_or( true ) ) nShapeRotation = 0; if( maGradientProps.moGradientPath.has_value() ) { - IntegerRectangle2D aFillToRect = maGradientProps.moFillToRect.get( IntegerRectangle2D( 0, 0, MAX_PERCENT, MAX_PERCENT ) ); + IntegerRectangle2D aFillToRect = maGradientProps.moFillToRect.value_or( IntegerRectangle2D( 0, 0, MAX_PERCENT, MAX_PERCENT ) ); sal_Int32 nCenterX = (MAX_PERCENT + aFillToRect.X1 - aFillToRect.X2) / 2; aGradient.XOffset = getLimitedValue<sal_Int16, sal_Int32>( nCenterX / PER_PERCENT, 0, 100); @@ -635,7 +635,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, // Now we have a potential border and a largest segment. Use those. aGradient.Style = bSymmetric ? awt::GradientStyle_AXIAL : awt::GradientStyle_LINEAR; - sal_Int32 nShadeAngle = maGradientProps.moShadeAngle.get( 0 ); + sal_Int32 nShadeAngle = maGradientProps.moShadeAngle.value_or( 0 ); // Adjust for flips if ( bFlipH ) nShadeAngle = 180*60000 - nShadeAngle; @@ -737,7 +737,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if (xGraphic.is()) { - if (maBlipProps.moColorEffect.get(XML_TOKEN_INVALID) == XML_grayscl) + if (maBlipProps.moColorEffect.value_or(XML_TOKEN_INVALID) == XML_grayscl) xGraphic = lclGreysScaleGraphic(xGraphic); if (rPropMap.supportsProperty(ShapeProperty::FillBitmapName) && @@ -755,31 +755,31 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if( eFillStyle == FillStyle_BITMAP ) { // bitmap mode (single, repeat, stretch) - BitmapMode eBitmapMode = lclGetBitmapMode( maBlipProps.moBitmapMode.get( XML_TOKEN_INVALID ) ); + BitmapMode eBitmapMode = lclGetBitmapMode( maBlipProps.moBitmapMode.value_or( XML_TOKEN_INVALID ) ); rPropMap.setProperty( ShapeProperty::FillBitmapMode, eBitmapMode ); // additional settings for repeated bitmap if( eBitmapMode == BitmapMode_REPEAT ) { // anchor position inside bitmap - RectanglePoint eRectPoint = lclGetRectanglePoint( maBlipProps.moTileAlign.get( XML_tl ) ); + RectanglePoint eRectPoint = lclGetRectanglePoint( maBlipProps.moTileAlign.value_or( XML_tl ) ); rPropMap.setProperty( ShapeProperty::FillBitmapRectanglePoint, eRectPoint ); awt::Size aOriginalSize = lclGetOriginalSize(rGraphicHelper, maBlipProps.mxFillGraphic); if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) ) { // size of one bitmap tile (given as 1/1000 percent of bitmap size), convert to 1/100 mm - double fScaleX = maBlipProps.moTileScaleX.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT ); + double fScaleX = maBlipProps.moTileScaleX.value_or( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT ); sal_Int32 nFillBmpSizeX = getLimitedValue< sal_Int32, double >( aOriginalSize.Width * fScaleX, 1, SAL_MAX_INT32 ); rPropMap.setProperty( ShapeProperty::FillBitmapSizeX, nFillBmpSizeX ); - double fScaleY = maBlipProps.moTileScaleY.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT ); + double fScaleY = maBlipProps.moTileScaleY.value_or( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT ); sal_Int32 nFillBmpSizeY = getLimitedValue< sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 ); rPropMap.setProperty( ShapeProperty::FillBitmapSizeY, nFillBmpSizeY ); // offset of the first bitmap tile (given as EMUs), convert to percent - sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetX.get( 0 ) / 3.6 / aOriginalSize.Width, 0, 100 ); + sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / aOriginalSize.Width, 0, 100 ); rPropMap.setProperty( ShapeProperty::FillBitmapOffsetX, nTileOffsetX ); - sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetY.get( 0 ) / 3.6 / aOriginalSize.Height, 0, 100 ); + sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / aOriginalSize.Height, 0, 100 ); rPropMap.setProperty( ShapeProperty::FillBitmapOffsetY, nTileOffsetY ); } } @@ -862,11 +862,11 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, bool bFlipH, bool bFlipV) const { - sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 ); - sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 ); + sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.value_or( 0 ) / PER_PERCENT, -100, 100 ); + sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.value_or( 0 ) / PER_PERCENT, -100, 100 ); ColorMode eColorMode = ColorMode_STANDARD; - switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) ) + switch( maBlipProps.moColorEffect.value_or( XML_TOKEN_INVALID ) ) { case XML_biLevel: eColorMode = ColorMode_MONO; break; case XML_grayscl: eColorMode = ColorMode_GREYS; break; diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 3e32944825a0..12f74b845ef5 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -244,7 +244,7 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, OUStringBuffer aBuffer; sal_Int32 nMarkerWidth = 0; bool bMarkerCenter = false; - sal_Int32 nArrowType = rArrowProps.moArrowType.get( XML_none ); + sal_Int32 nArrowType = rArrowProps.moArrowType.value_or( XML_none ); OSL_ASSERT((nArrowType & sal_Int32(0xFFFF0000))==0); switch( nArrowType ) { @@ -270,8 +270,8 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, if( !aBuffer.isEmpty() ) { bool bIsArrow = nArrowType == XML_arrow; - sal_Int32 nLength = lclGetArrowSize( rArrowProps.moArrowLength.get( XML_med ) ); - sal_Int32 nWidth = lclGetArrowSize( rArrowProps.moArrowWidth.get( XML_med ) ); + sal_Int32 nLength = lclGetArrowSize( rArrowProps.moArrowLength.value_or( XML_med ) ); + sal_Int32 nWidth = lclGetArrowSize( rArrowProps.moArrowWidth.value_or( XML_med ) ); sal_Int32 nNameIndex = nWidth * 3 + nLength + 1; aBuffer.append( ' ' ).append( nNameIndex ); @@ -453,10 +453,10 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, ((moPresetDash.has_value() && moPresetDash.get() != XML_solid) || !maCustomDash.empty()) ) { LineDash aLineDash; - aLineDash.Style = lclGetDashStyle( moLineCap.get( XML_flat ) ); + aLineDash.Style = lclGetDashStyle( moLineCap.value_or( XML_flat ) ); if(moPresetDash.has_value() && moPresetDash.get() != XML_solid) - lclConvertPresetDash(aLineDash, moPresetDash.get(XML_dash)); + lclConvertPresetDash(aLineDash, moPresetDash.value_or(XML_dash)); else // !maCustomDash.empty() { lclConvertCustomDash(aLineDash, maCustomDash); @@ -532,7 +532,7 @@ drawing::LineJoint LineProperties::getLineJoint() const sal_Int32 LineProperties::getLineWidth() const { - return convertEmuToHmm( moLineWidth.get( 0 ) ); + return convertEmuToHmm( moLineWidth.value_or( 0 ) ); } } // namespace oox diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 6b6ffbeab607..774ca831e35d 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -992,7 +992,7 @@ Reference< XShape > const & Shape::createAndInsert( // ToDo: Not sure about the restrictions given by bUseRotationTransform. // Since LibreOffice doesn't have 3D camera options for 2D shapes, rotate the shape opposite of // the camera Z axis rotation, in order to produce the same visual result from MSO - const sal_Int32 nCameraRotation = get3DProperties().maCameraRotation.mnRevolution.get(0); + const sal_Int32 nCameraRotation = get3DProperties().maCameraRotation.mnRevolution.value_or(0); if (bUseRotationTransform && (mnRotation != 0 || nCameraRotation != 0)) lcl_RotateAtCenter(aTransformation, nOrientation * (mnRotation - nCameraRotation)); @@ -1196,7 +1196,7 @@ Reference< XShape > const & Shape::createAndInsert( } if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) ) { - if (!getFillProperties().moUseBgFill.get(false)) + if (!getFillProperties().moUseBgFill.value_or(false)) { nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper); nFillPhClrTheme = pFillRef->maPhClr.getSchemeColorIndex(); @@ -1501,7 +1501,7 @@ Reference< XShape > const & Shape::createAndInsert( // Store original fill and line colors of the shape and the theme color name to InteropGrabBag std::vector<beans::PropertyValue> aProperties { - comphelper::makePropertyValue("EmuLineWidth", aLineProperties.moLineWidth.get(0)), + comphelper::makePropertyValue("EmuLineWidth", aLineProperties.moLineWidth.value_or(0)), comphelper::makePropertyValue("OriginalSolidFillClr", aShapeProps.getProperty(PROP_FillColor)), comphelper::makePropertyValue("OriginalLnSolidFillClr", aShapeProps.getProperty(PROP_LineColor)) }; @@ -1688,7 +1688,7 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 nTextCameraZRotation = static_cast< sal_Int32 >( getTextBody()->get3DProperties().maCameraRotation.mnRevolution.get() ); mpCustomShapePropertiesPtr->setTextCameraZRotateAngle( nTextCameraZRotation / 60000 ); - sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) ); + sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.value_or( 0 ) ); nTextRotateAngle -= mnDiagramRotation; /* OOX measures text rotation clockwise in 1/60000th degrees, diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index db117e941ac4..f2e8fc336937 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -68,17 +68,17 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, { Color aColor = rLineProperties.maLineFill.getBestSolidColor(); aBorderLine.Color = sal_Int32(aColor.getColor( rFilterBase.getGraphicHelper() )); - aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); + aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.value_or( 0 ) ) / 4 ); + aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.value_or( 0 ) ) / 4 ); + aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.value_or( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } else { aBorderLine.Color = sal_Int32( COL_AUTO ); - aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); - aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); + aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.value_or( 0 ) ) / 4 ); + aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.value_or( 0 ) ) / 4 ); + aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.value_or( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx index e44a103e3865..e7cad96fb235 100644 --- a/oox/source/drawingml/textbodyproperties.cxx +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -45,7 +45,7 @@ TextBodyProperties::TextBodyProperties() /* For Legacy purposes: TODO: Check if it is required at all! */ void TextBodyProperties::pushVertSimulation() { - sal_Int32 tVert = moVert.get( XML_horz ); + sal_Int32 tVert = moVert.value_or( XML_horz ); if( !(tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 || tVert == XML_mongolianVert) ) return; @@ -79,7 +79,7 @@ void TextBodyProperties::pushTextDistances(Size const& rTextAreaSize) PROP_TextLowerDistance }; - switch (moRotation.get(0)) + switch (moRotation.value_or(0)) { case 90*1*60000: nOff = 3; break; case 90*2*60000: nOff = 2; break; diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 6f771eeee9ff..a2a0d365b0c2 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -116,7 +116,7 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons // ST_TextVerticalType if( rAttribs.hasAttribute( XML_vert ) ) { mrTextBodyProp.moVert = rAttribs.getToken( XML_vert ); - sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz ); + sal_Int32 tVert = mrTextBodyProp.moVert.value_or( XML_horz ); if (tVert == XML_vert || tVert == XML_eaVert || tVert == XML_mongolianVert) mrTextBodyProp.moRotation = 5400000; else if (tVert == XML_vert270) @@ -175,7 +175,7 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement } case A_TOKEN( spAutoFit ): { - const sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz ); + const sal_Int32 tVert = mrTextBodyProp.moVert.value_or( XML_horz ); if( tVert != XML_vert && tVert != XML_eaVert && tVert != XML_vert270 && tVert != XML_mongolianVert ) mrTextBodyProp.maPropertyMap.setProperty( PROP_TextAutoGrowHeight, true); } diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 7cae52fcfd97..b99723e6cd01 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -171,31 +171,31 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty( PROP_CharHeightComplex, fHeight); } - rPropMap.setProperty( PROP_CharKerning, static_cast<sal_Int16>(GetTextSpacingPoint( moSpacing.get( 0 ) ))); + rPropMap.setProperty( PROP_CharKerning, static_cast<sal_Int16>(GetTextSpacingPoint( moSpacing.value_or( 0 ) ))); - rPropMap.setProperty( PROP_CharUnderline, GetFontUnderline( moUnderline.get( XML_none ) )); - rPropMap.setProperty( PROP_CharStrikeout, GetFontStrikeout( moStrikeout.get( XML_noStrike ) )); - rPropMap.setProperty( PROP_CharCaseMap, GetCaseMap( moCaseMap.get( XML_none ) )); + rPropMap.setProperty( PROP_CharUnderline, GetFontUnderline( moUnderline.value_or( XML_none ) )); + rPropMap.setProperty( PROP_CharStrikeout, GetFontStrikeout( moStrikeout.value_or( XML_noStrike ) )); + rPropMap.setProperty( PROP_CharCaseMap, GetCaseMap( moCaseMap.value_or( XML_none ) )); if( moBaseline.has_value() ) { - rPropMap.setProperty( PROP_CharEscapement, sal_Int16(moBaseline.get( 0 ) / 1000)); + rPropMap.setProperty( PROP_CharEscapement, sal_Int16(moBaseline.value_or( 0 ) / 1000)); rPropMap.setProperty( PROP_CharEscapementHeight, sal_Int8(DFLT_ESC_PROP)); } else { rPropMap.setProperty( PROP_CharEscapement, sal_Int16(0)); rPropMap.setProperty( PROP_CharEscapementHeight, sal_Int8(100)); // 100% } - float fWeight = moBold.get( false ) ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL; + float fWeight = moBold.value_or( false ) ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL; rPropMap.setProperty( PROP_CharWeight, fWeight); rPropMap.setProperty( PROP_CharWeightAsian, fWeight); rPropMap.setProperty( PROP_CharWeightComplex, fWeight); - awt::FontSlant eSlant = moItalic.get( false ) ? awt::FontSlant_ITALIC : awt::FontSlant_NONE; + awt::FontSlant eSlant = moItalic.value_or( false ) ? awt::FontSlant_ITALIC : awt::FontSlant_NONE; rPropMap.setProperty( PROP_CharPosture, eSlant); rPropMap.setProperty( PROP_CharPostureAsian, eSlant); rPropMap.setProperty( PROP_CharPostureComplex, eSlant); - bool bUnderlineFillFollowText = moUnderlineFillFollowText.get( false ); + bool bUnderlineFillFollowText = moUnderlineFillFollowText.value_or( false ); if( moUnderline.has_value() && maUnderlineColor.isUsed() && !bUnderlineFillFollowText ) { rPropMap.setProperty( PROP_CharUnderlineHasColor, true); diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index c7b6b0c4cfb6..5752af105c72 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -288,7 +288,7 @@ OUString AttributeList::getString( sal_Int32 nAttrToken, const OUString& rDefaul OUString AttributeList::getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const { - return getXString( nAttrToken ).get( rDefault ); + return getXString( nAttrToken ).value_or( rDefault ); } const char* AttributeList::getChar( sal_Int32 nAttrToken ) const @@ -303,42 +303,42 @@ const char* AttributeList::getChar( sal_Int32 nAttrToken ) const double AttributeList::getDouble( sal_Int32 nAttrToken, double fDefault ) const { - return getDouble( nAttrToken ).get( fDefault ); + return getDouble( nAttrToken ).value_or( fDefault ); } sal_Int32 AttributeList::getInteger( sal_Int32 nAttrToken, sal_Int32 nDefault ) const { - return getInteger( nAttrToken ).get( nDefault ); + return getInteger( nAttrToken ).value_or( nDefault ); } sal_uInt32 AttributeList::getUnsigned( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const { - return getUnsigned( nAttrToken ).get( nDefault ); + return getUnsigned( nAttrToken ).value_or( nDefault ); } sal_Int64 AttributeList::getHyper( sal_Int32 nAttrToken, sal_Int64 nDefault ) const { - return getHyper( nAttrToken ).get( nDefault ); + return getHyper( nAttrToken ).value_or( nDefault ); } sal_Int32 AttributeList::getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault ) const { - return getIntegerHex( nAttrToken ).get( nDefault ); + return getIntegerHex( nAttrToken ).value_or( nDefault ); } sal_uInt32 AttributeList::getUnsignedHex( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const { - return getIntegerHex( nAttrToken ).get( nDefault ); + return getIntegerHex( nAttrToken ).value_or( nDefault ); } bool AttributeList::getBool( sal_Int32 nAttrToken, bool bDefault ) const { - return getBool( nAttrToken ).get( bDefault ); + return getBool( nAttrToken ).value_or( bDefault ); } util::DateTime AttributeList::getDateTime( sal_Int32 nAttrToken, const util::DateTime& rDefault ) const { - return getDateTime( nAttrToken ).get( rDefault ); + return getDateTime( nAttrToken ).value_or( rDefault ); } std::vector<sal_Int32> AttributeList::getTokenList(sal_Int32 nAttrToken) const diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index da922ab91370..bc7ce80ab152 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -230,7 +230,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, // convert opacity const sal_Int32 DML_FULL_OPAQUE = ::oox::drawingml::MAX_PERCENT; - double fOpacity = roVmlOpacity.get( 1.0 ); + double fOpacity = roVmlOpacity.value_or( 1.0 ); sal_Int32 nOpacity = getLimitedValue< sal_Int32, double >( fOpacity * DML_FULL_OPAQUE, 0, DML_FULL_OPAQUE ); if( nOpacity < DML_FULL_OPAQUE ) aDmlColor.addTransformation( XML_alpha, nOpacity ); @@ -700,7 +700,7 @@ void StrokeModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper DrawingML code do the hard work. */ LineProperties aLineProps; - if( moStroked.get( true ) ) + if( moStroked.value_or( true ) ) { aLineProps.maLineFill.moFillType = XML_solidFill; lclConvertArrow( aLineProps.maStartArrow, maStartArrow ); @@ -751,17 +751,17 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& DrawingML code do the hard work. */ FillProperties aFillProps; - if( moFilled.get( true ) ) + if( moFilled.value_or( true ) ) { - sal_Int32 nFillType = moType.get( XML_solid ); + sal_Int32 nFillType = moType.value_or( XML_solid ); switch( nFillType ) { case XML_gradient: case XML_gradientRadial: { aFillProps.moFillType = XML_gradFill; - aFillProps.maGradientProps.moRotateWithShape = moRotate.get( false ); - double fFocus = moFocus.get( 0.0 ); + aFillProps.maGradientProps.moRotateWithShape = moRotate.value_or( false ); + double fFocus = moFocus.value_or( 0.0 ); // prepare colors Color aColor1 = ConversionHelper::decodeColor( rGraphicHelper, moColor, moOpacity, API_RGB_WHITE ); @@ -771,7 +771,7 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& if( nFillType == XML_gradient ) { // normalize angle to range [0;360) degrees - sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, sal_Int32 >( moAngle.get( 0 ), 0, 360 ); + sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, sal_Int32 >( moAngle.value_or( 0 ), 0, 360 ); // focus of -50% or 50% is axial gradient if( ((-0.75 <= fFocus) && (fFocus <= -0.25)) || ((0.25 <= fFocus) && (fFocus <= 0.75)) ) @@ -813,8 +813,8 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& { aFillProps.maGradientProps.moGradientPath = XML_rect; // convert VML focus position and size to DrawingML fill-to-rect - DoublePair aFocusPos = moFocusPos.get( DoublePair( 0.0, 0.0 ) ); - DoublePair aFocusSize = moFocusSize.get( DoublePair( 0.0, 0.0 ) ); + DoublePair aFocusPos = moFocusPos.value_or( DoublePair( 0.0, 0.0 ) ); + DoublePair aFocusSize = moFocusSize.value_or( DoublePair( 0.0, 0.0 ) ); double fLeft = getLimitedValue< double, double >( aFocusPos.first, 0.0, 1.0 ); double fTop = getLimitedValue< double, double >( aFocusPos.second, 0.0, 1.0 ); double fRight = getLimitedValue< double, double >( fLeft + aFocusSize.first, fLeft, 1.0 ); @@ -949,7 +949,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen } if (moStyle.has_value()) { - OUString aStyle = moStyle.get(OUString()); + OUString aStyle = moStyle.value_or(OUString()); sal_Int32 nIndex = 0; while( nIndex >= 0 ) diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 97c51325c5fd..7fcde2ba9860 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -158,18 +158,18 @@ ShapeType::~ShapeType() sal_Int32 ShapeType::getShapeType() const { - return maTypeModel.moShapeType.get( 0 ); + return maTypeModel.moShapeType.value_or( 0 ); } OUString ShapeType::getGraphicPath() const { - return maTypeModel.moGraphicPath.get( OUString() ); + return maTypeModel.moGraphicPath.value_or( OUString() ); } awt::Rectangle ShapeType::getCoordSystem() const { - Int32Pair aCoordPos = maTypeModel.moCoordPos.get( Int32Pair( 0, 0 ) ); - Int32Pair aCoordSize = maTypeModel.moCoordSize.get( Int32Pair( 1000, 1000 ) ); + Int32Pair aCoordPos = maTypeModel.moCoordPos.value_or( Int32Pair( 0, 0 ) ); + Int32Pair aCoordSize = maTypeModel.moCoordSize.value_or( Int32Pair( 1000, 1000 ) ); if( aCoordSize.first == 0 ) aCoordSize.first = 1; if( aCoordSize.second == 0 ) diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index a75940a272fe..0b0939c6ba38 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -313,7 +313,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent, mrTypeModel.moCoordPos = lclDecodeInt32Pair( rAttribs, XML_coordorigin ); mrTypeModel.moCoordSize = lclDecodeInt32Pair( rAttribs, XML_coordsize ); setStyle( rAttribs.getString( XML_style, OUString() ) ); - if( lclDecodeBool( rAttribs, O_TOKEN( hr )).get( false )) + if( lclDecodeBool( rAttribs, O_TOKEN( hr )).value_or( false )) { // MSO's handling of o:hr width is nowhere near what the spec says: // - o:hrpct is not in % but in 0.1% // - if o:hrpct is not given, 100% width is assumed @@ -435,7 +435,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A case VML_TOKEN( shadow ): { mrTypeModel.maShadowModel.mbHasShadow = true; - mrTypeModel.maShadowModel.moShadowOn = lclDecodeBool(rAttribs, XML_on).get(false); + mrTypeModel.maShadowModel.moShadowOn = lclDecodeBool(rAttribs, XML_on).value_or(false); 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); |