diff options
-rw-r--r-- | xmloff/inc/txtflde.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 24 |
2 files changed, 15 insertions, 14 deletions
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx index f98fb7c5c421..f21b85eb1b2a 100644 --- a/xmloff/inc/txtflde.hxx +++ b/xmloff/inc/txtflde.hxx @@ -32,6 +32,7 @@ #include <map> #include <set> #include <memory> +#include <optional> #include <string_view> #include "txtfld.hxx" @@ -154,10 +155,10 @@ class XMLTextFieldExport final SvXMLExport& rExport; /// store used text field master names (NULL means: don't collect) - std::unique_ptr< ::std::map< + std::optional< ::std::map< css::uno::Reference< css::text::XText >, ::std::set< OUString > > > - pUsedMasters; + moUsedMasters; public: diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 2c054d57e3f6..0beab8dd8994 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -760,7 +760,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle( Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY); // add field master to list of used field masters (if desired) - if (nullptr != pUsedMasters) + if (moUsedMasters) { Reference<XDependentTextField> xDepField(rTextField, UNO_QUERY); if (xDepField.is()) @@ -770,14 +770,14 @@ void XMLTextFieldExport::ExportFieldAutoStyle( Reference<XText> xOurText = GetToplevelText(rTextField->getAnchor()->getText()); std::map<Reference<XText>, std::set<OUString> >::iterator aMapIter = - pUsedMasters->find(xOurText); + moUsedMasters->find(xOurText); // insert a list for our XText (if necessary) - if (aMapIter == pUsedMasters->end()) + if (aMapIter == moUsedMasters->end()) { std::set<OUString> aSet; - (*pUsedMasters)[xOurText] = aSet; - aMapIter = pUsedMasters->find(xOurText); + (*moUsedMasters)[xOurText] = aSet; + aMapIter = moUsedMasters->find(xOurText); } // insert this text field master @@ -1973,18 +1973,18 @@ void XMLTextFieldExport::ExportFieldDeclarations( if (rText.is()) { // export only used masters - DBG_ASSERT(nullptr != pUsedMasters, + DBG_ASSERT(moUsedMasters.has_value(), "field masters must be recorded in order to be " "written out separately" ); - if (nullptr != pUsedMasters) + if (moUsedMasters) { std::map<Reference<XText>, std::set<OUString> > ::iterator aMapIter = - pUsedMasters->find(rText); - if (aMapIter != pUsedMasters->end()) + moUsedMasters->find(rText); + if (aMapIter != moUsedMasters->end()) { // found the set of used field masters aFieldMasters = comphelper::containerToSequence(aMapIter->second); - pUsedMasters->erase(rText); + moUsedMasters->erase(rText); } // else: XText not found -> ignore } @@ -2244,11 +2244,11 @@ void XMLTextFieldExport::ExportFieldDeclarations( void XMLTextFieldExport::SetExportOnlyUsedFieldDeclarations( bool bExportOnlyUsed) { - pUsedMasters.reset(); + moUsedMasters.reset(); // create used masters set (if none is used) if (bExportOnlyUsed) - pUsedMasters.reset( new std::map<Reference<XText>, std::set<OUString> > ); + moUsedMasters.emplace(); } void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName, |