diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-23 15:12:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-02 08:17:00 +0100 |
commit | 8c5ffecf1dbd3f93128910433da11d5315661680 (patch) | |
tree | 4263d40f2e6e118f42b7eed7bc40e92ad504036d /xmloff/source | |
parent | 0f3a8a972421aa440f4276b92463a481e5cd4267 (diff) |
make SvXMLImport capable of mixing fast- and slow- contexts adhoc
so I can convert even *ImportContext subclasses in the middle of
a context stack, and thus break the cyclic dependency nature
of the writer import.
and adjust the xmlimport loplugin for the new rules.
As a consequence of the loplugin:xmlimport's checking, we remove
a bunch of now unnecessary overrides of startFastElement.
Change-Id: I97464522ede8ec5e345e928cdafa4b18364b1b80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104730
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source')
57 files changed, 162 insertions, 570 deletions
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx index fc0d0df12316..95f484888d08 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.cxx +++ b/xmloff/source/chart/SchXMLParagraphContext.cxx @@ -52,45 +52,6 @@ SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport, SchXMLParagraphContext::~SchXMLParagraphContext() {} -void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) -{ - // remember the id. It is used for storing the original cell range string in - // a local table (cached data) - if( !mpId ) - return; - - sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; - bool bHaveXmlId( false ); - - for( sal_Int16 i = 0; i < nAttrCount; i++ ) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - - if (IsXMLToken(aLocalName, XML_ID)) - { - if (nPrefix == XML_NAMESPACE_XML) - { - (*mpId) = xAttrList->getValueByIndex( i ); - bHaveXmlId = true; - } - if (nPrefix == XML_NAMESPACE_TEXT) - { // text:id shall be ignored if xml:id exists - if (!bHaveXmlId) - { - (*mpId) = xAttrList->getValueByIndex( i ); - } - } - } - } -} - -void SchXMLParagraphContext::EndElement() -{ - mrText = maBuffer.makeStringAndClear(); -} - void SchXMLParagraphContext::startFastElement( sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) @@ -149,11 +110,6 @@ SvXMLImportContextRef SchXMLParagraphContext::CreateChildContext( return nullptr; } -void SchXMLParagraphContext::Characters( const OUString& rChars ) -{ - maBuffer.append( rChars ); -} - void SchXMLParagraphContext::characters( const OUString& rChars ) { maBuffer.append( rChars ); diff --git a/xmloff/source/chart/SchXMLParagraphContext.hxx b/xmloff/source/chart/SchXMLParagraphContext.hxx index a76eceba2bc2..3d2599e9845a 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.hxx +++ b/xmloff/source/chart/SchXMLParagraphContext.hxx @@ -43,10 +43,6 @@ public: OUString& rText ); virtual ~SchXMLParagraphContext() override; - virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; - virtual void EndElement() override; - virtual void Characters( const OUString& rChars ) override; - virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx index 537fe4ce3643..fdaf1f361896 100644 --- a/xmloff/source/chart/SchXMLTextListContext.cxx +++ b/xmloff/source/chart/SchXMLTextListContext.cxx @@ -35,9 +35,6 @@ class SchXMLListItemContext : public SvXMLImportContext public: SchXMLListItemContext( SvXMLImport& rImport, const OUString& rLocalName, OUString& rText ); - virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ) override; - virtual void EndElement() override; - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -58,14 +55,6 @@ SchXMLListItemContext::SchXMLListItemContext( { } -void SchXMLListItemContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ ) -{ -} - -void SchXMLListItemContext::EndElement() -{ -} - SvXMLImportContextRef SchXMLListItemContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& ) @@ -91,10 +80,6 @@ SchXMLTextListContext::~SchXMLTextListContext() { } -void SchXMLTextListContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ ) -{ -} - void SchXMLTextListContext::EndElement() { sal_Int32 nCount = m_aTextVector.size(); diff --git a/xmloff/source/chart/SchXMLTextListContext.hxx b/xmloff/source/chart/SchXMLTextListContext.hxx index 2b15c17c6192..ef728c84fff2 100644 --- a/xmloff/source/chart/SchXMLTextListContext.hxx +++ b/xmloff/source/chart/SchXMLTextListContext.hxx @@ -34,7 +34,6 @@ public: const OUString& rLocalName, css::uno::Sequence< OUString>& rTextList ); virtual ~SchXMLTextListContext() override; - virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; virtual void EndElement() override; virtual SvXMLImportContextRef CreateChildContext( diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.cxx b/xmloff/source/chart/XMLLabelSeparatorContext.cxx index b43abf82bfdc..11c3710d9d10 100644 --- a/xmloff/source/chart/XMLLabelSeparatorContext.cxx +++ b/xmloff/source/chart/XMLLabelSeparatorContext.cxx @@ -40,10 +40,6 @@ XMLLabelSeparatorContext::XMLLabelSeparatorContext( XMLLabelSeparatorContext::~XMLLabelSeparatorContext() {} -void XMLLabelSeparatorContext::startFastElement( sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ -} - css::uno::Reference< css::xml::sax::XFastContextHandler > XMLLabelSeparatorContext::createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.hxx b/xmloff/source/chart/XMLLabelSeparatorContext.hxx index f66b6009b495..fc1451923686 100644 --- a/xmloff/source/chart/XMLLabelSeparatorContext.hxx +++ b/xmloff/source/chart/XMLLabelSeparatorContext.hxx @@ -30,9 +30,6 @@ public: ::std::vector< XMLPropertyState > &rProps ); virtual ~XMLLabelSeparatorContext() override; - virtual void SAL_CALL startFastElement( - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx index bdde116de6c9..b39ba4efbfae 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -43,9 +43,6 @@ public: SchXMLBodyContext_Impl( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; @@ -162,12 +159,6 @@ SchXMLBodyContext::SchXMLBodyContext( SchXMLImportHelper& rImpHelper, SchXMLBodyContext::~SchXMLBodyContext() {} -css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLBodyContext::createFastChildContext( - sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ - return nullptr; -} - SvXMLImportContextRef SchXMLBodyContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/chart/contexts.hxx b/xmloff/source/chart/contexts.hxx index 7cfcf2d5f44c..d8fe78be1a9d 100644 --- a/xmloff/source/chart/contexts.hxx +++ b/xmloff/source/chart/contexts.hxx @@ -47,9 +47,6 @@ public: virtual ~SchXMLDocContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -70,10 +67,6 @@ public: sal_Int32 i_nElement, const css::uno::Reference<css::document::XDocumentProperties>& i_xDocProps); - virtual void SAL_CALL startFastElement( sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override - { SvXMLMetaDocumentContext::startFastElement(nElement, xAttrList); } - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; @@ -90,12 +83,6 @@ public: sal_Int32 nElement ); virtual ~SchXMLBodyContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( - sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 96313067a491..f221bfbc0f00 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -135,9 +135,6 @@ public: XMLConfigBaseContext* pBaseContext); void AddPropertyValue() { maProps.push_back(maProp); } - - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} }; class XMLConfigItemContext : public SvXMLImportContext @@ -155,9 +152,6 @@ public: const OUString& rItemName, XMLConfigBaseContext* pBaseContext); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual void SAL_CALL characters( const OUString& rChars ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx index bd19c4fdc0c2..0deacd18fb4b 100644 --- a/xmloff/source/core/DomBuilderContext.cxx +++ b/xmloff/source/core/DomBuilderContext.cxx @@ -154,11 +154,6 @@ void DomBuilderContext::StartElement( } } -void DomBuilderContext::EndElement() -{ - // nothing to be done! -} - void DomBuilderContext::Characters( const OUString& rCharacters ) { SAL_WARN_IF( !mxNode.is(), "xmloff", "empty XNode not allowed" ); diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx b/xmloff/source/core/XMLBase64ImportContext.cxx index b9049e577d1c..504460bff96a 100644 --- a/xmloff/source/core/XMLBase64ImportContext.cxx +++ b/xmloff/source/core/XMLBase64ImportContext.cxx @@ -50,11 +50,6 @@ XMLBase64ImportContext::~XMLBase64ImportContext() { } -void XMLBase64ImportContext::EndElement() -{ - endFastElement(0); -} - void XMLBase64ImportContext::endFastElement(sal_Int32 ) { OUString sChars = maCharBuffer.makeStringAndClear().trim(); @@ -67,11 +62,6 @@ void XMLBase64ImportContext::endFastElement(sal_Int32 ) xOut->closeOutput(); } -void XMLBase64ImportContext::Characters( const OUString& rChars ) -{ - characters(rChars); -} - void XMLBase64ImportContext::characters( const OUString& rChars ) { maCharBuffer.append(rChars); diff --git a/xmloff/source/core/namespacemap.cxx b/xmloff/source/core/namespacemap.cxx index 96cdc10fcb31..3ff1d65bd1d9 100644 --- a/xmloff/source/core/namespacemap.cxx +++ b/xmloff/source/core/namespacemap.cxx @@ -319,6 +319,7 @@ sal_uInt16 SvXMLNamespaceMap::GetKeyByQName(const OUString& rQName, if (eMode == QNameMode::AttrNameCached && sEntryName.indexOf(':') != -1) { SAL_INFO("xmloff", "invalid attribute name with multiple ':'"); + assert(false); return XML_NAMESPACE_UNKNOWN; } diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx index bc1d2a8486bf..7a32f8455be3 100644 --- a/xmloff/source/core/xmlictxt.cxx +++ b/xmloff/source/core/xmlictxt.cxx @@ -23,6 +23,7 @@ #include <sax/fastattribs.hxx> #include <comphelper/attributelist.hxx> #include <cppuhelper/queryinterface.hxx> +#include <sal/log.hxx> using namespace ::com::sun::star; @@ -70,20 +71,15 @@ void SvXMLImportContext::Characters( const OUString& ) // css::xml::sax::XFastContextHandler: void SAL_CALL SvXMLImportContext::startFastElement(sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) { - mrImport.isFastContext = false; const OUString& rPrefix = SvXMLImport::getNamespacePrefixFromToken(nElement, &GetImport().GetNamespaceMap()); const OUString& rLocalName = SvXMLImport::getNameFromToken( nElement ); startUnknownElement( SvXMLImport::aDefaultNamespace, (rPrefix.isEmpty())? rLocalName : rPrefix + SvXMLImport::aNamespaceSeparator + rLocalName, Attribs ); } -void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & /*rNamespace*/, const OUString & rElementName, +void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & /*rNamespace*/, const OUString & /*rElementName*/, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) { - if ( mrImport.maAttrList.is() ) - mrImport.maAttrList->Clear(); - else - mrImport.maAttrList = new comphelper::AttributeList; - + mrImport.maAttrList->Clear(); mrImport.maNamespaceHandler->addNSDeclAttributes( mrImport.maAttrList ); if ( Attribs.is() ) @@ -108,40 +104,34 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & /*rNamesp mrImport.maAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue ); } } - mrImport.startElement( rElementName, mrImport.maAttrList.get() ); + StartElement( mrImport.maAttrList.get() ); } -void SAL_CALL SvXMLImportContext::endFastElement(sal_Int32 nElement) +void SAL_CALL SvXMLImportContext::endFastElement(sal_Int32 ) { - mrImport.isFastContext = false; - const OUString& rPrefix = SvXMLImport::getNamespacePrefixFromToken(nElement, &GetImport().GetNamespaceMap()); - const OUString& rLocalName = SvXMLImport::getNameFromToken( nElement ); - endUnknownElement( SvXMLImport::aDefaultNamespace, (rPrefix.isEmpty())? rLocalName : rPrefix + SvXMLImport::aNamespaceSeparator + rLocalName ); + EndElement(); } -void SAL_CALL SvXMLImportContext::endUnknownElement (const OUString & /*rNamespace*/, const OUString & rElementName) +void SAL_CALL SvXMLImportContext::endUnknownElement (const OUString & /*rNamespace*/, const OUString & /*rElementName*/) { - mrImport.endElement( rElementName ); + EndElement(); } uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SvXMLImportContext::createFastChildContext - (sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) + (sal_Int32 /*Element*/, const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/) { - // Call CreateFastContext only if it's the first element of the document - if ( mrImport.maFastContexts.empty() ) - return mrImport.CreateFastContext( Element, Attribs ); return nullptr; } uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SvXMLImportContext::createUnknownChildContext - (const OUString &, const OUString &, const uno::Reference< xml::sax::XFastAttributeList > &) + (const OUString & /*rNamespace*/, const OUString & /*rName*/, const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/) { - return this; + return nullptr; } void SAL_CALL SvXMLImportContext::characters(const OUString &rChars) { - mrImport.Characters( rChars ); + Characters(rChars); } // XInterface diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index dbb02f0fe29a..7886d150948b 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -334,6 +334,7 @@ public: SvXMLImportContext *SvXMLImport::CreateFastContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) { + assert(false); SAL_WARN( "xmloff.core", "CreateFastContext should be overridden, for element " << nElement); return new SvXMLImportContext( *this ); } @@ -404,7 +405,6 @@ SvXMLImport::SvXMLImport( util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mnImportFlags( nImportFlags ), - isFastContext( false ), maNamespaceHandler( new SvXMLImportFastNamespaceHandler() ), mbIsFormsSupported( true ), mbIsTableShapeSupported( false ), @@ -421,6 +421,8 @@ SvXMLImport::SvXMLImport( bIsNSMapsInitialized = true; } registerNamespaces(); + maNamespaceAttrList = new comphelper::AttributeList; + maAttrList = new comphelper::AttributeList; } void SvXMLImport::cleanup() throw () @@ -429,12 +431,6 @@ void SvXMLImport::cleanup() throw () mxModel->removeEventListener(mxEventListener); // clear context stacks first in case of parse error because the context // class dtors are full of application logic - while (!maFastContexts.empty()) - { - if (SvXMLStylesContext* pStylesContext = dynamic_cast<SvXMLStylesContext*>(maFastContexts.top().get())) - pStylesContext->dispose(); - maFastContexts.pop(); - } while (!maContexts.empty()) { if (SvXMLStylesContext* pStylesContext = dynamic_cast<SvXMLStylesContext*>(maContexts.top().get())) @@ -725,119 +721,10 @@ std::unique_ptr<SvXMLNamespaceMap> SvXMLImport::processNSAttributes( return pRewindMap; } -void SvXMLImport::startElement( const OUString& rName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList ) -{ - // SAL_INFO("svg", "startElement " << rName); - // Process namespace attributes. This must happen before creating the - // context, because namespace declaration apply to the element name itself. - std::unique_ptr<SvXMLNamespaceMap> pRewindMap(processNSAttributes(xAttrList)); - - // Get element's namespace and local name. - OUString aLocalName; - sal_uInt16 nPrefix = - mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName ); - - // If there are contexts already, call a CreateChildContext at the topmost - // context. Otherwise, create a default context. - SvXMLImportContextRef xContext; - if(!maContexts.empty()) - { - xContext = maContexts.top()->CreateChildContext(nPrefix, aLocalName, xAttrList); - SAL_WARN_IF( xContext.is() && xContext->IsPrefixFilledIn() && (xContext->GetPrefix() != nPrefix), "xmloff.core", - "SvXMLImport::startElement: created context has wrong prefix" ); - } - else - { - Reference<xml::sax::XLocator> xDummyLocator; - Sequence < OUString > aParams { rName }; - - SetError( XMLERROR_FLAG_SEVERE|XMLERROR_UNKNOWN_ROOT, - aParams, "Root element " + rName + " unknown", xDummyLocator ); - } - - if ( !xContext.is() ) - SAL_INFO_IF( !xContext.is(), "xmloff.core", "SvXMLImport::startElement: missing context for element " << rName ); - - if( !xContext.is() ) - xContext.set(new SvXMLImportContext( *this, nPrefix, aLocalName )); - - // Remember old namespace map. - if( pRewindMap ) - xContext->PutRewindMap(std::move(pRewindMap)); - - // Call a startElement at the new context. - xContext->StartElement( xAttrList ); - - // Push context on stack. - maContexts.push(xContext); -} - -void SvXMLImport::endElement( const OUString& -#ifdef DBG_UTIL -rName -#endif -) -{ - if (maContexts.empty()) - { - SAL_WARN("xmloff.core", "SvXMLImport::endElement: no context left"); - return; - } - - std::unique_ptr<SvXMLNamespaceMap> pRewindMap; - - { - // Get topmost context and remove it from the stack. - SvXMLImportContextRef xContext = std::move(maContexts.top()); - maContexts.pop(); - -#ifdef DBG_UTIL - // Non product only: check if endElement call matches startELement call. - if (xContext->IsPrefixFilledIn()) // prefix+localname are only valid in the non-FastParser case - { - OUString aLocalName; - sal_uInt16 nPrefix = - mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName ); - SAL_WARN_IF( xContext->GetPrefix() != nPrefix, "xmloff.core", "SvXMLImport::endElement: popped context has wrong prefix" ); - SAL_WARN_IF( xContext->GetLocalName() != aLocalName, "xmloff.core", "SvXMLImport::endElement: popped context has wrong lname '" - << aLocalName << "' expected. '" << xContext->GetLocalName() << "' with impl " << getImplementationName() ); - } -#endif - - // Call a EndElement at the current context. - xContext->EndElement(); - // Get a namespace map to rewind. - pRewindMap = xContext->TakeRewindMap(); - // note: delete xContext *before* rewinding namespace map! - } - - // Rewind a namespace map. - if (pRewindMap) - { - mpNamespaceMap.reset(); - mpNamespaceMap = std::move(pRewindMap); - } -} void SAL_CALL SvXMLImport::characters( const OUString& rChars ) { - if ( !maFastContexts.empty() ) - { - maFastContexts.top()->characters( rChars ); - } - else if( !maContexts.empty() ) - { - maContexts.top()->Characters( rChars ); - } -} - -void SvXMLImport::Characters( const OUString& rChars ) -{ - if( !maContexts.empty() ) - { - maContexts.top()->Characters( rChars ); - } + maContexts.top()->characters( rChars ); } void SAL_CALL SvXMLImport::processingInstruction( const OUString&, @@ -854,6 +741,7 @@ void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::X void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) { + SAL_INFO("xmloff.core", "startFastElement " << SvXMLImport::getNameFromToken( Element )); if ( Attribs.is() && !mpImpl->mxODFVersion) { sax_fastparser::FastAttributeList& rAttribList = @@ -874,80 +762,180 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element, } } - //Namespace handling is unnecessary. It is done by the fastparser itself. - uno::Reference<XFastContextHandler> xContext; - if (!maFastContexts.empty()) + maNamespaceAttrList->Clear(); + + maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList ); + std::unique_ptr<SvXMLNamespaceMap> pRewindMap( + processNSAttributes( maNamespaceAttrList.get() )); + + SvXMLImportContextRef xContext; + const bool bRootContext = maContexts.empty(); + if (!maContexts.empty()) { - uno::Reference<XFastContextHandler> pHandler = maFastContexts.top(); - xContext = pHandler->createFastChildContext( Element, Attribs ); + const SvXMLImportContextRef & pHandler = maContexts.top(); + SAL_INFO("xmloff.core", "calling createFastChildContext on " << typeid(*pHandler.get()).name()); + auto tmp = pHandler->createFastChildContext( Element, Attribs ); + if (!tmp) + { + // fall back to slow-parser path + const OUString& rPrefix = SvXMLImport::getNamespacePrefixFromToken(Element, &GetNamespaceMap()); + const OUString& rLocalName = SvXMLImport::getNameFromToken( Element ); + OUString aName = rPrefix.isEmpty() ? rLocalName : rPrefix + SvXMLImport::aNamespaceSeparator + rLocalName; + OUString aLocalName; + sal_uInt16 nPrefix = + mpNamespaceMap->GetKeyByAttrName( aName, &aLocalName ); + + maAttrList->Clear(); + + if ( Attribs.is() ) + { + for( auto &it : sax_fastparser::castToFastAttributeList( Attribs ) ) + { + sal_Int32 nToken = it.getToken(); + const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken(nToken, &GetNamespaceMap()); + OUString sAttrName = SvXMLImport::getNameFromToken( nToken ); + if ( !rAttrNamespacePrefix.isEmpty() ) + sAttrName = rAttrNamespacePrefix + SvXMLImport::aNamespaceSeparator + sAttrName; + + maAttrList->AddAttribute( sAttrName, "CDATA", it.toString() ); + } + + const uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes(); + for ( const auto& rUnknownAttrib : unknownAttribs ) + { + const OUString& rAttrValue = rUnknownAttrib.Value; + const OUString& rAttrName = rUnknownAttrib.Name; + // note: rAttrName is expected to be namespace-prefixed here + maAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue ); + } + } + + SAL_INFO("xmloff.core", "calling CreateChildContext on " << typeid(*pHandler).name()); + tmp = pHandler->CreateChildContext(nPrefix, aLocalName, maAttrList.get() ).get(); + } + xContext = dynamic_cast<SvXMLImportContext*>(tmp.get()); + assert(tmp && xContext || (!tmp && !xContext)); } else xContext.set( CreateFastContext( Element, Attribs ) ); SAL_INFO_IF(!xContext.is(), "xmloff.core", "No fast context for element " << getNameFromToken(Element)); - if ( !xContext.is() ) + if (bRootContext && !xContext) + { + OUString aName = getNameFromToken(Element); + SetError( XMLERROR_FLAG_SEVERE | XMLERROR_UNKNOWN_ROOT, + { aName }, "Root element " + aName + " unknown", Reference<xml::sax::XLocator>() ); + } + if ( !xContext ) xContext.set( new SvXMLImportContext( *this ) ); - isFastContext = true; - // Call a startElement at the new context. xContext->startFastElement( Element, Attribs ); - if ( isFastContext ) - { - if ( maNamespaceAttrList.is() ) - maNamespaceAttrList->Clear(); - else - maNamespaceAttrList = new comphelper::AttributeList; - - maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList ); - std::unique_ptr<SvXMLNamespaceMap> pRewindMap( - processNSAttributes( maNamespaceAttrList.get() )); - assert( dynamic_cast<SvXMLImportContext*>( xContext.get() ) != nullptr ); - SvXMLImportContext *pContext = static_cast<SvXMLImportContext*>( xContext.get() ); - if (pRewindMap) - pContext->PutRewindMap(std::move(pRewindMap)); - maContexts.push(pContext); - } + if (pRewindMap) + xContext->PutRewindMap(std::move(pRewindMap)); // Push context on stack. - maFastContexts.push(xContext); + maContexts.push(xContext); } -void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rPrefix, const OUString & rLocalName, +void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rNamespace, const OUString & rName, const uno::Reference< xml::sax::XFastAttributeList > & Attribs) { - uno::Reference<XFastContextHandler> xContext; - if (!maFastContexts.empty()) + SAL_INFO("xmloff.core", "startUnknownElement " << rNamespace << " " << rName); + SvXMLImportContextRef xContext; + const bool bRootContext = maContexts.empty(); + if (!maContexts.empty()) { - uno::Reference<XFastContextHandler> pHandler = maFastContexts.top(); - xContext = pHandler->createUnknownChildContext( rPrefix, rLocalName, Attribs ); + const SvXMLImportContextRef & pHandler = maContexts.top(); + SAL_INFO("xmloff.core", "calling createUnknownChildContext on " << typeid(*pHandler.get()).name()); + auto tmp = pHandler->createUnknownChildContext( rNamespace, rName, Attribs ); + if (!tmp) + { + // fall back to slow-parser path + OUString aLocalName; + sal_uInt16 nPrefix = mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName ); + + maAttrList->Clear(); + maNamespaceHandler->addNSDeclAttributes( maAttrList ); + + if ( Attribs.is() ) + { + for( auto &it : sax_fastparser::castToFastAttributeList( Attribs ) ) + { + sal_Int32 nToken = it.getToken(); + const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken(nToken, &GetNamespaceMap()); + OUString sAttrName = SvXMLImport::getNameFromToken( nToken ); + if ( !rAttrNamespacePrefix.isEmpty() ) + sAttrName = rAttrNamespacePrefix + SvXMLImport::aNamespaceSeparator + sAttrName; + + maAttrList->AddAttribute( sAttrName, "CDATA", it.toString() ); + } + + const uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes(); + for ( const auto& rUnknownAttrib : unknownAttribs ) + { + const OUString& rAttrValue = rUnknownAttrib.Value; + const OUString& rAttrName = rUnknownAttrib.Name; + // note: rAttrName is expected to be namespace-prefixed here + maAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue ); + } + } + + SAL_INFO("xmloff.core", "calling CreateChildContext on " << typeid(*pHandler).name()); + tmp = pHandler->CreateChildContext(nPrefix, aLocalName, maAttrList.get() ).get(); + } + xContext = dynamic_cast<SvXMLImportContext*>(tmp.get()); + assert(tmp && xContext || (!tmp && !xContext)); } else xContext.set( CreateFastContext( -1, Attribs ) ); - SAL_WARN_IF(!xContext.is(), "xmloff.core", "No context for unknown-element " << rLocalName); - if ( !xContext.is() ) - xContext.set( new SvXMLImportContext( *this ) ); + SAL_WARN_IF(!xContext.is(), "xmloff.core", "No context for unknown-element " << rNamespace << " " << rName); + if (bRootContext && !xContext) + { + SetError( XMLERROR_FLAG_SEVERE | XMLERROR_UNKNOWN_ROOT, + { rName }, "Root element " + rName + " unknown", Reference<xml::sax::XLocator>() ); + } + if (!xContext) + { + if (!maContexts.empty()) + // This is pretty weird, but it's what the code did before I simplified it, and some parts of the + // code rely on this behaviour e.g. DocumentBuilderContext + xContext = maContexts.top(); + else + xContext = new SvXMLImportContext( *this ); + } - xContext->startUnknownElement( rPrefix, rLocalName, Attribs ); - maFastContexts.push(xContext); + xContext->startUnknownElement( rNamespace, rName, Attribs ); + maContexts.push(xContext); } void SAL_CALL SvXMLImport::endFastElement (sal_Int32 Element) { - uno::Reference<XFastContextHandler> xContext = std::move(maFastContexts.top()); - maFastContexts.pop(); - isFastContext = true; + SAL_INFO("xmloff.core", "endFastElement " << SvXMLImport::getNameFromToken( Element )); + if (maContexts.empty()) + { + SAL_WARN("xmloff.core", "SvXMLImport::endFastElement: no context left"); + assert(false); + return; + } + SvXMLImportContextRef xContext = std::move(maContexts.top()); + maContexts.pop(); xContext->endFastElement( Element ); - if (isFastContext) - maContexts.pop(); } void SAL_CALL SvXMLImport::endUnknownElement (const OUString & rPrefix, const OUString & rLocalName) { - uno::Reference<XFastContextHandler> xContext = std::move(maFastContexts.top()); - maFastContexts.pop(); + SAL_INFO("xmloff.core", "endUnknownElement " << rPrefix << " " << rLocalName); + if (maContexts.empty()) + { + SAL_WARN("xmloff.core", "SvXMLImport::endUnknownElement: no context left"); + assert(false); + return; + } + SvXMLImportContextRef xContext = std::move(maContexts.top()); + maContexts.pop(); xContext->endUnknownElement( rPrefix, rLocalName ); } diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx index cf171cba5c85..2894b0a04616 100644 --- a/xmloff/source/draw/XMLNumberStyles.cxx +++ b/xmloff/source/draw/XMLNumberStyles.cxx @@ -641,8 +641,6 @@ bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle* pS void SdXMLNumberFormatImportContext::endFastElement(sal_Int32 ) { - SvXMLNumFormatContext::EndElement(); - for( ; mnIndex < 16; mnIndex++ ) { mnElements[mnIndex] = DataStyleNumber::NONE; diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx index 2c13b36ac187..b8bc00122044 100644 --- a/xmloff/source/draw/XMLShapePropertySetContext.cxx +++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx @@ -60,8 +60,6 @@ void XMLShapePropertySetContext::endFastElement(sal_Int32 ) XMLPropertyState aPropState( mnBulletIndex, Any(xNumRule) ); mrProperties.push_back( aPropState ); - - SvXMLPropertySetContext::EndElement(); } css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetContext::createFastChildContext( diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index bbfe7f29b425..6c8672fa38b4 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -533,14 +533,6 @@ AnimationNodeContext::AnimationNodeContext( } } -void AnimationNodeContext::startFastElement( sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) -{ - // code of StartElement is moved to init_node that is now called - // in c'tor before appending this node to its parent. - // This is needed for random nodes that need the correct target - // set when child nodes are appended. -} - void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { if( !mxNode.is() ) diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx index 490203eaffad..47417bcc27a1 100644 --- a/xmloff/source/draw/animimp.cxx +++ b/xmloff/source/draw/animimp.cxx @@ -372,9 +372,6 @@ public: const Reference< XFastAttributeList >& xAttrList, XMLAnimationsContext& rAnimationsContext); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) override {} - virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( @@ -386,9 +383,6 @@ class XMLAnimationsSoundContext : public SvXMLImportContext public: XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent ); - - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) override {} }; } @@ -595,10 +589,6 @@ XMLAnimationsContext::XMLAnimationsContext( SvXMLImport& rImport ) { } -void XMLAnimationsContext::startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{} - css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnimationsContext::createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { diff --git a/xmloff/source/draw/layerimp.hxx b/xmloff/source/draw/layerimp.hxx index 5779442da6ac..aa1869473ddc 100644 --- a/xmloff/source/draw/layerimp.hxx +++ b/xmloff/source/draw/layerimp.hxx @@ -39,9 +39,6 @@ public: SdXMLLayerSetContext( SvXMLImport& rImport ); virtual ~SdXMLLayerSetContext() override; - virtual void SAL_CALL startFastElement (sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttribs*/) override {} - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override; }; diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 60db53160082..ae5dba2c6639 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -59,9 +59,6 @@ public: SdXMLBodyContext_Impl( SdXMLImport& rImport ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; }; @@ -94,13 +91,6 @@ public: virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; - - virtual void SAL_CALL characters( const OUString& /*aChars*/ ) override {} - - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) override {} - - virtual void SAL_CALL endFastElement( sal_Int32 /*nElement*/ ) override {} }; } @@ -193,13 +183,6 @@ public: SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport, const uno::Reference<document::XDocumentProperties>& i_xDocProps ); - virtual void SAL_CALL startFastElement( sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; - - virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; - - virtual void SAL_CALL characters( const OUString& aChars ) override; - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; @@ -214,22 +197,6 @@ SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport, { } -void SAL_CALL SdXMLFlatDocContext_Impl::startFastElement( sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) -{ - SvXMLMetaDocumentContext::startFastElement(nElement, xAttrList); -} - -void SAL_CALL SdXMLFlatDocContext_Impl::endFastElement( sal_Int32 nElement ) -{ - SvXMLMetaDocumentContext::endFastElement(nElement); -} - -void SAL_CALL SdXMLFlatDocContext_Impl::characters( const OUString& rChars ) -{ - SvXMLMetaDocumentContext::characters(rChars); -} - uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SdXMLFlatDocContext_Impl::createFastChildContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) { diff --git a/xmloff/source/draw/ximpbody.hxx b/xmloff/source/draw/ximpbody.hxx index 714c8f8ec07d..c16d875eca7e 100644 --- a/xmloff/source/draw/ximpbody.hxx +++ b/xmloff/source/draw/ximpbody.hxx @@ -53,9 +53,6 @@ public: SdXMLBodyContext( SdXMLImport& rImport ); virtual ~SdXMLBodyContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; }; diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 88412788d5f8..6b987c42d417 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -68,7 +68,6 @@ public: virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override; - virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; private: @@ -208,11 +207,6 @@ SvXMLImportContextRef DrawAnnotationContext::CreateChildContext( sal_uInt16 nPre return xContext; } -void DrawAnnotationContext::startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ -} - void DrawAnnotationContext::endFastElement(sal_Int32) { if(mxCursor.is()) diff --git a/xmloff/source/draw/ximpshow.hxx b/xmloff/source/draw/ximpshow.hxx index a97ded31b904..b508b3005c25 100644 --- a/xmloff/source/draw/ximpshow.hxx +++ b/xmloff/source/draw/ximpshow.hxx @@ -37,9 +37,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList); virtual ~SdXMLShowsContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; private: diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx index 7d0d94080411..a7eee862783c 100644 --- a/xmloff/source/draw/ximpstyl.hxx +++ b/xmloff/source/draw/ximpstyl.hxx @@ -222,9 +222,6 @@ public: SdXMLMasterStylesContext(SdXMLImport& rImport); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; @@ -243,9 +240,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual bool IsTransient() const override; - virtual void SAL_CALL startFastElement( - sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 ) override; virtual void SAL_CALL characters( const OUString& rChars ) override; diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index e9945f49e7aa..38579d399c1e 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -1738,8 +1738,6 @@ namespace xmloff _rxAttrList->getValueByName(sDefaultSelectedAttribute)); if (bDefaultSelected) m_xListBoxImport->implDefaultSelectCurrentItem(); - - SvXMLImportContext::StartElement(_rxAttrList); } //= OComboItemImport @@ -1755,8 +1753,6 @@ namespace xmloff const OUString sLabelAttributeName = GetImport().GetNamespaceMap().GetQNameByKey( GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label))); m_xListBoxImport->implPushBackLabel(_rxAttrList->getValueByName(sLabelAttributeName)); - - SvXMLImportContext::StartElement(_rxAttrList); } //= OColumnWrapperImport diff --git a/xmloff/source/forms/eventimport.cxx b/xmloff/source/forms/eventimport.cxx index b30ce9dc953a..5e7d1e815ab9 100644 --- a/xmloff/source/forms/eventimport.cxx +++ b/xmloff/source/forms/eventimport.cxx @@ -89,8 +89,6 @@ namespace xmloff // register the events m_rEventAttacher.registerEvents(aTranslated); - - XMLEventsImportContext::EndElement(); } //= ODefaultEventAttacherManager diff --git a/xmloff/source/forms/officeforms.cxx b/xmloff/source/forms/officeforms.cxx index 1b5091087444..491a8afefb65 100644 --- a/xmloff/source/forms/officeforms.cxx +++ b/xmloff/source/forms/officeforms.cxx @@ -88,7 +88,6 @@ namespace xmloff void OFormsRootImport::StartElement( const Reference< XAttributeList >& _rxAttrList ) { ENTER_LOG_CONTEXT( "xmloff::OFormsRootImport - importing the complete tree" ); - SvXMLImportContext::StartElement( _rxAttrList ); try { @@ -113,7 +112,6 @@ namespace xmloff void OFormsRootImport::EndElement() { - SvXMLImportContext::EndElement(); LEAVE_LOG_CONTEXT( ); } diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx index 719187fc5f84..e7a3e7914ec0 100644 --- a/xmloff/source/forms/propertyimport.cxx +++ b/xmloff/source/forms/propertyimport.cxx @@ -364,15 +364,12 @@ SvXMLImportContextRef OPropertyElementsContext::CreateChildContext(sal_uInt16 _n void OPropertyElementsContext::StartElement(const Reference< XAttributeList >& _rxAttrList) { OSL_ENSURE(0 == _rxAttrList->getLength(), "OPropertyElementsContext::StartElement: the form:properties element should not have attributes!"); - SvXMLImportContext::StartElement(_rxAttrList); } void OPropertyElementsContext::Characters(const OUString& _rChars) { OSL_ENSURE(_rChars.trim().isEmpty(), "OPropertyElementsContext::Characters: non-whitespace characters detected!"); - SvXMLImportContext::Characters(_rChars); } - #endif //= OSinglePropertyContext @@ -383,12 +380,6 @@ OSinglePropertyContext::OSinglePropertyContext(SvXMLImport& _rImport, sal_uInt16 { } -SvXMLImportContextRef OSinglePropertyContext::CreateChildContext(sal_uInt16 /*_nPrefix*/, const OUString& /*_rLocalName*/, - const Reference< XAttributeList >&) -{ - return nullptr; -} - void OSinglePropertyContext::StartElement(const Reference< XAttributeList >& _rxAttrList) { css::beans::PropertyValue aPropValue; // the property the instance imports currently diff --git a/xmloff/source/forms/propertyimport.hxx b/xmloff/source/forms/propertyimport.hxx index 9ea8c1dd797a..46163107b52b 100644 --- a/xmloff/source/forms/propertyimport.hxx +++ b/xmloff/source/forms/propertyimport.hxx @@ -183,10 +183,6 @@ namespace xmloff OSinglePropertyContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName, const OPropertyImportRef& _rPropertyImporter); - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 _nPrefix, const OUString& _rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; - virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; }; diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index fa24a35e9c5d..14721440bf9b 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -205,10 +205,6 @@ void SAL_CALL SvXMLMetaDocumentContext::startFastElement(sal_Int32 /*nElement*/, mxDocBuilder->startFastElement(XML_ELEMENT(OFFICE, XML_DOCUMENT_META), xAttrList); } -void SAL_CALL SvXMLMetaDocumentContext::endFastElement(sal_Int32 /*nElement*/) -{ -} - void SvXMLMetaDocumentContext::FinishMetaElement() { // hardcode office:document-meta (necessary in case of flat file ODF) @@ -224,10 +220,6 @@ void SvXMLMetaDocumentContext::FinishMetaElement() } } -void SAL_CALL SvXMLMetaDocumentContext::characters( const OUString& /*rChars*/ ) -{ -} - uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SvXMLMetaDocumentContext::createFastChildContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) { diff --git a/xmloff/source/script/XMLEventsImportContext.cxx b/xmloff/source/script/XMLEventsImportContext.cxx index 7694bc482d94..012156831671 100644 --- a/xmloff/source/script/XMLEventsImportContext.cxx +++ b/xmloff/source/script/XMLEventsImportContext.cxx @@ -89,17 +89,6 @@ XMLEventsImportContext::~XMLEventsImportContext() } -void XMLEventsImportContext::StartElement( - const Reference<XAttributeList> &) -{ - // nothing to be done -} - -void XMLEventsImportContext::EndElement() -{ - // nothing to be done -} - SvXMLImportContextRef XMLEventsImportContext::CreateChildContext( sal_uInt16 /*p_nPrefix*/, const OUString& /*rLocalName*/, @@ -141,17 +130,6 @@ SvXMLImportContextRef XMLEventsImportContext::CreateChildContext( GetImport(), xAttrList, this, sEventName, sLanguage); } -void XMLEventsImportContext::startFastElement(sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >&) -{ - // nothing to be done -} - -void XMLEventsImportContext::endFastElement(sal_Int32 /*nElement*/) -{ - // nothing to be done -} - css::uno::Reference< css::xml::sax::XFastContextHandler > XMLEventsImportContext::createFastChildContext( sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) diff --git a/xmloff/source/script/xmlbasicscript.cxx b/xmloff/source/script/xmlbasicscript.cxx index 0d15f2c4149c..d610e7e4d0f0 100644 --- a/xmloff/source/script/xmlbasicscript.cxx +++ b/xmloff/source/script/xmlbasicscript.cxx @@ -71,11 +71,6 @@ bool BasicElementBase::getBoolAttr(bool* pRet, sal_Int32 nToken, return false; } -void BasicElementBase::startFastElement(sal_Int32 /*nElement*/, - const Reference<XFastAttributeList>& /*xAttributes*/) -{ -} - // BasicLibrariesElement BasicLibrariesElement::BasicLibrariesElement(SvXMLImport& rImport, diff --git a/xmloff/source/script/xmlbasicscript.hxx b/xmloff/source/script/xmlbasicscript.hxx index b8a03a5b72a8..1d94f344b5d6 100644 --- a/xmloff/source/script/xmlbasicscript.hxx +++ b/xmloff/source/script/xmlbasicscript.hxx @@ -38,10 +38,6 @@ protected: public: BasicElementBase(SvXMLImport& rImport); - - virtual void SAL_CALL startFastElement( - sal_Int32 nElement, - const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttribs) override; }; class BasicLibrariesElement : public BasicElementBase diff --git a/xmloff/source/script/xmlscripti.cxx b/xmloff/source/script/xmlscripti.cxx index 35bdfd3abb3c..16bcfaee7281 100644 --- a/xmloff/source/script/xmlscripti.cxx +++ b/xmloff/source/script/xmlscripti.cxx @@ -54,9 +54,6 @@ public: virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; - - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} }; } diff --git a/xmloff/source/style/FillStyleContext.hxx b/xmloff/source/style/FillStyleContext.hxx index 026754ac6402..aac0b8b31b15 100644 --- a/xmloff/source/style/FillStyleContext.hxx +++ b/xmloff/source/style/FillStyleContext.hxx @@ -38,8 +38,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual ~XMLGradientStyleContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual bool IsTransient() const override; @@ -59,8 +57,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual ~XMLHatchStyleContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual bool IsTransient() const override; @@ -84,8 +80,6 @@ public: virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual bool IsTransient() const override; @@ -105,8 +99,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual ~XMLTransGradientStyleContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual bool IsTransient() const override; @@ -126,8 +118,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual ~XMLMarkerStyleContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual bool IsTransient() const override; @@ -147,8 +137,6 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); virtual ~XMLDashStyleContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual bool IsTransient() const override; diff --git a/xmloff/source/style/PageHeaderFooterContext.hxx b/xmloff/source/style/PageHeaderFooterContext.hxx index b72f3f011dfa..c767f609c47b 100644 --- a/xmloff/source/style/PageHeaderFooterContext.hxx +++ b/xmloff/source/style/PageHeaderFooterContext.hxx @@ -40,9 +40,6 @@ public: virtual ~PageHeaderFooterContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; diff --git a/xmloff/source/style/XMLFontStylesContext_impl.hxx b/xmloff/source/style/XMLFontStylesContext_impl.hxx index 2df396c09796..72f5af7e2347 100644 --- a/xmloff/source/style/XMLFontStylesContext_impl.hxx +++ b/xmloff/source/style/XMLFontStylesContext_impl.hxx @@ -76,8 +76,6 @@ public: XMLFontStyleContextFontFaceSrc( SvXMLImport& rImport, const XMLFontStyleContextFontFace& font ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override; diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 52e2fc81744c..f02d8964c2d3 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -128,8 +128,6 @@ public: virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL characters( const OUString& rChars ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; @@ -147,8 +145,6 @@ public: SvXMLNumFmtElementContext& rParentContext, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL characters( const OUString& rChars ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; @@ -164,8 +160,6 @@ public: SvXMLNumFormatContext& rParentContext, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; @@ -180,8 +174,6 @@ public: SvXMLNumFormatContext& rParentContext, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 2593d2aa0d75..a0325c5abc9a 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -88,8 +88,6 @@ public: const Reference< xml::sax::XFastAttributeList >& xAttrList, SvxXMLListLevelStyleContext_Impl& rLLevel ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; @@ -197,8 +195,6 @@ public: SvXMLImport& rImport, sal_Int32 nElement, const Reference< xml::sax::XFastAttributeList > & xAttrList ); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; diff --git a/xmloff/source/text/XMLAutoTextContainerEventImport.hxx b/xmloff/source/text/XMLAutoTextContainerEventImport.hxx index 1910c301f423..f943ac51653d 100644 --- a/xmloff/source/text/XMLAutoTextContainerEventImport.hxx +++ b/xmloff/source/text/XMLAutoTextContainerEventImport.hxx @@ -51,14 +51,6 @@ public: protected: - virtual void SAL_CALL startFastElement( - sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) override {} - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext(sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*rxAttribs*/) override - { return nullptr; } - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/text/XMLChangeInfoContext.cxx b/xmloff/source/text/XMLChangeInfoContext.cxx index 90ff2db3831a..71ed643bc33c 100644 --- a/xmloff/source/text/XMLChangeInfoContext.cxx +++ b/xmloff/source/text/XMLChangeInfoContext.cxx @@ -48,11 +48,6 @@ XMLChangeInfoContext::~XMLChangeInfoContext() { } -void XMLChangeInfoContext::StartElement(const Reference<XAttributeList> &) -{ - // no attributes -} - SvXMLImportContextRef XMLChangeInfoContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/text/XMLChangeInfoContext.hxx b/xmloff/source/text/XMLChangeInfoContext.hxx index 557ebdad2d64..d86f9ea7b5fd 100644 --- a/xmloff/source/text/XMLChangeInfoContext.hxx +++ b/xmloff/source/text/XMLChangeInfoContext.hxx @@ -60,9 +60,6 @@ public: virtual ~XMLChangeInfoContext() override; - virtual void StartElement( - const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override; - virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx index 2aa5fb939e9f..d4415ff29c04 100644 --- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx @@ -68,8 +68,6 @@ public: XMLFootnoteConfigurationImportContext& rConfigImport, bool bBegin); - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual void SAL_CALL characters( const OUString& rChars ) override; diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx index f0cf15c8dd76..d2db5a883157 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteImportContext.cxx @@ -150,12 +150,6 @@ void XMLFootnoteImportContext::StartElement( // else: ignore footnote! Content will be merged into document. } -void XMLFootnoteImportContext::Characters(const OUString&) -{ - // ignore characters! Text must be contained in paragraphs! - // rHelper.InsertString(rString); -} - void XMLFootnoteImportContext::EndElement() { // get rid of last dummy paragraph diff --git a/xmloff/source/text/XMLFootnoteImportContext.hxx b/xmloff/source/text/XMLFootnoteImportContext.hxx index b499e5831757..30f197f81c4f 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.hxx +++ b/xmloff/source/text/XMLFootnoteImportContext.hxx @@ -64,9 +64,6 @@ protected: virtual void StartElement( const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override; - virtual void Characters( - const OUString& rChars) override; - virtual void EndElement() override; virtual SvXMLImportContextRef CreateChildContext( diff --git a/xmloff/source/text/XMLIndexTOCStylesContext.cxx b/xmloff/source/text/XMLIndexTOCStylesContext.cxx index 3b543c14bbc9..b116f1cc1e5c 100644 --- a/xmloff/source/text/XMLIndexTOCStylesContext.cxx +++ b/xmloff/source/text/XMLIndexTOCStylesContext.cxx @@ -133,8 +133,7 @@ SvXMLImportContextRef XMLIndexTOCStylesContext::CreateChildContext( } // always return default context; we already got the interesting info - return SvXMLImportContext::CreateChildContext(p_nPrefix, rLocalName, - xAttrList); + return new SvXMLImportContext(GetImport()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx index bfcf041bba19..c45c3ffe1a2b 100644 --- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx +++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx @@ -119,9 +119,4 @@ void XMLSectionSourceDDEImportContext::startFastElement(sal_Int32 /*nElement*/, } -void XMLSectionSourceDDEImportContext::endFastElement(sal_Int32 /*nElement*/) -{ - // nothing to be done! -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx index 7f646c65a067..b7af6c0d3372 100644 --- a/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx +++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx @@ -47,8 +47,6 @@ protected: virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override; - - virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; #endif diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx index b1cfd6063822..0ceb68eda53d 100644 --- a/xmloff/source/text/XMLSectionSourceImportContext.cxx +++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx @@ -123,9 +123,4 @@ void XMLSectionSourceImportContext::StartElement( } } -void XMLSectionSourceImportContext::EndElement() -{ - // this space intentionally left blank. -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLSectionSourceImportContext.hxx b/xmloff/source/text/XMLSectionSourceImportContext.hxx index 9bdb6b7733eb..33fb2e966291 100644 --- a/xmloff/source/text/XMLSectionSourceImportContext.hxx +++ b/xmloff/source/text/XMLSectionSourceImportContext.hxx @@ -47,8 +47,6 @@ protected: virtual void StartElement( const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override; - - virtual void EndElement() override; }; #endif diff --git a/xmloff/source/text/XMLStringBufferImportContext.cxx b/xmloff/source/text/XMLStringBufferImportContext.cxx index 5d72ffc2f975..f61db1fdf6d3 100644 --- a/xmloff/source/text/XMLStringBufferImportContext.cxx +++ b/xmloff/source/text/XMLStringBufferImportContext.cxx @@ -56,26 +56,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLStringBufferImportC return new XMLStringBufferImportContext(GetImport(), rTextBuffer); } -SvXMLImportContextRef XMLStringBufferImportContext::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference<XAttributeList> &) -{ - return new XMLStringBufferImportContext(GetImport(), nPrefix, - rLocalName, rTextBuffer); -} - void XMLStringBufferImportContext::characters(const OUString& rChars ) { rTextBuffer.append(rChars); } -void XMLStringBufferImportContext::Characters( - const OUString& rChars ) -{ - rTextBuffer.append(rChars); -} - void XMLStringBufferImportContext::endFastElement(sal_Int32 nElement) { // add return for paragraph elements @@ -85,20 +70,4 @@ void XMLStringBufferImportContext::endFastElement(sal_Int32 nElement) } } -void XMLStringBufferImportContext::startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) -{ -} - -void XMLStringBufferImportContext::EndElement() -{ - // add return for paragraph elements - if ( (XML_NAMESPACE_TEXT == GetPrefix() || - XML_NAMESPACE_LO_EXT == GetPrefix()) && - (IsXMLToken(GetLocalName(), XML_P)) ) - { - rTextBuffer.append(u'\x000a'); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx index 865937aa9dea..8514ef2f2aa0 100644 --- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx +++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx @@ -97,10 +97,6 @@ XMLTextFrameHyperlinkContext::~XMLTextFrameHyperlinkContext() { } -void XMLTextFrameHyperlinkContext::EndElement() -{ -} - SvXMLImportContextRef XMLTextFrameHyperlinkContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx index f11f81e20de9..1c66a7f3abb6 100644 --- a/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx +++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx @@ -49,8 +49,6 @@ public: css::text::TextContentAnchorType eDefaultAnchorType ); virtual ~XMLTextFrameHyperlinkContext() override; - virtual void EndElement() override; - SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index f05218b95653..55d564a18737 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -250,8 +250,6 @@ static auto PopFieldmark(XMLTextImportHelper & rHelper) -> void void XMLTextMarkImportContext::EndElement() { - SvXMLImportContext::EndElement(); - static const char sAPI_bookmark[] = "com.sun.star.text.Bookmark"; lcl_MarkType nTmp{}; diff --git a/xmloff/source/text/txtdropi.hxx b/xmloff/source/text/txtdropi.hxx index c15d83dc95a9..9ddefc812d2b 100644 --- a/xmloff/source/text/txtdropi.hxx +++ b/xmloff/source/text/txtdropi.hxx @@ -43,8 +43,6 @@ public: virtual ~XMLTextDropCapImportContext() override; - virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {} virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; const OUString& GetStyleName() const { return sStyleName; } diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index ff54d40bc0f9..71172b5d977c 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -1234,8 +1234,7 @@ SvXMLImportContextRef XMLDatabaseFieldImportContext::CreateChildContext( ProcessAttribute( XML_TOKEN_INVALID, OUString() ); } - return SvXMLImportContext::CreateChildContext(p_nPrefix, rLocalName, - xAttrList); + return nullptr; } diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index d438400c4540..e5428059c198 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -200,27 +200,6 @@ XMLCharContext::XMLCharContext( XMLCharContext::~XMLCharContext() { } -void XMLCharContext::EndElement() -{ - if ( !m_nCount ) - InsertControlCharacter( m_nControl ); - else - { - if( 1U == m_nCount ) - { - OUString sBuff( &m_c, 1 ); - InsertString(sBuff); - } - else - { - OUStringBuffer sBuff(static_cast<int>(m_nCount)); - while( m_nCount-- ) - sBuff.append( &m_c, 1 ); - - InsertString(sBuff.makeStringAndClear() ); - } - } -} void XMLCharContext::endFastElement(sal_Int32 ) { if ( !m_nCount ) |