Commit Graph

302 Commits

Author SHA1 Message Date
f7803b302a loplugin:commaoperator
Change-Id: I7ba83b999b3b12411348c21cabcd47b8ad9c4034
2016-07-15 10:53:25 +02:00
fc305bb6d6 strip second parameter from ISOWEEKNUM if literal double != 1.0
For other arguments convert to WEEKNUM_OOO, which now can be saved as
ORG.LIBREOFFICE.WEEKNUM_OOO.

Change-Id: I63fd3df1ec4ccaa535a1437200854d8734544a2c
2016-07-14 23:16:49 +02:00
77ccf8a9ca store WEEKNUM_OOO as ORG.LIBREOFFICE.WEEKNUM_OOO
Now that the previous two releases can read it.

Change-Id: Ie04c7b0fd94f5906b678d738370e4fc0696da79c
2016-07-14 23:13:41 +02:00
908449639b let FormulaTokenArray::RemoveToken() return the actual count of tokens removed
Change-Id: Iebf654e7b4c682036b4ff334298948557b755eac
2016-07-14 22:31:20 +02:00
f9021f7eea re-add FormulaTokenArray::ReplaceToken() that was removed as unused, grml..
with 4ff5a5558472beee85eb1234dcc2aa2ed9000f6c

Change-Id: Id99c3ae74515f24c55a3734698c560dcac8bacd9
2016-07-14 22:26:25 +02:00
d480e5c7f6 rename *effective to *effect, tdf#100641 related
... to unify naming.

Change-Id: I0964822d53eafd69ea4ed0656dfdfcb3f5bfd561
2016-06-27 16:03:23 +02:00
8a6bffd2fe tdf#42949: clean up includes in include/formula with iwyu
Change-Id: Ieb601d98be80aeb2239d4f0a330d90e63f1abc43
Reviewed-on: https://gerrit.libreoffice.org/26398
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-21 07:58:59 +00:00
478613c550 explicit svl::SharedString(const OUString&) ctor
... to prevent accidental surprises. Not interned shared strings
constructed from OUString have mpDataIgnoreCase=nullptr so can't be used
for case insensitive comparison.

Change-Id: I03323354298a73e93b18d2796ec447c072fdefa5
2016-06-14 13:33:35 +02:00
189f2e52b8 assert on FormulaToken::GetDouble() virtual dummy
Change-Id: Ic31c2b943dcc6dfdaaefe3daa120c91cf29ce0e7
2016-06-10 14:12:59 +02:00
2b6710c2b5 check for svDouble when stripping DCOUNT/A argument, tdf#70806 follow-up
Change-Id: Ic7897b5240f9f3f66eb71485ef9eed4fa8ce87e1
2016-06-10 12:57:26 +02:00
a43529886f Fix ambiguous calls
Change-Id: Ia115185b615f86a49004133e00211c197b61db7b
2016-06-09 08:57:15 +02:00
333b644d11 assert on "forgot to add a jump" for OpCode
Change-Id: I6c430b8a4079cd0d74e5c9e71a3f7b5b638d4ef5
2016-06-08 22:49:03 +02:00
1ec01a340a introduce FormulaTypedDoubleToken to carry type information of a double
Change-Id: I88b4964ca95eefa41d415ed66fc106c834a686b6
2016-06-08 12:13:23 +02:00
7a2bca302f cid#1362174, 1362177: USE_AFTER_FREE+resource leak due to copypasta
Change-Id: Icd903335fdef3921781e2f16e98a0e10bda31e3f
Reviewed-on: https://gerrit.libreoffice.org/25641
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-05-30 00:32:03 +00:00
3129b75fca strip 0 argument only if not part of an expression, tdf#70806
Change-Id: Ia1f986a594194a1c564d815bbe2faa987eea971a
2016-05-27 21:58:48 +02:00
a88ee01b86 omit DCOUNT or DCOUNTA 2nd argument if 0 when writing ODFF or OOXML, tdf#70806
Change-Id: I2833a1005c6941e66a09172b337e23b0bf7f2002
2016-05-27 18:09:21 +02:00
74713b34a3 loplugin:unusedmethods
Change-Id: Ib36bc0e87d00abb638cbfec511cd13b6179eabda
Reviewed-on: https://gerrit.libreoffice.org/25431
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-26 07:50:33 +00:00
d4d2fc2479 clang-tidy modernize-make-unique
Change-Id: I550bb69ddcef69906027516ccde62cf8e87c295b
Reviewed-on: https://gerrit.libreoffice.org/25138
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-19 08:33:10 +00:00
2c8fe2e737 update unusedmethods plugin to deal with constructors
and fix the operator< implementations in some of the other
plugins too.

Change-Id: Ie5631e0cdc8d2a994ad2af2533cdb558a6cfc035
Reviewed-on: https://gerrit.libreoffice.org/25057
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-18 10:03:44 +00:00
edd4370f5b check presence of token, tdf#96426 follow-up
Change-Id: I4c368dfd113b02d208013b4ba79dff606769a150
2016-05-02 20:39:45 +02:00
b79d226017 Revert "crashtesting: fix ooo123540-1.xlsx etc"
This reverts commit bfca69eddd3d94e74d6b73f91476b79c8f72cce7.

Rather let the caller check for a valid token instead of checking it
twice for other places that already do, and we usually need two valid
tokens before even one call makes sens.
2016-05-02 20:05:11 +02:00
a2565e067b crashtesting: fix ooo123540-1.xlsx etc
Change-Id: I178c3e5818f4538bc306694115bc3d1cbe95513e
2016-04-30 21:16:43 +01:00
5e4fc95409 clang-tidy modernize-loop-convert in f*
Change-Id: Id866aa244378758e3bdb9e99d02cdd2ae6104e16
2016-04-27 15:03:40 +02:00
e8fd5a07ec update loplugin stylepolice to check local pointers vars
are actually pointer vars.

Also convert from regex to normal code, so we can enable this
plugin all the time.

Change-Id: Ie36a25ecba61c18f99c77c77646d6459a443cbd1
Reviewed-on: https://gerrit.libreoffice.org/24391
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-26 10:55:58 +00:00
0c5663cfb1 first range can be anywhere before second at RPN end, tdf#96426 follow-up
... not just adjacent to the one at the end. So we actually can handle
INDIRECT("A2:C2") INDIRECT("B1:B3")

Change-Id: Ie8030ebc13bb1ae2246611f5722da97970b8c544
2016-04-24 00:11:08 +02:00
0f8a8332a5 more differentiated significant whitespace recognition, tdf#96426 follow-up
Change-Id: I081409a82a9ff64f163115bf4597afbb9b2f5fa6
2016-04-23 22:35:31 +02:00
e0875f8e34 narrow down where a space could be an intersection, tdf#96426 follow-up
Change-Id: Ic53a4a0d19a11298895efb28e2786e48a071e72b
2016-04-23 20:42:18 +02:00
b0992e1190 fully check for adjacent RPN end, tdf#96426 follow-up
Change-Id: I886e559c6f6041bf4889fdd6d89c12a10be70e5f
2016-04-23 20:24:46 +02:00
4f8d72d068 use FormulaToken::DeleteIfZeroRef() instead of Delete() at some places
The array overflow detecting places that unconditionally deleted the
token in case of overflow should do so only if no reference is held,
i.e. the token was allocated with new and passed immediately without
being assigned to a FormulaTokenRef. Just to be on the safe side.

Change-Id: If2ccabec3725ac73fe82c23f51a291246847cfdb
2016-04-23 17:28:27 +02:00
26adceb098 Resolves: tdf#96426 significant whitespace as intersection in Excel syntax
Also when reading/writing OOXML, so change SC_OPCODE_INTERSECT of
RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML accordingly to " ", where
previously "!" was expected and written, which was plain wrong.

Change-Id: Ic0cfd7afc657f07bfd8e37de61b3621cc68685ff
2016-04-23 15:52:35 +02:00
f41257dc99 simplify the ReplaceToken() offset logic to absolute offsets
Change-Id: I8d02fb63bc0c5cb48aabaf7a8800f5f9ac95cbf5
2016-04-23 15:52:35 +02:00
9185f889ed newline shortage
Change-Id: Id2487480270bb2be765495bb6d5982c85ae2117f
2016-04-23 15:52:34 +02:00
737040e5db change multiple ifs to switch case
... obtaining mpToken->GetOpCode() only once.

Change-Id: I909fef97540998a7f09115738fb76a1e963480bf
2016-04-23 15:52:32 +02:00
4c5932cf06 join two lines that cause an annoying debugger step over experience
Change-Id: I50bf6710f7319f5c2ea18d8a3aa02f5c613de063
2016-04-23 15:52:31 +02:00
cb9bcae7ba clang-tidy performance-unnecessary-value-param in formula
Change-Id: I9f90c55f74216c2f3452e5b30d85b304668330b3
2016-04-11 11:38:58 +02:00
62967a0afc get rid of a TODO comment
Checked if the < is correct. It is.
Calc function Choose has 1 index argument plus up to 30 value-arguments,
so the maximum argument count is 31.
FORMULA_MAXJUMPCOUNT is 32.

Change-Id: I0bc8cc122902848dadfc92d56b6f06fbec43e4be
Reviewed-on: https://gerrit.libreoffice.org/23794
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-04-04 07:25:56 +00:00
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
64e5424138 Resolves: tdf#96915 implement other-sheet-local named expressions
Change-Id: I0d62536caa6eb455473a755067abc585662cd9a5
2016-03-18 10:37:40 +01:00
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
2437ccd3e9 loplugin:unuseddefaultparams in formula
Change-Id: I7f0baa2709db24e8299f0e1c19c0703aee1cbf4f
2016-03-03 11:15:52 +02:00
c45d3badc9 new loplugin: commaoperator
Change-Id: I03f24e61f696b7619855e3c7010aa0d874e5a4ff
2016-02-23 08:08:56 +02:00
05d2684840 tdf#43157 Cleanup DBG_ASSERT for formula module.
Change-Id: I1be9332b4408b3c28aacfa872d63fce67adcb1fe
Reviewed-on: https://gerrit.libreoffice.org/21958
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-02-18 19:52:14 +00:00
a238b1f8d3 Remove excess newlines
A ridiculously fast way of doing this is:

for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \
  --exclude-dir=workdir --exclude-dir=instdir '^
{3,}' .)
do
    perl -0777 -i -pe 's/^
{3,}/

/gm' $i
done

Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c
Reviewed-on: https://gerrit.libreoffice.org/22224
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-09 08:18:05 +00:00
4ff5a55584 loplugin:unusedmethods
Change-Id: Ib2dc804f55d1a96ae01f2cf31b7d55956040a72e
Reviewed-on: https://gerrit.libreoffice.org/21603
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-20 08:13:51 +00:00
0078512eda loplugin:unusedmethods unused return value in include/formula
Change-Id: Ic5d6c11d955ef5ef53dea0bb4e5bec8167874a91
2016-01-12 10:37:20 +02:00
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
7994b77819 tdf#96198 postpone conversion from WEEKNUM to ISOWEEKNUM, tdf#50950 follow-up
Have two releases be able to read ISOWEEKNUM first.

Change-Id: I7ea8141043d18076a65396374dec40a806c8ab6a
2016-01-07 19:37:09 +01:00
4ae7b66286 use new'ed FormulaToken and FormulaTokenArray::Add()
... instead of a temporary instance and AddToken() that just clones it
again.

Add function comment describing the difference.

Change-Id: I3f089965d394b33d7bbbb9a1c3f69dc1c4182fd2
2016-01-05 23:42:07 +01:00
c3d2313eca for new'ed FormulaToken use FormulaTokenArray::Add()
... instead of AddToken() that just clones it again.

Change-Id: I99b02b0924d0a0c070435501f8ecd45f030e9c2c
2016-01-05 22:18:24 +01:00
902c593196 tdf#96198 add WEEKNUM_OOO compatibility function, tdf#50950 follow-up
The remaining cases when loading old and wrong ISOWEEKNUM that can't be
mapped to either new WEEKNUM or ISOWEEKNUM now are mapped to
WEEKNUM_OOO(date,mode) with calculations identical to the old and wrong
OOo WEEKNUM.

These WEEKNUM_OOO cases are still wrongly saved as ISOWEEKNUM so can be
read by 5.0 or earlier versions as the old WEEKNUM, which should be
changed for 5.3 or later.

WEEKNUM_OOO is not offered in the Function Wizard to prevent deliberate
usage.

Also reverts the interim unit test change to
sc/qa/unit/data/contentCSV/date-time-functions.csv
that was necessary to catch the error generated by ISOWEEKNUM with two
arguments.

Change-Id: I874c4c7225900f03b879f2947512ae02270cbd4f
2016-01-05 19:29:17 +01:00