summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2015-11-08 19:30:34 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2015-11-08 19:42:12 +0100
commit1d75c2e5ed1df1b9e3ae733d9c8a2106701b67ae (patch)
treeca404d71bd256cf8f9e7c8554d3d69cc675d6f3f /oox
parentebe469f83eebc89dd6b30811327912e3c13fa2c8 (diff)
oox: check for namespace in MCE is flawed, use a namespace list
In "AlternateContent" nodes we have to check if we support the namespace which is provided in "Requires" attribute of "Choice". Currently we tried to resolve the namespace with a call to the xml filter, however this doesn't work as the filter is already gone. In writerfilter we also have to handle a similar situation but there we just compare it to a list of predefined namespace alias ("wps" and "wpg"). This commit adds a list of supported namespace aliases to fragmenthandler2 instead of the namespace checking to support the "p14" namespace alias correctly. Change-Id: I25c430b97336c9e140bb5641a76a60895734b91f
Diffstat (limited to 'oox')
-rw-r--r--oox/source/core/fragmenthandler2.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index 5f7cb7f4d40b..0186d78448f4 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -60,15 +60,21 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
case MCE_TOKEN( Choice ):
{
- OUString aRequires = rAttribs.getString( ( XML_Requires ), "none" );
- if (!getFilter().hasNamespaceURL(aRequires))
- // Check to see if we have this namespace defined first,
- // because calling getNamespaceURL() would throw if the
- // namespace doesn't exist.
+ if (aMceState.empty() || aMceState.back() != MCE_STARTED)
return false;
- aRequires = getFilter().getNamespaceURL( aRequires );
- if( getFilter().getNamespaceId( aRequires ) > 0 && !aMceState.empty() && aMceState.back() == MCE_STARTED )
+ OUString aRequires = rAttribs.getString( (XML_Requires ), OUString("none") );
+
+ // At this point we can't access namespaces as the correct xml filter
+ // is long gone. For now let's decide depending on a list of supported
+ // namespaces like we do in writerfilter
+
+ static std::vector<OUString> aSupportedNS =
+ {
+ "p14",
+ };
+
+ if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end())
aMceState.back() = MCE_FOUND_CHOICE;
else
return false;