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
......
...@@ -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