summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xmloff/xmlictxt.hxx6
-rw-r--r--sw/source/filter/xml/xmlimp.cxx2
-rw-r--r--xmloff/source/core/xmlictxt.cxx3
-rw-r--r--xmloff/source/core/xmlimp.cxx4
4 files changed, 10 insertions, 5 deletions
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 8dc67dac0227..5ab75bce286e 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -51,6 +51,7 @@ class XMLOFF_DLLPUBLIC SvXMLImportContext : public css::xml::sax::XFastContextHa
SvXMLImport& mrImport;
sal_uInt16 mnPrefix;
OUString maLocalName;
+ bool mbPrefixAndLocalNameFilledIn;
std::unique_ptr<SvXMLNamespaceMap> m_pRewindMap;
SAL_DLLPRIVATE std::unique_ptr<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_pRewindMap); }
@@ -63,8 +64,9 @@ protected:
public:
- sal_uInt16 GetPrefix() const { return mnPrefix; }
- const OUString& GetLocalName() const { return maLocalName; }
+ bool IsPrefixFilledIn() const { return mnPrefix != 0; }
+ sal_uInt16 GetPrefix() const { assert(mbPrefixAndLocalNameFilledIn && "those fields not filled, probably fast-parser context"); return mnPrefix; }
+ const OUString& GetLocalName() const { assert(mbPrefixAndLocalNameFilledIn && "those fields not filled, probably fast-parser context"); return maLocalName; }
/** A contexts constructor does anything that is required if an element
* starts. Namespace processing has been done already.
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index ebbd220e65a1..6b9a18327714 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -244,7 +244,7 @@ SvXMLImportContextRef SwXMLDocContext_Impl::CreateChildContext(
break;
case XML_TOK_DOC_AUTOSTYLES:
// don't use the autostyles from the styles-document for the progress
- if ( ! IsXMLToken( GetLocalName(), XML_DOCUMENT_STYLES ) )
+ if ( !IsPrefixFilledIn() || ! IsXMLToken( GetLocalName(), XML_DOCUMENT_STYLES ) )
GetSwImport().GetProgressBarHelper()->Increment
( PROGRESS_BAR_STEP );
pContext = GetSwImport().CreateStylesContext( rLocalName, xAttrList,
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index 092b1845c18c..b05a76b39969 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -32,13 +32,16 @@ SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp, sal_uInt16 nPrfx,
, mrImport(rImp)
, mnPrefix(nPrfx)
, maLocalName(rLName)
+ , mbPrefixAndLocalNameFilledIn(true)
{
+ assert(!rLName.isEmpty());
}
SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp )
: m_nRefCount(0)
, mrImport(rImp)
, mnPrefix(0)
+ , mbPrefixAndLocalNameFilledIn(false)
{
}
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 9c1f806a999c..578bef43a82c 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -729,7 +729,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
if(!maContexts.empty())
{
xContext = maContexts.top()->CreateChildContext(nPrefix, aLocalName, xAttrList);
- SAL_WARN_IF( !xContext.is() || (xContext->GetPrefix() != nPrefix), "xmloff.core",
+ SAL_WARN_IF( xContext.is() && xContext->IsPrefixFilledIn() && (xContext->GetPrefix() != nPrefix), "xmloff.core",
"SvXMLImport::startElement: created context has wrong prefix" );
}
else
@@ -782,7 +782,7 @@ rName
#ifdef DBG_UTIL
// Non product only: check if endElement call matches startELement call.
- if (!xContext->GetLocalName().isEmpty()) // prefix+localname are only valid in the non-FastParser case
+ if (xContext->IsPrefixFilledIn()) // prefix+localname are only valid in the non-FastParser case
{
OUString aLocalName;
sal_uInt16 nPrefix =