summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox/formulabuffer.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-03-21Related: tdf#160056 this SvNumberFormatter is the one from the ScDocumentCaolán McNamara1-11/+7
and ScCompiler ctor will take that one already. So drop this for clarity. Change-Id: I7fc16b4cd40f08556704bfa2e3ee28d56ed6e947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164869 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-10using decls should come after #includeNoel Grandin1-3/+2
Change-Id: I058551e87bca42adede860f6f299b0f7ae2af3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156798 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-26Resolves: tdf#147955 Recalculate OOXML for bad generators with all 0.0 resultsEike Rathke1-13/+31
Change-Id: I0ad301dddfe986a38303ce1134e080bafbf312de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154944 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-02-23Resolves: tdf#153767 Try harder to import OOXML bool shared formula resultEike Rathke1-3/+28
... by setting the result value or if necessary recalculating even if AutoCalc is turned off for the document. Similar for other implicitly recalculating formula types. Also set a boolean number format if none. Change-Id: I2f75735707180eccf4b2c525738ac0b763901230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147425 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-08-07clang-tidy modernize-pass-by-value in scNoel Grandin1-4/+5
Change-Id: Ia7ff651d1cbc119b36a9f8052594d03650988f59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137848 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-14loplugin:moveitNoel Grandin1-2/+2
Change-Id: I2702e716dc669ffbb870d36d060e110288d7a744 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137043 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-23tdf#122098 xlsx im/export: let formulas guess their number formatJustin Luth1-0/+7
This fixes the import side of a LO 4.2 regression from commit 07b66cd3ac1a9f6c7b61a1d7da6e9d266e6de92d and the export side of a LO 4.3 regression from commit 69ecdad805281b2cb6ec2437da18daa19576deae make CppunitTest_sc_pivottable_filters_test \ CPPUNIT_TEST_NAME=testPivotTableBoolFieldFilterXLSX Change-Id: I4c680dbff844cf1eca52de641856daafa032eeb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130406 Tested-by: Justin Luth <jluth@mail.com> Reviewed-by: Justin Luth <jluth@mail.com>
2021-09-12clang:optin.performance.Padding in scNoel Grandin1-1/+1
Excessive padding in 'struct ScPreviewLocationEntry' (10 padding bytes, where 2 is optimal). Excessive padding in 'struct oox::xls::FormulaBuffer::SharedFormulaDesc' (8 padding bytes, where 0 is optimal). Excessive padding in 'struct ScOrcusStyles::font' (11 padding bytes, where 3 is optimal). Excessive padding in 'struct ScOrcusFactory::CellStoreToken' (8 padding bytes, where 0 is optimal). Excessive padding in 'struct TokenPool::ExtCellRef' (10 padding bytes, where 2 is optimal). Excessive padding in 'struct TokenPool::ExtAreaRef' (10 padding bytes, where 2 is optimal). Change-Id: Ifce31c799b0f64d3c6971279345391bb74f210c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121994 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-03Consolidate on C++17 std::scoped_lock instead of std::lock_guardNoel Grandin1-1/+1
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-29osl::Mutex->std::mutex in FormulaBufferNoel Grandin1-1/+1
Change-Id: Idef0cddac54da4794553394f48d3006b8145b291 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119672 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-24loplugin:stringviewparam extend to comparison operatorsNoel1-1/+1
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-14tdf#76047 XLSX import: fix links to external dataAttila Szűcs1-1/+3
in array formulas to avoid loss of cell content. Without using SetExternalLinks in applyArrayFormulas the IDs of the linked files were not replaced with file names. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I57c304a46899f4171db9ad12e7e187bd6e4c1c15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104049 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-10-06loplugin:const* make some params and methods constNoel1-1/+1
Change-Id: If621bb2585fda4afef4be9a189c7f4c00008d358 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104029 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-24ScCellFormat::GetString never called with a null ScDocument*Caolán McNamara1-1/+1
and similar, allowing a few redundant null checks to be dropped Change-Id: Ice0d6d57df112a09d3e1af3d34126b3519529daf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103278 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-18ScCellIterator never passed a null ScDocument*Caolán McNamara1-1/+1
Change-Id: I5d8ea1533fe861cf969c2999343da217c82d54e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103006 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-17ScCompiler ctors never passed a null ScDocument*Caolán McNamara1-3/+3
add one assert to ScXMLConditionalFormatContext where this isn't immediately certain. Change-Id: I2103c5cd42288e0a5d2a1c2e2d2d031f806773bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102906 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-17TokenStringContext never called with a null ScDocument*Caolán McNamara1-1/+1
so we can drop the nullptr check Change-Id: I588619f3e6f701a003447c59f5c0530801b5e1ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102886 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-16ScFormulaCell ctor variants never called with null ScDocument*Caolán McNamara1-4/+4
Change-Id: Ie0814a8948e2a4bcf723f0418c496fbbe85495ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102878 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-13ScFormulaCell ctor variant never passed a null ScDocumentCaolán McNamara1-1/+1
Change-Id: Ic96245d22c717d4360fe73855aaca9eaa1fd206d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102587 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-01-28New loplugin:unsignedcompareStephan Bergmann1-6/+7
"Find explicit casts from signed to unsigned integer in comparison against unsigned integer, where the cast is presumably used to avoid warnings about signed vs. unsigned comparisons, and could thus be replaced with o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx) o3tl::make_unsigned requires its argument to be non-negative, and there is a chance that some original code like static_cast<sal_uInt32>(n) >= c used the explicit cast to actually force a (potentially negative) value of sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the cast to avoid a false "signed vs. unsigned comparison" warning in a case where n is known to be non-negative. It appears that restricting this plugin to non- equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=) is a useful heuristic to avoid such false positives. The only remainging false positive I found was 0288c8ffecff4956a52b9147d441979941e8b87f "Rephrase cast from sal_Int32 to sal_uInt32". But which of course does not mean that there were no further false positivies that I missed. So this commit may accidentally introduce some false hits of the assert in o3tl::make_unsigned. At least, it passed a full (Linux ASan+UBSan --enable-dbgutil) `make check && make screenshot`. It is by design that o3tl::make_unsigned only accepts signed integer parameter types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses which would in general be suspicious. But the STATIC_ARRAY_SELECT macro in include/oox/helper/helper.hxx is used with both signed and unsigned types, so needs a little oox::detail::make_unsigned helper function for now. (The ultimate fix being to get rid of the macro in the first place.) Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-15clang-tidy modernize-concat-nested-namespace in scNoel Grandin1-2/+2
Change-Id: I6a9b2b912434c053e20ce06ef03e52451e506693 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86804 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-12sc: rowcol: tdf#50916 pass ScDocument to the token classesNoel Grandin1-3/+2
needed to create a fake ScDocument for the external ref manager, since it has no ScDocument at all Change-Id: Ia786ac291133e3c438694e81ecfb2590729a853d Reviewed-on: https://gerrit.libreoffice.org/85050 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-22tdf#128894: xlsx-import : Do not share tokens between cells...Dennis Francis1-4/+19
which are part of a xlsx-shared-formula along a *row*. If we do, any reference-updates on these cells while editing will mess things up. For example a shared formula "=A30+1" used for a few cells in the first row (say, A1, B1, C1 and D1) and on deleting a row, say row#5, the reference update operation will decrement the row index of all tokens in A1, B1, C1 and D1. But if they share tokens, they all end up pointing to row#26 instead of row#29 as each cell is updated which amounts to decrementing 4 times instead of once. However shared formulas along columns are not affected by this bug, when tokens are shared since we use formula-groups which only keeps one copy of token array for the entire group and reference-update code is designed to correctly work with formula-groups. Change-Id: Ic0fe84d12fef18fbf21658664e2b2b86409bca27 Reviewed-on: https://gerrit.libreoffice.org/83361 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Eike Rathke <erack@redhat.com>
2019-10-29sc: rowcol: tdf#50916 convert core/toolNoel Grandin1-2/+3
Change-Id: I0fe5a7ef4a79d0832802945ce1b9da4752f1d5fc Reviewed-on: https://gerrit.libreoffice.org/81598 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-29o3tl::make_unique -> std::make_unique in scGabor Kelemen1-3/+2
Since it is now possible to use C++14, it's time to replace the temporary solution with the standard one Change-Id: Ib69a4a2a08b1edbc0f40beac00f7f68075b479a1 Reviewed-on: https://gerrit.libreoffice.org/66967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-10pass ScTokenArray around by unique_ptrNoel Grandin1-4/+4
Change-Id: I611554b1c4cbc506dbfc32748e9f14c9e8eb5156 Reviewed-on: https://gerrit.libreoffice.org/66022 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-19tdf#42949 Fix IWYU warnings in sc/source/filter/oox/*cxxGabor Kelemen1-3/+0
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ibf5b7a813910f2ab37d8705b99bd8a9a19706c43 Reviewed-on: https://gerrit.libreoffice.org/65061 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-08Remove obsolete SAL_FALLTHROUGH completelyStephan Bergmann1-1/+1
...after 7ffdd830d5fb52f2ca25aa80277d22ea6d89970b "HAVE_CPP_ATTRIBUTE_FALLTHROUGH is always true now" Change-Id: I54e5ff4e036a6bb3e5774d1c0524158aae18e937 Reviewed-on: https://gerrit.libreoffice.org/64800 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-19clang-tidy readability-container-size-emptyNoel Grandin1-5/+5
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422 Reviewed-on: https://gerrit.libreoffice.org/61967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-04tdf#42949 Fix IWYU warnings in sc/source/filter/inc/[a-l]*Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I92cfd8d09ca8229764db4200568b96a62e2ab21e Reviewed-on: https://gerrit.libreoffice.org/59742 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-08-01Add missing sal/log.hxx headersGabor Kelemen1-0/+1
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directory sc Change-Id: I988d7d3abaedfb32516a9db88815663bf54da46e Reviewed-on: https://gerrit.libreoffice.org/58266 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-19Fix typosAndrea Gelmini1-1/+1
Change-Id: Ica623a5312196ff6a3538027e7c72ba4afe92f5c Reviewed-on: https://gerrit.libreoffice.org/57604 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2018-07-17loplugin:useuniqueptr in CachedTokenArrayNoel Grandin1-8/+2
Change-Id: If65de2af34b6f2013feee96332078c1cfa167dcf Reviewed-on: https://gerrit.libreoffice.org/57524 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-14Remove the check for IsRecalcModeMustAfterImport(), tdf#94925 follow-upEike Rathke1-15/+6
It's now superfluous as we set those cells dirty and broadcast in ScDocumentImport::broadcastRecalcAfterImport() Change-Id: Ia9dd4ad16c20b23ee8a1d46b69a4702b1ad4c81f Reviewed-on: https://gerrit.libreoffice.org/57439 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2018-07-14Resolves: tdf#94925 do not unset dirty if formula cell must be recalculatedEike Rathke1-6/+20
Change-Id: If70860b8babf1cce7fda2ae63412659e72dbb4c3 Reviewed-on: https://gerrit.libreoffice.org/57404 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-07-13Remove now superfluous CheckLinkFormulaNeedingCheck() callEike Rathke1-3/+0
That's now done in the ScDocumentImport::setFormulaCell() anyway, called two rows below. Change-Id: I593a8781fced9930061a492e4ce613baba50207a
2018-06-29tdf#118441: also keep string-formula results for shared formulasMike Kaganski1-3/+19
... like it is done for normal cells. So, the cells that have markup like <row r="2" ...> <c r="A2" t="str"> <f t="shared" ref="A2:A65" si="0">Test(B2:Z2)</f> <v>0</v> </c> </row> <row r="3" ...> <c r="A3" t="str"> <f t="shared" si="0"/> <v>0</v> </c> </row> now are handled (wrt restoring the stored result value) just like cells with this markup without sharing have long been handled: <row r="1" ...> <c r="A1" t="str"> <f>Test(B1:Z1)</f> <v>0</v> </c> </row> Change-Id: Ifcf62cf6d073faff310aa8553c6f57f42ae588cc Reviewed-on: https://gerrit.libreoffice.org/56675 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-06-26More Implicit intersection computationDennis Francis1-2/+2
Do implicit intersection computation for for single parameter functions while generating RPN token array when the argument is a doubleref with relative row references. This optimization is not done when under forced array mode or matrix formula mode. The computation logic was already present in ScInterpreter, so factored it out and reused. This also adds unit tests to ensure correctness of II computation for various cases. Change-Id: I509c3f6f811aa036b1dc3296e8f68904b26c3c49 Reviewed-on: https://gerrit.libreoffice.org/53885 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-06-25loplugin:useuniqueptr in ScDocumentNoel Grandin1-1/+2
Change-Id: I117424b6d28d4cc6cc6d7146f9df861a8075a791 Reviewed-on: https://gerrit.libreoffice.org/56320 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-17CheckLinkFormulaNeedingCheck() for .xlsx cell formulasEike Rathke1-0/+4
Change-Id: Ia6dd195f7eb4d43483e87eeca59f651e7bf2dcb8
2018-01-12More loplugin:cstylecast: scStephan Bergmann1-6/+6
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I987ac3a6d062600a5e21c3462c70595dfaa51796
2017-10-23loplugin:includeform: scStephan Bergmann1-13/+13
Change-Id: I2ed763e0584a188032c80fde60890de3c6985cbd
2017-09-12clang-tidy modernize-use-emplace in scNoel Grandin1-4/+3
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-08-11convert std::map::insert to std::map::emplaceNoel Grandin1-1/+1
which is considerably less verbose Change-Id: Ifa373e8eb09e39bd6c8d3578641610a6055a187b Reviewed-on: https://gerrit.libreoffice.org/40978 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-18Pass grammar to ScCompiler ctor instead of subsequent SetGrammar()Eike Rathke1-6/+3
Not only to have more concise code but also to avoid setting grammar twice if the actual grammar differs from the document's default one. Change-Id: I7bfd151c22c48a40aea05f5f983fa0370d9fd9ae
2017-01-25cleanup css includes and using namespacesJochen Nitschke1-4/+2
Change-Id: I29c3f89c50f858ff4592d0058f15d856de465d77 Reviewed-on: https://gerrit.libreoffice.org/33490 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-03rename members and use range based loopsJochen Nitschke1-31/+24
rename members to reflect their type css::table::CellAddress maCellAddress -> ScAddress maAddress Change-Id: Id95461512600023dbfd3209a5b0fdcf3d3e53b1e Reviewed-on: https://gerrit.libreoffice.org/32661 Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-01-03tdf#48140 replace CellRangeAddress in xlsx import (11)Jochen Nitschke1-12/+7
Change-Id: I033b2ddb720942882aad5ceaa8b140546f32356d Reviewed-on: https://gerrit.libreoffice.org/32580 Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2016-11-19tdf#48140 Remove not used UNO headers from filtersBartosz Kosiorek1-5/+0
Change-Id: I66e775b60343fe8ac772d8c0287ca19be58a7236 Reviewed-on: https://gerrit.libreoffice.org/30966 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-10-25Resolves: tdf#79442 in OOXML import add external files to LinkManagerEike Rathke1-0/+4
Now that we store formula results without recalculating, the implicit logic that adds files of external references to the LinkManager is not triggered, explicitly force it during import. Change-Id: Id867d2fa2b39841fb4c8e90941814457c8db431d