Kaydet (Commit) 1d75c2e5 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

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
üst ebe469f8
...@@ -60,15 +60,21 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis ...@@ -60,15 +60,21 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
case MCE_TOKEN( Choice ): case MCE_TOKEN( Choice ):
{ {
OUString aRequires = rAttribs.getString( ( XML_Requires ), "none" ); if (aMceState.empty() || aMceState.back() != MCE_STARTED)
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.
return false; return false;
aRequires = getFilter().getNamespaceURL( aRequires ); OUString aRequires = rAttribs.getString( (XML_Requires ), OUString("none") );
if( getFilter().getNamespaceId( aRequires ) > 0 && !aMceState.empty() && aMceState.back() == MCE_STARTED )
// 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; aMceState.back() = MCE_FOUND_CHOICE;
else else
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment