diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 11:00:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 11:58:40 +0200 |
commit | d8487667e65184aa58520aa907fa747a73a08e34 (patch) | |
tree | 8420d263854ebe3a28f56356cd9721386086b651 | |
parent | 966d9757de471f2a5ea1ffa87cef019dcf1e0cb3 (diff) |
rename oox::OptValue::has() to has_value
as a step towards converting it to std::optional
Change-Id: I9b2201c29827fcddae3b46480065c90b2907e6cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136210
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
35 files changed, 178 insertions, 178 deletions
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 63718ca0ebed..1805e0b24c81 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -178,7 +178,7 @@ public: explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {} explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {} - bool has() const { return mbHasValue; } + bool has_value() const { return mbHasValue; } bool operator!() const { return !mbHasValue; } bool differsFrom( const Type& rValue ) const { return mbHasValue && (maValue != rValue); } diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index a8ccc6cdf164..bb6b278af8ac 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -55,12 +55,12 @@ namespace { void lclSetValueOrClearAny( Any& orAny, const OptValue< double >& rofValue ) { - if( rofValue.has() ) orAny <<= rofValue.get(); else orAny.clear(); + if( rofValue.has_value() ) orAny <<= rofValue.get(); else orAny.clear(); } bool lclIsLogarithmicScale( const AxisModel& rAxisModel ) { - return rAxisModel.mofLogBase.has() && (2.0 <= rAxisModel.mofLogBase.get()) && (rAxisModel.mofLogBase.get() <= 1000.0); + return rAxisModel.mofLogBase.has_value() && (2.0 <= rAxisModel.mofLogBase.get()) && (rAxisModel.mofLogBase.get() <= 1000.0); } sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit ) @@ -78,7 +78,7 @@ sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit ) void lclConvertTimeInterval( Any& orInterval, const OptValue< double >& rofUnit, sal_Int32 nTimeUnit ) { - if( rofUnit.has() && (1.0 <= rofUnit.get()) && (rofUnit.get() <= SAL_MAX_INT32) ) + if( rofUnit.has_value() && (1.0 <= rofUnit.get()) && (rofUnit.get() <= SAL_MAX_INT32) ) orInterval <<= css::chart::TimeInterval( static_cast< sal_Int32 >( rofUnit.get() ), lclGetApiTimeUnit( nTimeUnit ) ); else orInterval.clear(); @@ -264,7 +264,7 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord lclConvertTimeInterval( aScaleData.TimeIncrement.MajorTimeInterval, mrModel.mofMajorUnit, mrModel.mnMajorTimeUnit ); lclConvertTimeInterval( aScaleData.TimeIncrement.MinorTimeInterval, mrModel.mofMinorUnit, mrModel.mnMinorTimeUnit ); // base time unit - if( mrModel.monBaseTimeUnit.has() ) + if( mrModel.monBaseTimeUnit.has_value() ) aScaleData.TimeIncrement.TimeResolution <<= lclGetApiTimeUnit( mrModel.monBaseTimeUnit.get() ); else aScaleData.TimeIncrement.TimeResolution.clear(); @@ -274,7 +274,7 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord // do not overlap text unless the rotation is 0 in xml bool bTextOverlap = false; if (mrModel.mxTextProp.is() - && mrModel.mxTextProp->getTextProperties().moRotation.has()) + && mrModel.mxTextProp->getTextProperties().moRotation.has_value()) bTextOverlap = mrModel.mxTextProp->getTextProperties().moRotation.get() == 0; aAxisProp.setProperty(PROP_TextOverlap, bTextOverlap); @@ -308,7 +308,7 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord lclSetValueOrClearAny( aScaleData.Maximum, mrModel.mofMax ); // major increment IncrementData& rIncrementData = aScaleData.IncrementData; - if( mrModel.mofMajorUnit.has() && aScaleData.Scaling.is() ) + if( mrModel.mofMajorUnit.has_value() && aScaleData.Scaling.is() ) rIncrementData.Distance <<= aScaleData.Scaling->doScaling( mrModel.mofMajorUnit.get() ); else lclSetValueOrClearAny( rIncrementData.Distance, mrModel.mofMajorUnit ); @@ -319,16 +319,16 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord rIntervalCount.clear(); if( bLogScale ) { - if( mrModel.mofMinorUnit.has() ) + if( mrModel.mofMinorUnit.has_value() ) rIntervalCount <<= sal_Int32( 9 ); } - else if( mrModel.mofMajorUnit.has() && mrModel.mofMinorUnit.has() && (0.0 < mrModel.mofMinorUnit.get()) && (mrModel.mofMinorUnit.get() <= mrModel.mofMajorUnit.get()) ) + else if( mrModel.mofMajorUnit.has_value() && mrModel.mofMinorUnit.has_value() && (0.0 < mrModel.mofMinorUnit.get()) && (mrModel.mofMinorUnit.get() <= mrModel.mofMajorUnit.get()) ) { double fCount = mrModel.mofMajorUnit.get() / mrModel.mofMinorUnit.get() + 0.5; if( (1.0 <= fCount) && (fCount < 1001.0) ) rIntervalCount <<= static_cast< sal_Int32 >( fCount ); } - else if( !mrModel.mofMinorUnit.has() ) + else if( !mrModel.mofMinorUnit.has_value() ) { // tdf#114168 If minor unit is not set then set interval to 5, as MS Excel do. rIntervalCount <<= static_cast< sal_Int32 >( 5 ); @@ -364,7 +364,7 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord // position of crossing axis ------------------------------------------ - bool bManualCrossing = mrModel.mofCrossesAt.has(); + bool bManualCrossing = mrModel.mofCrossesAt.has_value(); cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE; if( !bManualCrossing ) switch( mrModel.mnCrossMode ) { diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 774d784a6eb7..7b9044c47442 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -210,7 +210,7 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern // tdf#134118 leave gap if the time unit is month bool bIsMonthBasedTimeUnit = false; if( mrModel.mxPlotArea.is() && mrModel.mxPlotArea->maAxes.size() > 0 && - mrModel.mxPlotArea->maAxes[0]->monBaseTimeUnit.has() ) + mrModel.mxPlotArea->maAxes[0]->monBaseTimeUnit.has_value() ) { bIsMonthBasedTimeUnit = mrModel.mxPlotArea->maAxes[0]->monBaseTimeUnit.get() == XML_months; } diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 24094db5234a..4bd69f8c779f 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -838,7 +838,7 @@ LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* mxAutoLine->maLineFill.maFillColor.setSrgbClr( 0xD9D9D9 ); } // change line width according to chart auto style - if( mxAutoLine->moLineWidth.has() ) + if( mxAutoLine->moLineWidth.has_value() ) mxAutoLine->moLineWidth = mxAutoLine->moLineWidth.get() * pAutoFormatEntry->mnRelLineWidth / 100; } @@ -914,7 +914,7 @@ TextFormatter::TextFormatter( ObjectFormatterData& rData, const AutoTextEntry* p if( const TextCharacterProperties* pTextProps = lclGetTextProperties( rxGlobalTextProp ) ) { mxAutoText->assignUsed( *pTextProps ); - if( pTextProps->moHeight.has() ) + if( pTextProps->moHeight.has_value() ) mxAutoText->moHeight = pTextProps->moHeight.get() * pAutoTextEntry->mnRelFontSize / 100; } } @@ -1139,7 +1139,7 @@ void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eO bool ObjectFormatter::isAutomaticFill( const ModelRef< Shape >& rxShapeProp ) { - return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has(); + return !rxShapeProp || !rxShapeProp->getFillProperties().moFillType.has_value(); } } // namespace oox diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 3ace8e9a703e..c022c35bf536 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -124,10 +124,10 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt bool bHasAnyElement = true; if (bMSO2007Doc) { - bHasAnyElement = rDataLabel.moaSeparator.has() || rDataLabel.monLabelPos.has() || - rDataLabel.mobShowCatName.has() || rDataLabel.mobShowLegendKey.has() || - rDataLabel.mobShowPercent.has() || rDataLabel.mobShowSerName.has() || - rDataLabel.mobShowVal.has(); + bHasAnyElement = rDataLabel.moaSeparator.has_value() || rDataLabel.monLabelPos.has_value() || + rDataLabel.mobShowCatName.has_value() || rDataLabel.mobShowLegendKey.has_value() || + rDataLabel.mobShowPercent.has_value() || rDataLabel.mobShowSerName.has_value() || + rDataLabel.mobShowVal.has_value(); } bool bShowValue = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( !bMSO2007Doc ); @@ -160,13 +160,13 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt // data label separator (do not overwrite series separator, if no explicit point separator is present) // 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() ) ) + if( bShowPercent && !bShowValue && ( bDataSeriesLabel || rDataLabel.moaSeparator.has_value() ) ) rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.get( "\n" ) ); - else if( bDataSeriesLabel || rDataLabel.moaSeparator.has() ) + else if( bDataSeriesLabel || rDataLabel.moaSeparator.has_value() ) rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.get( "; " ) ); // data label placement (do not overwrite series placement, if no explicit point placement is present) - if( !(bDataSeriesLabel || rDataLabel.monLabelPos.has()) ) + if( !(bDataSeriesLabel || rDataLabel.monLabelPos.has_value()) ) return; namespace csscd = ::com::sun::star::chart::DataLabelPlacement; @@ -200,7 +200,7 @@ void importBorderProperties( PropertySet& rPropSet, Shape& rShape, const Graphic if (rLP.maLineFill.moFillType.get() == XML_noFill) return; - if (rLP.moLineWidth.has()) + if (rLP.moLineWidth.has_value()) { sal_Int32 nWidth = convertEmuToHmm(rLP.moLineWidth.get()); rPropSet.setProperty(PROP_LabelBorderWidth, uno::Any(nWidth)); @@ -215,7 +215,7 @@ void importFillProperties( PropertySet& rPropSet, Shape& rShape, const GraphicHe { FillProperties& rFP = rShape.getFillProperties(); - if (rFP.moFillType.has() && rFP.moFillType.get() == XML_solidFill) + if (rFP.moFillType.has_value() && rFP.moFillType.get() == XML_solidFill) { rPropSet.setProperty(PROP_LabelFillStyle, drawing::FillStyle_SOLID); @@ -223,7 +223,7 @@ void importFillProperties( PropertySet& rPropSet, Shape& rShape, const GraphicHe ::Color nColor = aColor.getColor(rGraphicHelper); rPropSet.setProperty(PROP_LabelFillColor, uno::Any(nColor)); } - else if(rFP.moFillType.has() && rFP.moFillType.get() == XML_pattFill) + else if(rFP.moFillType.has_value() && rFP.moFillType.get() == XML_pattFill) { rPropSet.setProperty(PROP_LabelFillStyle, drawing::FillStyle_HATCH); rPropSet.setProperty(PROP_LabelFillBackground, true); @@ -355,7 +355,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat { DataPointCustomLabelFieldType eType = lcl_ConvertFieldNameToFieldEnum( pField->getType() ); - if (eType == DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE && oaCellRange.has()) + if (eType == DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE && oaCellRange.has_value()) { xCustomLabel->setCellRange( oaCellRange.get() ); xCustomLabel->setString( oaLabelText.get() ); @@ -665,15 +665,15 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat aPropSet.setProperty( PROP_MovingAveragePeriod, mrModel.mnPeriod ); // Intercept - bool hasIntercept = mrModel.mfIntercept.has(); + bool hasIntercept = mrModel.mfIntercept.has_value(); aPropSet.setProperty( PROP_ForceIntercept, hasIntercept); if (hasIntercept) aPropSet.setProperty( PROP_InterceptValue, mrModel.mfIntercept.get()); // Extrapolation - if (mrModel.mfForward.has()) + if (mrModel.mfForward.has_value()) aPropSet.setProperty( PROP_ExtrapolateForward, mrModel.mfForward.get() ); - if (mrModel.mfBackward.has()) + if (mrModel.mfBackward.has_value()) aPropSet.setProperty( PROP_ExtrapolateBackward, mrModel.mfBackward.get() ); // trendline formatting diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx index fc93b460a8de..8da42f62a419 100644 --- a/oox/source/drawingml/colorchoicecontext.cxx +++ b/oox/source/drawingml/colorchoicecontext.cxx @@ -64,7 +64,7 @@ void ColorValueContext::onStartElement( const AttributeList& rAttribs ) { mrColor.setSchemeClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); oox::OptValue<OUString> sSchemeName = rAttribs.getString( XML_val ); - if( sSchemeName.has() ) + if( sSchemeName.has_value() ) mrColor.setSchemeName( sSchemeName.use() ); } break; diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 59d8a8775fb6..ff666b25ab6c 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -214,7 +214,7 @@ void CustomShapeProperties::pushToPropSet( aPath.setProperty( PROP_Segments, comphelper::containerToSequence(maSegments) ); - if ( maTextRect.has() ) { + if ( maTextRect.has_value() ) { Sequence< EnhancedCustomShapeTextFrame > aTextFrames{ { /* tl */ { maTextRect.get().l, maTextRect.get().t }, /* br */ { maTextRect.get().r, maTextRect.get().b } } @@ -286,21 +286,21 @@ void CustomShapeProperties::pushToPropSet( // 4. The unit of angular adjustment values are 6000th degree. aHandle.setProperty( PROP_Position, maAdjustHandleList[ i ].pos); - if ( maAdjustHandleList[ i ].gdRef1.has() ) + if ( maAdjustHandleList[ i ].gdRef1.has_value() ) { sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef1.get() ); if ( nIndex >= 0 ) aHandle.setProperty( PROP_RefR, nIndex); } - if ( maAdjustHandleList[ i ].gdRef2.has() ) + if ( maAdjustHandleList[ i ].gdRef2.has_value() ) { sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef2.get() ); if ( nIndex >= 0 ) aHandle.setProperty( PROP_RefAngle, nIndex); } - if ( maAdjustHandleList[ i ].min1.has() ) + if ( maAdjustHandleList[ i ].min1.has_value() ) aHandle.setProperty( PROP_RadiusRangeMinimum, maAdjustHandleList[ i ].min1.get()); - if ( maAdjustHandleList[ i ].max1.has() ) + if ( maAdjustHandleList[ i ].max1.has_value() ) aHandle.setProperty( PROP_RadiusRangeMaximum, maAdjustHandleList[ i ].max1.get()); /* TODO: AngleMin & AngleMax @@ -313,7 +313,7 @@ void CustomShapeProperties::pushToPropSet( else { aHandle.setProperty( PROP_Position, maAdjustHandleList[ i ].pos); - if ( maAdjustHandleList[ i ].gdRef1.has() ) + if ( maAdjustHandleList[ i ].gdRef1.has_value() ) { // TODO: PROP_RefX and PROP_RefY are not yet part of our file format, // so the handles will not work after save/reload @@ -321,19 +321,19 @@ void CustomShapeProperties::pushToPropSet( if ( nIndex >= 0 ) aHandle.setProperty( PROP_RefX, nIndex); } - if ( maAdjustHandleList[ i ].gdRef2.has() ) + if ( maAdjustHandleList[ i ].gdRef2.has_value() ) { sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef2.get() ); if ( nIndex >= 0 ) aHandle.setProperty( PROP_RefY, nIndex); } - if ( maAdjustHandleList[ i ].min1.has() ) + if ( maAdjustHandleList[ i ].min1.has_value() ) aHandle.setProperty( PROP_RangeXMinimum, maAdjustHandleList[ i ].min1.get()); - if ( maAdjustHandleList[ i ].max1.has() ) + if ( maAdjustHandleList[ i ].max1.has_value() ) aHandle.setProperty( PROP_RangeXMaximum, maAdjustHandleList[ i ].max1.get()); - if ( maAdjustHandleList[ i ].min2.has() ) + if ( maAdjustHandleList[ i ].min2.has_value() ) aHandle.setProperty( PROP_RangeYMinimum, maAdjustHandleList[ i ].min2.get()); - if ( maAdjustHandleList[ i ].max2.has() ) + if ( maAdjustHandleList[ i ].max2.has_value() ) aHandle.setProperty( PROP_RangeYMaximum, maAdjustHandleList[ i ].max2.get()); } aHandlesRange[ i ] = aHandle.makePropertyValueSequence(); diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx index 4f0e3f047233..e0ea3c93dc35 100644 --- a/oox/source/drawingml/diagram/datamodelcontext.cxx +++ b/oox/source/drawingml/diagram/datamodelcontext.cxx @@ -116,7 +116,7 @@ public: { // 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 )); - if(aOptVal.has()) + if(aOptVal.has_value()) mrPoint.moHierarchyBranch = aOptVal.get(); break; } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index a904797a4363..08e5269b6b6c 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1516,12 +1516,12 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& if (nDir == XML_fromL || nDir == XML_fromR) { oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); - bScaleDownEmptySpacing = oWidth.has() && oWidth.get() > 0; + bScaleDownEmptySpacing = oWidth.has_value() && oWidth.get() > 0; } if (!bScaleDownEmptySpacing && (nDir == XML_fromT || nDir == XML_fromB)) { oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); - bScaleDownEmptySpacing = oHeight.has() && oHeight.get() > 0; + bScaleDownEmptySpacing = oHeight.has_value() && oHeight.get() > 0; } if (bScaleDownEmptySpacing && aCurrShape->getChildren().empty()) { @@ -1571,9 +1571,9 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, aCurrShape->getInternalName(), XML_w); oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); awt::Size aSize = aChildSize; - if (oWidth.has()) + if (oWidth.has_value()) aSize.Width = oWidth.get(); - if (oHeight.has()) + if (oHeight.has_value()) aSize.Height = oHeight.get(); aTotalSize.Width += aSize.Width; aTotalSize.Height += aSize.Height; @@ -1598,9 +1598,9 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, aCurrShape->getInternalName(), XML_h); awt::Size aSize = aChildSize; - if (oWidth.has()) + if (oWidth.has_value()) aSize.Width = oWidth.get(); - if (oHeight.has()) + if (oHeight.has_value()) aSize.Height = oHeight.get(); if (aChildrenToShrink.empty() || aChildrenToShrink.find(aCurrShape->getInternalName()) @@ -1725,7 +1725,7 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& { for (auto& aParagraph : pTextBody->getParagraphs()) for (auto& aRun : aParagraph->getRuns()) - if (!aRun->getTextCharacterProperties().moHeight.has()) + if (!aRun->getTextCharacterProperties().moHeight.has_value()) aRun->getTextCharacterProperties().moHeight = fFontSize * 100; } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 9270201920b3..b26c42b85759 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -345,7 +345,7 @@ void FillProperties::assignUsed( const FillProperties& rSourceProps ) Color FillProperties::getBestSolidColor() const { Color aSolidColor; - if( moFillType.has() ) switch( moFillType.get() ) + if( moFillType.has_value() ) switch( moFillType.get() ) { case XML_solidFill: aSolidColor = maFillColor; @@ -371,7 +371,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color nPhClr, sal_Int16 nPhClrTheme, bool bFlipH, bool bFlipV, bool bIsCustomShape) const { - if( !moFillType.has() ) + if( !moFillType.has_value() ) return; FillStyle eFillStyle = FillStyle_NONE; @@ -434,7 +434,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if ( !maGradientProps.moRotateWithShape.get( true ) ) nShapeRotation = 0; - if( maGradientProps.moGradientPath.has() ) + if( maGradientProps.moGradientPath.has_value() ) { IntegerRectangle2D aFillToRect = maGradientProps.moFillToRect.get( IntegerRectangle2D( 0, 0, MAX_PERCENT, MAX_PERCENT ) ); sal_Int32 nCenterX = (MAX_PERCENT + aFillToRect.X1 - aFillToRect.X2) / 2; @@ -783,7 +783,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, rPropMap.setProperty( ShapeProperty::FillBitmapOffsetY, nTileOffsetY ); } } - else if ( eBitmapMode == BitmapMode_STRETCH && maBlipProps.moFillRect.has() ) + else if ( eBitmapMode == BitmapMode_STRETCH && maBlipProps.moFillRect.has_value() ) { geometry::IntegerRectangle2D aFillRect( maBlipProps.moFillRect.get() ); awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic ) ); @@ -813,7 +813,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, } } - if (maBlipProps.moAlphaModFix.has()) + if (maBlipProps.moAlphaModFix.has_value()) rPropMap.setProperty(ShapeProperty::FillTransparency, static_cast<sal_Int16>(100 - (maBlipProps.moAlphaModFix.get() / PER_PERCENT))); } break; @@ -823,7 +823,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if( rPropMap.supportsProperty( ShapeProperty::FillHatch ) ) { Color aColor( maPatternProps.maPattFgColor ); - if( aColor.isUsed() && maPatternProps.moPattPreset.has() ) + if( aColor.isUsed() && maPatternProps.moPattPreset.has_value() ) { eFillStyle = FillStyle_HATCH; rPropMap.setProperty( ShapeProperty::FillHatch, createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( rGraphicHelper, nPhClr ) ) ); @@ -897,7 +897,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe } // cropping - if ( maBlipProps.moClipRect.has() ) + if ( maBlipProps.moClipRect.has_value() ) { geometry::IntegerRectangle2D oClipRect( maBlipProps.moClipRect.get() ); awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic ) ); @@ -953,7 +953,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe rPropMap.setProperty(PROP_Graphic, xGraphic); - if ( maBlipProps.moAlphaModFix.has() ) + if ( maBlipProps.moAlphaModFix.has_value() ) { rPropMap.setProperty(PROP_Transparency, static_cast<sal_Int16>(100 - (maBlipProps.moAlphaModFix.get() / PER_PERCENT))); } diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 2d10e82871ab..8f1a0c905b92 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -433,7 +433,7 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const { // line fill type must exist, otherwise ignore other properties - if( !maLineFill.moFillType.has() ) + if( !maLineFill.moFillType.has_value() ) return; // line style (our core only supports none and solid) @@ -444,8 +444,8 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, rPropMap.setProperty( ShapeProperty::LineWidth, nLineWidth ); // line cap type - LineCap eLineCap = moLineCap.has() ? lclGetLineCap( moLineCap.get() ) : LineCap_BUTT; - if( moLineCap.has() ) + LineCap eLineCap = moLineCap.has_value() ? lclGetLineCap( moLineCap.get() ) : LineCap_BUTT; + if( moLineCap.has_value() ) rPropMap.setProperty( ShapeProperty::LineCap, eLineCap ); // create line dash from preset dash token or dash stop vector (not for invisible line) @@ -485,7 +485,7 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, rPropMap.setProperty( ShapeProperty::LineStyle, eLineStyle ); // line joint type - if( moLineJoint.has() ) + if( moLineJoint.has_value() ) rPropMap.setProperty( ShapeProperty::LineJoint, lclGetLineJoint( moLineJoint.get() ) ); // line color and transparence @@ -514,7 +514,7 @@ drawing::LineStyle LineProperties::getLineStyle() const drawing::LineCap LineProperties::getLineCap() const { - if( moLineCap.has() ) + if( moLineCap.has_value() ) return lclGetLineCap( moLineCap.get() ); return drawing::LineCap_BUTT; @@ -522,7 +522,7 @@ drawing::LineCap LineProperties::getLineCap() const drawing::LineJoint LineProperties::getLineJoint() const { - if( moLineJoint.has() ) + if( moLineJoint.has_value() ) return lclGetLineJoint( moLineJoint.get() ); return drawing::LineJoint_NONE; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index cff9a5018c6a..7e61dfb7c9c5 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -643,15 +643,15 @@ static void lcl_createPresetShape(const uno::Reference<drawing::XShape>& xShape, std::shared_ptr<TextRun> pRun = pParagraph->getRuns()[0]; TextCharacterProperties& pProperties = pRun->getTextCharacterProperties(); - if (pProperties.moBold.has() && pProperties.moBold.get()) + if (pProperties.moBold.has_value() && pProperties.moBold.get()) { xSet->setPropertyValue( UNO_NAME_CHAR_WEIGHT, uno::Any( css::awt::FontWeight::BOLD ) ); } - if (pProperties.moItalic.has() && pProperties.moItalic.get()) + if (pProperties.moItalic.has_value() && pProperties.moItalic.get()) { xSet->setPropertyValue( UNO_NAME_CHAR_POSTURE, uno::Any( css::awt::FontSlant::FontSlant_ITALIC ) ); } - if (pProperties.moHeight.has()) + if (pProperties.moHeight.has_value()) { sal_Int32 nHeight = pProperties.moHeight.get() / 100; xSet->setPropertyValue( UNO_NAME_CHAR_HEIGHT, uno::Any( nHeight ) ); @@ -1239,7 +1239,7 @@ Reference< XShape > const & Shape::createAndInsert( mpTextBody->getTextProperties().pushTextDistances(Size(aShapeRectHmm.Width, aShapeRectHmm.Height)); aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap ); // Push char properties as well - specifically useful when this is a placeholder - if( mpMasterTextListStyle && mpMasterTextListStyle->getListStyle()[0].getTextCharacterProperties().moHeight.has() ) + if( mpMasterTextListStyle && mpMasterTextListStyle->getListStyle()[0].getTextCharacterProperties().moHeight.has_value() ) aShapeProps.setProperty(PROP_CharHeight, GetFontHeight( mpMasterTextListStyle->getListStyle()[0].getTextCharacterProperties().moHeight.get() )); } @@ -1259,7 +1259,7 @@ Reference< XShape > const & Shape::createAndInsert( mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle ); FillProperties aFillProperties = getActualFillProperties(pTheme, &rShapeOrParentShapeFillProps); - if (getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill) + if (getFillProperties().moFillType.has_value() && getFillProperties().moFillType.get() == XML_grpFill) getFillProperties().assignUsed(aFillProperties); if(!bIsCroppedGraphic) aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, nFillPhClrTheme, mbFlipH, mbFlipV, bIsCustomShape ); @@ -1358,7 +1358,7 @@ Reference< XShape > const & Shape::createAndInsert( { css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<css::table::BorderLine2>(); aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>(); - if (aLineProperties.moLineWidth.has()) + if (aLineProperties.moLineWidth.has_value()) aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get()); aShapeProps.setProperty(nBorder, aBorderLine); } @@ -1405,12 +1405,12 @@ Reference< XShape > const & Shape::createAndInsert( if (aShapeProps.hasProperty(PROP_Shadow)) aShapeProps.erase(PROP_Shadow); - if (oShadowDistance || oShadowColor || aEffectProperties.maShadow.moShadowDir.has()) + if (oShadowDistance || oShadowColor || aEffectProperties.maShadow.moShadowDir.has_value()) { css::table::ShadowFormat aFormat; if (oShadowColor) aFormat.Color = *oShadowColor; - if (aEffectProperties.maShadow.moShadowDir.has()) + if (aEffectProperties.maShadow.moShadowDir.has_value()) { css::table::ShadowLocation nLocation = css::table::ShadowLocation_NONE; switch (aEffectProperties.maShadow.moShadowDir.get()) @@ -1561,7 +1561,7 @@ Reference< XShape > const & Shape::createAndInsert( } // If getFillProperties.moFillType is unused that means gradient is defined by a theme // which is already saved into StyleFillRef property, so no need to save the explicit values too - if( getFillProperties().moFillType.has() ) + if( getFillProperties().moFillType.has_value() ) putPropertyToGrabBag( "GradFillDefinition", uno::Any(comphelper::containerToSequence(aGradientStops))); putPropertyToGrabBag( "OriginalGradFill", aShapeProps.getProperty(PROP_FillGradient) ); } @@ -1809,7 +1809,7 @@ Reference< XShape > const & Shape::createAndInsert( } // Set glow effect properties - if ( aEffectProperties.maGlow.moGlowRad.has() ) + if ( aEffectProperties.maGlow.moGlowRad.has_value() ) { uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY); propertySet->setPropertyValue("GlowEffectRadius", Any(convertEmuToHmm(aEffectProperties.maGlow.moGlowRad.get()))); @@ -1818,7 +1818,7 @@ Reference< XShape > const & Shape::createAndInsert( } // Set soft edge effect properties - if (aEffectProperties.maSoftEdge.moRad.has()) + if (aEffectProperties.maSoftEdge.moRad.has_value()) { uno::Reference<beans::XPropertySet> propertySet(mxShape, uno::UNO_QUERY); propertySet->setPropertyValue( @@ -2196,7 +2196,7 @@ FillProperties Shape::getActualFillProperties(const Theme* pTheme, const FillPro // Parent shape's properties if ( pParentShapeFillProps != nullptr) - if( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill ) + if( getFillProperties().moFillType.has_value() && getFillProperties().moFillType.get() == XML_grpFill ) aFillProperties.assignUsed( *pParentShapeFillProps ); return aFillProperties; diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx index 07ba56579682..8554320acf0b 100644 --- a/oox/source/drawingml/shape3dproperties.cxx +++ b/oox/source/drawingml/shape3dproperties.cxx @@ -207,37 +207,37 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getCameraAt css::uno::Sequence<css::beans::PropertyValue> aSeq(6); auto pSeq = aSeq.getArray(); sal_Int32 nSize = 0; - if( mfFieldOfVision.has() ) + if( mfFieldOfVision.has_value() ) { pSeq[nSize].Name = "fov"; pSeq[nSize].Value <<= mfFieldOfVision.use(); nSize++; } - if( mfZoom.has() ) + if( mfZoom.has_value() ) { pSeq[nSize].Name = "zoom"; pSeq[nSize].Value <<= mfZoom.use(); nSize++; } - if( mnPreset.has() ) + if( mnPreset.has_value() ) { pSeq[nSize].Name = "prst"; pSeq[nSize].Value <<= getCameraPrstName( mnPreset.use() ); nSize++; } - if( maCameraRotation.mnLatitude.has() ) + if( maCameraRotation.mnLatitude.has_value() ) { pSeq[nSize].Name = "rotLat"; pSeq[nSize].Value <<= maCameraRotation.mnLatitude.use(); nSize++; } - if( maCameraRotation.mnLongitude.has() ) + if( maCameraRotation.mnLongitude.has_value() ) { pSeq[nSize].Name = "rotLon"; pSeq[nSize].Value <<= maCameraRotation.mnLongitude.use(); nSize++; } - if( maCameraRotation.mnRevolution.has() ) + if( maCameraRotation.mnRevolution.has_value() ) { pSeq[nSize].Name = "rotRev"; pSeq[nSize].Value <<= maCameraRotation.mnRevolution.use(); @@ -252,31 +252,31 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getLightRig css::uno::Sequence<css::beans::PropertyValue> aSeq(5); auto pSeq = aSeq.getArray(); sal_Int32 nSize = 0; - if( mnLightRigDirection.has() ) + if( mnLightRigDirection.has_value() ) { pSeq[nSize].Name = "dir"; pSeq[nSize].Value <<= getLightRigDirName( mnLightRigDirection.use() ); nSize++; } - if( mnLightRigType.has() ) + if( mnLightRigType.has_value() ) { pSeq[nSize].Name = "rig"; pSeq[nSize].Value <<= getLightRigName( mnLightRigType.use() ); nSize++; } - if( maLightRigRotation.mnLatitude.has() ) + if( maLightRigRotation.mnLatitude.has_value() ) { pSeq[nSize].Name = "rotLat"; pSeq[nSize].Value <<= maLightRigRotation.mnLatitude.use(); nSize++; } - if( maLightRigRotation.mnLongitude.has() ) + if( maLightRigRotation.mnLongitude.has_value() ) { pSeq[nSize].Name = "rotLon"; pSeq[nSize].Value <<= maLightRigRotation.mnLongitude.use(); nSize++; } - if( maLightRigRotation.mnRevolution.has() ) + if( maLightRigRotation.mnRevolution.has_value() ) { pSeq[nSize].Name = "rotRev"; pSeq[nSize].Value <<= maLightRigRotation.mnRevolution.use(); @@ -291,19 +291,19 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getBevelAtt css::uno::Sequence<css::beans::PropertyValue> aSeq(3); auto pSeq = aSeq.getArray(); sal_Int32 nSize = 0; - if( rProps.mnPreset.has() ) + if( rProps.mnPreset.has_value() ) { pSeq[nSize].Name = "prst"; pSeq[nSize].Value <<= getBevelPresetTypeString( rProps.mnPreset.use() ); nSize++; } - if( rProps.mnWidth.has() ) + if( rProps.mnWidth.has_value() ) { pSeq[nSize].Name = "w"; pSeq[nSize].Value <<= rProps.mnWidth.use(); nSize++; } - if( rProps.mnHeight.has() ) + if( rProps.mnHeight.has_value() ) { pSeq[nSize].Name = "h"; pSeq[nSize].Value <<= rProps.mnHeight.use(); @@ -335,37 +335,37 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getShape3DA css::uno::Sequence<css::beans::PropertyValue> aSeq(8); auto pSeq = aSeq.getArray(); sal_Int32 nSize = 0; - if( mnExtrusionH.has() ) + if( mnExtrusionH.has_value() ) { pSeq[nSize].Name = "extrusionH"; pSeq[nSize].Value <<= mnExtrusionH.use(); nSize++; } - if( mnContourW.has() ) + if( mnContourW.has_value() ) { pSeq[nSize].Name = "contourW"; pSeq[nSize].Value <<= mnContourW.use(); nSize++; } - if( mnShapeZ.has() ) + if( mnShapeZ.has_value() ) { pSeq[nSize].Name = "z"; pSeq[nSize].Value <<= mnShapeZ.use(); nSize++; } - if( mnMaterial.has() ) + if( mnMaterial.has_value() ) { pSeq[nSize].Name = "prstMaterial"; pSeq[nSize].Value <<= getPresetMaterialTypeString( mnMaterial.use() ); nSize++; } - if( maTopBevelProperties.has() ) + if( maTopBevelProperties.has_value() ) { pSeq[nSize].Name = "bevelT"; pSeq[nSize].Value <<= getBevelAttributes( maTopBevelProperties.use() ); nSize++; } - if( maBottomBevelProperties.has() ) + if( maBottomBevelProperties.has_value() ) { pSeq[nSize].Name = "bevelB"; pSeq[nSize].Value <<= getBevelAttributes( maBottomBevelProperties.use() ); diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx b/oox/source/drawingml/table/predefined-table-styles.cxx index 91eccdfc88a6..68cbb00cf261 100644 --- a/oox/source/drawingml/table/predefined-table-styles.cxx +++ b/oox/source/drawingml/table/predefined-table-styles.cxx @@ -210,7 +210,7 @@ void setBorderLineType(const oox::drawingml::LinePropertiesPtr& pLineProp, sal_I void insertBorderLine(TableStylePart& aTableStylePart, sal_Int32 nToken, oox::drawingml::LinePropertiesPtr pLineProp) { - if (pLineProp->maLineFill.moFillType.has()) + if (pLineProp->maLineFill.moFillType.has_value()) { aTableStylePart.getLineBorders().insert( std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(nToken, pLineProp)); diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index fdf7950dcf2c..32ac36b92ddc 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -82,7 +82,7 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, aBorderLine.LineDistance = 0; } - if ( rLineProperties.moPresetDash.has() ) + if ( rLineProperties.moPresetDash.has_value() ) { switch ( rLineProperties.moPresetDash.get() ) { @@ -536,7 +536,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons aFillProperties.maFillColor.setSrgbClr(sal_Int32(aResult.GetRGBColor())); aFillProperties.moFillType.set(XML_solidFill); } - if (!aFillProperties.moFillType.has()) + if (!aFillProperties.moFillType.has_value()) aFillProperties.moFillType.set(XML_noFill); // TODO: phClr? diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index f7d4abd4e685..6f771eeee9ff 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -149,7 +149,7 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement if( mpShapePtr ) { const OptValue<OUString> sPrst = rAttribs.getString( XML_prst ); - if( sPrst.has() ) + if( sPrst.has_value() ) { mrTextBodyProp.msPrst = sPrst.get(); if( mrTextBodyProp.msPrst != "textNoShape" ) diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 7be4d89ae57c..0406d7fa72b0 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -108,7 +108,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty( PROP_CharFontFamilyComplex, nFontFamily); } - if ( maFillProperties.moFillType.has() ) + if ( maFillProperties.moFillType.has_value() ) { Color aColor = maFillProperties.getBestSolidColor(); bool bContoured = false; @@ -119,8 +119,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil // tdf#137438 Emulate text outline color/transparency. // If the outline color dominates, then use it as the text color. - if (moTextOutlineProperties.has() - && moTextOutlineProperties.get().maLineFill.moFillType.has() + if (moTextOutlineProperties.has_value() + && moTextOutlineProperties.get().maLineFill.moFillType.has_value() && moTextOutlineProperties.get().maLineFill.moFillType.get() != XML_noFill) { Color aLineColor = moTextOutlineProperties.get().maLineFill.getBestSolidColor(); @@ -146,7 +146,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil } } - if( moLang.has() && !moLang.get().isEmpty() ) + if( moLang.has_value() && !moLang.get().isEmpty() ) { LanguageTag aTag(moLang.get()); lang::Locale aLocale(aTag.getLocale()); @@ -161,10 +161,10 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil } } - if( moHeight.has() ) + if( moHeight.has_value() ) { float fHeight = GetFontHeight( moHeight.get() ); - if (moFontScale.has()) + if (moFontScale.has_value()) fHeight *= (moFontScale.get() / 100000); rPropMap.setProperty( PROP_CharHeight, fHeight); rPropMap.setProperty( PROP_CharHeightAsian, fHeight); @@ -177,7 +177,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty( PROP_CharStrikeout, GetFontStrikeout( moStrikeout.get( XML_noStrike ) )); rPropMap.setProperty( PROP_CharCaseMap, GetCaseMap( moCaseMap.get( XML_none ) )); - if( moBaseline.has() ) { + if( moBaseline.has_value() ) { rPropMap.setProperty( PROP_CharEscapement, sal_Int16(moBaseline.get( 0 ) / 1000)); rPropMap.setProperty( PROP_CharEscapementHeight, sal_Int8(DFLT_ESC_PROP)); } else { @@ -196,7 +196,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty( PROP_CharPostureComplex, eSlant); bool bUnderlineFillFollowText = moUnderlineFillFollowText.get( false ); - if( moUnderline.has() && maUnderlineColor.isUsed() && !bUnderlineFillFollowText ) + if( moUnderline.has_value() && maUnderlineColor.isUsed() && !bUnderlineFillFollowText ) { rPropMap.setProperty( PROP_CharUnderlineHasColor, true); rPropMap.setProperty( PROP_CharUnderlineColor, maUnderlineColor.getColor( rFilter.getGraphicHelper() )); @@ -234,7 +234,7 @@ void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFil float TextCharacterProperties::getCharHeightPoints( float fDefault ) const { - return moHeight.has() ? GetFontHeight( moHeight.get() ) : fDefault; + return moHeight.has_value() ? GetFontHeight( moHeight.get() ) : fDefault; } } // namespace oox::drawingml diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 5ec22d45e2a4..c201f9738029 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -228,7 +228,7 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl else if (attrib == "none") mrTextCharacterProperties.moUnderline = XML_none; auto colorAttrib = rAttribs.getIntegerHex(W_TOKEN(color)); - if (colorAttrib.has()) + if (colorAttrib.has_value()) { oox::drawingml::Color theColor; theColor.setSrgbClr(colorAttrib.get()); @@ -259,14 +259,14 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl mrTextCharacterProperties.moStrikeout = XML_dblStrike; break; case W_TOKEN( color ): - if (rAttribs.getInteger(W_TOKEN(val)).has()) + if (rAttribs.getInteger(W_TOKEN(val)).has_value()) { mrTextCharacterProperties.maFillProperties.maFillColor.setSrgbClr(rAttribs.getIntegerHex(W_TOKEN(val)).get()); mrTextCharacterProperties.maFillProperties.moFillType.set(XML_solidFill); } break; case W_TOKEN( sz ): - if (rAttribs.getInteger(W_TOKEN(val)).has()) + if (rAttribs.getInteger(W_TOKEN(val)).has_value()) { sal_Int32 nVal = rAttribs.getInteger(W_TOKEN(val)).get(); // wml has half points, dml has hundred points diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 664c2dd37d2c..76615409901f 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -169,7 +169,7 @@ sal_Int32 TextField::insertAt( TextCharacterProperties aTextCharacterProps( rTextCharacterStyle ); aTextCharacterProps.assignUsed( maTextParagraphProperties.getTextCharacterProperties() ); aTextCharacterProps.assignUsed( getTextCharacterProperties() ); - if ( aTextCharacterProps.moHeight.has() ) + if ( aTextCharacterProps.moHeight.has_value() ) nCharHeight = aTextCharacterProps.moHeight.get(); aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index f91ee279bb3b..8b333bc4545c 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -108,7 +108,7 @@ void TextParagraph::insertAt( TextCharacterProperties aTextCharacterProps( aTextCharacterStyle ); aTextCharacterProps.assignUsed( maEndProperties ); - if ( aTextCharacterProps.moHeight.has() ) + if ( aTextCharacterProps.moHeight.has_value() ) nCharHeight = nCharHeightFirst = aTextCharacterProps.moHeight.get(); aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); } @@ -145,9 +145,9 @@ void TextParagraph::insertAt( // bullets have same color as following texts by default if( !aioBulletList.hasProperty( PROP_BulletColor ) && !maRuns.empty() - && (*maRuns.begin())->getTextCharacterProperties().maFillProperties.moFillType.has() ) + && (*maRuns.begin())->getTextCharacterProperties().maFillProperties.moFillType.has_value() ) aioBulletList.setProperty( PROP_BulletColor, (*maRuns.begin())->getTextCharacterProperties().maFillProperties.getBestSolidColor().getColor( rFilterBase.getGraphicHelper() )); - if( !aioBulletList.hasProperty( PROP_BulletColor ) && aTextCharacterStyle.maFillProperties.moFillType.has() ) + if( !aioBulletList.hasProperty( PROP_BulletColor ) && aTextCharacterStyle.maFillProperties.moFillType.has_value() ) aioBulletList.setProperty( PROP_BulletColor, aTextCharacterStyle.maFillProperties.getBestSolidColor().getColor( rFilterBase.getGraphicHelper() )); if( !aioBulletList.hasProperty( PROP_GraphicSize ) && !maRuns.empty() && aParaProp.getBulletList().maGraphic.hasValue()) diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index c1b8763a961a..a6b8f2c275cc 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -280,7 +280,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl case W_TOKEN( jc ): { OptValue< OUString > oParaAdjust = rAttribs.getString( W_TOKEN(val) ); - if( oParaAdjust.has() && !oParaAdjust.get().isEmpty() ) + if( oParaAdjust.has_value() && !oParaAdjust.get().isEmpty() ) { const OUString& sParaAdjust = oParaAdjust.get(); if( sParaAdjust == "left" ) @@ -300,7 +300,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl if( !rAttribs.getBool(W_TOKEN(beforeAutospacing), false) ) { OptValue<sal_Int32> oBefore = rAttribs.getInteger(W_TOKEN(before)); - if (oBefore.has()) + if (oBefore.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); rSpacing.nUnit = TextSpacing::Unit::Points; @@ -310,7 +310,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl else { OptValue<sal_Int32> oBeforeLines = rAttribs.getInteger(W_TOKEN(beforeLines)); - if (oBeforeLines.has()) + if (oBeforeLines.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); rSpacing.nUnit = TextSpacing::Unit::Percent; @@ -324,7 +324,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl if( !rAttribs.getBool(W_TOKEN(afterAutospacing), false) ) { OptValue<sal_Int32> oAfter = rAttribs.getInteger(W_TOKEN(after)); - if (oAfter.has()) + if (oAfter.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); rSpacing.nUnit = TextSpacing::Unit::Points; @@ -334,7 +334,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl else { OptValue<sal_Int32> oAfterLines = rAttribs.getInteger(W_TOKEN(afterLines)); - if (oAfterLines.has()) + if (oAfterLines.has_value()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); rSpacing.nUnit = TextSpacing::Unit::Percent; @@ -347,10 +347,10 @@ 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)); - if (oLineSpacing.has()) + if (oLineSpacing.has_value()) { TextSpacing& rLineSpacing = mrTextParagraphProperties.getLineSpacing(); - if( !oLineRule.has() || oLineRule.get() == "auto" ) + if( !oLineRule.has_value() || oLineRule.get() == "auto" ) { rLineSpacing.nUnit = TextSpacing::Unit::Percent; rLineSpacing.nValue = oLineSpacing.get() * MAX_PERCENT / 240; diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index e3bcecb745d5..59bb959cb548 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -76,7 +76,7 @@ sal_Int32 TextRun::insertAt( aTextCharacterProps.maFillProperties.moFillType = XML_solidFill; aTextCharacterProps.assignUsed(maTextCharacterProperties); - if ( aTextCharacterProps.moHeight.has() ) + if ( aTextCharacterProps.moHeight.has_value() ) nCharHeight = aTextCharacterProps.moHeight.get(); else // UNO API has the character height as float, DML has it as int, but in hundreds. @@ -158,7 +158,7 @@ sal_Int32 TextRun::insertAt( aTextCharacterProps.maFillProperties.maFillColor.setSchemeClr(XML_hlink); aTextCharacterProps.maFillProperties.moFillType.set(XML_solidFill); - if ( !maTextCharacterProperties.moUnderline.has() ) + if ( !maTextCharacterProperties.moUnderline.has_value() ) aTextCharacterProps.moUnderline.set( XML_sng ); PropertySet aFieldTextPropSet( xTextFieldCursor ); diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index e0bea17c22e6..25cb1ac5354f 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -243,7 +243,7 @@ OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const case XML_off: return OptValue< bool >( false ); } OptValue< sal_Int32 > onValue = getInteger( nAttrToken ); - return OptValue< bool >( onValue.has(), onValue.get() != 0 ); + return OptValue< bool >( onValue.has_value(), onValue.get() != 0 ); } OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx index 9d95b6ecc5b6..3dcc7df15ef8 100644 --- a/oox/source/ppt/layoutfragmenthandler.cxx +++ b/oox/source/ppt/layoutfragmenthandler.cxx @@ -54,7 +54,7 @@ ContextHandlerRef LayoutFragmentHandler::onCreateContext( sal_Int32 aElementToke mpSlidePersistPtr->setLayoutValueToken( rAttribs.getToken( XML_type, 0 ) ); // CT_SlideLayoutType OptValue< bool > aShowMasterShapes = rAttribs.getBool( XML_showMasterSp ); - if( aShowMasterShapes.has() && !aShowMasterShapes.get() ) { + if( aShowMasterShapes.has_value() && !aShowMasterShapes.get() ) { mpSlidePersistPtr->hideShapesAsMasterShapes(); } break; diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 2ec4a3fbe327..e730f4f26c6c 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -343,7 +343,7 @@ void PPTShape::addShape( SAL_INFO("oox.ppt","shape service: " << sServiceName); - if (mnSubType && getSubTypeIndex().has() && meShapeLocation == Layout) + if (mnSubType && getSubTypeIndex().has_value() && meShapeLocation == Layout) { oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex().get(), rSlidePersist.getShapes()->getChildren(), true ); if (!pPlaceholder) @@ -370,7 +370,7 @@ void PPTShape::addShape( } // use placeholder index if possible - if (mnSubType && getSubTypeIndex().has() && rSlidePersist.getMasterPersist()) + if (mnSubType && getSubTypeIndex().has_value() && rSlidePersist.getMasterPersist()) { oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex(getSubTypeIndex().get(), rSlidePersist.getMasterPersist()->getShapes()->getChildren()); // TODO: Check if this is required for non-notes slides as well... @@ -789,7 +789,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() ); while( aRevIter != rShapes.rend() ) { - if ( (*aRevIter)->getSubTypeIndex().has() && (*aRevIter)->getSubTypeIndex().get() == nIdx && + if ( (*aRevIter)->getSubTypeIndex().has_value() && (*aRevIter)->getSubTypeIndex().get() == nIdx && ( !bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()) ) ) { aShapePtr = *aRevIter; diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index d7f3d90f2d0f..8aa8ea9dc0e6 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -77,7 +77,7 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 aElementToken, con sal_Int32 nSubTypeIndex = rAttribs.getString( XML_idx ).get().toInt32(); mpShapePtr->setSubTypeIndex( nSubTypeIndex ); - if(!oSubType.has() && pMasterPersist) + if(!oSubType.has_value() && pMasterPersist) { pTmpPlaceholder = PPTShape::findPlaceholderByIndex( nSubTypeIndex, pMasterPersist->getShapes()->getChildren() ); diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 79ea427b5227..6553b8a7e2bd 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -83,7 +83,7 @@ SlideFragmentHandler::~SlideFragmentHandler() PropertySet aSlideProp( xSlide ); OptValue<bool> aShowMasterShapes = rAttribs.getBool(XML_showMasterSp); - if (aShowMasterShapes.has() && !aShowMasterShapes.get()) + if (aShowMasterShapes.has_value() && !aShowMasterShapes.get()) xSet->setPropertyValue("IsBackgroundObjectsVisible", Any(false)); aPropMap.setProperty( PROP_Visible, rAttribs.getBool( XML_show, true )); diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 176ad569e25f..33c6b8d450fa 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -127,7 +127,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken for (std::size_t i = 0; i < SAL_N_ELEMENTS(aInsets); ++i) { OptValue<OUString> oValue = rAttribs.getString(aInsets[i]); - if (oValue.has()) + if (oValue.has_value()) oInsets[i] = oox::drawingml::GetCoordinate(oValue.get()); else // Defaults from the spec: left/right: 91440 EMU, top/bottom: 45720 EMU @@ -239,7 +239,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken if (rAttribs.hasAttribute(XML_lIns)) { OptValue<OUString> oValue = rAttribs.getString(aInsets[i]); - if (oValue.has()) + if (oValue.has_value()) pTextBody->getTextProperties().moInsets[i] = oox::drawingml::GetCoordinate(oValue.get()); else @@ -299,7 +299,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken if (rAttribs.hasAttribute(XML_id)) { OptValue<OUString> id = rAttribs.getString(XML_id); - if (id.has()) + if (id.has_value()) { oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr; linkedTxtBoxAttr.id = id.get().toInt32(); @@ -318,7 +318,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken mpShapePtr->setTextBox(true); OptValue<OUString> id = rAttribs.getString(XML_id); OptValue<OUString> seq = rAttribs.getString(XML_seq); - if (id.has() && seq.has()) + if (id.has_value() && seq.has_value()) { oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr; linkedTxtBoxAttr.id = id.get().toInt32(); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 8f00eb47b8a4..5ac7eade0521 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -236,7 +236,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, aDmlColor.addTransformation( XML_alpha, nOpacity ); // color attribute not present - set passed default color - if( !roVmlColor.has() ) + if( !roVmlColor.has_value() ) { aDmlColor.setSrgbClr( nDefaultRgb ); return aDmlColor; @@ -556,12 +556,12 @@ namespace { sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< OUString >& roValue, sal_Int64 nDefValue ) { - return roValue.has() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.get(), 0, false, false ) : nDefValue; + return roValue.has_value() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.get(), 0, false, false ) : nDefValue; } void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, LineProperties::DashStopVector& orCustomDash, const OptValue< OUString >& roDashStyle ) { - if( !roDashStyle.has() ) + if( !roDashStyle.has_value() ) return; const OUString& rDashStyle = roDashStyle.get(); @@ -595,7 +595,7 @@ void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, LineProperties::Da sal_Int32 lclGetDmlArrowType( const OptValue< sal_Int32 >& roArrowType ) { - if( roArrowType.has() ) switch( roArrowType.get() ) + if( roArrowType.has_value() ) switch( roArrowType.get() ) { case XML_none: return XML_none; case XML_block: return XML_triangle; @@ -609,7 +609,7 @@ sal_Int32 lclGetDmlArrowType( const OptValue< sal_Int32 >& roArrowType ) sal_Int32 lclGetDmlArrowWidth( const OptValue< sal_Int32 >& roArrowWidth ) { - if( roArrowWidth.has() ) switch( roArrowWidth.get() ) + if( roArrowWidth.has_value() ) switch( roArrowWidth.get() ) { case XML_narrow: return XML_sm; case XML_medium: return XML_med; @@ -620,7 +620,7 @@ sal_Int32 lclGetDmlArrowWidth( const OptValue< sal_Int32 >& roArrowWidth ) sal_Int32 lclGetDmlArrowLength( const OptValue< sal_Int32 >& roArrowLength ) { - if( roArrowLength.has() ) switch( roArrowLength.get() ) + if( roArrowLength.has_value() ) switch( roArrowLength.get() ) { case XML_short: return XML_sm; case XML_medium: return XML_med; @@ -638,7 +638,7 @@ void lclConvertArrow( LineArrowProperties& orArrowProp, const StrokeArrowModel& sal_Int32 lclGetDmlLineCompound( const OptValue< sal_Int32 >& roLineStyle ) { - if( roLineStyle.has() ) switch( roLineStyle.get() ) + if( roLineStyle.has_value() ) switch( roLineStyle.get() ) { case XML_single: return XML_sng; case XML_thinThin: return XML_dbl; @@ -651,7 +651,7 @@ sal_Int32 lclGetDmlLineCompound( const OptValue< sal_Int32 >& roLineStyle ) sal_Int32 lclGetDmlLineCap( const OptValue< sal_Int32 >& roEndCap ) { - if( roEndCap.has() ) switch( roEndCap.get() ) + if( roEndCap.has_value() ) switch( roEndCap.get() ) { case XML_flat: return XML_flat; case XML_square: return XML_sq; @@ -662,7 +662,7 @@ sal_Int32 lclGetDmlLineCap( const OptValue< sal_Int32 >& roEndCap ) sal_Int32 lclGetDmlLineJoint( const OptValue< sal_Int32 >& roJoinStyle ) { - if( roJoinStyle.has() ) switch( roJoinStyle.get() ) + if( roJoinStyle.has_value() ) switch( roJoinStyle.get() ) { case XML_round: return XML_round; case XML_bevel: return XML_bevel; @@ -837,7 +837,7 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& case XML_tile: case XML_frame: { - if( moBitmapPath.has() && !moBitmapPath.get().isEmpty() ) + if( moBitmapPath.has_value() && !moBitmapPath.get().isEmpty() ) { aFillProps.maBlipProps.mxFillGraphic = rGraphicHelper.importEmbeddedGraphic(moBitmapPath.get()); if (aFillProps.maBlipProps.mxFillGraphic.is()) @@ -874,13 +874,13 @@ ShadowModel::ShadowModel() void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const { - if (!mbHasShadow || (moShadowOn.has() && !moShadowOn.get())) + if (!mbHasShadow || (moShadowOn.has_value() && !moShadowOn.get())) return; drawingml::Color aColor = ConversionHelper::decodeColor(rGraphicHelper, moColor, moOpacity, API_RGB_GRAY); // nOffset* is in mm100, default value is 35 twips, see DffPropertyReader::ApplyAttributes() in msfilter. sal_Int32 nOffsetX = 62, nOffsetY = 62; - if (moOffset.has()) + if (moOffset.has_value()) { std::u16string_view aOffsetX, aOffsetY; ConversionHelper::separatePair(aOffsetX, aOffsetY, moOffset.get(), ','); @@ -923,7 +923,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen { OUString sFont = ""; - if (moString.has()) + if (moString.has_value()) { uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY); xTextRange->setString(moString.get()); @@ -947,7 +947,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen } rPropMap.setAnyProperty(PROP_CustomShapeGeometry, uno::Any(aGeomPropSeq)); } - if (moStyle.has()) + if (moStyle.has_value()) { OUString aStyle = moStyle.get(OUString()); @@ -978,7 +978,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen } } } - if (moTrim.has() && moTrim.get()) + if (moTrim.has_value() && moTrim.get()) return; OUString sText = moString.get(); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 31fbbade4256..e79da70bcc6e 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -544,7 +544,7 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con } // And no LineColor property; individual borders can have colors and widths std::optional<sal_Int32> oLineWidth; - if (maTypeModel.maStrokeModel.moWeight.has()) + if (maTypeModel.maStrokeModel.moWeight.has_value()) oLineWidth = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maStrokeModel.moWeight.get(), 0, false, false); if (aPropMap.hasProperty(PROP_LineColor)) @@ -975,18 +975,18 @@ Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes >& aPropSet.setProperty(PROP_TopMargin, uno::Any(nWrapDistanceTop)); aPropSet.setProperty(PROP_BottomMargin, uno::Any(nWrapDistanceBottom)); - if (maTypeModel.moCropBottom.has() || maTypeModel.moCropLeft.has() || maTypeModel.moCropRight.has() || maTypeModel.moCropTop.has()) + if (maTypeModel.moCropBottom.has_value() || maTypeModel.moCropLeft.has_value() || maTypeModel.moCropRight.has_value() || maTypeModel.moCropTop.has_value()) { text::GraphicCrop aGraphicCrop; awt::Size aOriginalSize = rGraphicHelper.getOriginalSize(rxGraphic); - if (maTypeModel.moCropBottom.has()) + if (maTypeModel.moCropBottom.has_value()) aGraphicCrop.Bottom = lclConvertCrop(maTypeModel.moCropBottom.get(), aOriginalSize.Height); - if (maTypeModel.moCropLeft.has()) + if (maTypeModel.moCropLeft.has_value()) aGraphicCrop.Left = lclConvertCrop(maTypeModel.moCropLeft.get(), aOriginalSize.Width); - if (maTypeModel.moCropRight.has()) + if (maTypeModel.moCropRight.has_value()) aGraphicCrop.Right = lclConvertCrop(maTypeModel.moCropRight.get(), aOriginalSize.Width); - if (maTypeModel.moCropTop.has()) + if (maTypeModel.moCropTop.has_value()) aGraphicCrop.Top = lclConvertCrop(maTypeModel.moCropTop.get(), aOriginalSize.Height); aPropSet.setProperty(PROP_GraphicCrop, aGraphicCrop); diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 3141cb3aad68..af5b61eca601 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -52,7 +52,7 @@ namespace { OptValue< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 nToken ) { OptValue< OUString > oValue = rAttribs.getString( nToken ); - if( oValue.has() ) return OptValue< bool >( ConversionHelper::decodeBool( oValue.get() ) ); + if( oValue.has_value() ) return OptValue< bool >( ConversionHelper::decodeBool( oValue.get() ) ); return OptValue< bool >(); } @@ -62,7 +62,7 @@ OptValue< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 nToken OptValue< double > lclDecodePercent( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue ) { OptValue< OUString > oValue = rAttribs.getString( nToken ); - if( oValue.has() ) return OptValue< double >( ConversionHelper::decodePercent( oValue.get(), fDefValue ) ); + if( oValue.has_value() ) return OptValue< double >( ConversionHelper::decodePercent( oValue.get(), fDefValue ) ); return OptValue< double >(); } @@ -74,7 +74,7 @@ OptValue< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 nT OptValue< OUString > oValue = rAttribs.getString( nToken ); double fRetval(fDefValue); - if( oValue.has() ) + if( oValue.has_value() ) { const OUString& aString(oValue.get()); const sal_Int32 nLength(aString.getLength()); @@ -101,7 +101,7 @@ OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int { OptValue< OUString > oValue = rAttribs.getString( nToken ); OptValue< Int32Pair > oRetValue; - if( oValue.has() ) + if( oValue.has_value() ) { std::u16string_view aValue1, aValue2; ConversionHelper::separatePair( aValue1, aValue2, oValue.get(), ',' ); @@ -116,7 +116,7 @@ OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_ { OptValue< OUString > oValue = rAttribs.getString( nToken ); OptValue< DoublePair > oRetValue; - if( oValue.has() ) + if( oValue.has_value() ) { std::u16string_view aValue1, aValue2; ConversionHelper::separatePair( aValue1, aValue2, oValue.get(), ',' ); @@ -400,7 +400,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A // Gain / contrast. OptValue<OUString> oGain = rAttribs.getString(XML_gain); sal_Int32 nGain = 0x10000; - if (oGain.has() && oGain.get().endsWith("f")) + if (oGain.has_value() && oGain.get().endsWith("f")) { nGain = oGain.get().toInt32(); } @@ -415,7 +415,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A // Blacklevel / brightness. OptValue<OUString> oBlacklevel = rAttribs.getString(XML_blacklevel); sal_Int16 nBlacklevel = 0; - if (oBlacklevel.has() && oBlacklevel.get().endsWith("f")) + if (oBlacklevel.has_value() && oBlacklevel.get().endsWith("f")) { nBlacklevel = oBlacklevel.get().toInt32(); } @@ -454,7 +454,7 @@ OptValue< OUString > ShapeTypeContext::decodeFragmentPath( const AttributeList& { OptValue< OUString > oFragmentPath; OptValue< OUString > oRelId = rAttribs.getString( nToken ); - if( oRelId.has() ) + if( oRelId.has_value() ) oFragmentPath = getFragmentPathFromRelId( oRelId.get() ); return oFragmentPath; } @@ -611,7 +611,7 @@ void ShapeContext::setPoints(std::u16string_view rPoints) if (!mrShape.getTypeModel().maWidth.isEmpty() || !mrShape.getTypeModel().maHeight.isEmpty()) return; - if (mrShape.getTypeModel().moCoordSize.has()) + if (mrShape.getTypeModel().moCoordSize.has_value()) { double fWidth = mrShape.getTypeModel().moCoordSize.get().first; fWidth = o3tl::convert(fWidth, o3tl::Length::twip, o3tl::Length::pt); diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx index 1162eb2aa237..9115d2b9a3b9 100644 --- a/oox/source/vml/vmltextbox.cxx +++ b/oox/source/vml/vmltextbox.cxx @@ -86,7 +86,7 @@ void TextBox::convert(const uno::Reference<drawing::XShape>& xShape) const std::vector<beans::PropertyValue> aPropVec; const TextParagraphModel& rParagraph = portion.maParagraph; const TextFontModel& rFont = portion.maFont; - if (rFont.moName.has()) + if (rFont.moName.has_value()) { aPropertyValue.Name = "CharFontName"; aPropertyValue.Value <<= rFont.moName.get(); @@ -100,19 +100,19 @@ void TextBox::convert(const uno::Reference<drawing::XShape>& xShape) const aPropertyValue.Value <<= rFont.moNameComplex.get(); aPropVec.push_back(aPropertyValue); } - if (rFont.mobBold.has()) + if (rFont.mobBold.has_value()) { aPropertyValue.Name = "CharWeight"; aPropertyValue.Value <<= rFont.mobBold.get() ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL; aPropVec.push_back(aPropertyValue); } - if (rFont.monSize.has()) + if (rFont.monSize.has_value()) { aPropertyValue.Name = "CharHeight"; aPropertyValue.Value <<= double(rFont.monSize.get()) / 2.; aPropVec.push_back(aPropertyValue); } - if (rFont.monSpacing.has()) + if (rFont.monSpacing.has_value()) { aPropertyValue.Name = "CharKerning"; // Value is not converted to mm100: SvxKerningItem::PutValue() gets @@ -121,7 +121,7 @@ void TextBox::convert(const uno::Reference<drawing::XShape>& xShape) const aPropertyValue.Value <<= sal_Int16(rFont.monSpacing.get()); aPropVec.push_back(aPropertyValue); } - if (rParagraph.moParaAdjust.has()) + if (rParagraph.moParaAdjust.has_value()) { style::ParagraphAdjust eAdjust = style::ParagraphAdjust_LEFT; if (rParagraph.moParaAdjust.get() == "center") @@ -138,21 +138,21 @@ void TextBox::convert(const uno::Reference<drawing::XShape>& xShape) const // because it will only be applied to the entire shape, and not per-paragraph. if (sParaStyle.isEmpty() ) { - if ( rParagraph.moParaStyleName.has() ) + if ( rParagraph.moParaStyleName.has_value() ) sParaStyle = rParagraph.moParaStyleName.get(); if ( bAmbiguousStyle ) bAmbiguousStyle = false; // both empty parastyle and ambiguous can only be true at the first paragraph else - bAmbiguousStyle = rParagraph.moParaStyleName.has(); // ambiguous if both default and specified style used. + bAmbiguousStyle = rParagraph.moParaStyleName.has_value(); // ambiguous if both default and specified style used. } else if ( !bAmbiguousStyle ) { - if ( !rParagraph.moParaStyleName.has() ) + if ( !rParagraph.moParaStyleName.has_value() ) bAmbiguousStyle = true; // ambiguous if both specified and default style used. else if ( rParagraph.moParaStyleName.get() != sParaStyle ) bAmbiguousStyle = true; // ambiguous if two different styles specified. } - if (rFont.moColor.has()) + if (rFont.moColor.has_value()) { aPropertyValue.Name = "CharColor"; aPropertyValue.Value <<= rFont.moColor.get().toUInt32(16); diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index d043ebc87f00..6155749c8d30 100644 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -73,14 +73,14 @@ TextPortionContext::TextPortionContext( ContextHandler2Helper const & rParent, case OOX_TOKEN(dml, blip): { OptValue<OUString> oRelId = rAttribs.getString(R_TOKEN(embed)); - if (oRelId.has()) + if (oRelId.has_value()) mrTextBox.mrTypeModel.moGraphicPath = getFragmentPathFromRelId(oRelId.get()); } break; case VML_TOKEN(imagedata): { OptValue<OUString> oRelId = rAttribs.getString(R_TOKEN(id)); - if (oRelId.has()) + if (oRelId.has_value()) mrTextBox.mrTypeModel.moGraphicPath = getFragmentPathFromRelId(oRelId.get()); } break; diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index adf499d996f3..8084afb585ab 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -737,7 +737,7 @@ sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) con void VmlDrawing::convertControlFontData( AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, const ::oox::vml::TextFontModel& rFontModel ) const { - if( rFontModel.moName.has() ) + if( rFontModel.moName.has_value() ) rAxFontData.maFontName = rFontModel.moName.get(); // font height: convert from twips to points, then to internal representation of AX controls diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index feb56a68a0b3..57d54f17756f 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -1100,7 +1100,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap if (rShape.getWrap() != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE) xPropertySet->setPropertyValue("Surround", uno::Any(rShape.getWrap())); oox::ModelObjectHelper aModelObjectHelper(m_rImport.getModelFactory()); - if (aFillModel.moType.has()) + if (aFillModel.moType.has_value()) { oox::drawingml::ShapePropertyMap aPropMap(aModelObjectHelper); aFillModel.pushToPropMap(aPropMap, m_rImport.getGraphicHelper()); |