diff options
author | Mohammed Abdul Azeem <azeemmysore@gmail.com> | 2017-10-01 14:11:11 +0530 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-03-14 14:12:08 +0100 |
commit | bf46b46a1d734348096936284fb8a76e977936d0 (patch) | |
tree | a76c30897cf1e49491bf26580c823701b6d74778 /xmloff/source/chart/contexts.cxx | |
parent | 1b61d0417bf46896ef1f1bd1e1a8209588fc157a (diff) |
Moving XSAXDocumentBuilder2 to use XFastDocumentHandler:
This is used in parsing of meta Contexts across different
modules. This also involved moving to XFastParser for
parsing xml filters in sw, sd, starmath.
Change-Id: Ic663aaac6cb20ee8ce5b97cae87c93220f5a2929
Reviewed-on: https://gerrit.libreoffice.org/42989
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'xmloff/source/chart/contexts.cxx')
-rw-r--r-- | xmloff/source/chart/contexts.cxx | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx index 2ddb5030cb6c..ebba9adaed70 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -77,6 +77,18 @@ SchXMLDocContext::SchXMLDocContext( SchXMLImportHelper& rImpHelper, !IsXMLToken( rLName, XML_DOCUMENT_CONTENT) ), "xmloff.chart", "SchXMLDocContext instantiated with no <office:document> element" ); } +SchXMLDocContext::SchXMLDocContext( SchXMLImportHelper& rImpHelper, + SvXMLImport& rImport, + sal_Int32 nElement ) : + SvXMLImportContext( rImport ), + mrImportHelper( rImpHelper ) +{ + SAL_WARN_IF(( nElement != XML_ELEMENT( OFFICE, XML_DOCUMENT ) && + nElement != XML_ELEMENT( OFFICE, XML_DOCUMENT_META ) && + nElement != XML_ELEMENT( OFFICE, XML_DOCUMENT_STYLES ) && + nElement != XML_ELEMENT( OFFICE, XML_DOCUMENT_CONTENT ) ), "xmloff.chart", "SchXMLDocContext instantiated with no <office:document> element" ); +} + SchXMLDocContext::~SchXMLDocContext() {} @@ -122,31 +134,33 @@ SvXMLImportContextRef SchXMLDocContext::CreateChildContext( return xContext; } +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SchXMLDocContext::createFastChildContext( + sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ ) +{ + return new SvXMLImportContext( GetImport() ); +} + SchXMLFlatDocContext_Impl::SchXMLFlatDocContext_Impl( SchXMLImportHelper& i_rImpHelper, SchXMLImport& i_rImport, - sal_uInt16 i_nPrefix, const OUString & i_rLName, + sal_Int32 i_nElement, const uno::Reference<document::XDocumentProperties>& i_xDocProps) : - SvXMLImportContext(i_rImport, i_nPrefix, i_rLName), - SchXMLDocContext(i_rImpHelper, i_rImport, i_nPrefix, i_rLName), - SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName, - i_xDocProps) + SvXMLImportContext(i_rImport), + SchXMLDocContext(i_rImpHelper, i_rImport, i_nElement), + SvXMLMetaDocumentContext(i_rImport, i_xDocProps) { } -SvXMLImportContextRef SchXMLFlatDocContext_Impl::CreateChildContext( - sal_uInt16 i_nPrefix, const OUString& i_rLocalName, - const uno::Reference<xml::sax::XAttributeList>& i_xAttrList) +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SchXMLFlatDocContext_Impl::createFastChildContext( + sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) { // behave like meta base class iff we encounter office:meta - const SvXMLTokenMap& rTokenMap = - mrImportHelper.GetDocElemTokenMap(); - if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) { - return SvXMLMetaDocumentContext::CreateChildContext( - i_nPrefix, i_rLocalName, i_xAttrList ); + if ( nElement == XML_ELEMENT( OFFICE, XML_META ) ) { + return SvXMLMetaDocumentContext::createFastChildContext( + nElement, xAttrList ); } else { - return SchXMLDocContext::CreateChildContext( - i_nPrefix, i_rLocalName, i_xAttrList ); + return SchXMLDocContext::createFastChildContext( + nElement, xAttrList ); } } |