summaryrefslogtreecommitdiff
path: root/formula
AgeCommit message (Collapse)AuthorFilesLines
2016-04-18clang-tidy performance-unnecessary-copy-initializationNoel Grandin2-5/+2
probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-12Avoid reserved identifierStephan Bergmann1-3/+3
Change-Id: Ie86787cdcf96453c94e6859e66b158d9188f3491
2016-04-11clang-tidy performance-unnecessary-value-param in formulaNoel Grandin1-5/+5
Change-Id: I9f90c55f74216c2f3452e5b30d85b304668330b3
2016-04-04get rid of a TODO commentWinfried Donkers1-1/+1
Checked if the < is correct. It is. Calc function Choose has 1 index argument plus up to 30 value-arguments, so the maximum argument count is 31. FORMULA_MAXJUMPCOUNT is 32. Change-Id: I0bc8cc122902848dadfc92d56b6f06fbec43e4be Reviewed-on: https://gerrit.libreoffice.org/23794 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-03-31use SAL_N_ELEMENTS more widelyNoel Grandin1-4/+4
found using git grep -n 'sizeof.*/.*sizeof.*[0]' Change-Id: Icd4a6cc1ca8ec8ebd68e1701a02789c74cf0eb2a
2016-03-23missing nullptr check, tdf#98427Markus Mohrhard1-1/+1
Change-Id: I657dc0c84eab6ff5b31976fac3317adc0a99dd51
2016-03-18Resolves: tdf#96915 implement other-sheet-local named expressionsEike Rathke1-8/+8
Change-Id: I0d62536caa6eb455473a755067abc585662cd9a5
2016-03-18loplugin:constantparam in formulaNoel Grandin2-17/+10
Change-Id: I3adeed435b62ae60b5d0d4b763dceced5675cd85 Reviewed-on: https://gerrit.libreoffice.org/23330 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-14prefix domain namespace to FORECAST.* functions for ODFF, tdf#94635 follow-upEike Rathke1-8/+8
Change-Id: If875b538f2143eb572371dfcc086145c2f6e80f5
2016-03-10loplugin:constantparam in formulaNoel Grandin3-10/+10
Change-Id: I18246d34d27f1b12dfd107166b31ef16d9632462
2016-03-03tdf#94635 Add FORECAST.ETS functions to CalcWinfried Donkers1-0/+56
Change-Id: Ifbfff1c27fb3960a06f467630da0fa39665f0ce4 Reviewed-on: https://gerrit.libreoffice.org/20073 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-03-03loplugin:unuseddefaultparams in formulaNoel Grandin1-3/+2
Change-Id: I7f0baa2709db24e8299f0e1c19c0703aee1cbf4f
2016-02-23new loplugin: commaoperatorNoel Grandin2-2/+6
Change-Id: I03f24e61f696b7619855e3c7010aa0d874e5a4ff
2016-02-18tdf#43157 Cleanup DBG_ASSERT for formula module.aybuke2-2/+5
Change-Id: I1be9332b4408b3c28aacfa872d63fce67adcb1fe Reviewed-on: https://gerrit.libreoffice.org/21958 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-02-09Remove excess newlinesChris Sherlock9-22/+0
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-04vcl: take into account the font width is the average font widthChris Sherlock1-2/+2
I'm changing the Font class function names: - SetSize -> SetFontSize - GetSize -> GetFontSize - SetHeight -> SetFontHeight - GetHeight -> GetFontHeight - SetWidth -> SetAverageFontWidth - GetWidth -> GetAverageFontWidth That's because it really makes no sense to say that there is a single constant font width because obviously proportional fonts don't have one - the best we can do is an average font width, which is what folks like Microsoft sort of do already. On a fixed font, the average is still accurate, for obvious reasons :-) I'm also not a fan of GetSize/SetSize as I find it a might too generic. Change-Id: Ib80a604ba62d6883fd6cbc7994da763976be5c70 Reviewed-on: https://gerrit.libreoffice.org/22069 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-01-20loplugin:unusedmethodsNoel Grandin1-54/+0
Change-Id: Ib2dc804f55d1a96ae01f2cf31b7d55956040a72e Reviewed-on: https://gerrit.libreoffice.org/21603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-12loplugin:unusedmethods unused return value in include/formulaNoel Grandin2-8/+5
Change-Id: Ic5d6c11d955ef5ef53dea0bb4e5bec8167874a91
2016-01-10Fix typosAndrea Gelmini2-2/+2
Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86 Reviewed-on: https://gerrit.libreoffice.org/21209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-09Function Wizard: exclude functions with hidden flag from listsEike Rathke1-2/+3
Change-Id: Ia209bb44cef5969e5c9cd360aa5725708d6bdec5
2016-01-09Function Wizard: don't overwrite an unlisted functionEike Rathke2-4/+18
* in a spreadsheet cell enter =LOG(foobar(SIN(1))) * invoke Function Wizard on that cell (Ctrl+F2) LOG(foobar(SIN(1))) is marked in Formula edit field * activate Functions page LOG(foobar(SIN(1))) is marked in Formula edit field Function LOG is selected * click Next button foobar(SIN(1)) is marked in Formula edit field Function ABS is selected * click Next button foobar(SIN(1)) is overwritten with ABS( ) * only Cancel solves the problem foobar() could be any user defined or macro function that have no function description in the Formula Wizard. Change-Id: I1cb69a9e38c0b8f251d783bd0f67b4b24ade50d0
2016-01-09prepare for hidden flag in function description for Function WizardEike Rathke1-0/+1
Change-Id: Ic018ea5b962a66b6543e57d9cc1d44711e51de6e
2016-01-07tdf#96198 postpone conversion from WEEKNUM to ISOWEEKNUM, tdf#50950 follow-upEike Rathke1-0/+11
Have two releases be able to read ISOWEEKNUM first. Change-Id: I7ea8141043d18076a65396374dec40a806c8ab6a
2016-01-05use new'ed FormulaToken and FormulaTokenArray::Add()Eike Rathke1-4/+4
... instead of a temporary instance and AddToken() that just clones it again. Add function comment describing the difference. Change-Id: I3f089965d394b33d7bbbb9a1c3f69dc1c4182fd2
2016-01-05for new'ed FormulaToken use FormulaTokenArray::Add()Eike Rathke1-2/+2
... instead of AddToken() that just clones it again. Change-Id: I99b02b0924d0a0c070435501f8ecd45f030e9c2c
2016-01-05tdf#96198 add WEEKNUM_OOO compatibility function, tdf#50950 follow-upEike Rathke3-6/+30
The remaining cases when loading old and wrong ISOWEEKNUM that can't be mapped to either new WEEKNUM or ISOWEEKNUM now are mapped to WEEKNUM_OOO(date,mode) with calculations identical to the old and wrong OOo WEEKNUM. These WEEKNUM_OOO cases are still wrongly saved as ISOWEEKNUM so can be read by 5.0 or earlier versions as the old WEEKNUM, which should be changed for 5.3 or later. WEEKNUM_OOO is not offered in the Function Wizard to prevent deliberate usage. Also reverts the interim unit test change to sc/qa/unit/data/contentCSV/date-time-functions.csv that was necessary to catch the error generated by ISOWEEKNUM with two arguments. Change-Id: I874c4c7225900f03b879f2947512ae02270cbd4f
2016-01-05formula: add missing algorithm include for std::min.Michael Meeks1-0/+1
Change-Id: Ica344a8f1351826e53c109ef49f80e4b022a0364
2016-01-05tdf#96198 detect old ISO/WEEKNUM usage with two arguments, tdf#50950 follow-upEike Rathke2-1/+82
5.0 and earlier implemented WEEKNUM(date,mode) with mode!=1 such that effectively an ISO 8601 week number was calculated. WEEKNUM was wrongly saved as ISOWEEKNUM (even with two parameters though it is defined to have only one) so that when reading it we can try to detect a literal double argument for mode and if it is not 1 remove it to keep ISOWEEKNUM(date) instead of calling WEEKNUM(date,mode) which wouldn't match. A further change to 5.0 to accept also only one parameter in WEEKNUM(date) and for this default the mode to not 1 for ISO week will yield forward compatibility. Change-Id: I88de7dd809d69b6826a190505d2a1dd3fe79c90b
2015-12-18Formula Wizard: evaluating expressions always in matrix context is wrongEike Rathke1-12/+20
Change-Id: I276f7bbf2bd6fa7c67d8691634ad9d79e4a08b1c
2015-12-18Resolves: tdf#96366 replace Edit...() calls with actually working codeEike Rathke1-17/+38
... and way less overhead, geez.. Change-Id: Id9277301fbe69bc9a83ca39a907032b0b86b1c81
2015-12-18tdf#96366 disable treeview results until fix availableEike Rathke1-0/+3
Since f82d89f35207fc1cfc00ad5cd914b74c55c3e3d2 EditThisFunc() and EditNextFunc() are used to iterate through the formula to obtain expression results to display in the treeview. Calling the Edit...() functions spoils about everything as it messes around with the edit state. As the name suggests.. Change-Id: I8b35d85b7bbf8821b5a995e84f9dd88a0f6f00b9
2015-12-18Function Wizard shoots itself in the footEike Rathke2-3/+21
Currently the Function Wizard is broken in that editing a function call as argument within another function's parameter leads to selections being reset and mismatching argument/function information being evaluated. Not sure yet what's going on there, but at least don't access vectors out-of-bounds or crash. Change-Id: I633c775556a0b90278d22d0f74d2975c20a08a5d
2015-12-17out-of-bounds arg mapping access, this was always wrong but never hit it seemsEike Rathke1-1/+1
Change-Id: I15843b320ac8ddcefce8094da7aa7c6b81b42e4f
2015-12-17handle varargs with first required and subsequent optional, tdf#71459 relatedEike Rathke2-8/+13
Change-Id: I56c66f516ba2a2e12cab4848c8c352315f27b3bb
2015-12-17add RAWSUBTRACT spreadsheet function, tdf#71459Eike Rathke1-0/+7
Change-Id: I2ae13771c85044b771e253a8189a30cb4aecb30f
2015-12-15Resolves: tdf#95440 SharedString are interned per document, re-internEike Rathke1-0/+30
... if literal strings are copied with formula expression tokens. Change-Id: I13526907bb6c2c605c6ed9584fa6e3f2b18623b8
2015-11-20loplugin:unusedfields forms,formula,fpicker,frameworkNoel Grandin1-4/+0
Change-Id: Ic7af56ac801c1e5b3fcf3c4e8413656e96220279
2015-11-18cosmeticsEike Rathke1-13/+13
Change-Id: Ic06bef4c80426b97a2613fe296ae0aa0ee55a215
2015-11-18rename FormulaToken HasForceArray to IsInForceArrayEike Rathke2-12/+12
... to name it was it does and to distinguish from ScParameterClassification::HasForceArray(OpCode) which IS about a function having ForceArray parameters. Change-Id: I8af4e1d0353cdb5ad0a9b837ae0763dc77242734
2015-11-16prevent ForceArray propagation on the same token, tdf#95670 follow-upEike Rathke1-1/+1
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. Change-Id: I890fb6b5b88337033cfcf2e8189371ee39461205
2015-11-16Resolves: tdf#95670 propagate ForceArray per parameterEike Rathke1-3/+51
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. Change-Id: If188d45366279d9a7bf641edc7e4dd7095d6d035
2015-11-15tdf#95798: CRASH: when finish Function wizard on Report builderJulien Nabet1-1/+2
Following http://cgit.freedesktop.org/libreoffice/core/commit/?id=844b7287a4ccd8e3d5e458bb1dc6c52e71322b01 Change-Id: Ia5a2cd39cf3fdf87619f55710a188545830b4088 Reviewed-on: https://gerrit.libreoffice.org/19970 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Jenkins <ci@libreoffice.org>
2015-11-15use initialiser for Sequence<OUString>Noel Grandin1-2/+1
replaced using: git grep -lP 'Sequence.*OUString.*\(\s*1\s*\)' | xargs perl -0777 -pi -e "s/Sequence<\s*OUString\s*> (\w+)\(\s*1\s*\); .*\[0\] = (\S+);/Sequence<OUString> \1 { \2 };/g" Change-Id: I20ad0489da887a9712982531c3b127339bb8b3b9 Reviewed-on: https://gerrit.libreoffice.org/19969 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-13cppcheck: noExplicitConstructorCaolán McNamara2-7/+7
Change-Id: Ife26f55c28c4631aec4ba4105225bfca72da8bff
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann13-124/+124
Change-Id: Ib336ce9bc95f5c84dd6412ff3c098e68c5b0f4ff
2015-11-09Replace a local functor and bind2nd by a lambda in formula.Mario J. Rugiero1-13/+3
Change-Id: Ied06b3f167c566d754d32708eaec4a354f7ee663 Reviewed-on: https://gerrit.libreoffice.org/19848 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-26Revert "tdf#90695: In function Wizard Array box cannot be unchecked"Eike Rathke1-0/+1
This reverts commit bebc20c62be2df2cf2741fb82945ce6b631d2fe5. Removing the disabling is plain wrong. Please see the code for when the button is disabled, when it is enabled, and what consequences it has when changing the state from checked to unchecked. Unchecking will result in the formula not being applied as array formula anymore, which it was before editing. Actually tdf#90695 is not even a bug. The checked but disabled Array button is meant as an indicator that the formula IS an array/matrix formula. Change-Id: Ic7f9f7010ce208171ef614e0885474f2deae4ac9 Reviewed-on: https://gerrit.libreoffice.org/19602 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2015-10-26tdf#90695: In function Wizard Array box cannot be uncheckedJulien Nabet1-1/+0
Just remove the disabling Change-Id: Ia03591610ba1b60a66d9962169383c4ab85288ca Reviewed-on: https://gerrit.libreoffice.org/19590 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-10-19loplugin:defaultparamsStephan Bergmann1-4/+4
Change-Id: I4cb8e39dfe7efcb7ac75ebf41e3d76b8f12750f2
2015-10-16convert Link<> to typedNoel Grandin3-11/+8
Change-Id: Icbba339dac0be31e30dff021bba06a219f8aecd6 Reviewed-on: https://gerrit.libreoffice.org/19405 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>