include/oox/helper/helper.hxx                  |    1 -
 oox/source/drawingml/chart/seriesconverter.cxx |    5 +++--
 oox/source/drawingml/lineproperties.cxx        |   16 +++++++++-------
 oox/source/drawingml/table/tablecell.cxx       |    2 +-
 4 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 6471ea40f7739814264ce8540cdedef28a3cb731
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Jun 21 11:09:42 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jun 21 14:36:43 2022 +0200

    remove oox::OptValue::differsFrom
    
    as a step towards converting it to std::optional
    
    Change-Id: I198abb4ae85b1d82f465577ebd0eec37b78c1111
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136213
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 1805e0b24c81..8f0e75839281 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -180,7 +180,6 @@ public:
 
     bool         has_value() const { return mbHasValue; }
     bool         operator!() const { return !mbHasValue; }
-    bool         differsFrom( const Type& rValue ) const { return mbHasValue 
&& (maValue != rValue); }
 
     const Type&  get() const { return maValue; }
     const Type&  get( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index c022c35bf536..703d995b18bf 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -722,12 +722,13 @@ void DataPointConverter::convertFromModel( const 
Reference< XDataSeries >& rxDat
         PropertySet aPropSet( rxDataSeries->getDataPointByIndex( 
mrModel.mnIndex ) );
 
         // data point marker
-        if( mrModel.monMarkerSymbol.differsFrom( rSeries.mnMarkerSymbol ) || 
mrModel.monMarkerSize.differsFrom( rSeries.mnMarkerSize ) )
+        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 );
 
         // data point pie explosion
-        if( mrModel.monExplosion.differsFrom( rSeries.mnExplosion ) )
+        if( mrModel.monExplosion.has_value() && mrModel.monExplosion.get() != 
rSeries.mnExplosion )
             rTypeGroup.convertPieExplosion( aPropSet, 
mrModel.monExplosion.get() );
 
         // point formatting
diff --git a/oox/source/drawingml/lineproperties.cxx 
b/oox/source/drawingml/lineproperties.cxx
index 8f1a0c905b92..4cd83045840a 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -449,12 +449,13 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
         rPropMap.setProperty( ShapeProperty::LineCap, eLineCap );
 
     // create line dash from preset dash token or dash stop vector (not for 
invisible line)
-    if( (eLineStyle != drawing::LineStyle_NONE) && (moPresetDash.differsFrom( 
XML_solid ) || !maCustomDash.empty()) )
+    if( (eLineStyle != drawing::LineStyle_NONE) &&
+        ((moPresetDash.has_value() && moPresetDash.get() != XML_solid) || 
!maCustomDash.empty()) )
     {
         LineDash aLineDash;
         aLineDash.Style = lclGetDashStyle( moLineCap.get( XML_flat ) );
 
-        if(moPresetDash.differsFrom(XML_solid))
+        if(moPresetDash.has_value() && moPresetDash.get() != XML_solid)
             lclConvertPresetDash(aLineDash, moPresetDash.get(XML_dash));
         else // !maCustomDash.empty()
         {
@@ -505,11 +506,12 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 drawing::LineStyle LineProperties::getLineStyle() const
 {
     // rules to calculate the line style inferred from the code in 
LineProperties::pushToPropMap
-    return (maLineFill.moFillType.get() == XML_noFill) ?
-            drawing::LineStyle_NONE :
-            (moPresetDash.differsFrom( XML_solid ) || (!moPresetDash && 
!maCustomDash.empty())) ?
-                    drawing::LineStyle_DASH :
-                    drawing::LineStyle_SOLID;
+    if (maLineFill.moFillType.get() == XML_noFill)
+        return drawing::LineStyle_NONE;
+    if ((moPresetDash.has_value() && moPresetDash.get() != XML_solid) ||
+        (!moPresetDash && !maCustomDash.empty()))
+       return drawing::LineStyle_DASH;
+    return drawing::LineStyle_SOLID;
 }
 
 drawing::LineCap LineProperties::getLineCap() const
diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 32ac36b92ddc..1dae5369b271 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -64,7 +64,7 @@ static void applyLineAttributes( const 
::oox::core::XmlFilterBase& rFilterBase,
         sal_Int32 nPropId )
 {
     BorderLine2 aBorderLine;
-    if ( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ))
+    if ( rLineProperties.maLineFill.moFillType.has_value() && 
rLineProperties.maLineFill.moFillType.get() != XML_noFill )
     {
         Color aColor = rLineProperties.maLineFill.getBestSolidColor();
         aBorderLine.Color = sal_Int32(aColor.getColor( 
rFilterBase.getGraphicHelper() ));

Reply via email to