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

Moving legacy contexts to FastContexts:

ScXMLConditionalFormatContext
ScXMLColorScaleFormatContext
ScXMLDataBarFormatContext
ScXMLIconSetFormatContext
ScXMLColorScaleFormatEntryContext
ScXMLFormattingEntryContext
ScXMLCondContext
ScXMLDateContext

Change-Id: If2980e87198b934b4f8e95a6278f4026c092896d
Reviewed-on: https://gerrit.libreoffice.org/40561Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst b6076ea5
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <memory> #include <memory>
#include "xmlcondformat.hxx" #include "xmlcondformat.hxx"
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <xmloff/xmlnmspe.hxx>
#include "colorscale.hxx" #include "colorscale.hxx"
#include "conditio.hxx" #include "conditio.hxx"
...@@ -21,6 +22,8 @@ ...@@ -21,6 +22,8 @@
#include "XMLConverter.hxx" #include "XMLConverter.hxx"
#include "stylehelper.hxx" #include "stylehelper.hxx"
using namespace xmloff::token;
ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_Int32 /*nElement*/ ): ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_Int32 /*nElement*/ ):
ScXMLImportContext( rImport ) ScXMLImportContext( rImport )
{ {
...@@ -28,17 +31,14 @@ ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rIm ...@@ -28,17 +31,14 @@ ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rIm
GetScImport().GetDocument()->SetCondFormList(new ScConditionalFormatList(), GetScImport().GetTables().GetCurrentSheet()); GetScImport().GetDocument()->SetCondFormList(new ScConditionalFormatList(), GetScImport().GetTables().GetCurrentSheet());
} }
SvXMLImportContext* ScXMLConditionalFormatsContext::CreateChildContext( sal_uInt16 nPrefix, css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLConditionalFormatsContext::createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{ {
const SvXMLTokenMap& rTokenMap = GetScImport().GetCondFormatsTokenMap();
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
SvXMLImportContext* pContext = nullptr; SvXMLImportContext* pContext = nullptr;
switch (nToken) switch (nElement)
{ {
case XML_TOK_CONDFORMATS_CONDFORMAT: case XML_ELEMENT( CALC_EXT, XML_CONDITIONAL_FORMAT ):
pContext = new ScXMLConditionalFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList ); pContext = new ScXMLConditionalFormatContext( GetScImport(), nElement, xAttrList );
break; break;
} }
...@@ -56,29 +56,27 @@ void SAL_CALL ScXMLConditionalFormatsContext::endFastElement( sal_Int32 /*nEleme ...@@ -56,29 +56,27 @@ void SAL_CALL ScXMLConditionalFormatsContext::endFastElement( sal_Int32 /*nEleme
SAL_WARN_IF(bDeleted, "sc", "conditional formats have been deleted because they contained empty range info"); SAL_WARN_IF(bDeleted, "sc", "conditional formats have been deleted because they contained empty range info");
} }
ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImport, sal_Int32 /*nElement*/,
const OUString& rLName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList): const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList):
ScXMLImportContext( rImport, nPrfx, rLName ) ScXMLImportContext( rImport )
{ {
OUString sRange; OUString sRange;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetCondFormatAttrMap();
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_CONDFORMAT_TARGET_RANGE: switch (aIter.getToken())
sRange = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_TARGET_RANGE_ADDRESS ):
default: sRange = aIter.toString();
break; break;
default:
break;
}
} }
} }
...@@ -89,29 +87,26 @@ ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImpo ...@@ -89,29 +87,26 @@ ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImpo
mxFormat->SetRange(maRange); mxFormat->SetRange(maRange);
} }
SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildContext( sal_uInt16 nPrefix, css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLConditionalFormatContext::createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{ {
const SvXMLTokenMap& rTokenMap = GetScImport().GetCondFormatTokenMap();
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
SvXMLImportContext* pContext = nullptr; SvXMLImportContext* pContext = nullptr;
switch (nToken) switch (nElement)
{ {
case XML_TOK_CONDFORMAT_CONDITION: case XML_ELEMENT( CALC_EXT, XML_CONDITION ):
pContext = new ScXMLCondContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() ); pContext = new ScXMLCondContext( GetScImport(), nElement, xAttrList, mxFormat.get() );
break; break;
case XML_TOK_CONDFORMAT_COLORSCALE: case XML_ELEMENT( CALC_EXT, XML_COLOR_SCALE ):
pContext = new ScXMLColorScaleFormatContext( GetScImport(), nPrefix, rLocalName, mxFormat.get() ); pContext = new ScXMLColorScaleFormatContext( GetScImport(), nElement, mxFormat.get() );
break; break;
case XML_TOK_CONDFORMAT_DATABAR: case XML_ELEMENT( CALC_EXT, XML_DATA_BAR ):
pContext = new ScXMLDataBarFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() ); pContext = new ScXMLDataBarFormatContext( GetScImport(), nElement, xAttrList, mxFormat.get() );
break; break;
case XML_TOK_CONDFORMAT_ICONSET: case XML_ELEMENT( CALC_EXT, XML_ICON_SET ):
pContext = new ScXMLIconSetFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() ); pContext = new ScXMLIconSetFormatContext( GetScImport(), nElement, xAttrList, mxFormat.get() );
break; break;
case XML_TOK_CONDFORMAT_DATE: case XML_ELEMENT( CALC_EXT, XML_DATE_IS ):
pContext = new ScXMLDateContext( GetScImport(), nPrefix, rLocalName, xAttrList, mxFormat.get() ); pContext = new ScXMLDateContext( GetScImport(), nElement, xAttrList, mxFormat.get() );
break; break;
default: default:
break; break;
...@@ -120,7 +115,7 @@ SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildContext( sal_uInt1 ...@@ -120,7 +115,7 @@ SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildContext( sal_uInt1
return pContext; return pContext;
} }
void ScXMLConditionalFormatContext::EndElement() void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElement*/ )
{ {
ScDocument* pDoc = GetScImport().GetDocument(); ScDocument* pDoc = GetScImport().GetDocument();
...@@ -136,26 +131,23 @@ ScXMLConditionalFormatContext::~ScXMLConditionalFormatContext() ...@@ -136,26 +131,23 @@ ScXMLConditionalFormatContext::~ScXMLConditionalFormatContext()
{ {
} }
ScXMLColorScaleFormatContext::ScXMLColorScaleFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLColorScaleFormatContext::ScXMLColorScaleFormatContext( ScXMLImport& rImport, sal_Int32 /*nElement*/,
const OUString& rLName, ScConditionalFormat* pFormat): ScConditionalFormat* pFormat):
ScXMLImportContext( rImport, nPrfx, rLName ), ScXMLImportContext( rImport ),
pColorScaleFormat(nullptr) pColorScaleFormat(nullptr)
{ {
pColorScaleFormat = new ScColorScaleFormat(GetScImport().GetDocument()); pColorScaleFormat = new ScColorScaleFormat(GetScImport().GetDocument());
pFormat->AddEntry(pColorScaleFormat); pFormat->AddEntry(pColorScaleFormat);
} }
SvXMLImportContext* ScXMLColorScaleFormatContext::CreateChildContext( sal_uInt16 nPrefix, css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLColorScaleFormatContext::createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{ {
const SvXMLTokenMap& rTokenMap = GetScImport().GetColorScaleTokenMap();
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
SvXMLImportContext* pContext = nullptr; SvXMLImportContext* pContext = nullptr;
switch (nToken) switch (nElement)
{ {
case XML_TOK_COLORSCALE_COLORSCALEENTRY: case XML_ELEMENT( CALC_EXT, XML_COLOR_SCALE_ENTRY ):
pContext = new ScXMLColorScaleFormatEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, pColorScaleFormat ); pContext = new ScXMLColorScaleFormatEntryContext( GetScImport(), nElement, xAttrList, pColorScaleFormat );
break; break;
default: default:
break; break;
...@@ -164,10 +156,10 @@ SvXMLImportContext* ScXMLColorScaleFormatContext::CreateChildContext( sal_uInt16 ...@@ -164,10 +156,10 @@ SvXMLImportContext* ScXMLColorScaleFormatContext::CreateChildContext( sal_uInt16
return pContext; return pContext;
} }
ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_Int32 /*nElement*/,
const OUString& rLName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
ScConditionalFormat* pFormat): ScConditionalFormat* pFormat):
ScXMLImportContext( rImport, nPrfx, rLName ), ScXMLImportContext( rImport ),
mpDataBarFormat(nullptr), mpDataBarFormat(nullptr),
mpFormatData(nullptr), mpFormatData(nullptr),
mnIndex(0) mnIndex(0)
...@@ -181,44 +173,42 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_ ...@@ -181,44 +173,42 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_
OUString sMinLength; OUString sMinLength;
OUString sMaxLength; OUString sMaxLength;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDataBarAttrMap();
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_DATABAR_POSITIVE_COLOR: switch (aIter.getToken())
sPositiveColor = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_POSITIVE_COLOR ):
case XML_TOK_DATABAR_GRADIENT: sPositiveColor = aIter.toString();
sGradient = sValue;
break; break;
case XML_TOK_DATABAR_NEGATIVE_COLOR: case XML_ELEMENT( CALC_EXT, XML_GRADIENT ):
sNegativeColor = sValue; sGradient = aIter.toString();
break; break;
case XML_TOK_DATABAR_AXISPOSITION: case XML_ELEMENT( CALC_EXT, XML_NEGATIVE_COLOR ):
sAxisPosition = sValue; sNegativeColor = aIter.toString();
break; break;
case XML_TOK_DATABAR_SHOWVALUE: case XML_ELEMENT( CALC_EXT, XML_AXIS_POSITION ):
sShowValue = sValue; sAxisPosition = aIter.toString();
break; break;
case XML_TOK_DATABAR_AXISCOLOR: case XML_ELEMENT( CALC_EXT, XML_SHOW_VALUE ):
sAxisColor = sValue; sShowValue = aIter.toString();
break; break;
case XML_TOK_DATABAR_MINLENGTH: case XML_ELEMENT( CALC_EXT, XML_AXIS_COLOR ):
sMinLength = sValue; sAxisColor = aIter.toString();
break; break;
case XML_TOK_DATABAR_MAXLENGTH: case XML_ELEMENT( CALC_EXT, XML_MIN_LENGTH ):
sMaxLength = sValue; sMinLength = aIter.toString();
break; break;
default: case XML_ELEMENT( CALC_EXT, XML_MAX_LENGTH ):
sMaxLength = aIter.toString();
break; break;
default:
break;
}
} }
} }
...@@ -288,20 +278,17 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_ ...@@ -288,20 +278,17 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_
pFormat->AddEntry(mpDataBarFormat); pFormat->AddEntry(mpDataBarFormat);
} }
SvXMLImportContext* ScXMLDataBarFormatContext::CreateChildContext( sal_uInt16 nPrefix, css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLDataBarFormatContext::createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{ {
const SvXMLTokenMap& rTokenMap = GetScImport().GetFormattingTokenMap();
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
SvXMLImportContext* pContext = nullptr; SvXMLImportContext* pContext = nullptr;
switch (nToken) switch (nElement)
{ {
case XML_TOK_FORMATTING_ENTRY: case XML_ELEMENT( CALC_EXT, XML_FORMATTING_ENTRY ):
case XML_TOK_DATABAR_DATABARENTRY: case XML_ELEMENT( CALC_EXT, XML_DATA_BAR_ENTRY ):
{ {
ScColorScaleEntry* pEntry(nullptr); ScColorScaleEntry* pEntry(nullptr);
pContext = new ScXMLFormattingEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, pEntry ); pContext = new ScXMLFormattingEntryContext( GetScImport(), nElement, xAttrList, pEntry );
if(mnIndex == 0) if(mnIndex == 0)
{ {
mpFormatData->mpLowerLimit.reset(pEntry); mpFormatData->mpLowerLimit.reset(pEntry);
...@@ -325,33 +312,30 @@ SvXMLImportContext* ScXMLDataBarFormatContext::CreateChildContext( sal_uInt16 nP ...@@ -325,33 +312,30 @@ SvXMLImportContext* ScXMLDataBarFormatContext::CreateChildContext( sal_uInt16 nP
return pContext; return pContext;
} }
ScXMLIconSetFormatContext::ScXMLIconSetFormatContext(ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLIconSetFormatContext::ScXMLIconSetFormatContext(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,
ScConditionalFormat* pFormat): ScConditionalFormat* pFormat):
ScXMLImportContext( rImport, nPrfx, rLName ) ScXMLImportContext( rImport )
{ {
OUString aIconSetType, sShowValue; OUString aIconSetType, sShowValue;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetIconSetAttrMap();
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_ICONSET_TYPE: switch (aIter.getToken())
aIconSetType = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_ICON_SET_TYPE ):
case XML_TOK_ICONSET_SHOWVALUE: aIconSetType = aIter.toString();
sShowValue = sValue;
break; break;
default: case XML_ELEMENT( CALC_EXT, XML_SHOW_VALUE ):
sShowValue = aIter.toString();
break; break;
default:
break;
}
} }
} }
...@@ -384,19 +368,16 @@ ScXMLIconSetFormatContext::ScXMLIconSetFormatContext(ScXMLImport& rImport, sal_u ...@@ -384,19 +368,16 @@ ScXMLIconSetFormatContext::ScXMLIconSetFormatContext(ScXMLImport& rImport, sal_u
mpFormatData = pIconSetFormatData; mpFormatData = pIconSetFormatData;
} }
SvXMLImportContext* ScXMLIconSetFormatContext::CreateChildContext( sal_uInt16 nPrefix, css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLIconSetFormatContext::createFastChildContext(
const OUString& rLocalName, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
{ {
const SvXMLTokenMap& rTokenMap = GetScImport().GetFormattingTokenMap();
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
SvXMLImportContext* pContext = nullptr; SvXMLImportContext* pContext = nullptr;
switch (nToken) switch (nElement)
{ {
case XML_TOK_FORMATTING_ENTRY: case XML_ELEMENT( CALC_EXT, XML_FORMATTING_ENTRY ):
{ {
ScColorScaleEntry* pEntry(nullptr); ScColorScaleEntry* pEntry(nullptr);
pContext = new ScXMLFormattingEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, pEntry ); pContext = new ScXMLFormattingEntryContext( GetScImport(), nElement, xAttrList, pEntry );
mpFormatData->m_Entries.push_back(std::unique_ptr<ScColorScaleEntry>(pEntry)); mpFormatData->m_Entries.push_back(std::unique_ptr<ScColorScaleEntry>(pEntry));
} }
break; break;
...@@ -569,39 +550,36 @@ void GetConditionData(const OUString& rValue, ScConditionMode& eMode, OUString& ...@@ -569,39 +550,36 @@ void GetConditionData(const OUString& rValue, ScConditionMode& eMode, OUString&
} }
ScXMLCondContext::ScXMLCondContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLCondContext::ScXMLCondContext( 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,
ScConditionalFormat* pFormat ): ScConditionalFormat* pFormat ):
ScXMLImportContext( rImport, nPrfx, rLName ) ScXMLImportContext( rImport )
{ {
OUString sExpression; OUString sExpression;
OUString sStyle; OUString sStyle;
OUString sAddress; OUString sAddress;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetConditionAttrMap();
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_CONDITION_VALUE: switch (aIter.getToken())
sExpression = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_VALUE ):
case XML_TOK_CONDITION_APPLY_STYLE_NAME: sExpression = aIter.toString();
sStyle = ScStyleNameConversion::ProgrammaticToDisplayName(sValue, SfxStyleFamily::Para );
break; break;
case XML_TOK_CONDITION_BASE_CELL_ADDRESS: case XML_ELEMENT( CALC_EXT, XML_APPLY_STYLE_NAME ):
sAddress = sValue; sStyle = ScStyleNameConversion::ProgrammaticToDisplayName(aIter.toString(), SfxStyleFamily::Para );
break; break;
default: case XML_ELEMENT( CALC_EXT, XML_BASE_CELL_ADDRESS ):
sAddress = aIter.toString();
break; break;
default:
break;
}
} }
} }
...@@ -644,11 +622,10 @@ void setColorEntryType(const OUString& rType, ScColorScaleEntry* pEntry, const O ...@@ -644,11 +622,10 @@ void setColorEntryType(const OUString& rType, ScColorScaleEntry* pEntry, const O
} }
ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( 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,
ScColorScaleFormat* pFormat): ScColorScaleFormat* pFormat):
ScXMLImportContext( rImport, nPrfx, rLName ), ScXMLImportContext( rImport ),
mpFormatEntry( nullptr ) mpFormatEntry( nullptr )
{ {
double nVal = 0; double nVal = 0;
...@@ -658,29 +635,27 @@ ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImpor ...@@ -658,29 +635,27 @@ ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImpor
OUString sVal; OUString sVal;
OUString sColor; OUString sColor;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetColorScaleEntryAttrMap();
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_COLORSCALEENTRY_TYPE: switch (aIter.getToken())
sType = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_TYPE ):
case XML_TOK_COLORSCALEENTRY_VALUE: sType = aIter.toString();
sVal = sValue;
break; break;
case XML_TOK_COLORSCALEENTRY_COLOR: case XML_ELEMENT( CALC_EXT, XML_VALUE ):
sColor = sValue; sVal = aIter.toString();
break; break;
default: case XML_ELEMENT( CALC_EXT, XML_COLOR ):
sColor = aIter.toString();
break; break;
default:
break;
}
} }
} }
...@@ -696,35 +671,32 @@ ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImpor ...@@ -696,35 +671,32 @@ ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImpor
pFormat->AddEntry(mpFormatEntry); pFormat->AddEntry(mpFormatEntry);
} }
ScXMLFormattingEntryContext::ScXMLFormattingEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLFormattingEntryContext::ScXMLFormattingEntryContext( 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,
ScColorScaleEntry*& pColorScaleEntry): ScColorScaleEntry*& pColorScaleEntry):
ScXMLImportContext( rImport, nPrfx, rLName ) ScXMLImportContext( rImport )
{ {
OUString sVal; OUString sVal;
OUString sType; OUString sType;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDataBarEntryAttrMap();
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_DATABARENTRY_TYPE: switch (aIter.getToken())
sType = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_TYPE ):
case XML_TOK_DATABARENTRY_VALUE: sType = aIter.toString();
sVal = sValue;
break; break;
default: case XML_ELEMENT( CALC_EXT, XML_VALUE ):
sVal = aIter.toString();
break; break;
default:
break;
}
} }
} }
...@@ -773,33 +745,30 @@ condformat::ScCondFormatDateType getDateFromString(const OUString& rString) ...@@ -773,33 +745,30 @@ condformat::ScCondFormatDateType getDateFromString(const OUString& rString)
} }
ScXMLDateContext::ScXMLDateContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLDateContext::ScXMLDateContext( 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,
ScConditionalFormat* pFormat ): ScConditionalFormat* pFormat ):
ScXMLImportContext( rImport, nPrfx, rLName ) ScXMLImportContext( rImport )
{ {
OUString sDateType, sStyle; OUString sDateType, sStyle;
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); if ( xAttrList.is() )
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetCondDateAttrMap();
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_COND_DATE_VALUE: switch (aIter.getToken())
sDateType = sValue; {
break; case XML_ELEMENT( CALC_EXT, XML_DATE ):
case XML_TOK_COND_DATE_STYLE: sDateType = aIter.toString();
sStyle = ScStyleNameConversion::ProgrammaticToDisplayName(sValue, SfxStyleFamily::Para );
break; break;
default: case XML_ELEMENT( CALC_EXT, XML_STYLE ):
sStyle = ScStyleNameConversion::ProgrammaticToDisplayName(aIter.toString(), SfxStyleFamily::Para );
break; break;
default:
break;
}
} }
} }
......
...@@ -28,9 +28,8 @@ class ScXMLConditionalFormatsContext : public ScXMLImportContext ...@@ -28,9 +28,8 @@ class ScXMLConditionalFormatsContext : public ScXMLImportContext
public: public:
ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_Int32 nElement ); ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_Int32 nElement );
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 SAL_CALL endFastElement( sal_Int32 nElement ) override; virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
}; };
...@@ -38,17 +37,15 @@ public: ...@@ -38,17 +37,15 @@ public:
class ScXMLConditionalFormatContext : public ScXMLImportContext class ScXMLConditionalFormatContext : public ScXMLImportContext
{ {
public: public:
ScXMLConditionalFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLConditionalFormatContext( 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 ~ScXMLConditionalFormatContext() override; virtual ~ScXMLConditionalFormatContext() 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;
private: private:
std::unique_ptr<ScConditionalFormat> mxFormat; std::unique_ptr<ScConditionalFormat> mxFormat;
...@@ -58,12 +55,11 @@ private: ...@@ -58,12 +55,11 @@ private:
class ScXMLColorScaleFormatContext : public ScXMLImportContext class ScXMLColorScaleFormatContext : public ScXMLImportContext
{ {
public: public:
ScXMLColorScaleFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLColorScaleFormatContext( ScXMLImport& rImport, sal_Int32 nElement,
const OUString& rLName, ScConditionalFormat* pFormat); ScConditionalFormat* pFormat);
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;
private: private:
ScColorScaleFormat* pColorScaleFormat; ScColorScaleFormat* pColorScaleFormat;
...@@ -72,14 +68,12 @@ private: ...@@ -72,14 +68,12 @@ private:
class ScXMLDataBarFormatContext : public ScXMLImportContext class ScXMLDataBarFormatContext : public ScXMLImportContext
{ {
public: public:
ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLDataBarFormatContext( 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,
ScConditionalFormat* pFormat); ScConditionalFormat* pFormat);
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;
private: private:
ScDataBarFormat* mpDataBarFormat; ScDataBarFormat* mpDataBarFormat;
...@@ -93,22 +87,19 @@ class ScXMLIconSetFormatContext : public ScXMLImportContext ...@@ -93,22 +87,19 @@ class ScXMLIconSetFormatContext : public ScXMLImportContext
ScIconSetFormatData* mpFormatData; ScIconSetFormatData* mpFormatData;
public: public:
ScXMLIconSetFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLIconSetFormatContext( 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,
ScConditionalFormat* pFormat); ScConditionalFormat* pFormat);
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;
}; };
class ScXMLColorScaleFormatEntryContext : public ScXMLImportContext class ScXMLColorScaleFormatEntryContext : public ScXMLImportContext
{ {
public: public:
ScXMLColorScaleFormatEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLColorScaleFormatEntryContext( 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,
ScColorScaleFormat* pFormat); ScColorScaleFormat* pFormat);
private: private:
...@@ -118,27 +109,24 @@ private: ...@@ -118,27 +109,24 @@ private:
class ScXMLFormattingEntryContext : public ScXMLImportContext class ScXMLFormattingEntryContext : public ScXMLImportContext
{ {
public: public:
ScXMLFormattingEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLFormattingEntryContext( 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,
ScColorScaleEntry*& pData); ScColorScaleEntry*& pData);
}; };
class ScXMLCondContext : public ScXMLImportContext class ScXMLCondContext : public ScXMLImportContext
{ {
public: public:
ScXMLCondContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLCondContext( 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,
ScConditionalFormat* pFormat); ScConditionalFormat* pFormat);
}; };
class ScXMLDateContext : public ScXMLImportContext class ScXMLDateContext : public ScXMLImportContext
{ {
public: public:
ScXMLDateContext( ScXMLImport& rImport, sal_uInt16 nPrfx, ScXMLDateContext( 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,
ScConditionalFormat* pFormat); ScConditionalFormat* pFormat);
}; };
......
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