include/oox/drawingml/shape.hxx                         |    4 
 include/oox/helper/attributelist.hxx                    |   20 ++--
 include/oox/helper/helper.hxx                           |   32 -------
 include/oox/ppt/pptshape.hxx                            |    3 
 include/oox/vml/vmlformatting.hxx                       |   64 +++++++--------
 include/oox/vml/vmlshape.hxx                            |   26 +++---
 include/oox/vml/vmlshapecontext.hxx                     |    2 
 include/oox/vml/vmltextbox.hxx                          |   26 +++---
 oox/inc/drawingml/chart/axismodel.hxx                   |   14 +--
 oox/inc/drawingml/chart/plotareamodel.hxx               |    6 -
 oox/inc/drawingml/chart/seriesmodel.hxx                 |   34 ++++----
 oox/inc/drawingml/customshapeproperties.hxx             |   16 +--
 oox/inc/drawingml/fillproperties.hxx                    |   48 +++++------
 oox/inc/drawingml/lineproperties.hxx                    |   16 +--
 oox/inc/drawingml/shape3dproperties.hxx                 |   34 ++++----
 oox/inc/drawingml/textbodyproperties.hxx                |    4 
 oox/inc/drawingml/textcharacterproperties.hxx           |   26 +++---
 oox/source/drawingml/chart/axisconverter.cxx            |    4 
 oox/source/drawingml/chart/seriesconverter.cxx          |    4 
 oox/source/drawingml/colorchoicecontext.cxx             |    2 
 oox/source/drawingml/diagram/datamodelcontext.cxx       |    2 
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx     |   16 +--
 oox/source/drawingml/effectproperties.hxx               |   14 +--
 oox/source/drawingml/textbodypropertiescontext.cxx      |    2 
 oox/source/drawingml/textparagraphpropertiescontext.cxx |   14 +--
 oox/source/helper/attributelist.cxx                     |   66 ++++++++--------
 oox/source/ppt/layoutfragmenthandler.cxx                |    2 
 oox/source/ppt/pptshape.cxx                             |    4 
 oox/source/ppt/pptshapecontext.cxx                      |    2 
 oox/source/ppt/slidefragmenthandler.cxx                 |    2 
 oox/source/shape/WpsContext.cxx                         |   12 +-
 oox/source/vml/vmlformatting.cxx                        |   20 ++--
 oox/source/vml/vmlshapecontext.cxx                      |   44 +++++-----
 oox/source/vml/vmltextboxcontext.cxx                    |    4 
 sc/source/filter/inc/autofilterbuffer.hxx               |    2 
 sc/source/filter/oox/autofilterbuffer.cxx               |    2 
 36 files changed, 282 insertions(+), 311 deletions(-)

New commits:
commit 04073c5fedd33654f242fecb7e39afb07cf0e273
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Jun 21 13:17:09 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jun 27 11:32:42 2022 +0200

    replace oox::OptValue with std::optional
    
    Change-Id: I16e7179b2851640b4d73665685dcc1e84042ddaf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136270
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 5f4173c9de87..246a964fc2a6 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -179,7 +179,7 @@ public:
     void                            setSubType( sal_Int32 nSubType ) { 
mnSubType = nSubType; }
     sal_Int32                       getSubType() const { return mnSubType; }
     void                            setSubTypeIndex( sal_Int32 nSubTypeIndex ) 
{ moSubTypeIndex = nSubTypeIndex; }
-    const OptValue< sal_Int32 >&    getSubTypeIndex() const { return 
moSubTypeIndex; }
+    const std::optional< sal_Int32 >& getSubTypeIndex() const { return 
moSubTypeIndex; }
 
     // setDefaults has to be called if styles are imported (OfficeXML is not 
storing properties having the default value)
     void                            setDefaults(bool bHeight);
@@ -353,7 +353,7 @@ protected:
     OUString                    msId;
     OUString                    msDescription;
     sal_Int32                   mnSubType;      // if this type is not zero, 
then the shape is a placeholder
-    OptValue< sal_Int32 >       moSubTypeIndex;
+    std::optional< sal_Int32 >  moSubTypeIndex;
 
     ShapeStyleRefMap            maShapeStyleRefs;
 
diff --git a/include/oox/helper/attributelist.hxx 
b/include/oox/helper/attributelist.hxx
index fb4079714a5c..d58305bffa54 100644
--- a/include/oox/helper/attributelist.hxx
+++ b/include/oox/helper/attributelist.hxx
@@ -95,41 +95,41 @@ public:
     // optional return values -------------------------------------------------
 
     /** Returns the token identifier of the value of the specified attribute. 
*/
-    OptValue< sal_Int32 > getToken( sal_Int32 nAttrToken ) const;
+    std::optional< sal_Int32 > getToken( sal_Int32 nAttrToken ) const;
 
     /** Returns the Color object of highlight of the text. */
     oox::drawingml::Color getHighlightColor(sal_Int32 nAttrToken) const;
 
     /** Returns the string value of the specified attribute. */
-    OptValue< OUString > getString( sal_Int32 nAttrToken ) const;
+    std::optional< OUString > getString( sal_Int32 nAttrToken ) const;
 
     /** Returns the string value of the specified attribute, returns an empty 
string if attribute not present. */
     OUString getStringDefaulted( sal_Int32 nAttrToken ) const;
 
     /** Returns the string value of the specified attribute. All characters in
         the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
-    OptValue< OUString > getXString( sal_Int32 nAttrToken ) const;
+    std::optional< OUString > getXString( sal_Int32 nAttrToken ) const;
 
     /** Returns the double value of the specified attribute. */
-    OptValue< double >  getDouble( sal_Int32 nAttrToken ) const;
+    std::optional< double >  getDouble( sal_Int32 nAttrToken ) const;
 
     /** Returns the 32-bit signed integer value of the specified attribute 
(decimal). */
-    OptValue< sal_Int32 > getInteger( sal_Int32 nAttrToken ) const;
+    std::optional< sal_Int32 > getInteger( sal_Int32 nAttrToken ) const;
 
     /** Returns the 32-bit unsigned integer value of the specified attribute 
(decimal). */
-    OptValue< sal_uInt32 > getUnsigned( sal_Int32 nAttrToken ) const;
+    std::optional< sal_uInt32 > getUnsigned( sal_Int32 nAttrToken ) const;
 
     /** Returns the 64-bit signed integer value of the specified attribute 
(decimal). */
-    OptValue< sal_Int64 > getHyper( sal_Int32 nAttrToken ) const;
+    std::optional< sal_Int64 > getHyper( sal_Int32 nAttrToken ) const;
 
     /** Returns the 32-bit signed integer value of the specified attribute 
(hexadecimal). */
-    OptValue< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const;
+    std::optional< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const;
 
     /** Returns the boolean value of the specified attribute. */
-    OptValue< bool >    getBool( sal_Int32 nAttrToken ) const;
+    std::optional< bool > getBool( sal_Int32 nAttrToken ) const;
 
     /** Returns the date/time value of the specified attribute. */
-    OptValue< css::util::DateTime > getDateTime( sal_Int32 nAttrToken ) const;
+    std::optional< css::util::DateTime > getDateTime( sal_Int32 nAttrToken ) 
const;
 
     // defaulted return values ------------------------------------------------
 
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index ef066f31d338..f9bdd1cec9c2 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -24,6 +24,7 @@
 
 #include <cstring>
 #include <limits>
+#include <optional>
 
 #include <o3tl/safeint.hxx>
 #include <osl/endian.h>
@@ -168,37 +169,8 @@ inline void setFlag( Type& ornBitField, Type nMask, bool 
bSet = true )
 }
 
 
-/** Optional value, similar to ::std::optional<>, with convenience accessors.
- */
-template< typename Type >
-class OptValue
-{
-public:
-                 OptValue() : maValue(), mbHasValue( false ) {}
-    explicit     OptValue( const Type& rValue ) : maValue( rValue ), 
mbHasValue( true ) {}
-
-    bool         has_value() const { return mbHasValue; }
-    bool         operator!() const { return !mbHasValue; }
-
-    const Type&  value() const { assert(mbHasValue); return maValue; }
-    const Type&  value_or( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
-
-    Type&        operator*() { assert(mbHasValue); return maValue; }
-    Type&        emplace() { mbHasValue = true; maValue = Type(); return 
maValue; }
-
-    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 ) );
-                 }
-
-private:
-    Type                maValue;
-    bool                mbHasValue;
-};
-
 template< typename Type >
-void assignIfUsed( OptValue<Type>& rDestValue, const OptValue<Type>& 
rSourceValue )
+void assignIfUsed( std::optional<Type>& rDestValue, const std::optional<Type>& 
rSourceValue )
 {
     if( rSourceValue.has_value() )
         rDestValue = rSourceValue.value();
diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
index ead382b52685..fd5268ea0a89 100644
--- a/include/oox/ppt/pptshape.hxx
+++ b/include/oox/ppt/pptshape.hxx
@@ -39,7 +39,6 @@ namespace com::sun::star {
 namespace oox {
     namespace core { class XmlFilterBase; }
     namespace drawingml { class Theme; }
-    template <typename Type> class OptValue;
 }
 
 namespace oox::ppt {
@@ -83,7 +82,7 @@ public:
     bool hasNonInheritedShapeProperties() const { return 
mbHasNoninheritedShapeProperties; }
 
     static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 
nFirstSubType,
-            const sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& 
oSubTypeIndex,
+            const sal_Int32 nSecondSubType, const std::optional< sal_Int32 >& 
oSubTypeIndex,
             std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly 
= false );
     static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 
nIdx,
             std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly 
= false );
diff --git a/include/oox/vml/vmlformatting.hxx 
b/include/oox/vml/vmlformatting.hxx
index 3f7bbe60a457..f35ab118aec8 100644
--- a/include/oox/vml/vmlformatting.hxx
+++ b/include/oox/vml/vmlformatting.hxx
@@ -166,8 +166,8 @@ OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const 
GraphicHelper& rGraphicHelper,
      */
     OOX_DLLPUBLIC ::oox::drawingml::Color decodeColor(
                             const GraphicHelper& rGraphicHelper,
-                            const OptValue< OUString >& roVmlColor,
-                            const OptValue< double >& roVmlOpacity,
+                            const std::optional< OUString >& roVmlColor,
+                            const std::optional< double >& roVmlOpacity,
                             ::Color nDefaultRgb,
                             ::Color nPrimaryRgb = API_RGB_TRANSPARENT );
 
@@ -193,9 +193,9 @@ OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const 
GraphicHelper& rGraphicHelper,
 /** The stroke arrow model structure contains all properties for a line end 
arrow. */
 struct StrokeArrowModel
 {
-    OptValue< sal_Int32 > moArrowType;
-    OptValue< sal_Int32 > moArrowWidth;
-    OptValue< sal_Int32 > moArrowLength;
+    std::optional< sal_Int32 > moArrowType;
+    std::optional< sal_Int32 > moArrowWidth;
+    std::optional< sal_Int32 > moArrowLength;
 
     void                assignUsed( const StrokeArrowModel& rSource );
 };
@@ -204,16 +204,16 @@ struct StrokeArrowModel
 /** The stroke model structure contains all shape border properties. */
 struct StrokeModel
 {
-    OptValue< bool >    moStroked;              ///< Shape border line on/off.
+    std::optional< bool >    moStroked;              ///< Shape border line 
on/off.
     StrokeArrowModel    maStartArrow;           ///< Start line arrow style.
     StrokeArrowModel    maEndArrow;             ///< End line arrow style.
-    OptValue< OUString > moColor;        ///< Solid line color.
-    OptValue< double > moOpacity;               ///< Solid line color opacity.
-    OptValue< OUString > moWeight;       ///< Line width.
-    OptValue< OUString > moDashStyle;    ///< Line dash (predefined or 
manually).
-    OptValue< sal_Int32 > moLineStyle;          ///< Line style (single, 
double, ...).
-    OptValue< sal_Int32 > moEndCap;             ///< Type of line end cap.
-    OptValue< sal_Int32 > moJoinStyle;          ///< Type of line join.
+    std::optional< OUString > moColor;        ///< Solid line color.
+    std::optional< double > moOpacity;               ///< Solid line color 
opacity.
+    std::optional< OUString > moWeight;       ///< Line width.
+    std::optional< OUString > moDashStyle;    ///< Line dash (predefined or 
manually).
+    std::optional< sal_Int32 > moLineStyle;          ///< Line style (single, 
double, ...).
+    std::optional< sal_Int32 > moEndCap;             ///< Type of line end cap.
+    std::optional< sal_Int32 > moJoinStyle;          ///< Type of line join.
 
     void                assignUsed( const StrokeModel& rSource );
 
@@ -227,18 +227,18 @@ struct StrokeModel
 /** The fill model structure contains all shape fill properties. */
 struct OOX_DLLPUBLIC FillModel
 {
-    OptValue< bool >    moFilled;               ///< Shape fill on/off.
-    OptValue< OUString > moColor;        ///< Solid fill color.
-    OptValue< double >  moOpacity;              ///< Solid fill color opacity.
-    OptValue< OUString > moColor2;       ///< End color of gradient.
-    OptValue< double >  moOpacity2;             ///< End color opacity of 
gradient.
-    OptValue< sal_Int32 > moType;               ///< Fill type.
-    OptValue< sal_Int32 > moAngle;              ///< Gradient rotation angle.
-    OptValue< double >  moFocus;                ///< Linear gradient focus of 
second color.
-    OptValue< DoublePair > moFocusPos;          ///< Rectangular gradient 
focus position of second color.
-    OptValue< DoublePair > moFocusSize;         ///< Rectangular gradient 
focus size of second color.
-    OptValue< OUString > moBitmapPath;   ///< Path to fill bitmap fragment.
-    OptValue< bool >    moRotate;               ///< True = rotate 
gradient/bitmap with shape.
+    std::optional< bool >    moFilled;               ///< Shape fill on/off.
+    std::optional< OUString > moColor;        ///< Solid fill color.
+    std::optional< double >  moOpacity;              ///< Solid fill color 
opacity.
+    std::optional< OUString > moColor2;       ///< End color of gradient.
+    std::optional< double >  moOpacity2;             ///< End color opacity of 
gradient.
+    std::optional< sal_Int32 > moType;               ///< Fill type.
+    std::optional< sal_Int32 > moAngle;              ///< Gradient rotation 
angle.
+    std::optional< double >  moFocus;                ///< Linear gradient 
focus of second color.
+    std::optional< DoublePair > moFocusPos;          ///< Rectangular gradient 
focus position of second color.
+    std::optional< DoublePair > moFocusSize;         ///< Rectangular gradient 
focus size of second color.
+    std::optional< OUString > moBitmapPath;   ///< Path to fill bitmap 
fragment.
+    std::optional< bool >    moRotate;               ///< True = rotate 
gradient/bitmap with shape.
 
     void                assignUsed( const FillModel& rSource );
 
@@ -253,10 +253,10 @@ struct OOX_DLLPUBLIC FillModel
 struct OOX_DLLPUBLIC ShadowModel
 {
     bool               mbHasShadow;               ///< Is a v:shadow element 
seen?
-    OptValue<bool>     moShadowOn;                ///< Is the element turned 
on?
-    OptValue<OUString> moColor;                   ///< Specifies the color of 
the shadow.
-    OptValue<OUString> moOffset;                  ///< Specifies the shadow's 
offset from the shape's location.
-    OptValue<double>   moOpacity;                 ///< Specifies the opacity 
of the shadow.
+    std::optional<bool>     moShadowOn;                ///< Is the element 
turned on?
+    std::optional<OUString> moColor;                   ///< Specifies the 
color of the shadow.
+    std::optional<OUString> moOffset;                  ///< Specifies the 
shadow's offset from the shape's location.
+    std::optional<double>   moOpacity;                 ///< Specifies the 
opacity of the shadow.
 
     ShadowModel();
 
@@ -267,9 +267,9 @@ struct OOX_DLLPUBLIC ShadowModel
 /** The shadow model structure contains all shape textpath properties. */
 struct TextpathModel
 {
-    OptValue<OUString> moString;                  ///< Specifies the string of 
the textpath.
-    OptValue<OUString> moStyle;                   ///< Specifies the style of 
the textpath.
-    OptValue<bool>     moTrim;                    ///< Specifies whether extra 
space is removed above and below the text
+    std::optional<OUString> moString;                  ///< Specifies the 
string of the textpath.
+    std::optional<OUString> moStyle;                   ///< Specifies the 
style of the textpath.
+    std::optional<bool>     moTrim;                    ///< Specifies whether 
extra space is removed above and below the text
 
     TextpathModel();
 
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 7a17bda51ccd..36a9511a2632 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -62,10 +62,10 @@ struct ShapeTypeModel
     OUString     maShapeId;              ///< Unique identifier of the shape.
     OUString     maLegacyId;             ///< Plaintext identifier of the 
shape.
     OUString     maShapeName;            ///< Name of the shape, if present.
-    OptValue< sal_Int32 > moShapeType;          ///< Builtin shape type 
identifier.
+    std::optional< sal_Int32 > moShapeType;          ///< Builtin shape type 
identifier.
 
-    OptValue< Int32Pair > moCoordPos;           ///< Top-left position of 
coordinate system for children scaling.
-    OptValue< Int32Pair > moCoordSize;          ///< Size of coordinate system 
for children scaling.
+    std::optional< Int32Pair > moCoordPos;           ///< Top-left position of 
coordinate system for children scaling.
+    std::optional< Int32Pair > moCoordSize;          ///< Size of coordinate 
system for children scaling.
     OUString     maPosition;             ///< Position type of the shape.
     OUString     maZIndex;                ///< ZIndex of the shape
     OUString     maLeft;                 ///< X position of the shape bounding 
box (number with unit).
@@ -96,21 +96,21 @@ struct ShapeTypeModel
     ShadowModel         maShadowModel;          ///< Shape shadow formatting.
     TextpathModel       maTextpathModel;        ///< Shape textpath formatting.
 
-    OptValue< OUString > moGraphicPath;  ///< Path to a graphic for this shape.
-    OptValue< OUString > moGraphicTitle; ///< Title of the graphic.
-    OptValue< OUString > moWrapAnchorX;  ///< The base object from which our 
horizontal positioning should be calculated.
-    OptValue< OUString > moWrapAnchorY;  ///< The base object from which our 
vertical positioning should be calculated.
-    OptValue< OUString > moWrapType;     ///< How to wrap the text around the 
object
-    OptValue< OUString > moWrapSide;     ///< On which side to wrap the text 
around the object
+    std::optional< OUString > moGraphicPath;  ///< Path to a graphic for this 
shape.
+    std::optional< OUString > moGraphicTitle; ///< Title of the graphic.
+    std::optional< OUString > moWrapAnchorX;  ///< The base object from which 
our horizontal positioning should be calculated.
+    std::optional< OUString > moWrapAnchorY;  ///< The base object from which 
our vertical positioning should be calculated.
+    std::optional< OUString > moWrapType;     ///< How to wrap the text around 
the object
+    std::optional< OUString > moWrapSide;     ///< On which side to wrap the 
text around the object
     OUString maVTextAnchor; ///< How the text inside the shape is anchored 
vertically.
     OUString maWrapDistanceLeft;         ///< Distance from the left side of 
the shape to the text that wraps around it.
     OUString maWrapDistanceRight;        ///< Distance from the right side of 
the shape to the text that wraps around it.
     OUString maWrapDistanceTop;          ///< Distance from the top of the 
shape to the text that wraps around it.
     OUString maWrapDistanceBottom;       ///< Distance from the bottom of the 
shape to the text that wraps around it.
-    OptValue<OUString> moCropBottom; ///< Specifies the how much to crop the 
image from the bottom up as a fraction of picture size.
-    OptValue<OUString> moCropLeft; ///< Specifies how much to crop the image 
from the left in as a fraction of picture size.
-    OptValue<OUString> moCropRight; ///< Specifies how much to crop the image 
from the right in as a fraction of picture size.
-    OptValue<OUString> moCropTop; ///< Specifies how much to crop the image 
from the top down as a fraction of picture size.
+    std::optional<OUString> moCropBottom; ///< Specifies the how much to crop 
the image from the bottom up as a fraction of picture size.
+    std::optional<OUString> moCropLeft; ///< Specifies how much to crop the 
image from the left in as a fraction of picture size.
+    std::optional<OUString> moCropRight; ///< Specifies how much to crop the 
image from the right in as a fraction of picture size.
+    std::optional<OUString> moCropTop; ///< Specifies how much to crop the 
image from the top down as a fraction of picture size.
     OUString maLayoutFlowAlt; ///< Specifies the alternate layout flow for 
text in textboxes.
 
     /// An adjustment for the intensity of all colors, i.e. contrast, on a 
0..0x10000 scale.
diff --git a/include/oox/vml/vmlshapecontext.hxx 
b/include/oox/vml/vmlshapecontext.hxx
index ce838297cdf0..61e189fc009f 100644
--- a/include/oox/vml/vmlshapecontext.hxx
+++ b/include/oox/vml/vmlshapecontext.hxx
@@ -109,7 +109,7 @@ private:
     void                setStyle( std::u16string_view rStyle );
 
     /** Resolve a relation identifier to a fragment path. */
-    OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, 
sal_Int32 nToken ) const;
+    std::optional< OUString > decodeFragmentPath( const AttributeList& 
rAttribs, sal_Int32 nToken ) const;
 
 private:
     std::shared_ptr<ShapeType> m_pShapeType;
diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx
index fb6983315b61..f3c4bf4f2fd6 100644
--- a/include/oox/vml/vmltextbox.hxx
+++ b/include/oox/vml/vmltextbox.hxx
@@ -41,24 +41,24 @@ struct ShapeTypeModel;
 /// A text paragraph in a textbox.
 struct TextParagraphModel
 {
-    OptValue<OUString> moParaAdjust; ///< Paragraph adjust (left, center, 
right, etc.)
-    OptValue<OUString> moParaStyleName;
+    std::optional<OUString> moParaAdjust; ///< Paragraph adjust (left, center, 
right, etc.)
+    std::optional<OUString> moParaStyleName;
 };
 
 /** Font settings for a text portion in a textbox. */
 struct OOX_DLLPUBLIC TextFontModel
 {
-    OptValue< OUString > moName;     ///< Font name.
-    OptValue< OUString > moNameAsian; ///< Asian font name.
-    OptValue< OUString > moNameComplex; ///< Complex font name.
-    OptValue< OUString > moColor;    ///< Font color, HTML encoded, sort of.
-    OptValue< sal_Int32 > monSize;          ///< Font size in twips.
-    OptValue< sal_Int32 > monUnderline;     ///< Single or double underline.
-    OptValue< sal_Int32 > monEscapement;    ///< Subscript or superscript.
-    OptValue< bool >    mobBold;
-    OptValue< bool >    mobItalic;
-    OptValue< bool >    mobStrikeout;
-    OptValue<sal_Int32> monSpacing;
+    std::optional< OUString > moName;     ///< Font name.
+    std::optional< OUString > moNameAsian; ///< Asian font name.
+    std::optional< OUString > moNameComplex; ///< Complex font name.
+    std::optional< OUString > moColor;    ///< Font color, HTML encoded, sort 
of.
+    std::optional< sal_Int32 > monSize;          ///< Font size in twips.
+    std::optional< sal_Int32 > monUnderline;     ///< Single or double 
underline.
+    std::optional< sal_Int32 > monEscapement;    ///< Subscript or superscript.
+    std::optional< bool >    mobBold;
+    std::optional< bool >    mobItalic;
+    std::optional< bool >    mobStrikeout;
+    std::optional<sal_Int32> monSpacing;
 
     explicit            TextFontModel();
 };
diff --git a/oox/inc/drawingml/chart/axismodel.hxx 
b/oox/inc/drawingml/chart/axismodel.hxx
index 6ecd411e1ed1..0c1799276083 100644
--- a/oox/inc/drawingml/chart/axismodel.hxx
+++ b/oox/inc/drawingml/chart/axismodel.hxx
@@ -57,13 +57,13 @@ struct AxisModel
     ShapeRef            mxMajorGridLines;   /// Major grid lines formatting.
     ShapeRef            mxMinorGridLines;   /// Minor grid lines formatting.
     NumberFormat        maNumberFormat;     /// Number format for axis tick 
labels.
-    OptValue< double >  mofCrossesAt;       /// Position on this axis where 
another axis crosses.
-    OptValue< double >  mofMajorUnit;       /// Unit for major tick marks on 
date/value axis.
-    OptValue< double >  mofMinorUnit;       /// Unit for minor tick marks on 
date/value axis.
-    OptValue< double >  mofLogBase;         /// Logarithmic base for 
logarithmic axes.
-    OptValue< double >  mofMax;             /// Maximum axis value.
-    OptValue< double >  mofMin;             /// Minimum axis value.
-    OptValue< sal_Int32 > monBaseTimeUnit;  /// Base time unit shown on a date 
axis.
+    std::optional< double >  mofCrossesAt;       /// Position on this axis 
where another axis crosses.
+    std::optional< double >  mofMajorUnit;       /// Unit for major tick marks 
on date/value axis.
+    std::optional< double >  mofMinorUnit;       /// Unit for minor tick marks 
on date/value axis.
+    std::optional< double >  mofLogBase;         /// Logarithmic base for 
logarithmic axes.
+    std::optional< double >  mofMax;             /// Maximum axis value.
+    std::optional< double >  mofMin;             /// Minimum axis value.
+    std::optional< sal_Int32 > monBaseTimeUnit;  /// Base time unit shown on a 
date axis.
     sal_Int32           mnAxisId;           /// Unique axis identifier.
     sal_Int32           mnAxisPos;          /// Position of the axis 
(top/bottom/left/right).
     sal_Int32           mnCrossAxisId;      /// Identifier of a crossing axis.
diff --git a/oox/inc/drawingml/chart/plotareamodel.hxx 
b/oox/inc/drawingml/chart/plotareamodel.hxx
index 11990095378f..c635f99b4fe6 100644
--- a/oox/inc/drawingml/chart/plotareamodel.hxx
+++ b/oox/inc/drawingml/chart/plotareamodel.hxx
@@ -30,9 +30,9 @@ namespace oox::drawingml::chart {
 
 struct View3DModel
 {
-    OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, 
relative to chart width.
-    OptValue< sal_Int32 > monRotationX;     /// Horizontal rotation in degrees.
-    OptValue< sal_Int32 > monRotationY;     /// Vertical rotation in degrees.
+    std::optional< sal_Int32 > monHeightPercent; /// Height of the 3D view, 
relative to chart width.
+    std::optional< sal_Int32 > monRotationX;     /// Horizontal rotation in 
degrees.
+    std::optional< sal_Int32 > monRotationY;     /// Vertical rotation in 
degrees.
     sal_Int32           mnDepthPercent;     /// Depth of the 3D view, relative 
to chart width.
     sal_Int32           mnPerspective;      /// Eye distance to the 3D objects.
     bool                mbRightAngled;      /// True = right-angled axes in 3D 
view.
diff --git a/oox/inc/drawingml/chart/seriesmodel.hxx 
b/oox/inc/drawingml/chart/seriesmodel.hxx
index 34656a6daf4a..4f48115676f0 100644
--- a/oox/inc/drawingml/chart/seriesmodel.hxx
+++ b/oox/inc/drawingml/chart/seriesmodel.hxx
@@ -33,18 +33,18 @@ struct DataLabelModelBase
     ShapeRef            mxShapeProp;        /// Data label frame formatting.
     TextBodyRef         mxTextProp;         /// Data label text formatting.
     NumberFormat        maNumberFormat;     /// Number format for numeric data 
labels.
-    OptValue< OUString > moaSeparator;/// Separator between label components.
-    OptValue< sal_Int32 > monLabelPos;      /// Data label position.
-    OptValue< bool >    mobShowBubbleSize;  /// True = show size of bubbles in 
bubble charts.
-    OptValue< bool >    mobShowCatName;     /// True = show category name of 
data points.
-    OptValue< bool >    mobShowLegendKey;   /// True = show legend key of data 
series.
-    OptValue< bool >    mobShowPercent;     /// True = show percentual value 
in pie/doughnut charts.
-    OptValue< bool >    mobShowSerName;     /// True = show series name.
-    OptValue< bool >    mobShowVal;         /// True = show data point value.
+    std::optional< OUString > moaSeparator;/// Separator between label 
components.
+    std::optional< sal_Int32 > monLabelPos;      /// Data label position.
+    std::optional< bool >    mobShowBubbleSize;  /// True = show size of 
bubbles in bubble charts.
+    std::optional< bool >    mobShowCatName;     /// True = show category name 
of data points.
+    std::optional< bool >    mobShowLegendKey;   /// True = show legend key of 
data series.
+    std::optional< bool >    mobShowPercent;     /// True = show percentual 
value in pie/doughnut charts.
+    std::optional< bool >    mobShowSerName;     /// True = show series name.
+    std::optional< bool >    mobShowVal;         /// True = show data point 
value.
 
     /// True = the value from the <c15:datalabelsRange> corresponding to the
     /// index of this label is used as the label text.
-    OptValue< bool >    mobShowDataLabelsRange;
+    std::optional< bool >    mobShowDataLabelsRange;
     bool                mbDeleted;          /// True = data label(s) deleted.
 
     explicit            DataLabelModelBase(bool bMSO2007Doc);
@@ -142,9 +142,9 @@ struct TrendlineModel
     ShapeRef            mxShapeProp;        /// Trendline formatting.
     TrendlineLabelRef   mxLabel;            /// Trendline label text object.
     OUString            maName;             /// User-defined name of the 
trendline.
-    OptValue< double >  mfBackward;         /// Size of trendline before first 
data point.
-    OptValue< double >  mfForward;          /// Size of trendline behind last 
data point.
-    OptValue< double >  mfIntercept;        /// Crossing point with Y axis.
+    std::optional< double > mfBackward;         /// Size of trendline before 
first data point.
+    std::optional< double > mfForward;          /// Size of trendline behind 
last data point.
+    std::optional< double > mfIntercept;        /// Crossing point with Y axis.
     sal_Int32           mnOrder;            /// Polynomial order in range [2, 
6].
     sal_Int32           mnPeriod;           /// Moving average period in range 
[2, 255].
     sal_Int32           mnTypeId;           /// Type of the trendline.
@@ -163,10 +163,10 @@ struct DataPointModel
     ShapeRef            mxShapeProp;        /// Data point formatting.
     PictureOptionsRef   mxPicOptions;       /// Fill bitmap settings.
     ShapeRef            mxMarkerProp;       /// Data point marker formatting.
-    OptValue< sal_Int32 > monExplosion;     /// Pie slice moved from pie 
center.
-    OptValue< sal_Int32 > monMarkerSize;    /// Size of the series line marker 
(2...72).
-    OptValue< sal_Int32 > monMarkerSymbol;  /// Series line marker symbol.
-    OptValue< bool >    mobBubble3d;        /// True = show bubbles with 3D 
shade.
+    std::optional< sal_Int32 > monExplosion;     /// Pie slice moved from pie 
center.
+    std::optional< sal_Int32 > monMarkerSize;    /// Size of the series line 
marker (2...72).
+    std::optional< sal_Int32 > monMarkerSymbol;  /// Series line marker symbol.
+    std::optional< bool >    mobBubble3d;        /// True = show bubbles with 
3D shade.
     sal_Int32           mnIndex;            /// Unique data point index.
     bool                mbInvertNeg;        /// True = invert negative data 
points (not derived from series!).
 
@@ -202,7 +202,7 @@ struct SeriesModel
     ShapeRef            mxMarkerProp;       /// Data point marker formatting.
     TextRef             mxText;             /// Series title source.
     DataLabelsRef       mxLabels;           /// Data point label settings for 
all points.
-    OptValue< sal_Int32 > monShape;         /// 3D bar shape type.
+    std::optional< sal_Int32 > monShape;         /// 3D bar shape type.
     sal_Int32           mnExplosion;        /// Pie slice moved from pie 
center.
     sal_Int32           mnIndex;            /// Series index used for 
automatic formatting.
     sal_Int32           mnMarkerSize;       /// Size of the series line marker 
(2...72).
diff --git a/oox/inc/drawingml/customshapeproperties.hxx 
b/oox/inc/drawingml/customshapeproperties.hxx
index ea9b9e9d53af..74369c5286d6 100644
--- a/oox/inc/drawingml/customshapeproperties.hxx
+++ b/oox/inc/drawingml/customshapeproperties.hxx
@@ -49,15 +49,15 @@ struct AdjustHandle
                                             pos;
 
     // depending to the type (polar or not):
-    OptValue< OUString >               gdRef1; // gdRefX   or gdRefR
-    OptValue< css::drawing::EnhancedCustomShapeParameter >
+    std::optional< OUString >               gdRef1; // gdRefX   or gdRefR
+    std::optional< css::drawing::EnhancedCustomShapeParameter >
                                             min1;   // minX     or minR
-    OptValue< css::drawing::EnhancedCustomShapeParameter >
+    std::optional< css::drawing::EnhancedCustomShapeParameter >
                                             max1;   // maxX     or maxR
-    OptValue< OUString >               gdRef2; // gdRefY   or gdRefAng
-    OptValue< css::drawing::EnhancedCustomShapeParameter >
+    std::optional< OUString >               gdRef2; // gdRefY   or gdRefAng
+    std::optional< css::drawing::EnhancedCustomShapeParameter >
                                             min2;   // minX     or minAng
-    OptValue< css::drawing::EnhancedCustomShapeParameter >
+    std::optional< css::drawing::EnhancedCustomShapeParameter >
                                             max2;   // maxY     or maxAng
 
     AdjustHandle( bool bPolar ) : polar( bPolar ) {};
@@ -110,7 +110,7 @@ public:
     std::vector< CustomShapeGuide >&    getGuideList(){ return maGuideList; };
     std::vector< AdjustHandle >&        getAdjustHandleList(){ return 
maAdjustHandleList; };
     std::vector< ConnectionSite >&      getConnectionSiteList(){ return 
maConnectionSiteList; };
-    OptValue< GeomRect >&               getTextRect(){ return maTextRect; };
+    std::optional< GeomRect >&          getTextRect(){ return maTextRect; };
     std::vector< Path2D >&              getPath2DList(){ return maPath2DList; 
};
     std::vector< css::drawing::EnhancedCustomShapeSegment >& getSegments(){ 
return maSegments; };
     void                                setMirroredX( bool bMirroredX ) { 
mbMirroredX = bMirroredX; };
@@ -137,7 +137,7 @@ private:
     std::vector< CustomShapeGuide > maGuideList;
     std::vector< AdjustHandle >     maAdjustHandleList;
     std::vector< ConnectionSite >   maConnectionSiteList;
-    OptValue< GeomRect >            maTextRect;
+    std::optional< GeomRect >       maTextRect;
     std::vector< Path2D >           maPath2DList;
 
     std::vector< css::drawing::EnhancedCustomShapeSegment >
diff --git a/oox/inc/drawingml/fillproperties.hxx 
b/oox/inc/drawingml/fillproperties.hxx
index b4f3d00fabc6..9cef3c98f2b1 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -49,13 +49,13 @@ struct GradientFillProperties
     typedef ::std::multimap< double, Color > GradientStopMap;
 
     GradientStopMap     maGradientStops;        /// Gradient stops 
(colors/transparence).
-    OptValue< css::geometry::IntegerRectangle2D > moFillToRect;
-    OptValue< css::geometry::IntegerRectangle2D > moTileRect;
-    OptValue< sal_Int32 > moGradientPath;       /// If set, gradient follows 
rectangle, circle, or shape.
-    OptValue< sal_Int32 > moShadeAngle;         /// Rotation angle of linear 
gradients.
-    OptValue< sal_Int32 > moShadeFlip;          /// Flip mode of gradient, if 
not stretched to shape.
-    OptValue< bool >    moShadeScaled;          /// True = scale gradient into 
shape.
-    OptValue< bool >    moRotateWithShape;      /// True = rotate gradient 
with shape.
+    std::optional< css::geometry::IntegerRectangle2D > moFillToRect;
+    std::optional< css::geometry::IntegerRectangle2D > moTileRect;
+    std::optional< sal_Int32 > moGradientPath;       /// If set, gradient 
follows rectangle, circle, or shape.
+    std::optional< sal_Int32 > moShadeAngle;         /// Rotation angle of 
linear gradients.
+    std::optional< sal_Int32 > moShadeFlip;          /// Flip mode of 
gradient, if not stretched to shape.
+    std::optional< bool >    moShadeScaled;          /// True = scale gradient 
into shape.
+    std::optional< bool >    moRotateWithShape;      /// True = rotate 
gradient with shape.
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const GradientFillProperties& rSourceProps 
);
@@ -65,7 +65,7 @@ struct PatternFillProperties
 {
     Color               maPattFgColor;          /// Pattern foreground color.
     Color               maPattBgColor;          /// Pattern background color.
-    OptValue< sal_Int32 > moPattPreset;         /// Preset pattern type.
+    std::optional< sal_Int32 > moPattPreset;         /// Preset pattern type.
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const PatternFillProperties& rSourceProps 
);
@@ -97,28 +97,28 @@ struct ArtisticEffectProperties
 struct BlipFillProperties
 {
     css::uno::Reference<css::graphic::XGraphic> mxFillGraphic; /// The fill 
graphic.
-    OptValue< sal_Int32 > moBitmapMode;         /// Bitmap tile or stretch.
-    OptValue< css::geometry::IntegerRectangle2D >
+    std::optional< sal_Int32 > moBitmapMode;         /// Bitmap tile or 
stretch.
+    std::optional< css::geometry::IntegerRectangle2D >
                           moFillRect;             /// Stretch fill offsets.
-    OptValue< css::geometry::IntegerRectangle2D >
+    std::optional< css::geometry::IntegerRectangle2D >
                           moClipRect;
-    OptValue< sal_Int32 > moTileOffsetX;        /// Width of bitmap tiles 
(EMUs).
-    OptValue< sal_Int32 > moTileOffsetY;        /// Height of bitmap tiles 
(EMUs).
-    OptValue< sal_Int32 > moTileScaleX;         /// Horizontal scaling of 
bitmap tiles (1/1000 percent).
-    OptValue< sal_Int32 > moTileScaleY;         /// Vertical scaling of bitmap 
tiles (1/1000 percent).
-    OptValue< sal_Int32 > moTileAlign;          /// Anchor point inside bitmap.
-    OptValue< sal_Int32 > moTileFlip;           /// Flip mode of bitmap tiles.
-    OptValue< bool >      moRotateWithShape;      /// True = rotate bitmap 
with shape.
+    std::optional< sal_Int32 > moTileOffsetX;        /// Width of bitmap tiles 
(EMUs).
+    std::optional< sal_Int32 > moTileOffsetY;        /// Height of bitmap 
tiles (EMUs).
+    std::optional< sal_Int32 > moTileScaleX;         /// Horizontal scaling of 
bitmap tiles (1/1000 percent).
+    std::optional< sal_Int32 > moTileScaleY;         /// Vertical scaling of 
bitmap tiles (1/1000 percent).
+    std::optional< sal_Int32 > moTileAlign;          /// Anchor point inside 
bitmap.
+    std::optional< sal_Int32 > moTileFlip;           /// Flip mode of bitmap 
tiles.
+    std::optional< bool >      moRotateWithShape;      /// True = rotate 
bitmap with shape.
     // effects
-    OptValue< sal_Int32 > moColorEffect;        /// XML token for a color 
effect.
-    OptValue< sal_Int32 > moBrightness;         /// Brightness in the range 
[-100000,100000].
-    OptValue< sal_Int32 > moContrast;           /// Contrast in the range 
[-100000,100000].
+    std::optional< sal_Int32 > moColorEffect;        /// XML token for a color 
effect.
+    std::optional< sal_Int32 > moBrightness;         /// Brightness in the 
range [-100000,100000].
+    std::optional< sal_Int32 > moContrast;           /// Contrast in the range 
[-100000,100000].
     Color                 maColorChangeFrom;      /// Start color of color 
transformation.
     Color                 maColorChangeTo;        /// Destination color of 
color transformation.
     Color                 maDuotoneColors[2];     /// Duotone Colors
 
     ArtisticEffectProperties maEffect;          /// Artistic effect, not 
supported by core.
-    OptValue<sal_Int32> moAlphaModFix; ///< Alpha Modulate Fixed Effect.
+    std::optional<sal_Int32> moAlphaModFix; ///< Alpha Modulate Fixed Effect.
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const BlipFillProperties& rSourceProps );
@@ -126,9 +126,9 @@ struct BlipFillProperties
 
 struct FillProperties
 {
-    OptValue< sal_Int32 > moFillType;           /// Fill type (OOXML token).
+    std::optional< sal_Int32 > moFillType;           /// Fill type (OOXML 
token).
     Color               maFillColor;            /// Solid fill color and 
transparence.
-    OptValue< bool > moUseBgFill;               /// Whether the background is 
used as fill type
+    std::optional< bool > moUseBgFill;               /// Whether the 
background is used as fill type
     GradientFillProperties maGradientProps;     /// Properties for gradient 
fills.
     PatternFillProperties maPatternProps;       /// Properties for pattern 
fills.
     BlipFillProperties  maBlipProps;            /// Properties for bitmap 
fills.
diff --git a/oox/inc/drawingml/lineproperties.hxx 
b/oox/inc/drawingml/lineproperties.hxx
index 214aadba12e9..f2d37a7f8a9f 100644
--- a/oox/inc/drawingml/lineproperties.hxx
+++ b/oox/inc/drawingml/lineproperties.hxx
@@ -39,9 +39,9 @@ class ShapePropertyMap;
 
 struct LineArrowProperties
 {
-    OptValue< sal_Int32 > moArrowType;
-    OptValue< sal_Int32 > moArrowWidth;
-    OptValue< sal_Int32 > moArrowLength;
+    std::optional< sal_Int32 > moArrowType;
+    std::optional< sal_Int32 > moArrowWidth;
+    std::optional< sal_Int32 > moArrowLength;
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const LineArrowProperties& rSourceProps );
@@ -56,11 +56,11 @@ struct LineProperties
     LineArrowProperties maEndArrow;         /// End line arrow style.
     FillProperties      maLineFill;         /// Line fill (solid, gradient, 
...).
     DashStopVector      maCustomDash;       /// User-defined line dash style.
-    OptValue< sal_Int32 > moLineWidth;      /// Line width (EMUs).
-    OptValue< sal_Int32 > moPresetDash;     /// Preset dash (OOXML token).
-    OptValue< sal_Int32 > moLineCompound;   /// Line compound type (OOXML 
token).
-    OptValue< sal_Int32 > moLineCap;        /// Line cap (OOXML token).
-    OptValue< sal_Int32 > moLineJoint;      /// Line joint type (OOXML token).
+    std::optional< sal_Int32 > moLineWidth;      /// Line width (EMUs).
+    std::optional< sal_Int32 > moPresetDash;     /// Preset dash (OOXML token).
+    std::optional< sal_Int32 > moLineCompound;   /// Line compound type (OOXML 
token).
+    std::optional< sal_Int32 > moLineCap;        /// Line cap (OOXML token).
+    std::optional< sal_Int32 > moLineJoint;      /// Line joint type (OOXML 
token).
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const LineProperties& rSourceProps );
diff --git a/oox/inc/drawingml/shape3dproperties.hxx 
b/oox/inc/drawingml/shape3dproperties.hxx
index c43e643aae5c..80bc01271ece 100644
--- a/oox/inc/drawingml/shape3dproperties.hxx
+++ b/oox/inc/drawingml/shape3dproperties.hxx
@@ -32,37 +32,37 @@ namespace oox::drawingml {
 
 struct RotationProperties
 {
-    OptValue< sal_Int32 > mnLatitude;
-    OptValue< sal_Int32 > mnLongitude;
-    OptValue< sal_Int32 > mnRevolution;
+    std::optional< sal_Int32 > mnLatitude;
+    std::optional< sal_Int32 > mnLongitude;
+    std::optional< sal_Int32 > mnRevolution;
 };
 
 struct BevelProperties
 {
-    OptValue< sal_Int32 > mnPreset;
-    OptValue< sal_Int32 > mnWidth;
-    OptValue< sal_Int32 > mnHeight;
+    std::optional< sal_Int32 > mnPreset;
+    std::optional< sal_Int32 > mnWidth;
+    std::optional< sal_Int32 > mnHeight;
 };
 
 struct Generic3DProperties
 {
-    OptValue< sal_Int32 > mnPreset;
-    OptValue< float > mfFieldOfVision;
-    OptValue< float > mfZoom;
-    OptValue< sal_Int32 > mnLightRigDirection;
-    OptValue< sal_Int32 > mnLightRigType;
+    std::optional< sal_Int32 > mnPreset;
+    std::optional< float > mfFieldOfVision;
+    std::optional< float > mfZoom;
+    std::optional< sal_Int32 > mnLightRigDirection;
+    std::optional< sal_Int32 > mnLightRigType;
     RotationProperties maCameraRotation;
     RotationProperties maLightRigRotation;
 
-    OptValue< sal_Int32 > mnExtrusionH;
-    OptValue< sal_Int32 > mnContourW;
-    OptValue< sal_Int32 > mnShapeZ;
-    OptValue< sal_Int32 > mnMaterial;
+    std::optional< sal_Int32 > mnExtrusionH;
+    std::optional< sal_Int32 > mnContourW;
+    std::optional< sal_Int32 > mnShapeZ;
+    std::optional< sal_Int32 > mnMaterial;
     Color maExtrusionColor;
     Color maContourColor;
 
-    OptValue< BevelProperties > maTopBevelProperties;
-    OptValue< BevelProperties > maBottomBevelProperties;
+    std::optional< BevelProperties > maTopBevelProperties;
+    std::optional< BevelProperties > maBottomBevelProperties;
 
     static OUString     getCameraPrstName( sal_Int32 nElement );
     static OUString     getLightRigName( sal_Int32 nElement );
diff --git a/oox/inc/drawingml/textbodyproperties.hxx 
b/oox/inc/drawingml/textbodyproperties.hxx
index 7cc1b9d8041c..8d115848f6ec 100644
--- a/oox/inc/drawingml/textbodyproperties.hxx
+++ b/oox/inc/drawingml/textbodyproperties.hxx
@@ -34,9 +34,9 @@ namespace oox::drawingml {
 struct TextBodyProperties
 {
     PropertyMap                                     maPropertyMap;
-    OptValue< sal_Int32 >                           moRotation;
+    std::optional< sal_Int32 >                      moRotation;
     bool                                            mbAnchorCtr;
-    OptValue< sal_Int32 >                           moVert;
+    std::optional< sal_Int32 >                      moVert;
     bool                                            moUpright = false;
     std::array<std::optional<sal_Int32>, 4> moInsets;
     std::optional< sal_Int32 >                    moTextOffUpper;
diff --git a/oox/inc/drawingml/textcharacterproperties.hxx 
b/oox/inc/drawingml/textcharacterproperties.hxx
index 49d4125698a4..40842585d10a 100644
--- a/oox/inc/drawingml/textcharacterproperties.hxx
+++ b/oox/inc/drawingml/textcharacterproperties.hxx
@@ -45,20 +45,20 @@ struct TextCharacterProperties
     TextFont            maSymbolFont;
     Color               maUnderlineColor;
     Color               maHighlightColor;
-    OptValue< OUString > moLang;
-    OptValue< sal_Int32 > moHeight;
+    std::optional< OUString > moLang;
+    std::optional< sal_Int32 > moHeight;
     /// If a font scale has to be applied manually to moHeight.
-    OptValue< double > moFontScale;
-    OptValue< sal_Int32 > moSpacing;
-    OptValue< sal_Int32 > moUnderline;
-    OptValue< sal_Int32 > moBaseline;
-    OptValue< sal_Int32 > moStrikeout;
-    OptValue< sal_Int32 > moCaseMap;
-    OptValue< bool >    moBold;
-    OptValue< bool >    moItalic;
-    OptValue< bool >    moUnderlineLineFollowText;
-    OptValue< bool >    moUnderlineFillFollowText;
-    OptValue<LineProperties> moTextOutlineProperties;
+    std::optional< double > moFontScale;
+    std::optional< sal_Int32 > moSpacing;
+    std::optional< sal_Int32 > moUnderline;
+    std::optional< sal_Int32 > moBaseline;
+    std::optional< sal_Int32 > moStrikeout;
+    std::optional< sal_Int32 > moCaseMap;
+    std::optional< bool >    moBold;
+    std::optional< bool >    moItalic;
+    std::optional< bool >    moUnderlineLineFollowText;
+    std::optional< bool >    moUnderlineFillFollowText;
+    std::optional<LineProperties> moTextOutlineProperties;
 
     FillProperties      maFillProperties;
     /// Set if there was a property set that alters run visually during import
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index 8d6ba3fab509..ba22dc5e028e 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -53,7 +53,7 @@ using namespace ::com::sun::star::uno;
 
 namespace {
 
-void lclSetValueOrClearAny( Any& orAny, const OptValue< double >& rofValue )
+void lclSetValueOrClearAny( Any& orAny, const std::optional< double >& 
rofValue )
 {
     if( rofValue.has_value() ) orAny <<= rofValue.value(); else orAny.clear();
 }
@@ -76,7 +76,7 @@ sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit )
     return TimeUnit::DAY;
 }
 
-void lclConvertTimeInterval( Any& orInterval, const OptValue< double >& 
rofUnit, sal_Int32 nTimeUnit )
+void lclConvertTimeInterval( Any& orInterval, const std::optional< double >& 
rofUnit, sal_Int32 nTimeUnit )
 {
     if( rofUnit.has_value() && (1.0 <= rofUnit.value()) && (rofUnit.value() <= 
SAL_MAX_INT32) )
         orInterval <<= css::chart::TimeInterval( static_cast< sal_Int32 >( 
rofUnit.value() ), lclGetApiTimeUnit( nTimeUnit ) );
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 03e97d3e3339..1e00618ae411 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -319,8 +319,8 @@ void DataLabelConverter::convertFromModel( const Reference< 
XDataSeries >& rxDat
             if( nParagraphs > 1 )
                 nSequenceSize += nParagraphs - 1;
 
-            OptValue< OUString > oaLabelText;
-            OptValue< OUString > oaCellRange;
+            std::optional< OUString > oaLabelText;
+            std::optional< OUString > oaCellRange;
             if (mrModel.mobShowDataLabelsRange.value_or(false))
             {
                 const DataSourceModel* pLabelSource = 
mrModel.mrParent.mpLabelsSource;
diff --git a/oox/source/drawingml/colorchoicecontext.cxx 
b/oox/source/drawingml/colorchoicecontext.cxx
index 81e077d58c4c..4029b5750ccb 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -63,7 +63,7 @@ void ColorValueContext::onStartElement( const AttributeList& 
rAttribs )
         case A_TOKEN( schemeClr ):
         {
             mrColor.setSchemeClr( rAttribs.getToken( XML_val, 
XML_TOKEN_INVALID ) );
-            oox::OptValue<OUString> sSchemeName = rAttribs.getString( XML_val 
);
+            std::optional<OUString> sSchemeName = rAttribs.getString( XML_val 
);
             if( sSchemeName.has_value() )
                 mrColor.setSchemeName( *sSchemeName );
         }
diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx 
b/oox/source/drawingml/diagram/datamodelcontext.cxx
index 97c46c25365c..1c060cb90665 100644
--- a/oox/source/drawingml/diagram/datamodelcontext.cxx
+++ b/oox/source/drawingml/diagram/datamodelcontext.cxx
@@ -115,7 +115,7 @@ public:
             case DGM_TOKEN( hierBranch ):
             {
                 // 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 
));
+                const std::optional< sal_Int32 > aOptVal(rAttribs.getToken( 
XML_val ));
                 if(aOptVal.has_value())
                     mrPoint.moHierarchyBranch = aOptVal.value();
                 break;
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 3714c239f9ef..c38ea30e5d6f 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -45,10 +45,10 @@ using namespace ::oox::core;
 namespace
 {
 /// Looks up the value of the rInternalName -> nProperty key in rProperties.
-oox::OptValue<sal_Int32> findProperty(const oox::drawingml::LayoutPropertyMap& 
rProperties,
+std::optional<sal_Int32> findProperty(const oox::drawingml::LayoutPropertyMap& 
rProperties,
                                       const OUString& rInternalName, sal_Int32 
nProperty)
 {
-    oox::OptValue<sal_Int32> oRet;
+    std::optional<sal_Int32> oRet;
 
     auto it = rProperties.find(rInternalName);
     if (it != rProperties.end())
@@ -1515,12 +1515,12 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const 
std::vector<Constraint>&
                                 bool bScaleDownEmptySpacing = false;
                                 if (nDir == XML_fromL || nDir == XML_fromR)
                                 {
-                                    oox::OptValue<sal_Int32> oWidth = 
findProperty(aProperties, aCurrShape->getInternalName(), XML_w);
+                                    std::optional<sal_Int32> oWidth = 
findProperty(aProperties, aCurrShape->getInternalName(), XML_w);
                                     bScaleDownEmptySpacing = 
oWidth.has_value() && oWidth.value() > 0;
                                 }
                                 if (!bScaleDownEmptySpacing && (nDir == 
XML_fromT || nDir == XML_fromB))
                                 {
-                                    oox::OptValue<sal_Int32> oHeight = 
findProperty(aProperties, aCurrShape->getInternalName(), XML_h);
+                                    std::optional<sal_Int32> oHeight = 
findProperty(aProperties, aCurrShape->getInternalName(), XML_h);
                                     bScaleDownEmptySpacing = 
oHeight.has_value() && oHeight.value() > 0;
                                 }
                                 if (bScaleDownEmptySpacing && 
aCurrShape->getChildren().empty())
@@ -1568,8 +1568,8 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const 
std::vector<Constraint>&
             awt::Size aTotalSize;
             for (const auto & aCurrShape : rShape->getChildren())
             {
-                oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_w);
-                oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_h);
+                std::optional<sal_Int32> oWidth = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_w);
+                std::optional<sal_Int32> oHeight = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_h);
                 awt::Size aSize = aChildSize;
                 if (oWidth.has_value())
                     aSize.Width = oWidth.value();
@@ -1594,8 +1594,8 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const 
std::vector<Constraint>&
             for (auto& aCurrShape : rShape->getChildren())
             {
                 // Extract properties relevant for this shape from constraints.
-                oox::OptValue<sal_Int32> oWidth = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_w);
-                oox::OptValue<sal_Int32> oHeight = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_h);
+                std::optional<sal_Int32> oWidth = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_w);
+                std::optional<sal_Int32> oHeight = findProperty(aProperties, 
aCurrShape->getInternalName(), XML_h);
 
                 awt::Size aSize = aChildSize;
                 if (oWidth.has_value())
diff --git a/oox/source/drawingml/effectproperties.hxx 
b/oox/source/drawingml/effectproperties.hxx
index b588b9f7cffa..54c7068ef5c6 100644
--- a/oox/source/drawingml/effectproperties.hxx
+++ b/oox/source/drawingml/effectproperties.hxx
@@ -21,7 +21,7 @@ namespace oox::drawingml {
 
 struct EffectGlowProperties
 {
-    OptValue< sal_Int64 > moGlowRad; // size of glow effect
+    std::optional< sal_Int64 > moGlowRad; // size of glow effect
     Color moGlowColor;
     // TODO saturation and luminance missing
 
@@ -30,19 +30,19 @@ struct EffectGlowProperties
 
 struct EffectSoftEdgeProperties
 {
-    OptValue<sal_Int64> moRad; // size of effect
+    std::optional<sal_Int64> moRad; // size of effect
 
     void assignUsed(const EffectSoftEdgeProperties& rSourceProps);
 };
 
 struct EffectShadowProperties
 {
-    OptValue< sal_Int64 > moShadowDist;
-    OptValue< sal_Int64 > moShadowDir;
-    OptValue< sal_Int64 > moShadowSx;
-    OptValue< sal_Int64 > moShadowSy;
+    std::optional< sal_Int64 > moShadowDist;
+    std::optional< sal_Int64 > moShadowDir;
+    std::optional< sal_Int64 > moShadowSx;
+    std::optional< sal_Int64 > moShadowSy;
     Color moShadowColor;
-    OptValue< sal_Int64 > moShadowBlur; // size of blur effect
+    std::optional< sal_Int64 > moShadowBlur; // size of blur effect
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const EffectShadowProperties& rSourceProps 
);
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx 
b/oox/source/drawingml/textbodypropertiescontext.cxx
index b0d05f61bd48..d1e5a7669227 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -148,7 +148,7 @@ ContextHandlerRef 
TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement
             case A_TOKEN( prstTxWarp ):     // CT_PresetTextShape
                 if( mpShapePtr )
                 {
-                    const OptValue<OUString> sPrst = rAttribs.getString( 
XML_prst );
+                    const std::optional<OUString> sPrst = rAttribs.getString( 
XML_prst );
                     if( sPrst.has_value() )
                     {
                         mrTextBodyProp.msPrst = sPrst.value();
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx 
b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 8a8c30db61cb..8cbeee66408a 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -279,7 +279,7 @@ ContextHandlerRef 
TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
             return new TextCharacterPropertiesContext( *this, rAttribs, 
mrTextParagraphProperties.getTextCharacterProperties() );
         case W_TOKEN( jc ):
             {
-                OptValue< OUString > oParaAdjust = rAttribs.getString( 
W_TOKEN(val) );
+                std::optional< OUString > oParaAdjust = rAttribs.getString( 
W_TOKEN(val) );
                 if( oParaAdjust.has_value() && !oParaAdjust.value().isEmpty() )
                 {
                     const OUString& sParaAdjust = oParaAdjust.value();
@@ -299,7 +299,7 @@ ContextHandlerRef 
TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
                 // Spacing before
                 if( !rAttribs.getBool(W_TOKEN(beforeAutospacing), false) )
                 {
-                    OptValue<sal_Int32> oBefore = 
rAttribs.getInteger(W_TOKEN(before));
+                    std::optional<sal_Int32> oBefore = 
rAttribs.getInteger(W_TOKEN(before));
                     if (oBefore.has_value())
                     {
                         TextSpacing& rSpacing = 
mrTextParagraphProperties.getParaTopMargin();
@@ -309,7 +309,7 @@ ContextHandlerRef 
TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
                     }
                     else
                     {
-                        OptValue<sal_Int32> oBeforeLines = 
rAttribs.getInteger(W_TOKEN(beforeLines));
+                        std::optional<sal_Int32> oBeforeLines = 
rAttribs.getInteger(W_TOKEN(beforeLines));
                         if (oBeforeLines.has_value())
                         {
                             TextSpacing& rSpacing = 
mrTextParagraphProperties.getParaTopMargin();
@@ -323,7 +323,7 @@ ContextHandlerRef 
TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
                 // Spacing after
                 if( !rAttribs.getBool(W_TOKEN(afterAutospacing), false) )
                 {
-                    OptValue<sal_Int32> oAfter = 
rAttribs.getInteger(W_TOKEN(after));
+                    std::optional<sal_Int32> oAfter = 
rAttribs.getInteger(W_TOKEN(after));
                     if (oAfter.has_value())
                     {
                         TextSpacing& rSpacing = 
mrTextParagraphProperties.getParaBottomMargin();
@@ -333,7 +333,7 @@ ContextHandlerRef 
TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
                     }
                     else
                     {
-                        OptValue<sal_Int32> oAfterLines = 
rAttribs.getInteger(W_TOKEN(afterLines));
+                        std::optional<sal_Int32> oAfterLines = 
rAttribs.getInteger(W_TOKEN(afterLines));
                         if (oAfterLines.has_value())
                         {
                             TextSpacing& rSpacing = 
mrTextParagraphProperties.getParaBottomMargin();
@@ -345,8 +345,8 @@ 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));
+                std::optional<OUString> oLineRule = 
rAttribs.getString(W_TOKEN(lineRule));
+                std::optional<sal_Int32> oLineSpacing = 
rAttribs.getInteger(W_TOKEN(line));
                 if (oLineSpacing.has_value())
                 {
                     TextSpacing& rLineSpacing = 
mrTextParagraphProperties.getLineSpacing();
diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index 2ee3ced80c5b..043f0689fd40 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -160,18 +160,18 @@ oox::drawingml::Color 
AttributeList::getHighlightColor(sal_Int32 nAttrToken) con
 
 // optional return values -----------------------------------------------------
 
-OptValue< sal_Int32 > AttributeList::getToken( sal_Int32 nAttrToken ) const
+std::optional< sal_Int32 > AttributeList::getToken( sal_Int32 nAttrToken ) 
const
 {
     sal_Int32 nToken = mxAttribs->getOptionalValueToken( nAttrToken, 
XML_TOKEN_INVALID );
-    return nToken == XML_TOKEN_INVALID ? OptValue< sal_Int32 >() : OptValue< 
sal_Int32 >( nToken );
+    return nToken == XML_TOKEN_INVALID ? std::optional< sal_Int32 >() : 
std::optional< sal_Int32 >( nToken );
 }
 
-OptValue< OUString > AttributeList::getString( sal_Int32 nAttrToken ) const
+std::optional< OUString > AttributeList::getString( sal_Int32 nAttrToken ) 
const
 {
     // check if the attribute exists (empty string may be different to missing 
attribute)
     if( mxAttribs->hasAttribute( nAttrToken ) )
-        return OptValue< OUString >( mxAttribs->getOptionalValue( nAttrToken ) 
);
-    return OptValue< OUString >();
+        return std::optional< OUString >( mxAttribs->getOptionalValue( 
nAttrToken ) );
+    return std::optional< OUString >();
 }
 
 OUString AttributeList::getStringDefaulted( sal_Int32 nAttrToken ) const
@@ -182,93 +182,93 @@ OUString AttributeList::getStringDefaulted( sal_Int32 
nAttrToken ) const
     return OUString();
 }
 
-OptValue< OUString > AttributeList::getXString( sal_Int32 nAttrToken ) const
+std::optional< OUString > AttributeList::getXString( sal_Int32 nAttrToken ) 
const
 {
     // check if the attribute exists (empty string may be different to missing 
attribute)
     if( mxAttribs->hasAttribute( nAttrToken ) )
-        return OptValue< OUString >( AttributeConversion::decodeXString( 
mxAttribs->getOptionalValue( nAttrToken ) ) );
-    return OptValue< OUString >();
+        return std::optional< OUString >( AttributeConversion::decodeXString( 
mxAttribs->getOptionalValue( nAttrToken ) ) );
+    return std::optional< OUString >();
 }
 
-OptValue< double > AttributeList::getDouble( sal_Int32 nAttrToken ) const
+std::optional< double > AttributeList::getDouble( sal_Int32 nAttrToken ) const
 {
     double nValue;
     bool bValid = getAttribList()->getAsDouble( nAttrToken, nValue );
-    return bValid ? OptValue< double >( nValue ) : OptValue< double >();
+    return bValid ? std::optional< double >( nValue ) : std::optional< double 
>();
 }
 
-OptValue< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) const
+std::optional< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) 
const
 {
     sal_Int32 nValue;
     bool bValid = getAttribList()->getAsInteger( nAttrToken, nValue );
-    return bValid ? OptValue< sal_Int32 >( nValue ) : OptValue< sal_Int32 >();
+    return bValid ? std::optional< sal_Int32 >( nValue ) : std::optional< 
sal_Int32 >();
 }
 
-OptValue< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) const
+std::optional< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) 
const
 {
     OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
     bool bValid = !aValue.isEmpty();
-    return bValid ? OptValue< sal_uInt32 >( 
AttributeConversion::decodeUnsigned( aValue ) ) : OptValue< sal_uInt32 >();
+    return bValid ? std::optional< sal_uInt32 >( 
AttributeConversion::decodeUnsigned( aValue ) ) : std::optional< sal_uInt32 >();
 }
 
-OptValue< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const
+std::optional< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) 
const
 {
     OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
     bool bValid = !aValue.isEmpty();
-    return bValid ? OptValue< sal_Int64 >( AttributeConversion::decodeHyper( 
aValue ) ) : OptValue< sal_Int64 >();
+    return bValid ? std::optional< sal_Int64 >( 
AttributeConversion::decodeHyper( aValue ) ) : std::optional< sal_Int64 >();
 }
 
-OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) 
const
+std::optional< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken 
) const
 {
     OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
     bool bValid = !aValue.isEmpty();
-    return bValid ? OptValue< sal_Int32 >( 
AttributeConversion::decodeIntegerHex( aValue ) ) : OptValue< sal_Int32 >();
+    return bValid ? std::optional< sal_Int32 >( 
AttributeConversion::decodeIntegerHex( aValue ) ) : std::optional< sal_Int32 
>();
 }
 
-OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const
+std::optional< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const
 {
     const char *pAttr;
 
     // catch the common cases as quickly as possible first
     bool bHasAttr = getAttribList()->getAsChar( nAttrToken, pAttr );
     if( !bHasAttr )
-        return OptValue< bool >();
+        return std::optional< bool >();
     if( !strcmp( pAttr, "false" ) )
-        return OptValue< bool >( false );
+        return std::optional< bool >( false );
     if( !strcmp( pAttr, "true" ) )
-        return OptValue< bool >( true );
+        return std::optional< bool >( true );
 
     // now for all the crazy stuff
 
     // boolean attributes may be "t", "f", "true", "false", "on", "off", "1", 
or "0"
     switch( getToken( nAttrToken, XML_TOKEN_INVALID ) )
     {
-        case XML_t:     return OptValue< bool >( true );  // used in VML
-        case XML_true:  return OptValue< bool >( true );
-        case XML_on:    return OptValue< bool >( true );
-        case XML_f:     return OptValue< bool >( false ); // used in VML
-        case XML_false: return OptValue< bool >( false );
-        case XML_off:   return OptValue< bool >( false );
+        case XML_t:     return std::optional< bool >( true );  // used in VML
+        case XML_true:  return std::optional< bool >( true );
+        case XML_on:    return std::optional< bool >( true );
+        case XML_f:     return std::optional< bool >( false ); // used in VML
+        case XML_false: return std::optional< bool >( false );
+        case XML_off:   return std::optional< bool >( false );
     }
-    OptValue< sal_Int32 > onValue = getInteger( nAttrToken );
-    return onValue.has_value() ? OptValue< bool >( onValue.value() != 0 ) : 
OptValue< bool >();
+    std::optional< sal_Int32 > onValue = getInteger( nAttrToken );
+    return onValue.has_value() ? std::optional< bool >( onValue.value() != 0 ) 
: std::optional< bool >();
 }
 
-OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) 
const
+std::optional< util::DateTime > AttributeList::getDateTime( sal_Int32 
nAttrToken ) const
 {
     OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
     util::DateTime aDateTime;
     bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && 
(aValue[ 7 ] == '-') &&
         (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == 
':');
     if (!bValid)
-        return OptValue< util::DateTime >();
+        return std::optional< util::DateTime >();
     aDateTime.Year    = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 0, 4 )) );
     aDateTime.Month   = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 5, 2 )) );
     aDateTime.Day     = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 8, 2 )) );
     aDateTime.Hours   = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 11, 2 )) );
     aDateTime.Minutes = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 14, 2 )) );
     aDateTime.Seconds = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 17, 2 )) );
-    return OptValue< util::DateTime >( aDateTime );
+    return std::optional< util::DateTime >( aDateTime );
 }
 
 // defaulted return values ----------------------------------------------------
diff --git a/oox/source/ppt/layoutfragmenthandler.cxx 
b/oox/source/ppt/layoutfragmenthandler.cxx
index 4b6c19a53145..352eded1fa27 100644
--- a/oox/source/ppt/layoutfragmenthandler.cxx
+++ b/oox/source/ppt/layoutfragmenthandler.cxx
@@ -53,7 +53,7 @@ ContextHandlerRef LayoutFragmentHandler::onCreateContext( 
sal_Int32 aElementToke
         {
             mpSlidePersistPtr->setLayoutValueToken( rAttribs.getToken( 
XML_type, 0 ) ); // CT_SlideLayoutType
 
-            OptValue< bool > aShowMasterShapes = rAttribs.getBool( 
XML_showMasterSp );
+            std::optional< bool > aShowMasterShapes = rAttribs.getBool( 
XML_showMasterSp );
             if( aShowMasterShapes.has_value() && !aShowMasterShapes.value() ) {
                 mpSlidePersistPtr->hideShapesAsMasterShapes();
             }
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index cecd2796b734..ffa337b4de9a 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -683,7 +683,7 @@ namespace
 // 5. ph with the same oSubTypeIndex
 
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, 
sal_Int32 nSecondSubType,
-    const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< 
oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
+    const std::optional< sal_Int32 >& oSubTypeIndex, std::vector< 
oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
     class Placeholders
     {
@@ -693,7 +693,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( 
sal_Int32 nFirstSubType, sal
         {
         }
 
-        void add(const oox::drawingml::ShapePtr& aShape, sal_Int32 
nFirstSubType, sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& 
oSubTypeIndex)
+        void add(const oox::drawingml::ShapePtr& aShape, sal_Int32 
nFirstSubType, sal_Int32 nSecondSubType, const std::optional< sal_Int32 >& 
oSubTypeIndex)
         {
             if (!aShape)
                 return;
diff --git a/oox/source/ppt/pptshapecontext.cxx 
b/oox/source/ppt/pptshapecontext.cxx
index 14b551864170..ac73be10ed9b 100644
--- a/oox/source/ppt/pptshapecontext.cxx
+++ b/oox/source/ppt/pptshapecontext.cxx
@@ -66,7 +66,7 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 
aElementToken, con
         case PPT_TOKEN( ph ):
         {
             SlidePersistPtr pMasterPersist( 
mpSlidePersistPtr->getMasterPersist() );
-            OptValue< sal_Int32 > oSubType( rAttribs.getToken( XML_type) );
+            std::optional< sal_Int32 > oSubType( rAttribs.getToken( XML_type) 
);
             sal_Int32 nSubType( rAttribs.getToken( XML_type, XML_obj ) );
             oox::drawingml::ShapePtr pTmpPlaceholder;
 
diff --git a/oox/source/ppt/slidefragmenthandler.cxx 
b/oox/source/ppt/slidefragmenthandler.cxx
index a6447b376d15..a6b8202a4c61 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -82,7 +82,7 @@ SlideFragmentHandler::~SlideFragmentHandler()
         PropertyMap aPropMap;
         PropertySet aSlideProp( xSlide );
 
-        OptValue<bool> aShowMasterShapes = rAttribs.getBool(XML_showMasterSp);
+        std::optional<bool> aShowMasterShapes = 
rAttribs.getBool(XML_showMasterSp);
         if (aShowMasterShapes.has_value() && !aShowMasterShapes.value())
             xSet->setPropertyValue("IsBackgroundObjectsVisible", Any(false));
 
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 6198127a4743..98d3375f7a1c 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -126,7 +126,7 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
                     std::optional<sal_Int32> oInsets[4];
                     for (std::size_t i = 0; i < SAL_N_ELEMENTS(aInsets); ++i)
                     {
-                        OptValue<OUString> oValue = 
rAttribs.getString(aInsets[i]);
+                        std::optional<OUString> oValue = 
rAttribs.getString(aInsets[i]);
                         if (oValue.has_value())
                             oInsets[i] = 
oox::drawingml::GetCoordinate(oValue.value());
                         else
@@ -238,7 +238,7 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
                 {
                     if (rAttribs.hasAttribute(XML_lIns))
                     {
-                        OptValue<OUString> oValue = 
rAttribs.getString(aInsets[i]);
+                        std::optional<OUString> oValue = 
rAttribs.getString(aInsets[i]);
                         if (oValue.has_value())
                             pTextBody->getTextProperties().moInsets[i]
                                 = 
oox::drawingml::GetCoordinate(oValue.value());
@@ -279,7 +279,7 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
                 uno::Reference<beans::XPropertySet> xPropertySet(mxShape, 
uno::UNO_QUERY);
                 if (xPropertySet.is())
                 {
-                    oox::OptValue<OUString> presetShapeName = 
rAttribs.getString(XML_prst);
+                    std::optional<OUString> presetShapeName = 
rAttribs.getString(XML_prst);
                     const OUString& preset = presetShapeName.value();
                     comphelper::SequenceAsHashMap aCustomShapeGeometry(
                         xPropertySet->getPropertyValue("CustomShapeGeometry"));
@@ -298,7 +298,7 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
             //for further processing.
             if (rAttribs.hasAttribute(XML_id))
             {
-                OptValue<OUString> id = rAttribs.getString(XML_id);
+                std::optional<OUString> id = rAttribs.getString(XML_id);
                 if (id.has_value())
                 {
                     oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr;
@@ -316,8 +316,8 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
             //for further processing.
             mpShapePtr->getCustomShapeProperties()->setShapeTypeOverride(true);
             mpShapePtr->setTextBox(true);
-            OptValue<OUString> id = rAttribs.getString(XML_id);
-            OptValue<OUString> seq = rAttribs.getString(XML_seq);
+            std::optional<OUString> id = rAttribs.getString(XML_id);
+            std::optional<OUString> seq = rAttribs.getString(XML_seq);
             if (id.has_value() && seq.has_value())
             {
                 oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr;
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 00a346748531..c15a1fa3a658 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -223,7 +223,7 @@ sal_Int32 ConversionHelper::decodeMeasureToTwip(const 
GraphicHelper& rGraphicHel
 }
 
 Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
-        const OptValue< OUString >& roVmlColor, const OptValue< double >& 
roVmlOpacity,
+        const std::optional< OUString >& roVmlColor, const std::optional< 
double >& roVmlOpacity,
         ::Color nDefaultRgb, ::Color nPrimaryRgb )
 {
     Color aDmlColor;
@@ -554,12 +554,12 @@ void ConversionHelper::decodeVmlPath( ::std::vector< 
::std::vector< Point > >& r
 
 namespace {
 
-sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< 
OUString >& roValue, sal_Int64 nDefValue )
+sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const std::optional< 
OUString >& roValue, sal_Int64 nDefValue )
 {
     return roValue.has_value() ? ConversionHelper::decodeMeasureToEmu( 
rGraphicHelper, roValue.value(), 0, false, false ) : nDefValue;
 }
 
-void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, 
LineProperties::DashStopVector& orCustomDash, const OptValue< OUString >& 
roDashStyle )
+void lclGetDmlLineDash( std::optional< sal_Int32 >& oroPresetDash, 
LineProperties::DashStopVector& orCustomDash, const std::optional< OUString >& 
roDashStyle )
 {
     if( !roDashStyle.has_value() )
         return;
@@ -593,7 +593,7 @@ void lclGetDmlLineDash( OptValue< sal_Int32 >& 
oroPresetDash, LineProperties::Da
     }
 }
 
-sal_Int32 lclGetDmlArrowType( const OptValue< sal_Int32 >& roArrowType )
+sal_Int32 lclGetDmlArrowType( const std::optional< sal_Int32 >& roArrowType )
 {
     if( roArrowType.has_value() ) switch( roArrowType.value() )
     {
@@ -607,7 +607,7 @@ sal_Int32 lclGetDmlArrowType( const OptValue< sal_Int32 >& 
roArrowType )
     return XML_none;
 }
 
-sal_Int32 lclGetDmlArrowWidth( const OptValue< sal_Int32 >& roArrowWidth )
+sal_Int32 lclGetDmlArrowWidth( const std::optional< sal_Int32 >& roArrowWidth )
 {
     if( roArrowWidth.has_value() ) switch( roArrowWidth.value() )
     {
@@ -618,7 +618,7 @@ sal_Int32 lclGetDmlArrowWidth( const OptValue< sal_Int32 >& 
roArrowWidth )
     return XML_med;
 }
 
-sal_Int32 lclGetDmlArrowLength( const OptValue< sal_Int32 >& roArrowLength )
+sal_Int32 lclGetDmlArrowLength( const std::optional< sal_Int32 >& 
roArrowLength )
 {
     if( roArrowLength.has_value() ) switch( roArrowLength.value() )
     {
@@ -636,7 +636,7 @@ void lclConvertArrow( LineArrowProperties& orArrowProp, 
const StrokeArrowModel&
     orArrowProp.moArrowLength = lclGetDmlArrowLength( 
rStrokeArrow.moArrowLength );
 }
 
-sal_Int32 lclGetDmlLineCompound( const OptValue< sal_Int32 >& roLineStyle )
+sal_Int32 lclGetDmlLineCompound( const std::optional< sal_Int32 >& roLineStyle 
)
 {
     if( roLineStyle.has_value() ) switch( roLineStyle.value() )
     {
@@ -649,7 +649,7 @@ sal_Int32 lclGetDmlLineCompound( const OptValue< sal_Int32 
>& roLineStyle )
     return XML_sng;
 }
 
-sal_Int32 lclGetDmlLineCap( const OptValue< sal_Int32 >& roEndCap )
+sal_Int32 lclGetDmlLineCap( const std::optional< sal_Int32 >& roEndCap )
 {
     if( roEndCap.has_value() ) switch( roEndCap.value() )
     {
@@ -660,7 +660,7 @@ sal_Int32 lclGetDmlLineCap( const OptValue< sal_Int32 >& 
roEndCap )
     return XML_flat;    // different defaults in VML (flat) and DrawingML 
(square)
 }
 
-sal_Int32 lclGetDmlLineJoint( const OptValue< sal_Int32 >& roJoinStyle )
+sal_Int32 lclGetDmlLineJoint( const std::optional< sal_Int32 >& roJoinStyle )
 {
     if( roJoinStyle.has_value() ) switch( roJoinStyle.value() )
     {
@@ -969,7 +969,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& 
rPropMap, const uno::Referen
                 }
                 else if (aName == u"font-size")
                 {
-                    oox::OptValue<OUString> aOptString {OUString(aValue)};
+                    std::optional<OUString> aOptString {OUString(aValue)};
                     float nSize = 
drawingml::convertEmuToPoints(lclGetEmu(rGraphicHelper, aOptString, 1));
 
                     uno::Reference<beans::XPropertySet> xPropertySet(xShape, 
uno::UNO_QUERY);
diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index 63ece16c7046..bf62b725ff23 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -49,29 +49,29 @@ namespace {
 
 /** Returns the boolean value from the specified VML attribute (if present).
  */
-OptValue< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 
nToken )
+std::optional< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 
nToken )
 {
-    OptValue< OUString > oValue = rAttribs.getString( nToken );
-    if( oValue.has_value() ) return OptValue< bool >( 
ConversionHelper::decodeBool( oValue.value() ) );
-    return OptValue< bool >();
+    std::optional< OUString > oValue = rAttribs.getString( nToken );
+    if( oValue.has_value() ) return std::optional< bool >( 
ConversionHelper::decodeBool( oValue.value() ) );
+    return std::optional< bool >();
 }
 
 /** Returns the percentage value from the specified VML attribute (if present).
     The value will be normalized (1.0 is returned for 100%).
  */
-OptValue< double > lclDecodePercent( const AttributeList& rAttribs, sal_Int32 
nToken, double fDefValue )
+std::optional< double > lclDecodePercent( const AttributeList& rAttribs, 
sal_Int32 nToken, double fDefValue )
 {
-    OptValue< OUString > oValue = rAttribs.getString( nToken );
-    if( oValue.has_value() ) return OptValue< double >( 
ConversionHelper::decodePercent( oValue.value(), fDefValue ) );
-    return OptValue< double >();
+    std::optional< OUString > oValue = rAttribs.getString( nToken );
+    if( oValue.has_value() ) return std::optional< double >( 
ConversionHelper::decodePercent( oValue.value(), fDefValue ) );
+    return std::optional< double >();
 }
 
 /** #119750# Special method for opacity; it *should* be a percentage value, 
but there are cases
     where a value relative to 0xffff (65536) is used, ending with an 'f'
  */
-OptValue< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 
nToken, double fDefValue )
+std::optional< double > lclDecodeOpacity( const AttributeList& rAttribs, 
sal_Int32 nToken, double fDefValue )
 {
-    OptValue< OUString > oValue = rAttribs.getString( nToken );
+    std::optional< OUString > oValue = rAttribs.getString( nToken );
     double fRetval(fDefValue);
 
     if( oValue.has_value() )
@@ -92,15 +92,15 @@ OptValue< double > lclDecodeOpacity( const AttributeList& 
rAttribs, sal_Int32 nT
         }
     }
 
-    return OptValue< double >(fRetval);
+    return std::optional< double >(fRetval);
 }
 
 /** Returns the integer value pair from the specified VML attribute (if 
present).
  */
-OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, 
sal_Int32 nToken )
+std::optional< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, 
sal_Int32 nToken )
 {
-    OptValue< OUString > oValue = rAttribs.getString( nToken );
-    OptValue< Int32Pair > oRetValue;
+    std::optional< OUString > oValue = rAttribs.getString( nToken );
+    std::optional< Int32Pair > oRetValue;
     if( oValue.has_value() )
     {
         std::u16string_view aValue1, aValue2;
@@ -112,10 +112,10 @@ OptValue< Int32Pair > lclDecodeInt32Pair( const 
AttributeList& rAttribs, sal_Int
 
 /** Returns the percentage pair from the specified VML attribute (if present).
  */
-OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, 
sal_Int32 nToken )
+std::optional< DoublePair > lclDecodePercentPair( const AttributeList& 
rAttribs, sal_Int32 nToken )
 {
-    OptValue< OUString > oValue = rAttribs.getString( nToken );
-    OptValue< DoublePair > oRetValue;
+    std::optional< OUString > oValue = rAttribs.getString( nToken );
+    std::optional< DoublePair > oRetValue;
     if( oValue.has_value() )
     {
         std::u16string_view aValue1, aValue2;
@@ -398,7 +398,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( 
sal_Int32 nElement, const A
             mrTypeModel.moCropTop = rAttribs.getString(XML_croptop);
 
             // Gain / contrast.
-            OptValue<OUString> oGain = rAttribs.getString(XML_gain);
+            std::optional<OUString> oGain = rAttribs.getString(XML_gain);
             sal_Int32 nGain = 0x10000;
             if (oGain.has_value() && oGain.value().endsWith("f"))
             {
@@ -413,7 +413,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( 
sal_Int32 nElement, const A
             mrTypeModel.mnGain = nGain;
 
             // Blacklevel / brightness.
-            OptValue<OUString> oBlacklevel = 
rAttribs.getString(XML_blacklevel);
+            std::optional<OUString> oBlacklevel = 
rAttribs.getString(XML_blacklevel);
             sal_Int16 nBlacklevel = 0;
             if (oBlacklevel.has_value() && oBlacklevel.value().endsWith("f"))
             {
@@ -450,10 +450,10 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( 
sal_Int32 nElement, const A
     return nullptr;
 }
 
-OptValue< OUString > ShapeTypeContext::decodeFragmentPath( const 
AttributeList& rAttribs, sal_Int32 nToken ) const
+std::optional< OUString > ShapeTypeContext::decodeFragmentPath( const 
AttributeList& rAttribs, sal_Int32 nToken ) const
 {
-    OptValue< OUString > oFragmentPath;
-    OptValue< OUString > oRelId = rAttribs.getString( nToken );
+    std::optional< OUString > oFragmentPath;
+    std::optional< OUString > oRelId = rAttribs.getString( nToken );
     if( oRelId.has_value() )
         oFragmentPath = getFragmentPathFromRelId( oRelId.value() );
     return oFragmentPath;
diff --git a/oox/source/vml/vmltextboxcontext.cxx 
b/oox/source/vml/vmltextboxcontext.cxx
index c9cb789d28a9..768919c12a85 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -72,14 +72,14 @@ TextPortionContext::TextPortionContext( 
ContextHandler2Helper const & rParent,
         break;
         case OOX_TOKEN(dml, blip):
             {
-                OptValue<OUString> oRelId = rAttribs.getString(R_TOKEN(embed));
+                std::optional<OUString> oRelId = 
rAttribs.getString(R_TOKEN(embed));
                 if (oRelId.has_value())
                     mrTextBox.mrTypeModel.moGraphicPath = 
getFragmentPathFromRelId(oRelId.value());
             }
         break;
         case VML_TOKEN(imagedata):
             {
-                OptValue<OUString> oRelId = rAttribs.getString(R_TOKEN(id));
+                std::optional<OUString> oRelId = 
rAttribs.getString(R_TOKEN(id));
                 if (oRelId.has_value())
                     mrTextBox.mrTypeModel.moGraphicPath = 
getFragmentPathFromRelId(oRelId.value());
             }
diff --git a/sc/source/filter/inc/autofilterbuffer.hxx 
b/sc/source/filter/inc/autofilterbuffer.hxx
index 788be95615c1..6721c185f403 100644
--- a/sc/source/filter/inc/autofilterbuffer.hxx
+++ b/sc/source/filter/inc/autofilterbuffer.hxx
@@ -42,7 +42,7 @@ struct ApiFilterSettings
     typedef ::std::vector<css::sheet::TableFilterField3> FilterFieldVector;
 
     FilterFieldVector   maFilterFields;     /// List of UNO API filter 
settings.
-    OptValue< bool >    mobNeedsRegExp;     /// If set, requires regular 
expressions to be enabled/disabled.
+    std::optional< bool > mobNeedsRegExp;     /// If set, requires regular 
expressions to be enabled/disabled.
 
     explicit            ApiFilterSettings();
 
diff --git a/sc/source/filter/oox/autofilterbuffer.cxx 
b/sc/source/filter/oox/autofilterbuffer.cxx
index 703de7bd510f..3295087d0c7d 100644
--- a/sc/source/filter/oox/autofilterbuffer.cxx
+++ b/sc/source/filter/oox/autofilterbuffer.cxx
@@ -732,7 +732,7 @@ void AutoFilter::finalizeImport( const Reference< 
XDatabaseRange >& rxDatabaseRa
     ::std::vector<TableFilterField3> aFilterFields;
 
     // track if columns require to enable or disable regular expressions
-    OptValue< bool > obNeedsRegExp;
+    std::optional< bool > obNeedsRegExp;
 
     /*  Track whether the filter fields of the first filter column are
         connected with 'or'. In this case, other filter fields cannot be

Reply via email to