Commit Graph

515 Commits

Author SHA1 Message Date
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
Eike Rathke
2795cb694b add an isPODF() block to ScCompiler::IsOpCode(), tdf#100641 related
... as we can't rename RID_STRLIST_FUNCTION_NAMES_ENGLISH names.

Should we need yet another resource block to differentiate between
PODF/API names and actual always available English names? Ugly but
maybe. A much better approach would be if Text[en-US] would be always
available, additionally to the current localized resource.

Change-Id: If8eaf18643f4e24c811149c52efff1097a3c1596
2016-06-27 17:24:20 +02:00
Eike Rathke
d480e5c7f6 rename *effective to *effect, tdf#100641 related
... to unify naming.

Change-Id: I0964822d53eafd69ea4ed0656dfdfcb3f5bfd561
2016-06-27 16:03:23 +02:00
Eike Rathke
f3f89f4f31 accept EFFECTIVE as EFFECT in OOXML import
Change-Id: I18a914972d69a37e9dcf5b18ffbea9177004dad7
2016-06-27 13:41:33 +02:00
Noel Grandin
f107d45381 Convert SbxClassType to scoped enum
Change-Id: I48afcdd9924d22b52a8db21aa253061e4d38c85b
Reviewed-on: https://gerrit.libreoffice.org/25259
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-23 11:49:32 +00:00
Noel Grandin
aad5eced79 convert SC_COMPILER to scoped enum
Change-Id: Ib8fdce056847b2b2514f61da18c106bb3e78631c
Reviewed-on: https://gerrit.libreoffice.org/25079
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-20 08:06:20 +00:00
Eike Rathke
bc1c92ef41 recognize #REF! particles of invalidated references, tdf#86575 follow-up
... so they result in an invalid reference again producing a #REF! error
instead of a bad string producing #NAME? error.

This way we can handle the invalid #REF!.A1 and similar references that
were wrongly written to ODFF between 2013 and 2016 until 5.1.4

As a benefit, this is now also the case in UI, e.g. when recompiling
changed names with already invalidated references.

Change-Id: I117d709f594b7c37d899528a51220c1855b7817d
2016-05-13 20:08:45 +02:00
Eike Rathke
0c991c5dbf comment the outdated documentation
Change-Id: I6ee52d2d61ebb1763f2f86c467021fc80467601f
2016-05-12 17:35:05 +02:00
Stephan Bergmann
14cd5182c5 Replace fallthrough comments with new SAL_FALLTHROUGH macro
...which (in LIBO_INTERNAL_ONLY) for Clang expands to [[clang::fallthrough]] in
preparation of enabling -Wimplicit-fallthrough.  (This is only relevant for
C++11, as neither C nor old C++ has a way to annotate intended fallthroughs.)

Could use BOOST_FALLTHROUGH instead of introducing our own SAL_FALLTHROUGH, but
that would require adding back in dependencies on boost_headers to many
libraries where we carefully removed any remaining Boost dependencies only
recently.  (At least make SAL_FALLTHROUGH strictly LIBO_INTERNAL_ONLY, so its
future evolution will not have any impact on the stable URE interface.)  C++17
will have a proper [[fallthroug]], eventually removing the need for a macro
altogether.

Change-Id: I342a7610a107db7d7a344ea9cbddfd9714d7e9ca
2016-05-10 16:42:16 +02:00
Eike Rathke
f92a6153ad use passed rErrRef instead of obtaining resource string
Change-Id: I96ae74d8d82468bebcc79cebebf86731685c446f
2016-05-10 13:21:49 +02:00
Eike Rathke
e17b76954c use passed rErrRef instead of obtaining resource string
Change-Id: I3041b0a4f4427bbcbaf07e7a0694e9cfe5d10014
2016-05-10 13:21:48 +02:00
Noel Grandin
9613b49317 clang-tidy modernize-loop-convert in sc
Change-Id: I620028d69b11ea0469efd7b02ac7bbc7edab1066
Reviewed-on: https://gerrit.libreoffice.org/24690
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2016-05-07 12:24:31 +00:00
Eike Rathke
bb0ef99fb9 Resolves: tdf#86575 for OOXML write plain #REF! if deleted parts
Change-Id: Ie3233d72bdbdd0ab82386c98a46755ce64ef3e7f
2016-05-06 17:07:04 +02:00
Eike Rathke
eeb203089f write the [#REF!] as defined in ODFF, tdf#86575 related
... if a part of the reference was deleted, instead of [.#REF!A1]

Actually this is a regression that already can be tracked down to
c54616f62b which changed things to use
ValidAddress() only.

Change-Id: I70f68722d7af02f6da3380c2dd9d54704c20b451
2016-05-06 17:07:04 +02:00
Eike Rathke
cc5f8c6bf0 FindRangeNameByIndexAndSheet() to FindRangeNameBySheetAndIndex()
index,sheet was slightly confusing as we lookup an index within a sheet.

Change-Id: I164dd48187e6652639094e33ca83a91a96c893a0
2016-04-27 21:06:20 +02:00
Eike Rathke
f5523a6ef4 FormulaByteToken(ocClose) was always wrong
... should be FormulaToken(svSep,ocClose) instead. Though it didn't hurt
at the end of a formula where this was generated for auto-correction.

Change-Id: I71bd8270ccc268e645eb60298e84acffe39d3a0d
2016-04-23 22:54:39 +02:00
Eike Rathke
f41257dc99 simplify the ReplaceToken() offset logic to absolute offsets
Change-Id: I8d02fb63bc0c5cb48aabaf7a8800f5f9ac95cbf5
2016-04-23 15:52:35 +02:00
Noel Grandin
789055bc2a clang-tidy performance-unnecessary-copy-initialization
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-18 07:37:31 +00:00
Noel Grandin
cb9bcae7ba clang-tidy performance-unnecessary-value-param in formula
Change-Id: I9f90c55f74216c2f3452e5b30d85b304668330b3
2016-04-11 11:38:58 +02:00
Eike Rathke
3c36ba50f6 Resolves: tdf#98990 accept R1C1 notation entire column/row references
... which consist of only C4 or C[3] without a range operator.

Change-Id: I1865f0ec4c4fec1101b93b6b40d6f26871a65f07
2016-04-05 18:08:36 +01:00
Caolán McNamara
9e087de133 coverity#708016 Uninitialized scalar field
Change-Id: I6ec7614eab32f08596f259ef445a999cbb8b69e8
2016-04-04 10:14:25 +01:00
Noel Grandin
6439005484 use SAL_N_ELEMENTS more widely
found using
   git grep -n 'sizeof.*/.*sizeof.*[0]'

Change-Id: Icd4a6cc1ca8ec8ebd68e1701a02789c74cf0eb2a
2016-03-31 11:30:36 +02:00
Eike Rathke
97269062ca enquote sheet name of other-sheet-local named expressions, tdf#96915 follow-up
Change-Id: I8fde73dc86c29054ec05bbc60e212ae660c78376
2016-03-22 14:02:35 +01:00
Eike Rathke
cf56d2449c adjust other-sheet-local relative sheet references, tdf#96915
... so they still point to the same sheet as if used on the original
local sheet.

Change-Id: Id40378deaf70c1645bfa52ea28aa39775d16aec5
2016-03-18 14:36:28 +01:00
Eike Rathke
64e5424138 Resolves: tdf#96915 implement other-sheet-local named expressions
Change-Id: I0d62536caa6eb455473a755067abc585662cd9a5
2016-03-18 10:37:40 +01:00
Noel Grandin
9704207c38 loplugin:constantparam in formula
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-18 06:01:25 +00:00
Jochen Nitschke
51d0b4037b tdf#84938 Change defines to typed_flags
Put defines into an enum class and use typed_flags template from o3tl
to give them flag operators.

There were some shift operations to apply flags from start references
to end references, these went into a helper in address.hxx to hide
them. A marco with shift operations in address.cxx was rewritten in two
helpers without shifts.
One shift remained in ScRange::Format with a comment.

The other flag untypical operator was a minus 1 in a helper for
ScRefFinder::ToggleRel, which iteratates through all possible
combinations for absolute references. This is used to make referecnces
absolute via SHIFT+F4. A replacement would be too complex.

Change-Id: I4850f1623e01e56c60ac2260b95fc5cad8b6fd71
Signed-off-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Reviewed-on: https://gerrit.libreoffice.org/22840
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-03-12 00:21:29 +00:00
Noel Grandin
fecfd9c498 loplugin:unuseddefaultparams in sc (part2)
Change-Id: I356a86bfca20cbf2c52185697042dce5237e847d
2016-03-03 08:11:02 +02:00
Andrea Gelmini
534b2a4b58 Fix typos
Change-Id: Ice72f8d9971e15dd6ef365e64cd567b8581a92d3
Reviewed-on: https://gerrit.libreoffice.org/21797
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-05 06:48:38 +00:00
Stephan Bergmann
00c62e306f loplugin:privatebase: Publicly derive from binary_/unary_function
Somewhat arbitrarily prefer public over private derivation; ultimately,
derivation from those deprecated (C++11)/removed (C++17) classes should be
removed, anyway.

Change-Id: I5ed24427d37586e72f8c16509cf5002a54af73f1
2016-01-11 13:17:08 +01:00
Andrea Gelmini
64d624b651 Fix typos
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-10 14:17:20 +00:00
Eike Rathke
22e5170af7 create closing bracket token only when necessary
Change-Id: Ifb705279ff01d4c886678a183de0499ec5bb119e
2016-01-05 23:42:08 +01:00