[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source include/formula sc/inc sc/source
formula/source/core/api/FormulaCompiler.cxx | 48 ++-- include/formula/FormulaCompiler.hxx | 29 +++- sc/inc/compiler.hxx |2 + sc/source/core/inc/interpre.hxx |4 +- sc/source/core/tool/compiler.cxx|8 sc/source/core/tool/interpr4.cxx|2 - sc/source/core/tool/token.cxx |2 - 7 files changed, 81 insertions(+), 14 deletions(-) New commits: commit 7ffceb55db60ab2cd5899b2a80583b5fb94bebcf Author: Eike RathkeDate: Mon Nov 16 12:23:15 2015 +0100 Resolves: tdf#95670 propagate ForceArray per parameter Regression of b5cd11b4b02a85a83db77ba9d8d1763f0cd88cb1 It was always wrong to propagate ForceArray already if a function had a ForceArray parameter *somewhere*, we need to do this per parameter instead. (cherry picked from commit 49257e1da7e371fdea0fac080116b0511789cac7) Conflicts: formula/source/core/api/FormulaCompiler.cxx prevent ForceArray propagation on the same token, tdf#95670 follow-up This may happen if the last RPN token is put and the function has a ForceArray parameter but now again would be wrong if not all parameters are ForceArray. (cherry picked from commit b31b17e52b2b2b94999d68c4b2ed5c74ee7eed0a) 890fb6b5b88337033cfcf2e8189371ee39461205 Conflicts: sc/source/core/inc/interpre.hxx -Werror,-Winconsistent-missing-override (cherry picked from commit 6edc492efd6fe2de15c1ae306b400ca054772ad1) Backported to SAL_OVERRIDE 3bb2764b625d44f6e0cecbdde3363440faef63b5 Change-Id: If188d45366279d9a7bf641edc7e4dd7095d6d035 Reviewed-on: https://gerrit.libreoffice.org/19997 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 5cb40fc..6b28048 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -527,6 +527,7 @@ void FormulaCompiler::OpCodeMap::putOpCode( const OUString & rStr, const OpCode FormulaCompiler::FormulaCompiler( FormulaTokenArray& rArr ) : +nCurrentFactorParam(0), pArr( ), pCode( NULL ), pStack( NULL ), @@ -545,6 +546,7 @@ FormulaCompiler::FormulaCompiler( FormulaTokenArray& rArr ) FormulaCompiler::FormulaCompiler() : +nCurrentFactorParam(0), pArr( NULL ), pCode( NULL ), pStack( NULL ), @@ -1165,6 +1167,7 @@ void FormulaCompiler::Factor() { // range list (A1;A2) converted to (A1~A2) pFacToken = mpToken; NextToken(); +CheckSetForceArrayParameter( mpToken, 0); eOp = Expression(); // Do not ignore error here, regardless of bIgnoreErrors, otherwise // errors like =(1;) would also result in display of =(1~) @@ -1250,6 +1253,7 @@ void FormulaCompiler::Factor() if (eOp == ocOpen) { NextToken(); +CheckSetForceArrayParameter( mpToken, 0); eOp = Expression(); } else @@ -1281,7 +1285,10 @@ void FormulaCompiler::Factor() if (eOp == ocClose) bNoParam = true; else +{ +CheckSetForceArrayParameter( mpToken, 0); eOp = Expression(); +} } else if (eMyLastOp == ocBad) { @@ -1298,8 +1305,9 @@ void FormulaCompiler::Factor() nSepCount++; while ((eOp == ocSep) && (!pArr->GetCodeError() || !mbStopOnError)) { -nSepCount++; NextToken(); +CheckSetForceArrayParameter( mpToken, nSepCount); +nSepCount++; eOp = Expression(); } } @@ -1339,6 +1347,7 @@ void FormulaCompiler::Factor() if (eOp == ocOpen) { NextToken(); +CheckSetForceArrayParameter( mpToken, 0); eOp = Expression(); } else @@ -1373,6 +1382,7 @@ void FormulaCompiler::Factor() if ( ++nJumpCount <= nJumpMax ) pFacToken->GetJump()[nJumpCount] = pc-1; NextToken(); +CheckSetForceArrayParameter( mpToken, nJumpCount - 1); eOp = Expression(); // ocSep or ocClose terminate the subexpression PutCode( mpToken ); @@ -2082,7 +2092,7 @@ void FormulaCompiler::PutCode( FormulaTokenRef& p ) } if (pArr->GetCodeError() && mbJumpCommandReorder) return; -
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source include/formula sc/inc sc/source
formula/source/ui/dlg/FormulaHelper.cxx |4 +--- include/formula/IFunctionDescription.hxx |5 +++-- sc/inc/funcdesc.hxx | 10 ++ sc/source/core/data/funcdesc.cxx |7 --- 4 files changed, 14 insertions(+), 12 deletions(-) New commits: commit 4e3d54fc9542af87d718b24bcd76a0529133f45f Author: Caolán McNamara caol...@redhat.com Date: Thu Jun 11 16:52:09 2015 +0100 Resolves: tdf#89643 report builder function wizard segfaults regression from commit 3d6521280929ecacc53b7c358d29d0b5d31b3462 CommitDate: Thu Jul 31 22:14:25 2014 +0200 fix memory leak around function descriptions Found by Lsan. There are two implementations of getCategory, one (sc) returns a new one each time (hence the leak fix) and the other (reportdesign) returns a pointer to one that belongs to the manger (hence the crash). The code in formula really looks to me to expect that the getCategory return a pointer that someone else needs to look after, i.e. the reportdesign variant is the more correct so revert 3d6521280929ecacc53b7c358d29d0b5d31b3462 and to fix the leak make the sc own the ScFunctionCategories and just cache them like the reportdesign one does Change-Id: Ifd986301a54b4d20449e864697655cd973e0c4df (cherry picked from commit 7c3abee29c742593206b755b20a718c46f0780fa) (cherry picked from commit 73107eb3375f1671f549f0467be2812df9223848) Reviewed-on: https://gerrit.libreoffice.org/16232 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx index c644856..ab1baa6 100644 --- a/formula/source/ui/dlg/FormulaHelper.cxx +++ b/formula/source/ui/dlg/FormulaHelper.cxx @@ -23,8 +23,6 @@ #include unotools/charclass.hxx #include unotools/syslocale.hxx -#include boost/scoped_ptr.hpp - namespace formula { @@ -95,7 +93,7 @@ bool FormulaHelper::GetNextFunc( const OUString rFormula, const sal_uInt32 nCategoryCount = m_pFunctionManager-getCount(); for(sal_uInt32 j= 0; j nCategoryCount !*ppFDesc; ++j) { -boost::scoped_ptrconst IFunctionCategory pCategory(m_pFunctionManager-getCategory(j)); +const IFunctionCategory* pCategory = m_pFunctionManager-getCategory(j); const sal_uInt32 nCount = pCategory-getCount(); for(sal_uInt32 i = 0 ; i nCount; ++i) { diff --git a/include/formula/IFunctionDescription.hxx b/include/formula/IFunctionDescription.hxx index 1b37d51..85f42aa 100644 --- a/include/formula/IFunctionDescription.hxx +++ b/include/formula/IFunctionDescription.hxx @@ -60,7 +60,7 @@ namespace formula ~IFunctionManager() {} }; -class IFunctionCategory +class SAL_NO_VTABLE IFunctionCategory { public: IFunctionCategory(){} @@ -70,7 +70,8 @@ namespace formula virtual sal_uInt32 getNumber() const = 0; virtual OUString getName() const = 0; -virtual ~IFunctionCategory() {} +protected: +~IFunctionCategory() {} }; class SAL_NO_VTABLE IFunctionDescription diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx index e746462..43e4101 100644 --- a/sc/inc/funcdesc.hxx +++ b/sc/inc/funcdesc.hxx @@ -27,6 +27,7 @@ #include formula/IFunctionDescription.hxx #include sal/types.h #include rtl/ustring.hxx +#include map #define MAX_FUNCCAT 12 /* maximum number of categories for functions */ #define LRU_MAX 10 /* maximal number of last recently used functions */ @@ -361,7 +362,7 @@ public: /** Returns a category. - Creates an IFunctionCategory object from a category specified by nPos. + Returns an IFunctionCategory object for a category specified by nPos. @param nPos the index of the category, note that 0 maps to the first category not the cumulative ('All') category. @@ -399,9 +400,10 @@ public: private: ScFunctionList* pFuncList; /** list of all calc functions */ -::std::vectorconst ScFuncDesc** aCatLists[MAX_FUNCCAT]; /** array of all categories, 0 is the cumulative ('All') category */ -mutable ::std::vectorconst ScFuncDesc*::iterator pCurCatListIter; /** position in current category */ -mutable ::std::vectorconst ScFuncDesc*::iterator pCurCatListEnd; /** end of current category */ +std::vectorconst ScFuncDesc** aCatLists[MAX_FUNCCAT]; /** array of all categories, 0 is the cumulative ('All') category */ +mutable std::map sal_uInt32, std::shared_ptrScFunctionCategory m_aCategories; /** map of category pos to IFunctionCategory */ +mutable std::vectorconst ScFuncDesc*::iterator pCurCatListIter; /** position in current category */ +mutable std::vectorconst ScFuncDesc*::iterator pCurCatListEnd; /** end of current
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source
formula/source/ui/dlg/FormulaHelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 121a2c44c90004300b41bee1492c614dc0fe57aa Author: Eike Rathke er...@redhat.com Date: Wed Apr 29 18:57:16 2015 +0200 string access out of bounds This convoluted logic may pass FUNC_NOTFOUND -1 as position around if there was no initial function. Change-Id: I217fc745d8e0b8e532642d0f69110371d183610d (cherry picked from commit d6635af3186314de0c20a904b36e50bba4ae63cd) Reviewed-on: https://gerrit.libreoffice.org/15570 Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx index 9d9bda1..c644856 100644 --- a/formula/source/ui/dlg/FormulaHelper.cxx +++ b/formula/source/ui/dlg/FormulaHelper.cxx @@ -229,7 +229,7 @@ sal_Int32 FormulaHelper::GetFunctionStart( const OUString rFormula, } else { -while ( !bFound (nParPos nStrLen) ) +while ( !bFound (0 = nParPos nParPos nStrLen) ) { if ( rFormula[nParPos] == '' ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source
formula/source/ui/dlg/FormulaHelper.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit d63406ec35ce3d22b8f3e78b46c46dd71b6b91e4 Author: Eike Rathke er...@redhat.com Date: Mon Mar 30 21:29:46 2015 +0200 Resolves: tdf#90301 string access out of bounds Apparently yet another leftover of UniString to OUString conversion where with UniString out-of-bounds accesses didn't harm and returned NIL. (cherry picked from commit eed393039a9067f7a1a318934ff1c5ff90bfe443) Include algorithm for std::min() (cherry picked from commit 3394ac816a573030feda145dbdabd2a1eabd78c4) 13ed47d23ed4b94501d944d99ce08af94698 Change-Id: Id88456a52df3fc8cdaf90d9d509e327b96269808 Reviewed-on: https://gerrit.libreoffice.org/15074 Tested-by: David Tardon dtar...@redhat.com Reviewed-by: David Tardon dtar...@redhat.com diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx index 6c999bd..9d9bda1 100644 --- a/formula/source/ui/dlg/FormulaHelper.cxx +++ b/formula/source/ui/dlg/FormulaHelper.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include algorithm + #include formula/formulahelper.hxx #include unotools/charclass.hxx #include unotools/syslocale.hxx @@ -201,7 +203,7 @@ sal_Int32 FormulaHelper::GetFunctionStart( const OUString rFormula, return nStart; sal_Int32 nFStart = FUNC_NOTFOUND; -sal_Int32 nParPos = nStart; +sal_Int32 nParPos = bBack ? ::std::min( nStart, nStrLen - 1) : nStart; bool bRepeat, bFound; do ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source include/formula
formula/source/core/api/FormulaCompiler.cxx | 13 - formula/source/core/api/token.cxx | 343 include/formula/tokenarray.hxx | 47 +++ 3 files changed, 299 insertions(+), 104 deletions(-) New commits: commit 1706760769018662a50b494b2e4a0ca85c93ca42 Author: Winfried Donkers winfrieddonk...@libreoffice.org Date: Fri Aug 8 17:39:04 2014 +0200 fdo#81596 export to OOXML that need argument changes Reviewed-on: https://gerrit.libreoffice.org/10831 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com (cherry picked from commit 4feaf96f50fa89eccb4e7a638220099e9a8482f1) sensible indenting, fdo#81596 related (cherry picked from commit 3dd241c52d6db424bd4696ff8f223976542e411b) simplify RewriteMissing() and switch in Add...(), fdo#81596 related (cherry picked from commit 14aabee5a73e57e26b2062b1ebf00c3f1dff1250) write TRUE() for 2nd IF() parameter, fdo#81596 related (cherry picked from commit 8f031861f590ba914321816657a003375d93ef5d) f7eb11a950b45793d04837d02f9546a93673fa2f f2ca37e1fda87ce56282fc2d2fc57a0784851139 52d0b43b19e10bee82109b635b3b7ce4f43650a3 Change-Id: I3a99e416be9f3f04175939e4560f8f7c55497185 Reviewed-on: https://gerrit.libreoffice.org/14388 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 5b2e8ea..5cb40fc 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1742,9 +1742,16 @@ void FormulaCompiler::CreateStringFromTokenArray( OUStringBuffer rBuffer ) if (bODFF || FormulaGrammar::isPODF( meGrammar) ) { // Scan token array for missing args and re-write if present. -MissingConvention aConv( bODFF); -if (pArr-NeedsPofRewrite( aConv)) -pArr = pArr-RewriteMissingToPof( aConv); +MissingConventionODF aConv( bODFF); +if (pArr-NeedsPodfRewrite( aConv)) +pArr = pArr-RewriteMissing( aConv ); +} +else if ( FormulaGrammar::isOOXML( meGrammar ) ) +{ +// Scan token array for missing args and rewrite if present. +MissingConventionOOXML aConv; +if (pArr-NeedsOoxmlRewrite( aConv)) +pArr = pArr-RewriteMissing( aConv ); } // At least one character per token, plus some are references, some are diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 92486dc..a414a4b 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -995,11 +995,9 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps() return false; } +// --- Formula rewrite of a token array - -// --- POF (plain old formula) rewrite of a token array - - -inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const +inline bool MissingConventionODF::isRewriteNeeded( OpCode eOp ) const { switch (eOp) { @@ -1011,7 +1009,62 @@ inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const return true; case ocMissing: case ocLog: -return !isODFF(); // rewrite only for PODF +return isPODF();// rewrite only for PODF +default: +return false; +} +} + +/* + * fdo 81596 +Test status ( . : in progress , v : tested , - not applicable ) +finished: +- ocCosecant: // for OOXML not rewritten anymore +- ocSecant:// for OOXML not rewritten anymore +- ocCot: // for OOXML not rewritten anymore +- ocCosecantHyp: // for OOXML not rewritten anymore +- ocSecantHyp: // for OOXML not rewritten anymore +- ocCotHyp:// for OOXML not rewritten anymore +- ocArcCot:// for OOXML not rewritten anymore +- ocArcCotHyp: // ACOTH(x), not needed for Excel2013 and later +- ocChose: // CHOOSE() - no rewrite needed, it seems +v ocEuroConvert: +v ocIf: +v ocRound: +v ocRoundUp: +v ocRoundDown: +v ocGammaDist: +v ocPoissonDist: +v ocNormDist: +v ocLogNormDist: + +To be implemented yet: + ocExternal:? + ocMacro: ? + ocIndex: INDEX() ? + ocFDist: // later, fdo40835 +*/ +inline bool MissingConventionOOXML::isRewriteNeeded( OpCode eOp ) const +{ +switch (eOp) +{ +case ocIf: + +case ocExternal: +case ocEuroConvert: +case ocMacro: + +case ocRound: +case ocRoundUp: +case ocRoundDown: + +case ocIndex: + +case ocGammaDist: +case ocPoissonDist: +case ocNormDist: +case ocLogNormDist: +return true; default: return false; } @@
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source
formula/source/core/api/FormulaCompiler.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 8d210d109667cdf38bc5d35a596e06dc1f888104 Author: Winfried Donkers winfrieddonk...@libreoffice.org Date: Thu Jan 15 10:35:32 2015 +0100 fdo#87534 fix HYPERLINK behaviour when used in names When using HYPERLINK() in names, the hyperlink was set to disabled on copying token. After fix, behaviour is consistent. Note: reducing the fix to 1 line does not work, a set hyperlink is only to be copied when applicable. Change-Id: I27ad24ed8912afa548f08d249ad51d18a792c275 Reviewed-on: https://gerrit.libreoffice.org/13920 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com (cherry picked from commit 944886f6d96843ca4f5833ecca48a693c81abc3b) Reviewed-on: https://gerrit.libreoffice.org/14448 diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 6c4f617..5b2e8ea 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1715,6 +1715,8 @@ void FormulaCompiler::PopTokenArray() else if ( !pArr-IsRecalcModeNormal() p-pArr-IsRecalcModeNormal() ) p-pArr-SetMaskedRecalcMode( pArr-GetRecalcMode() ); p-pArr-SetCombinedBitsRecalcMode( pArr-GetRecalcMode() ); +if ( pArr-IsHyperLink() ) // fdo 87534 +p-pArr-SetHyperLink( true ); if( p-bTemp ) delete pArr; pArr = p-pArr; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - formula/source
formula/source/core/resource/core_resource.src |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 3d541065fe235de6f1dc3e673082e9a8cda9b328 Author: Andras Timar andras.ti...@collabora.com Date: Wed Dec 10 21:18:27 2014 +0100 fdo#87203 make translatable AGGREGATE function Change-Id: Ic376a4e03cafbba65ec78723de188bd627c0ef4f (cherry picked from commit f6ef20b046c485c89fb25521dec1eb6642aac1ba) diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src index b6816c7..99b387d 100644 --- a/formula/source/core/resource/core_resource.src +++ b/formula/source/core/resource/core_resource.src @@ -2370,7 +2370,7 @@ Resource RID_STRLIST_FUNCTION_NAMES }; String SC_OPCODE_AGGREGATE { -Text = AGGREGATE ; +Text [ en-US ] = AGGREGATE ; }; String SC_OPCODE_T_TEST { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits