summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-06-24 11:55:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-06-24 20:37:10 +0200
commit79f3abc0e200ffa772bc7722b5f384eb538d7576 (patch)
treef327110ebea5e65a1b5362cd2d55e2c001f8dbc0 /oox
parenta22652b76a5ed1fc130607e8999ed86681b4ed1f (diff)
make oox::OptValue::value() assert if empty
as part of replacing OptValue with std::optional, we need to mimc the behaviour of std::optional::value(), which will throw bad_optional_access Change-Id: Icf5141cefd4623a6a1bb7b3a3449d3af382e01c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136365 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx2
-rw-r--r--oox/source/drawingml/shape.cxx2
-rw-r--r--oox/source/vml/vmlformatting.cxx2
-rw-r--r--oox/source/vml/vmlshape.cxx6
-rw-r--r--oox/source/vml/vmltextbox.cxx4
5 files changed, 9 insertions, 7 deletions
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 383e5bd3fa4b..03e97d3e3339 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -197,7 +197,7 @@ void importBorderProperties( PropertySet& rPropSet, Shape& rShape, const Graphic
{
LineProperties& rLP = rShape.getLineProperties();
// no fill has the same effect as no border so skip it
- if (rLP.maLineFill.moFillType.value() == XML_noFill)
+ if (rLP.maLineFill.moFillType.has_value() && rLP.maLineFill.moFillType.value() == XML_noFill)
return;
if (rLP.moLineWidth.has_value())
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 236e0bea3c82..20564b584f76 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1685,7 +1685,7 @@ Reference< XShape > const & Shape::createAndInsert(
mpCustomShapePropertiesPtr->setMirroredY( true );
if( getTextBody() )
{
- sal_Int32 nTextCameraZRotation = static_cast< sal_Int32 >( getTextBody()->get3DProperties().maCameraRotation.mnRevolution.value() );
+ sal_Int32 nTextCameraZRotation = getTextBody()->get3DProperties().maCameraRotation.mnRevolution.value_or(0);
mpCustomShapePropertiesPtr->setTextCameraZRotateAngle( nTextCameraZRotation / 60000 );
sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.value_or( 0 ) );
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 6d80193e7b37..00a346748531 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -981,7 +981,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen
if (moTrim.has_value() && moTrim.value())
return;
- OUString sText = moString.value();
+ OUString sText = moString.value_or("");
ScopedVclPtrInstance<VirtualDevice> pDevice;
vcl::Font aFont = pDevice->GetFont();
aFont.SetFamilyName(sFont);
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 2cb8261f1af4..22ea45a3bdd3 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -578,7 +578,7 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) :
static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper)
{
- OUString aWrapType = rTypeModel.moWrapType.value();
+ OUString aWrapType = rTypeModel.moWrapType.value_or("");
// Extreme negative top margin? Then the shape will end up at the top of the page, it's pointless to perform any kind of wrapping.
sal_Int32 nMarginTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, rTypeModel.maMarginTop, 0, false, true);
@@ -590,7 +590,9 @@ static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeMo
aWrapType == "through" )
{
nSurround = css::text::WrapTextMode_PARALLEL;
- if ( rTypeModel.moWrapSide.value() == "left" )
+ if ( !rTypeModel.moWrapSide.has_value() )
+ ; // leave as PARALLEL
+ else if ( rTypeModel.moWrapSide.value() == "left" )
nSurround = css::text::WrapTextMode_LEFT;
else if ( rTypeModel.moWrapSide.value() == "right" )
nSurround = css::text::WrapTextMode_RIGHT;
diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx
index cf31236c48ca..e6da71a06d78 100644
--- a/oox/source/vml/vmltextbox.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -93,11 +93,11 @@ void TextBox::convert(const uno::Reference<drawing::XShape>& xShape) const
aPropVec.push_back(aPropertyValue);
aPropertyValue.Name = "CharFontNameAsian";
- aPropertyValue.Value <<= rFont.moNameAsian.value();
+ aPropertyValue.Value <<= rFont.moNameAsian.value_or("");
aPropVec.push_back(aPropertyValue);
aPropertyValue.Name = "CharFontNameComplex";
- aPropertyValue.Value <<= rFont.moNameComplex.value();
+ aPropertyValue.Value <<= rFont.moNameComplex.value_or("");
aPropVec.push_back(aPropertyValue);
}
if (rFont.mobBold.has_value())