diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 11:23:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-21 14:37:34 +0200 |
commit | 36d3fa20a5e0ebd7d3befd789a6930c777972e8c (patch) | |
tree | c22f6e2673f79345ae32e46096fbd57baf331b2a | |
parent | 6471ea40f7739814264ce8540cdedef28a3cb731 (diff) |
remove oox::OptValue::set
as a step towards converting it to std::optional
Change-Id: I49db0b13338388c92108fc2c27d8e662dcd954d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136214
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/oox/helper/helper.hxx | 5 | ||||
-rw-r--r-- | oox/source/drawingml/chart/objectformatter.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/scene3dcontext.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/table/predefined-table-styles.cxx | 22 | ||||
-rw-r--r-- | oox/source/drawingml/table/tablecell.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterpropertiescontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/textrun.cxx | 4 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 24 |
10 files changed, 39 insertions, 40 deletions
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 8f0e75839281..7299353f1298 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -184,15 +184,14 @@ public: const Type& get() const { return maValue; } const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } - void set( const Type& rValue ) { maValue = rValue; mbHasValue = true; } Type& use() { mbHasValue = true; return maValue; } - OptValue& operator=( const Type& rValue ) { set( rValue ); return *this; } + OptValue& operator=( const Type& rValue ) { maValue = rValue; mbHasValue = true; return *this; } bool operator==( const OptValue& rValue ) const { return ( ( !mbHasValue && rValue.mbHasValue == false ) || ( mbHasValue == rValue.mbHasValue && maValue == rValue.maValue ) ); } - void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) set( rValue.maValue ); } + void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) operator=(rValue.maValue); } private: Type maValue; diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 4bd69f8c779f..e04bfe5f0ae6 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -906,7 +906,7 @@ TextFormatter::TextFormatter( ObjectFormatterData& rData, const AutoTextEntry* p ::Color nTextColor = getPhColor( -1 ); if( sal_Int32(nTextColor) >= 0 ) { mxAutoText->maFillProperties.maFillColor.setSrgbClr( nTextColor ); - mxAutoText->maFillProperties.moFillType.set(XML_solidFill); + mxAutoText->maFillProperties.moFillType = XML_solidFill; } mxAutoText->moHeight = pAutoTextEntry->mnDefFontSize; mxAutoText->moBold = pAutoTextEntry->mbBold; diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx index e17893472bc2..10b4fbff606c 100644 --- a/oox/source/drawingml/scene3dcontext.cxx +++ b/oox/source/drawingml/scene3dcontext.cxx @@ -105,9 +105,9 @@ ContextHandlerRef SceneText3DPropertiesContext::onCreateContext( sal_Int32 aElem aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none ); if( aElementToken == A_TOKEN( bevelT ) ) - mr3DProperties.maTopBevelProperties.set( aProps ); + mr3DProperties.maTopBevelProperties = aProps; else - mr3DProperties.maBottomBevelProperties.set( aProps ); + mr3DProperties.maBottomBevelProperties = aProps; break; } @@ -150,9 +150,9 @@ ContextHandlerRef Shape3DPropertiesContext::onCreateContext( sal_Int32 aElementT aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none ); if( aElementToken == A_TOKEN( bevelT ) ) - mr3DProperties.maTopBevelProperties.set( aProps ); + mr3DProperties.maTopBevelProperties = aProps; else - mr3DProperties.maBottomBevelProperties.set( aProps ); + mr3DProperties.maBottomBevelProperties = aProps; break; } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7e61dfb7c9c5..6b6ffbeab607 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1772,7 +1772,7 @@ Reference< XShape > const & Shape::createAndInsert( if ( pFontRef->maPhClr.isUsed() ) { aCharStyleProperties.maFillProperties.maFillColor = pFontRef->maPhClr; - aCharStyleProperties.maFillProperties.moFillType.set(XML_solidFill); + aCharStyleProperties.maFillProperties.moFillType = XML_solidFill; } } } diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx b/oox/source/drawingml/table/predefined-table-styles.cxx index 68cbb00cf261..7d420038856a 100644 --- a/oox/source/drawingml/table/predefined-table-styles.cxx +++ b/oox/source/drawingml/table/predefined-table-styles.cxx @@ -204,7 +204,7 @@ static std::map<OUString, sal_Int32> tokens = { { "", XML_dk1 }, void setBorderLineType(const oox::drawingml::LinePropertiesPtr& pLineProp, sal_Int32 nToken) { - pLineProp->maLineFill.moFillType.set(nToken); + pLineProp->maLineFill.moFillType = nToken; } void insertBorderLine(TableStylePart& aTableStylePart, sal_Int32 nToken, @@ -381,16 +381,16 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId) // Start to set fill types. - pTblBgFillProperties->moFillType.set(XML_solidFill); - pWholeTblFillProperties->moFillType.set(XML_solidFill); - pFirstRowFillProperties->moFillType.set(XML_solidFill); - pFirstColFillProperties->moFillType.set(XML_solidFill); - pLastRowFillProperties->moFillType.set(XML_solidFill); - pLastColFillProperties->moFillType.set(XML_solidFill); - pBand1HFillProperties->moFillType.set(XML_solidFill); - pBand1VFillProperties->moFillType.set(XML_solidFill); - pBand2HFillProperties->moFillType.set(XML_solidFill); - pBand2VFillProperties->moFillType.set(XML_solidFill); + pTblBgFillProperties->moFillType = XML_solidFill; + pWholeTblFillProperties->moFillType = XML_solidFill; + pFirstRowFillProperties->moFillType = XML_solidFill; + pFirstColFillProperties->moFillType = XML_solidFill; + pLastRowFillProperties->moFillType = XML_solidFill; + pLastColFillProperties->moFillType = XML_solidFill; + pBand1HFillProperties->moFillType = XML_solidFill; + pBand1VFillProperties->moFillType = XML_solidFill; + pBand2HFillProperties->moFillType = XML_solidFill; + pBand2VFillProperties->moFillType = XML_solidFill; // End to set fill types. diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 1dae5369b271..db117e941ac4 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -213,7 +213,7 @@ static void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, if ( rTableStylePart.getTextColor().isUsed() ) { aTextCharProps.maFillProperties.maFillColor = rTableStylePart.getTextColor(); - aTextCharProps.maFillProperties.moFillType.set(XML_solidFill); + aTextCharProps.maFillProperties.moFillType = XML_solidFill; } if( rTableStylePart.getTextBoldStyle() ) aTextCharProps.moBold = *rTableStylePart.getTextBoldStyle(); @@ -534,10 +534,10 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons ::Color aResult( basegfx::interpolate(nBgColor.getBColor(), nCellColor.getBColor(), 1.0 - fTransparency) ); aFillProperties.maFillColor.clearTransformations(); aFillProperties.maFillColor.setSrgbClr(sal_Int32(aResult.GetRGBColor())); - aFillProperties.moFillType.set(XML_solidFill); + aFillProperties.moFillType = XML_solidFill; } if (!aFillProperties.moFillType.has_value()) - aFillProperties.moFillType.set(XML_noFill); + aFillProperties.moFillType = XML_noFill; // TODO: phClr? aFillProperties.pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() ); diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index c201f9738029..ffee500486ac 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -262,7 +262,7 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl if (rAttribs.getInteger(W_TOKEN(val)).has_value()) { mrTextCharacterProperties.maFillProperties.maFillColor.setSrgbClr(rAttribs.getIntegerHex(W_TOKEN(val)).get()); - mrTextCharacterProperties.maFillProperties.moFillType.set(XML_solidFill); + mrTextCharacterProperties.maFillProperties.moFillType = XML_solidFill; } break; case W_TOKEN( sz ): diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index 59bb959cb548..2482e9da0461 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -157,9 +157,9 @@ sal_Int32 TextRun::insertAt( if (!maTextCharacterProperties.maHyperlinkPropertyMap.hasProperty(PROP_CharColor)) aTextCharacterProps.maFillProperties.maFillColor.setSchemeClr(XML_hlink); - aTextCharacterProps.maFillProperties.moFillType.set(XML_solidFill); + aTextCharacterProps.maFillProperties.moFillType = XML_solidFill; if ( !maTextCharacterProperties.moUnderline.has_value() ) - aTextCharacterProps.moUnderline.set( XML_sng ); + aTextCharacterProps.moUnderline = XML_sng; PropertySet aFieldTextPropSet( xTextFieldCursor ); aTextCharacterProps.pushToPropSet( aFieldTextPropSet, rFilterBase ); diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index af5b61eca601..de6bf421288d 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -646,8 +646,8 @@ void ShapeContext::setPoints(std::u16string_view rPoints) o3tl::convert(fMaxY - fMinY, o3tl::Length::twip, o3tl::Length::pt)) + "pt"; // Set moCoordSize, otherwise default (1000,1000) is used. - mrShape.getTypeModel().moCoordSize.set( - Int32Pair(basegfx::fround(fMaxX - fMinX), basegfx::fround(fMaxY - fMinY))); + mrShape.getTypeModel().moCoordSize = + Int32Pair(basegfx::fround(fMaxX - fMinX), basegfx::fround(fMaxY - fMinY)); } } diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 57d54f17756f..339ecc902c6e 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -443,15 +443,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap xPropertySet->setPropertyValue("FillColor", aAny); // fillType will decide, possible it'll be the start color of a gradient. - aFillModel.moColor.set( - "#" - + msfilter::util::ConvertColorOU(Color(ColorTransparency, aAny.get<sal_Int32>()))); + aFillModel.moColor + = "#" + + msfilter::util::ConvertColorOU(Color(ColorTransparency, aAny.get<sal_Int32>())); } else if (rProperty.first == "fillBackColor") // fillType will decide, possible it'll be the end color of a gradient. - aFillModel.moColor2.set("#" - + msfilter::util::ConvertColorOU( - msfilter::util::BGRToRGB(rProperty.second.toInt32()))); + aFillModel.moColor2 = "#" + + msfilter::util::ConvertColorOU( + msfilter::util::BGRToRGB(rProperty.second.toInt32())); else if (rProperty.first == "lineColor") aLineColor <<= msfilter::util::BGRToRGB(rProperty.second.toInt32()); else if (rProperty.first == "lineBackColor") @@ -658,7 +658,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap switch (rProperty.second.toInt32()) { case 7: // Shade using the fillAngle - aFillModel.moType.set(oox::XML_gradient); + aFillModel.moType = oox::XML_gradient; break; default: SAL_INFO("writerfilter", @@ -667,19 +667,19 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } } else if (rProperty.first == "fillFocus") - aFillModel.moFocus.set(rProperty.second.toDouble() / 100); // percent + aFillModel.moFocus = rProperty.second.toDouble() / 100; // percent else if (rProperty.first == "fShadow" && xPropertySet.is()) { if (rProperty.second.toInt32() == 1) aShadowModel.mbHasShadow = true; } else if (rProperty.first == "shadowColor") - aShadowModel.moColor.set("#" - + msfilter::util::ConvertColorOU( - msfilter::util::BGRToRGB(rProperty.second.toInt32()))); + aShadowModel.moColor = "#" + + msfilter::util::ConvertColorOU( + msfilter::util::BGRToRGB(rProperty.second.toInt32())); else if (rProperty.first == "shadowOffsetX") // EMUs to points - aShadowModel.moOffset.set(OUString::number(rProperty.second.toDouble() / 12700) + "pt"); + aShadowModel.moOffset = OUString::number(rProperty.second.toDouble() / 12700) + "pt"; else if (rProperty.first == "posh" || rProperty.first == "posv" || rProperty.first == "fFitShapeToText" || rProperty.first == "fFilled" || rProperty.first == "rotation") |