summaryrefslogtreecommitdiff
path: root/include/formula
AgeCommit message (Collapse)Author
2018-10-25Resolves: tdf#113977 implement REGEX() spreadsheet functionEike Rathke
REGEX( Text ; Expression [ ; Replacement ] ) Using ICU regular expressions http://userguide.icu-project.org/strings/regexp Change-Id: I4cb9b8ba77cfb5b8faab93037aa0d947609383d7 Reviewed-on: https://gerrit.libreoffice.org/62332 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-10-10add ScTokenArray::Finalize() to explicitly reduce memory usageLuboš Luňák
Since ScTokenArray::Add() overallocates memory, make sure we do not keep such possibly large arrays. Since any copying of ScTokenArray implicitly finalizes as well, this is not a big problem right now, but then why needlessly do the copies? (next commit) Change-Id: I55398bcd8fb31f1be5a4b8e3f5a71b26649a7594 Reviewed-on: https://gerrit.libreoffice.org/60862 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2018-09-28Remove unused ocIndirectXL and ocAddressXLEike Rathke
Separated implementation is gone since long. Change-Id: I78279f631c9205202af92ad8e248f9a1226b7a19 Reviewed-on: https://gerrit.libreoffice.org/61075 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-16remove mempoolNoel Grandin
we've been using the normal memory allocator instead of the sal slab allocator ever since commit bc6a5d8e79e7d0e7d75ac107aa8e6aa275e434e9 Date: Wed Nov 15 16:52:44 2017 +0530 Disable custom allocator Change-Id: I3383962cedb85d56fbec695398901f6ff7057651 Reviewed-on: https://gerrit.libreoffice.org/58577 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-13loplugin:returnconstant in forms..fpickerNoel Grandin
Change-Id: I3f0bead636632682488cbe677fd7fee60350f04d Reviewed-on: https://gerrit.libreoffice.org/58876 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-31try to detect that a formula does not contain any implicit intersectionLuboš Luňák
Commit 67444cbe disabled svDoubleRef completely for OpenCL, which means many formulas weren't handled by OpenCL even if the implicit intersection problems are quite rare. This patch tries to detect formulas implicit intersections in formulas and if it's certain that a formula does not contain one, then it's ok to use OpenCL with svDoubleRef. The detection is done by having ScCompiler analyze each opcode call and its parameters, which should provide sufficient information to know if implicit intersection can take place or not. The extra compilation can be avoided by using OpenCL's compilation and doing the svDoubleRef conversion later on the RPN code, to be done later. This is opt-in, so if unsure don't do anything, if it turns out that some opcode needs special handling, it can be simply added. Change-Id: Iaa52fa7eb8b14dc8c2b92384a21e2ab8efe0ddd7 Reviewed-on: https://gerrit.libreoffice.org/57959 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2018-07-19Related: tdf#118735 introduce FormulaError::LinkFormulaNeedingCheck (Err:540)Eike Rathke
To indicate why the result isn't available ("External content disabled") and in future maybe signal to the formula cell that it could keep the hybrid string result, see source code comment. Change-Id: Ic5d336b8489e8776f7b640b7e46815e71d0a82a4 Reviewed-on: https://gerrit.libreoffice.org/57738 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-07-18loplugin:mergeclasses merge IFormulaToken into FormulaTokenNoel Grandin
Change-Id: I5dbf870ff27f1039e24f4350787cf5bfc5f4ccaf Reviewed-on: https://gerrit.libreoffice.org/57487 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-14Resolves: tdf#94925 do not unset dirty if formula cell must be recalculatedEike Rathke
Change-Id: If70860b8babf1cce7fda2ae63412659e72dbb4c3 Reviewed-on: https://gerrit.libreoffice.org/57404 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-07-13Rework FormulaTokenArray ScRecalcMode in preparation for tdf#94925Eike Rathke
Strictly order the exclusive bits by priority, let AddRecalcMode() handle all sets except forced ALWAYS or NORMAL. Introduce ONLOAD_LENIENT and ONLOAD_MUST splitting ONLOAD to be able to distinguish later during OOXML import. Change-Id: I188de2d53a2d54df32d24eeeb148c4f9e87e7cfc Reviewed-on: https://gerrit.libreoffice.org/57402 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-06-26More Implicit intersection computationDennis Francis
Do implicit intersection computation for for single parameter functions while generating RPN token array when the argument is a doubleref with relative row references. This optimization is not done when under forced array mode or matrix formula mode. The computation logic was already present in ScInterpreter, so factored it out and reused. This also adds unit tests to ensure correctness of II computation for various cases. Change-Id: I509c3f6f811aa036b1dc3296e8f68904b26c3c49 Reviewed-on: https://gerrit.libreoffice.org/53885 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-06-05Add "Unsupported inline array content." BadArrayContent message, tdf#117879Eike Rathke
Change-Id: I176884ea5161c4f12419431a74bfb2c6fbed4e0f Reviewed-on: https://gerrit.libreoffice.org/55317 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2018-05-17disable also ocStyle for Calc's threadingLuboš Luňák
The ocStyle token is only in the RPN tokens, the raw tokens array contains only ocName, so it's necessary to check also RPN tokens. Prevents a crash with tdf#91220/1 because of ScInterpreter::ScStyle() causing a SfxBroadcaster::Broadcast() call. Change-Id: I7fa04114b698918569014322c721751ab3d8c62f Reviewed-on: https://gerrit.libreoffice.org/54326 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
2018-05-14loplugin:useuniqueptr in FormulaTokenArrayNoel Grandin
Change-Id: I5716295d2f0c88c6daf0570941d5dd4c5ff03a33 Reviewed-on: https://gerrit.libreoffice.org/54168 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-28tdf#114479: compute implicit sum ranges for ocSumIf,ocAverageIf...Dennis Francis
and update the sum-range token in RPN array while creation of the RPN array itself. + Adds unit tests. + In ScParallelismTest unit test, enable threading in its setUp() method and restore the original setting in tearDown(). Change-Id: Iee9b7759210a82950181a418eb92766a6cf891fc Reviewed-on: https://gerrit.libreoffice.org/49465 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2018-03-06Resolves: tdf#116215 fewer array of references cases, tdf#58874 relatedEike Rathke
In particular if in any ForceArray context use the matrix result instead of the array of references list. Change-Id: I72328a690760637f6d31fadba447641c64711a67
2018-02-20Resolves: tdf#115879 treat NOT as the 1-parameter function that it isEike Rathke
... instead of a low precedence unary operator with an odd behaviour. This wasn't documented nor specified but maybe needed for old(est) binary file format compatibility. Generate an error for anything else than a context of a function with one argument. There might be some corner cases of documents where some old usage leads to error now, of which some may have worked by accident, but some not as intended. Related, the internal not exposed (but available) NEG was classified similar as a unary operator but corectly handled as function at all places. Classified as an ordinary 1-parameter function as well. Change-Id: I3d84a6382243c8d64313e37346f81c857e71be95 Reviewed-on: https://gerrit.libreoffice.org/50055 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2018-01-15More loplugin:cstylecast: formulaStephan Bergmann
Change-Id: I0a6f4eaf49282a6aa74b24ea62736065d1786f58
2017-12-29loplugin:passstuffbyref improved return in variousNoel Grandin
Change-Id: I0a8282d8e0d9575b055243073fc89a7d6b67b560 Reviewed-on: https://gerrit.libreoffice.org/47173 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-20Remove unused ocExternalRefEike Rathke
Change-Id: Ie32411637f2f2dbedfc8e4272e952ecc1d72ac49
2017-12-19wrap scoped enum around css::util::NumberFormatNoel Grandin
Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa Reviewed-on: https://gerrit.libreoffice.org/46339 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2017-12-14No need to keep these whitelisted functions decorated with SAL_CALLStephan Bergmann
The only effect SAL_CALL effectively has on LO-internal code is to change non- static member functions from __thiscall to __cdecl in MSVC (where all other functions are __cdecl by default, anyway). (For 3rd-party code, it could be argued that SAL_CALL is useful on function declarations in the URE stable interface other than non-static member functions, too, in case 3rd-party code uses a compiler switch to change the default calling convention to something other than __cdecl. But loplugin:salcall exempts the URE stable interface, anyway.) One could argue that SAL_CALL, even if today it effectively only affects non- static member functions in MSVC, could be extended in the future to affect more functions on more platforms. However, the current code would already not support that. For example, 3af500580b1c82eabd60335c9ebc458a3f68850c "loplugin:salcall fix functions" changed FrameControl_createInstance in UnoControls/source/base/registercontrols.cxx to no longer be SAL_CALL, even though its address (in ctl_component_getFacrory, in the same file) is passed to cppuhelper::createSingleFactory as an argument of type cppu::ComponentInstantiation, which is a pointer to SAL_CALL function. Change-Id: I3acbf7314a3d7868ed70e35bb5c47bc11a0b7ff6 Reviewed-on: https://gerrit.libreoffice.org/46436 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-04new loplugin salcall: remove unnecessary SAL_CALLNoel Grandin
In this first commit, I use the plugin to verify the consistency of our SAL_CALL annotations. The point being to make the next commit more mechanical in nature, purely using the rewriter. There are various chunks of unix-only code that have never had to be compiled by MSVC, hence the inconsistencies. In bridges, I had to inline some typedefs to make the verification code happy, since it cannot see into typedefs. Change-Id: Iec6e274bed857febf7295cfcf5e9f21fe4a34da0 Reviewed-on: https://gerrit.libreoffice.org/45502 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-01loplugin:unusedfieldsNoel Grandin
The mnRequestedLength fields in formula/ were introduced in commit 6ef6dd0122b8e44d8547ec31f40def42173e4e41 Author: Kohei Yoshida <kohei.yoshida@collabora.com> Date: Wed Feb 26 14:32:57 2014 -0500 Store the length of originally requested array size prior to trimming. but then partially removed in commit d7f1f91b194da1cb96e66268ce7ef38602aa5754 Author: Noel Grandin <noel@peralex.com> Date: Mon Mar 3 13:29:43 2014 +0200 remove unused code in formula/vectortoken Change-Id: Ic56b6e42682131ee45df7838867145f980f3d601 Reviewed-on: https://gerrit.libreoffice.org/45571 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-25Add a debugging output OpCodeEnumToString() functionTor Lillqvist
Change-Id: I5382107dc556df822292e72af48d23e04a3408a2 Reviewed-on: https://gerrit.libreoffice.org/45261 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2017-11-24Mention that the StackVarEnumToString should really be an operator<<Tor Lillqvist
Change-Id: I71288daf10b1010ab0f9dbedd39875cc24f119ae
2017-11-21cache FormulaToken for doublesDennis Francis
Change-Id: Ic0b4dff6f03ef3f88bd150e798fa2d83dfb0f486
2017-10-23overload std::hash for OUString and OStringNoel Grandin
no need to explicitly specify it anymore Change-Id: I6ad9259cce77201fdd75152533f5151aae83e9ec Reviewed-on: https://gerrit.libreoffice.org/43567 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-21coverity#1401307 document checked 'Uncaught exception'Caolán McNamara
markup std::unique_ptr where coverity warns a dtor might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do Change-Id: Icc99cdecf8d8b011e599574f0a05b59efd1c65c2 Reviewed-on: https://gerrit.libreoffice.org/41561 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-25FormulaTokenArray::Clear() virtual, ScTokenArray::Clear() overridesEike Rathke
A sliced Clear()/ClearScTokenArray() was never intended. Change-Id: I25df3fa8829f6bc8f1dee6ef0d27b28491d6a5c3
2017-09-25Clarify comment of "copy"-ctor and operator=()Eike Rathke
Change-Id: Ie6e40e5c08d05ee75e4d1d9d6d8b4e567ecbcdbc
2017-09-07tdf#107135 Add missing ODFF function SEARCHB.Winfried Donkers
Change-Id: Ic72693ad8f33fb94c171751f82680eabad1d3d6d Reviewed-on: https://gerrit.libreoffice.org/41900 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2017-08-02normalize resource locale ctor construction mechanismsCaolán McNamara
make them all the same and share std::locales more various OModuleClient, etc, classes go away Change-Id: I7e3ff01a69332eeacd22e3078f66a60318de62d5 Reviewed-on: https://gerrit.libreoffice.org/40634 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-07-31loplugin:constparams in formula,xmlhelpNoel Grandin
Change-Id: I1c987d991a5b292df327d1bb921099233b5531fe Reviewed-on: https://gerrit.libreoffice.org/40584 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-26loplugin:unusedfieldsNoel Grandin
Change-Id: I21e538b8e9c7a5f0fb233019efac37a3555e3c93 Reviewed-on: https://gerrit.libreoffice.org/40438 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-25loplugin:unusedmethodsNoel Grandin
Change-Id: Ia874baf21257e5fe41e104211068a2bcc50446eb Reviewed-on: https://gerrit.libreoffice.org/40391 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-25tdf#107135 Add missing ODFF function FINDB.Winfried Donkers
Change-Id: I96bbca8e6d91448fbb27fe95a57ce62a78d1b2c5 Reviewed-on: https://gerrit.libreoffice.org/40242 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2017-07-21de-hrc various thingsCaolán McNamara
e.g. helpid[s].hrc -> helpids.h and insert include guards where missing move "ordinary" defines into .hxx files remove .hrc entries that are used as arguments to dialog factory when a dedicated method can be added instead Change-Id: I792fb8eb0adfaa63cf354e6e57401fc943e9196e
2017-07-21migrate to boost::gettextCaolán McNamara
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") * ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching MODULE .mo files * UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui goes from l10n target to normal one, so the res/lang.zips of UI files go away * translation via Translation::get(hrc-define-key, imbued-std::locale) * python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there to keep finding the .hrc file uniform) so magic numbers can go away there * java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation mechanism * en-US res files go away, their strings are now the .hrc keys in the source code * remaining .res files are replaced by .mo files * in .res/.ui-lang-zip files, the old scheme missing translations of strings results in inserting the english original so something can be found, now the standard fallback of using the english original from the source key is used, so partial translations shrink dramatically in size * extract .hrc strings with hrcex which backs onto xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap * extract .ui strings with uiex which backs onto xgettext --add-comments --no-wrap * qtz for gettext translations is generated at runtime as ascii-ified crc32 of content + "|" + msgid * [API CHANGE] remove deprecated binary .res resouce loader related uno apis com::sun::star::resource::OfficeResourceLoader com::sun::star::resource::XResourceBundleLoader com::sun::star::resource::XResourceBundle when translating strings via uno apis com.sun.star.resource.StringResourceWithLocation can continue to be used Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
2017-07-11Introduce IFormulaEditorHelper::createCompiler()Eike Rathke
For application specific derivatives. Change-Id: I8af95bd120c642e47ec5d0708ed463c98c471567
2017-07-10Make GetForceArrayParameter() publicEike Rathke
Change-Id: I3a82c43e80fffb4bf37bb2f7a3f5b3b26f1baf98
2017-07-10Introduce IFormulaEditorHelper::getCompiler()Eike Rathke
Implemented at rptui::FormulaDialog as nullptr and at ScFormulaDlg as ScCompiler* Change-Id: I0edaca56f5d9e3505ed766d43bc9ee4af80f03ff
2017-07-10tdf#107135, add missing ODFF function REPLACEB.Winfried Donkers
Change-Id: I8d782b109eb390838b6c4f3a85e9b344ecef87ec Reviewed-on: https://gerrit.libreoffice.org/39606 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-07-05Enable the Formula Wizard to display 255 argument fieldsEike Rathke
Previously it was, for example for SUM, 1 2 3 ... 28 29 30,31,32,33,...,253,254,255 ie. for more than 30 parameters the exceeding ones were crammed into the last (30th) edit field. The expression still worked, but this was ugly, and selecting the last field it was easy to overwrite all remaining arguments at once. Change-Id: I6b27a20e7f07d3a6b4752855f04d6239e6375418
2017-07-04Set error on more than max params (255) per functionEike Rathke
Parameter count is size byte, so.. SUM(1,1,1,...) with 256 arguments resulted in 0 (uint8 wrapping around). Change-Id: Ib9997ad0d0d13d4c5171f276148b6c5cad570d5b
2017-07-04Prepare for change of VAR_ARGS valueEike Rathke
Change-Id: I0b1955bb660b5e19587799de657c63634705b99c
2017-07-04Move definition of VAR_ARGS and PAIRED_VAR_ARGS to formula/funcvarargs.hEike Rathke
... to have it at one central place instead of two. And add comments why changing the value is not just easily done. Change-Id: I266ea55c79c02a653a0704c33f9fa712bbcd104e
2017-07-04loplugin:unusedfields in formulaNoel Grandin
Change-Id: I5d8fe8869087efda68d040448b2d9e0e7e5611f6 Reviewed-on: https://gerrit.libreoffice.org/39493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-22Introduce a range-based iterator for 'references' in a FormulaTokenArrayTor Lillqvist
Take it into use in a couple of places. Change-Id: I72127f4236220fbe6fbf9ea25cdd56470be89961 Reviewed-on: https://gerrit.libreoffice.org/38997 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2017-06-22formula: remove indirection and use unique_ptrJochen Nitschke
Change-Id: Ib0c083803024d223f62b91ec54850b84eb68a758 Reviewed-on: https://gerrit.libreoffice.org/39033 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>