Commit Graph
353 Commits
Author SHA1 Message Date
Eike Rathke cfc6cf5177 Resolves: tdf#116215 fewer array of references cases, tdf#58874 related
In particular if in any ForceArray context use the matrix result
instead of the array of references list.

Change-Id: I72328a690760637f6d31fadba447641c64711a67
2018-03-06 18:59:07 +01:00
Eike Rathke a8d4d4b9ed Resolves: tdf#115879 treat NOT as the 1-parameter function that it is
... 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-02-20 23:24:17 +01:00
Stephan Bergmann bb60b49c3a More loplugin:cstylecast: formula
Change-Id: I0a6f4eaf49282a6aa74b24ea62736065d1786f58
2018-01-15 09:05:23 +01:00
Noel Grandin 4b030651a0 loplugin:passstuffbyref improved return in various
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-29 18:19:37 +01:00
Eike Rathke f6c2fd1ce5 Remove unused ocExternalRef
Change-Id: Ie32411637f2f2dbedfc8e4272e952ecc1d72ac49
2017-12-20 22:05:34 +01:00
Noel Grandin 00bc5a0973 wrap scoped enum around css::util::NumberFormat
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-19 22:08:26 +01:00
Stephan Bergmann 6f4f5677ac No need to keep these whitelisted functions decorated with SAL_CALL
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, 3af500580b
"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-14 13:03:06 +01:00
Noel Grandin 68f8645752 new loplugin salcall: remove unnecessary SAL_CALL
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-04 07:24:52 +01:00
Noel Grandin e7f6fdd5c3 loplugin:unusedfields
The mnRequestedLength fields in formula/ were introduced in

    commit 6ef6dd0122
    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 d7f1f91b19
    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-12-01 08:13:06 +01:00
Tor Lillqvist bfa72a6a2a Add a debugging output OpCodeEnumToString() function
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-25 06:51:30 +01:00
Tor Lillqvist ceff579722 Mention that the StackVarEnumToString should really be an operator<<
Change-Id: I71288daf10b1010ab0f9dbedd39875cc24f119ae
2017-11-24 23:00:39 +02:00
Dennis Francis 4b3e4c1c98 cache FormulaToken for doubles
Change-Id: Ic0b4dff6f03ef3f88bd150e798fa2d83dfb0f486
2017-11-21 16:09:44 +05:30
Noel Grandin 87a9979c89 overload std::hash for OUString and OString
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-23 08:15:35 +02:00
Caolán McNamara e26f8d2592 coverity#1401307 document checked 'Uncaught exception'
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-10-21 10:36:39 +02:00
Eike Rathke 1015e1f6f0 FormulaTokenArray::Clear() virtual, ScTokenArray::Clear() overrides
A sliced Clear()/ClearScTokenArray() was never intended.

Change-Id: I25df3fa8829f6bc8f1dee6ef0d27b28491d6a5c3
2017-09-25 13:39:41 +02:00
Eike Rathke bf0996d39c Clarify comment of "copy"-ctor and operator=()
Change-Id: Ie6e40e5c08d05ee75e4d1d9d6d8b4e567ecbcdbc
2017-09-25 13:16:24 +02:00
Winfried Donkers 41a85500a7 tdf#107135 Add missing ODFF function SEARCHB.
Change-Id: Ic72693ad8f33fb94c171751f82680eabad1d3d6d
Reviewed-on: https://gerrit.libreoffice.org/41900
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2017-09-07 13:57:29 +02:00
Caolán McNamara 13fac4894f normalize resource locale ctor construction mechanisms
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-08-02 10:36:07 +02:00
Noel Grandin b1a1baa66a loplugin:constparams in formula,xmlhelp
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-31 12:09:24 +02:00
Noel Grandin 4ed70b89aa loplugin:unusedfields
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-26 11:15:52 +02:00
Noel Grandin 2fffaf6f05 loplugin:unusedmethods
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-25 12:03:50 +02:00
Winfried Donkers a5ec33c9e1 tdf#107135 Add missing ODFF function FINDB.
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-25 10:36:41 +02:00
Caolán McNamara 182a74d937 de-hrc various things
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-21 08:20:51 +01:00
Caolán McNamara 00657aef09 migrate to boost::gettext
* 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-21 08:20:50 +01:00
Eike Rathke 3087b8f5d5 Introduce IFormulaEditorHelper::createCompiler()
For application specific derivatives.

Change-Id: I8af95bd120c642e47ec5d0708ed463c98c471567
2017-07-11 16:42:23 +02:00
Eike Rathke e8fcb1fbd3 Make GetForceArrayParameter() public
Change-Id: I3a82c43e80fffb4bf37bb2f7a3f5b3b26f1baf98
2017-07-10 21:15:28 +02:00
Eike Rathke 741f61d0ca Introduce IFormulaEditorHelper::getCompiler()
Implemented at rptui::FormulaDialog as nullptr and at ScFormulaDlg as ScCompiler*

Change-Id: I0edaca56f5d9e3505ed766d43bc9ee4af80f03ff
2017-07-10 21:15:28 +02:00
Winfried Donkers c9f6bd6a71 tdf#107135, add missing ODFF function REPLACEB.
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-10 15:13:37 +02:00
Eike Rathke 91287c7456 Enable the Formula Wizard to display 255 argument fields
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-05 13:47:55 +02:00
Eike Rathke 209cc5c211 Set error on more than max params (255) per function
Parameter count is size byte, so.. SUM(1,1,1,...) with 256 arguments resulted
in 0 (uint8 wrapping around).

Change-Id: Ib9997ad0d0d13d4c5171f276148b6c5cad570d5b
2017-07-04 15:22:52 +02:00
Eike Rathke 3054a8c1c1 Prepare for change of VAR_ARGS value
Change-Id: I0b1955bb660b5e19587799de657c63634705b99c
2017-07-04 14:04:56 +02:00
Eike Rathke a5bff39217 Move definition of VAR_ARGS and PAIRED_VAR_ARGS to formula/funcvarargs.h
... 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-04 13:04:58 +02:00
Noel Grandin 8237a77245 loplugin:unusedfields in formula
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-07-04 11:05:28 +02:00
Tor Lillqvist 4e27d3cf6b Introduce a range-based iterator for 'references' in a FormulaTokenArray
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-22 12:28:27 +02:00
Jochen Nitschke d9726a6920 formula: remove indirection and use unique_ptr
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>
2017-06-22 10:34:44 +02:00
Tor Lillqvist a8a9d0add5 s/FormulaTokenArrayStandardIterator/FormulaTokenArrayStandardRange
Because that class isn't an iterator, but a class that produces
iterators (with its begin() and end() member functions).

Change-Id: I13125ced5e82406d049a61078e31690312a82620
2017-06-19 14:42:11 +03:00
Tor Lillqvist c3fae6be60 Add yet another kind of iterator for the two arrays in FormulaTokenArray
This one has no extra functionality at all, and its only purpose is to
be used in range-based for loops. If there is a cleaner way to do
this, feel free. Not sure if this functionality could or should be
combined with either of the two existing iterator classes related to
FormulaTokenArray (FormulaTokenIterator and
FormulaTokenArrayPlainIterator). Probably not.

Change-Id: I32599b0800fd2585624d3742a46ad4896ce7e47a
2017-06-19 12:23:24 +03:00
Tor Lillqvist cfd5d203e9 Drop another friend declaration
Change-Id: I06dd3639e4110700e070f1224112a9fa6597a832
2017-06-19 12:23:23 +03:00
Tor Lillqvist 896dbaee45 Drop an unnecessary friend declaration
Change-Id: I05ee0c0db2d54625413c9b89a12e24b9de7c45da
2017-06-19 12:23:17 +03:00
Tor Lillqvist a056978ace Drop one friend declaration and instead add some useful member functions
Change-Id: I9a947078d9f2c1c06cb8524be137ba5e36e97a0b
2017-06-19 12:22:51 +03:00
Tor Lillqvist 5c81adc51a Get rid of the index inside FormulaTokenArray
Instead, use FormulaTokenArrrayPlainIterator everywhere, especially in
the FormulaCompiler.

This is the final step of a long chain of commits. (Split up into many
"uncontroversial" bits, and then this, to make potential bisecting
easier.)

Also added a logging operator<< for FormulaTokenArray, for SAL_DEBUG,
SAL_INFO etc goodness.

Change-Id: I02fe29f3f1e0dc33e5cba69e594223b4178a12bc
Reviewed-on: https://gerrit.libreoffice.org/38851
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2017-06-16 12:17:40 +02:00
Tor Lillqvist b3dfd7988a Use pointer instead of reference
Change-Id: I087f0fe99e6631d5b62ea773c83404e11d64d060
2017-06-14 18:23:02 +03:00
Tor Lillqvist 60763a9551 FormulaTokenArray::FirstRPN() can go away now
Change-Id: Ic9570421f176c8bc078c1d33697a5f379e05111b
2017-06-13 21:41:28 +03:00
Tor Lillqvist 7b67e3fc55 Add FirstToken() and FirstRPNToken() functions that don't touch nIndex
... to FormulaTokenArray. Intermediate commit, these new functions
aren't used yet.

Change-Id: Ie505fe9dbd787087fa29f701d29ff9b4495c8699
2017-06-13 17:27:02 +03:00
Tor Lillqvist c2b256084b Partial start of separating the iterator out from FormulaTokenArray
The plan is to drop the iterator functionality from FormulaTokenArray
and instead use separate iterator objects. This will make
parallelising code that uses these data structures easier. I call the
new separate iterator class FormulaTokenArrayPlainIterator for now,
feel free to come up with a better name.

No change to what code actually gets run yet, so yeah, this adds
"unused" code.

Change-Id: Ie86f80529354174f0ce8bde1085a54bc6c5ac67b
2017-06-06 21:11:41 +03:00
Johnny_M c6f4fd1942 tdf#39468 Translate German comments and dbg strings (leftovers in h.. to i..)
Translates all (leftovers) found using a custom regex, in directories not shown by
/bin/find-german-comments and beginning with "h" to "i".

Additionally:
- Fixed a few spellings

Change-Id: I54ea06f8e0cf1bd4bd6c84b171bec1bd342a8df8
Reviewed-on: https://gerrit.libreoffice.org/38390
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2017-06-06 13:51:55 +02:00
Eike Rathke 70cb7757f9 Resolves: tdf#96426 more whitespace intersection operator in Excel syntax
Handle also stacked token arrays resulting from named expressions like
=range1 range2

Change-Id: I1838af155f17b5e4f941e46895303caed75b6075
2017-05-17 15:23:33 +02:00
Eike Rathke 534746c99e Introduce and check FormulaTokenArray::mbFinalized to not add further tokens
Obviously after FormulaTokenArray::Assign() or the copy-ctor for that matter,
new tokens can not be added anymore to the shrunk code array. We don't do it,
but ensure that it isn't done in future..

Change-Id: Ibc0115f9f38e9745028a7459c61408c188783d03
2017-05-12 17:54:36 +02:00
Eike Rathke 1cf4494716 Hold ParamClass at FormulaByteToken instead of bool, tdf#107724 prep
* change IsInForceArray() to GetInForceArray()
* add IsInForceArray() to keep previous functionality

Change-Id: I64c891486e548a66539646846a4691a213c783ac
2017-05-10 00:39:58 +02:00
Eike Rathke f39e1b1079 Change IsForceArrayParameter() to GetForceArrayParameter(), tdf#107724 prep
Change-Id: Icd3400e4ee1c69860908a2ad0ca6e52879f2f725
2017-05-10 00:39:58 +02:00