[Libreoffice-commits] core.git: include/xmloff sc/source xmloff/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 6 07:09:38 UTC 2020
include/xmloff/XMLEventsImportContext.hxx | 2
sc/source/filter/xml/xmlcvali.cxx | 78 ++++++++----------------
xmloff/source/script/XMLEventsImportContext.cxx | 5 +
3 files changed, 35 insertions(+), 50 deletions(-)
New commits:
commit ae854970bf9c734df132797c0f23a7829efd167c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Mar 5 12:40:57 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Mar 6 08:09:04 2020 +0100
use more FastParser in ScXMLContentValidationContext
Change-Id: I958d2ad1a8dc6c2a3da1c1a4fc6bd4f0011367fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90055
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/xmloff/XMLEventsImportContext.hxx b/include/xmloff/XMLEventsImportContext.hxx
index 4b843015fa14..8e98853796d1 100644
--- a/include/xmloff/XMLEventsImportContext.hxx
+++ b/include/xmloff/XMLEventsImportContext.hxx
@@ -67,6 +67,8 @@ public:
sal_uInt16 nPrfx,
const OUString& rLocalName);
+ XMLEventsImportContext(SvXMLImport& rImport);
+
XMLEventsImportContext(
SvXMLImport& rImport,
sal_uInt16 nPrfx,
diff --git a/sc/source/filter/xml/xmlcvali.cxx b/sc/source/filter/xml/xmlcvali.cxx
index e32fe80cfb84..c96572c26715 100644
--- a/sc/source/filter/xml/xmlcvali.cxx
+++ b/sc/source/filter/xml/xmlcvali.cxx
@@ -62,10 +62,6 @@ public:
ScXMLContentValidationContext( ScXMLImport& rImport,
const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList );
- 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;
@@ -91,9 +87,9 @@ public:
const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
ScXMLContentValidationContext* pValidationContext);
- 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;
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
};
@@ -114,9 +110,9 @@ public:
const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
ScXMLContentValidationContext* pValidationContext);
- 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;
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
};
@@ -132,9 +128,9 @@ public:
const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
ScXMLContentValidationContext* pValidationContext);
- 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;
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
};
@@ -218,24 +214,6 @@ ScXMLContentValidationContext::ScXMLContentValidationContext( ScXMLImport& rImpo
}
}
-SvXMLImportContextRef ScXMLContentValidationContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttrList*/ )
-{
- SvXMLImportContext *pContext = nullptr;
-
- const SvXMLTokenMap& rTokenMap = GetScImport().GetContentValidationElemTokenMap();
- switch( rTokenMap.Get( nPrefix, rLName ) )
- {
- case XML_TOK_CONTENT_VALIDATION_ELEM_EVENT_LISTENERS:
- pContext = new XMLEventsImportContext( GetImport(), nPrefix, rLName );
- xEventContext = pContext;
- break;
- }
-
- return pContext;
-}
-
uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLContentValidationContext::createFastChildContext(
sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
@@ -254,6 +232,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLContentValidationC
case XML_ELEMENT( TABLE, XML_ERROR_MACRO ):
pContext = new ScXMLErrorMacroContext( GetScImport(), pAttribList, this);
break;
+ case XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS):
+ pContext = new XMLEventsImportContext( GetImport() );
+ xEventContext = pContext;
}
return pContext;
@@ -455,21 +436,20 @@ ScXMLHelpMessageContext::ScXMLHelpMessageContext( ScXMLImport& rImport,
}
}
-SvXMLImportContextRef ScXMLHelpMessageContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttrList*/ )
+css::uno::Reference< css::xml::sax::XFastContextHandler > ScXMLHelpMessageContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
SvXMLImportContext *pContext = nullptr;
- const SvXMLTokenMap& rTokenMap = GetScImport().GetContentValidationMessageElemTokenMap();
- switch( rTokenMap.Get( nPrefix, rLName ) )
+ switch( nElement )
{
- case XML_TOK_P:
+ case XML_ELEMENT(TEXT, XML_P):
{
if(nParagraphCount)
sMessage.append('\n');
++nParagraphCount;
- pContext = new ScXMLContentContext( GetScImport(), nPrefix, rLName, sMessage);
+ pContext = new ScXMLContentContext( GetScImport(), sMessage );
}
break;
}
@@ -513,21 +493,20 @@ ScXMLErrorMessageContext::ScXMLErrorMessageContext( ScXMLImport& rImport,
}
}
-SvXMLImportContextRef ScXMLErrorMessageContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttrList*/ )
+css::uno::Reference< css::xml::sax::XFastContextHandler > ScXMLErrorMessageContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
SvXMLImportContext *pContext = nullptr;
- const SvXMLTokenMap& rTokenMap = GetScImport().GetContentValidationMessageElemTokenMap();
- switch( rTokenMap.Get( nPrefix, rLName ) )
+ switch( nElement )
{
- case XML_TOK_P:
+ case XML_ELEMENT(TEXT, XML_P):
{
if(nParagraphCount)
sMessage.append('\n');
++nParagraphCount;
- pContext = new ScXMLContentContext( GetScImport(), nPrefix, rLName, sMessage);
+ pContext = new ScXMLContentContext( GetScImport(), sMessage);
}
break;
}
@@ -563,15 +542,14 @@ ScXMLErrorMacroContext::ScXMLErrorMacroContext( ScXMLImport& rImport,
}
}
-SvXMLImportContextRef ScXMLErrorMacroContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
+css::uno::Reference< css::xml::sax::XFastContextHandler > ScXMLErrorMacroContext::createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
SvXMLImportContext *pContext = nullptr;
- if ((nPrefix == XML_NAMESPACE_SCRIPT) && IsXMLToken(rLName, XML_EVENTS))
+ if (nElement == XML_ELEMENT(SCRIPT, XML_EVENTS))
{
- pContext = new XMLEventsImportContext(GetImport(), nPrefix, rLName);
+ pContext = new XMLEventsImportContext(GetImport());
}
return pContext;
diff --git a/xmloff/source/script/XMLEventsImportContext.cxx b/xmloff/source/script/XMLEventsImportContext.cxx
index d58be893909a..cb7679cc3b63 100644
--- a/xmloff/source/script/XMLEventsImportContext.cxx
+++ b/xmloff/source/script/XMLEventsImportContext.cxx
@@ -47,6 +47,11 @@ XMLEventsImportContext::XMLEventsImportContext(
{
}
+XMLEventsImportContext::XMLEventsImportContext(SvXMLImport& rImport) :
+ SvXMLImportContext(rImport)
+{
+}
+
XMLEventsImportContext::XMLEventsImportContext(
SvXMLImport& rImport,
More information about the Libreoffice-commits
mailing list