Kaydet (Commit) b6076ea5 authored tarafından Mohammed Abdul Azeem's avatar Mohammed Abdul Azeem Kaydeden (comit) Markus Mohrhard

Moving legacy contexts to FastContexts:

ScXMLCellRangeSourceContext
ScXMLDetectiveHighlightedContext
ScXMLDetectiveOperationContext
ScXMLCellTextParaContext
ScXMLCellTextSpanContext
ScXMLCellFieldSheetNameContext
ScXMLCellFieldDateContext
ScXMLCellFieldTitleContext
ScXMLCellFieldURLContext
ScXMLCellFieldSContext

Change-Id: I605e83064a7c0ec8dc0c78a93d2fec0ebdbce565
Reviewed-on: https://gerrit.libreoffice.org/40553Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst ce1b56ae
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include "xmlimprt.hxx" #include "xmlimprt.hxx"
#include <xmloff/xmlnmspe.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace xmloff::token;
ScMyImpCellRangeSource::ScMyImpCellRangeSource() : ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
nColumns( 0 ), nColumns( 0 ),
...@@ -35,63 +37,58 @@ ScMyImpCellRangeSource::ScMyImpCellRangeSource() : ...@@ -35,63 +37,58 @@ ScMyImpCellRangeSource::ScMyImpCellRangeSource() :
ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext( ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 /*nElement*/,
const OUString& rLName, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
ScMyImpCellRangeSource* pCellRangeSource ) : ScMyImpCellRangeSource* pCellRangeSource ) :
ScXMLImportContext( rImport, nPrfx, rLName ) ScXMLImportContext( rImport )
{ {
if( !xAttrList.is() ) return; if ( xAttrList.is() )
sal_Int16 nAttrCount = xAttrList->getLength();
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableCellRangeSourceAttrTokenMap();
for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
{ {
const OUString& sAttrName(xAttrList->getNameByIndex( nIndex )); sax_fastparser::FastAttributeList *pAttribList =
const OUString& sValue(xAttrList->getValueByIndex( nIndex )); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
OUString aLocalName;
sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
switch( rAttrTokenMap.Get( nPrefix, aLocalName ) ) for (auto &aIter : *pAttribList)
{ {
case XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME: switch (aIter.getToken())
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:
{ {
double fTime; case XML_ELEMENT( TABLE, XML_NAME ):
if (::sax::Converter::convertDuration( fTime, sValue )) pCellRangeSource->sSourceStr = aIter.toString();
pCellRangeSource->nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 ); 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() ...@@ -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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -43,19 +43,11 @@ class ScXMLCellRangeSourceContext : public ScXMLImportContext ...@@ -43,19 +43,11 @@ class ScXMLCellRangeSourceContext : public ScXMLImportContext
public: public:
ScXMLCellRangeSourceContext( ScXMLCellRangeSourceContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 nElement,
const OUString& rLName, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
ScMyImpCellRangeSource* pCellRangeSource ScMyImpCellRangeSource* pCellRangeSource
); );
virtual ~ScXMLCellRangeSourceContext() override; 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 #endif
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <sax/tools/converter.hxx> #include <sax/tools/converter.hxx>
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <xmloff/xmltoken.hxx> #include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
#include "convuno.hxx" #include "convuno.hxx"
#include "xmlimprt.hxx" #include "xmlimprt.hxx"
#include "XMLConverter.hxx" #include "XMLConverter.hxx"
...@@ -61,10 +62,9 @@ bool ScMyImpDetectiveOpArray::GetFirstOp( ScMyImpDetectiveOp& rDetOp ) ...@@ -61,10 +62,9 @@ bool ScMyImpDetectiveOpArray::GetFirstOp( ScMyImpDetectiveOp& rDetOp )
ScXMLDetectiveContext::ScXMLDetectiveContext( ScXMLDetectiveContext::ScXMLDetectiveContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 /*nElement*/,
const OUString& rLName,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec ) : ScMyImpDetectiveObjVec* pNewDetectiveObjVec ) :
ScXMLImportContext( rImport, nPrfx, rLName ), ScXMLImportContext( rImport ),
pDetectiveObjVec( pNewDetectiveObjVec ) pDetectiveObjVec( pNewDetectiveObjVec )
{ {
} }
...@@ -73,77 +73,65 @@ ScXMLDetectiveContext::~ScXMLDetectiveContext() ...@@ -73,77 +73,65 @@ ScXMLDetectiveContext::~ScXMLDetectiveContext()
{ {
} }
SvXMLImportContext *ScXMLDetectiveContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDetectiveContext::createFastChildContext(
sal_uInt16 nPrefix, sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList>& xAttrList )
{ {
SvXMLImportContext* pContext = nullptr; SvXMLImportContext* pContext = nullptr;
const SvXMLTokenMap& rTokenMap = GetScImport().GetDetectiveElemTokenMap();
switch( rTokenMap.Get( nPrefix, rLName ) ) switch (nElement)
{ {
case XML_TOK_DETECTIVE_ELEM_HIGHLIGHTED: case XML_ELEMENT( TABLE, XML_HIGHLIGHTED_RANGE ):
pContext = new ScXMLDetectiveHighlightedContext( GetScImport(), nPrefix, rLName, xAttrList, pDetectiveObjVec ); pContext = new ScXMLDetectiveHighlightedContext( GetScImport(), nElement, xAttrList, pDetectiveObjVec );
break; break;
case XML_TOK_DETECTIVE_ELEM_OPERATION: case XML_ELEMENT( TABLE, XML_OPERATION ):
pContext = new ScXMLDetectiveOperationContext( GetScImport(), nPrefix, rLName, xAttrList ); pContext = new ScXMLDetectiveOperationContext( GetScImport(), nElement, xAttrList );
break; break;
} }
if( !pContext ) if( !pContext )
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName ); pContext = new SvXMLImportContext( GetImport() );
return pContext; return pContext;
} }
void ScXMLDetectiveContext::EndElement()
{
}
ScXMLDetectiveHighlightedContext::ScXMLDetectiveHighlightedContext( ScXMLDetectiveHighlightedContext::ScXMLDetectiveHighlightedContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 /*nElement*/,
const OUString& rLName, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec ): ScMyImpDetectiveObjVec* pNewDetectiveObjVec ):
ScXMLImportContext( rImport, nPrfx, rLName ), ScXMLImportContext( rImport ),
pDetectiveObjVec( pNewDetectiveObjVec ), pDetectiveObjVec( pNewDetectiveObjVec ),
aDetectiveObj(), aDetectiveObj(),
bValid( false ) bValid( false )
{ {
if( !xAttrList.is() ) return; if ( xAttrList.is() )
sal_Int16 nAttrCount = xAttrList->getLength();
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDetectiveHighlightedAttrTokenMap();
for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
{ {
const OUString& sAttrName (xAttrList->getNameByIndex( nIndex )); sax_fastparser::FastAttributeList *pAttribList =
const OUString& sValue (xAttrList->getValueByIndex( nIndex )); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
OUString aLocalName;
sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
switch( rAttrTokenMap.Get( nPrefix, aLocalName ) ) for (auto &aIter : *pAttribList)
{ {
case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE: switch (aIter.getToken())
{ {
sal_Int32 nOffset(0); case XML_ELEMENT( TABLE, XML_CELL_RANGE_ADDRESS ):
ScXMLImport::MutexGuard aGuard(GetScImport()); {
bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, sValue, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ); sal_Int32 nOffset(0);
} ScXMLImport::MutexGuard aGuard(GetScImport());
break; bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION: }
aDetectiveObj.eObjType = ScXMLConverter::GetDetObjTypeFromString( sValue ); break;
break; case XML_ELEMENT( TABLE, XML_DIRECTION ):
case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CONTAINS_ERROR: aDetectiveObj.eObjType = ScXMLConverter::GetDetObjTypeFromString( aIter.toString() );
aDetectiveObj.bHasError = IsXMLToken(sValue, XML_TRUE); break;
break; case XML_ELEMENT( TABLE, XML_CONTAINS_ERROR ):
case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_MARKED_INVALID: 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; aDetectiveObj.eObjType = SC_DETOBJ_CIRCLE;
} }
break; break;
}
} }
} }
} }
...@@ -152,15 +140,7 @@ ScXMLDetectiveHighlightedContext::~ScXMLDetectiveHighlightedContext() ...@@ -152,15 +140,7 @@ ScXMLDetectiveHighlightedContext::~ScXMLDetectiveHighlightedContext()
{ {
} }
SvXMLImportContext *ScXMLDetectiveHighlightedContext::CreateChildContext( void SAL_CALL ScXMLDetectiveHighlightedContext::endFastElement( sal_Int32 /*nElement*/ )
sal_uInt16 nPrefix,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
{
return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDetectiveHighlightedContext::EndElement()
{ {
switch( aDetectiveObj.eObjType ) switch( aDetectiveObj.eObjType )
{ {
...@@ -180,37 +160,32 @@ void ScXMLDetectiveHighlightedContext::EndElement() ...@@ -180,37 +160,32 @@ void ScXMLDetectiveHighlightedContext::EndElement()
ScXMLDetectiveOperationContext::ScXMLDetectiveOperationContext( ScXMLDetectiveOperationContext::ScXMLDetectiveOperationContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 /*nElement*/,
const OUString& rLName, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) :
const uno::Reference< xml::sax::XAttributeList >& xAttrList ) : ScXMLImportContext( rImport ),
ScXMLImportContext( rImport, nPrfx, rLName ),
aDetectiveOp(), aDetectiveOp(),
bHasType( false ) bHasType( false )
{ {
if( !xAttrList.is() ) return; if ( xAttrList.is() )
sal_Int16 nAttrCount = xAttrList->getLength();
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDetectiveOperationAttrTokenMap();
for( sal_Int16 nIndex = 0; nIndex < nAttrCount; ++nIndex )
{ {
const OUString& sAttrName (xAttrList->getNameByIndex( nIndex )); sax_fastparser::FastAttributeList *pAttribList =
const OUString& sValue (xAttrList->getValueByIndex( nIndex )); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
OUString aLocalName;
sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
switch( rAttrTokenMap.Get( nPrefix, aLocalName ) ) for (auto &aIter : *pAttribList)
{ {
case XML_TOK_DETECTIVE_OPERATION_ATTR_NAME: switch (aIter.getToken())
bHasType = ScXMLConverter::GetDetOpTypeFromString( aDetectiveOp.eOpType, sValue );
break;
case XML_TOK_DETECTIVE_OPERATION_ATTR_INDEX:
{ {
sal_Int32 nValue; case XML_ELEMENT( TABLE, XML_NAME ):
if (::sax::Converter::convertNumber( nValue, sValue, 0 )) bHasType = ScXMLConverter::GetDetOpTypeFromString( aDetectiveOp.eOpType, aIter.toString() );
aDetectiveOp.nIndex = nValue; 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(); aDetectiveOp.aPosition = rImport.GetTables().GetCurrentCellPos();
...@@ -220,15 +195,7 @@ ScXMLDetectiveOperationContext::~ScXMLDetectiveOperationContext() ...@@ -220,15 +195,7 @@ ScXMLDetectiveOperationContext::~ScXMLDetectiveOperationContext()
{ {
} }
SvXMLImportContext *ScXMLDetectiveOperationContext::CreateChildContext( void SAL_CALL ScXMLDetectiveOperationContext::endFastElement( sal_Int32 /*nElement*/ )
sal_uInt16 nPrefix,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList>& /* xAttrList */ )
{
return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
void ScXMLDetectiveOperationContext::EndElement()
{ {
if( bHasType && (aDetectiveOp.nIndex >= 0) ) if( bHasType && (aDetectiveOp.nIndex >= 0) )
GetScImport().GetDetectiveOpArray()->AddDetectiveOp( aDetectiveOp ); GetScImport().GetDetectiveOpArray()->AddDetectiveOp( aDetectiveOp );
......
...@@ -80,18 +80,16 @@ private: ...@@ -80,18 +80,16 @@ private:
public: public:
ScXMLDetectiveContext( ScXMLDetectiveContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 nElement,
const OUString& rLName,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec ScMyImpDetectiveObjVec* pNewDetectiveObjVec
); );
virtual ~ScXMLDetectiveContext() override; virtual ~ScXMLDetectiveContext() override;
virtual SvXMLImportContext* CreateChildContext( virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
sal_uInt16 nPrefix, createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList
) override; ) override;
virtual void EndElement() override;
}; };
class ScXMLDetectiveHighlightedContext : public ScXMLImportContext class ScXMLDetectiveHighlightedContext : public ScXMLImportContext
...@@ -104,19 +102,13 @@ private: ...@@ -104,19 +102,13 @@ private:
public: public:
ScXMLDetectiveHighlightedContext( ScXMLDetectiveHighlightedContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 nElement,
const OUString& rLName, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
ScMyImpDetectiveObjVec* pNewDetectiveObjVec ScMyImpDetectiveObjVec* pNewDetectiveObjVec
); );
virtual ~ScXMLDetectiveHighlightedContext() override; virtual ~ScXMLDetectiveHighlightedContext() override;
virtual SvXMLImportContext* CreateChildContext( virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
) override;
virtual void EndElement() override;
}; };
class ScXMLDetectiveOperationContext : public ScXMLImportContext class ScXMLDetectiveOperationContext : public ScXMLImportContext
...@@ -128,18 +120,12 @@ private: ...@@ -128,18 +120,12 @@ private:
public: public:
ScXMLDetectiveOperationContext( ScXMLDetectiveOperationContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrfx, sal_Int32 nElement,
const OUString& rLName, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
); );
virtual ~ScXMLDetectiveOperationContext() override; virtual ~ScXMLDetectiveOperationContext() override;
virtual SvXMLImportContext* CreateChildContext( virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList
) override;
virtual void EndElement() override;
}; };
#endif #endif
......
...@@ -13,23 +13,21 @@ ...@@ -13,23 +13,21 @@
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp>
using namespace com::sun::star; using namespace com::sun::star;
using namespace xmloff::token;
ScXMLCellTextParaContext::ScXMLCellTextParaContext( ScXMLCellTextParaContext::ScXMLCellTextParaContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLTableRowCellContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent) mrParentCxt(rParent)
{ {
} }
void ScXMLCellTextParaContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/) void SAL_CALL ScXMLCellTextParaContext::endFastElement( sal_Int32 /*nElement*/ )
{
}
void ScXMLCellTextParaContext::EndElement()
{ {
if (!maContent.isEmpty()) if (!maContent.isEmpty())
mrParentCxt.PushParagraphSpan(maContent, OUString()); mrParentCxt.PushParagraphSpan(maContent, OUString());
...@@ -37,13 +35,13 @@ void ScXMLCellTextParaContext::EndElement() ...@@ -37,13 +35,13 @@ void ScXMLCellTextParaContext::EndElement()
mrParentCxt.PushParagraphEnd(); mrParentCxt.PushParagraphEnd();
} }
void ScXMLCellTextParaContext::Characters(const OUString& rChars) void SAL_CALL ScXMLCellTextParaContext::characters( const OUString& rChars )
{ {
maContent += rChars; maContent += rChars;
} }
SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContext::createFastChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/) sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{ {
if (!maContent.isEmpty()) if (!maContent.isEmpty())
{ {
...@@ -51,26 +49,25 @@ SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext( ...@@ -51,26 +49,25 @@ SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext(
maContent.clear(); maContent.clear();
} }
const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextParaElemTokenMap(); switch (nElement)
switch (rTokenMap.Get(nPrefix, rLocalName))
{ {
case XML_TOK_CELL_TEXT_S: case XML_ELEMENT( TEXT, XML_S ):
return new ScXMLCellFieldSContext(GetScImport(), nPrefix, rLocalName, *this); return new ScXMLCellFieldSContext(GetScImport(), nElement, *this);
case XML_TOK_CELL_TEXT_SPAN: case XML_ELEMENT( TEXT, XML_SPAN ):
return new ScXMLCellTextSpanContext(GetScImport(), nPrefix, rLocalName, *this); return new ScXMLCellTextSpanContext(GetScImport(), nElement, *this);
case XML_TOK_CELL_TEXT_SHEET_NAME: case XML_ELEMENT( TEXT, XML_SHEET_NAME ):
return new ScXMLCellFieldSheetNameContext(GetScImport(), nPrefix, rLocalName, *this); return new ScXMLCellFieldSheetNameContext(GetScImport(), nElement, *this);
case XML_TOK_CELL_TEXT_DATE: case XML_ELEMENT( TEXT, XML_DATE ):
return new ScXMLCellFieldDateContext(GetScImport(), nPrefix, rLocalName, *this); return new ScXMLCellFieldDateContext(GetScImport(), nElement, *this);
case XML_TOK_CELL_TEXT_TITLE: case XML_ELEMENT( TEXT, XML_TITLE ):
return new ScXMLCellFieldTitleContext(GetScImport(), nPrefix, rLocalName, *this); return new ScXMLCellFieldTitleContext(GetScImport(), nElement, *this);
case XML_TOK_CELL_TEXT_URL: case XML_ELEMENT( TEXT, XML_A ):
return new ScXMLCellFieldURLContext(GetScImport(), nPrefix, rLocalName, *this); return new ScXMLCellFieldURLContext(GetScImport(), nElement, *this);
default: default:
; ;
} }
return new SvXMLImportContext(GetImport(), nPrefix, rLocalName); return new SvXMLImportContext(GetImport());
} }
void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan, const OUString& rStyleName) void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan, const OUString& rStyleName)
...@@ -100,40 +97,35 @@ void ScXMLCellTextParaContext::PushFieldURL( ...@@ -100,40 +97,35 @@ void ScXMLCellTextParaContext::PushFieldURL(
} }
ScXMLCellTextSpanContext::ScXMLCellTextSpanContext( ScXMLCellTextSpanContext::ScXMLCellTextSpanContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent) 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()) if ( xAttrList.is() )
return;
OUString aLocalName;
sal_Int16 nAttrCount = xAttrList->getLength();
const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextSpanAttrTokenMap();
for (sal_Int16 i = 0; i < nAttrCount; ++i)
{ {
sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sax_fastparser::FastAttributeList *pAttribList =
xAttrList->getNameByIndex(i), &aLocalName); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
const OUString& rAttrValue = xAttrList->getValueByIndex(i); for (auto &aIter : *pAttribList)
sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
switch (nToken)
{ {
case XML_TOK_CELL_TEXT_SPAN_ATTR_STYLE_NAME: switch (aIter.getToken())
maStyleName = rAttrValue; {
break; case XML_ELEMENT( TEXT, XML_STYLE_NAME ):
default: maStyleName = aIter.toString();
; break;
default:
;
}
} }
} }
} }
void ScXMLCellTextSpanContext::EndElement() void SAL_CALL ScXMLCellTextSpanContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
if (!maContent.isEmpty()) if (!maContent.isEmpty())
{ {
...@@ -141,13 +133,13 @@ void ScXMLCellTextSpanContext::EndElement() ...@@ -141,13 +133,13 @@ void ScXMLCellTextSpanContext::EndElement()
} }
} }
void ScXMLCellTextSpanContext::Characters(const OUString& rChars) void SAL_CALL ScXMLCellTextSpanContext::characters( const OUString& rChars )
{ {
maContent += rChars; maContent += rChars;
} }
SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextSpanContext::createFastChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/) sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{ {
if (!maContent.isEmpty()) if (!maContent.isEmpty())
{ {
...@@ -155,36 +147,35 @@ SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext( ...@@ -155,36 +147,35 @@ SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext(
maContent.clear(); maContent.clear();
} }
const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextSpanElemTokenMap(); switch (nElement)
switch (rTokenMap.Get(nPrefix, rLocalName))
{ {
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); p->SetStyleName(maStyleName);
return p; 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); p->SetStyleName(maStyleName);
return p; 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); p->SetStyleName(maStyleName);
return p; 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); p->SetStyleName(maStyleName);
return p; 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); p->SetStyleName(maStyleName);
return p; return p;
} }
...@@ -192,12 +183,12 @@ SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext( ...@@ -192,12 +183,12 @@ SvXMLImportContext* ScXMLCellTextSpanContext::CreateChildContext(
; ;
} }
return new SvXMLImportContext(GetImport(), nPrefix, rLocalName); return new SvXMLImportContext(GetImport());
} }
ScXMLCellFieldSheetNameContext::ScXMLCellFieldSheetNameContext( ScXMLCellFieldSheetNameContext::ScXMLCellFieldSheetNameContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent) mrParentCxt(rParent)
{ {
} }
...@@ -207,29 +198,20 @@ void ScXMLCellFieldSheetNameContext::SetStyleName(const OUString& rStyleName) ...@@ -207,29 +198,20 @@ void ScXMLCellFieldSheetNameContext::SetStyleName(const OUString& rStyleName)
maStyleName = 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). // <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); 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( ScXMLCellFieldDateContext::ScXMLCellFieldDateContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent) mrParentCxt(rParent)
{ {
} }
...@@ -239,28 +221,14 @@ void ScXMLCellFieldDateContext::SetStyleName(const OUString& rStyleName) ...@@ -239,28 +221,14 @@ void ScXMLCellFieldDateContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName; maStyleName = rStyleName;
} }
void ScXMLCellFieldDateContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/) void SAL_CALL ScXMLCellFieldDateContext::endFastElement( sal_Int32 /*nElement*/ )
{
}
void ScXMLCellFieldDateContext::EndElement()
{ {
mrParentCxt.PushFieldDate(maStyleName); 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( ScXMLCellFieldTitleContext::ScXMLCellFieldTitleContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent) mrParentCxt(rParent)
{ {
} }
...@@ -270,28 +238,14 @@ void ScXMLCellFieldTitleContext::SetStyleName(const OUString& rStyleName) ...@@ -270,28 +238,14 @@ void ScXMLCellFieldTitleContext::SetStyleName(const OUString& rStyleName)
maStyleName = rStyleName; maStyleName = rStyleName;
} }
void ScXMLCellFieldTitleContext::StartElement(const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/) void SAL_CALL ScXMLCellFieldTitleContext::endFastElement( sal_Int32 /*nElement*/ )
{
}
void ScXMLCellFieldTitleContext::EndElement()
{ {
mrParentCxt.PushFieldTitle(maStyleName); 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( ScXMLCellFieldURLContext::ScXMLCellFieldURLContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent) mrParentCxt(rParent)
{ {
} }
...@@ -301,58 +255,47 @@ void ScXMLCellFieldURLContext::SetStyleName(const OUString& rStyleName) ...@@ -301,58 +255,47 @@ void ScXMLCellFieldURLContext::SetStyleName(const OUString& rStyleName)
maStyleName = 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()) if ( xAttrList.is() )
return;
OUString aLocalName;
sal_Int16 nAttrCount = xAttrList->getLength();
const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextURLAttrTokenMap();
for (sal_Int16 i = 0; i < nAttrCount; ++i)
{ {
sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sax_fastparser::FastAttributeList *pAttribList =
xAttrList->getNameByIndex(i), &aLocalName); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
const OUString& rAttrValue = xAttrList->getValueByIndex(i); for (auto &aIter : *pAttribList)
sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
switch (nToken)
{ {
case XML_TOK_CELL_TEXT_URL_ATTR_UREF: switch (aIter.getToken())
maURL = rAttrValue; {
break; case XML_ELEMENT( XLINK, XML_HREF ):
case XML_TOK_CELL_TEXT_URL_ATTR_TYPE: maURL = aIter.toString();
// Ignored for now. break;
break; case XML_ELEMENT( XLINK, XML_TYPE ):
case XML_TOK_CELL_TEXT_URL_TARGET_FRAME: // Ignored for now.
maTargetFrame = rAttrValue; break;
break; case XML_ELEMENT( OFFICE, XML_TARGET_FRAME_NAME ):
default: maTargetFrame = aIter.toString();
; break;
default:
;
}
} }
} }
} }
void ScXMLCellFieldURLContext::EndElement() void SAL_CALL ScXMLCellFieldURLContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
mrParentCxt.PushFieldURL(maURL, maRep, maStyleName, maTargetFrame); mrParentCxt.PushFieldURL(maURL, maRep, maStyleName, maTargetFrame);
} }
void ScXMLCellFieldURLContext::Characters(const OUString& rChars) void SAL_CALL ScXMLCellFieldURLContext::characters( const OUString& rChars )
{ {
maRep += 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( ScXMLCellFieldSContext::ScXMLCellFieldSContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent) : ScXMLImport& rImport, sal_Int32 /*nElement*/, ScXMLCellTextParaContext& rParent) :
ScXMLImportContext(rImport, nPrefix, rLName), ScXMLImportContext(rImport),
mrParentCxt(rParent), mrParentCxt(rParent),
mnCount(1) mnCount(1)
{ {
...@@ -363,43 +306,38 @@ void ScXMLCellFieldSContext::SetStyleName(const OUString& rStyleName) ...@@ -363,43 +306,38 @@ void ScXMLCellFieldSContext::SetStyleName(const OUString& rStyleName)
maStyleName = 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()) if ( xAttrList.is() )
return;
OUString aLocalName;
sal_Int16 nAttrCount = xAttrList->getLength();
const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextSAttrTokenMap();
for (sal_Int16 i = 0; i < nAttrCount; ++i)
{ {
sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sax_fastparser::FastAttributeList *pAttribList =
xAttrList->getNameByIndex(i), &aLocalName); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
const OUString& rAttrValue = xAttrList->getValueByIndex(i); for (auto &aIter : *pAttribList)
sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
switch (nToken)
{ {
case XML_TOK_CELL_TEXT_S_ATTR_C: switch (aIter.getToken())
mnCount = rAttrValue.toInt32(); {
if (mnCount <= 0) case XML_ELEMENT( TEXT, XML_C ):
mnCount = 1; // worth a warning? mnCount = aIter.toInt32();
break; if (mnCount <= 0)
default: mnCount = 1; // worth a warning?
; break;
default:
;
}
} }
} }
} }
void ScXMLCellFieldSContext::EndElement() void SAL_CALL ScXMLCellFieldSContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
if (mnCount) if (mnCount)
PushSpaces(); PushSpaces();
} }
SvXMLImportContext* ScXMLCellFieldSContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellFieldSContext::createFastChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/) sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{ {
// <text:s> does not have child elements, but ... // <text:s> does not have child elements, but ...
if (mnCount) if (mnCount)
...@@ -408,7 +346,7 @@ SvXMLImportContext* ScXMLCellFieldSContext::CreateChildContext( ...@@ -408,7 +346,7 @@ SvXMLImportContext* ScXMLCellFieldSContext::CreateChildContext(
mnCount = 0; mnCount = 0;
} }
return new SvXMLImportContext(GetImport(), nPrefix, rLocalName); return new SvXMLImportContext(GetImport());
} }
void ScXMLCellFieldSContext::PushSpaces() void ScXMLCellFieldSContext::PushSpaces()
......
...@@ -23,13 +23,12 @@ class ScXMLCellTextParaContext : public ScXMLImportContext ...@@ -23,13 +23,12 @@ class ScXMLCellTextParaContext : public ScXMLImportContext
ScXMLTableRowCellContext& mrParentCxt; ScXMLTableRowCellContext& mrParentCxt;
OUString maContent; OUString maContent;
public: 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 SAL_CALL endFastElement( sal_Int32 nElement ) override;
virtual void EndElement() override; virtual void SAL_CALL characters( const OUString& aChars ) override;
virtual void Characters(const OUString& rChars) override; virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
virtual SvXMLImportContext* CreateChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override;
void PushSpan(const OUString& rSpan, const OUString& rStyleName); void PushSpan(const OUString& rSpan, const OUString& rStyleName);
void PushFieldSheetName(const OUString& rStyleName); void PushFieldSheetName(const OUString& rStyleName);
...@@ -47,13 +46,14 @@ class ScXMLCellTextSpanContext : public ScXMLImportContext ...@@ -47,13 +46,14 @@ class ScXMLCellTextSpanContext : public ScXMLImportContext
OUString maStyleName; OUString maStyleName;
OUString maContent; OUString maContent;
public: public:
ScXMLCellTextSpanContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent); ScXMLCellTextSpanContext(ScXMLImport& rImport, sal_Int32 nElement, ScXMLCellTextParaContext& rParent);
virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; virtual void SAL_CALL startFastElement( sal_Int32 nElement,
virtual void EndElement() override; const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void Characters(const OUString& rChars) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
virtual SvXMLImportContext* CreateChildContext( virtual void SAL_CALL characters( const OUString& aChars ) override;
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 >& xAttrList ) override;
}; };
/** /**
...@@ -64,15 +64,13 @@ class ScXMLCellFieldSheetNameContext : public ScXMLImportContext ...@@ -64,15 +64,13 @@ class ScXMLCellFieldSheetNameContext : public ScXMLImportContext
ScXMLCellTextParaContext& mrParentCxt; ScXMLCellTextParaContext& mrParentCxt;
OUString maStyleName; OUString maStyleName;
public: 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); void SetStyleName(const OUString& rStyleName);
virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; virtual void SAL_CALL startFastElement( sal_Int32 nElement,
virtual void EndElement() override; const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void Characters(const OUString& rChars) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
virtual SvXMLImportContext* CreateChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override;
}; };
/** /**
...@@ -83,15 +81,11 @@ class ScXMLCellFieldDateContext : public ScXMLImportContext ...@@ -83,15 +81,11 @@ class ScXMLCellFieldDateContext : public ScXMLImportContext
ScXMLCellTextParaContext& mrParentCxt; ScXMLCellTextParaContext& mrParentCxt;
OUString maStyleName; OUString maStyleName;
public: 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); void SetStyleName(const OUString& rStyleName);
virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) 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;
}; };
/** /**
...@@ -102,15 +96,11 @@ class ScXMLCellFieldTitleContext : public ScXMLImportContext ...@@ -102,15 +96,11 @@ class ScXMLCellFieldTitleContext : public ScXMLImportContext
ScXMLCellTextParaContext& mrParentCxt; ScXMLCellTextParaContext& mrParentCxt;
OUString maStyleName; OUString maStyleName;
public: 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); void SetStyleName(const OUString& rStyleName);
virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) 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;
}; };
/** /**
...@@ -124,15 +114,14 @@ class ScXMLCellFieldURLContext : public ScXMLImportContext ...@@ -124,15 +114,14 @@ class ScXMLCellFieldURLContext : public ScXMLImportContext
OUString maRep; OUString maRep;
OUString maTargetFrame; OUString maTargetFrame;
public: 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); void SetStyleName(const OUString& rStyleName);
virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; virtual void SAL_CALL startFastElement( sal_Int32 nElement,
virtual void EndElement() override; const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void Characters(const OUString& rChars) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
virtual SvXMLImportContext* CreateChildContext( virtual void SAL_CALL characters( const OUString& aChars ) override;
sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override;
}; };
/** /**
...@@ -146,14 +135,15 @@ class ScXMLCellFieldSContext : public ScXMLImportContext ...@@ -146,14 +135,15 @@ class ScXMLCellFieldSContext : public ScXMLImportContext
void PushSpaces(); void PushSpaces();
public: 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); void SetStyleName(const OUString& rStyleName);
virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; virtual void SAL_CALL startFastElement( sal_Int32 nElement,
virtual void EndElement() override; const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual SvXMLImportContext* CreateChildContext( virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
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 >& xAttrList ) override;
}; };
#endif #endif
......
...@@ -654,15 +654,7 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr ...@@ -654,15 +654,7 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
{ {
case XML_TOK_TABLE_ROW_CELL_P: case XML_TOK_TABLE_ROW_CELL_P:
{ {
bIsEmpty = false;
bTextP = true; 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; break;
case XML_TOK_TABLE_ROW_CELL_ANNOTATION: case XML_TOK_TABLE_ROW_CELL_ANNOTATION:
...@@ -674,24 +666,6 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr ...@@ -674,24 +666,6 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
xAttrList, *mxAnnotationData); xAttrList, *mxAnnotationData);
} }
break; 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) if (!pContext && !bTextP)
...@@ -724,6 +698,53 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr ...@@ -724,6 +698,53 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPr
return pContext; 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 ) void ScXMLTableRowCellContext::DoMerge( const ScAddress& rScAddress, const SCCOL nCols, const SCROW nRows )
{ {
SCCOL mergeToCol = rScAddress.Col() + nCols; SCCOL mergeToCol = rScAddress.Col() + nCols;
......
...@@ -139,6 +139,9 @@ public: ...@@ -139,6 +139,9 @@ public:
const OUString& rLocalName, const OUString& rLocalName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override; 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 PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName);
void PushParagraphFieldDate(const OUString& rStyleName); void PushParagraphFieldDate(const OUString& rStyleName);
void PushParagraphFieldSheetName(const OUString& rStyleName); void PushParagraphFieldSheetName(const OUString& rStyleName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment