Kaydet (Commit) 1d85c8df authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#69518: Correctly handle the old constraint syntax.

We apparently support this syntax for ODF-backward compatibility.

To fix this, I resurrected ScDPObject::ParseFilters() which was removed as
unused, adjusted it for the String->OUString change, and changed the filter
data structure to the UNO one rather than using the old one we no longer use
elsewhere.

Change-Id: If52b38aaa1e8b208fb0ef9d92a6e853decdf43e3
üst 60b5de35
......@@ -183,6 +183,12 @@ public:
const OUString& rDataFieldName,
std::vector<com::sun::star::sheet::DataPilotFieldFilter>& rFilters);
bool ParseFilters(
OUString& rDataFieldName,
std::vector<com::sun::star::sheet::DataPilotFieldFilter>& rFilters,
std::vector<com::sun::star::sheet::GeneralFunction>& rFilterFuncs,
const OUString& rFilterList );
void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
void ToggleDetails(const ::com::sun::star::sheet::DataPilotTableHeaderData& rElemDesc, ScDPObject* pDestObj);
......
......@@ -41,29 +41,8 @@ namespace com { namespace sun { namespace star { namespace sheet {
class Rectangle;
class ScDocument;
struct ScDPOutLevelData;
struct ScDPGetPivotDataField
{
OUString maFieldName;
com::sun::star::sheet::GeneralFunction meFunction;
bool mbValIsStr;
OUString maValStr;
double mnValNum;
ScDPGetPivotDataField() :
meFunction( com::sun::star::sheet::GeneralFunction_NONE ),
mbValIsStr( false ),
mnValNum( 0.0 )
{
}
};
class ScDPOutput
{
private:
......
......@@ -2831,12 +2831,12 @@ void ScInterpreter::ScGetPivotData()
}
std::vector<sheet::DataPilotFieldFilter> aFilters;
svl::SharedString aDataFieldName;
OUString aDataFieldName;
ScRange aBlock;
if (bOldSyntax)
{
aDataFieldName = GetString();
aDataFieldName = GetString().getString();
switch (GetStackType())
{
......@@ -2887,7 +2887,7 @@ void ScInterpreter::ScGetPivotData()
return;
}
aDataFieldName = GetString(); // First parameter is data field name.
aDataFieldName = GetString().getString(); // First parameter is data field name.
}
// NOTE : MS Excel docs claim to use the 'most recent' which is not
......@@ -2900,7 +2900,22 @@ void ScInterpreter::ScGetPivotData()
return;
}
double fVal = pDPObj->GetPivotData(aDataFieldName.getString(), aFilters);
if (bOldSyntax)
{
OUString aFilterStr = aDataFieldName;
std::vector<sheet::GeneralFunction> aFilterFuncs;
if (!pDPObj->ParseFilters(aDataFieldName, aFilters, aFilterFuncs, aFilterStr))
{
PushError(errNoRef);
return;
}
// TODO : For now, we ignore filter functions since we couldn't find a
// live example of how they are supposed to be used. We'll support
// this again once we come across a real-world example.
}
double fVal = pDPObj->GetPivotData(aDataFieldName, aFilters);
if (rtl::math::isNan(fVal))
{
PushError(errNoRef);
......
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