Kaydet (Commit) a9588bac authored tarafından Mohammed Abdul Azeem's avatar Mohammed Abdul Azeem

Moving legacy contexts to FastContexts:

ScXMLTableShapesContext
ScXMLTableSourceContext
ScXMLTableColContext
ScXMLTableColsContext
ScXMLConditionalFormatsContext
ScXMLTableProtectionContext

Change-Id: I36704c7f51cd5d13b3c0ebf9bc07b172c1576f3e
Reviewed-on: https://gerrit.libreoffice.org/40246Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst e0bafa78
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
using namespace com::sun::star; using namespace com::sun::star;
ScXMLTableShapesContext::ScXMLTableShapesContext( ScXMLImport& rImport, ScXMLTableShapesContext::ScXMLTableShapesContext( 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 */ ) : ScXMLImportContext( rImport )
ScXMLImportContext( rImport, nPrfx, rLName )
{ {
// here are no attributes // here are no attributes
} }
...@@ -59,8 +58,4 @@ SvXMLImportContext *ScXMLTableShapesContext::CreateChildContext( sal_uInt16 nPre ...@@ -59,8 +58,4 @@ SvXMLImportContext *ScXMLTableShapesContext::CreateChildContext( sal_uInt16 nPre
return pContext; return pContext;
} }
void ScXMLTableShapesContext::EndElement()
{
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -27,17 +27,14 @@ ...@@ -27,17 +27,14 @@
class ScXMLTableShapesContext : public ScXMLImportContext class ScXMLTableShapesContext : public ScXMLImportContext
{ {
public: public:
ScXMLTableShapesContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLTableShapesContext( ScXMLImport& rImport, 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 ~ScXMLTableShapesContext() override; virtual ~ScXMLTableShapesContext() override;
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
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 void EndElement() override;
}; };
#endif #endif
......
...@@ -32,10 +32,9 @@ using namespace com::sun::star; ...@@ -32,10 +32,9 @@ using namespace com::sun::star;
using namespace xmloff::token; using namespace xmloff::token;
ScXMLTableSourceContext::ScXMLTableSourceContext( ScXMLImport& rImport, ScXMLTableSourceContext::ScXMLTableSourceContext( 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) : ScXMLImportContext( rImport ),
ScXMLImportContext( rImport, nPrfx, rLName ),
sLink(), sLink(),
sTableName(), sTableName(),
sFilterName(), sFilterName(),
...@@ -43,37 +42,36 @@ ScXMLTableSourceContext::ScXMLTableSourceContext( ScXMLImport& rImport, ...@@ -43,37 +42,36 @@ ScXMLTableSourceContext::ScXMLTableSourceContext( ScXMLImport& rImport,
nRefresh(0), nRefresh(0),
nMode(sheet::SheetLinkMode_NORMAL) nMode(sheet::SheetLinkMode_NORMAL)
{ {
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
for( sal_Int16 i=0; i < nAttrCount; ++i )
{ {
const OUString& sAttrName(xAttrList->getNameByIndex( i )); sax_fastparser::FastAttributeList *pAttribList =
OUString aLocalName; sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
sAttrName, &aLocalName )); for (auto &aIter : *pAttribList)
const OUString& sValue(xAttrList->getValueByIndex( i ));
if(nPrefix == XML_NAMESPACE_XLINK)
{
if (IsXMLToken(aLocalName, XML_HREF))
sLink = GetScImport().GetAbsoluteReference(sValue);
}
else if (nPrefix == XML_NAMESPACE_TABLE)
{ {
if (IsXMLToken(aLocalName, XML_TABLE_NAME)) switch (aIter.getToken())
sTableName = sValue;
else if (IsXMLToken(aLocalName, XML_FILTER_NAME))
sFilterName = sValue;
else if (IsXMLToken(aLocalName, XML_FILTER_OPTIONS))
sFilterOptions = sValue;
else if (IsXMLToken(aLocalName, XML_MODE))
{ {
if (IsXMLToken(sValue, XML_COPY_RESULTS_ONLY)) case XML_ELEMENT( XLINK, XML_HREF ):
sLink = GetScImport().GetAbsoluteReference(aIter.toString());
break;
case XML_ELEMENT( TABLE, XML_TABLE_NAME ):
sTableName = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_FILTER_NAME):
sFilterName = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_FILTER_OPTIONS ):
sFilterOptions = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_MODE ):
if (IsXMLToken(aIter, XML_COPY_RESULTS_ONLY))
nMode = sheet::SheetLinkMode_VALUE; nMode = sheet::SheetLinkMode_VALUE;
} break;
else if (IsXMLToken(aLocalName, XML_REFRESH_DELAY)) case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ):
{
double fTime; double fTime;
if (::sax::Converter::convertDuration( fTime, sValue )) if (::sax::Converter::convertDuration( fTime, aIter.toString() ))
nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 ); nRefresh = std::max( (sal_Int32)(fTime * 86400.0), (sal_Int32)0 );
break;
} }
} }
} }
...@@ -83,14 +81,13 @@ ScXMLTableSourceContext::~ScXMLTableSourceContext() ...@@ -83,14 +81,13 @@ ScXMLTableSourceContext::~ScXMLTableSourceContext()
{ {
} }
SvXMLImportContext *ScXMLTableSourceContext::CreateChildContext( sal_uInt16 nPrefix, uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableSourceContext::createFastChildContext(
const OUString& rLName, sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{ {
return new SvXMLImportContext( GetImport(), nPrefix, rLName ); return new SvXMLImportContext( GetImport() );
} }
void ScXMLTableSourceContext::EndElement() void SAL_CALL ScXMLTableSourceContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
if (!sLink.isEmpty()) if (!sLink.isEmpty())
{ {
......
...@@ -35,17 +35,15 @@ class ScXMLTableSourceContext : public ScXMLImportContext ...@@ -35,17 +35,15 @@ class ScXMLTableSourceContext : public ScXMLImportContext
css::sheet::SheetLinkMode nMode; css::sheet::SheetLinkMode nMode;
public: public:
ScXMLTableSourceContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLTableSourceContext( ScXMLImport& rImport, 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 ~ScXMLTableSourceContext() override; virtual ~ScXMLTableSourceContext() override;
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
virtual void EndElement() override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
#endif #endif
......
...@@ -40,47 +40,43 @@ using namespace com::sun::star; ...@@ -40,47 +40,43 @@ using namespace com::sun::star;
using namespace xmloff::token; using namespace xmloff::token;
ScXMLTableColContext::ScXMLTableColContext( ScXMLImport& rImport, ScXMLTableColContext::ScXMLTableColContext( 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 ) : ScXMLImportContext( rImport ),
ScXMLImportContext( rImport, nPrfx, rLName ),
sVisibility(GetXMLToken(XML_VISIBLE)) sVisibility(GetXMLToken(XML_VISIBLE))
{ {
nColCount = 1; nColCount = 1;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableColAttrTokenMap();
for( sal_Int16 i=0; i < nAttrCount; ++i )
{ {
const OUString& sAttrName(xAttrList->getNameByIndex( i )); sax_fastparser::FastAttributeList *pAttribList =
OUString aLocalName; sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
sAttrName, &aLocalName );
const OUString& sValue(xAttrList->getValueByIndex( i ));
switch( rAttrTokenMap.Get( nPrefix, aLocalName ) ) for (auto &aIter : *pAttribList)
{ {
case XML_TOK_TABLE_COL_ATTR_REPEATED: switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_REPEATED ):
{ {
nColCount = std::max<sal_Int32>(sValue.toInt32(), 1); nColCount = std::max<sal_Int32>(aIter.toInt32(), 1);
nColCount = std::min<sal_Int32>(nColCount, MAXCOLCOUNT); nColCount = std::min<sal_Int32>(nColCount, MAXCOLCOUNT);
} }
break; break;
case XML_TOK_TABLE_COL_ATTR_STYLE_NAME: case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
{ {
sStyleName = sValue; sStyleName = aIter.toString();
} }
break; break;
case XML_TOK_TABLE_COL_ATTR_VISIBILITY: case XML_ELEMENT( TABLE, XML_VISIBILITY ):
{ {
sVisibility = sValue; sVisibility = aIter.toString();
} }
break; break;
case XML_TOK_TABLE_COL_ATTR_DEFAULT_CELL_STYLE_NAME: case XML_ELEMENT( TABLE, XML_DEFAULT_CELL_STYLE_NAME ):
{ {
sCellStyleName = sValue; sCellStyleName = aIter.toString();
} }
break; break;
}
} }
} }
} }
...@@ -89,14 +85,13 @@ ScXMLTableColContext::~ScXMLTableColContext() ...@@ -89,14 +85,13 @@ ScXMLTableColContext::~ScXMLTableColContext()
{ {
} }
SvXMLImportContext *ScXMLTableColContext::CreateChildContext( sal_uInt16 nPrefix, uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableColContext::createFastChildContext(
const OUString& rLName, sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
{ {
return new SvXMLImportContext( GetImport(), nPrefix, rLName ); return new SvXMLImportContext( GetImport() );
} }
void ScXMLTableColContext::EndElement() void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
ScXMLImport& rXMLImport = GetScImport(); ScXMLImport& rXMLImport = GetScImport();
SCTAB nSheet = rXMLImport.GetTables().GetCurrentSheet(); SCTAB nSheet = rXMLImport.GetTables().GetCurrentSheet();
...@@ -152,11 +147,10 @@ void ScXMLTableColContext::EndElement() ...@@ -152,11 +147,10 @@ void ScXMLTableColContext::EndElement()
} }
ScXMLTableColsContext::ScXMLTableColsContext( ScXMLImport& rImport, ScXMLTableColsContext::ScXMLTableColsContext( 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,
const bool bTempHeader, const bool bTempGroup) : const bool bTempHeader, const bool bTempGroup) :
ScXMLImportContext( rImport, nPrfx, rLName ), ScXMLImportContext( rImport ),
nHeaderStartCol(0), nHeaderStartCol(0),
nHeaderEndCol(0), nHeaderEndCol(0),
nGroupStartCol(0), nGroupStartCol(0),
...@@ -171,20 +165,14 @@ ScXMLTableColsContext::ScXMLTableColsContext( ScXMLImport& rImport, ...@@ -171,20 +165,14 @@ ScXMLTableColsContext::ScXMLTableColsContext( ScXMLImport& rImport,
else if (bGroup) else if (bGroup)
{ {
nGroupStartCol = rImport.GetTables().GetCurrentColCount(); nGroupStartCol = rImport.GetTables().GetCurrentColCount();
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; if ( xAttrList.is() )
for( sal_Int16 i=0; i < nAttrCount; ++i )
{ {
const OUString& sAttrName(xAttrList->getNameByIndex( i )); sax_fastparser::FastAttributeList *pAttribList =
OUString aLocalName; sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
sAttrName, &aLocalName );
const OUString& sValue(xAttrList->getValueByIndex( i ));
if (nPrefix == XML_NAMESPACE_TABLE && IsXMLToken(aLocalName, XML_DISPLAY)) auto &aIter( pAttribList->find( XML_ELEMENT( TABLE, XML_DISPLAY ) ) );
{ if ( aIter != pAttribList->end() && IsXMLToken(aIter, XML_FALSE) )
if (IsXMLToken(sValue, XML_FALSE)) bGroupDisplay = false;
bGroupDisplay = false;
}
} }
} }
} }
...@@ -193,45 +181,39 @@ ScXMLTableColsContext::~ScXMLTableColsContext() ...@@ -193,45 +181,39 @@ ScXMLTableColsContext::~ScXMLTableColsContext()
{ {
} }
SvXMLImportContext *ScXMLTableColsContext::CreateChildContext( sal_uInt16 nPrefix, uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableColsContext::createFastChildContext(
const OUString& rLName, sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{ {
SvXMLImportContext *pContext = nullptr; SvXMLImportContext *pContext = nullptr;
const SvXMLTokenMap& rTokenMap = GetScImport().GetTableColsElemTokenMap(); switch (nElement)
switch( rTokenMap.Get( nPrefix, rLName ) )
{ {
case XML_TOK_TABLE_COLS_COL_GROUP: case XML_ELEMENT( TABLE, XML_TABLE_COLUMN_GROUP ):
pContext = new ScXMLTableColsContext( GetScImport(), nPrefix, pContext = new ScXMLTableColsContext( GetScImport(), nElement, xAttrList,
rLName, xAttrList,
false, true ); false, true );
break; break;
case XML_TOK_TABLE_COLS_HEADER_COLS: case XML_ELEMENT( TABLE, XML_TABLE_HEADER_COLUMNS ):
pContext = new ScXMLTableColsContext( GetScImport(), nPrefix, pContext = new ScXMLTableColsContext( GetScImport(), nElement, xAttrList,
rLName, xAttrList,
true, false ); true, false );
break; break;
case XML_TOK_TABLE_COLS_COLS: case XML_ELEMENT( TABLE, XML_TABLE_COLUMNS ):
pContext = new ScXMLTableColsContext( GetScImport(), nPrefix, pContext = new ScXMLTableColsContext( GetScImport(), nElement, xAttrList,
rLName, xAttrList,
false, false ); false, false );
break; break;
case XML_TOK_TABLE_COLS_COL: case XML_ELEMENT( TABLE, XML_TABLE_COLUMN ):
pContext = new ScXMLTableColContext( GetScImport(), nPrefix, pContext = new ScXMLTableColContext( GetScImport(), nElement, xAttrList//,
rLName, xAttrList//,
//this //this
); );
break; break;
} }
if( !pContext ) if( !pContext )
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName ); pContext = new SvXMLImportContext( GetImport() );
return pContext; return pContext;
} }
void ScXMLTableColsContext::EndElement() void SAL_CALL ScXMLTableColsContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
ScXMLImport& rXMLImport = GetScImport(); ScXMLImport& rXMLImport = GetScImport();
if (bHeader) if (bHeader)
......
...@@ -33,17 +33,15 @@ class ScXMLTableColContext : public ScXMLImportContext ...@@ -33,17 +33,15 @@ class ScXMLTableColContext : public ScXMLImportContext
public: public:
ScXMLTableColContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLTableColContext( ScXMLImport& rImport, 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 ~ScXMLTableColContext() override; virtual ~ScXMLTableColContext() override;
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
virtual void EndElement() override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
class ScXMLTableColsContext : public ScXMLImportContext class ScXMLTableColsContext : public ScXMLImportContext
...@@ -58,18 +56,16 @@ class ScXMLTableColsContext : public ScXMLImportContext ...@@ -58,18 +56,16 @@ class ScXMLTableColsContext : public ScXMLImportContext
public: public:
ScXMLTableColsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLTableColsContext( ScXMLImport& rImport, sal_Int32 nElement,
const OUString& rLName, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
const bool bHeader, const bool bGroup); const bool bHeader, const bool bGroup);
virtual ~ScXMLTableColsContext() override; virtual ~ScXMLTableColsContext() override;
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
virtual void EndElement() override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
#endif #endif
......
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
#include "XMLConverter.hxx" #include "XMLConverter.hxx"
#include "stylehelper.hxx" #include "stylehelper.hxx"
ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_Int32 /*nElement*/ ):
const OUString& rLName): ScXMLImportContext( rImport )
ScXMLImportContext( rImport, nPrfx, rLName )
{ {
GetScImport().SetNewCondFormatData(); GetScImport().SetNewCondFormatData();
GetScImport().GetDocument()->SetCondFormList(new ScConditionalFormatList(), GetScImport().GetTables().GetCurrentSheet()); GetScImport().GetDocument()->SetCondFormList(new ScConditionalFormatList(), GetScImport().GetTables().GetCurrentSheet());
...@@ -46,7 +45,7 @@ SvXMLImportContext* ScXMLConditionalFormatsContext::CreateChildContext( sal_uInt ...@@ -46,7 +45,7 @@ SvXMLImportContext* ScXMLConditionalFormatsContext::CreateChildContext( sal_uInt
return pContext; return pContext;
} }
void ScXMLConditionalFormatsContext::EndElement() void SAL_CALL ScXMLConditionalFormatsContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
ScDocument* pDoc = GetScImport().GetDocument(); ScDocument* pDoc = GetScImport().GetDocument();
......
...@@ -26,14 +26,13 @@ struct ScIconSetFormatData; ...@@ -26,14 +26,13 @@ struct ScIconSetFormatData;
class ScXMLConditionalFormatsContext : public ScXMLImportContext class ScXMLConditionalFormatsContext : public ScXMLImportContext
{ {
public: public:
ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_Int32 nElement );
const OUString& rLName );
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
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 void EndElement() override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
class ScXMLConditionalFormatContext : public ScXMLImportContext class ScXMLConditionalFormatContext : public ScXMLImportContext
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <xmloff/xmltoken.hxx> #include <xmloff/xmltoken.hxx>
#include "xmlimprt.hxx" #include "xmlimprt.hxx"
#include <xmloff/xmlnmspe.hxx>
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
...@@ -41,55 +42,49 @@ ScXMLLabelRangesContext::~ScXMLLabelRangesContext() ...@@ -41,55 +42,49 @@ ScXMLLabelRangesContext::~ScXMLLabelRangesContext()
GetScImport().UnlockSolarMutex(); GetScImport().UnlockSolarMutex();
} }
SvXMLImportContext* ScXMLLabelRangesContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLLabelRangesContext::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().GetLabelRangesElemTokenMap());
switch( rTokenMap.Get( nPrefix, rLName ) ) switch (nElement)
{ {
case XML_TOK_LABEL_RANGE_ELEM: case XML_ELEMENT( TABLE, XML_LABEL_RANGE ):
pContext = new ScXMLLabelRangeContext( GetScImport(), nPrefix, rLName, xAttrList ); pContext = new ScXMLLabelRangeContext( GetScImport(), nElement, xAttrList );
break; break;
} }
if( !pContext ) if( !pContext )
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName ); pContext = new SvXMLImportContext( GetImport() );
return pContext; return pContext;
} }
ScXMLLabelRangeContext::ScXMLLabelRangeContext( ScXMLLabelRangeContext::ScXMLLabelRangeContext(
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 ),
bColumnOrientation( false ) bColumnOrientation( false )
{ {
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetLabelRangeAttrTokenMap());
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_LABEL_RANGE_ATTR_LABEL_RANGE: switch (aIter.getToken())
sLabelRangeStr = sValue; {
break; case XML_ELEMENT( TABLE, XML_LABEL_CELL_RANGE_ADDRESS ):
case XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE: sLabelRangeStr = aIter.toString();
sDataRangeStr = sValue; break;
break; case XML_ELEMENT( TABLE, XML_DATA_CELL_RANGE_ADDRESS ):
case XML_TOK_LABEL_RANGE_ATTR_ORIENTATION: sDataRangeStr = aIter.toString();
bColumnOrientation = IsXMLToken(sValue, XML_COLUMN ); break;
break; case XML_ELEMENT( TABLE, XML_ORIENTATION ):
bColumnOrientation = IsXMLToken(aIter, XML_COLUMN );
break;
}
} }
} }
} }
...@@ -98,15 +93,13 @@ ScXMLLabelRangeContext::~ScXMLLabelRangeContext() ...@@ -98,15 +93,13 @@ ScXMLLabelRangeContext::~ScXMLLabelRangeContext()
{ {
} }
SvXMLImportContext* ScXMLLabelRangeContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLLabelRangeContext::createFastChildContext(
sal_uInt16 nPrefix, sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList >& /* xAttrList */ )
{ {
return new SvXMLImportContext( GetImport(), nPrefix, rLName ); return new SvXMLImportContext( GetImport() );
} }
void ScXMLLabelRangeContext::EndElement() void SAL_CALL ScXMLLabelRangeContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
// Label ranges must be stored as strings until all sheets are loaded // Label ranges must be stored as strings until all sheets are loaded
// (like named expressions). // (like named expressions).
......
...@@ -33,10 +33,10 @@ public: ...@@ -33,10 +33,10 @@ public:
); );
virtual ~ScXMLLabelRangesContext() override; virtual ~ScXMLLabelRangesContext() 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;
}; };
...@@ -50,18 +50,17 @@ private: ...@@ -50,18 +50,17 @@ private:
public: public:
ScXMLLabelRangeContext( ScXMLLabelRangeContext(
ScXMLImport& rImport, ScXMLImport& rImport,
sal_uInt16 nPrefix, 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 ~ScXMLLabelRangeContext() override; virtual ~ScXMLLabelRangeContext() 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; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
#endif #endif
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <xmloff/xmltkmap.hxx> #include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <xmloff/xmltoken.hxx> #include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <sax/tools/converter.hxx> #include <sax/tools/converter.hxx>
...@@ -36,10 +37,9 @@ using namespace xmloff::token; ...@@ -36,10 +37,9 @@ using namespace xmloff::token;
ScXMLTableScenarioContext::ScXMLTableScenarioContext( ScXMLTableScenarioContext::ScXMLTableScenarioContext(
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 ),
aBorderColor( COL_BLACK ), aBorderColor( COL_BLACK ),
bDisplayBorder( true ), bDisplayBorder( true ),
bCopyBack( true ), bCopyBack( true ),
...@@ -49,66 +49,49 @@ ScXMLTableScenarioContext::ScXMLTableScenarioContext( ...@@ -49,66 +49,49 @@ ScXMLTableScenarioContext::ScXMLTableScenarioContext(
bProtected( false ) bProtected( false )
{ {
rImport.LockSolarMutex(); rImport.LockSolarMutex();
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetTableScenarioAttrTokenMap()); if ( xAttrList.is() )
for( sal_Int16 i = 0; i < nAttrCount; ++i )
{ {
const OUString& sAttrName(xAttrList->getNameByIndex( i )); sax_fastparser::FastAttributeList *pAttribList =
OUString aLocalName; sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
sAttrName, &aLocalName ));
const OUString& sValue(xAttrList->getValueByIndex( i ));
switch( rAttrTokenMap.Get( nPrefix, aLocalName ) ) for (auto &aIter : *pAttribList)
{ {
case XML_TOK_TABLE_SCENARIO_ATTR_DISPLAY_BORDER: switch (aIter.getToken())
{
bDisplayBorder = IsXMLToken(sValue, XML_TRUE);
}
break;
case XML_TOK_TABLE_SCENARIO_ATTR_BORDER_COLOR:
{
sal_Int32 nColor(0);
::sax::Converter::convertColor(nColor, sValue);
aBorderColor.SetColor(nColor);
}
break;
case XML_TOK_TABLE_SCENARIO_ATTR_COPY_BACK:
{
bCopyBack = IsXMLToken(sValue, XML_TRUE);
}
break;
case XML_TOK_TABLE_SCENARIO_ATTR_COPY_STYLES:
{
bCopyStyles = IsXMLToken(sValue, XML_TRUE);
}
break;
case XML_TOK_TABLE_SCENARIO_ATTR_COPY_FORMULAS:
{
bCopyFormulas = IsXMLToken(sValue, XML_TRUE);
}
break;
case XML_TOK_TABLE_SCENARIO_ATTR_IS_ACTIVE:
{
bIsActive = IsXMLToken(sValue, XML_TRUE);
}
break;
case XML_TOK_TABLE_SCENARIO_ATTR_SCENARIO_RANGES:
{ {
case XML_ELEMENT( TABLE, XML_DISPLAY_BORDER ):
bDisplayBorder = IsXMLToken(aIter, XML_TRUE);
break;
case XML_ELEMENT( TABLE, XML_BORDER_COLOR ):
{
sal_Int32 nColor(0);
::sax::Converter::convertColor(nColor, aIter.toString());
aBorderColor.SetColor(nColor);
}
break;
case XML_ELEMENT( TABLE, XML_COPY_BACK ):
bCopyBack = IsXMLToken(aIter, XML_TRUE);
break;
case XML_ELEMENT( TABLE, XML_COPY_STYLES ):
bCopyStyles = IsXMLToken(aIter, XML_TRUE);
break;
case XML_ELEMENT( TABLE, XML_COPY_FORMULAS ):
bCopyFormulas = IsXMLToken(aIter, XML_TRUE);
break;
case XML_ELEMENT( TABLE, XML_IS_ACTIVE ):
bIsActive = IsXMLToken(aIter, XML_TRUE);
break;
case XML_ELEMENT( TABLE, XML_SCENARIO_RANGES ):
ScRangeStringConverter::GetRangeListFromString( ScRangeStringConverter::GetRangeListFromString(
aScenarioRanges, sValue, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO ); aScenarioRanges, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO );
} break;
break; case XML_ELEMENT( TABLE, XML_COMMENT ):
case XML_TOK_TABLE_SCENARIO_ATTR_COMMENT: sComment = aIter.toString();
{ break;
sComment = sValue; case XML_ELEMENT( TABLE, XML_PROTECTED ):
} bProtected = IsXMLToken(aIter, XML_TRUE);
break; break;
case XML_TOK_TABLE_SCENARIO_ATTR_PROTECTED:
{
bProtected = IsXMLToken(sValue, XML_TRUE);
} }
break;
} }
} }
} }
...@@ -118,15 +101,13 @@ ScXMLTableScenarioContext::~ScXMLTableScenarioContext() ...@@ -118,15 +101,13 @@ ScXMLTableScenarioContext::~ScXMLTableScenarioContext()
GetScImport().UnlockSolarMutex(); GetScImport().UnlockSolarMutex();
} }
SvXMLImportContext *ScXMLTableScenarioContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableScenarioContext::createFastChildContext(
sal_uInt16 nPrefix, sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList >& /* xAttrList */ )
{ {
return new SvXMLImportContext( GetImport(), nPrefix, rLName ); return new SvXMLImportContext( GetImport() );
} }
void ScXMLTableScenarioContext::EndElement() void SAL_CALL ScXMLTableScenarioContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
SCTAB nCurrTable( GetScImport().GetTables().GetCurrentSheet() ); SCTAB nCurrTable( GetScImport().GetTables().GetCurrentSheet() );
ScDocument* pDoc(GetScImport().GetDocument()); ScDocument* pDoc(GetScImport().GetDocument());
......
...@@ -42,17 +42,15 @@ private: ...@@ -42,17 +42,15 @@ private:
public: public:
ScXMLTableScenarioContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLTableScenarioContext( ScXMLImport& rImport, 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 ~ScXMLTableScenarioContext() override; virtual ~ScXMLTableScenarioContext() override;
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
virtual void EndElement() override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
#endif #endif
......
...@@ -215,7 +215,7 @@ ScXMLTableContext::~ScXMLTableContext() ...@@ -215,7 +215,7 @@ ScXMLTableContext::~ScXMLTableContext()
SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix, SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLName, const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttrList*/ )
{ {
const SvXMLTokenMap& rTokenMap(GetScImport().GetTableElemTokenMap()); const SvXMLTokenMap& rTokenMap(GetScImport().GetTableElemTokenMap());
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLName); sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLName);
...@@ -228,38 +228,6 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix, ...@@ -228,38 +228,6 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
switch (nToken) switch (nToken)
{ {
case XML_TOK_TABLE_COL_GROUP:
pContext = new ScXMLTableColsContext( GetScImport(), nPrefix,
rLName, xAttrList,
false, true );
break;
case XML_TOK_TABLE_HEADER_COLS:
pContext = new ScXMLTableColsContext( GetScImport(), nPrefix,
rLName, xAttrList,
true, false );
break;
case XML_TOK_TABLE_COLS:
pContext = new ScXMLTableColsContext( GetScImport(), nPrefix,
rLName, xAttrList,
false, false );
break;
case XML_TOK_TABLE_COL:
pContext = new ScXMLTableColContext( GetScImport(), nPrefix,
rLName, xAttrList );
break;
case XML_TOK_TABLE_PROTECTION:
case XML_TOK_TABLE_PROTECTION_EXT:
pContext = new ScXMLTableProtectionContext( GetScImport(), nPrefix, rLName, xAttrList );
break;
case XML_TOK_TABLE_SOURCE:
pContext = new ScXMLTableSourceContext( GetScImport(), nPrefix, rLName, xAttrList);
break;
case XML_TOK_TABLE_SCENARIO:
pContext = new ScXMLTableScenarioContext( GetScImport(), nPrefix, rLName, xAttrList);
break;
case XML_TOK_TABLE_SHAPES:
pContext = new ScXMLTableShapesContext( GetScImport(), nPrefix, rLName, xAttrList);
break;
case XML_TOK_TABLE_FORMS: case XML_TOK_TABLE_FORMS:
{ {
GetScImport().GetFormImport()->startPage(GetScImport().GetTables().GetCurrentXDrawPage()); GetScImport().GetFormImport()->startPage(GetScImport().GetTables().GetCurrentXDrawPage());
...@@ -275,9 +243,6 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix, ...@@ -275,9 +243,6 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
pContext = new XMLEventsImportContext( GetImport(), nPrefix, rLName, xSupplier ); pContext = new XMLEventsImportContext( GetImport(), nPrefix, rLName, xSupplier );
} }
break; break;
case XML_TOK_TABLE_CONDFORMATS:
pContext = new ScXMLConditionalFormatsContext( GetScImport(), nPrefix, rLName );
break;
default: default:
; ;
} }
...@@ -328,6 +293,26 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ...@@ -328,6 +293,26 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
new ScXMLNamedExpressionsContext::SheetLocalInserter(GetScImport(), nTab)); new ScXMLNamedExpressionsContext::SheetLocalInserter(GetScImport(), nTab));
} }
break; break;
case XML_ELEMENT( TABLE, XML_TABLE_COLUMN_GROUP ):
pContext = new ScXMLTableColsContext( GetScImport(), nElement, xAttrList,
false, true );
break;
case XML_ELEMENT( TABLE, XML_TABLE_HEADER_COLUMNS ):
pContext = new ScXMLTableColsContext( GetScImport(), nElement, xAttrList,
true, false );
break;
case XML_ELEMENT( TABLE, XML_TABLE_COLUMNS ):
pContext = new ScXMLTableColsContext( GetScImport(), nElement, xAttrList,
false, false );
break;
case XML_ELEMENT( TABLE, XML_TABLE_COLUMN ):
pContext = new ScXMLTableColContext( GetScImport(), nElement, xAttrList );
break;
case XML_ELEMENT( TABLE, XML_TABLE_PROTECTION ):
case XML_ELEMENT( LO_EXT, XML_TABLE_PROTECTION ):
case XML_ELEMENT( OFFICE_EXT, XML_TABLE_PROTECTION ):
pContext = new ScXMLTableProtectionContext( GetScImport(), nElement, xAttrList );
break;
case XML_ELEMENT( TABLE, XML_TABLE_ROW_GROUP ): case XML_ELEMENT( TABLE, XML_TABLE_ROW_GROUP ):
pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList, pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
false, true ); false, true );
...@@ -343,6 +328,18 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ...@@ -343,6 +328,18 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
case XML_ELEMENT( TABLE, XML_TABLE_ROW ): case XML_ELEMENT( TABLE, XML_TABLE_ROW ):
pContext = new ScXMLTableRowContext( GetScImport(),xAttrList ); pContext = new ScXMLTableRowContext( GetScImport(),xAttrList );
break; break;
case XML_ELEMENT( TABLE, XML_TABLE_SOURCE ):
pContext = new ScXMLTableSourceContext( GetScImport(), nElement, xAttrList);
break;
case XML_ELEMENT( TABLE, XML_SCENARIO ):
pContext = new ScXMLTableScenarioContext( GetScImport(), nElement, xAttrList);
break;
case XML_ELEMENT( TABLE, XML_SHAPES ):
pContext = new ScXMLTableShapesContext( GetScImport(), nElement, xAttrList);
break;
case XML_ELEMENT( CALC_EXT, XML_CONDITIONAL_FORMATS ):
pContext = new ScXMLConditionalFormatsContext( GetScImport(), nElement );
break;
default: default:
pContext = new SvXMLImportContext( GetImport() ); pContext = new SvXMLImportContext( GetImport() );
} }
...@@ -432,11 +429,10 @@ void SAL_CALL ScXMLTableContext::endFastElement(sal_Int32 /*nElement*/) ...@@ -432,11 +429,10 @@ void SAL_CALL ScXMLTableContext::endFastElement(sal_Int32 /*nElement*/)
} }
ScXMLTableProtectionContext::ScXMLTableProtectionContext( ScXMLTableProtectionContext::ScXMLTableProtectionContext(
ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLImport& rImport, sal_Int32 /*nElement*/,
const Reference<XAttributeList>& xAttrList ) : const Reference< xml::sax::XFastAttributeList>& xAttrList ) :
ScXMLImportContext( rImport, nPrefix, rLName ) ScXMLImportContext( rImport )
{ {
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableProtectionAttrTokenMap();
bool bSelectProtectedCells = false; bool bSelectProtectedCells = false;
bool bSelectUnprotectedCells = false; bool bSelectUnprotectedCells = false;
bool bInsertColumns = false; bool bInsertColumns = false;
...@@ -444,41 +440,42 @@ ScXMLTableProtectionContext::ScXMLTableProtectionContext( ...@@ -444,41 +440,42 @@ ScXMLTableProtectionContext::ScXMLTableProtectionContext(
bool bDeleteColumns = false; bool bDeleteColumns = false;
bool bDeleteRows = false; bool bDeleteRows = false;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; if ( xAttrList.is() )
for (sal_Int16 i = 0; i < nAttrCount; ++i)
{ {
const OUString& aAttrName = xAttrList->getNameByIndex(i); sax_fastparser::FastAttributeList *pAttribList =
const OUString aValue = xAttrList->getValueByIndex(i); sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
OUString aLocalName;
sal_uInt16 nLocalPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
aAttrName, &aLocalName);
switch (rAttrTokenMap.Get(nLocalPrefix, aLocalName)) for (auto &aIter : *pAttribList)
{ {
case XML_TOK_TABLE_SELECT_PROTECTED_CELLS: sal_Int32 nToken = aIter.getToken();
case XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT: switch (nToken)
bSelectProtectedCells = IsXMLToken(aValue, XML_TRUE);
{
case XML_ELEMENT( TABLE, XML_SELECT_PROTECTED_CELLS ):
case XML_ELEMENT( OFFICE_EXT, XML_SELECT_PROTECTED_CELLS ):
case XML_ELEMENT( LO_EXT, XML_SELECT_PROTECTED_CELLS ):
bSelectProtectedCells = IsXMLToken(aIter, XML_TRUE);
break; break;
case XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS: case XML_ELEMENT( TABLE, XML_SELECT_UNPROTECTED_CELLS ):
case XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT: case XML_ELEMENT( OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS ):
bSelectUnprotectedCells = IsXMLToken(aValue, XML_TRUE); case XML_ELEMENT( LO_EXT, XML_SELECT_UNPROTECTED_CELLS ):
bSelectUnprotectedCells = IsXMLToken(aIter, XML_TRUE);
break; break;
case XML_TOK_TABLE_INSERT_COLUMNS_EXT: case XML_ELEMENT( LO_EXT, XML_INSERT_COLUMNS ):
bInsertColumns = IsXMLToken(aValue, XML_TRUE); bInsertColumns = IsXMLToken(aIter, XML_TRUE);
break; break;
case XML_TOK_TABLE_INSERT_ROWS_EXT: case XML_ELEMENT( LO_EXT, XML_INSERT_ROWS ):
bInsertRows = IsXMLToken(aValue, XML_TRUE); bInsertRows = IsXMLToken(aIter, XML_TRUE);
break; break;
case XML_TOK_TABLE_DELETE_COLUMNS_EXT: case XML_ELEMENT( LO_EXT, XML_DELETE_COLUMNS ):
bDeleteColumns = IsXMLToken(aValue, XML_TRUE); bDeleteColumns = IsXMLToken(aIter, XML_TRUE);
break; break;
case XML_TOK_TABLE_DELETE_ROWS_EXT: case XML_ELEMENT( LO_EXT, XML_DELETE_ROWS ):
bDeleteRows = IsXMLToken(aValue, XML_TRUE); bDeleteRows = IsXMLToken(aIter, XML_TRUE);
break; break;
default: default:
SAL_WARN("sc", "unknown attribute: " << aAttrName); SAL_WARN("sc", "unknown attribute: " << nToken);
}
} }
} }
...@@ -495,14 +492,10 @@ ScXMLTableProtectionContext::~ScXMLTableProtectionContext() ...@@ -495,14 +492,10 @@ ScXMLTableProtectionContext::~ScXMLTableProtectionContext()
{ {
} }
SvXMLImportContext* ScXMLTableProtectionContext::CreateChildContext( uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableProtectionContext::createFastChildContext(
sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, const Reference<XAttributeList>& /*xAttrList*/ ) sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{ {
return nullptr; return nullptr;
} }
void ScXMLTableProtectionContext::EndElement()
{
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -67,17 +67,13 @@ public: ...@@ -67,17 +67,13 @@ public:
class ScXMLTableProtectionContext : public ScXMLImportContext class ScXMLTableProtectionContext : public ScXMLImportContext
{ {
public: public:
ScXMLTableProtectionContext( ScXMLImport& rImport, sal_uInt16 nPrefix, ScXMLTableProtectionContext( ScXMLImport& rImport, 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 ~ScXMLTableProtectionContext() override; virtual ~ScXMLTableProtectionContext() override;
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
virtual void EndElement() override;
}; };
#endif #endif
......
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