Commit Graph
481 Commits
Author SHA1 Message Date
Julien Nabet c6994fb815 Use for-range loops in embeddedobj, embedserv and formula
Change-Id: I56e1bace8ab8312524e681d3865a1a89d523812d
Reviewed-on: https://gerrit.libreoffice.org/51459
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-03-17 18:30:39 +01:00
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
Andrea Gelmini fa4def2a2b Fix typos
Change-Id: I76d50754a660e006e5913b89caa491cc21d6f9dc
Reviewed-on: https://gerrit.libreoffice.org/49588
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-02-14 08:55:39 +01:00
Eike Rathke a6c659283a Use FormulaCompiler::IsOpCodeJumpCommand() where applicable
Change-Id: I295e842da0192c21d318357caa574062085acd9d
2018-02-12 22:52:58 +01:00
Stephan Bergmann 11e93c64c3 More loplugin:cstylecast: formula
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I924954aefd471386805082f11a2d33db2746c49a
2018-01-12 20:23:50 +01:00
Jan Holesovsky 101a79cc4d lokdialog: Allow switching language of some of the ResMgr's.
This way, it is possible to have all the strings translated in dialogs even
when different users use different languages.  [It was already possible
to have different languages previously, but not everything in the dialog has
switched - like the buttons at the bottom of the dialogs etc.]

Change-Id: I29a5ae6d31a370eec60397884200b684ec1bf5b9
Reviewed-on: https://gerrit.libreoffice.org/46417
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/46979
Tested-by: Jenkins <ci@libreoffice.org>
2017-12-22 22:39:39 +01:00
Mike Kaganski 9c50b0ed87 loplugin:unusedindex
Change-Id: Id69dcfde5c8b5d39c272916e7c1bcc649f720888
Reviewed-on: https://gerrit.libreoffice.org/46829
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-20 07:13:01 +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 3af500580b loplugin:salcall fix functions
since cdecl is the default calling convention on Windows for
such functions, the annotation is redundant.

Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d
Reviewed-on: https://gerrit.libreoffice.org/46164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11 12:13:46 +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
Eike Rathke 1f9d91afac Assert also new FormulaToken::SetDoubleType() virtual dummy
Change-Id: I4532d0329dc7cd2609bc96abba140aba3f3d36f3
2017-11-21 16:09:44 +05:30
Dennis Francis 4b3e4c1c98 cache FormulaToken for doubles
Change-Id: Ic0b4dff6f03ef3f88bd150e798fa2d83dfb0f486
2017-11-21 16:09:44 +05:30
Eike Rathke 48dcf7837e Assert all FormulaToken::Set...() virtual dummy methods
Attempting to set on a wrong token type can never be right.

Change-Id: I788221505a628f40dfbb9c2ee7c92ac789529303
2017-11-15 17:41:58 +01:00
Stephan Bergmann 2304eef0af loplugin:includeform: formula
Change-Id: I50b898e477e0842577bcc648540e7f4b66d5b693
2017-10-23 22:46:07 +02:00
Noel Grandin d347c24036 convert std::map::insert to std::map::emplace
which is considerably less verbose

Change-Id: Ifa373e8eb09e39bd6c8d3578641610a6055a187b
Reviewed-on: https://gerrit.libreoffice.org/40978
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-11 12:38:32 +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
Caolán McNamara b1d829e52e move resmgr to unotools
and the vast majority of translations is to the ui language so default
ctor with that arg

and now drop OModuleResourceClient

Change-Id: I3b85a560ffdfe5f019c2271ac56a5fe4a361522b
2017-08-01 13:42:21 +01: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 b09deb0753 loplugin:constparams handle constructors
had to change the structure of the plugin considerably, was too messy to
structure it to do the calculations on a per-function basis

Change-Id: I4edee7735f726101105c607368124a08dba21086
Reviewed-on: https://gerrit.libreoffice.org/40516
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-28 14:51:56 +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 7232980be6 Resolves: tdf#104186 spaces between function name and ( not allowed in OOXML
Change-Id: I6f6fcdab24a426d0f62052fa2d31f4098d1d893a
2017-07-17 20:13:38 +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 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
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 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 a056978ace Drop one friend declaration and instead add some useful member functions
Change-Id: I9a947078d9f2c1c06cb8524be137ba5e36e97a0b
2017-06-19 12:22:51 +03:00
Jochen Nitschke a5dba7dbec remove unused osl/mutex.hxx includes
Change-Id: I3b50e45fdb99e9cd8bfda07356ee3ddb4dd0f8bb
Reviewed-on: https://gerrit.libreoffice.org/38905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-06-18 13:38:25 +02: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 92b7acdf2a Avoid use of FormulaTokenArray::First() and Next() in another place
Change-Id: Ie542f62b910648ee494b908703083d28f92d9a33
2017-06-14 15:45:19 +03:00
Tor Lillqvist 4e81314953 Avoid use of FormulaTokenArray::First() and Next() in another place
Change-Id: I26147e53bad5f2b489a91eaa225196bb490bad27
2017-06-14 14:09:56 +03:00
Tor Lillqvist a0a72ba3d7 Avoid use of FormulaTokenArray::First() and Next() in one place
Change-Id: I941c3dba2c51eb9419cfb117b02cab9617906bac
2017-06-14 14:09:56 +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 90435528f4 Forgot FormulaTokenArrayPlainIterator::GetNextName()
Change-Id: I3a485518be1372c9c56137c35cefdbc8d0362fe4
2017-06-08 19:37:10 +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
Noel Grandin 17a2c9e8e2 clang-tidy performance-unnecessary-value-param
Change-Id: I6ed8c54c7c45931d91709cc818f2483c70197192
Reviewed-on: https://gerrit.libreoffice.org/38400
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-05 09:22:51 +02:00
Johnny_M fd48f39a7e Translate German comments and debug strings (leftovers in f... dirs)
Translates all (leftovers) found using a custom regex, in directories not
shown by /bin/find-german-comments and beginning with "f".

Additionally:
- Fixed translation in formula/source/ui/dlg/funcutl.cxx (translated in
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=5e04331fc0a6434c61d3d18843cb4f80a44e5989 ),
because clearing an event is quite the opposite of its triggering.

Change-Id: I0fd62193a29883796cd05e5a80ce8a2900636b6c
Reviewed-on: https://gerrit.libreoffice.org/37839
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-05-20 13:43:17 +02:00
Stephan Bergmann 054c06dc5d loplugin:stringcopy: formula
Change-Id: Ifab711d6081a70480396ac05112b4647206a754d
2017-05-19 17:17:57 +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 3e67f82fce inherit ReferenceOrForceArray only if nested not Reference, tdf#107724 prep
Change-Id: I14c6a651677fcdcaac943d10f6a0d663bf37aff2
2017-05-10 14:00:31 +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
Jochen Nitschke 959496794c cleanup osl/diagnose.h includes
with command
> git grep -l osl/diagnose.h *.cxx |
  xargs grep -L -w 'OSL_\w*' |
  xargs sed -i '/#include *\(<\|\"\)osl\/diagnose.h\(>\|\"\).*/d'

headers need more work

Change-Id: I906519ebbd47a04703b4fa5943b2f7abea7a97ab
Reviewed-on: https://gerrit.libreoffice.org/37350
Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-09 15:41:46 +02:00
Jochen Nitschke b3eb843766 cleanup tools/debug.hxx includes
with command
> git grep -l tools/debug.hxx |
  xargs grep -L DBG_ |
  xargs sed -i '/#include *\(<\|\"\)tools\/debug.hxx.*/d'

don't change files in includes/ and */pch

Change-Id: Ie429d6a7dca5dfa1073e0f5ba037f7c84bdbec08
Reviewed-on: https://gerrit.libreoffice.org/37349
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-08 08:33:01 +02:00
Caolán McNamara f772812e6b split out the non-translatable strings
Change-Id: Id4c3e9265ae591b938ae43554208823e0cdc06c0
Reviewed-on: https://gerrit.libreoffice.org/37164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-05-03 09:56:48 +02:00