Commit Graph

316 Commits

Author SHA1 Message Date
1276e95193 tdf#103088, improve interoperability with Excel for LOGNORMDIST().
Change-Id: I5f4ccbb54b212247a3ff8b13ff012c930d18a86c
Reviewed-on: https://gerrit.libreoffice.org/30020
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-10-26 11:13:09 +00:00
536258758a tdf#103186, make LOGINV ODFF1.2 compliant.
(Also retain Excel-interoperability and backward compatibility with Calc.)

Change-Id: Ibbe7224eabfb776cf6e7ecfeabae6d188178f4ed
Reviewed-on: https://gerrit.libreoffice.org/29885
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-10-24 12:08:33 +00:00
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
cf43ff5262 tdf#102948 Make HYPGEOMDIST ODFF1.2 compliant.
Also reduce duplicate code.
On Export to OOXML, HYPGEOMDIST is converted to HYPGEOM.DIST.

Change-Id: I70a70ee6b5c542e272ef574073ebcd1924f31083
Reviewed-on: https://gerrit.libreoffice.org/29767
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-10-14 15:23:57 +00:00
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
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
89c4a69103b6e15e7f52401c51110b926c3ccf36

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
fa2fdb6607 rename ocConvert to ocConvertOOo and related
... to clarify that this is not the "real" CONVERT function.

Change-Id: Ia71949ffabd2c983be0dbf9fa36bb8c52f0077ee
2016-08-03 18:57:37 +02:00
4afd35f691 use GRAM_API instead of GRAM_PODF_A1 in API context
... which right now is identical but may get corrections in future.

Change-Id: Id4e1707afb32a3d8e073705072e5e65105f2a14a
2016-08-03 15:16:50 +02:00
f21a73bc5b InitSymbolsAPI() for FormulaLanguage::API
Change-Id: I203557ed50d0d54fe9977e3d51e7f979551b472b
2016-08-03 15:16:50 +02:00
41eb7eef76 introduce formula::FormulaGrammar::Grammar::GRAM_API
Change-Id: Iceaf114847129f0b014ffd61d547e131baf1f07b
2016-08-03 15:16:50 +02:00
a859c37ee0 introduce mxSymbolsAPI and InitSymbolsAPI()
Change-Id: I1c4673a25bb0f686e0705f87318a04166e6688bb
2016-08-02 00:25:35 +02:00
fc5342fb30 InitSymbolsPODF() from RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF
Change-Id: I03f8d183303b869a4cfaa76ea4170da95574e5d5
2016-08-02 00:25:35 +02:00
28a63715f4 keep a broken expression as originally broken
The invalid expression ISOWEEKNUM(A1,0+) lead to a replacement with
ISOWEEKNUM(A1+) which of course is also wrong but loses the original
context. Just exchange the call and convert to WEEKNUM_OOO(A1,0+)
without fiddling with the parameters.

Change-Id: Id1c42d3ba084382e09c164b6c35db996f2b0197a
2016-08-01 20:31:39 +02:00
2e3bc9fcee refine ISOWEEKNUM vs WEEKNUM_OOO detection
Change-Id: I7cf5d51946235ea1bc6a4d0999fa98e1a3f8a095
2016-08-01 18:12:29 +02:00
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