[Libreoffice-commits] core.git: xmloff/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 3 07:06:37 UTC 2020
xmloff/source/text/XMLSectionImportContext.cxx | 64 +++++++++++++++----------
xmloff/source/text/XMLSectionImportContext.hxx | 4 +
2 files changed, 44 insertions(+), 24 deletions(-)
New commits:
commit 8b961a2aa5ca8bee4081f083ce4accacb110137b
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Wed Dec 2 14:41:22 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Dec 3 08:06:01 2020 +0100
fastparser in XMLSectionImportContext
Change-Id: If6d2b5a73265acecc7947e11b1107ef72f075836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107129
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
index 11716281bd7e..4cf133e11225 100644
--- a/xmloff/source/text/XMLSectionImportContext.cxx
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -229,41 +229,41 @@ void XMLSectionImportContext::ProcessAttributes(
{
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sAttr = aIter.toString();
+ OUString sValue = aIter.toString();
switch (aIter.getToken())
{
case XML_ELEMENT(XML, XML_ID):
- sXmlId = sAttr;
+ sXmlId = sValue;
break;
case XML_ELEMENT(TEXT, XML_STYLE_NAME):
- sStyleName = sAttr;
+ sStyleName = sValue;
break;
case XML_ELEMENT(TEXT, XML_NAME):
- sName = sAttr;
+ sName = sValue;
bValid = true;
break;
case XML_ELEMENT(TEXT, XML_CONDITION):
{
OUString sTmp;
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrValueQName(sAttr, &sTmp);
+ GetKeyByAttrValueQName(sValue, &sTmp);
if( XML_NAMESPACE_OOOW == nPrefix )
{
sCond = sTmp;
bCondOK = true;
}
else
- sCond = sAttr;
+ sCond = sValue;
}
break;
case XML_ELEMENT(TEXT, XML_DISPLAY):
- if (IsXMLToken(sAttr, XML_TRUE))
+ if (IsXMLToken(sValue, XML_TRUE))
{
bIsVisible = true;
}
- else if ( IsXMLToken(sAttr, XML_NONE) ||
- IsXMLToken(sAttr, XML_CONDITION) )
+ else if ( IsXMLToken(sValue, XML_NONE) ||
+ IsXMLToken(sValue, XML_CONDITION) )
{
bIsVisible = false;
}
@@ -272,7 +272,7 @@ void XMLSectionImportContext::ProcessAttributes(
case XML_ELEMENT(TEXT, XML_IS_HIDDEN):
{
bool bTmp(false);
- if (::sax::Converter::convertBool(bTmp, sAttr))
+ if (::sax::Converter::convertBool(bTmp, sValue))
{
bIsCurrentlyVisible = !bTmp;
bIsCurrentlyVisibleOK = true;
@@ -280,7 +280,7 @@ void XMLSectionImportContext::ProcessAttributes(
}
break;
case XML_ELEMENT(TEXT, XML_PROTECTION_KEY):
- ::comphelper::Base64::decode(aSequence, sAttr);
+ ::comphelper::Base64::decode(aSequence, sValue);
bSequenceOK = true;
break;
case XML_ELEMENT(TEXT, XML_PROTECTED):
@@ -288,7 +288,7 @@ void XMLSectionImportContext::ProcessAttributes(
case XML_ELEMENT(TEXT, XML_PROTECT):
{
bool bTmp(false);
- if (::sax::Converter::convertBool(bTmp, sAttr))
+ if (::sax::Converter::convertBool(bTmp, sValue))
{
bProtect = bTmp;
}
@@ -324,10 +324,37 @@ void XMLSectionImportContext::endFastElement(sal_Int32 )
rHelper->RedlineAdjustStartNodeCursor();
}
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLSectionImportContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
+{
+ // section-source (-dde) elements
+ if ( nElement == XML_ELEMENT(TEXT, XML_SECTION_SOURCE) )
+ {
+ }
+ else if ( nElement == XML_ELEMENT(OFFICE, XML_DDE_SOURCE) )
+ {
+ }
+ else
+ {
+ // otherwise: text context
+ auto pContext = GetImport().GetTextImport()->CreateTextChildContext(
+ GetImport(), nElement, xAttrList, XMLTextType::Section );
+
+ // if that fails, default context
+ if (pContext)
+ bHasContent = true;
+ else
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+ return pContext;
+ }
+ return nullptr;
+}
+
SvXMLImportContextRef XMLSectionImportContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
- const Reference<XAttributeList> & xAttrList )
+ const Reference<XAttributeList> & /*xAttrList*/ )
{
SvXMLImportContext* pContext = nullptr;
@@ -345,17 +372,6 @@ SvXMLImportContextRef XMLSectionImportContext::CreateChildContext(
nPrefix, rLocalName,
xSectionPropertySet);
}
- else
- {
- // otherwise: text context
- pContext = GetImport().GetTextImport()->CreateTextChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList,
- XMLTextType::Section );
-
- // if that fails, default context
- if (pContext)
- bHasContent = true;
- }
return pContext;
}
diff --git a/xmloff/source/text/XMLSectionImportContext.hxx b/xmloff/source/text/XMLSectionImportContext.hxx
index 38f8c536684e..bad10a2e6a24 100644
--- a/xmloff/source/text/XMLSectionImportContext.hxx
+++ b/xmloff/source/text/XMLSectionImportContext.hxx
@@ -70,6 +70,10 @@ private:
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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 SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
More information about the Libreoffice-commits
mailing list