sc/source/core/data/dpobject.cxx | 223 --------------------------------------- 1 file changed, 223 deletions(-)
New commits: commit 69cd97277cb843d91bc1d1785b23e8c4c8bf6a33 Author: Thomas Arnhold <tho...@arnhold.org> Date: Thu Sep 5 07:41:05 2013 +0200 WaE: -Werror,-Wunused-function Change-Id: I87f5e5e13470826338030e8b0f08c46e09ac216e diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 3c5f7b2..1594463 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1400,229 +1400,6 @@ void ScDPObject::GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimensi pOutput->GetMemberResultNames(rNames, nDimension); // used only with table data -> level not needed } -static bool lcl_Dequote( const String& rSource, xub_StrLen nStartPos, xub_StrLen& rEndPos, String& rResult ) -{ - // nStartPos has to point to opening quote - - bool bRet = false; - const sal_Unicode cQuote = '\''; - - if ( rSource.GetChar(nStartPos) == cQuote ) - { - OUStringBuffer aBuffer; - xub_StrLen nPos = nStartPos + 1; - const xub_StrLen nLen = rSource.Len(); - - while ( nPos < nLen ) - { - const sal_Unicode cNext = rSource.GetChar(nPos); - if ( cNext == cQuote ) - { - if ( nPos+1 < nLen && rSource.GetChar(nPos+1) == cQuote ) - { - // double quote is used for an embedded quote - aBuffer.append( cNext ); // append one quote - ++nPos; // skip the next one - } - else - { - // end of quoted string - rResult = aBuffer.makeStringAndClear(); - rEndPos = nPos + 1; // behind closing quote - return true; - } - } - else - aBuffer.append( cNext ); - - ++nPos; - } - // no closing quote before the end of the string -> error (bRet still false) - } - - return bRet; -} - -struct ScGetPivotDataFunctionEntry -{ - const sal_Char* pName; - sheet::GeneralFunction eFunc; -}; - -static bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_StrLen& rEndPos, sheet::GeneralFunction& rFunc ) -{ - static const ScGetPivotDataFunctionEntry aFunctions[] = - { - // our names - { "Sum", sheet::GeneralFunction_SUM }, - { "Count", sheet::GeneralFunction_COUNT }, - { "Average", sheet::GeneralFunction_AVERAGE }, - { "Max", sheet::GeneralFunction_MAX }, - { "Min", sheet::GeneralFunction_MIN }, - { "Product", sheet::GeneralFunction_PRODUCT }, - { "CountNums", sheet::GeneralFunction_COUNTNUMS }, - { "StDev", sheet::GeneralFunction_STDEV }, - { "StDevp", sheet::GeneralFunction_STDEVP }, - { "Var", sheet::GeneralFunction_VAR }, - { "VarP", sheet::GeneralFunction_VARP }, - // compatibility names - { "Count Nums", sheet::GeneralFunction_COUNTNUMS }, - { "StdDev", sheet::GeneralFunction_STDEV }, - { "StdDevp", sheet::GeneralFunction_STDEVP } - }; - - const xub_StrLen nListLen = rList.Len(); - while ( nStartPos < nListLen && rList.GetChar(nStartPos) == ' ' ) - ++nStartPos; - - bool bParsed = false; - bool bFound = false; - String aFuncStr; - xub_StrLen nFuncEnd = 0; - if ( nStartPos < nListLen && rList.GetChar(nStartPos) == '\'' ) - bParsed = lcl_Dequote( rList, nStartPos, nFuncEnd, aFuncStr ); - else - { - nFuncEnd = rList.Search( static_cast<sal_Unicode>(']'), nStartPos ); - if ( nFuncEnd != STRING_NOTFOUND ) - { - aFuncStr = rList.Copy( nStartPos, nFuncEnd - nStartPos ); - bParsed = true; - } - } - - if ( bParsed ) - { - aFuncStr = comphelper::string::strip(aFuncStr, ' '); - - const sal_Int32 nFuncCount = sizeof(aFunctions) / sizeof(aFunctions[0]); - for ( sal_Int32 nFunc=0; nFunc<nFuncCount && !bFound; nFunc++ ) - { - if ( aFuncStr.EqualsIgnoreCaseAscii( aFunctions[nFunc].pName ) ) - { - rFunc = aFunctions[nFunc].eFunc; - bFound = true; - - while ( nFuncEnd < nListLen && rList.GetChar(nFuncEnd) == ' ' ) - ++nFuncEnd; - rEndPos = nFuncEnd; - } - } - } - - return bFound; -} - -static bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatched, - bool bAllowBracket, sheet::GeneralFunction* pFunc ) -{ - sal_Int32 nMatchList = 0; - sal_Int32 nMatchSearch = 0; - sal_Unicode cFirst = rList.GetChar(0); - if ( cFirst == '\'' || cFirst == '[' ) - { - // quoted string or string in brackets must match completely - - String aDequoted; - xub_StrLen nQuoteEnd = 0; - bool bParsed = false; - - if ( cFirst == '\'' ) - bParsed = lcl_Dequote( rList, 0, nQuoteEnd, aDequoted ); - else if ( cFirst == '[' ) - { - // skip spaces after the opening bracket - - xub_StrLen nStartPos = 1; - const xub_StrLen nListLen = rList.Len(); - while ( nStartPos < nListLen && rList.GetChar(nStartPos) == ' ' ) - ++nStartPos; - - if ( rList.GetChar(nStartPos) == '\'' ) // quoted within the brackets? - { - if ( lcl_Dequote( rList, nStartPos, nQuoteEnd, aDequoted ) ) - { - // after the quoted string, there must be the closing bracket, optionally preceded by spaces, - // and/or a function name - while ( nQuoteEnd < nListLen && rList.GetChar(nQuoteEnd) == ' ' ) - ++nQuoteEnd; - - // semicolon separates function name - if ( nQuoteEnd < nListLen && rList.GetChar(nQuoteEnd) == ';' && pFunc ) - { - xub_StrLen nFuncEnd = 0; - if ( lcl_ParseFunction( rList, nQuoteEnd + 1, nFuncEnd, *pFunc ) ) - nQuoteEnd = nFuncEnd; - } - if ( nQuoteEnd < nListLen && rList.GetChar(nQuoteEnd) == ']' ) - { - ++nQuoteEnd; // include the closing bracket for the matched length - bParsed = true; - } - } - } - else - { - // implicit quoting to the closing bracket - - xub_StrLen nClosePos = rList.Search( static_cast<sal_Unicode>(']'), nStartPos ); - if ( nClosePos != STRING_NOTFOUND ) - { - xub_StrLen nNameEnd = nClosePos; - xub_StrLen nSemiPos = rList.Search( static_cast<sal_Unicode>(';'), nStartPos ); - if ( nSemiPos != STRING_NOTFOUND && nSemiPos < nClosePos && pFunc ) - { - xub_StrLen nFuncEnd = 0; - if ( lcl_ParseFunction( rList, nSemiPos + 1, nFuncEnd, *pFunc ) ) - nNameEnd = nSemiPos; - } - - aDequoted = rList.Copy( nStartPos, nNameEnd - nStartPos ); - // spaces before the closing bracket or semicolon - aDequoted = comphelper::string::stripEnd(aDequoted, ' '); - nQuoteEnd = nClosePos + 1; - bParsed = true; - } - } - } - - if ( bParsed && ScGlobal::GetpTransliteration()->isEqual( aDequoted, rSearch ) ) - { - nMatchList = nQuoteEnd; // match count in the list string, including quotes - nMatchSearch = rSearch.Len(); - } - } - else - { - // otherwise look for search string at the start of rList - ScGlobal::GetpTransliteration()->equals( rList, 0, rList.Len(), nMatchList, - rSearch, 0, rSearch.Len(), nMatchSearch ); - } - - if ( nMatchSearch == rSearch.Len() ) - { - // search string is at start of rList - look for following space or end of string - - bool bValid = false; - if ( sal::static_int_cast<xub_StrLen>(nMatchList) >= rList.Len() ) - bValid = true; - else - { - sal_Unicode cNext = rList.GetChar(sal::static_int_cast<xub_StrLen>(nMatchList)); - if ( cNext == ' ' || ( bAllowBracket && cNext == '[' ) ) - bValid = true; - } - - if ( bValid ) - { - rMatched = nMatchList; - return true; - } - } - - return false; -} - void ScDPObject::ToggleDetails(const DataPilotTableHeaderData& rElemDesc, ScDPObject* pDestObj) { CreateObjects(); // create xSource if not already done _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits