summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-11-17 21:40:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-18 09:28:16 +0100
commit388b624dde64fd6c86f15b21f8ac3e42ce9a9db5 (patch)
tree7ce42cf07202545259422b3a14baaf2932297175
parentf7c8535a1e0bf2deda6c5f6d8d8469f5ab7fa07f (diff)
fastparser in SchXMLTitleContext
Change-Id: Ie11234a520f344e775d6ae4c030cef5c741233a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106026 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx47
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx10
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.cxx11
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.hxx3
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx2
-rw-r--r--xmloff/source/chart/SchXMLTextListContext.cxx2
6 files changed, 31 insertions, 44 deletions
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index a183d0b1e5f4..968bf0cfa76a 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -1205,40 +1205,39 @@ SchXMLTitleContext::SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImp
SchXMLTitleContext::~SchXMLTitleContext()
{}
-void SchXMLTitleContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+void SchXMLTitleContext::startFastElement( sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
-
css::awt::Point aPosition;
bool bHasXPosition=false;
bool bHasYPosition=false;
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- OUString aValue = xAttrList->getValueByIndex( i );
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if( nPrefix == XML_NAMESPACE_SVG )
+ OUString aValue = aIter.toString();
+ switch (aIter.getToken())
{
- if( IsXMLToken( aLocalName, XML_X ) )
+ case XML_ELEMENT(SVG, XML_X):
+ case XML_ELEMENT(SVG_COMPAT, XML_X):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
aPosition.X, aValue );
bHasXPosition = true;
+ break;
}
- else if( IsXMLToken( aLocalName, XML_Y ) )
+ case XML_ELEMENT(SVG, XML_Y):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
aPosition.Y, aValue );
bHasYPosition = true;
+ break;
}
- }
- else if( nPrefix == XML_NAMESPACE_CHART )
- {
- if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ case XML_ELEMENT(CHART, XML_STYLE_NAME):
msAutoStyleName = aValue;
+ break;
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
@@ -1252,19 +1251,19 @@ void SchXMLTitleContext::StartElement( const uno::Reference< xml::sax::XAttribut
}
}
-SvXMLImportContextRef SchXMLTitleContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList >& )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTitleContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
SvXMLImportContext* pContext = nullptr;
- if( (nPrefix == XML_NAMESPACE_TEXT ||
- nPrefix == XML_NAMESPACE_LO_EXT) &&
- IsXMLToken( rLocalName, XML_P ) )
+ if( nElement == XML_ELEMENT(TEXT, XML_P) ||
+ nElement == XML_ELEMENT(LO_EXT, XML_P) )
{
- pContext = new SchXMLParagraphContext( GetImport(), rLocalName, mrTitle );
+ pContext = new SchXMLParagraphContext( GetImport(), mrTitle );
}
+ else
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
return pContext;
}
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
index ce1868b0adc3..251431912d75 100644
--- a/xmloff/source/chart/SchXMLChartContext.hxx
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -143,11 +143,11 @@ public:
css::uno::Reference< css::drawing::XShape > const & xTitleShape );
virtual ~SchXMLTitleContext() override;
- virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
+ virtual void SAL_CALL startFastElement( sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& 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;
};
#endif // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLCHARTCONTEXT_HXX
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx
index 75c8be5e4764..85c360d17d84 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.cxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -32,20 +32,11 @@ using namespace com::sun::star;
using namespace ::xmloff::token;
SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport,
- const OUString& rLocalName,
OUString& rText,
OUString * pOutId /* = 0 */ ) :
- SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ),
- mrText( rText ),
- mpId( pOutId )
-{
-}
-
-SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport,
- OUString& rText ) :
SvXMLImportContext( rImport ),
mrText( rText ),
- mpId( nullptr )
+ mpId( pOutId )
{
}
diff --git a/xmloff/source/chart/SchXMLParagraphContext.hxx b/xmloff/source/chart/SchXMLParagraphContext.hxx
index 3d2599e9845a..d9db36a916fc 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.hxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.hxx
@@ -36,11 +36,8 @@ private:
public:
SchXMLParagraphContext( SvXMLImport& rImport,
- const OUString& rLocalName,
OUString& rText,
OUString * pOutId = nullptr );
- SchXMLParagraphContext( SvXMLImport& rImport,
- OUString& rText );
virtual ~SchXMLParagraphContext() override;
virtual void SAL_CALL startFastElement(
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index c0c88c1274a4..a6119fae5eb2 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -664,7 +664,7 @@ SvXMLImportContextRef SchXMLTableCellContext::CreateChildContext(
else if( (nPrefix == XML_NAMESPACE_TEXT ||
nPrefix == XML_NAMESPACE_LO_EXT) && IsXMLToken( rLocalName, XML_P ) )
{
- pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId );
+ pContext = new SchXMLParagraphContext( GetImport(), maCellContent, &maRangeId );
}
// <draw:g> element - read range
else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_G ) )
diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx
index c04d33ff9281..b49964726e72 100644
--- a/xmloff/source/chart/SchXMLTextListContext.cxx
+++ b/xmloff/source/chart/SchXMLTextListContext.cxx
@@ -62,7 +62,7 @@ SvXMLImportContextRef SchXMLListItemContext::CreateChildContext(
SvXMLImportContext* pContext = nullptr;
if( (nPrefix == XML_NAMESPACE_TEXT ||
nPrefix == XML_NAMESPACE_LO_EXT) && IsXMLToken( rLocalName, XML_P ) )
- pContext = new SchXMLParagraphContext( GetImport(), rLocalName, m_rText );
+ pContext = new SchXMLParagraphContext( GetImport(), m_rText );
return pContext;
}