fastparser in a couple of random places
Change-Id: I9c88c826cfffa71f389f78f9d18d46e097e540ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107217
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index bebc30a..10c33b3 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -1061,10 +1061,9 @@ private:
virtual void PrepareField(
const css::uno::Reference< css::beans::XPropertySet > & xPropertySet) 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 >& AttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 896aaf3..6f892de 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -1301,10 +1301,11 @@ namespace xmloff
enableTrackAttributes();
}
SvXMLImportContextRef OTextLikeImport::CreateChildContext( sal_uInt16 _nPrefix, const OUString& _rLocalName,
const Reference< XAttributeList >& _rxAttrList )
css::uno::Reference< css::xml::sax::XFastContextHandler > OTextLikeImport::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
if ( ( XML_NAMESPACE_TEXT == _nPrefix ) && _rLocalName.equalsIgnoreAsciiCase("p") )
if ( nElement == XML_ELEMENT(TEXT, XML_P) )
{
OSL_ENSURE( m_eElementType == OControlElement::TEXT_AREA,
"OTextLikeImport::CreateChildContext: text paragraphs in a non-text-area?" );
@@ -1327,7 +1328,7 @@ namespace xmloff
if ( m_xCursor.is() )
{
m_bEncounteredTextPara = true;
return xTextImportHelper->CreateTextChildContext( m_rContext.getGlobalContext(), _nPrefix, _rLocalName, _rxAttrList );
return xTextImportHelper->CreateTextChildContext( m_rContext.getGlobalContext(), nElement, xAttrList );
}
}
else
diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx
index 67eebc2..a3f9d6d 100644
--- a/xmloff/source/forms/elementimport.hxx
+++ b/xmloff/source/forms/elementimport.hxx
@@ -420,9 +420,9 @@ namespace xmloff
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) override;
virtual SvXMLImportContextRef CreateChildContext(
sal_uInt16 _nPrefix, const OUString& _rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) 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;
private:
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 60c6027..96cfd800 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3309,65 +3309,51 @@ void XMLAnnotationImportContext::ProcessAttribute(
XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
}
SvXMLImportContextRef XMLAnnotationImportContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference<XAttributeList >& xAttrList )
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnnotationImportContext::createFastChildContext(
sal_Int32 nElement,
const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
{
SvXMLImportContext *pContext = nullptr;
if( XML_NAMESPACE_DC == nPrefix )
{
if( IsXMLToken( rLocalName, XML_CREATOR ) )
pContext = new XMLStringBufferImportContext(GetImport(), aAuthorBuffer);
else if( IsXMLToken( rLocalName, XML_DATE ) )
pContext = new XMLStringBufferImportContext(GetImport(), aDateBuffer);
}
else if (((XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
&& IsXMLToken(rLocalName, XML_SENDER_INITIALS))
|| (XML_NAMESPACE_META == nPrefix
&& IsXMLToken(rLocalName, XML_CREATOR_INITIALS)))
{
pContext = new XMLStringBufferImportContext(GetImport(), aInitialsBuffer);
}
if( nElement == XML_ELEMENT(DC, XML_CREATOR) )
return new XMLStringBufferImportContext(GetImport(), aAuthorBuffer);
else if( nElement == XML_ELEMENT(DC, XML_DATE) )
return new XMLStringBufferImportContext(GetImport(), aDateBuffer);
else if (nElement == XML_ELEMENT(TEXT,XML_SENDER_INITIALS) ||
nElement == XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS) ||
nElement == XML_ELEMENT(META, XML_CREATOR_INITIALS))
return new XMLStringBufferImportContext(GetImport(), aInitialsBuffer);
if( !pContext )
try
{
try
bool bOK = true;
if ( !mxField.is() )
bOK = CreateField( mxField, sServicePrefix + GetServiceName() );
if (bOK)
{
bool bOK = true;
if ( !mxField.is() )
bOK = CreateField( mxField, sServicePrefix + GetServiceName() );
if (bOK)
Any aAny = mxField->getPropertyValue( "TextRange" );
Reference< XText > xText;
aAny >>= xText;
if( xText.is() )
{
Any aAny = mxField->getPropertyValue( "TextRange" );
Reference< XText > xText;
aAny >>= xText;
if( xText.is() )
rtl::Reference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
if( !mxCursor.is() )
{
rtl::Reference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
if( !mxCursor.is() )
{
mxOldCursor = xTxtImport->GetCursor();
mxCursor = xText->createTextCursor();
}
mxOldCursor = xTxtImport->GetCursor();
mxCursor = xText->createTextCursor();
}
if( mxCursor.is() )
{
xTxtImport->SetCursor( mxCursor );
pContext = xTxtImport->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
}
if( mxCursor.is() )
{
xTxtImport->SetCursor( mxCursor );
return xTxtImport->CreateTextChildContext( GetImport(), nElement, xAttrList );
}
}
}
catch (const Exception&)
{
}
if( !pContext )
pContext = new XMLStringBufferImportContext(GetImport(), aTextBuffer);
}
catch (const Exception&)
{
}
return pContext;
return new XMLStringBufferImportContext(GetImport(), aTextBuffer);
}
void XMLAnnotationImportContext::endFastElement(sal_Int32 )