summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-11-30 18:29:37 +0100
committerMichael Stahl <mstahl@redhat.com>2017-11-30 22:32:46 +0100
commitf7a5335ef50f4a9775703a038006dfb983a50a15 (patch)
tree979d14b4145c5b1cf2809b5d3eab32ff4a705ef7 /xmloff
parentebb34571c19c5ac939fbf5aed2ab66ee18e298dc (diff)
xmloff: turn SvXMLImportContext into a no-op base class
Fix the non-obvious and potentially dangerous recursion that is implicit in xmloff's context code. SvXMLImportContext::CreateChildContext() now always creates a SvXMLImportContext, does not delegate to SvXMLImport. Rename CreateContext to CreateDocumentContext, to make its purpose of creating only the top-level context more obvious. With the previous changes to CreateContext overrides in sw, reportdesign and dbaccess, this hopefully shouldn't break anything. Change-Id: I9e147bf6297bbac9e8470454881da73f6e39db0a
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/SchXMLImport.hxx2
-rw-r--r--xmloff/inc/xmlversion.hxx4
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx7
-rw-r--r--xmloff/source/core/xmlictxt.cxx6
-rw-r--r--xmloff/source/core/xmlimp.cxx4
-rw-r--r--xmloff/source/draw/animationimport.cxx8
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx4
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx5
-rw-r--r--xmloff/source/meta/MetaImportComponent.cxx6
-rw-r--r--xmloff/source/meta/xmlversion.cxx4
-rw-r--r--xmloff/source/text/XMLAutoTextEventImport.cxx4
-rw-r--r--xmloff/source/text/XMLAutoTextEventImport.hxx2
12 files changed, 28 insertions, 28 deletions
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 4119496c5894..3248d4ceadbd 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -154,7 +154,7 @@ private:
rtl::Reference<SchXMLImportHelper> maImportHelper;
protected:
- virtual SvXMLImportContext *CreateContext(
+ virtual SvXMLImportContext *CreateDocumentContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/inc/xmlversion.hxx b/xmloff/inc/xmlversion.hxx
index e709efb6f5a4..e39cfdda5521 100644
--- a/xmloff/inc/xmlversion.hxx
+++ b/xmloff/inc/xmlversion.hxx
@@ -56,9 +56,7 @@ private:
protected:
- // This method is called after the namespace map has been updated, but
- // before a context for the current element has been pushed.
- virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
+ virtual SvXMLImportContext *CreateDocumentContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index d3c40c78887d..b7dc42566ec3 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -510,7 +510,8 @@ SchXMLImport::~SchXMLImport() throw ()
// create the main context (subcontexts are created
// by the one created here)
-SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUString& rLocalName,
+SvXMLImportContext *SchXMLImport::CreateDocumentContext(sal_uInt16 const nPrefix,
+ const OUString& rLocalName,
const Reference< xml::sax::XAttributeList >& xAttrList )
{
SvXMLImportContext* pContext = nullptr;
@@ -540,12 +541,12 @@ SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUStr
xDPS->getDocumentProperties());
} else {
pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
- ? SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList )
+ ? SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList)
: new SchXMLDocContext( *maImportHelper.get(), *this,
nPrefix, rLocalName );
}
} else {
- pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
+ pContext = SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList);
}
return pContext;
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index e1805057dcdd..a00539afce6b 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -48,10 +48,10 @@ SvXMLImportContext::~SvXMLImportContext()
}
SvXMLImportContextRef SvXMLImportContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& )
{
- return mrImport.CreateContext( nPrefix, rLocalName, xAttrList );
+ return new SvXMLImportContext(mrImport, nPrefix, rLocalName);
}
void SvXMLImportContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& )
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index f96940aeb575..676d6be7d071 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -308,7 +308,7 @@ public:
::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
};
-SvXMLImportContext *SvXMLImport::CreateContext( sal_uInt16 nPrefix,
+SvXMLImportContext *SvXMLImport::CreateDocumentContext(sal_uInt16 const nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList >& )
{
@@ -719,7 +719,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
}
else
{
- xContext.set(CreateContext( nPrefix, aLocalName, xAttrList ));
+ xContext.set(CreateDocumentContext(nPrefix, aLocalName, xAttrList));
if( (nPrefix & XML_NAMESPACE_UNKNOWN_FLAG) != 0 &&
dynamic_cast< const SvXMLImportContext*>(xContext.get()) != nullptr )
{
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index 8134fd671499..75553fa8a1cd 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -1243,7 +1243,7 @@ class AnimationsImport: public SvXMLImport, public XAnimationNodeSupplier
public:
explicit AnimationsImport( const Reference< XComponentContext > & rxContext );
- SvXMLImportContext* CreateContext(sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList) override;
+ SvXMLImportContext* CreateDocumentContext(sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList) override;
// XInterface
virtual Any SAL_CALL queryInterface( const Type& aType ) override;
@@ -1305,7 +1305,9 @@ void SAL_CALL AnimationsImport::release() throw ()
SvXMLImport::release();
}
-SvXMLImportContext *AnimationsImport::CreateContext(sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList)
+SvXMLImportContext *AnimationsImport::CreateDocumentContext(
+ sal_uInt16 const nPrefix, const OUString& rLocalName,
+ const Reference<XAttributeList>& xAttrList)
{
SvXMLImportContext* pContext = nullptr;
@@ -1315,7 +1317,7 @@ SvXMLImportContext *AnimationsImport::CreateContext(sal_uInt16 nPrefix, const OU
}
else
{
- pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ pContext = SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList);
}
return pContext;
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index bb02d346bf24..ed2848036239 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -584,7 +584,7 @@ const SvXMLTokenMap& SdXMLImport::GetPresentationPlaceholderAttrTokenMap()
return *mpPresentationPlaceholderAttrTokenMap;
}
-SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix,
+SvXMLImportContext *SdXMLImport::CreateDocumentContext(sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference<xml::sax::XAttributeList>& xAttrList)
{
@@ -607,7 +607,7 @@ SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix,
pContext = new SdXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
xAttrList, xDPS->getDocumentProperties());
} else {
- pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ pContext = SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList);
}
return pContext;
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 9dcf7715a76a..3900aa02aaf4 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -175,9 +175,8 @@ class SdXMLImport: public SvXMLImport
DateTimeDeclMap maDateTimeDeclsMap;
protected:
- // This method is called after the namespace map has been updated, but
- // before a context for the current element has been pushed.
- virtual SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
+
+ virtual SvXMLImportContext *CreateDocumentContext(sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList) override;
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx
index 2ba733d1abc0..2159916ad9cc 100644
--- a/xmloff/source/meta/MetaImportComponent.cxx
+++ b/xmloff/source/meta/MetaImportComponent.cxx
@@ -43,7 +43,7 @@ public:
protected:
- virtual SvXMLImportContext* CreateContext(
+ virtual SvXMLImportContext* CreateDocumentContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
@@ -68,7 +68,7 @@ XMLMetaImportComponent::XMLMetaImportComponent(
{
}
-SvXMLImportContext* XMLMetaImportComponent::CreateContext(
+SvXMLImportContext* XMLMetaImportComponent::CreateDocumentContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference<xml::sax::XAttributeList > & xAttrList )
@@ -86,7 +86,7 @@ SvXMLImportContext* XMLMetaImportComponent::CreateContext(
}
else
{
- return SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ return SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList);
}
}
diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx
index 080a954536aa..48104f58ff34 100644
--- a/xmloff/source/meta/xmlversion.cxx
+++ b/xmloff/source/meta/xmlversion.cxx
@@ -112,7 +112,7 @@ XMLVersionListImport::XMLVersionListImport(
XMLVersionListImport::~XMLVersionListImport() throw()
{}
-SvXMLImportContext *XMLVersionListImport::CreateContext(
+SvXMLImportContext *XMLVersionListImport::CreateDocumentContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< XAttributeList > & xAttrList )
@@ -126,7 +126,7 @@ SvXMLImportContext *XMLVersionListImport::CreateContext(
}
else
{
- pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
+ pContext = SvXMLImport::CreateDocumentContext( nPrefix, rLocalName, xAttrList );
}
return pContext;
diff --git a/xmloff/source/text/XMLAutoTextEventImport.cxx b/xmloff/source/text/XMLAutoTextEventImport.cxx
index dcb7d93554b3..285a8ca1d13b 100644
--- a/xmloff/source/text/XMLAutoTextEventImport.cxx
+++ b/xmloff/source/text/XMLAutoTextEventImport.cxx
@@ -85,7 +85,7 @@ void XMLAutoTextEventImport::initialize(
}
-SvXMLImportContext* XMLAutoTextEventImport::CreateContext(
+SvXMLImportContext* XMLAutoTextEventImport::CreateDocumentContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference<XAttributeList > & xAttrList )
@@ -98,7 +98,7 @@ SvXMLImportContext* XMLAutoTextEventImport::CreateContext(
}
else
{
- return SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
+ return SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList);
}
}
diff --git a/xmloff/source/text/XMLAutoTextEventImport.hxx b/xmloff/source/text/XMLAutoTextEventImport.hxx
index 0d7b4d4787fb..6413033dee4a 100644
--- a/xmloff/source/text/XMLAutoTextEventImport.hxx
+++ b/xmloff/source/text/XMLAutoTextEventImport.hxx
@@ -52,7 +52,7 @@ public:
protected:
- virtual SvXMLImportContext* CreateContext(
+ virtual SvXMLImportContext* CreateDocumentContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;