summaryrefslogtreecommitdiff
path: root/xmloff/source/chart
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/chart')
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx41
-rw-r--r--xmloff/source/chart/contexts.cxx44
-rw-r--r--xmloff/source/chart/contexts.hxx17
3 files changed, 72 insertions, 30 deletions
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index eab97676edff..c1cdfc91d813 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -528,16 +528,7 @@ SvXMLImportContext *SchXMLImport::CreateDocumentContext(sal_uInt16 const nPrefix
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
GetModel(), uno::UNO_QUERY);
// mst@: right now, this seems to be not supported, so it is untested
- if (xDPS.is()) {
- pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
- ? new SvXMLMetaDocumentContext(*this,
- XML_NAMESPACE_OFFICE, rLocalName,
- xDPS->getDocumentProperties())
- // flat OpenDocument file format
- : new SchXMLFlatDocContext_Impl(
- *maImportHelper.get(), *this, nPrefix, rLocalName,
- xDPS->getDocumentProperties());
- } else {
+ if (!xDPS.is()) {
pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
? SvXMLImport::CreateDocumentContext(nPrefix, rLocalName, xAttrList)
: new SchXMLDocContext( *maImportHelper.get(), *this,
@@ -550,6 +541,36 @@ SvXMLImportContext *SchXMLImport::CreateDocumentContext(sal_uInt16 const nPrefix
return pContext;
}
+SvXMLImportContext *SchXMLImport::CreateFastContext( sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
+{
+ SvXMLImportContext* pContext = nullptr;
+
+ switch (nElement)
+ {
+ case XML_ELEMENT( OFFICE, XML_DOCUMENT ):
+ case XML_ELEMENT( OFFICE, XML_DOCUMENT_META ):
+ {
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY);
+ // mst@: right now, this seems to be not supported, so it is untested
+ if (xDPS.is()) {
+ pContext = (nElement == XML_ELEMENT( OFFICE, XML_DOCUMENT_META ))
+ ? new SvXMLMetaDocumentContext(*this,
+ xDPS->getDocumentProperties())
+ // flat OpenDocument file format
+ : new SchXMLFlatDocContext_Impl(
+ *maImportHelper.get(), *this, nElement,
+ xDPS->getDocumentProperties());
+ }
+ }
+ break;
+ default:
+ pContext = new SvXMLImportContext( *this );
+ }
+ return pContext;
+}
+
SvXMLImportContext* SchXMLImport::CreateStylesContext(
const OUString& rLocalName,
const Reference<xml::sax::XAttributeList>& xAttrList )
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 );
}
}
diff --git a/xmloff/source/chart/contexts.hxx b/xmloff/source/chart/contexts.hxx
index 9820cd3b76e4..c2980d800682 100644
--- a/xmloff/source/chart/contexts.hxx
+++ b/xmloff/source/chart/contexts.hxx
@@ -47,13 +47,21 @@ public:
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLName );
- virtual ~SchXMLDocContext() override;
+ SchXMLDocContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_Int32 nElement );
+
+ virtual ~SchXMLDocContext() override;
virtual SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) 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;
};
// context for flat file xml format
@@ -64,12 +72,11 @@ public:
SchXMLFlatDocContext_Impl(
SchXMLImportHelper& i_rImpHelper,
SchXMLImport& i_rImport,
- sal_uInt16 i_nPrefix, const OUString & i_rLName,
+ sal_Int32 i_nElement,
const css::uno::Reference<css::document::XDocumentProperties>& i_xDocProps);
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& i_xAttrList) 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;
};
class SchXMLBodyContext : public SvXMLImportContext