[Libreoffice-commits] core.git: sc/source
Mohammed Abdul Azeem
azeemmysore at gmail.com
Mon Jun 19 16:04:40 UTC 2017
sc/source/filter/xml/xmlexternaltabi.cxx | 277 ++++++++++++++-----------------
sc/source/filter/xml/xmlexternaltabi.hxx | 80 ++++----
sc/source/filter/xml/xmltabi.cxx | 39 ++--
3 files changed, 189 insertions(+), 207 deletions(-)
New commits:
commit e3b4987450b9bd39bb68fa3d9c9efa03b059f12a
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date: Mon Jun 19 18:43:18 2017 +0530
Moving legacy contexts to FastContexts:
ScXMLExternalRefTabSourceContext
ScXMLExternalRefRowsContext
ScXMLExternalRefRowContext
ScXMLExternalRefCellContext
ScXMLExternalRefCellTextContext
Change-Id: Ia626ed62186e53a352a5c7831b41be99ebc55018
Reviewed-on: https://gerrit.libreoffice.org/38881
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mohammed Abdul Azeem <azeemmysore at gmail.com>
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 9193c491fd61..964b13a4410d 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -37,39 +37,34 @@
#include <com/sun/star/util/NumberFormat.hpp>
using namespace ::com::sun::star;
+using namespace ::com::sun::star::xml::sax;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::xml::sax::XAttributeList;
ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
- const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
- SvXMLImportContext( rImport, nPrefix, rLName ),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/,
+ const Reference<XFastAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
+ ScXMLImportContext( rImport ),
mrScImport(rImport),
mrExternalRefInfo(rRefInfo)
{
using namespace ::xmloff::token;
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for (sal_Int16 i = 0; i < nAttrCount; ++i)
+ if( xAttrList.is() )
{
- const OUString& sAttrName = xAttrList->getNameByIndex(i);
- OUString aLocalName;
- sal_uInt16 nAttrPrefix = mrScImport.GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
- const OUString& sValue = xAttrList->getValueByIndex(i);
- if (nAttrPrefix == XML_NAMESPACE_XLINK)
- {
- if (IsXMLToken(aLocalName, XML_HREF))
- maRelativeUrl = sValue;
- }
- else if (nAttrPrefix == XML_NAMESPACE_TABLE)
+ sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+
+ for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
{
- if (IsXMLToken(aLocalName, XML_TABLE_NAME))
- maTableName = sValue;
- else if (IsXMLToken(aLocalName, XML_FILTER_NAME))
- maFilterName = sValue;
- else if (IsXMLToken(aLocalName, XML_FILTER_OPTIONS))
- maFilterOptions = sValue;
+ sal_Int32 nAttrToken = it.getToken();
+ if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_XLINK ) | XML_HREF ) )
+ maRelativeUrl = it.toString();
+ else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_TABLE_NAME ) )
+ maTableName = it.toString();
+ else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_FILTER_NAME ) )
+ maFilterName = it.toString();
+ else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_FILTER_OPTIONS ) )
+ maFilterOptions = it.toString();
}
}
}
@@ -78,10 +73,10 @@ ScXMLExternalRefTabSourceContext::~ScXMLExternalRefTabSourceContext()
{
}
-SvXMLImportContext* ScXMLExternalRefTabSourceContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& /*xAttrList*/ )
+Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefTabSourceContext::createFastChildContext(
+ sal_Int32/* nElement */, const Reference< XFastAttributeList >&/* xAttrList */ )
{
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext( GetImport() );
}
/**
@@ -110,7 +105,7 @@ static bool lcl_isValidRelativeURL(const OUString& rUrl)
return true;
}
-void ScXMLExternalRefTabSourceContext::EndElement()
+void SAL_CALL ScXMLExternalRefTabSourceContext::endFastElement( sal_Int32 /*nElement*/ )
{
ScDocument* pDoc = mrScImport.GetDocument();
if (!pDoc)
@@ -123,9 +118,9 @@ void ScXMLExternalRefTabSourceContext::EndElement()
}
ScXMLExternalRefRowsContext::ScXMLExternalRefRowsContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
- const Reference<XAttributeList>& /* xAttrList */, ScXMLExternalTabData& rRefInfo ) :
- SvXMLImportContext( rImport, nPrefix, rLName ),
+ ScXMLImport& rImport, sal_Int32 /* nElement */,
+ const Reference<XFastAttributeList>& /* xAttrList */, ScXMLExternalTabData& rRefInfo ) :
+ ScXMLImportContext( rImport ),
mrScImport(rImport),
mrExternalRefInfo(rRefInfo)
{
@@ -135,60 +130,55 @@ ScXMLExternalRefRowsContext::~ScXMLExternalRefRowsContext()
{
}
-SvXMLImportContext* ScXMLExternalRefRowsContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList )
+Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefRowsContext::createFastChildContext(
+ sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList )
{
// #i101319# row elements inside group, rows or header-rows
// are treated like row elements directly in the table element
const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowsElemTokenMap();
- sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
+ sal_uInt16 nToken = rTokenMap.Get( nElement );
switch (nToken)
{
case XML_TOK_TABLE_ROWS_ROW_GROUP:
case XML_TOK_TABLE_ROWS_HEADER_ROWS:
case XML_TOK_TABLE_ROWS_ROWS:
return new ScXMLExternalRefRowsContext(
- mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
+ mrScImport, nElement, xAttrList, mrExternalRefInfo);
case XML_TOK_TABLE_ROWS_ROW:
return new ScXMLExternalRefRowContext(
- mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
+ mrScImport, nElement, xAttrList, mrExternalRefInfo);
default:
;
}
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-}
-
-void ScXMLExternalRefRowsContext::EndElement()
-{
+ return new SvXMLImportContext( GetImport() );
}
ScXMLExternalRefRowContext::ScXMLExternalRefRowContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
- const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
- SvXMLImportContext( rImport, nPrefix, rLName ),
+ ScXMLImport& rImport, sal_Int32 /* nElement */,
+ const Reference<XFastAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
+ ScXMLImportContext( rImport ),
mrScImport(rImport),
mrExternalRefInfo(rRefInfo),
mnRepeatRowCount(1)
{
mrExternalRefInfo.mnCol = 0;
- sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
const SvXMLTokenMap& rAttrTokenMap = mrScImport.GetTableRowAttrTokenMap();
- for( sal_Int16 i=0; i < nAttrCount; ++i )
+ if ( xAttrList.is() )
{
- const OUString& sAttrName = xAttrList->getNameByIndex(i);
- OUString aLocalName;
- sal_uInt16 nAttrPrefix = mrScImport.GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
- const OUString& sValue = xAttrList->getValueByIndex(i);
+ sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- switch (rAttrTokenMap.Get(nAttrPrefix, aLocalName))
+ for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
{
- case XML_TOK_TABLE_ROW_ATTR_REPEATED:
+ switch ( rAttrTokenMap.Get( it.getToken() ) )
{
- mnRepeatRowCount = std::max(sValue.toInt32(), static_cast<sal_Int32>(1));
+ case XML_TOK_TABLE_ROW_ATTR_REPEATED:
+ {
+ mnRepeatRowCount = std::max(it.toInt32(), static_cast<sal_Int32>(1));
+ }
+ break;
}
- break;
}
}
}
@@ -197,18 +187,18 @@ ScXMLExternalRefRowContext::~ScXMLExternalRefRowContext()
{
}
-SvXMLImportContext* ScXMLExternalRefRowContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList )
+Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefRowContext::createFastChildContext(
+ sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList )
{
const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowElemTokenMap();
- sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
+ sal_uInt16 nToken = rTokenMap.Get( nElement );
if (nToken == XML_TOK_TABLE_ROW_CELL || nToken == XML_TOK_TABLE_ROW_COVERED_CELL)
- return new ScXMLExternalRefCellContext(mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
+ return new ScXMLExternalRefCellContext(mrScImport, nElement, xAttrList, mrExternalRefInfo);
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext( GetImport() );
}
-void ScXMLExternalRefRowContext::EndElement()
+void SAL_CALL ScXMLExternalRefRowContext::endFastElement( sal_Int32 /* nElement */ )
{
ScExternalRefCache::TableTypeRef pTab = mrExternalRefInfo.mpCacheTable;
@@ -239,9 +229,9 @@ void ScXMLExternalRefRowContext::EndElement()
}
ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
- const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
- SvXMLImportContext( rImport, nPrefix, rLName ),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/,
+ const Reference<XFastAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
+ ScXMLImportContext( rImport ),
mrScImport(rImport),
mrExternalRefInfo(rRefInfo),
mfCellValue(0.0),
@@ -253,90 +243,87 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
{
using namespace ::xmloff::token;
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
- for (sal_Int16 i = 0; i < nAttrCount; ++i)
+ if( xAttrList.is() )
{
- OUString aLocalName;
- sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
- xAttrList->getNameByIndex(i), &aLocalName);
+ sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
- const OUString& sValue = xAttrList->getValueByIndex(i);
- sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
-
- switch (nToken)
+ for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
{
- case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
- {
- XMLTableStylesContext* pStyles = static_cast<XMLTableStylesContext*>(mrScImport.GetAutoStyles());
- const XMLTableStyleContext* pStyle = static_cast<const XMLTableStyleContext*>(
- pStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL, sValue, true));
- if (pStyle)
- mnNumberFormat = const_cast<XMLTableStyleContext*>(pStyle)->GetNumberFormat();
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED:
- {
- mnRepeatCount = ::std::max(sValue.toInt32(), static_cast<sal_Int32>(1));
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
- {
- mnCellType = mrScImport.GetCellType(sValue);
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
+ switch ( rTokenMap.Get( it.getToken() ) )
{
- if (!sValue.isEmpty())
+ case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
{
- ::sax::Converter::convertDouble(mfCellValue, sValue);
- mbIsNumeric = true;
- mbIsEmpty = false;
+ XMLTableStylesContext* pStyles = static_cast<XMLTableStylesContext*>(mrScImport.GetAutoStyles());
+ const XMLTableStyleContext* pStyle = static_cast<const XMLTableStyleContext*>(
+ pStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL, it.toString(), true));
+ if (pStyle)
+ mnNumberFormat = const_cast<XMLTableStyleContext*>(pStyle)->GetNumberFormat();
}
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE:
- {
- if (!sValue.isEmpty() && mrScImport.SetNullDateOnUnitConverter())
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED:
{
- mrScImport.GetMM100UnitConverter().convertDateTime(mfCellValue, sValue);
- mbIsNumeric = true;
- mbIsEmpty = false;
+ mnRepeatCount = ::std::max( it.toInt32(), static_cast<sal_Int32>(1) );
}
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE:
- {
- if (!sValue.isEmpty())
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
{
- ::sax::Converter::convertDuration(mfCellValue, sValue);
- mbIsNumeric = true;
- mbIsEmpty = false;
+ mnCellType = mrScImport.GetCellType( it.toString() );
}
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE:
- {
- if (!sValue.isEmpty())
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
{
- maCellString = sValue;
- mbIsNumeric = false;
- mbIsEmpty = false;
+ if ( !it.isEmpty() )
+ {
+ ::sax::Converter::convertDouble( mfCellValue, it.toString() );
+ mbIsNumeric = true;
+ mbIsEmpty = false;
+ }
}
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE:
- {
- if (!sValue.isEmpty())
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE:
+ {
+ if ( !it.isEmpty() && mrScImport.SetNullDateOnUnitConverter() )
+ {
+ mrScImport.GetMM100UnitConverter().convertDateTime( mfCellValue, it.toString() );
+ mbIsNumeric = true;
+ mbIsEmpty = false;
+ }
+ }
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE:
+ {
+ if ( !it.isEmpty() )
+ {
+ ::sax::Converter::convertDuration( mfCellValue, it.toString() );
+ mbIsNumeric = true;
+ mbIsEmpty = false;
+ }
+ }
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE:
+ {
+ if ( !it.isEmpty() )
+ {
+ maCellString = it.toString();
+ mbIsNumeric = false;
+ mbIsEmpty = false;
+ }
+ }
+ break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE:
{
- mfCellValue = IsXMLToken(sValue, XML_TRUE) ? 1.0 : 0.0;
- mbIsNumeric = true;
- mbIsEmpty = false;
+ if ( !it.isEmpty() )
+ {
+ mfCellValue = IsXMLToken( it.toCString(), XML_TRUE ) ? 1.0 : 0.0;
+ mbIsNumeric = true;
+ mbIsEmpty = false;
+ }
}
+ break;
+ default:
+ ;
}
- break;
- default:
- ;
}
}
}
@@ -345,18 +332,18 @@ ScXMLExternalRefCellContext::~ScXMLExternalRefCellContext()
{
}
-SvXMLImportContext* ScXMLExternalRefCellContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList )
+Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefCellContext::createFastChildContext(
+ sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList )
{
const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowCellElemTokenMap();
- sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
+ sal_uInt16 nToken = rTokenMap.Get( nElement );
if (nToken == XML_TOK_TABLE_ROW_CELL_P)
- return new ScXMLExternalRefCellTextContext(mrScImport, nPrefix, rLocalName, xAttrList, *this);
+ return new ScXMLExternalRefCellTextContext(mrScImport, nElement, xAttrList, *this);
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext( GetImport() );
}
-void ScXMLExternalRefCellContext::EndElement()
+void SAL_CALL ScXMLExternalRefCellContext::endFastElement( sal_Int32 /*nElement*/ )
{
if (!maCellString.isEmpty())
mbIsEmpty = false;
@@ -390,10 +377,10 @@ void ScXMLExternalRefCellContext::SetCellString(const OUString& rStr)
}
ScXMLExternalRefCellTextContext::ScXMLExternalRefCellTextContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName,
- const Reference<XAttributeList>& /*xAttrList*/,
+ ScXMLImport& rImport, sal_Int32 /*nElement*/,
+ const Reference<XFastAttributeList>& /*xAttrList*/,
ScXMLExternalRefCellContext& rParent ) :
- SvXMLImportContext( rImport, nPrefix, rLName ),
+ ScXMLImportContext( rImport ),
mrParent(rParent)
{
}
@@ -402,20 +389,20 @@ ScXMLExternalRefCellTextContext::~ScXMLExternalRefCellTextContext()
{
}
-SvXMLImportContext* ScXMLExternalRefCellTextContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& /*xAttrList*/ )
+Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefCellTextContext::createFastChildContext(
+ sal_Int32/* nElement */, const Reference< XFastAttributeList >&/* xAttrList */ )
{
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext( GetImport() );
}
-void ScXMLExternalRefCellTextContext::Characters(const OUString& rChar)
+void SAL_CALL ScXMLExternalRefCellTextContext::characters( const OUString& rChars )
{
- maCellStrBuf.append(rChar);
+ maCellStrBuf.append( rChars );
}
-void ScXMLExternalRefCellTextContext::EndElement()
+void SAL_CALL ScXMLExternalRefCellTextContext::endFastElement( sal_Int32 /*nElement*/ )
{
- mrParent.SetCellString(maCellStrBuf.makeStringAndClear());
+ mrParent.SetCellString( maCellStrBuf.makeStringAndClear() );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlexternaltabi.hxx b/sc/source/filter/xml/xmlexternaltabi.hxx
index 99c46d101232..014d75324a07 100644
--- a/sc/source/filter/xml/xmlexternaltabi.hxx
+++ b/sc/source/filter/xml/xmlexternaltabi.hxx
@@ -22,25 +22,26 @@
#include <xmloff/xmlictxt.hxx>
#include <rtl/ustrbuf.hxx>
+#include "importcontext.hxx"
class ScXMLImport;
struct ScXMLExternalTabData;
-class ScXMLExternalRefTabSourceContext : public SvXMLImportContext
+class ScXMLExternalRefTabSourceContext : public ScXMLImportContext
{
public:
- ScXMLExternalRefTabSourceContext( ScXMLImport& rImport, sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ ScXMLExternalRefTabSourceContext( ScXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
ScXMLExternalTabData& rRefInfo );
virtual ~ScXMLExternalRefTabSourceContext() override;
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
+
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
- virtual void EndElement() override;
private:
ScXMLImport& mrScImport;
ScXMLExternalTabData& mrExternalRefInfo;
@@ -51,62 +52,59 @@ private:
OUString maFilterOptions;
};
-class ScXMLExternalRefRowsContext : public SvXMLImportContext
+class ScXMLExternalRefRowsContext : public ScXMLImportContext
{
public:
- ScXMLExternalRefRowsContext( ScXMLImport& rImport, sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ ScXMLExternalRefRowsContext( ScXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
ScXMLExternalTabData& rRefInfo );
virtual ~ScXMLExternalRefRowsContext() override;
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
- virtual void EndElement() override;
private:
ScXMLImport& mrScImport;
ScXMLExternalTabData& mrExternalRefInfo;
};
-class ScXMLExternalRefRowContext : public SvXMLImportContext
+class ScXMLExternalRefRowContext : public ScXMLImportContext
{
public:
- ScXMLExternalRefRowContext( ScXMLImport& rImport, sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ ScXMLExternalRefRowContext( ScXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
ScXMLExternalTabData& rRefInfo );
virtual ~ScXMLExternalRefRowContext() override;
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
+
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
- virtual void EndElement() override;
private:
ScXMLImport& mrScImport;
ScXMLExternalTabData& mrExternalRefInfo;
sal_Int32 mnRepeatRowCount;
};
-class ScXMLExternalRefCellContext : public SvXMLImportContext
+class ScXMLExternalRefCellContext : public ScXMLImportContext
{
public:
- ScXMLExternalRefCellContext( ScXMLImport& rImport, sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ ScXMLExternalRefCellContext( ScXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
ScXMLExternalTabData& rRefInfo );
virtual ~ScXMLExternalRefCellContext() override;
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
- virtual void EndElement() override;
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
void SetCellString(const OUString& rStr);
@@ -122,23 +120,21 @@ private:
bool mbIsEmpty;
};
-class ScXMLExternalRefCellTextContext : public SvXMLImportContext
+class ScXMLExternalRefCellTextContext : public ScXMLImportContext
{
public:
- ScXMLExternalRefCellTextContext( ScXMLImport& rImport, sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ ScXMLExternalRefCellTextContext( ScXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
ScXMLExternalRefCellContext& rParent );
virtual ~ScXMLExternalRefCellTextContext() override;
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
- virtual void Characters(const OUString& rChar) override;
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
+ virtual void SAL_CALL characters( const OUString& rChars ) override;
- virtual void EndElement() override;
+ virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
private:
ScXMLExternalRefCellContext& mrParent;
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 793416ba0e93..84caa9b81a5f 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -221,26 +221,6 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLName);
if (pExternalRefInfo.get())
{
- // We only care about the table-row and table-source elements for
- // external cache data.
- switch (nToken)
- {
- case XML_TOK_TABLE_ROW_GROUP:
- case XML_TOK_TABLE_HEADER_ROWS:
- case XML_TOK_TABLE_ROWS:
- // #i101319# don't discard rows in groups or header (repeat range)
- return new ScXMLExternalRefRowsContext(
- GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
- case XML_TOK_TABLE_ROW:
- return new ScXMLExternalRefRowContext(
- GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
- case XML_TOK_TABLE_SOURCE:
- return new ScXMLExternalRefTabSourceContext(
- GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
- default:
- ;
- }
-
return new SvXMLImportContext(GetImport(), nPrefix, rLName);
}
@@ -324,6 +304,25 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
sal_uInt16 nToken = rTokenMap.Get( nElement );
if (pExternalRefInfo.get())
{
+ // We only care about the table-row and table-source elements for
+ // external cache data.
+ switch (nToken)
+ {
+ case XML_TOK_TABLE_ROW_GROUP:
+ case XML_TOK_TABLE_HEADER_ROWS:
+ case XML_TOK_TABLE_ROWS:
+ // #i101319# don't discard rows in groups or header (repeat range)
+ return new ScXMLExternalRefRowsContext(
+ GetScImport(), nElement, xAttrList, *pExternalRefInfo);
+ case XML_TOK_TABLE_ROW:
+ return new ScXMLExternalRefRowContext(
+ GetScImport(), nElement, xAttrList, *pExternalRefInfo);
+ case XML_TOK_TABLE_SOURCE:
+ return new ScXMLExternalRefTabSourceContext(
+ GetScImport(), nElement, xAttrList, *pExternalRefInfo);
+ default:
+ ;
+ }
return new SvXMLImportContext( GetImport() );
}
More information about the Libreoffice-commits
mailing list