Commit Graph

265 Commits

Author SHA1 Message Date
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
1ec01a340a introduce FormulaTypedDoubleToken to carry type information of a double
Change-Id: I88b4964ca95eefa41d415ed66fc106c834a686b6
2016-06-08 12:13:23 +02:00
77d5491e15 loplugin:unusedmethods
Change-Id: I08e9bb65b2530148b80c67f01d51e594fc698acb
Reviewed-on: https://gerrit.libreoffice.org/25543
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-30 06:34:42 +00: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
07f1a39509 (nearly) nothing uses GetUniqueId anymore, so remove it.
The odd one out is the usage in Formula, which attempts
to restore focus to a particular window identified by
an unique id. In this case restore focus by keeping a VclPtr
to the desired window.

Change-Id: I1dc335325c109d75745c6bba2e12662e6ae50638
2016-05-25 14:24:20 +01:00
8a2149c105 clang-tidy misc-assign-operator-signature
Change-Id: I2953a88d9e2f5923732865ef17615d5928ac5f5f
Reviewed-on: https://gerrit.libreoffice.org/25154
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-20 07:55:30 +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
c57dc741a6 tdf#97831 [part] Add Excel 2016 functions to Calc
Functions MINIFS and MAXIFS

Change-Id: I4bd2e8b82f8377af81f4373d0c33ac286588b8df
Reviewed-on: https://gerrit.libreoffice.org/24619
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-05-04 21:54:01 +00:00
fa507ae23e Replace namespace ScErrorCodes with formula...
and remove that 'using namespace' statement in the header...

Change-Id: I2f994af5088ce6d1ffe92c8d36285a4f6fdd2248
Reviewed-on: https://gerrit.libreoffice.org/24628
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
2016-05-04 02:23:30 +00:00
29433c6496 tdf#97831 [part] Add Excel 2016 functions to Calc
Functions IFS and SWITCH.

Change-Id: Ic43d42a933bcac883e9aa2213dd4ddeddf45abf0
Reviewed-on: https://gerrit.libreoffice.org/24424
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-05-03 16:10:12 +00:00
a76c5e2137 tdf#97831 [part] Add Excel 2016-Office 365 functions to Calc
Functions CONCAT and TEXTJOIN.

Change-Id: I38092f77df719d11f6746ac10fe14dc53b7e93e7
Reviewed-on: https://gerrit.libreoffice.org/23601
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-04-26 15:08:22 +00: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
7756822206 alignment
Change-Id: If7dbdcd93a43d4e14f853b7d3436fa31c0091403
2016-04-23 15:52:33 +02:00
86d20ae1e5 loplugin:passstuffbyref in formula
Change-Id: I6a46110c6d0092b21e7b3a0245ccf11ca7ccac85
2016-04-13 13:27:52 +02:00
cb9bcae7ba clang-tidy performance-unnecessary-value-param in formula
Change-Id: I9f90c55f74216c2f3452e5b30d85b304668330b3
2016-04-11 11:38:58 +02:00
c20cc7e79b tdf#97499 Fixed containers parameters clearing #4
Change-Id: I7c96181399f4d7e62d4aceca404b22d68f903513
Reviewed-on: https://gerrit.libreoffice.org/23754
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-04 05:49:06 +00: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
f803aae0f3 loplugin:constantparam in formula
Change-Id: I18246d34d27f1b12dfd107166b31ef16d9632462
2016-03-10 10:09:58 +02:00
b3253b2bdc remove unused errInterpOverflow
Change-Id: Iaac45af141220f5a7460b7313507d3927a2b2581
2016-03-07 20:33:41 +01:00
36483fde78 introduce a dedicated errMatrixSize
... to distinguish from other errors, and really, errStackOverflow
should mean exactly that.

Change-Id: I3d2bfbd38b056c7d0a346797db560717312de069
2016-03-07 20:33:40 +01:00
f336f63da9 tdf#94635 Add FORECAST.ETS functions to Calc
Change-Id: Ifbfff1c27fb3960a06f467630da0fa39665f0ce4
Reviewed-on: https://gerrit.libreoffice.org/20073
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-03-03 16:28:59 +00:00
2437ccd3e9 loplugin:unuseddefaultparams in formula
Change-Id: I7f0baa2709db24e8299f0e1c19c0703aee1cbf4f
2016-03-03 11:15:52 +02: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
ac00b3c256 tdf#88737 handle temporary array formula matrix circular reference
This does not solve the difference in how Excel seems to handle the
arguments and calculation, but some corner case. See bug comment 6.

Change-Id: Ifa331e8552587c40e1486a08093ed0df92a9d245
2016-01-19 00:34:17 +01:00
79b46d5fad sal_math_Double is already a union containing a double member
Change-Id: I6e753bc0c5967ed07f162b0baa2daca4499953be
2016-01-18 19:27:35 +01:00
0078512eda loplugin:unusedmethods unused return value in include/formula
Change-Id: Ic5d6c11d955ef5ef53dea0bb4e5bec8167874a91
2016-01-12 10:37:20 +02:00
8aee44c94f Function Wizard: don't overwrite an unlisted function
* in a spreadsheet cell enter =LOG(foobar(SIN(1)))
* invoke Function Wizard on that cell (Ctrl+F2)
  LOG(foobar(SIN(1))) is marked in Formula edit field
* activate Functions page
  LOG(foobar(SIN(1))) is marked in Formula edit field
  Function LOG is selected
* click Next button
  foobar(SIN(1)) is marked in Formula edit field
  Function ABS is selected
* click Next button
  foobar(SIN(1)) is overwritten with ABS( )
* only Cancel solves the problem

foobar() could be any user defined or macro function that have no
function description in the Formula Wizard.

Change-Id: I1cb69a9e38c0b8f251d783bd0f67b4b24ade50d0
2016-01-09 13:33:31 +01:00
077cc9fbaa prepare for hidden flag in function description for Function Wizard
Change-Id: Ic018ea5b962a66b6543e57d9cc1d44711e51de6e
2016-01-09 13:33:30 +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
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
2f79244cb3 tdf#96198 detect old ISO/WEEKNUM usage with two arguments, tdf#50950 follow-up
5.0 and earlier implemented WEEKNUM(date,mode) with mode!=1 such that
effectively an ISO 8601 week number was calculated. WEEKNUM was wrongly
saved as ISOWEEKNUM (even with two parameters though it is defined to
have only one) so that when reading it we can try to detect a literal
double argument for mode and if it is not 1 remove it to keep
ISOWEEKNUM(date) instead of calling WEEKNUM(date,mode) which wouldn't
match.

A further change to 5.0 to accept also only one parameter in
WEEKNUM(date) and for this default the mode to not 1 for ISO week will
yield forward compatibility.

Change-Id: I88de7dd809d69b6826a190505d2a1dd3fe79c90b
2016-01-05 12:10:02 +01:00
dc89367a56 Formula Wizard: evaluating expressions always in matrix context is wrong
Change-Id: I276f7bbf2bd6fa7c67d8691634ad9d79e4a08b1c
2015-12-18 23:28:14 +01:00
4eea9f2146 handle varargs with first required and subsequent optional, tdf#71459 related
Change-Id: I56c66f516ba2a2e12cab4848c8c352315f27b3bb
2015-12-17 15:14:43 +01:00
db1e34aecd add RAWSUBTRACT spreadsheet function, tdf#71459
Change-Id: I2ae13771c85044b771e253a8189a30cb4aecb30f
2015-12-17 15:14:43 +01:00
dad412e07f Resolves: tdf#95440 SharedString are interned per document, re-intern
... if literal strings are copied with formula expression tokens.

Change-Id: I13526907bb6c2c605c6ed9584fa6e3f2b18623b8
2015-12-15 17:50:21 +01:00
6b203d5050 formula: fix build, undef Idle
Change-Id: If256bba5d8207a955c06713db7141831b53324c7
2015-11-26 15:23:58 +01:00
eedcc2c45c cosmetics
Change-Id: Ic06bef4c80426b97a2613fe296ae0aa0ee55a215
2015-11-18 21:02:07 +01:00
270f8ea48b rename FormulaToken HasForceArray to IsInForceArray
... to name it was it does and to distinguish from
ScParameterClassification::HasForceArray(OpCode) which IS about a
function having ForceArray parameters.

Change-Id: I8af4e1d0353cdb5ad0a9b837ae0763dc77242734
2015-11-18 21:02:06 +01:00
49257e1da7 Resolves: tdf#95670 propagate ForceArray per parameter
Regression of b5cd11b4b02a85a83db77ba9d8d1763f0cd88cb1

It was always wrong to propagate ForceArray already if a function had a
ForceArray parameter *somewhere*, we need to do this per parameter
instead.

Change-Id: If188d45366279d9a7bf641edc7e4dd7095d6d035
2015-11-16 13:25:49 +01:00
e5b721a14c loplugin:nullptr (automatic rewrite)
Change-Id: Ib336ce9bc95f5c84dd6412ff3c098e68c5b0f4ff
2015-11-10 10:31:26 +01:00
5d5c4686ba remove boost::noncopyable from /include
Change-Id: I9fa22b06fabf79043ebc68be7afebc6e810f4db1
2015-10-29 08:51:55 +02:00
fd9d9976bf fix includes that are not stand-alone
includes should be able to be included on their own
fix some of the ones that do not respect
that rule.

Change-Id: Id161224a1978461d3cea43252f232f18888a4f61
Reviewed-on: https://gerrit.libreoffice.org/19612
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
2015-10-26 21:04:30 +00:00