kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0043-fdo-69518-Correctly-handle-the-old-constraint-syntax.patch

f0633d
From cfc9cef1e26e98153eb93229a9c18a674a3ebf11 Mon Sep 17 00:00:00 2001
f0633d
From: Kohei Yoshida <kohei.yoshida@collabora.com>
f0633d
Date: Fri, 6 Dec 2013 10:43:38 -0500
f0633d
Subject: [PATCH 043/109] fdo#69518: Correctly handle the old constraint
f0633d
 syntax.
f0633d
f0633d
We apparently support this syntax for ODF-backward compatibility.
f0633d
f0633d
To fix this, I resurrected ScDPObject::ParseFilters() which was removed as
f0633d
unused, adjusted it for the String->OUString change, and changed the filter
f0633d
data structure to the UNO one rather than using the old one we no longer use
f0633d
elsewhere.
f0633d
f0633d
(cherry picked from commit 1d85c8df2fb9cb25fc524485339ae9f11e8da676)
f0633d
f0633d
Conflicts:
f0633d
	sc/inc/dpobject.hxx
f0633d
	sc/source/core/data/dpobject.cxx
f0633d
	sc/source/core/tool/interpr2.cxx
f0633d
f0633d
Change-Id: If52b38aaa1e8b208fb0ef9d92a6e853decdf43e3
f0633d
Reviewed-on: https://gerrit.libreoffice.org/6962
f0633d
Reviewed-by: Eike Rathke <erack@redhat.com>
f0633d
Tested-by: Eike Rathke <erack@redhat.com>
f0633d
---
f0633d
 sc/inc/dpobject.hxx              |   8 +-
f0633d
 sc/inc/dpoutput.hxx              |  21 -----
f0633d
 sc/source/core/data/dpobject.cxx | 163 ++++++++++++++++++++-------------------
f0633d
 sc/source/core/tool/interpr2.cxx |  15 ++++
f0633d
 4 files changed, 103 insertions(+), 104 deletions(-)
f0633d
f0633d
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
f0633d
index 735b033..8505a53 100644
f0633d
--- a/sc/inc/dpobject.hxx
f0633d
+++ b/sc/inc/dpobject.hxx
f0633d
@@ -183,9 +183,11 @@ public:
f0633d
         const OUString& rDataFieldName,
f0633d
         std::vector<com::sun::star::sheet::DataPilotFieldFilter>& rFilters);
f0633d
 
f0633d
-    bool                ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
-                                      std::vector< ScDPGetPivotDataField >& rFilters,
f0633d
-                                      const OUString& rFilterList );
f0633d
+    bool ParseFilters(
f0633d
+        OUString& rDataFieldName,
f0633d
+        std::vector<com::sun::star::sheet::DataPilotFieldFilter>& rFilters,
f0633d
+        std::vector<com::sun::star::sheet::GeneralFunction>& rFilterFuncs,
f0633d
+        const OUString& rFilterList );
f0633d
 
f0633d
     void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
f0633d
 
f0633d
diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx
f0633d
index 293d937..7b38c7e 100644
f0633d
--- a/sc/inc/dpoutput.hxx
f0633d
+++ b/sc/inc/dpoutput.hxx
f0633d
@@ -41,29 +41,8 @@ namespace com { namespace sun { namespace star { namespace sheet {
f0633d
 
f0633d
 class Rectangle;
f0633d
 class ScDocument;
f0633d
-
f0633d
 struct ScDPOutLevelData;
f0633d
 
f0633d
-
f0633d
-struct ScDPGetPivotDataField
f0633d
-{
f0633d
-    OUString maFieldName;
f0633d
-    com::sun::star::sheet::GeneralFunction meFunction;
f0633d
-
f0633d
-    bool   mbValIsStr;
f0633d
-    OUString maValStr;
f0633d
-    double mnValNum;
f0633d
-
f0633d
-        ScDPGetPivotDataField() :
f0633d
-            meFunction( com::sun::star::sheet::GeneralFunction_NONE ),
f0633d
-            mbValIsStr( false ),
f0633d
-            mnValNum( 0.0 )
f0633d
-        {
f0633d
-        }
f0633d
-};
f0633d
-
f0633d
-
f0633d
-
f0633d
 class ScDPOutput
f0633d
 {
f0633d
 private:
f0633d
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
f0633d
index 3a45a34..677ccd5 100644
f0633d
--- a/sc/source/core/data/dpobject.cxx
f0633d
+++ b/sc/source/core/data/dpobject.cxx
f0633d
@@ -1400,25 +1400,27 @@ void ScDPObject::GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimensi
f0633d
     pOutput->GetMemberResultNames(rNames, nDimension);    // used only with table data -> level not needed
f0633d
 }
f0633d
 
f0633d
-static bool lcl_Dequote( const String& rSource, xub_StrLen nStartPos, xub_StrLen& rEndPos, String& rResult )
f0633d
+namespace {
f0633d
+
f0633d
+bool dequote( const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, OUString& rResult )
f0633d
 {
f0633d
     // nStartPos has to point to opening quote
f0633d
 
f0633d
     bool bRet = false;
f0633d
     const sal_Unicode cQuote = '\'';
f0633d
 
f0633d
-    if ( rSource.GetChar(nStartPos) == cQuote )
f0633d
+    if (rSource[nStartPos] == cQuote)
f0633d
     {
f0633d
         OUStringBuffer aBuffer;
f0633d
-        xub_StrLen nPos = nStartPos + 1;
f0633d
-        const xub_StrLen nLen = rSource.Len();
f0633d
+        sal_Int32 nPos = nStartPos + 1;
f0633d
+        const sal_Int32 nLen = rSource.getLength();
f0633d
 
f0633d
         while ( nPos < nLen )
f0633d
         {
f0633d
-            const sal_Unicode cNext = rSource.GetChar(nPos);
f0633d
+            const sal_Unicode cNext = rSource[nPos];
f0633d
             if ( cNext == cQuote )
f0633d
             {
f0633d
-                if ( nPos+1 < nLen && rSource.GetChar(nPos+1) == cQuote )
f0633d
+                if (nPos+1 < nLen && rSource[nPos+1] == cQuote)
f0633d
                 {
f0633d
                     // double quote is used for an embedded quote
f0633d
                     aBuffer.append( cNext );    // append one quote
f0633d
@@ -1449,7 +1451,7 @@ struct ScGetPivotDataFunctionEntry
f0633d
     sheet::GeneralFunction  eFunc;
f0633d
 };
f0633d
 
f0633d
-static bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_StrLen& rEndPos, sheet::GeneralFunction& rFunc )
f0633d
+bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sheet::GeneralFunction& rFunc )
f0633d
 {
f0633d
     static const ScGetPivotDataFunctionEntry aFunctions[] =
f0633d
     {
f0633d
@@ -1471,22 +1473,22 @@ static bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_St
f0633d
         { "StdDevp",    sheet::GeneralFunction_STDEVP    }
f0633d
     };
f0633d
 
f0633d
-    const xub_StrLen nListLen = rList.Len();
f0633d
-    while ( nStartPos < nListLen && rList.GetChar(nStartPos) == ' ' )
f0633d
+    const sal_Int32 nListLen = rList.getLength();
f0633d
+    while (nStartPos < nListLen && rList[nStartPos] == ' ')
f0633d
         ++nStartPos;
f0633d
 
f0633d
     bool bParsed = false;
f0633d
     bool bFound = false;
f0633d
-    String aFuncStr;
f0633d
-    xub_StrLen nFuncEnd = 0;
f0633d
-    if ( nStartPos < nListLen && rList.GetChar(nStartPos) == '\'' )
f0633d
-        bParsed = lcl_Dequote( rList, nStartPos, nFuncEnd, aFuncStr );
f0633d
+    OUString aFuncStr;
f0633d
+    sal_Int32 nFuncEnd = 0;
f0633d
+    if (nStartPos < nListLen && rList[nStartPos] == '\'')
f0633d
+        bParsed = dequote( rList, nStartPos, nFuncEnd, aFuncStr );
f0633d
     else
f0633d
     {
f0633d
-        nFuncEnd = rList.Search( static_cast<sal_Unicode>(']'), nStartPos );
f0633d
-        if ( nFuncEnd != STRING_NOTFOUND )
f0633d
+        nFuncEnd = rList.indexOf(']', nStartPos);
f0633d
+        if (nFuncEnd >= 0)
f0633d
         {
f0633d
-            aFuncStr = rList.Copy( nStartPos, nFuncEnd - nStartPos );
f0633d
+            aFuncStr = rList.copy(nStartPos, nFuncEnd - nStartPos);
f0633d
             bParsed = true;
f0633d
         }
f0633d
     }
f0633d
@@ -1498,12 +1500,12 @@ static bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_St
f0633d
         const sal_Int32 nFuncCount = sizeof(aFunctions) / sizeof(aFunctions[0]);
f0633d
         for ( sal_Int32 nFunc=0; nFunc
f0633d
         {
f0633d
-            if ( aFuncStr.EqualsIgnoreCaseAscii( aFunctions[nFunc].pName ) )
f0633d
+           if (aFuncStr.equalsIgnoreAsciiCaseAscii(aFunctions[nFunc].pName))
f0633d
             {
f0633d
                 rFunc = aFunctions[nFunc].eFunc;
f0633d
                 bFound = true;
f0633d
 
f0633d
-                while ( nFuncEnd < nListLen && rList.GetChar(nFuncEnd) == ' ' )
f0633d
+                while (nFuncEnd < nListLen && rList[nFuncEnd] == ' ')
f0633d
                     ++nFuncEnd;
f0633d
                 rEndPos = nFuncEnd;
f0633d
             }
f0633d
@@ -1513,48 +1515,49 @@ static bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_St
f0633d
     return bFound;
f0633d
 }
f0633d
 
f0633d
-static bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatched,
f0633d
-                    bool bAllowBracket, sheet::GeneralFunction* pFunc )
f0633d
+bool isAtStart(
f0633d
+    const OUString& rList, const OUString& rSearch, sal_Int32& rMatched,
f0633d
+    bool bAllowBracket, sheet::GeneralFunction* pFunc )
f0633d
 {
f0633d
     sal_Int32 nMatchList = 0;
f0633d
     sal_Int32 nMatchSearch = 0;
f0633d
-    sal_Unicode cFirst = rList.GetChar(0);
f0633d
+    sal_Unicode cFirst = rList[0];
f0633d
     if ( cFirst == '\'' || cFirst == '[' )
f0633d
     {
f0633d
         // quoted string or string in brackets must match completely
f0633d
 
f0633d
-        String aDequoted;
f0633d
-        xub_StrLen nQuoteEnd = 0;
f0633d
+        OUString aDequoted;
f0633d
+        sal_Int32 nQuoteEnd = 0;
f0633d
         bool bParsed = false;
f0633d
 
f0633d
         if ( cFirst == '\'' )
f0633d
-            bParsed = lcl_Dequote( rList, 0, nQuoteEnd, aDequoted );
f0633d
+            bParsed = dequote( rList, 0, nQuoteEnd, aDequoted );
f0633d
         else if ( cFirst == '[' )
f0633d
         {
f0633d
             // skip spaces after the opening bracket
f0633d
 
f0633d
-            xub_StrLen nStartPos = 1;
f0633d
-            const xub_StrLen nListLen = rList.Len();
f0633d
-            while ( nStartPos < nListLen && rList.GetChar(nStartPos) == ' ' )
f0633d
+            sal_Int32 nStartPos = 1;
f0633d
+            const sal_Int32 nListLen = rList.getLength();
f0633d
+            while (nStartPos < nListLen && rList[nStartPos] == ' ')
f0633d
                 ++nStartPos;
f0633d
 
f0633d
-            if ( rList.GetChar(nStartPos) == '\'' )         // quoted within the brackets?
f0633d
+            if (nStartPos < nListLen && rList[nStartPos] == '\'')         // quoted within the brackets?
f0633d
             {
f0633d
-                if ( lcl_Dequote( rList, nStartPos, nQuoteEnd, aDequoted ) )
f0633d
+                if ( dequote( rList, nStartPos, nQuoteEnd, aDequoted ) )
f0633d
                 {
f0633d
                     // after the quoted string, there must be the closing bracket, optionally preceded by spaces,
f0633d
                     // and/or a function name
f0633d
-                    while ( nQuoteEnd < nListLen && rList.GetChar(nQuoteEnd) == ' ' )
f0633d
+                    while (nQuoteEnd < nListLen && rList[nQuoteEnd] == ' ')
f0633d
                         ++nQuoteEnd;
f0633d
 
f0633d
                     // semicolon separates function name
f0633d
-                    if ( nQuoteEnd < nListLen && rList.GetChar(nQuoteEnd) == ';' && pFunc )
f0633d
+                    if (nQuoteEnd < nListLen && rList[nQuoteEnd] == ';' && pFunc)
f0633d
                     {
f0633d
-                        xub_StrLen nFuncEnd = 0;
f0633d
-                        if ( lcl_ParseFunction( rList, nQuoteEnd + 1, nFuncEnd, *pFunc ) )
f0633d
+                        sal_Int32 nFuncEnd = 0;
f0633d
+                        if ( parseFunction( rList, nQuoteEnd + 1, nFuncEnd, *pFunc ) )
f0633d
                             nQuoteEnd = nFuncEnd;
f0633d
                     }
f0633d
-                    if ( nQuoteEnd < nListLen && rList.GetChar(nQuoteEnd) == ']' )
f0633d
+                    if (nQuoteEnd < nListLen && rList[nQuoteEnd] == ']')
f0633d
                     {
f0633d
                         ++nQuoteEnd;        // include the closing bracket for the matched length
f0633d
                         bParsed = true;
f0633d
@@ -1565,19 +1568,19 @@ static bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32
f0633d
             {
f0633d
                 // implicit quoting to the closing bracket
f0633d
 
f0633d
-                xub_StrLen nClosePos = rList.Search( static_cast<sal_Unicode>(']'), nStartPos );
f0633d
-                if ( nClosePos != STRING_NOTFOUND )
f0633d
+                sal_Int32 nClosePos = rList.indexOf(']', nStartPos);
f0633d
+                if (nClosePos >= 0)
f0633d
                 {
f0633d
-                    xub_StrLen nNameEnd = nClosePos;
f0633d
-                    xub_StrLen nSemiPos = rList.Search( static_cast<sal_Unicode>(';'), nStartPos );
f0633d
-                    if ( nSemiPos != STRING_NOTFOUND && nSemiPos < nClosePos && pFunc )
f0633d
+                    sal_Int32 nNameEnd = nClosePos;
f0633d
+                    sal_Int32 nSemiPos = rList.indexOf(';', nStartPos);
f0633d
+                    if (nSemiPos >= 0 && nSemiPos < nClosePos && pFunc)
f0633d
                     {
f0633d
-                        xub_StrLen nFuncEnd = 0;
f0633d
-                        if ( lcl_ParseFunction( rList, nSemiPos + 1, nFuncEnd, *pFunc ) )
f0633d
+                        sal_Int32 nFuncEnd = 0;
f0633d
+                        if (parseFunction(rList, nSemiPos+1, nFuncEnd, *pFunc))
f0633d
                             nNameEnd = nSemiPos;
f0633d
                     }
f0633d
 
f0633d
-                    aDequoted = rList.Copy( nStartPos, nNameEnd - nStartPos );
f0633d
+                    aDequoted = rList.copy(nStartPos, nNameEnd - nStartPos);
f0633d
                     // spaces before the closing bracket or semicolon
f0633d
                     aDequoted = comphelper::string::stripEnd(aDequoted, ' ');
f0633d
                     nQuoteEnd = nClosePos + 1;
f0633d
@@ -1589,26 +1592,26 @@ static bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32
f0633d
         if ( bParsed && ScGlobal::GetpTransliteration()->isEqual( aDequoted, rSearch ) )
f0633d
         {
f0633d
             nMatchList = nQuoteEnd;             // match count in the list string, including quotes
f0633d
-            nMatchSearch = rSearch.Len();
f0633d
+            nMatchSearch = rSearch.getLength();
f0633d
         }
f0633d
     }
f0633d
     else
f0633d
     {
f0633d
         // otherwise look for search string at the start of rList
f0633d
-        ScGlobal::GetpTransliteration()->equals( rList, 0, rList.Len(), nMatchList,
f0633d
-                                            rSearch, 0, rSearch.Len(), nMatchSearch );
f0633d
+        ScGlobal::GetpTransliteration()->equals(
f0633d
+            rList, 0, rList.getLength(), nMatchList, rSearch, 0, rSearch.getLength(), nMatchSearch);
f0633d
     }
f0633d
 
f0633d
-    if ( nMatchSearch == rSearch.Len() )
f0633d
+    if (nMatchSearch == rSearch.getLength())
f0633d
     {
f0633d
         // search string is at start of rList - look for following space or end of string
f0633d
 
f0633d
         bool bValid = false;
f0633d
-        if ( sal::static_int_cast<xub_StrLen>(nMatchList) >= rList.Len() )
f0633d
+        if ( sal::static_int_cast<sal_Int32>(nMatchList) >= rList.getLength() )
f0633d
             bValid = true;
f0633d
         else
f0633d
         {
f0633d
-            sal_Unicode cNext = rList.GetChar(sal::static_int_cast<xub_StrLen>(nMatchList));
f0633d
+            sal_Unicode cNext = rList[nMatchList];
f0633d
             if ( cNext == ' ' || ( bAllowBracket && cNext == '[' ) )
f0633d
                 bValid = true;
f0633d
         }
f0633d
@@ -1623,17 +1626,20 @@ static bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32
f0633d
     return false;
f0633d
 }
f0633d
 
f0633d
-bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
-                               std::vector< ScDPGetPivotDataField >& rFilters,
f0633d
-                               const OUString& rFilterList )
f0633d
+} // anonymous namespace
f0633d
+
f0633d
+bool ScDPObject::ParseFilters(
f0633d
+    OUString& rDataFieldName,
f0633d
+    std::vector<sheet::DataPilotFieldFilter>& rFilters,
f0633d
+    std::vector<sheet::GeneralFunction>& rFilterFuncs, const OUString& rFilterList )
f0633d
 {
f0633d
     // parse the string rFilterList into parameters for GetPivotData
f0633d
 
f0633d
     CreateObjects();            // create xSource if not already done
f0633d
 
f0633d
-    std::vector<String> aDataNames;     // data fields (source name)
f0633d
-    std::vector<String> aGivenNames;    // data fields (compound name)
f0633d
-    std::vector<String> aFieldNames;    // column/row/data fields
f0633d
+    std::vector<OUString> aDataNames;     // data fields (source name)
f0633d
+    std::vector<OUString> aGivenNames;    // data fields (compound name)
f0633d
+    std::vector<OUString> aFieldNames;    // column/row/data fields
f0633d
     std::vector< uno::Sequence<OUString> > aFieldValues;
f0633d
 
f0633d
     //
f0633d
@@ -1691,7 +1697,7 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
                         {
f0633d
                             uno::Reference<container::XNameAccess> xMembers = xLevSupp->getMembers();
f0633d
 
f0633d
-                            String aFieldName( xLevNam->getName() );
f0633d
+                            OUString aFieldName( xLevNam->getName() );
f0633d
                             uno::Sequence<OUString> aMemberNames( xMembers->getElementNames() );
f0633d
 
f0633d
                             aFieldNames.push_back( aFieldName );
f0633d
@@ -1713,8 +1719,8 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
 
f0633d
     bool bError = false;
f0633d
     bool bHasData = false;
f0633d
-    String aRemaining(comphelper::string::strip(rFilterList, ' '));
f0633d
-    while ( aRemaining.Len() && !bError )
f0633d
+    OUString aRemaining(comphelper::string::strip(rFilterList, ' '));
f0633d
+    while (!aRemaining.isEmpty() && !bError)
f0633d
     {
f0633d
         bool bUsed = false;
f0633d
 
f0633d
@@ -1722,17 +1728,17 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
 
f0633d
         for ( SCSIZE nDataPos=0; nDataPos
f0633d
         {
f0633d
-            String aFound;
f0633d
+            OUString aFound;
f0633d
             sal_Int32 nMatched = 0;
f0633d
-            if ( lcl_IsAtStart( aRemaining, aDataNames[nDataPos], nMatched, false, NULL ) )
f0633d
+            if (isAtStart(aRemaining, aDataNames[nDataPos], nMatched, false, NULL))
f0633d
                 aFound = aDataNames[nDataPos];
f0633d
-            else if ( lcl_IsAtStart( aRemaining, aGivenNames[nDataPos], nMatched, false, NULL ) )
f0633d
+            else if (isAtStart(aRemaining, aGivenNames[nDataPos], nMatched, false, NULL))
f0633d
                 aFound = aGivenNames[nDataPos];
f0633d
 
f0633d
-            if ( aFound.Len() )
f0633d
+            if (!aFound.isEmpty())
f0633d
             {
f0633d
-                rTarget.maFieldName = aFound;
f0633d
-                aRemaining.Erase( 0, sal::static_int_cast<xub_StrLen>(nMatched) );
f0633d
+                rDataFieldName = aFound;
f0633d
+                aRemaining = aRemaining.copy(nMatched);
f0633d
                 bHasData = true;
f0633d
                 bUsed = true;
f0633d
             }
f0633d
@@ -1740,21 +1746,21 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
 
f0633d
         // look for field name
f0633d
 
f0633d
-        String aSpecField;
f0633d
+        OUString aSpecField;
f0633d
         bool bHasFieldName = false;
f0633d
         if ( !bUsed )
f0633d
         {
f0633d
             sal_Int32 nMatched = 0;
f0633d
             for ( SCSIZE nField=0; nField
f0633d
             {
f0633d
-                if ( lcl_IsAtStart( aRemaining, aFieldNames[nField], nMatched, true, NULL ) )
f0633d
+                if (isAtStart(aRemaining, aFieldNames[nField], nMatched, true, NULL))
f0633d
                 {
f0633d
                     aSpecField = aFieldNames[nField];
f0633d
-                    aRemaining.Erase( 0, sal::static_int_cast<xub_StrLen>(nMatched) );
f0633d
+                    aRemaining = aRemaining.copy(nMatched);
f0633d
                     aRemaining = comphelper::string::stripStart(aRemaining, ' ');
f0633d
 
f0633d
                     // field name has to be followed by item name in brackets
f0633d
-                    if ( aRemaining.GetChar(0) == '[' )
f0633d
+                    if (!aRemaining.isEmpty() && aRemaining[0] == '[')
f0633d
                     {
f0633d
                         bHasFieldName = true;
f0633d
                         // bUsed remains false - still need the item
f0633d
@@ -1774,8 +1780,8 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
         {
f0633d
             bool bItemFound = false;
f0633d
             sal_Int32 nMatched = 0;
f0633d
-            String aFoundName;
f0633d
-            String aFoundValue;
f0633d
+            OUString aFoundName;
f0633d
+            OUString aFoundValue;
f0633d
             sheet::GeneralFunction eFunc = sheet::GeneralFunction_NONE;
f0633d
             sheet::GeneralFunction eFoundFunc = sheet::GeneralFunction_NONE;
f0633d
 
f0633d
@@ -1790,7 +1796,7 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
                     const OUString* pItemArr = rItems.getConstArray();
f0633d
                     for ( sal_Int32 nItem=0; nItem
f0633d
                     {
f0633d
-                        if ( lcl_IsAtStart( aRemaining, pItemArr[nItem], nMatched, false, &eFunc ) )
f0633d
+                        if ( isAtStart( aRemaining, pItemArr[nItem], nMatched, false, &eFunc ) )
f0633d
                         {
f0633d
                             if ( bItemFound )
f0633d
                                 bError = true;      // duplicate (also across fields)
f0633d
@@ -1809,15 +1815,12 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
 
f0633d
             if ( bItemFound && !bError )
f0633d
             {
f0633d
-                ScDPGetPivotDataField aField;
f0633d
-                aField.maFieldName = aFoundName;
f0633d
-                aField.meFunction = eFoundFunc;
f0633d
-                aField.mbValIsStr = true;
f0633d
-                aField.maValStr = aFoundValue;
f0633d
-                aField.mnValNum = 0.0;
f0633d
-                rFilters.push_back( aField );
f0633d
-
f0633d
-                aRemaining.Erase( 0, sal::static_int_cast<xub_StrLen>(nMatched) );
f0633d
+                sheet::DataPilotFieldFilter aField;
f0633d
+                aField.FieldName = aFoundName;
f0633d
+                aField.MatchValue = aFoundValue;
f0633d
+                rFilters.push_back(aField);
f0633d
+                rFilterFuncs.push_back(eFoundFunc);
f0633d
+                aRemaining = aRemaining.copy(nMatched);
f0633d
             }
f0633d
         }
f0633d
 
f0633d
@@ -1831,7 +1834,7 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget,
f0633d
     if ( !bError && !bHasData && aDataNames.size() == 1 )
f0633d
     {
f0633d
         // if there's only one data field, its name need not be specified
f0633d
-        rTarget.maFieldName = aDataNames[0];
f0633d
+        rDataFieldName = aDataNames[0];
f0633d
         bHasData = true;
f0633d
     }
f0633d
 
f0633d
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
f0633d
index 7cc59de..a0f270d 100644
f0633d
--- a/sc/source/core/tool/interpr2.cxx
f0633d
+++ b/sc/source/core/tool/interpr2.cxx
f0633d
@@ -3005,6 +3005,21 @@ void ScInterpreter::ScGetPivotData()
f0633d
         return;
f0633d
     }
f0633d
 
f0633d
+    if (bOldSyntax)
f0633d
+    {
f0633d
+        OUString aFilterStr = aDataFieldName;
f0633d
+        std::vector<sheet::GeneralFunction> aFilterFuncs;
f0633d
+        if (!pDPObj->ParseFilters(aDataFieldName, aFilters, aFilterFuncs, aFilterStr))
f0633d
+        {
f0633d
+            PushError(errNoRef);
f0633d
+            return;
f0633d
+        }
f0633d
+
f0633d
+        // TODO : For now, we ignore filter functions since we couldn't find a
f0633d
+        // live example of how they are supposed to be used. We'll support
f0633d
+        // this again once we come across a real-world example.
f0633d
+    }
f0633d
+
f0633d
     double fVal = pDPObj->GetPivotData(aDataFieldName, aFilters);
f0633d
     if (rtl::math::isNan(fVal))
f0633d
     {
f0633d
-- 
f0633d
1.8.4.2
f0633d