diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-02-21 07:26:06 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-02-21 14:50:28 +0100 |
commit | 9ad252b2e79576119c2d733a1a45fdd9e9f83140 (patch) | |
tree | 87fee16145d457b6799a05c389d85270476f7f35 /writerfilter | |
parent | 3aca35f1505fa552eaa316a2d47a60ef52646525 (diff) |
Drop o3tl::optional wrapper
...now that macOS builds are guaranteed to have std::optional since
358146bbbd1b9775c12770fb5e497b6ec5adfc51 "Bump macOS build baseline to
Xcode 11.3 and macOS 10.14.4".
The change is done mostly mechanically with
> for i in $(git grep -Fl optional); do
> sed -i -e 's:<o3tl/optional\.hxx>\|\"o3tl/optional\.hxx\":<optional>:' \
> -e 's/\<o3tl::optional\>/std::optional/g' \
> -e 's/\<o3tl::make_optional\>/std::make_optional/g' "$i"
> done
> for i in $(git grep -Flw o3tl::nullopt); do
> sed -i -e 's/\<o3tl::nullopt\>/std::nullopt/g' "$i"
> done
(though that causes some of the resulting
#include <optional>
to appear at different places relative to other includes than if they had been
added manually), plus a few manual modifications:
* adapt bin/find-unneeded-includes
* adapt desktop/IwyuFilter_desktop.yaml
* remove include/o3tl/optional.hxx
* quote resulting "<"/">" as "<"/">" in officecfg/registry/cppheader.xsl
* and then solenv/clang-format/reformat-formatted-files
Change-Id: I68833d9f7945e57aa2bc703349cbc5a56b342273
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89165
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 38 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 26 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SdtHelper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TextEffectsHandler.hxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 22 |
15 files changed, 80 insertions, 81 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c92e70a10f2a..b4490712ccdd 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -447,7 +447,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) { style::LineSpacing aSpacing; PropertyMapPtr pTopContext = m_pImpl->GetTopContext(); - o3tl::optional<PropertyMap::Property> aLineSpacingVal; + std::optional<PropertyMap::Property> aLineSpacingVal; if (pTopContext && (aLineSpacingVal = pTopContext->getProperty(PROP_PARA_LINE_SPACING)) ) { aLineSpacingVal->second >>= aSpacing; @@ -2650,7 +2650,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_cntxtAlts_cntxtAlts: { tools::SvRef<TextEffectsHandler> pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) ); - o3tl::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId(); + std::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId(); if(aPropertyId) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index bf5b638fafb5..d10f1e8776c4 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -92,7 +92,7 @@ void DomainMapperTableHandler::startTable(const TablePropertyMapPtr& pProps) static void lcl_mergeBorder( PropertyIds nId, const PropertyMapPtr& pOrig, const PropertyMapPtr& pDest ) { - o3tl::optional<PropertyMap::Property> pOrigVal = pOrig->getProperty(nId); + std::optional<PropertyMap::Property> pOrigVal = pOrig->getProperty(nId); if ( pOrigVal ) { @@ -103,8 +103,8 @@ static void lcl_mergeBorder( PropertyIds nId, const PropertyMapPtr& pOrig, const static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const PropertyMapPtr& pCellProps, sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow, bool bMergedVertically ) { - o3tl::optional<PropertyMap::Property> pVerticalVal = pCellProps->getProperty(META_PROP_VERTICAL_BORDER); - o3tl::optional<PropertyMap::Property> pHorizontalVal = pCellProps->getProperty(META_PROP_HORIZONTAL_BORDER); + std::optional<PropertyMap::Property> pVerticalVal = pCellProps->getProperty(META_PROP_VERTICAL_BORDER); + std::optional<PropertyMap::Property> pHorizontalVal = pCellProps->getProperty(META_PROP_HORIZONTAL_BORDER); // Handle the vertical and horizontal borders uno::Any aVertProp; @@ -254,7 +254,7 @@ bool lcl_extractTableBorderProperty(const PropertyMapPtr& pTableProperties, cons if (!pTableProperties) return false; - const o3tl::optional<PropertyMap::Property> aTblBorder = pTableProperties->getProperty(nId); + const std::optional<PropertyMap::Property> aTblBorder = pTableProperties->getProperty(nId); if( aTblBorder ) { OSL_VERIFY(aTblBorder->second >>= rLine); @@ -388,7 +388,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo aGrabBag["TablePosition"] <<= aGrabBagTS; } - o3tl::optional<PropertyMap::Property> aTableStyleVal = m_aTableProperties->getProperty(META_PROP_TABLE_STYLE_NAME); + std::optional<PropertyMap::Property> aTableStyleVal = m_aTableProperties->getProperty(META_PROP_TABLE_STYLE_NAME); if(aTableStyleVal) { // Apply table style properties recursively @@ -456,7 +456,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } // This is the one preserving just all the table look attributes. - o3tl::optional<PropertyMap::Property> oTableLook = m_aTableProperties->getProperty(META_PROP_TABLE_LOOK); + std::optional<PropertyMap::Property> oTableLook = m_aTableProperties->getProperty(META_PROP_TABLE_LOOK); if (oTableLook) { aGrabBag["TableStyleLook"] = oTableLook->second; @@ -464,7 +464,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } // This is just the "val" attribute's numeric value. - const o3tl::optional<PropertyMap::Property> aTblLook = m_aTableProperties->getProperty(PROP_TBL_LOOK); + const std::optional<PropertyMap::Property> aTblLook = m_aTableProperties->getProperty(PROP_TBL_LOOK); if(aTblLook) { aTblLook->second >>= rInfo.nTblLook; @@ -472,25 +472,25 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } // apply cell margin settings of the table style - const o3tl::optional<PropertyMap::Property> oLeftMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_LEFT); + const std::optional<PropertyMap::Property> oLeftMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_LEFT); if (oLeftMargin) { oLeftMargin->second >>= rInfo.nLeftBorderDistance; m_aTableProperties->Erase(oLeftMargin->first); } - const o3tl::optional<PropertyMap::Property> oRightMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_RIGHT); + const std::optional<PropertyMap::Property> oRightMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_RIGHT); if (oRightMargin) { oRightMargin->second >>= rInfo.nRightBorderDistance; m_aTableProperties->Erase(oRightMargin->first); } - const o3tl::optional<PropertyMap::Property> oTopMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_TOP); + const std::optional<PropertyMap::Property> oTopMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_TOP); if (oTopMargin) { oTopMargin->second >>= rInfo.nTopBorderDistance; m_aTableProperties->Erase(oTopMargin->first); } - const o3tl::optional<PropertyMap::Property> oBottomMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_BOTTOM); + const std::optional<PropertyMap::Property> oBottomMargin = m_aTableProperties->getProperty(META_PROP_CELL_MAR_BOTTOM); if (oBottomMargin) { oBottomMargin->second >>= rInfo.nBottomBorderDistance; @@ -598,7 +598,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo if ( !m_aCellProperties.empty() && !m_aCellProperties[0].empty() ) { // aLeftBorder already contains tblBorder; overwrite if cell is different. - o3tl::optional<PropertyMap::Property> aCellBorder + std::optional<PropertyMap::Property> aCellBorder = m_aCellProperties[0][0]->getProperty(PROP_LEFT_BORDER); if ( aCellBorder ) aCellBorder->second >>= aLeftBorder; @@ -658,7 +658,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo // if table is only a single row, and row is set as don't split, set the same value for the whole table. if( m_aRowProperties.size() == 1 && m_aRowProperties[0].get() ) { - o3tl::optional<PropertyMap::Property> oSplitAllowed = m_aRowProperties[0]->getProperty(PROP_IS_SPLIT_ALLOWED); + std::optional<PropertyMap::Property> oSplitAllowed = m_aRowProperties[0]->getProperty(PROP_IS_SPLIT_ALLOWED); if( oSplitAllowed ) { bool bRowCanSplit = true; @@ -808,18 +808,18 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl // Apply also possible tblPrEx borders on cells for (const PropertyIds& rBorder : pBorders) { - o3tl::optional<PropertyMap::Property> oStyleCellBorder = pStyleProps->getProperty(rBorder); - o3tl::optional<PropertyMap::Property> oRowCellBorder; + std::optional<PropertyMap::Property> oStyleCellBorder = pStyleProps->getProperty(rBorder); + std::optional<PropertyMap::Property> oRowCellBorder; // we can have table border exception in row properties if (*aRowIter && (*aRowIter)->isSet(rBorder)) oRowCellBorder = (*aRowIter)->getProperty(rBorder); - o3tl::optional<PropertyMap::Property> oDirectCellBorder = (*aCellIterator)->getProperty(rBorder); + std::optional<PropertyMap::Property> oDirectCellBorder = (*aCellIterator)->getProperty(rBorder); if (oRowCellBorder && oDirectCellBorder) { table::BorderLine2 aRowCellBorder = oRowCellBorder->second.get<table::BorderLine2>(); table::BorderLine2 aDirectCellBorder = oDirectCellBorder->second.get<table::BorderLine2>(); if (aRowCellBorder.LineStyle != table::BorderLineStyle::NONE && aDirectCellBorder.LineStyle == table::BorderLineStyle::NONE) - oDirectCellBorder = o3tl::optional<PropertyMap::Property>(); + oDirectCellBorder = std::optional<PropertyMap::Property>(); } if (oRowCellBorder && !oDirectCellBorder) { @@ -846,7 +846,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl } else { - o3tl::optional<PropertyMap::Property> oTableBorder = rInfo.pTableBorders->getProperty(rBorder); + std::optional<PropertyMap::Property> oTableBorder = rInfo.pTableBorders->getProperty(rBorder); if (oTableBorder) { table::BorderLine2 aTableBorder = oTableBorder->second.get<table::BorderLine2>(); @@ -928,7 +928,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl uno::makeAny(rInfo.nBottomBorderDistance ), false); // Horizontal merge is not a UNO property, extract that info here to rMerges, and then remove it from the map. - const o3tl::optional<PropertyMap::Property> aHorizontalMergeVal = (*aCellIterator)->getProperty(PROP_HORIZONTAL_MERGE); + const std::optional<PropertyMap::Property> aHorizontalMergeVal = (*aCellIterator)->getProperty(PROP_HORIZONTAL_MERGE); if (aHorizontalMergeVal) { if (aHorizontalMergeVal->second.get<bool>()) diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 552d30daf8ce..0701dc1610e1 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <o3tl/optional.hxx> +#include <optional> #include "DomainMapperTableManager.hxx" #include "ConversionHelper.hxx" #include "MeasureHandler.hxx" @@ -429,7 +429,7 @@ void DomainMapperTableManager::startLevel( ) TableManager::startLevel( ); // If requested, pop the value that was pushed too early. - o3tl::optional<sal_Int32> oCurrentWidth; + std::optional<sal_Int32> oCurrentWidth; if (m_bPushCurrentWidth && !m_aCellWidths.empty() && !m_aCellWidths.back()->empty()) { oCurrentWidth = m_aCellWidths.back()->back(); @@ -471,7 +471,7 @@ void DomainMapperTableManager::endLevel( ) m_aGridSpans.pop_back( ); // Do the same trick as in startLevel(): pop the value that was pushed too early. - o3tl::optional<sal_Int32> oCurrentWidth; + std::optional<sal_Int32> oCurrentWidth; if (m_bPushCurrentWidth && !m_aCellWidths.empty() && !m_aCellWidths.back()->empty()) oCurrentWidth = m_aCellWidths.back()->back(); m_aCellWidths.pop_back( ); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 22cf36388b48..4c7b50c72cf8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -809,7 +809,7 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleShee { if(pEntry->pProperties) { - o3tl::optional<PropertyMap::Property> aProperty = + std::optional<PropertyMap::Property> aProperty = pEntry->pProperties->getProperty(eId); if( aProperty ) { @@ -837,7 +837,7 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleShee const PropertyMapPtr& pDefaultParaProps = GetStyleSheetTable()->GetDefaultParaProps(); if ( pDefaultParaProps ) { - o3tl::optional<PropertyMap::Property> aProperty = pDefaultParaProps->getProperty(eId); + std::optional<PropertyMap::Property> aProperty = pDefaultParaProps->getProperty(eId); if ( aProperty ) { if (pIsDocDefault) @@ -852,7 +852,7 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleShee const PropertyMapPtr& pDefaultCharProps = GetStyleSheetTable()->GetDefaultCharProps(); if ( pDefaultCharProps ) { - o3tl::optional<PropertyMap::Property> aProperty = pDefaultCharProps->getProperty(eId); + std::optional<PropertyMap::Property> aProperty = pDefaultCharProps->getProperty(eId); if ( aProperty ) { if (pIsDocDefault) @@ -896,7 +896,7 @@ uno::Any DomainMapper_Impl::GetAnyProperty(PropertyIds eId, const PropertyMapPtr // first look in directly applied attributes if ( rContext ) { - o3tl::optional<PropertyMap::Property> aProperty = rContext->getProperty(eId); + std::optional<PropertyMap::Property> aProperty = rContext->getProperty(eId); if ( aProperty ) return aProperty->second; } @@ -1054,7 +1054,7 @@ static void lcl_AddRangeAndStyle( pToBeSavedProperties->SetStartingRange(xParaCursor->getStart()); if(pPropertyMap) { - o3tl::optional<PropertyMap::Property> aParaStyle = pPropertyMap->getProperty(PROP_PARA_STYLE_NAME); + std::optional<PropertyMap::Property> aParaStyle = pPropertyMap->getProperty(PROP_PARA_STYLE_NAME); if( aParaStyle ) { OUString sName; @@ -1384,7 +1384,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // over the ones from the numbering styles in Word // but in Writer numbering styles have priority, // so insert directly into the paragraph properties to compensate. - o3tl::optional<PropertyMap::Property> oProperty; + std::optional<PropertyMap::Property> oProperty; const StyleSheetEntryPtr pParent = (!pEntry->sBaseStyleIdentifier.isEmpty()) ? GetStyleSheetTable()->FindStyleSheetByISTD(pEntry->sBaseStyleIdentifier) : nullptr; const StyleSheetPropertyMap* pParentProperties = dynamic_cast<const StyleSheetPropertyMap*>(pParent ? pParent->pProperties.get() : nullptr); if (!pEntry->sBaseStyleIdentifier.isEmpty()) @@ -2367,7 +2367,7 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) // This adds a hack on top of the following hack to save the style name in the context. PropertyMapPtr pTopContext = GetTopContext(); OUString sFootnoteCharStyleName; - o3tl::optional< PropertyMap::Property > aProp = pTopContext->getProperty(PROP_CHAR_STYLE_NAME); + std::optional< PropertyMap::Property > aProp = pTopContext->getProperty(PROP_CHAR_STYLE_NAME); if (aProp) aProp->second >>= sFootnoteCharStyleName; @@ -2834,7 +2834,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape // Fix spacing for as-character objects. If the paragraph has CT_Spacing_after set, // it needs to be set on the object too, as that's what object placement code uses. PropertyMapPtr paragraphContext = GetTopContextOfType( CONTEXT_PARAGRAPH ); - o3tl::optional<PropertyMap::Property> aPropMargin = paragraphContext->getProperty(PROP_PARA_BOTTOM_MARGIN); + std::optional<PropertyMap::Property> aPropMargin = paragraphContext->getProperty(PROP_PARA_BOTTOM_MARGIN); if(aPropMargin) xProps->setPropertyValue( getPropertyName( PROP_BOTTOM_MARGIN ), aPropMargin->second ); } @@ -3338,7 +3338,7 @@ static bool lcl_FindInCommand( void DomainMapper_Impl::GetCurrentLocale(lang::Locale& rLocale) { PropertyMapPtr pTopContext = GetTopContext(); - o3tl::optional<PropertyMap::Property> pLocale = pTopContext->getProperty(PROP_CHAR_LOCALE); + std::optional<PropertyMap::Property> pLocale = pTopContext->getProperty(PROP_CHAR_LOCALE); if( pLocale ) pLocale->second >>= rLocale; else @@ -4644,7 +4644,7 @@ void DomainMapper_Impl::handleIndex static auto InsertFieldmark(std::stack<TextAppendContext> & rTextAppendStack, uno::Reference<text::XFormField> const& xFormField, uno::Reference<text::XTextRange> const& xStartRange, - o3tl::optional<FieldId> const oFieldId) -> void + std::optional<FieldId> const oFieldId) -> void { uno::Reference<text::XTextContent> const xTextContent(xFormField, uno::UNO_QUERY_THROW); uno::Reference<text::XTextAppend> const& xTextAppend(rTextAppendStack.top().xTextAppend); @@ -4686,7 +4686,7 @@ static auto InsertFieldmark(std::stack<TextAppendContext> & rTextAppendStack, static auto PopFieldmark(std::stack<TextAppendContext> & rTextAppendStack, uno::Reference<text::XTextCursor> const& xCursor, - o3tl::optional<FieldId> const oFieldId) -> void + std::optional<FieldId> const oFieldId) -> void { if (oFieldId && (oFieldId == FIELD_FORMCHECKBOX || oFieldId == FIELD_FORMDROPDOWN)) @@ -6672,7 +6672,7 @@ uno::Reference<beans::XPropertySet> DomainMapper_Impl::GetCurrentNumberingCharSt } // In case numbering rules is not found via a style, try the direct formatting instead. - o3tl::optional<PropertyMap::Property> oProp = pContext->getProperty(PROP_NUMBERING_RULES); + std::optional<PropertyMap::Property> oProp = pContext->getProperty(PROP_NUMBERING_RULES); if (oProp) { xLevels.set(oProp->second, uno::UNO_QUERY); @@ -6778,7 +6778,7 @@ sal_Int32 DomainMapper_Impl::getCurrentNumberingProperty(const OUString& aProp) { sal_Int32 nRet = 0; - o3tl::optional<PropertyMap::Property> pProp = m_pTopContext->getProperty(PROP_NUMBERING_RULES); + std::optional<PropertyMap::Property> pProp = m_pTopContext->getProperty(PROP_NUMBERING_RULES); uno::Reference<container::XIndexAccess> xNumberingRules; if (pProp) xNumberingRules.set(pProp->second, uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index c7b50dcdc730..154bd0bbc840 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -29,7 +29,7 @@ #include <stack> #include <unordered_map> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> #include "DomainMapper.hxx" #include "DomainMapperTableManager.hxx" @@ -156,7 +156,7 @@ class FieldContext : public virtual SvRefBase OUString m_sCommand; OUString m_sResult; - o3tl::optional<FieldId> m_eFieldId; + std::optional<FieldId> m_eFieldId; bool m_bFieldLocked; css::uno::Reference<css::text::XTextField> m_xTextField; @@ -186,7 +186,7 @@ public: const OUString& GetCommand() const {return m_sCommand; } void SetFieldId(FieldId eFieldId ) { m_eFieldId = eFieldId; } - o3tl::optional<FieldId> const & GetFieldId() const { return m_eFieldId; } + std::optional<FieldId> const & GetFieldId() const { return m_eFieldId; } void AppendResult(OUString const& rResult) { m_sResult += rResult; } const OUString& GetResult() const { return m_sResult; } @@ -440,7 +440,7 @@ private: css::uno::Reference<css::uno::XComponentContext> m_xComponentContext; css::uno::Reference<css::container::XNameContainer> m_xPageStyles1; // cache next available number, expensive to repeatedly compute - o3tl::optional<int> m_xNextUnusedPageStyleNo; + std::optional<int> m_xNextUnusedPageStyleNo; css::uno::Reference<css::text::XText> m_xBodyText; css::uno::Reference<css::text::XTextContent> m_xEmbedded; @@ -977,7 +977,7 @@ public: tools::SvRef<SdtHelper> m_pSdtHelper; /// Document background color, applied to every page style. - o3tl::optional<sal_Int32> m_oBackgroundColor; + std::optional<sal_Int32> m_oBackgroundColor; /** * This contains the raw table depth. m_nTableDepth > 0 is the same as diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 96d784f7cad1..c4a5f045b794 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -247,10 +247,10 @@ public: std::queue<OUString>& m_rPositivePercentages; OUString sAnchorId; comphelper::SequenceAsHashMap m_aInteropGrabBag; - o3tl::optional<sal_Int32> m_oEffectExtentLeft; - o3tl::optional<sal_Int32> m_oEffectExtentTop; - o3tl::optional<sal_Int32> m_oEffectExtentRight; - o3tl::optional<sal_Int32> m_oEffectExtentBottom; + std::optional<sal_Int32> m_oEffectExtentLeft; + std::optional<sal_Int32> m_oEffectExtentTop; + std::optional<sal_Int32> m_oEffectExtentRight; + std::optional<sal_Int32> m_oEffectExtentBottom; GraphicImport_Impl(GraphicImportType eImportType, DomainMapper& rDMapper, std::pair<OUString, OUString>& rPositionOffsets, std::pair<OUString, OUString>& rAligns, std::queue<OUString>& rPositivePercentages) : nXSize(0) diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 5574039cca5b..7084547c4d1a 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -293,7 +293,7 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults PROP_FIRST_LINE_OFFSET, PROP_LEFT_MARGIN }; for(PropertyIds const & rReadId : aReadIds) { - o3tl::optional<PropertyMap::Property> aProp = getProperty(rReadId); + std::optional<PropertyMap::Property> aProp = getProperty(rReadId); if (aProp) aNumberingProperties.emplace_back( getPropertyName(aProp->first), 0, aProp->second, beans::PropertyState_DIRECT_VALUE ); else if (rReadId == PROP_FIRST_LINE_INDENT && bDefaults) @@ -306,7 +306,7 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults beans::PropertyState_DIRECT_VALUE); } - o3tl::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME); + std::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME); if(aPropFont && !isOutlineNumbering()) aNumberingProperties.emplace_back( getPropertyName(PROP_BULLET_FONT_NAME), 0, aPropFont->second, beans::PropertyState_DIRECT_VALUE ); diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index 31bb400a36d8..8dec42778d28 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -132,7 +132,7 @@ private: OUString m_sNumStyleLink; /// list id to use for all derived numbering definitions - o3tl::optional<OUString> m_oListId; + std::optional<OUString> m_oListId; public: typedef tools::SvRef< AbstractListDef > Pointer; diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index d851c000c99b..962e11a50efc 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -257,11 +257,11 @@ void PropertyMap::Erase( PropertyIds eId ) Invalidate(); } -o3tl::optional< PropertyMap::Property > PropertyMap::getProperty( PropertyIds eId ) const +std::optional< PropertyMap::Property > PropertyMap::getProperty( PropertyIds eId ) const { std::map< PropertyIds, PropValue >::const_iterator aIter = m_vMap.find( eId ); if ( aIter == m_vMap.end() ) - return o3tl::optional<Property>(); + return std::optional<Property>(); else return std::make_pair( eId, aIter->second.getValue() ); } @@ -682,7 +682,7 @@ void SectionPropertyMap::ApplySectionProperties( const uno::Reference< beans::XP { if ( xSection.is() ) { - o3tl::optional< PropertyMap::Property > pProp = getProperty( PROP_WRITING_MODE ); + std::optional< PropertyMap::Property > pProp = getProperty( PROP_WRITING_MODE ); if ( pProp ) xSection->setPropertyValue( "WritingMode", pProp->second ); } @@ -1320,7 +1320,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) if ( pLastContext ) { bool bIsLandscape = false; - o3tl::optional< PropertyMap::Property > pProp = getProperty( PROP_IS_LANDSCAPE ); + std::optional< PropertyMap::Property > pProp = getProperty( PROP_IS_LANDSCAPE ); if ( pProp ) pProp->second >>= bIsLandscape; @@ -1554,7 +1554,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) //prepare text grid properties sal_Int32 nHeight = 1; - o3tl::optional< PropertyMap::Property > pProp = getProperty( PROP_HEIGHT ); + std::optional< PropertyMap::Property > pProp = getProperty( PROP_HEIGHT ); if ( pProp ) pProp->second >>= nHeight; @@ -1595,7 +1595,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( "Standard" ); if ( pEntry.get() ) { - o3tl::optional< PropertyMap::Property > pPropHeight = pEntry->pProperties->getProperty( PROP_CHAR_HEIGHT_ASIAN ); + std::optional< PropertyMap::Property > pPropHeight = pEntry->pProperties->getProperty( PROP_CHAR_HEIGHT_ASIAN ); if ( pPropHeight ) { double fHeight = 0; diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 9f5d54536abe..43a5beaa9ca5 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -30,7 +30,7 @@ #include <com/sun/star/drawing/XShape.hpp> #include "PropertyIds.hxx" #include <memory> -#include <o3tl/optional.hxx> +#include <optional> #include <map> #include <vector> @@ -164,7 +164,7 @@ public: void InsertProps( const PropertyMapPtr& rMap, const bool bOverwrite = true ); // Returns a copy of the property if it exists, .first is its PropertyIds and .second is its Value (type css::uno::Any) - o3tl::optional< Property > getProperty( PropertyIds eId ) const; + std::optional< Property > getProperty( PropertyIds eId ) const; // Has the property named been set (via Insert)? bool isSet( PropertyIds eId ) const; @@ -231,7 +231,7 @@ private: css::uno::Reference< css::beans::XPropertySet > m_aFirstPageStyle; css::uno::Reference< css::beans::XPropertySet > m_aFollowPageStyle; - o3tl::optional< css::table::BorderLine2 > m_oBorderLines[4]; + std::optional< css::table::BorderLine2 > m_oBorderLines[4]; sal_Int32 m_nBorderDistances[4]; BorderApply m_eBorderApply; BorderOffsetFrom m_eBorderOffsetFrom; diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 65fa272cea55..d31bfe4db00c 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -40,12 +40,11 @@ static awt::Size lcl_getOptimalWidth(const StyleSheetTablePtr& pStyleSheet, PropertyMapPtr pDefaultCharProps = pStyleSheet->GetDefaultCharProps(); vcl::Font aFont(pOut->GetFont()); - o3tl::optional<PropertyMap::Property> aFontName + std::optional<PropertyMap::Property> aFontName = pDefaultCharProps->getProperty(PROP_CHAR_FONT_NAME); if (aFontName) aFont.SetFamilyName(aFontName->second.get<OUString>()); - o3tl::optional<PropertyMap::Property> aHeight - = pDefaultCharProps->getProperty(PROP_CHAR_HEIGHT); + std::optional<PropertyMap::Property> aHeight = pDefaultCharProps->getProperty(PROP_CHAR_HEIGHT); if (aHeight) { nHeight = aHeight->second.get<double>() * 35; // points -> mm100 diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 2f0eda1f7565..633e74cac3f8 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -113,10 +113,10 @@ void TableStyleSheetEntry::AddTblStylePr( TblStyleType nType, const PropertyMapP if ( nType == pTypesToFix[i] ) { PropertyIds nChecked = pPropsToCheck[i]; - o3tl::optional<PropertyMap::Property> pChecked = pProps->getProperty(nChecked); + std::optional<PropertyMap::Property> pChecked = pProps->getProperty(nChecked); PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER; - o3tl::optional<PropertyMap::Property> pInside = pProps->getProperty(nInsideProp); + std::optional<PropertyMap::Property> pInside = pProps->getProperty(nInsideProp); if ( pChecked && pProps ) { @@ -201,7 +201,7 @@ static void lcl_mergeProps( const PropertyMapPtr& pToFill, const PropertyMapPtr& for ( unsigned i = 0 ; i != SAL_N_ELEMENTS(pPropsToCheck); i++ ) { PropertyIds nId = pPropsToCheck[i]; - o3tl::optional<PropertyMap::Property> pProp = pToAdd->getProperty(nId); + std::optional<PropertyMap::Property> pProp = pToAdd->getProperty(nId); if ( pProp ) { diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx b/writerfilter/source/dmapper/TextEffectsHandler.hxx index 54cf86392b7c..60e98d64b970 100644 --- a/writerfilter/source/dmapper/TextEffectsHandler.hxx +++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx @@ -20,7 +20,7 @@ #include <oox/helper/grabbagstack.hxx> #include <memory> -#include <o3tl/optional.hxx> +#include <optional> namespace writerfilter { namespace dmapper @@ -30,7 +30,7 @@ namespace dmapper class TextEffectsHandler : public LoggedProperties { private: - o3tl::optional<PropertyIds> maPropertyId; + std::optional<PropertyIds> maPropertyId; OUString maElementName; std::unique_ptr<oox::GrabBagStack> mpGrabBagStack; @@ -44,7 +44,7 @@ public: explicit TextEffectsHandler(sal_uInt32 aElementId); virtual ~TextEffectsHandler() override; - const o3tl::optional<PropertyIds>& getGrabBagPropertyId() const { return maPropertyId;} + const std::optional<PropertyIds>& getGrabBagPropertyId() const { return maPropertyId;} css::beans::PropertyValue getInteropGrabBag(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index d55217c708b5..31b83a855dea 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -14,7 +14,7 @@ #include <queue> #include <tuple> #include <vector> -#include <o3tl/optional.hxx> +#include <optional> #include <com/sun/star/text/WrapTextMode.hpp> #include <oox/mathml/importutils.hxx> @@ -275,7 +275,7 @@ private: sal_Int32 m_nTop = 0; sal_Int32 m_nRight = 0; sal_Int32 m_nBottom = 0; - o3tl::optional<sal_Int32> m_oZ; ///< Z-Order of the shape. + std::optional<sal_Int32> m_oZ; ///< Z-Order of the shape. sal_Int16 m_nHoriOrientRelation = 0; ///< Horizontal text::RelOrientation for drawinglayer shapes. sal_Int16 m_nVertOrientRelation = 0; ///< Vertical text::RelOrientation for drawinglayer shapes. @@ -381,7 +381,7 @@ private: sal_Int32 m_nHoriPadding, m_nVertPadding; sal_Int32 m_nHoriAlign, m_nHoriAnchor, m_nVertAlign, m_nVertAnchor; Id m_nHRule; - o3tl::optional<Id> m_oWrap; + std::optional<Id> m_oWrap; public: explicit RTFFrame(RTFParserState* pParserState); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index b0bd39d79830..d32e29fcd167 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -371,14 +371,14 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap uno::Any aLineWidth = uno::makeAny(sal_Int32(26)); sal_Int16 eWritingMode = text::WritingMode2::LR_TB; // Groupshape support - o3tl::optional<sal_Int32> oGroupLeft; - o3tl::optional<sal_Int32> oGroupTop; - o3tl::optional<sal_Int32> oGroupRight; - o3tl::optional<sal_Int32> oGroupBottom; - o3tl::optional<sal_Int32> oRelLeft; - o3tl::optional<sal_Int32> oRelTop; - o3tl::optional<sal_Int32> oRelRight; - o3tl::optional<sal_Int32> oRelBottom; + std::optional<sal_Int32> oGroupLeft; + std::optional<sal_Int32> oGroupTop; + std::optional<sal_Int32> oGroupRight; + std::optional<sal_Int32> oGroupBottom; + std::optional<sal_Int32> oRelLeft; + std::optional<sal_Int32> oRelTop; + std::optional<sal_Int32> oRelRight; + std::optional<sal_Int32> oRelBottom; // Importing these are not trivial, let the VML import do the hard work. oox::vml::FillModel aFillModel; // Gradient. @@ -386,8 +386,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap bool bOpaque = true; - o3tl::optional<sal_Int16> oRelativeWidth; - o3tl::optional<sal_Int16> oRelativeHeight; + std::optional<sal_Int16> oRelativeWidth; + std::optional<sal_Int16> oRelativeHeight; sal_Int16 nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; boost::logic::tribool obRelFlipV(boost::logic::indeterminate); @@ -725,7 +725,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap sal_Int16 nPercentage = rtl::math::round(rProperty.second.toDouble() / 10); if (nPercentage) { - o3tl::optional<sal_Int16>& rPercentage + std::optional<sal_Int16>& rPercentage = rProperty.first == "pctHoriz" ? oRelativeWidth : oRelativeHeight; rPercentage = nPercentage; } |