summaryrefslogtreecommitdiff
path: root/oox/source/drawingml
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-06-21 11:37:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-06-22 08:55:59 +0200
commitb7fce4a7d26aa559b0d86ec561348c9adee4efcc (patch)
tree4c0e6a8625049ff6f52a55b494be752ad12fd3cc /oox/source/drawingml
parent7bcbe333b802b4b44630e0b23897ac8e230bc19b (diff)
replace oox::OptValue::use
with emplace and operator* as a step towards converting it to std::optional Change-Id: I3fca397c7dcfe200962e2b81a423322e29787f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136215 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx5
-rw-r--r--oox/source/drawingml/colorchoicecontext.cxx2
-rw-r--r--oox/source/drawingml/shape3dproperties.cxx40
-rw-r--r--oox/source/drawingml/textcharacterpropertiescontext.cxx4
4 files changed, 28 insertions, 23 deletions
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 703d995b18bf..b4e8666ffdb9 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -330,7 +330,10 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat
const auto& rLabelMap = pLabelSource->mxDataSeq->maData;
const auto& rKV = rLabelMap.find(mrModel.mnIndex);
if (rKV != rLabelMap.end())
- rKV->second >>= oaLabelText.use();
+ {
+ oaLabelText.emplace();
+ rKV->second >>= *oaLabelText;
+ }
}
}
diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx
index 8da42f62a419..81e077d58c4c 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -65,7 +65,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_value() )
- mrColor.setSchemeName( sSchemeName.use() );
+ mrColor.setSchemeName( *sSchemeName );
}
break;
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
index 8554320acf0b..3f9ac87158c4 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -210,37 +210,37 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getCameraAt
if( mfFieldOfVision.has_value() )
{
pSeq[nSize].Name = "fov";
- pSeq[nSize].Value <<= mfFieldOfVision.use();
+ pSeq[nSize].Value <<= *mfFieldOfVision;
nSize++;
}
if( mfZoom.has_value() )
{
pSeq[nSize].Name = "zoom";
- pSeq[nSize].Value <<= mfZoom.use();
+ pSeq[nSize].Value <<= *mfZoom;
nSize++;
}
if( mnPreset.has_value() )
{
pSeq[nSize].Name = "prst";
- pSeq[nSize].Value <<= getCameraPrstName( mnPreset.use() );
+ pSeq[nSize].Value <<= getCameraPrstName( *mnPreset );
nSize++;
}
if( maCameraRotation.mnLatitude.has_value() )
{
pSeq[nSize].Name = "rotLat";
- pSeq[nSize].Value <<= maCameraRotation.mnLatitude.use();
+ pSeq[nSize].Value <<= *maCameraRotation.mnLatitude;
nSize++;
}
if( maCameraRotation.mnLongitude.has_value() )
{
pSeq[nSize].Name = "rotLon";
- pSeq[nSize].Value <<= maCameraRotation.mnLongitude.use();
+ pSeq[nSize].Value <<= *maCameraRotation.mnLongitude;
nSize++;
}
if( maCameraRotation.mnRevolution.has_value() )
{
pSeq[nSize].Name = "rotRev";
- pSeq[nSize].Value <<= maCameraRotation.mnRevolution.use();
+ pSeq[nSize].Value <<= *maCameraRotation.mnRevolution;
nSize++;
}
aSeq.realloc( nSize );
@@ -255,31 +255,31 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getLightRig
if( mnLightRigDirection.has_value() )
{
pSeq[nSize].Name = "dir";
- pSeq[nSize].Value <<= getLightRigDirName( mnLightRigDirection.use() );
+ pSeq[nSize].Value <<= getLightRigDirName( *mnLightRigDirection );
nSize++;
}
if( mnLightRigType.has_value() )
{
pSeq[nSize].Name = "rig";
- pSeq[nSize].Value <<= getLightRigName( mnLightRigType.use() );
+ pSeq[nSize].Value <<= getLightRigName( *mnLightRigType );
nSize++;
}
if( maLightRigRotation.mnLatitude.has_value() )
{
pSeq[nSize].Name = "rotLat";
- pSeq[nSize].Value <<= maLightRigRotation.mnLatitude.use();
+ pSeq[nSize].Value <<= *maLightRigRotation.mnLatitude;
nSize++;
}
if( maLightRigRotation.mnLongitude.has_value() )
{
pSeq[nSize].Name = "rotLon";
- pSeq[nSize].Value <<= maLightRigRotation.mnLongitude.use();
+ pSeq[nSize].Value <<= *maLightRigRotation.mnLongitude;
nSize++;
}
if( maLightRigRotation.mnRevolution.has_value() )
{
pSeq[nSize].Name = "rotRev";
- pSeq[nSize].Value <<= maLightRigRotation.mnRevolution.use();
+ pSeq[nSize].Value <<= *maLightRigRotation.mnRevolution;
nSize++;
}
aSeq.realloc( nSize );
@@ -294,19 +294,19 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getBevelAtt
if( rProps.mnPreset.has_value() )
{
pSeq[nSize].Name = "prst";
- pSeq[nSize].Value <<= getBevelPresetTypeString( rProps.mnPreset.use() );
+ pSeq[nSize].Value <<= getBevelPresetTypeString( *rProps.mnPreset );
nSize++;
}
if( rProps.mnWidth.has_value() )
{
pSeq[nSize].Name = "w";
- pSeq[nSize].Value <<= rProps.mnWidth.use();
+ pSeq[nSize].Value <<= *rProps.mnWidth;
nSize++;
}
if( rProps.mnHeight.has_value() )
{
pSeq[nSize].Name = "h";
- pSeq[nSize].Value <<= rProps.mnHeight.use();
+ pSeq[nSize].Value <<= *rProps.mnHeight;
nSize++;
}
aSeq.realloc( nSize );
@@ -338,37 +338,37 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getShape3DA
if( mnExtrusionH.has_value() )
{
pSeq[nSize].Name = "extrusionH";
- pSeq[nSize].Value <<= mnExtrusionH.use();
+ pSeq[nSize].Value <<= *mnExtrusionH;
nSize++;
}
if( mnContourW.has_value() )
{
pSeq[nSize].Name = "contourW";
- pSeq[nSize].Value <<= mnContourW.use();
+ pSeq[nSize].Value <<= *mnContourW;
nSize++;
}
if( mnShapeZ.has_value() )
{
pSeq[nSize].Name = "z";
- pSeq[nSize].Value <<= mnShapeZ.use();
+ pSeq[nSize].Value <<= *mnShapeZ;
nSize++;
}
if( mnMaterial.has_value() )
{
pSeq[nSize].Name = "prstMaterial";
- pSeq[nSize].Value <<= getPresetMaterialTypeString( mnMaterial.use() );
+ pSeq[nSize].Value <<= getPresetMaterialTypeString( *mnMaterial );
nSize++;
}
if( maTopBevelProperties.has_value() )
{
pSeq[nSize].Name = "bevelT";
- pSeq[nSize].Value <<= getBevelAttributes( maTopBevelProperties.use() );
+ pSeq[nSize].Value <<= getBevelAttributes( *maTopBevelProperties );
nSize++;
}
if( maBottomBevelProperties.has_value() )
{
pSeq[nSize].Name = "bevelB";
- pSeq[nSize].Value <<= getBevelAttributes( maBottomBevelProperties.use() );
+ pSeq[nSize].Value <<= getBevelAttributes( *maBottomBevelProperties );
nSize++;
}
if( maExtrusionColor.isUsed() )
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index ffee500486ac..f6aef3c92987 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -115,7 +115,9 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
{
case A_TOKEN(ln): // CT_LineProperties
// TODO still largely unsupported
- return new LinePropertiesContext(*this, rAttribs, mrTextCharacterProperties.moTextOutlineProperties.use());
+ if (!mrTextCharacterProperties.moTextOutlineProperties.has_value())
+ mrTextCharacterProperties.moTextOutlineProperties.emplace();
+ return new LinePropertiesContext(*this, rAttribs, *mrTextCharacterProperties.moTextOutlineProperties);
// EG_FillProperties
case A_TOKEN( noFill ):
case A_TOKEN( solidFill ):