[Libreoffice-commits] core.git: include/xmloff xmloff/source xmlsecurity/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 22 08:16:55 UTC 2021
include/xmloff/xmlictxt.hxx | 8 -
include/xmloff/xmlimp.hxx | 11 +-
xmloff/source/core/xmlimp.cxx | 100 +++++++++----------
xmlsecurity/source/helper/ooxmlsecparser.cxx | 117 +++++++++++-----------
xmlsecurity/source/helper/ooxmlsecparser.hxx | 3
xmlsecurity/source/helper/xsecparser.cxx | 141 +++++++++++++--------------
xmlsecurity/source/helper/xsecparser.hxx | 3
7 files changed, 192 insertions(+), 191 deletions(-)
New commits:
commit bebb1a3f2dc3e131f95a078f8a9c40d0491af7cd
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 21 09:34:10 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 22 10:16:20 2021 +0200
pass SvXMLNamespaceMap around by value
in SvXMLImport.
Remove an assert in XSecParser because std::move on std::optional
does not make the optional empty, unlike it's effect on std::unique_ptr.
Change-Id: Ie94d01423bf694a37e4bd7f2c0235c5f79a44efe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119302
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 3a83ff4527ff..885be2ead5ab 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -27,7 +27,7 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <rtl/ustring.hxx>
#include <xmloff/namespacemap.hxx>
-#include <memory>
+#include <optional>
namespace com::sun::star::xml::sax { class XAttributeList; }
@@ -49,10 +49,10 @@ class XMLOFF_DLLPUBLIC SvXMLImportContext : public css::xml::sax::XFastContextHa
SvXMLImport& mrImport;
oslInterlockedCount m_nRefCount;
- std::unique_ptr<SvXMLNamespaceMap> m_pRewindMap;
+ std::optional<SvXMLNamespaceMap> m_xRewindMap;
- SAL_DLLPRIVATE std::unique_ptr<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_pRewindMap); }
- SAL_DLLPRIVATE void PutRewindMap(std::unique_ptr<SvXMLNamespaceMap> p) { m_pRewindMap = std::move(p); }
+ SAL_DLLPRIVATE std::optional<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_xRewindMap); }
+ SAL_DLLPRIVATE void PutRewindMap(std::optional<SvXMLNamespaceMap> p) { m_xRewindMap = std::move(p); }
protected:
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index dc01b88ed9ef..12020802c329 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -48,6 +48,7 @@
#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
#include <o3tl/typed_flags_set.hxx>
#include <memory>
+#include <optional>
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::beans { struct NamedValue; }
@@ -214,7 +215,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
std::unique_ptr<SvXMLImport_Impl> mpImpl; // dummy
- std::unique_ptr<SvXMLNamespaceMap> mpNamespaceMap;
+ std::optional<SvXMLNamespaceMap> mxNamespaceMap;
std::unique_ptr<SvXMLUnitConverter> mpUnitConv;
std::stack<SvXMLImportContextRef, std::vector<SvXMLImportContextRef>>
maContexts;
@@ -240,8 +241,8 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
static void initializeNamespaceMaps();
void registerNamespaces();
public:
- static std::unique_ptr<SvXMLNamespaceMap> processNSAttributes(
- std::unique_ptr<SvXMLNamespaceMap> & rpNamespaceMap,
+ static std::optional<SvXMLNamespaceMap> processNSAttributes(
+ std::optional<SvXMLNamespaceMap> & rpNamespaceMap,
SvXMLImport *const pImport,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
private:
@@ -394,8 +395,8 @@ public:
static OUString getNamespacePrefixFromURI( const OUString& rURI );
static sal_Int32 getTokenFromName(const OUString& sName);
- SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
- const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
+ SvXMLNamespaceMap& GetNamespaceMap() { return *mxNamespaceMap; }
+ const SvXMLNamespaceMap& GetNamespaceMap() const { return *mxNamespaceMap; }
const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
const css::uno::Reference< css::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index d3973c87e16c..48a83f7d1b9f 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -354,42 +354,42 @@ void SvXMLImport::InitCtor_()
if( mnImportFlags != SvXMLImportFlags::NONE )
{
// implicit "xml" namespace prefix
- mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML), XML_NAMESPACE_XML );
- mpNamespaceMap->Add( "_office", GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
- mpNamespaceMap->Add( "_office_ooo", GetXMLToken(XML_N_OFFICE_EXT), XML_NAMESPACE_OFFICE_EXT );
- mpNamespaceMap->Add( "_ooo", GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
- mpNamespaceMap->Add( "_style", GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
- mpNamespaceMap->Add( "_text", GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
- mpNamespaceMap->Add( "_table", GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
- mpNamespaceMap->Add( "_table_ooo", GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT );
- mpNamespaceMap->Add( "_draw", GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
- mpNamespaceMap->Add( "_draw_ooo", GetXMLToken(XML_N_DRAW_EXT), XML_NAMESPACE_DRAW_EXT );
- mpNamespaceMap->Add( "_dr3d", GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
- mpNamespaceMap->Add( "_fo", GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
- mpNamespaceMap->Add( "_xlink", GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
- mpNamespaceMap->Add( "_dc", GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
- mpNamespaceMap->Add( "_dom", GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
- mpNamespaceMap->Add( "_meta", GetXMLToken(XML_N_META), XML_NAMESPACE_META );
- mpNamespaceMap->Add( "_number", GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
- mpNamespaceMap->Add( "_svg", GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
- mpNamespaceMap->Add( "_chart", GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
- mpNamespaceMap->Add( "_math", GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
- mpNamespaceMap->Add( "_form", GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
- mpNamespaceMap->Add( "_script", GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
- mpNamespaceMap->Add( "_config", GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
- mpNamespaceMap->Add( "_xforms", GetXMLToken(XML_N_XFORMS_1_0), XML_NAMESPACE_XFORMS );
- mpNamespaceMap->Add( "_formx", GetXMLToken( XML_N_FORMX ), XML_NAMESPACE_FORMX );
- mpNamespaceMap->Add( "_xsd", GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
- mpNamespaceMap->Add( "_xsi", GetXMLToken(XML_N_XSI), XML_NAMESPACE_XFORMS );
- mpNamespaceMap->Add( "_ooow", GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
- mpNamespaceMap->Add( "_oooc", GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
- mpNamespaceMap->Add( "_field", GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
- mpNamespaceMap->Add( "_of", GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
- mpNamespaceMap->Add( "_xhtml", GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
- mpNamespaceMap->Add( "_css3text", GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT );
-
- mpNamespaceMap->Add( "_calc_libo", GetXMLToken(XML_N_CALC_EXT), XML_NAMESPACE_CALC_EXT);
- mpNamespaceMap->Add( "_office_libo",
+ mxNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML), XML_NAMESPACE_XML );
+ mxNamespaceMap->Add( "_office", GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+ mxNamespaceMap->Add( "_office_ooo", GetXMLToken(XML_N_OFFICE_EXT), XML_NAMESPACE_OFFICE_EXT );
+ mxNamespaceMap->Add( "_ooo", GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ mxNamespaceMap->Add( "_style", GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
+ mxNamespaceMap->Add( "_text", GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
+ mxNamespaceMap->Add( "_table", GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
+ mxNamespaceMap->Add( "_table_ooo", GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT );
+ mxNamespaceMap->Add( "_draw", GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+ mxNamespaceMap->Add( "_draw_ooo", GetXMLToken(XML_N_DRAW_EXT), XML_NAMESPACE_DRAW_EXT );
+ mxNamespaceMap->Add( "_dr3d", GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
+ mxNamespaceMap->Add( "_fo", GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
+ mxNamespaceMap->Add( "_xlink", GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ mxNamespaceMap->Add( "_dc", GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
+ mxNamespaceMap->Add( "_dom", GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
+ mxNamespaceMap->Add( "_meta", GetXMLToken(XML_N_META), XML_NAMESPACE_META );
+ mxNamespaceMap->Add( "_number", GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
+ mxNamespaceMap->Add( "_svg", GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
+ mxNamespaceMap->Add( "_chart", GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
+ mxNamespaceMap->Add( "_math", GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
+ mxNamespaceMap->Add( "_form", GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
+ mxNamespaceMap->Add( "_script", GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
+ mxNamespaceMap->Add( "_config", GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
+ mxNamespaceMap->Add( "_xforms", GetXMLToken(XML_N_XFORMS_1_0), XML_NAMESPACE_XFORMS );
+ mxNamespaceMap->Add( "_formx", GetXMLToken( XML_N_FORMX ), XML_NAMESPACE_FORMX );
+ mxNamespaceMap->Add( "_xsd", GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
+ mxNamespaceMap->Add( "_xsi", GetXMLToken(XML_N_XSI), XML_NAMESPACE_XFORMS );
+ mxNamespaceMap->Add( "_ooow", GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
+ mxNamespaceMap->Add( "_oooc", GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
+ mxNamespaceMap->Add( "_field", GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
+ mxNamespaceMap->Add( "_of", GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+ mxNamespaceMap->Add( "_xhtml", GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ mxNamespaceMap->Add( "_css3text", GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT );
+
+ mxNamespaceMap->Add( "_calc_libo", GetXMLToken(XML_N_CALC_EXT), XML_NAMESPACE_CALC_EXT);
+ mxNamespaceMap->Add( "_office_libo",
GetXMLToken(XML_N_LO_EXT), XML_NAMESPACE_LO_EXT);
}
@@ -409,7 +409,7 @@ SvXMLImport::SvXMLImport(
SvXMLImportFlags nImportFlags,
const css::uno::Sequence< OUString > & sSupportedServiceNames )
: mpImpl( new SvXMLImport_Impl(xContext, implementationName, sSupportedServiceNames) ),
- mpNamespaceMap( new SvXMLNamespaceMap ),
+ mxNamespaceMap( SvXMLNamespaceMap() ),
mpUnitConv( new SvXMLUnitConverter( xContext,
util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH,
@@ -677,12 +677,12 @@ void SAL_CALL SvXMLImport::endDocument()
}
}
-std::unique_ptr<SvXMLNamespaceMap> SvXMLImport::processNSAttributes(
- std::unique_ptr<SvXMLNamespaceMap> & rpNamespaceMap,
+std::optional<SvXMLNamespaceMap> SvXMLImport::processNSAttributes(
+ std::optional<SvXMLNamespaceMap> & rpNamespaceMap,
SvXMLImport *const pImport, // TODO???
const uno::Reference< xml::sax::XAttributeList >& xAttrList)
{
- std::unique_ptr<SvXMLNamespaceMap> pRewindMap;
+ std::optional<SvXMLNamespaceMap> pRewindMap;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for( sal_Int16 i=0; i < nAttrCount; i++ )
{
@@ -708,7 +708,7 @@ std::unique_ptr<SvXMLNamespaceMap> SvXMLImport::processNSAttributes(
if( !pRewindMap )
{
pRewindMap = std::move(rpNamespaceMap);
- rpNamespaceMap.reset(new SvXMLNamespaceMap(*pRewindMap));
+ rpNamespaceMap.emplace(*pRewindMap);
}
const OUString& rAttrValue = xAttrList->getValueByIndex( i );
@@ -778,7 +778,7 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
maNamespaceAttrList->Clear();
maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList );
- std::unique_ptr<SvXMLNamespaceMap> pRewindMap = processNSAttributes(mpNamespaceMap, this, maNamespaceAttrList);
+ std::optional<SvXMLNamespaceMap> pRewindMap = processNSAttributes(mxNamespaceMap, this, maNamespaceAttrList);
SvXMLImportContextRef xContext;
const bool bRootContext = maContexts.empty();
@@ -862,12 +862,12 @@ void SAL_CALL SvXMLImport::endFastElement (sal_Int32 Element)
}
SvXMLImportContextRef xContext = std::move(maContexts.top());
// Get a namespace map to rewind.
- std::unique_ptr<SvXMLNamespaceMap> pRewindMap = xContext->TakeRewindMap();
+ std::optional<SvXMLNamespaceMap> pRewindMap = xContext->TakeRewindMap();
maContexts.pop();
xContext->endFastElement( Element );
// Rewind a namespace map.
if (pRewindMap)
- mpNamespaceMap = std::move(pRewindMap);
+ mxNamespaceMap = std::move(pRewindMap);
}
void SAL_CALL SvXMLImport::endUnknownElement (const OUString & rPrefix, const OUString & rLocalName)
@@ -2158,9 +2158,9 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
sal_uInt16 nDefaultNamespace = XML_NAMESPACE_UNKNOWN;
if (!maDefaultNamespaces.empty())
nDefaultNamespace = maDefaultNamespaces.top();
- SvXMLImport::processNSAttributes(mrImport->mpNamespaceMap, mrImport.get(), xAttrList);
+ SvXMLImport::processNSAttributes(mrImport->mxNamespaceMap, mrImport.get(), xAttrList);
OUString aLocalName;
- sal_uInt16 nPrefix = mrImport->mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+ sal_uInt16 nPrefix = mrImport->mxNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
sal_Int32 mnElement = NAMESPACE_TOKEN( nPrefix ) | SvXMLImport::getTokenFromName( aLocalName );
mxFastAttributes->clear();
@@ -2171,7 +2171,7 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
const OUString& rAttrValue = xAttrList->getValueByIndex( i );
if (rAttrName == "xmlns")
{
- sal_uInt16 nNamespaceKey = mrImport->mpNamespaceMap->GetKeyByName(rAttrValue);
+ sal_uInt16 nNamespaceKey = mrImport->mxNamespaceMap->GetKeyByName(rAttrValue);
if (nNamespaceKey != XML_NAMESPACE_UNKNOWN)
{
nDefaultNamespace = nNamespaceKey;
@@ -2184,7 +2184,7 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
auto const nToken = SvXMLImport::getTokenFromName(rAttrName);
if (nToken == xmloff::XML_TOKEN_INVALID)
{
- mxFastAttributes->addUnknown(mrImport->mpNamespaceMap->GetNameByKey(nDefaultNamespace),
+ mxFastAttributes->addUnknown(mrImport->mxNamespaceMap->GetNameByKey(nDefaultNamespace),
OUStringToOString(rAttrName, RTL_TEXTENCODING_UTF8),
OUStringToOString(rAttrValue, RTL_TEXTENCODING_UTF8));
}
@@ -2199,7 +2199,7 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
OUString aLocalAttrName;
OUString aNamespace;
// don't add unknown namespaces to the map
- sal_uInt16 const nAttrPrefix = mrImport->mpNamespaceMap->GetKeyByQName(
+ sal_uInt16 const nAttrPrefix = mrImport->mxNamespaceMap->GetKeyByQName(
rAttrName, nullptr, &aLocalAttrName, &aNamespace, SvXMLNamespaceMap::QNameMode::AttrValue);
if( XML_NAMESPACE_XMLNS == nAttrPrefix )
continue; // ignore
@@ -2223,7 +2223,7 @@ void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
void SAL_CALL SvXMLLegacyToFastDocHandler::endElement( const OUString& rName )
{
OUString aLocalName;
- sal_uInt16 nPrefix = mrImport->mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+ sal_uInt16 nPrefix = mrImport->mxNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
sal_Int32 mnElement = NAMESPACE_TOKEN( nPrefix ) | SvXMLImport::getTokenFromName(aLocalName);
mrImport->endFastElement( mnElement );
maDefaultNamespaces.pop();
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx
index c88c4efbbe69..a25c7ecffa01 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx
@@ -28,11 +28,11 @@ class OOXMLSecParser::Context
friend class OOXMLSecParser;
OOXMLSecParser & m_rParser;
private:
- std::unique_ptr<SvXMLNamespaceMap> m_pOldNamespaceMap;
+ std::optional<SvXMLNamespaceMap> m_pOldNamespaceMap;
public:
Context(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: m_rParser(rParser)
, m_pOldNamespaceMap(std::move(pOldNamespaceMap))
{
@@ -50,7 +50,7 @@ class OOXMLSecParser::Context
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/);
virtual void Characters(OUString const& /*rChars*/)
@@ -67,7 +67,7 @@ class OOXMLSecParser::UnknownContext
{
public:
UnknownContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -80,7 +80,7 @@ class OOXMLSecParser::UnknownContext
};
auto OOXMLSecParser::Context::CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/)
-> std::unique_ptr<Context>
{
@@ -106,7 +106,7 @@ class OOXMLSecParser::ReferencedContextImpl
public:
ReferencedContextImpl(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_isReferenced(isReferenced)
@@ -132,7 +132,7 @@ class OOXMLSecParser::DsX509CertificateContext
public:
DsX509CertificateContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -153,7 +153,7 @@ class OOXMLSecParser::DsX509SerialNumberContext
public:
DsX509SerialNumberContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -174,7 +174,7 @@ class OOXMLSecParser::DsX509IssuerNameContext
public:
DsX509IssuerNameContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -196,7 +196,7 @@ class OOXMLSecParser::DsX509IssuerSerialContext
public:
DsX509IssuerSerialContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rIssuerName, OUString & rSerialNumber)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rX509IssuerName(rIssuerName)
@@ -205,7 +205,7 @@ class OOXMLSecParser::DsX509IssuerSerialContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerName")
@@ -233,7 +233,7 @@ class OOXMLSecParser::DsX509DataContext
public:
DsX509DataContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -244,7 +244,7 @@ class OOXMLSecParser::DsX509DataContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerSerial")
@@ -267,7 +267,7 @@ class OOXMLSecParser::DsKeyInfoContext
{
public:
DsKeyInfoContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -279,7 +279,7 @@ class OOXMLSecParser::DsKeyInfoContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "X509Data")
@@ -303,7 +303,7 @@ class OOXMLSecParser::DsSignatureValueContext
public:
DsSignatureValueContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -333,7 +333,7 @@ class OOXMLSecParser::DsDigestValueContext
public:
DsDigestValueContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -360,7 +360,7 @@ class OOXMLSecParser::DsDigestMethodContext
public:
DsDigestMethodContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_Int32 & rReferenceDigestID)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rReferenceDigestID(rReferenceDigestID)
@@ -399,7 +399,7 @@ class OOXMLSecParser::DsTransformContext
public:
DsTransformContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool & rIsC14N)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rIsC14N(rIsC14N)
@@ -426,7 +426,7 @@ class OOXMLSecParser::DsTransformsContext
public:
DsTransformsContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool & rIsC14N)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rIsC14N(rIsC14N)
@@ -434,7 +434,7 @@ class OOXMLSecParser::DsTransformsContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "Transform")
@@ -459,7 +459,7 @@ class OOXMLSecParser::DsReferenceContext
public:
DsReferenceContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -503,7 +503,7 @@ class OOXMLSecParser::DsReferenceContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "Transforms")
@@ -527,7 +527,7 @@ class OOXMLSecParser::DsSignatureMethodContext
{
public:
DsSignatureMethodContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -549,7 +549,7 @@ class OOXMLSecParser::DsSignedInfoContext
{
public:
DsSignedInfoContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -566,7 +566,7 @@ class OOXMLSecParser::DsSignedInfoContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureMethod")
@@ -591,7 +591,7 @@ class OOXMLSecParser::XadesCertDigestContext
public:
XadesCertDigestContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rDigestValue, sal_Int32 & rReferenceDigestID)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rDigestValue(rDigestValue)
@@ -600,7 +600,7 @@ class OOXMLSecParser::XadesCertDigestContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "DigestMethod")
@@ -626,7 +626,7 @@ class OOXMLSecParser::XadesCertContext
public:
XadesCertContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -645,7 +645,7 @@ class OOXMLSecParser::XadesCertContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "CertDigest")
@@ -665,14 +665,14 @@ class OOXMLSecParser::XadesSigningCertificateContext
{
public:
XadesSigningCertificateContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "Cert")
@@ -691,7 +691,7 @@ class OOXMLSecParser::XadesSigningTimeContext
public:
XadesSigningTimeContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -720,7 +720,7 @@ class OOXMLSecParser::XadesSignedSignaturePropertiesContext
{
public:
XadesSignedSignaturePropertiesContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -733,7 +733,7 @@ class OOXMLSecParser::XadesSignedSignaturePropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "SigningTime")
@@ -754,7 +754,7 @@ class OOXMLSecParser::XadesSignedPropertiesContext
{
public:
XadesSignedPropertiesContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -767,7 +767,7 @@ class OOXMLSecParser::XadesSignedPropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "SignedSignatureProperties")
@@ -784,7 +784,7 @@ class OOXMLSecParser::XadesQualifyingPropertiesContext
{
public:
XadesQualifyingPropertiesContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -797,7 +797,7 @@ class OOXMLSecParser::XadesQualifyingPropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "SignedProperties")
@@ -817,7 +817,7 @@ class OOXMLSecParser::MsodigsigSetupIDContext
public:
MsodigsigSetupIDContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -838,7 +838,7 @@ class OOXMLSecParser::MsodigsigSignatureCommentsContext
public:
MsodigsigSignatureCommentsContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -860,7 +860,7 @@ class OOXMLSecParser::MsodigsigSignatureInfoV1Context
public:
MsodigsigSignatureInfoV1Context(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -873,7 +873,7 @@ class OOXMLSecParser::MsodigsigSignatureInfoV1Context
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_MSODIGSIG && rName == "SetupID")
@@ -916,7 +916,7 @@ class OOXMLSecParser::MdssiValueContext
public:
MdssiValueContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -937,7 +937,7 @@ class OOXMLSecParser::MdssiSignatureTimeContext
public:
MdssiSignatureTimeContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -945,7 +945,7 @@ class OOXMLSecParser::MdssiSignatureTimeContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_MDSSI && rName == "Value")
@@ -968,7 +968,7 @@ class OOXMLSecParser::DsSignaturePropertyContext
public:
DsSignaturePropertyContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1003,7 +1003,7 @@ class OOXMLSecParser::DsSignaturePropertyContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_MDSSI && rName == "SignatureTime")
@@ -1024,7 +1024,7 @@ class OOXMLSecParser::DsSignaturePropertiesContext
{
public:
DsSignaturePropertiesContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1037,7 +1037,7 @@ class OOXMLSecParser::DsSignaturePropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureProperty")
@@ -1053,7 +1053,7 @@ class OOXMLSecParser::DsManifestContext
{
public:
DsManifestContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1074,7 +1074,7 @@ class OOXMLSecParser::DsManifestContext
#endif
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "Reference")
@@ -1095,7 +1095,7 @@ class OOXMLSecParser::DsObjectContext
public:
DsObjectContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
// init with "false" here - the Signature element can't be referenced by its child
: OOXMLSecParser::ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), false)
{
@@ -1150,7 +1150,7 @@ class OOXMLSecParser::DsObjectContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureProperties")
@@ -1174,7 +1174,7 @@ class OOXMLSecParser::DsSignatureContext
{
public:
DsSignatureContext(OOXMLSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -1192,7 +1192,7 @@ class OOXMLSecParser::DsSignatureContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignedInfo")
@@ -1217,7 +1217,7 @@ class OOXMLSecParser::DsSignatureContext
OOXMLSecParser::OOXMLSecParser(XMLSignatureHelper& rXMLSignatureHelper, XSecController* pXSecController)
- : m_pNamespaceMap(new SvXMLNamespaceMap)
+ : m_pNamespaceMap(SvXMLNamespaceMap())
, m_pXSecController(pXSecController)
,m_rXMLSignatureHelper(rXMLSignatureHelper)
{
@@ -1262,7 +1262,7 @@ void SAL_CALL OOXMLSecParser::endDocument()
void SAL_CALL OOXMLSecParser::startElement(const OUString& rName, const uno::Reference<xml::sax::XAttributeList>& xAttribs)
{
assert(m_pNamespaceMap);
- std::unique_ptr<SvXMLNamespaceMap> pRewindMap(
+ std::optional<SvXMLNamespaceMap> pRewindMap(
SvXMLImport::processNSAttributes(m_pNamespaceMap, nullptr, xAttribs));
OUString localName;
@@ -1291,7 +1291,6 @@ void SAL_CALL OOXMLSecParser::startElement(const OUString& rName, const uno::Ref
}
m_ContextStack.push(std::move(pContext));
- assert(!pRewindMap);
m_ContextStack.top()->StartElement(xAttribs);
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.hxx b/xmlsecurity/source/helper/ooxmlsecparser.hxx
index 4f11302ff765..9d0c7efe470d 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.hxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.hxx
@@ -16,6 +16,7 @@
#include <xmloff/namespacemap.hxx>
+#include <optional>
#include <stack>
class XSecController;
@@ -71,7 +72,7 @@ private:
class DsigSignaturesContext;
std::stack<std::unique_ptr<Context>> m_ContextStack;
- std::unique_ptr<SvXMLNamespaceMap> m_pNamespaceMap;
+ std::optional<SvXMLNamespaceMap> m_pNamespaceMap;
XSecController* m_pXSecController;
css::uno::Reference<css::xml::sax::XDocumentHandler> m_xNextHandler;
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index d191c540ce8f..f12e7031e349 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -36,11 +36,11 @@ class XSecParser::Context
friend class XSecParser;
XSecParser & m_rParser;
private:
- std::unique_ptr<SvXMLNamespaceMap> m_pOldNamespaceMap;
+ std::optional<SvXMLNamespaceMap> m_pOldNamespaceMap;
public:
Context(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: m_rParser(rParser)
, m_pOldNamespaceMap(std::move(pOldNamespaceMap))
{
@@ -58,7 +58,7 @@ class XSecParser::Context
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/);
virtual void Characters(OUString const& /*rChars*/)
@@ -75,7 +75,7 @@ class XSecParser::UnknownContext
{
public:
UnknownContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -88,7 +88,7 @@ class XSecParser::UnknownContext
};
auto XSecParser::Context::CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/)
-> std::unique_ptr<Context>
{
@@ -114,7 +114,7 @@ class XSecParser::ReferencedContextImpl
public:
ReferencedContextImpl(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_isReferenced(isReferenced)
@@ -140,7 +140,7 @@ class XSecParser::LoPGPOwnerContext
public:
LoPGPOwnerContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -164,7 +164,7 @@ class XSecParser::DsPGPKeyPacketContext
public:
DsPGPKeyPacketContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -188,7 +188,7 @@ class XSecParser::DsPGPKeyIDContext
public:
DsPGPKeyIDContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -209,7 +209,7 @@ class XSecParser::DsPGPDataContext
{
public:
DsPGPDataContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -221,7 +221,7 @@ class XSecParser::DsPGPDataContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "PGPKeyID")
@@ -248,7 +248,7 @@ class XSecParser::DsX509CertificateContext
public:
DsX509CertificateContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -269,7 +269,7 @@ class XSecParser::DsX509SerialNumberContext
public:
DsX509SerialNumberContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -290,7 +290,7 @@ class XSecParser::DsX509IssuerNameContext
public:
DsX509IssuerNameContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -312,7 +312,7 @@ class XSecParser::DsX509IssuerSerialContext
public:
DsX509IssuerSerialContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rIssuerName, OUString & rSerialNumber)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rX509IssuerName(rIssuerName)
@@ -321,7 +321,7 @@ class XSecParser::DsX509IssuerSerialContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerName")
@@ -349,7 +349,7 @@ class XSecParser::DsX509DataContext
public:
DsX509DataContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -360,7 +360,7 @@ class XSecParser::DsX509DataContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerSerial")
@@ -383,7 +383,7 @@ class XSecParser::DsKeyInfoContext
{
public:
DsKeyInfoContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -395,7 +395,7 @@ class XSecParser::DsKeyInfoContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "X509Data")
@@ -422,7 +422,7 @@ class XSecParser::DsSignatureValueContext
public:
DsSignatureValueContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -452,7 +452,7 @@ class XSecParser::DsDigestValueContext
public:
DsDigestValueContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -479,7 +479,7 @@ class XSecParser::DsDigestMethodContext
public:
DsDigestMethodContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_Int32 & rReferenceDigestID)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rReferenceDigestID(rReferenceDigestID)
@@ -518,7 +518,7 @@ class XSecParser::DsTransformContext
public:
DsTransformContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool & rIsC14N)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rIsC14N(rIsC14N)
@@ -548,7 +548,7 @@ class XSecParser::DsTransformsContext
public:
DsTransformsContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool & rIsC14N)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rIsC14N(rIsC14N)
@@ -556,7 +556,7 @@ class XSecParser::DsTransformsContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "Transform")
@@ -581,7 +581,7 @@ class XSecParser::DsReferenceContext
public:
DsReferenceContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -625,7 +625,7 @@ class XSecParser::DsReferenceContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "Transforms")
@@ -649,7 +649,7 @@ class XSecParser::DsSignatureMethodContext
{
public:
DsSignatureMethodContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -671,7 +671,7 @@ class XSecParser::DsSignedInfoContext
{
public:
DsSignedInfoContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -688,7 +688,7 @@ class XSecParser::DsSignedInfoContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureMethod")
@@ -712,7 +712,7 @@ class XSecParser::XadesEncapsulatedX509CertificateContext
public:
XadesEncapsulatedX509CertificateContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -739,7 +739,7 @@ class XSecParser::XadesCertificateValuesContext
{
public:
XadesCertificateValuesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -751,7 +751,7 @@ class XSecParser::XadesCertificateValuesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "EncapsulatedX509Certificate")
@@ -768,7 +768,7 @@ class XSecParser::XadesUnsignedSignaturePropertiesContext
{
public:
XadesUnsignedSignaturePropertiesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -780,7 +780,7 @@ class XSecParser::XadesUnsignedSignaturePropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "CertificateValues")
@@ -811,7 +811,7 @@ class XSecParser::XadesUnsignedPropertiesContext
{
public:
XadesUnsignedPropertiesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -823,7 +823,7 @@ class XSecParser::XadesUnsignedPropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "UnsignedSignatureProperties")
@@ -843,7 +843,7 @@ class XSecParser::LoSignatureLineIdContext
public:
LoSignatureLineIdContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -875,7 +875,7 @@ class XSecParser::LoSignatureLineValidImageContext
public:
LoSignatureLineValidImageContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -907,7 +907,7 @@ class XSecParser::LoSignatureLineInvalidImageContext
public:
LoSignatureLineInvalidImageContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -936,14 +936,14 @@ class XSecParser::LoSignatureLineContext
{
public:
LoSignatureLineContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_LO_EXT && rName == "SignatureLineId")
@@ -971,7 +971,7 @@ class XSecParser::XadesCertDigestContext
public:
XadesCertDigestContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rDigestValue, sal_Int32 & rReferenceDigestID)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rDigestValue(rDigestValue)
@@ -980,7 +980,7 @@ class XSecParser::XadesCertDigestContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "DigestMethod")
@@ -1006,7 +1006,7 @@ class XSecParser::XadesCertContext
public:
XadesCertContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1025,7 +1025,7 @@ class XSecParser::XadesCertContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "CertDigest")
@@ -1045,14 +1045,14 @@ class XSecParser::XadesSigningCertificateContext
{
public:
XadesSigningCertificateContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "Cert")
@@ -1071,7 +1071,7 @@ class XSecParser::XadesSigningTimeContext
public:
XadesSigningTimeContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1100,7 +1100,7 @@ class XSecParser::XadesSignedSignaturePropertiesContext
{
public:
XadesSignedSignaturePropertiesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1113,7 +1113,7 @@ class XSecParser::XadesSignedSignaturePropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "SigningTime")
@@ -1138,7 +1138,7 @@ class XSecParser::XadesSignedPropertiesContext
{
public:
XadesSignedPropertiesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1151,7 +1151,7 @@ class XSecParser::XadesSignedPropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "SignedSignatureProperties")
@@ -1168,7 +1168,7 @@ class XSecParser::XadesQualifyingPropertiesContext
{
public:
XadesQualifyingPropertiesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1181,7 +1181,7 @@ class XSecParser::XadesQualifyingPropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_XADES132 && rName == "SignedProperties")
@@ -1204,7 +1204,7 @@ class XSecParser::DcDateContext
public:
DcDateContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -1225,7 +1225,7 @@ class XSecParser::DcDescriptionContext
public:
DcDescriptionContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
OUString & rValue)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
, m_rValue(rValue)
@@ -1249,7 +1249,7 @@ class XSecParser::DsSignaturePropertyContext
public:
DsSignaturePropertyContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1285,7 +1285,7 @@ class XSecParser::DsSignaturePropertyContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DC && rName == "date")
@@ -1307,7 +1307,7 @@ class XSecParser::DsSignaturePropertiesContext
{
public:
DsSignaturePropertiesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
bool const isReferenced)
: ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), isReferenced)
{
@@ -1320,7 +1320,7 @@ class XSecParser::DsSignaturePropertiesContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureProperty")
@@ -1336,7 +1336,7 @@ class XSecParser::DsObjectContext
{
public:
DsObjectContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
// init with "false" here - the Signature element can't be referenced by its child
: XSecParser::ReferencedContextImpl(rParser, std::move(pOldNamespaceMap), false)
{
@@ -1349,7 +1349,7 @@ class XSecParser::DsObjectContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureProperties")
@@ -1370,7 +1370,7 @@ class XSecParser::DsSignatureContext
{
public:
DsSignatureContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
@@ -1388,7 +1388,7 @@ class XSecParser::DsSignatureContext
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "SignedInfo")
@@ -1416,13 +1416,13 @@ class XSecParser::DsigSignaturesContext
{
public:
DsigSignaturesContext(XSecParser & rParser,
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap)
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap)
: XSecParser::Context(rParser, std::move(pOldNamespaceMap))
{
}
virtual std::unique_ptr<Context> CreateChildContext(
- std::unique_ptr<SvXMLNamespaceMap> pOldNamespaceMap,
+ std::optional<SvXMLNamespaceMap> pOldNamespaceMap,
sal_uInt16 const nNamespace, OUString const& rName) override
{
if (nNamespace == XML_NAMESPACE_DS && rName == "Signature")
@@ -1436,7 +1436,7 @@ class XSecParser::DsigSignaturesContext
XSecParser::XSecParser(XMLSignatureHelper& rXMLSignatureHelper,
XSecController* pXSecController)
- : m_pNamespaceMap(new SvXMLNamespaceMap)
+ : m_pNamespaceMap(SvXMLNamespaceMap())
, m_pXSecController(pXSecController)
, m_rXMLSignatureHelper(rXMLSignatureHelper)
{
@@ -1498,7 +1498,7 @@ void SAL_CALL XSecParser::startElement(
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs )
{
assert(m_pNamespaceMap);
- std::unique_ptr<SvXMLNamespaceMap> pRewindMap(
+ std::optional<SvXMLNamespaceMap> pRewindMap(
SvXMLImport::processNSAttributes(m_pNamespaceMap, nullptr, xAttribs));
OUString localName;
@@ -1527,7 +1527,6 @@ void SAL_CALL XSecParser::startElement(
}
m_ContextStack.push(std::move(pContext));
- assert(!pRewindMap);
try
{
diff --git a/xmlsecurity/source/helper/xsecparser.hxx b/xmlsecurity/source/helper/xsecparser.hxx
index 86f6154ddc93..fa2d4a8bc4ab 100644
--- a/xmlsecurity/source/helper/xsecparser.hxx
+++ b/xmlsecurity/source/helper/xsecparser.hxx
@@ -26,6 +26,7 @@
#include <xmloff/namespacemap.hxx>
+#include <optional>
#include <stack>
class XMLSignatureHelper;
@@ -98,7 +99,7 @@ private:
class DsigSignaturesContext;
std::stack<std::unique_ptr<Context>> m_ContextStack;
- std::unique_ptr<SvXMLNamespaceMap> m_pNamespaceMap;
+ std::optional<SvXMLNamespaceMap> m_pNamespaceMap;
/*
* the XSecController collaborating with XSecParser
More information about the Libreoffice-commits
mailing list