Commit Graph

546 Commits

Author SHA1 Message Date
Stephan Bergmann
3e1d3c25e0 loplugin:includeform: sc
Change-Id: I2ed763e0584a188032c80fde60890de3c6985cbd
2017-10-23 22:45:57 +02:00
Caolán McNamara
157bef79c1 ofz: avoid config
Change-Id: I1fa1c2cb9c755822c2a80453ac3f0424f2c91ffe
2017-10-23 10:09:11 +01:00
Noel Grandin
b6819a53c0 clang-tidy modernize-use-emplace in sc
Change-Id: Ifc38e1fc188fe957a0c717aec19cdd6637e4c658
Reviewed-on: https://gerrit.libreoffice.org/42183
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-12 09:42:55 +02:00
Noel Grandin
3eb5ab6efe loplugin:constparam in sc part3
Change-Id: I8abc44b9f0bcd5e39fd8a94abafaf80aadcd26ca
Reviewed-on: https://gerrit.libreoffice.org/41496
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-24 10:54:06 +02:00
Noel Grandin
53d0a6deff loplugin:constparam in sc part2
Change-Id: I4fd18096d7d22d8c146a2437906187d5df1cb268
Reviewed-on: https://gerrit.libreoffice.org/41447
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-23 14:59:04 +02:00
Noel Grandin
9881bea8d4 remove unnecessary use of OUString::getStr
Change-Id: I3d13e1c0bb6aa4a7aacc463198747c1368ebc9b4
Reviewed-on: https://gerrit.libreoffice.org/38114
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17 11:55:13 +02:00
Caolán McNamara
aa529a1957 ofz: survive missing macro support
Change-Id: Ica9c66fe09f7340f76f62e536527dc63b3735d90
2017-07-28 11:53:46 +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::resource::OfficeResourceLoader
      com::sun::resource::XResourceBundleLoader
      com::sun::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
Noel Grandin
d8e5a0db64 use more OUString::operator== in sc
Change-Id: I1a7691fe59e5e93c15bd812f03366da814f9f3db
Reviewed-on: https://gerrit.libreoffice.org/39900
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-14 09:10:59 +02:00
Noel Grandin
868d8c8f0f loplugin:unnecessaryparen handle parens inside call expr
stick to single-arg function calls, sometimes parens in multi-arg calls
might be there for clarity

Change-Id: Ib80190c571ce65b5d219a88056687042de749e74
Reviewed-on: https://gerrit.libreoffice.org/39676
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-07 10:45:05 +02:00
Noel Grandin
9f4421039a loplugin:unusedfields in sc part3
Change-Id: I7323e8644e5d336d52fa21b063264b0847b5e780
Reviewed-on: https://gerrit.libreoffice.org/39064
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-04 12:52:35 +02:00
Jochen Nitschke
c4ddf6cd6d C++11 remove std::unary_function bases from functors
std::unary_function is deprecated since C++11 and removed in C++17

90% done with regexp magic.
removed obsolete <functional> includes.

The std::unary_function base class was used in 3 places:
* chart2/source/tools/DataSeriesHelper.cxx: lcl_MatchesRole
   is used in a std::not1 function helper who uses the members
   return_type and argument_type.
   - replace deprecated std::not1 with a lambda
* chart2/source/tools/ModifyListenerHelper.cxx:
   lcl_weakReferenceToSame used the argument_type member in the
   operator() parameter.
   - inline the parameter type.
* xmloff/source/chart/SchXMLExport.cxx: lcl_SequenceToMapElement
   used result_type and argument_type in operator().
   - inline the types

Also fix compile error with gcc about finding std::for_each.

Change-Id: I073673beb01410c3108e7d0346d9e7d6b9ad2e2f
Reviewed-on: https://gerrit.libreoffice.org/39358
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-07-03 12:21:03 +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
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
Jochen Nitschke
709040e0ad remove duplicate 'using namespace'
Change-Id: I7f8828f677cfb588135ff75c03ffb75895773440
Reviewed-on: https://gerrit.libreoffice.org/38201
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-30 21:15:03 +02:00
Caolán McNamara
7be3b5b8ba coverity#1409898 Dereference before null check
Change-Id: I44b5ab0c66b4050c2ee47684af7526e2543945ca
2017-05-26 12:23:18 +01:00
Noel Grandin
ed5abacda9 drop the SCsROW/SCsCOL/SCsTAB typedefs
which are exactly the same as the regular SCROW/etc typedefs, and have
been this way since
    commit 43a21999a9
    Author: Oliver Bolte <obo@openoffice.org>
    Date:   Fri Jun 4 09:00:39 2004 +0000
    INTEGRATION: CWS rowlimit (1.1.2); FILE ADDED

Change-Id: Ia7f75d71227ca3167b5fd56019bb9bdf0697d1b0
Reviewed-on: https://gerrit.libreoffice.org/37911
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2017-05-23 11:20:43 +02:00
Noel Grandin
d1e47b1428 enhance useuniqueptr loplugin
teach it to look for the following sequence in a destructor:
    delete m_pfoo;
    m_pfoo = nullptr;

Change-Id: Icd6271a63a024e32b53cc9e599f8f59952160380
Reviewed-on: https://gerrit.libreoffice.org/37900
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-23 09:31:20 +02:00
Stephan Bergmann
dc4704ce1b loplugin:stringcopy: sc
Change-Id: Ic6cb5406d20e7e07b8e34514df71adf1c3a4e727
2017-05-19 17:17:29 +02:00
Eike Rathke
47a0e1554a Always set a grammar when constructing ScCompiler
Otherwise mxSymbols is null, which is rather unexpected as the past has shown,
see commit 63843a9726

Change-Id: Id4c13a5f50e711513a71a7d6cd6f87b4112b1f1d
2017-05-18 15:02:50 +02:00
Eike Rathke
730622df7c assert instead of OSL_ENSURE if grammar is GRAM_UNSPECIFIED
Change-Id: Ie23a5a98e9bc6dfbd5d685c482fb358ac3822845
2017-05-18 15:02:50 +02:00
Eike Rathke
f39e1b1079 Change IsForceArrayParameter() to GetForceArrayParameter(), tdf#107724 prep
Change-Id: Icd3400e4ee1c69860908a2ad0ca6e52879f2f725
2017-05-10 00:39:58 +02:00
Eike Rathke
8ba4679c96 Move ScParameterClassification::Type to formula::ParamClass, tdf#107724 prep
To be able to later differentiate specific types in the compiler.

Change-Id: If97485c0cb8e8e2e129c61cd3f01d9d420c92c8d
Reviewed-on: https://gerrit.libreoffice.org/37439
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-05-09 22:34:18 +02:00
Stephan Bergmann
a5993e4141 loplugin:salunicodeliteral: sc
Change-Id: I7f63388d3c0214be8f69095fe5ec0030df59a416
2017-04-28 18:26:56 +02:00
Noel Grandin
3a8ef92bc0 clang-tidy readability-simplify-boolean-expr in sc
Change-Id: I702e52e56487f201b9e0d7af21ff8167464aa58c
Reviewed-on: https://gerrit.libreoffice.org/36876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-24 11:41:21 +02:00
Eike Rathke
88d3d27dcd remove unnecessary temporary
likely a remnant of (Uni)String to OUString

Change-Id: I431723d7c390f1396855f91c26a9b72a417f7dbc
2017-04-19 13:56:12 +02:00
Jochen Nitschke
1ed1b639fc remove redundant OpCode casts
Change-Id: I75389b213ebf74aa35f935134e4f8122d28d2045
Reviewed-on: https://gerrit.libreoffice.org/35996
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-04-01 11:03:38 +00:00
Stephan Bergmann
6291574d94 Remove unused #include <ctype.h>
Change-Id: I8bf3e30687e20151a9e1936e69362abfe9b3a99d
2017-03-23 17:55:31 +01:00
Noel Grandin
bfde4866e0 convert DecodeMechanism to scoped enum
Change-Id: I5c56634b1bca8e37fa73d02d2428645301b6c547
2016-12-05 12:49:02 +02:00
Bartosz Kosiorek
5a4e106be6 tdf#42949 Remove not needed uno headers from sc/source/core
Change-Id: I1fd2b647caaa947390443ec41591a7ea050c4819
Reviewed-on: https://gerrit.libreoffice.org/31046
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-11-21 23:05:53 +00:00
Noel Grandin
442eacc4e1 loplugin:countusersofdefaultparams in sc(part1)
Change-Id: Ia2b0174654fad536ee23f6174a0b38b1843a4aa5
Reviewed-on: https://gerrit.libreoffice.org/30427
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-31 10:03:24 +00:00
Eike Rathke
a6628078a9 sc: OOXML: actually write both sheet names in external 3D references
... instead of twice the same name. Even if not handled yet in Calc, external
3D references may get imported and have to be written again.
Copy&Paste error since 2f373570c5

Change-Id: I6cb982793e1072d619053c02860a8046e78bc99e
2016-10-27 13:31:33 +02:00
Eike Rathke
02af87fdd7 Resolves: tdf#103531 OOXML: write external file ID within quoted sheet names
Excel expects '[1]Sheet Name' instead of [1]'Sheet Name' and complains if it
encounters the latter.

Fortunately Calc handles both.

Change-Id: If1129e58725b522ca4755c05e313c03fca065f28
2016-10-27 12:52:34 +02:00
Noel Grandin
6581152f03 loplugin:expandablemethodds in sc
Change-Id: Idda64b23ea91ec457b60279d851b7f01d8c02881
Reviewed-on: https://gerrit.libreoffice.org/30033
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-19 08:35:32 +00:00
Kohei Yoshida
e944d95104 tdf#93894: Prohibit grouping when certain token types are present.
For instance, column / row label tokens don't work correctly in
grouped cells with the current implementation.

Change-Id: Idf86312ef15fbfd4382aa90ee6d131c671a80683
2016-10-18 20:27:16 -04:00
Eike Rathke
16fd5a6e7d propagate original named expression error, if any
... instead of substituting with NoName error.

Change-Id: Id80f46f0f4c17a0fd06abdf821d1cf5ca5d7a3ec
2016-10-12 21:13:12 +02:00
Eike Rathke
d3645961d9 create NoName error token instead of setting error at the token array
... when handling name token. This can happen when importing BIFF .xls and the
original range is not present in the document. The document is broken, but such
formula can continue to work if the range expression was not actually executed,
for example IF(TRUE(),then_good,else_bad_range) where else_bad_range is #NAME?
error.

Change-Id: I823ac89115418cf5069b2baf5c5de2c814319ae7
2016-10-12 19:48:55 +02:00
Kohei Yoshida
7da2f3ce9f tdf#93894: Get column labels to work with formula groups.
Change-Id: Ia2a09981dceae2e9809c76570300de8ca1927c1b
Reviewed-on: https://gerrit.libreoffice.org/29514
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
2016-10-04 03:49:40 +00:00
Noel Grandin
3e22dfa5eb convert formula error codes to scoped enum
Change-Id: I5ff214bf1ec9031e30344bc125bc99916fd11bfb
Reviewed-on: https://gerrit.libreoffice.org/28897
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-09-23 15:22:38 +00:00
Eike Rathke
a8a8ff59c5 sc-perf: tdf#79023 do not call SvNumberFormatter also for numbers in OOXML
Change-Id: Ib565687bff2205da0213f6d523dd2bc42c96ad47
2016-09-20 22:38:43 +02:00
Eike Rathke
73c7e0921d sc-perf: tdf#79023 for ODFF do not call SvNumberFormatter to determine numeric
Speedup of this particular function and callees by factor 33 ...

1000 calls for =12345.6789 and =123.456 alternating:

Before:
Ir       Irpc  Callee
9859177  9859  ScCompiler::IsValue
6246858  6246  SvNumberFormatter::IsNumberFormat
3496261  3496  SvNumberFormatter::GetStandardIndex

After:
 298000   298  ScCompiler::IsValue
 248000   248  rtl_math_uStringToDouble

Change-Id: I36eac8c5fe1b1cbf34dfb480c9e7ca6607769364
2016-09-20 21:50:52 +02:00
Stephan Bergmann
d488a646b5 loplugin:stringconstant: adapt to improved OUStringLiteral1 (sc)
Change-Id: I41af3d6acdb5dfdaa27febf99cc3c5aa031ad779
2016-08-30 15:28:44 +02:00
Stephan Bergmann
5536aea822 Let OUStringLiteral1 take its arg as ctor arg, not template arg
...which makes it more flexible, can now also be used on non-const arguments.
The drawback of the argument no longer being a compile-time constant is remedied
by making the ctor constexpr.

Change-Id: Ia4903a2cc86791fece92eac0cb8406b6659dd19d
2016-08-30 07:43:52 +02:00
Noel Grandin
86c0ce4d46 loplugin:countusersofdefaultparams
Change-Id: I26f46ddac3d7d810ebfa1c3e7f1a77427369828e
Reviewed-on: https://gerrit.libreoffice.org/28451
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-29 08:41:53 +00:00
Eike Rathke
f551477ab3 handle overwriting of symbols/opcodes in symbol map for known cases
This silences the SAL_WARN_IF like
warn:formula.core:6944:1:formula/source/core/api/FormulaCompiler.cxx:625:
OpCodeMap::putOpCode: reusing OpCode 161,
replacing '_xlfn.ORG.OPENOFFICE.ERRORTYPE' with 'ERRORTYPE'
in English map 0x1018000

that occurred during the first load of OOXML .xlsx documents since the
old bad entries were added with commit
89c4a69103

In fact the direction opcode -> string was replaced, which it should had
not. That specific mapping is only used though when loading msoxl
namespace formulas from ODF.

Also, the replacement of parameter separator and array column and row
separator worked merely by chance, depending on in which order the
entries where inserted to the hash map. Fixed along as it popped up with
the new handling.

Change-Id: I88017a8b38ccc30874c3dca7d78f0fa47a77a36f
2016-08-26 16:46:12 +02:00
Andrea Gelmini
8278be9860 Fix typos
Thanks to Carlo Bertoldi for the german translation.

Change-Id: I76f554e757318aed4e28b5a05fae0ba15bd46afb
Reviewed-on: https://gerrit.libreoffice.org/27355
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2016-07-22 21:45:22 +00:00
Eike Rathke
69a3f884a5 yet more functions to save with prefix and namespace to OOXML
MULTIRANGE, GOALSEEK, EASTERSUNDAY, CURRENT and STYLE are LibreOffice /
OpenOffice.org only and need a _xlfn.ORG.OPENOFFICE. prefix and namespace when
saved to OOXML.

Change-Id: Ie5d4eb14b1ec958f9ebec5f149d0d1d7b4dd644e
2016-07-14 20:25:36 +02:00
Eike Rathke
feef105196 save ERRORTYPE as _xlfn.ORG.OPENOFFICE.ERRORTYPE to OOXML
Was wrongly saved as ERRORTYPE without _xlfn. prefix and namespace.
Be able to still read ERRORTYPE.

Change-Id: Ia028fe06d930f60b4260adf589ee3190b90ea099
2016-07-14 18:19:00 +02:00
Eike Rathke
633413a37e Resolves: tdf#100768 accept empty missing argument also for first parameter
... and let the interpreter decide about validity. Only if at least two
parameters are given, empty/omitted or not.

Change-Id: I2d7070e56f616b1940ff577c43e257eabb81b412
2016-07-13 01:11:07 +02:00