diff options
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/xml/XMLConverter.cxx | 70 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLConverter.hxx | 7 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLExportDataPilot.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmldpimp.cxx | 5 |
4 files changed, 58 insertions, 34 deletions
diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx index 3c1688036ad9..2437a6e49444 100644 --- a/sc/source/filter/xml/XMLConverter.cxx +++ b/sc/source/filter/xml/XMLConverter.cxx @@ -19,6 +19,7 @@ #include "XMLConverter.hxx" #include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/sheet/GeneralFunction2.hpp> #include <tools/datetime.hxx> #include <sax/tools/converter.hxx> #include <xmloff/xmltoken.hxx> @@ -56,11 +57,6 @@ sheet::GeneralFunction ScXMLConverter::GetFunctionFromString( const OUString& sF return sheet::GeneralFunction_PRODUCT; if( IsXMLToken(sFunction, XML_AVERAGE ) ) return sheet::GeneralFunction_AVERAGE; -#if 0 -// disabled because of css::sheet::GeneralFunction API incompatibility - if( IsXMLToken(sFunction, XML_MEDIAN ) ) - return sheet::GeneralFunction_MEDIAN; -#endif if( IsXMLToken(sFunction, XML_MAX ) ) return sheet::GeneralFunction_MAX; if( IsXMLToken(sFunction, XML_MIN ) ) @@ -76,6 +72,37 @@ sheet::GeneralFunction ScXMLConverter::GetFunctionFromString( const OUString& sF return sheet::GeneralFunction_NONE; } +sal_Int16 ScXMLConverter::GetFunctionFromString2( const OUString& sFunction ) +{ + if( IsXMLToken(sFunction, XML_SUM ) ) + return sheet::GeneralFunction2::SUM; + if( IsXMLToken(sFunction, XML_AUTO ) ) + return sheet::GeneralFunction2::AUTO; + if( IsXMLToken(sFunction, XML_COUNT ) ) + return sheet::GeneralFunction2::COUNT; + if( IsXMLToken(sFunction, XML_COUNTNUMS ) ) + return sheet::GeneralFunction2::COUNTNUMS; + if( IsXMLToken(sFunction, XML_PRODUCT ) ) + return sheet::GeneralFunction2::PRODUCT; + if( IsXMLToken(sFunction, XML_AVERAGE ) ) + return sheet::GeneralFunction2::AVERAGE; + if( IsXMLToken(sFunction, XML_MEDIAN ) ) + return sheet::GeneralFunction2::MEDIAN; + if( IsXMLToken(sFunction, XML_MAX ) ) + return sheet::GeneralFunction2::MAX; + if( IsXMLToken(sFunction, XML_MIN ) ) + return sheet::GeneralFunction2::MIN; + if( IsXMLToken(sFunction, XML_STDEV ) ) + return sheet::GeneralFunction2::STDEV; + if( IsXMLToken(sFunction, XML_STDEVP ) ) + return sheet::GeneralFunction2::STDEVP; + if( IsXMLToken(sFunction, XML_VAR ) ) + return sheet::GeneralFunction2::VAR; + if( IsXMLToken(sFunction, XML_VARP ) ) + return sheet::GeneralFunction2::VARP; + return sheet::GeneralFunction2::NONE; +} + ScSubTotalFunc ScXMLConverter::GetSubTotalFuncFromString( const OUString& sFunction ) { if( IsXMLToken(sFunction, XML_SUM ) ) @@ -107,28 +134,25 @@ ScSubTotalFunc ScXMLConverter::GetSubTotalFuncFromString( const OUString& sFunct void ScXMLConverter::GetStringFromFunction( OUString& rString, - const sheet::GeneralFunction eFunction ) + sal_Int16 eFunction ) { OUString sFuncStr; switch( eFunction ) { - case sheet::GeneralFunction_AUTO: sFuncStr = GetXMLToken( XML_AUTO ); break; - case sheet::GeneralFunction_AVERAGE: sFuncStr = GetXMLToken( XML_AVERAGE ); break; -#if 0 -// disabled because of css::sheet::GeneralFunction API incompatibility - case sheet::GeneralFunction_MEDIAN: sFuncStr = GetXMLToken( XML_MEDIAN ); break; -#endif - case sheet::GeneralFunction_COUNT: sFuncStr = GetXMLToken( XML_COUNT ); break; - case sheet::GeneralFunction_COUNTNUMS: sFuncStr = GetXMLToken( XML_COUNTNUMS ); break; - case sheet::GeneralFunction_MAX: sFuncStr = GetXMLToken( XML_MAX ); break; - case sheet::GeneralFunction_MIN: sFuncStr = GetXMLToken( XML_MIN ); break; - case sheet::GeneralFunction_NONE: sFuncStr = GetXMLToken( XML_NONE ); break; - case sheet::GeneralFunction_PRODUCT: sFuncStr = GetXMLToken( XML_PRODUCT ); break; - case sheet::GeneralFunction_STDEV: sFuncStr = GetXMLToken( XML_STDEV ); break; - case sheet::GeneralFunction_STDEVP: sFuncStr = GetXMLToken( XML_STDEVP ); break; - case sheet::GeneralFunction_SUM: sFuncStr = GetXMLToken( XML_SUM ); break; - case sheet::GeneralFunction_VAR: sFuncStr = GetXMLToken( XML_VAR ); break; - case sheet::GeneralFunction_VARP: sFuncStr = GetXMLToken( XML_VARP ); break; + case sheet::GeneralFunction2::AUTO: sFuncStr = GetXMLToken( XML_AUTO ); break; + case sheet::GeneralFunction2::AVERAGE: sFuncStr = GetXMLToken( XML_AVERAGE ); break; + case sheet::GeneralFunction2::MEDIAN: sFuncStr = GetXMLToken( XML_MEDIAN ); break; + case sheet::GeneralFunction2::COUNT: sFuncStr = GetXMLToken( XML_COUNT ); break; + case sheet::GeneralFunction2::COUNTNUMS: sFuncStr = GetXMLToken( XML_COUNTNUMS ); break; + case sheet::GeneralFunction2::MAX: sFuncStr = GetXMLToken( XML_MAX ); break; + case sheet::GeneralFunction2::MIN: sFuncStr = GetXMLToken( XML_MIN ); break; + case sheet::GeneralFunction2::NONE: sFuncStr = GetXMLToken( XML_NONE ); break; + case sheet::GeneralFunction2::PRODUCT: sFuncStr = GetXMLToken( XML_PRODUCT ); break; + case sheet::GeneralFunction2::STDEV: sFuncStr = GetXMLToken( XML_STDEV ); break; + case sheet::GeneralFunction2::STDEVP: sFuncStr = GetXMLToken( XML_STDEVP ); break; + case sheet::GeneralFunction2::SUM: sFuncStr = GetXMLToken( XML_SUM ); break; + case sheet::GeneralFunction2::VAR: sFuncStr = GetXMLToken( XML_VAR ); break; + case sheet::GeneralFunction2::VARP: sFuncStr = GetXMLToken( XML_VARP ); break; default: { assert(false); diff --git a/sc/source/filter/xml/XMLConverter.hxx b/sc/source/filter/xml/XMLConverter.hxx index 8c8ffe542865..41535c357136 100644 --- a/sc/source/filter/xml/XMLConverter.hxx +++ b/sc/source/filter/xml/XMLConverter.hxx @@ -47,13 +47,16 @@ public: static css::sheet::GeneralFunction GetFunctionFromString( const OUString& rString ); + static sal_Int16 GetFunctionFromString2( + const OUString& rString ); + static ScSubTotalFunc GetSubTotalFuncFromString( const OUString& rString ); -// EXPORT: GeneralFunction / ScSubTotalFunc +// EXPORT: GeneralFunctio2 / ScSubTotalFunc static void GetStringFromFunction( OUString& rString, - const css::sheet::GeneralFunction eFunction ); + const sal_Int16 eFunction ); static void GetStringFromFunction( OUString& rString, const ScSubTotalFunc eFunction ); diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index aa461163755a..b16aa0a03143 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp> #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp> #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp> +#include <com/sun/star/sheet/GeneralFunction2.hpp> using namespace com::sun::star; using namespace xmloff::token; @@ -431,8 +432,6 @@ void ScXMLExportDataPilot::WriteLayoutInfo(ScDPSaveDimension* pDim) void ScXMLExportDataPilot::WriteSubTotals(ScDPSaveDimension* pDim) { - using sheet::GeneralFunction; - sal_Int32 nSubTotalCount = pDim->GetSubTotalsCount(); const OUString* pLayoutName = nullptr; if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012) @@ -446,10 +445,10 @@ void ScXMLExportDataPilot::WriteSubTotals(ScDPSaveDimension* pDim) for (sal_Int32 nSubTotal = 0; nSubTotal < nSubTotalCount; nSubTotal++) { OUString sFunction; - GeneralFunction nFunc = static_cast<GeneralFunction>(pDim->GetSubTotalFunc(nSubTotal)); + sal_Int16 nFunc = static_cast<sal_Int16>(pDim->GetSubTotalFunc(nSubTotal)); ScXMLConverter::GetStringFromFunction( sFunction, nFunc); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sFunction); - if (pLayoutName && nFunc == sheet::GeneralFunction_AUTO) + if (pLayoutName && nFunc == sheet::GeneralFunction2::AUTO) rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName); SvXMLElementExport aElemST(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, true, true); } @@ -699,8 +698,7 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim ::sax::Converter::convertNumber(sBuffer, pDim->GetUsedHierarchy()); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, sBuffer.makeStringAndClear()); } - ScXMLConverter::GetStringFromFunction( sValueStr, - (sheet::GeneralFunction) pDim->GetFunction() ); + ScXMLConverter::GetStringFromFunction( sValueStr, static_cast<sal_Int16>(pDim->GetFunction()) ); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sValueStr); if (eOrientation == sheet::DataPilotFieldOrientation_PAGE) diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index 19b84729c4d4..cc39b95ce0aa 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -994,7 +994,7 @@ ScXMLDataPilotFieldContext::ScXMLDataPilotFieldContext( ScXMLImport& rImport, break; case XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION : { - nFunction = (sal_Int16) ScXMLConverter::GetFunctionFromString( sValue ); + nFunction = ScXMLConverter::GetFunctionFromString2( sValue ); } break; case XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION : @@ -1522,8 +1522,7 @@ ScXMLDataPilotSubTotalContext::ScXMLDataPilotSubTotalContext( ScXMLImport& rImpo { case XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_FUNCTION : { - pDataPilotSubTotals->AddFunction( sal::static_int_cast<sal_Int16>( - ScXMLConverter::GetFunctionFromString( sValue ) ) ); + pDataPilotSubTotals->AddFunction( ScXMLConverter::GetFunctionFromString2( sValue ) ); } break; case XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME: |