[Libreoffice-commits] core.git: xmloff/inc xmloff/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Aug 30 06:10:15 UTC 2020
xmloff/inc/XMLBackgroundImageContext.hxx | 5
xmloff/inc/XMLElementPropertyContext.hxx | 1
xmloff/inc/XMLTextColumnsContext.hxx | 5
xmloff/source/chart/SchXMLParagraphContext.cxx | 53 +++++++++
xmloff/source/chart/SchXMLParagraphContext.hxx | 13 +-
xmloff/source/chart/XMLLabelSeparatorContext.cxx | 17 +--
xmloff/source/chart/XMLLabelSeparatorContext.hxx | 6 -
xmloff/source/chart/XMLSymbolImageContext.cxx | 18 +--
xmloff/source/chart/XMLSymbolImageContext.hxx | 6 -
xmloff/source/style/XMLBackgroundImageContext.cxx | 19 +--
xmloff/source/text/XMLTextColumnsContext.cxx | 122 ++++++++--------------
11 files changed, 142 insertions(+), 123 deletions(-)
New commits:
commit 36914a8b3a07391d225bce593236d6fcf0cc61d2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 28 20:21:42 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 30 08:09:30 2020 +0200
use fastparser in XMLElementPropertyContext subclasses
Change-Id: Ib19b7372debb0a213bbe8f27c70ff9f0393797fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101631
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmloff/inc/XMLBackgroundImageContext.hxx b/xmloff/inc/XMLBackgroundImageContext.hxx
index c5ffa768710d..3ad9509e7bca 100644
--- a/xmloff/inc/XMLBackgroundImageContext.hxx
+++ b/xmloff/inc/XMLBackgroundImageContext.hxx
@@ -60,9 +60,8 @@ public:
virtual ~XMLBackgroundImageContext() override;
- 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 startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
diff --git a/xmloff/inc/XMLElementPropertyContext.hxx b/xmloff/inc/XMLElementPropertyContext.hxx
index 5c09efc05559..427e6d0f46ac 100644
--- a/xmloff/inc/XMLElementPropertyContext.hxx
+++ b/xmloff/inc/XMLElementPropertyContext.hxx
@@ -48,7 +48,6 @@ public:
virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
-
};
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx
index 82a64395040f..99e3bbaf07c3 100644
--- a/xmloff/inc/XMLTextColumnsContext.hxx
+++ b/xmloff/inc/XMLTextColumnsContext.hxx
@@ -50,9 +50,8 @@ public:
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps );
- 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 startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx
index e99a5bedb7a0..f46d45cc5eb9 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.cxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -20,6 +20,7 @@
#include "SchXMLParagraphContext.hxx"
+#include <sal/log.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
@@ -40,6 +41,15 @@ SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport,
{
}
+SchXMLParagraphContext::SchXMLParagraphContext( SvXMLImport& rImport,
+ OUString& rText,
+ OUString * pOutId /* = 0 */ ) :
+ SvXMLImportContext( rImport ),
+ mrText( rText ),
+ mpId( pOutId )
+{
+}
+
SchXMLParagraphContext::~SchXMLParagraphContext()
{}
@@ -82,6 +92,44 @@ void SchXMLParagraphContext::EndElement()
mrText = maBuffer.makeStringAndClear();
}
+void SchXMLParagraphContext::startFastElement(
+ sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
+{
+ // remember the id. It is used for storing the original cell range string in
+ // a local table (cached data)
+ if( !mpId )
+ return;
+
+ bool bHaveXmlId( false );
+
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
+ {
+ switch(aIter.getToken())
+ {
+ case XML_ELEMENT(XML, XML_ID):
+ (*mpId) = aIter.toString();
+ bHaveXmlId = true;
+ break;
+ case XML_ELEMENT(TEXT, XML_ID):
+ { // text:id shall be ignored if xml:id exists
+ if (!bHaveXmlId)
+ {
+ (*mpId) = aIter.toString();
+ }
+ break;
+ }
+ default:
+ SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ }
+ }
+}
+
+void SchXMLParagraphContext::endFastElement(sal_Int32 )
+{
+ mrText = maBuffer.makeStringAndClear();
+}
+
SvXMLImportContextRef SchXMLParagraphContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
@@ -107,4 +155,9 @@ void SchXMLParagraphContext::Characters( const OUString& rChars )
maBuffer.append( rChars );
}
+void SchXMLParagraphContext::characters( const OUString& rChars )
+{
+ maBuffer.append( rChars );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLParagraphContext.hxx b/xmloff/source/chart/SchXMLParagraphContext.hxx
index 655e7e33bd08..3f2b4d25708a 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.hxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.hxx
@@ -39,16 +39,25 @@ public:
const OUString& rLocalName,
OUString& rText,
OUString * pOutId = nullptr );
+ SchXMLParagraphContext( SvXMLImport& rImport,
+ OUString& rText,
+ OUString * pOutId = nullptr );
virtual ~SchXMLParagraphContext() override;
+
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
virtual void EndElement() override;
+ virtual void Characters( const OUString& rChars ) override;
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
+ virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
+ virtual void SAL_CALL characters( const OUString& rChars ) override;
virtual SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
-
- virtual void Characters( const OUString& rChars ) override;
};
#endif // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLPARAGRAPHCONTEXT_HXX
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.cxx b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
index 90af4736b77b..b43abf82bfdc 100644
--- a/xmloff/source/chart/XMLLabelSeparatorContext.cxx
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
@@ -20,6 +20,7 @@
#include "XMLLabelSeparatorContext.hxx"
#include "SchXMLParagraphContext.hxx"
+#include <sal/log.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlimp.hxx>
@@ -43,18 +44,16 @@ void XMLLabelSeparatorContext::startFastElement( sal_Int32 /*nElement*/, const u
{
}
-SvXMLImportContextRef XMLLabelSeparatorContext::CreateChildContext(
- sal_uInt16 /*nPrefix*/, const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/ )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLLabelSeparatorContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
- SvXMLImportContext* pContext = nullptr;
- if( xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_P ) )
+ if( (nElement & TOKEN_MASK) == xmloff::token::XML_P )
{
- pContext = new SchXMLParagraphContext( GetImport(),
- rLocalName, m_aSeparator );
+ return new SchXMLParagraphContext( GetImport(), m_aSeparator );
}
-
- return pContext;
+ SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
+ return nullptr;
}
void XMLLabelSeparatorContext::endFastElement(sal_Int32 nElement)
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.hxx b/xmloff/source/chart/XMLLabelSeparatorContext.hxx
index bd94d088be59..f66b6009b495 100644
--- a/xmloff/source/chart/XMLLabelSeparatorContext.hxx
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.hxx
@@ -33,10 +33,8 @@ public:
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) 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;
private:
diff --git a/xmloff/source/chart/XMLSymbolImageContext.cxx b/xmloff/source/chart/XMLSymbolImageContext.cxx
index 881f821a89f5..50104efc8c04 100644
--- a/xmloff/source/chart/XMLSymbolImageContext.cxx
+++ b/xmloff/source/chart/XMLSymbolImageContext.cxx
@@ -89,25 +89,21 @@ void XMLSymbolImageContext::startFastElement(
}
}
-SvXMLImportContextRef XMLSymbolImageContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLSymbolImageContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
- SvXMLImportContext* pContext = nullptr;
- if( xmloff::token::IsXMLToken( rLocalName,
- xmloff::token::XML_BINARY_DATA ) )
+ if( (nElement & TOKEN_MASK) == xmloff::token::XML_BINARY_DATA )
{
if( msURL.isEmpty() && ! mxBase64Stream.is() )
{
mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
if( mxBase64Stream.is() )
- pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
- rLocalName, xAttrList,
- mxBase64Stream );
+ return new XMLBase64ImportContext( GetImport(), mxBase64Stream );
}
}
-
- return pContext;
+ SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
+ return nullptr;
}
void XMLSymbolImageContext::endFastElement(sal_Int32 nElement)
diff --git a/xmloff/source/chart/XMLSymbolImageContext.hxx b/xmloff/source/chart/XMLSymbolImageContext.hxx
index d2267db6b338..9cdc270360c6 100644
--- a/xmloff/source/chart/XMLSymbolImageContext.hxx
+++ b/xmloff/source/chart/XMLSymbolImageContext.hxx
@@ -37,10 +37,8 @@ public:
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) 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;
private:
diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx
index fdfe43008081..60e61df32c5f 100644
--- a/xmloff/source/style/XMLBackgroundImageContext.cxx
+++ b/xmloff/source/style/XMLBackgroundImageContext.cxx
@@ -342,26 +342,21 @@ XMLBackgroundImageContext::~XMLBackgroundImageContext()
{
}
-SvXMLImportContextRef XMLBackgroundImageContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const Reference< xml::sax::XAttributeList > & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLBackgroundImageContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
- SvXMLImportContext *pContext = nullptr;
- if( (XML_NAMESPACE_OFFICE == nPrefix) &&
- xmloff::token::IsXMLToken( rLocalName,
- xmloff::token::XML_BINARY_DATA ) )
+ if( nElement == XML_ELEMENT(OFFICE, xmloff::token::XML_BINARY_DATA) )
{
if( m_sURL.isEmpty() && !m_xBase64Stream.is() )
{
m_xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
if( m_xBase64Stream.is() )
- pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
- rLocalName, xAttrList,
- m_xBase64Stream );
+ return new XMLBase64ImportContext( GetImport(), m_xBase64Stream );
}
}
-
- return pContext;
+ SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
+ return nullptr;
}
void XMLBackgroundImageContext::endFastElement(sal_Int32 nElement)
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index 4bacea3ed965..ba19c7ff50d3 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -105,66 +105,55 @@ class XMLTextColumnContext_Impl: public SvXMLImportContext
public:
- XMLTextColumnContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
- const OUString& rLName,
+ XMLTextColumnContext_Impl( SvXMLImport& rImport, sal_Int32 nElement,
const uno::Reference<
- xml::sax::XAttributeList > & xAttrList,
- const SvXMLTokenMap& rTokenMap );
+ xml::sax::XFastAttributeList > & xAttrList );
text::TextColumn& getTextColumn() { return aColumn; }
};
XMLTextColumnContext_Impl::XMLTextColumnContext_Impl(
- SvXMLImport& rImport, sal_uInt16 nPrfx,
- const OUString& rLName,
+ SvXMLImport& rImport, sal_Int32 /*nElement*/,
const uno::Reference<
- xml::sax::XAttributeList > & xAttrList,
- const SvXMLTokenMap& rTokenMap ) :
- SvXMLImportContext( rImport, nPrfx, rLName )
+ xml::sax::XFastAttributeList > & xAttrList ) :
+ SvXMLImportContext( rImport )
{
aColumn.Width = 0;
aColumn.LeftMargin = 0;
aColumn.RightMargin = 0;
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for( sal_Int16 i=0; i < nAttrCount; i++ )
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString& rAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix =
- GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
- &aLocalName );
- const OUString& rValue = xAttrList->getValueByIndex( i );
-
+ const OUString sValue = aIter.toString();
sal_Int32 nVal;
- switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ switch( aIter.getToken() )
{
- case XML_TOK_COLUMN_WIDTH:
+ case XML_ELEMENT(STYLE, XML_REL_WIDTH):
{
- sal_Int32 nPos = rValue.indexOf( '*' );
- if( nPos != -1 && nPos+1 == rValue.getLength() )
+ sal_Int32 nPos = sValue.indexOf( '*' );
+ if( nPos != -1 && nPos+1 == sValue.getLength() )
{
if (::sax::Converter::convertNumber(
nVal,
- std::u16string_view(rValue).substr(0, nPos),
+ std::u16string_view(sValue).substr(0, nPos),
0, USHRT_MAX))
aColumn.Width = nVal;
}
}
break;
- case XML_TOK_COLUMN_MARGIN_LEFT:
+ case XML_ELEMENT(FO, XML_START_INDENT):
if( GetImport().GetMM100UnitConverter().
- convertMeasureToCore( nVal, rValue ) )
+ convertMeasureToCore( nVal, sValue ) )
aColumn.LeftMargin = nVal;
break;
- case XML_TOK_COLUMN_MARGIN_RIGHT:
-
+ case XML_ELEMENT(FO, XML_END_INDENT):
if( GetImport().GetMM100UnitConverter().
- convertMeasureToCore( nVal, rValue ) )
+ convertMeasureToCore( nVal, sValue ) )
aColumn.RightMargin = nVal;
break;
default:
+ SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
break;
}
}
@@ -180,11 +169,9 @@ class XMLTextColumnSepContext_Impl: public SvXMLImportContext
public:
- XMLTextColumnSepContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
- const OUString& rLName,
+ XMLTextColumnSepContext_Impl( SvXMLImport& rImport, sal_Int32 nElement,
const uno::Reference<
- xml::sax::XAttributeList > & xAttrList,
- const SvXMLTokenMap& rTokenMap );
+ xml::sax::XFastAttributeList > & xAttrList );
sal_Int32 GetWidth() const { return nWidth; }
sal_Int32 GetColor() const { return nColor; }
@@ -195,52 +182,46 @@ public:
XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl(
- SvXMLImport& rImport, sal_uInt16 nPrfx,
- const OUString& rLName,
+ SvXMLImport& rImport, sal_Int32 /*nElement*/,
const uno::Reference<
- xml::sax::XAttributeList > & xAttrList,
- const SvXMLTokenMap& rTokenMap ) :
- SvXMLImportContext( rImport, nPrfx, rLName ),
+ xml::sax::XFastAttributeList > & xAttrList) :
+ SvXMLImportContext( rImport ),
nWidth( 2 ),
nColor( 0 ),
nHeight( 100 ),
nStyle( 1 ),
eVertAlign( VerticalAlignment_TOP )
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for( sal_Int16 i=0; i < nAttrCount; i++ )
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
- const OUString& rAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix =
- GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
- &aLocalName );
- const OUString& rValue = xAttrList->getValueByIndex( i );
+ const OUString sValue = aIter.toString();
sal_Int32 nVal;
- switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ switch( aIter.getToken() )
{
- case XML_TOK_COLUMN_SEP_WIDTH:
+ case XML_ELEMENT(STYLE, XML_WIDTH):
if( GetImport().GetMM100UnitConverter().
- convertMeasureToCore( nVal, rValue ) )
+ convertMeasureToCore( nVal, sValue ) )
nWidth = nVal;
break;
- case XML_TOK_COLUMN_SEP_HEIGHT:
- if (::sax::Converter::convertPercent( nVal, rValue ) &&
+ case XML_ELEMENT(STYLE, XML_HEIGHT):
+ if (::sax::Converter::convertPercent( nVal, sValue ) &&
nVal >=1 && nVal <= 100 )
nHeight = static_cast<sal_Int8>(nVal);
break;
- case XML_TOK_COLUMN_SEP_COLOR:
- ::sax::Converter::convertColor( nColor, rValue );
+ case XML_ELEMENT(STYLE, XML_COLOR):
+ ::sax::Converter::convertColor( nColor, sValue );
break;
- case XML_TOK_COLUMN_SEP_ALIGN:
- SvXMLUnitConverter::convertEnum( eVertAlign, rValue,
+ case XML_ELEMENT(STYLE, XML_VERTICAL_ALIGN):
+ SvXMLUnitConverter::convertEnum( eVertAlign, sValue,
pXML_Sep_Align_Enum );
break;
- case XML_TOK_COLUMN_SEP_STYLE:
- SvXMLUnitConverter::convertEnum( nStyle, rValue,
+ case XML_ELEMENT(STYLE, XML_STYLE):
+ SvXMLUnitConverter::convertEnum( nStyle, sValue,
pXML_Sep_Style_Enum );
break;
+ default:
+ SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
}
}
}
@@ -289,19 +270,14 @@ XMLTextColumnsContext::XMLTextColumnsContext(
}
}
-SvXMLImportContextRef XMLTextColumnsContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextColumnsContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- SvXMLImportContext *pContext = nullptr;
-
- if( XML_NAMESPACE_STYLE == nPrefix &&
- IsXMLToken( rLocalName, XML_COLUMN ) )
+ if( nElement == XML_ELEMENT(STYLE, XML_COLUMN) )
{
const rtl::Reference<XMLTextColumnContext_Impl> xColumn{
- new XMLTextColumnContext_Impl( GetImport(), nPrefix, rLocalName,
- xAttrList, *pColumnAttrTokenMap )};
+ new XMLTextColumnContext_Impl( GetImport(), nElement, xAttrList )};
// add new tabstop to array of tabstops
if( !pColumns )
@@ -309,19 +285,17 @@ SvXMLImportContextRef XMLTextColumnsContext::CreateChildContext(
pColumns->push_back( xColumn );
- pContext = xColumn.get();
+ return xColumn.get();
}
- else if( XML_NAMESPACE_STYLE == nPrefix &&
- IsXMLToken( rLocalName, XML_COLUMN_SEP ) )
+ else if( nElement == XML_ELEMENT(STYLE, XML_COLUMN_SEP) )
{
mxColumnSep.set(
- new XMLTextColumnSepContext_Impl( GetImport(), nPrefix, rLocalName,
- xAttrList, *pColumnSepAttrTokenMap ));
+ new XMLTextColumnSepContext_Impl( GetImport(), nElement, xAttrList ));
- pContext = mxColumnSep.get();
+ return mxColumnSep.get();
}
-
- return pContext;
+ SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
+ return nullptr;
}
void XMLTextColumnsContext::endFastElement(sal_Int32 nElement )
More information about the Libreoffice-commits
mailing list