summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2017-07-29 22:24:20 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-31 04:46:36 +0200
commitb6076ea5ce60bc1c971db502af3c963da51d8f82 (patch)
tree095b238cdac4a23f52efc5d71d371dcf9ea03f72
parentce1b56ae4ad35fbb5e2f5cc6f4b7ce4839f4e285 (diff)
Moving legacy contexts to FastContexts:
ScXMLCellRangeSourceContext ScXMLDetectiveHighlightedContext ScXMLDetectiveOperationContext ScXMLCellTextParaContext ScXMLCellTextSpanContext ScXMLCellFieldSheetNameContext ScXMLCellFieldDateContext ScXMLCellFieldTitleContext ScXMLCellFieldURLContext ScXMLCellFieldSContext Change-Id: I605e83064a7c0ec8dc0c78a93d2fec0ebdbce565 Reviewed-on: https://gerrit.libreoffice.org/40553 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/filter/xml/XMLCellRangeSourceContext.cxx109
-rw-r--r--sc/source/filter/xml/XMLCellRangeSourceContext.hxx12
-rw-r--r--sc/source/filter/xml/XMLDetectiveContext.cxx145
-rw-r--r--sc/source/filter/xml/XMLDetectiveContext.hxx36
-rw-r--r--sc/source/filter/xml/celltextparacontext.cxx284
-rw-r--r--sc/source/filter/xml/celltextparacontext.hxx74
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx73
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx3
8 files changed, 309 insertions, 427 deletions
diff --git a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
index 624d6f902af3..60a718196f1c 100644
--- a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
+++ b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
@@ -23,8 +23,10 @@
#include <xmloff/nmspmap.hxx>
#include "xmlimprt.hxx"
+#include <xmloff/xmlnmspe.hxx>
using namespace ::com::sun::star;
+using namespace xmloff::token;
ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
nColumns( 0 ),
@@ -35,63 +37,58 @@ ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
ScMyImpCellRangeSource* pCellRangeSource ) :
- ScXMLImportContext( rImport, nPrfx, rLName )
+ ScXMLImportContext( rImport )
{
- if( !xAttrList.is() ) return;
-
- sal_Int16 nAttrCount = xAttrList->getLength();
- const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableCellRangeSourceAttrTokenMap();
-
- for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
+ if ( xAttrList.is() )
{
- const OUString& sAttrName(xAttrList->getNameByIndex( nIndex ));
- const OUString& sValue(xAttrList->getValueByIndex( nIndex ));
- OUString aLocalName;
- sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+ for (auto &aIter : *pAttribList)
{
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME:
- pCellRangeSource->sSourceStr = sValue;
- break;
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME:
- pCellRangeSource->sFilterName = sValue;
- break;
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS:
- pCellRangeSource->sFilterOptions = sValue;
- break;
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF:
- pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(sValue);
- break;
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN:
- {
- sal_Int32 nValue;
- if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
- pCellRangeSource->nColumns = nValue;
- else
- pCellRangeSource->nColumns = 1;
- }
- break;
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW:
- {
- sal_Int32 nValue;
- if (::sax::Converter::convertNumber( nValue, sValue, 1 ))
- pCellRangeSource->nRows = nValue;
- else
- pCellRangeSource->nRows = 1;
- }
- break;
- case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY:
+ switch (aIter.getToken())
{
- double fTime;
- if (::sax::Converter::convertDuration( fTime, sValue ))
- pCellRangeSource->nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 );
+ case XML_ELEMENT( TABLE, XML_NAME ):
+ pCellRangeSource->sSourceStr = aIter.toString();
+ break;
+ case XML_ELEMENT( TABLE, XML_FILTER_NAME ):
+ pCellRangeSource->sFilterName = aIter.toString();
+ break;
+ case XML_ELEMENT( TABLE, XML_FILTER_OPTIONS ):
+ pCellRangeSource->sFilterOptions = aIter.toString();
+ break;
+ case XML_ELEMENT( XLINK, XML_HREF ):
+ pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(aIter.toString());
+ break;
+ case XML_ELEMENT( TABLE, XML_LAST_COLUMN_SPANNED ):
+ {
+ sal_Int32 nValue;
+ if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 ))
+ pCellRangeSource->nColumns = nValue;
+ else
+ pCellRangeSource->nColumns = 1;
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_LAST_ROW_SPANNED ):
+ {
+ sal_Int32 nValue;
+ if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 ))
+ pCellRangeSource->nRows = nValue;
+ else
+ pCellRangeSource->nRows = 1;
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ):
+ {
+ double fTime;
+ if (::sax::Converter::convertDuration( fTime, aIter.toString() ))
+ pCellRangeSource->nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 );
+ }
+ break;
}
- break;
}
}
}
@@ -100,16 +97,4 @@ ScXMLCellRangeSourceContext::~ScXMLCellRangeSourceContext()
{
}
-SvXMLImportContext *ScXMLCellRangeSourceContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
-{
- return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLCellRangeSourceContext::EndElement()
-{
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLCellRangeSourceContext.hxx b/sc/source/filter/xml/XMLCellRangeSourceContext.hxx
index 8d0c40998e8e..a7725601b73f 100644
--- a/sc/source/filter/xml/XMLCellRangeSourceContext.hxx
+++ b/sc/source/filter/xml/XMLCellRangeSourceContext.hxx
@@ -43,19 +43,11 @@ class ScXMLCellRangeSourceContext : public ScXMLImportContext
public:
ScXMLCellRangeSourceContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
ScMyImpCellRangeSource* pCellRangeSource
);
virtual ~ScXMLCellRangeSourceContext() override;
-
- virtual SvXMLImportContext* CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
- ) override;
- virtual void EndElement() override;
};
#endif
diff --git a/sc/source/filter/xml/XMLDetectiveContext.cxx b/sc/source/filter/xml/XMLDetectiveContext.cxx
index 976beb55b6b7..f326f605d9e0 100644
--- a/sc/source/filter/xml/XMLDetectiveContext.cxx
+++ b/sc/source/filter/xml/XMLDetectiveContext.cxx
@@ -22,6 +22,7 @@
#include <sax/tools/converter.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnmspe.hxx>
#include "convuno.hxx"
#include "xmlimprt.hxx"
#include "XMLConverter.hxx"
@@ -61,10 +62,9 @@ bool ScMyImpDetectiveOpArray::GetFirstOp( ScMyImpDetectiveOp& rDetOp )
ScXMLDetectiveContext::ScXMLDetectiveContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
+ sal_Int32 /*nElement*/,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec ) :
- ScXMLImportContext( rImport, nPrfx, rLName ),
+ ScXMLImportContext( rImport ),
pDetectiveObjVec( pNewDetectiveObjVec )
{
}
@@ -73,77 +73,65 @@ ScXMLDetectiveContext::~ScXMLDetectiveContext()
{
}
-SvXMLImportContext *ScXMLDetectiveContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDetectiveContext::createFastChildContext(
+ sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
SvXMLImportContext* pContext = nullptr;
- const SvXMLTokenMap& rTokenMap = GetScImport().GetDetectiveElemTokenMap();
- switch( rTokenMap.Get( nPrefix, rLName ) )
+ switch (nElement)
{
- case XML_TOK_DETECTIVE_ELEM_HIGHLIGHTED:
- pContext = new ScXMLDetectiveHighlightedContext( GetScImport(), nPrefix, rLName, xAttrList, pDetectiveObjVec );
+ case XML_ELEMENT( TABLE, XML_HIGHLIGHTED_RANGE ):
+ pContext = new ScXMLDetectiveHighlightedContext( GetScImport(), nElement, xAttrList, pDetectiveObjVec );
break;
- case XML_TOK_DETECTIVE_ELEM_OPERATION:
- pContext = new ScXMLDetectiveOperationContext( GetScImport(), nPrefix, rLName, xAttrList );
+ case XML_ELEMENT( TABLE, XML_OPERATION ):
+ pContext = new ScXMLDetectiveOperationContext( GetScImport(), nElement, xAttrList );
break;
}
if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+ pContext = new SvXMLImportContext( GetImport() );
return pContext;
}
-void ScXMLDetectiveContext::EndElement()
-{
-}
-
ScXMLDetectiveHighlightedContext::ScXMLDetectiveHighlightedContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec ):
- ScXMLImportContext( rImport, nPrfx, rLName ),
+ ScXMLImportContext( rImport ),
pDetectiveObjVec( pNewDetectiveObjVec ),
aDetectiveObj(),
bValid( false )
{
- if( !xAttrList.is() ) return;
-
- sal_Int16 nAttrCount = xAttrList->getLength();
- const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDetectiveHighlightedAttrTokenMap();
-
- for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
+ if ( xAttrList.is() )
{
- const OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
- const OUString& sValue (xAttrList->getValueByIndex( nIndex ));
- OUString aLocalName;
- sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+ for (auto &aIter : *pAttribList)
{
- case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE:
+ switch (aIter.getToken())
{
- sal_Int32 nOffset(0);
- ScXMLImport::MutexGuard aGuard(GetScImport());
- bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, sValue, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
- }
- break;
- case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION:
- aDetectiveObj.eObjType = ScXMLConverter::GetDetObjTypeFromString( sValue );
- break;
- case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CONTAINS_ERROR:
- aDetectiveObj.bHasError = IsXMLToken(sValue, XML_TRUE);
- break;
- case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_MARKED_INVALID:
+ case XML_ELEMENT( TABLE, XML_CELL_RANGE_ADDRESS ):
+ {
+ sal_Int32 nOffset(0);
+ ScXMLImport::MutexGuard aGuard(GetScImport());
+ bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_DIRECTION ):
+ aDetectiveObj.eObjType = ScXMLConverter::GetDetObjTypeFromString( aIter.toString() );
+ break;
+ case XML_ELEMENT( TABLE, XML_CONTAINS_ERROR ):
+ aDetectiveObj.bHasError = IsXMLToken(aIter, XML_TRUE);
+ break;
+ case XML_ELEMENT( TABLE, XML_MARKED_INVALID ):
{
- if (IsXMLToken(sValue, XML_TRUE))
+ if (IsXMLToken(aIter, XML_TRUE))
aDetectiveObj.eObjType = SC_DETOBJ_CIRCLE;
}
- break;
+ break;
+ }
}
}
}
@@ -152,15 +140,7 @@ ScXMLDetectiveHighlightedContext::~ScXMLDetectiveHighlightedContext()
{
}
-SvXMLImportContext *ScXMLDetectiveHighlightedContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
-{
- return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLDetectiveHighlightedContext::EndElement()
+void SAL_CALL ScXMLDetectiveHighlightedContext::endFastElement( sal_Int32 /*nElement*/ )
{
switch( aDetectiveObj.eObjType )
{
@@ -180,37 +160,32 @@ void ScXMLDetectiveHighlightedContext::EndElement()
ScXMLDetectiveOperationContext::ScXMLDetectiveOperationContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList >& xAttrList ) :
- ScXMLImportContext( rImport, nPrfx, rLName ),
+ sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) :
+ ScXMLImportContext( rImport ),
aDetectiveOp(),
bHasType( false )
{
- if( !xAttrList.is() ) return;
-
- sal_Int16 nAttrCount = xAttrList->getLength();
- const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDetectiveOperationAttrTokenMap();
-
- for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
+ if ( xAttrList.is() )
{
- const OUString& sAttrName (xAttrList->getNameByIndex( nIndex ));
- const OUString& sValue (xAttrList->getValueByIndex( nIndex ));
- OUString aLocalName;
- sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+ for (auto &aIter : *pAttribList)
{
- case XML_TOK_DETECTIVE_OPERATION_ATTR_NAME:
- bHasType = ScXMLConverter::GetDetOpTypeFromString( aDetectiveOp.eOpType, sValue );
- break;
- case XML_TOK_DETECTIVE_OPERATION_ATTR_INDEX:
+ switch (aIter.getToken())
{
- sal_Int32 nValue;
- if (::sax::Converter::convertNumber( nValue, sValue, 0 ))
- aDetectiveOp.nIndex = nValue;
+ case XML_ELEMENT( TABLE, XML_NAME ):
+ bHasType = ScXMLConverter::GetDetOpTypeFromString( aDetectiveOp.eOpType, aIter.toString() );
+ break;
+ case XML_ELEMENT( TABLE, XML_INDEX ):
+ {
+ sal_Int32 nValue;
+ if (::sax::Converter::convertNumber( nValue, aIter.toString(), 0 ))
+ aDetectiveOp.nIndex = nValue;
+ }
+ break;
}
- break;
}
}
aDetectiveOp.aPosition = rImport.GetTables().GetCurrentCellPos();
@@ -220,15 +195,7 @@ ScXMLDetectiveOperationContext::~ScXMLDetectiveOperationContext()
{
}
-SvXMLImportContext *ScXMLDetectiveOperationContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLName,
- const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
-{
- return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLDetectiveOperationContext::EndElement()
+void SAL_CALL ScXMLDetectiveOperationContext::endFastElement( sal_Int32 /*nElement*/ )
{
if( bHasType && (aDetectiveOp.nIndex >= 0) )
GetScImport().GetDetectiveOpArray()->AddDetectiveOp( aDetectiveOp );
diff --git a/sc/source/filter/xml/XMLDetectiveContext.hxx b/sc/source/filter/xml/XMLDetectiveContext.hxx
index a90f6975ed1f..7f8a834c3e94 100644
--- a/sc/source/filter/xml/XMLDetectiveContext.hxx
+++ b/sc/source/filter/xml/XMLDetectiveContext.hxx
@@ -80,18 +80,16 @@ private:
public:
ScXMLDetectiveContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
+ sal_Int32 nElement,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec
);
virtual ~ScXMLDetectiveContext() override;
- virtual SvXMLImportContext* CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
+ 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 EndElement() override;
};
class ScXMLDetectiveHighlightedContext : public ScXMLImportContext
@@ -104,19 +102,13 @@ private:
public:
ScXMLDetectiveHighlightedContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec
);
virtual ~ScXMLDetectiveHighlightedContext() override;
- virtual SvXMLImportContext* CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
- ) override;
- virtual void EndElement() override;
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
};
class ScXMLDetectiveOperationContext : public ScXMLImportContext
@@ -128,18 +120,12 @@ private:
public:
ScXMLDetectiveOperationContext(
ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList
);
virtual ~ScXMLDetectiveOperationContext() override;
- virtual SvXMLImportContext* CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
- ) override;
- virtual void EndElement() override;
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
};
#endif
diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx
index dc89e141fbf4..ea4349011fae 100644
--- a/sc/source/filter/xml/celltextparacontext.cxx
+++ b/sc/source/filter/xml/celltextparacontext.cxx
@@ -13,23 +13,21 @@
#include <xmloff/nmspmap.hxx>
#include <comphelper/string.hxx>
+#include <xmloff/xmlnmspe.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
using namespace com::sun::star;
+using namespace xmloff::token;
ScXMLCellTextParaContext::ScXMLCellTextParaContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLTableRowCellContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent)
{
}
-void ScXMLCellTextParaContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
-}
-
-void ScXMLCellTextParaContext::EndElement()
+void SAL_CALL ScXMLCellTextParaContext::endFastElement( sal_Int32 /*nElement*/ )
{
if (!maContent.isEmpty())
mrParentCxt.PushParagraphSpan(maContent, OUString());
@@ -37,13 +35,13 @@ void ScXMLCellTextParaContext::EndElement()
mrParentCxt.PushParagraphEnd();
}
-void ScXMLCellTextParaContext::Characters(const OUString& rChars)
+void SAL_CALL ScXMLCellTextParaContext::characters( const OUString& rChars )
{
maContent += rChars;
}
-SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContext::createFastChildContext(
+ sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
if (!maContent.isEmpty())
{
@@ -51,26 +49,25 @@ SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext(
maContent.clear();
}
- const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextParaElemTokenMap();
- switch (rTokenMap.Get(nPrefix, rLocalName))
+ switch (nElement)
{
- case XML_TOK_CELL_TEXT_S:
- return new ScXMLCellFieldSContext(GetScImport(), nPrefix, rLocalName, *this);
- case XML_TOK_CELL_TEXT_SPAN:
- return new ScXMLCellTextSpanContext(GetScImport(), nPrefix, rLocalName, *this);
- case XML_TOK_CELL_TEXT_SHEET_NAME:
- return new ScXMLCellFieldSheetNameContext(GetScImport(), nPrefix, rLocalName, *this);
- case XML_TOK_CELL_TEXT_DATE:
- return new ScXMLCellFieldDateContext(GetScImport(), nPrefix, rLocalName, *this);
- case XML_TOK_CELL_TEXT_TITLE:
- return new ScXMLCellFieldTitleContext(GetScImport(), nPrefix, rLocalName, *this);
- case XML_TOK_CELL_TEXT_URL:
- return new ScXMLCellFieldURLContext(GetScImport(), nPrefix, rLocalName, *this);
+ case XML_ELEMENT( TEXT, XML_S ):
+ return new ScXMLCellFieldSContext(GetScImport(), nElement, *this);
+ case XML_ELEMENT( TEXT, XML_SPAN ):
+ return new ScXMLCellTextSpanContext(GetScImport(), nElement, *this);
+ case XML_ELEMENT( TEXT, XML_SHEET_NAME ):
+ return new ScXMLCellFieldSheetNameContext(GetScImport(), nElement, *this);
+ case XML_ELEMENT( TEXT, XML_DATE ):
+ return new ScXMLCellFieldDateContext(GetScImport(), nElement, *this);
+ case XML_ELEMENT( TEXT, XML_TITLE ):
+ return new ScXMLCellFieldTitleContext(GetScImport(), nElement, *this);
+ case XML_ELEMENT( TEXT, XML_A ):
+ return new ScXMLCellFieldURLContext(GetScImport(), nElement, *this);
default:
;
}
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext(GetImport());
}
void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan, const OUString& rStyleName)
@@ -100,40 +97,35 @@ void ScXMLCellTextParaContext::PushFieldURL(
}
ScXMLCellTextSpanContext::ScXMLCellTextSpanContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent)
{
}
-void ScXMLCellTextSpanContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+void SAL_CALL ScXMLCellTextSpanContext::startFastElement( sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
- if (!xAttrList.is())
- return;
-
- OUString aLocalName;
- sal_Int16 nAttrCount = xAttrList->getLength();
-
- const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextSpanAttrTokenMap();
- for (sal_Int16 i = 0; i < nAttrCount; ++i)
+ if ( xAttrList.is() )
{
- sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
- xAttrList->getNameByIndex(i), &aLocalName);
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- const OUString& rAttrValue = xAttrList->getValueByIndex(i);
- sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
- switch (nToken)
+ for (auto &aIter : *pAttribList)
{
- case XML_TOK_CELL_TEXT_SPAN_ATTR_STYLE_NAME:
- maStyleName = rAttrValue;
- break;
- default:
- ;
+ switch (aIter.getToken())
+ {
+ case XML_ELEMENT( TEXT, XML_STYLE_NAME ):
+ maStyleName = aIter.toString();
+ break;
+ default:
+ ;
+ }
}
}
}
-void ScXMLCellTextSpanContext::EndElement()
+void SAL_CALL ScXMLCellTextSpanContext::endFastElement( sal_Int32 /*nElement*/ )
{
if (!maContent.isEmpty())
{
@@ -141,13 +133,13 @@ void ScXMLCellTextSpanContext::EndElement()
}
}
-void ScXMLCellTextSpanContext::Characters(const OUString& rChars)
+void SAL_CALL ScXMLCellTextSpanContext::characters( const OUString& rChars )
{
maContent += rChars;
}
-SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextSpanContext::createFastChildContext(
+ sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
if (!maContent.isEmpty())
{
@@ -155,36 +147,35 @@ SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext(
maContent.clear();
}
- const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextSpanElemTokenMap();
- switch (rTokenMap.Get(nPrefix, rLocalName))
+ switch (nElement)
{
- case XML_TOK_CELL_TEXT_SPAN_ELEM_SHEET_NAME:
+ case XML_ELEMENT( TEXT, XML_SHEET_NAME ):
{
- ScXMLCellFieldSheetNameContext* p = new ScXMLCellFieldSheetNameContext(GetScImport(), nPrefix, rLocalName, mrParentCxt);
+ ScXMLCellFieldSheetNameContext* p = new ScXMLCellFieldSheetNameContext(GetScImport(), nElement, mrParentCxt);
p->SetStyleName(maStyleName);
return p;
}
- case XML_TOK_CELL_TEXT_SPAN_ELEM_DATE:
+ case XML_ELEMENT( TEXT, XML_DATE ):
{
- ScXMLCellFieldDateContext* p = new ScXMLCellFieldDateContext(GetScImport(), nPrefix, rLocalName, mrParentCxt);
+ ScXMLCellFieldDateContext* p = new ScXMLCellFieldDateContext(GetScImport(), nElement, mrParentCxt);
p->SetStyleName(maStyleName);
return p;
}
- case XML_TOK_CELL_TEXT_SPAN_ELEM_TITLE:
+ case XML_ELEMENT( TEXT, XML_TITLE ):
{
- ScXMLCellFieldTitleContext* p = new ScXMLCellFieldTitleContext(GetScImport(), nPrefix, rLocalName, mrParentCxt);
+ ScXMLCellFieldTitleContext* p = new ScXMLCellFieldTitleContext(GetScImport(), nElement, mrParentCxt);
p->SetStyleName(maStyleName);
return p;
}
- case XML_TOK_CELL_TEXT_SPAN_ELEM_URL:
+ case XML_ELEMENT( TEXT, XML_A ):
{
- ScXMLCellFieldURLContext* p = new ScXMLCellFieldURLContext(GetScImport(), nPrefix, rLocalName, mrParentCxt);
+ ScXMLCellFieldURLContext* p = new ScXMLCellFieldURLContext(GetScImport(), nElement, mrParentCxt);
p->SetStyleName(maStyleName);
return p;
}
- case XML_TOK_CELL_TEXT_SPAN_ELEM_S:
+ case XML_ELEMENT( TEXT, XML_S ):
{
- ScXMLCellFieldSContext* p = new ScXMLCellFieldSContext(GetScImport(), nPrefix, rLocalName, mrParentCxt);
+ ScXMLCellFieldSContext* p = new ScXMLCellFieldSContext(GetScImport(), nElement, mrParentCxt);
p->SetStyleName(maStyleName);
return p;
}
@@ -192,12 +183,12 @@ SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext(
;
}
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext(GetImport());
}
ScXMLCellFieldSheetNameContext::ScXMLCellFieldSheetNameContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent)
{
}
@@ -207,29 +198,20 @@ void ScXMLCellFieldSheetNameContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName;
}
-void ScXMLCellFieldSheetNameContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
+void SAL_CALL ScXMLCellFieldSheetNameContext::startFastElement( sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
// <text:sheet-name> has no attributes (that I'm aware of).
}
-void ScXMLCellFieldSheetNameContext::EndElement()
+void SAL_CALL ScXMLCellFieldSheetNameContext::endFastElement( sal_Int32 /*nElement*/ )
{
mrParentCxt.PushFieldSheetName(maStyleName);
}
-void ScXMLCellFieldSheetNameContext::Characters(const OUString& /*rChars*/)
-{
-}
-
-SvXMLImportContext* ScXMLCellFieldSheetNameContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-}
-
ScXMLCellFieldDateContext::ScXMLCellFieldDateContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent)
{
}
@@ -239,28 +221,14 @@ void ScXMLCellFieldDateContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName;
}
-void ScXMLCellFieldDateContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
-}
-
-void ScXMLCellFieldDateContext::EndElement()
+void SAL_CALL ScXMLCellFieldDateContext::endFastElement( sal_Int32 /*nElement*/ )
{
mrParentCxt.PushFieldDate(maStyleName);
}
-void ScXMLCellFieldDateContext::Characters(const OUString& /*rChars*/)
-{
-}
-
-SvXMLImportContext* ScXMLCellFieldDateContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-}
-
ScXMLCellFieldTitleContext::ScXMLCellFieldTitleContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent)
{
}
@@ -270,28 +238,14 @@ void ScXMLCellFieldTitleContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName;
}
-void ScXMLCellFieldTitleContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
-}
-
-void ScXMLCellFieldTitleContext::EndElement()
+void SAL_CALL ScXMLCellFieldTitleContext::endFastElement( sal_Int32 /*nElement*/ )
{
mrParentCxt.PushFieldTitle(maStyleName);
}
-void ScXMLCellFieldTitleContext::Characters(const OUString& /*rChars*/)
-{
-}
-
-SvXMLImportContext* ScXMLCellFieldTitleContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-}
-
ScXMLCellFieldURLContext::ScXMLCellFieldURLContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent)
{
}
@@ -301,58 +255,47 @@ void ScXMLCellFieldURLContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName;
}
-void ScXMLCellFieldURLContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+void SAL_CALL ScXMLCellFieldURLContext::startFastElement( sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
- if (!xAttrList.is())
- return;
-
- OUString aLocalName;
- sal_Int16 nAttrCount = xAttrList->getLength();
-
- const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextURLAttrTokenMap();
- for (sal_Int16 i = 0; i < nAttrCount; ++i)
+ if ( xAttrList.is() )
{
- sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
- xAttrList->getNameByIndex(i), &aLocalName);
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- const OUString& rAttrValue = xAttrList->getValueByIndex(i);
- sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
- switch (nToken)
+ for (auto &aIter : *pAttribList)
{
- case XML_TOK_CELL_TEXT_URL_ATTR_UREF:
- maURL = rAttrValue;
- break;
- case XML_TOK_CELL_TEXT_URL_ATTR_TYPE:
- // Ignored for now.
- break;
- case XML_TOK_CELL_TEXT_URL_TARGET_FRAME:
- maTargetFrame = rAttrValue;
- break;
- default:
- ;
+ switch (aIter.getToken())
+ {
+ case XML_ELEMENT( XLINK, XML_HREF ):
+ maURL = aIter.toString();
+ break;
+ case XML_ELEMENT( XLINK, XML_TYPE ):
+ // Ignored for now.
+ break;
+ case XML_ELEMENT( OFFICE, XML_TARGET_FRAME_NAME ):
+ maTargetFrame = aIter.toString();
+ break;
+ default:
+ ;
+ }
}
}
}
-void ScXMLCellFieldURLContext::EndElement()
+void SAL_CALL ScXMLCellFieldURLContext::endFastElement( sal_Int32 /*nElement*/ )
{
mrParentCxt.PushFieldURL(maURL, maRep, maStyleName, maTargetFrame);
}
-void ScXMLCellFieldURLContext::Characters(const OUString& rChars)
+void SAL_CALL ScXMLCellFieldURLContext::characters( const OUString& rChars )
{
maRep += rChars;
}
-SvXMLImportContext* ScXMLCellFieldURLContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
-{
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-}
-
ScXMLCellFieldSContext::ScXMLCellFieldSContext(
- ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) :
- ScXMLImportContext(rImport, nPrefix, rLName),
+ ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
+ ScXMLImportContext(rImport),
mrParentCxt(rParent),
mnCount(1)
{
@@ -363,43 +306,38 @@ void ScXMLCellFieldSContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName;
}
-void ScXMLCellFieldSContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+void SAL_CALL ScXMLCellFieldSContext::startFastElement( sal_Int32 /*nElement*/,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
- if (!xAttrList.is())
- return;
-
- OUString aLocalName;
- sal_Int16 nAttrCount = xAttrList->getLength();
-
- const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextSAttrTokenMap();
- for (sal_Int16 i = 0; i < nAttrCount; ++i)
+ if ( xAttrList.is() )
{
- sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
- xAttrList->getNameByIndex(i), &aLocalName);
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- const OUString& rAttrValue = xAttrList->getValueByIndex(i);
- sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
- switch (nToken)
+ for (auto &aIter : *pAttribList)
{
- case XML_TOK_CELL_TEXT_S_ATTR_C:
- mnCount = rAttrValue.toInt32();
- if (mnCount <= 0)
- mnCount = 1; // worth a warning?
- break;
- default:
- ;
+ switch (aIter.getToken())
+ {
+ case XML_ELEMENT( TEXT, XML_C ):
+ mnCount = aIter.toInt32();
+ if (mnCount <= 0)
+ mnCount = 1; // worth a warning?
+ break;
+ default:
+ ;
+ }
}
}
}
-void ScXMLCellFieldSContext::EndElement()
+void SAL_CALL ScXMLCellFieldSContext::endFastElement( sal_Int32 /*nElement*/ )
{
if (mnCount)
PushSpaces();
}
-SvXMLImportContext* ScXMLCellFieldSContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/)
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellFieldSContext::createFastChildContext(
+ sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
// <text:s> does not have child elements, but ...
if (mnCount)
@@ -408,7 +346,7 @@ SvXMLImportContext* ScXMLCellFieldSContext::CreateChildContext(
mnCount = 0;
}
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext(GetImport());
}
void ScXMLCellFieldSContext::PushSpaces()
diff --git a/sc/source/filter/xml/celltextparacontext.hxx b/sc/source/filter/xml/celltextparacontext.hxx
index f6b8e2c2060e..fed9ac9dab54 100644
--- a/sc/source/filter/xml/celltextparacontext.hxx
+++ b/sc/source/filter/xml/celltextparacontext.hxx
@@ -23,13 +23,12 @@ class ScXMLCellTextParaContext : public ScXMLImportContext
ScXMLTableRowCellContext& mrParentCxt;
OUString maContent;
public:
- ScXMLCellTextParaContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent);
+ ScXMLCellTextParaContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLTableRowCellContext& rParent);
- 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 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 SAL_CALL characters( const OUString& aChars ) 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;
void PushSpan(const OUString& rSpan, const OUString& rStyleName);
void PushFieldSheetName(const OUString& rStyleName);
@@ -47,13 +46,14 @@ class ScXMLCellTextSpanContext : public ScXMLImportContext
OUString maStyleName;
OUString maContent;
public:
- ScXMLCellTextSpanContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
-
- 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 SvXMLImportContext* CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override;
+ ScXMLCellTextSpanContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
+
+ 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& aChars ) 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;
};
/**
@@ -64,15 +64,13 @@ class ScXMLCellFieldSheetNameContext : public ScXMLImportContext
ScXMLCellTextParaContext& mrParentCxt;
OUString maStyleName;
public:
- ScXMLCellFieldSheetNameContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
+ ScXMLCellFieldSheetNameContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
void SetStyleName(const OUString& rStyleName);
- 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 SvXMLImportContext* 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 void SAL_CALL endFastElement( sal_Int32 nElement ) override;
};
/**
@@ -83,15 +81,11 @@ class ScXMLCellFieldDateContext : public ScXMLImportContext
ScXMLCellTextParaContext& mrParentCxt;
OUString maStyleName;
public:
- ScXMLCellFieldDateContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
+ ScXMLCellFieldDateContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
void SetStyleName(const OUString& rStyleName);
- 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 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;
};
/**
@@ -102,15 +96,11 @@ class ScXMLCellFieldTitleContext : public ScXMLImportContext
ScXMLCellTextParaContext& mrParentCxt;
OUString maStyleName;
public:
- ScXMLCellFieldTitleContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
+ ScXMLCellFieldTitleContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
void SetStyleName(const OUString& rStyleName);
- 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 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;
};
/**
@@ -124,15 +114,14 @@ class ScXMLCellFieldURLContext : public ScXMLImportContext
OUString maRep;
OUString maTargetFrame;
public:
- ScXMLCellFieldURLContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
+ ScXMLCellFieldURLContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
void SetStyleName(const OUString& rStyleName);
- 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 SvXMLImportContext* 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 void SAL_CALL endFastElement( sal_Int32 nElement ) override;
+ virtual void SAL_CALL characters( const OUString& aChars ) override;
};
/**
@@ -146,14 +135,15 @@ class ScXMLCellFieldSContext : public ScXMLImportContext
void PushSpaces();
public:
- ScXMLCellFieldSContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
+ ScXMLCellFieldSContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
void SetStyleName(const OUString& rStyleName);
- virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override;
- virtual void EndElement() override;
- virtual SvXMLImportContext* 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 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 >& xAttrList ) override;
};
#endif
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 8989827d4c2d..043190f41bbf 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -654,15 +654,7 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
{
case XML_TOK_TABLE_ROW_CELL_P:
{
- bIsEmpty = false;
bTextP = true;
-
- pContext = new ScXMLCellTextParaContext(rXMLImport, nPrefix, rLName, *this);
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_TABLE:
- {
- SAL_WARN("sc", "ScXMLTableRowCellContext::CreateChildContext: subtables are not supported");
}
break;
case XML_TOK_TABLE_ROW_CELL_ANNOTATION:
@@ -674,24 +666,6 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
xAttrList, *mxAnnotationData);
}
break;
- case XML_TOK_TABLE_ROW_CELL_DETECTIVE:
- {
- bIsEmpty = false;
- if (!pDetectiveObjVec)
- pDetectiveObjVec = new ScMyImpDetectiveObjVec;
- pContext = new ScXMLDetectiveContext(
- rXMLImport, nPrefix, rLName, pDetectiveObjVec );
- }
- break;
- case XML_TOK_TABLE_ROW_CELL_CELL_RANGE_SOURCE:
- {
- bIsEmpty = false;
- if (!pCellRangeSource)
- pCellRangeSource = new ScMyImpCellRangeSource();
- pContext = new ScXMLCellRangeSourceContext(
- rXMLImport, nPrefix, rLName, xAttrList, pCellRangeSource );
- }
- break;
}
if (!pContext && !bTextP)
@@ -724,6 +698,53 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
return pContext;
}
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableRowCellContext::createFastChildContext(
+ sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
+{
+ SvXMLImportContext *pContext = nullptr;
+
+ // bool bTextP(false);
+ switch (nElement)
+ {
+ case XML_ELEMENT( TEXT, XML_P ):
+ {
+ bIsEmpty = false;
+ // bTextP = true;
+
+ pContext = new ScXMLCellTextParaContext(rXMLImport, nElement, *this);
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_SUB_TABLE ):
+ {
+ SAL_WARN("sc", "ScXMLTableRowCellContext::createFastChildContext: subtables are not supported");
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_DETECTIVE ):
+ {
+ bIsEmpty = false;
+ if (!pDetectiveObjVec)
+ pDetectiveObjVec = new ScMyImpDetectiveObjVec;
+ pContext = new ScXMLDetectiveContext(
+ rXMLImport, nElement, pDetectiveObjVec );
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_CELL_RANGE_SOURCE ):
+ {
+ bIsEmpty = false;
+ if (!pCellRangeSource)
+ pCellRangeSource = new ScMyImpCellRangeSource();
+ pContext = new ScXMLCellRangeSourceContext(
+ rXMLImport, nElement, xAttrList, pCellRangeSource );
+ }
+ break;
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport() );
+
+ return pContext;
+}
+
void ScXMLTableRowCellContext::DoMerge( const ScAddress& rScAddress, const SCCOL nCols, const SCROW nRows )
{
SCCOL mergeToCol = rScAddress.Col() + nCols;
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index d7a706388a5c..0a859f6b2c6e 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -139,6 +139,9 @@ public:
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 >& xAttrList ) override;
+
void PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName);
void PushParagraphFieldDate(const OUString& rStyleName);
void PushParagraphFieldSheetName(const OUString& rStyleName);