summaryrefslogtreecommitdiff
path: root/sc/source/core/data/column3.cxx
AgeCommit message (Collapse)AuthorFilesLines
13 min.sc: fix crash in ScColumn::SetEditText()HEADmasterMiklos Vajna1-0/+5
Crashreport: > SIG Fatal signal received: SIGSEGV code: 128 for address: 0x0 > program/libsclo.so > ScColumn::SetEditText(int, std::unique_ptr<EditTextObject, std::default_delete<EditTextObject> >) > sc/source/core/data/column3.cxx:2362 > program/libsclo.so > ScTable::SetEditText(short, int, std::unique_ptr<EditTextObject, std::default_delete<EditTextObject> >) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > ScDocument::SetEditText(ScAddress const&, std::unique_ptr<EditTextObject, std::default_delete<EditTextObject> >) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > ScDocFunc::SetEditCell(ScAddress const&, EditTextObject const&, bool) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > (anonymous namespace)::finalizeFormulaProcessing(std::shared_ptr<(anonymous namespace)::FormulaProcessingContext>) > sc/source/ui/view/viewfunc.cxx:565 Change-Id: I331ca8784702fdcb0ebad6a0a73390dbe2615ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166612 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-04-03reduce cost of displaying sheets with conditional formattingNoel Grandin1-2/+2
shaves off 1-2% of the cost by stack-allocating some iterator objects Change-Id: I509d4de6c59db086f112d83768a24c11dd5d0872 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165745 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-02tdf#146619 Remove unused #includes from C/C++ filesRafał Dobrakowski1-3/+0
'sc' module was cleaned. Change-Id: Ia491d741a4c1c5314f35ebb4baa82dd516948ae7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165699 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-04-02tdf#160399 speed up print previewNoel Grandin1-0/+13
shave about 2-5% off the cycles here Change-Id: I23adffa4715d3dd28a92d48603a236115fb7d680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165647 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-23Related: tdf#160056 do calc NumberFormatting via ScInterpreterContextCaolán McNamara1-22/+19
and for the duration of Threaded calculation where there will be no new formats required we can drive number formatting with the unlocked RO policy. Change-Id: Ic0e449acdcf834bc569d13b4a984f13c55316801 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165160 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-02-29tdf#159420: Show empty option even if empty is filtered outXisco Fauli1-3/+14
in other columns Regression from 89e032e9c4c51f52680c7d8bacf59ab2a34f2180 "tdf#158314: show Empty and Error entries as non-selected and inactive... ...when hidden by autofilter." The mbHasEmpties variable was added in 9c1826d98065c30411cbf2e731560165ca2b7668 "sc-perf: do not add a million empty filter entries just to sort and discard" Change-Id: Ie0d81fd57f68038fac62cb6a3442e93ed547167a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162752 Tested-by: Jenkins Reviewed-by: Kevin Suo <suokunlong@126.com>
2024-02-28Make the code tidier & stop event handling during destructionKohei Yoshida1-0/+1
This is a follow-up to 25ffb54c6d8a5b52dca6b782282962766e7791de. Change-Id: Ifc87323dd5085cdac08efac5fd9d22ae8b94d641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163997 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2024-01-18tdf#158314: show Empty and Error entries as non-selected and inactive...Kevin Suo1-2/+2
...when hidden by autofilter. The "show hidden filter elements as inactive" feature was added and improved by: commit 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1 (tdf#117276 sc: Show hidden filter elements as inactive elements) commit 2085e90fe8ac129bc4dbac4612d1ea7544335dae (FilteredRow is not a property of the column, tdf#117276 follow-up) commit 7321db3cadc8c0e4437ca04e5dcb652734ea9c26 (Related tdf#117276 sc: Show hidden filter elements as inactive elements) commit 19533948370dc1ccd7334dbe1a8b7fc8330b10c0 (Name FilteredRow what it is, not hidden; tdf#117276 follow-up) Those changes correctly made normal hidden filter elements as inactive, but failed to do so for Empty and Error entries. This patch shows the hidden Empty and Error entries as inactive and unselected. Also, do not show the Empty entry at the top of the list in case it is inactive. Change-Id: Ibcd758cebc0692b04b162cdfc3e06eceb86b17da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162166 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Kevin Suo <suokunlong@126.com> Tested-by: Kevin Suo <suokunlong@126.com>
2024-01-03tdf#114441 Convert use of sal_uLong to better integer typesgilssonn1-2/+2
Reasoning: + For clipcontent.cxx, column3.cxx, dbdocutl.cxx, documen8.cxx,formulacell.cxx, patattr.cxx, stlpool.cxx, table2.cxx, table3.cxx and validat.cxx: + sal_uLong variables and functions are being initialized with/assigned/returning sal_uInt32 or size_t values + For column2.cxx: + The type of the return values of the `getWeight` function are size_t + For document.hxx, documen2.cxx, docsh.hxx, docsh5.cxx, viewfun2.cxx and globstr.hrc + `ScDocument::TransferTab`'s return variable's value is constrained to be either 0 or 1; which is better represented as a boolean Change-Id: If556f7fcc29f7e325618721959ea4e3615b2e755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154408 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-12-28Decouple ScPatternAttr from SfxItemPoolArmin Le Grand (allotropia)1-3/+3
ScPatternAttr is traditionally derived from SfxPoolItem (or better: SfxSetItem) and held in the ScDocumentPool as Item. This is only because of 'using' the 'poolable' functionality of the Item/ItemSet/ItemPool mechanism. Lots of hacks were added to sc and Item/ItemSet/ ItemPool to make that 'work' which shows already that this relationship is not optimal. It uses DirectPutItemInPool/DirectRemoveItemFromPool to do so, also with massive overhead to do that (and with not much success). The RefCnt in the SfxPoolItem that is used for this never worked reliably, so the SfxItemPool was (ab)used as garbage collector (all Items added and never removed get deleted at last for good when the Pool goes down). For this reasons and to be able to further get ItemSets modernized I changed this. I did two big changes here: (1) No longer derive ScPatternAttr from SfxItemSet/ SfxSetItem, no longer hold as SfxPoolItem (2) Add tooling to reliably control the lifetime of ScPatternAttr instances and ther uniqueness/ reusage for memory reasons It is now a regular non-derived class. The SfxItemSet formally derived from SfxSetItem is now a member. The RefCnt is now also a member (so independent from size/data type of SfxPoolItem). All in all it's pretty much the same size as before. To support handling it I created a CellAttributeHelper that is at/owned by ScDocument and takes over tooling to handle the ScPatternAttr. It supports to guarantee the uniqueness of incarnated ScPatternAttr instances for a ScDocument by providing helpers like registerAndCheck and doUnregister. It hosts the default CellAttribute/ ScPatternAttr. That default handling was anyways not using the standard default-handling of Items/Pools. I adapted whole SC to use that mainly by replacing calls to DirectPutItemInPool with registerAndCheck and DirectRemoveItemFromPool with doUnregister, BUT: This was not sufficient, the RefCnt kept to be broken. For that reason I decided to also do (2) in this change: I added a CellAttributeHolder that owns/regulates the lifetime of a single ScPatternAttr. Originally it also contained the CellAttributeHolder, but after some thoughts I decided that this is not needed - if there is no ScPatternAttr set, no CellAttributeHolder is needed for safe cleanup at destruction of the helper. So I moved/added the CellAttributeHolder to ScPatternAttr where it belongs more naturally anyways. The big plus is that CellAttributeHolder is just one ptr, so not bigger than having a simple ScPatternAttr*. That way, e.g. ScAttrEntry in ScAttrArray did not 'grow' at all. In principle all places where a ScPatternAttr* is used can now be replaced by using a CellAttributeHolder, except for construction. It is capable to be initialized with either ScPatternAttr instances from the heap (it creates a copy that then gets RefCounted) or allocated (it supports ownership change at construction time). Note that ScAttrEntry started to get more a C++ class in that change, it has a constructor. I did not change the SCROW member, but that should also be done. Also made registerAndCheck/doUnregister private in CellAttributeHelper and exclusively used by CellAttributeHolder. That way the RefCnt works, and a lot of code gets much simpler (check ScItemPoolCache, it's now straightforward) and safer and ~ScPatternAttr() uses now a hard assert(!isRegistered()); which shows that RefCnt works now (the 1st time?). There can be done more (see ToDo section below) but I myself will concentrate on getting ItemSets forward. This decoupling makes both involved mechanisms more safe, less complex and more stable. It also opens up possibilities to further optimize ScPatternAttr in SC without further hacking Item/ItemSet/ItemPool stuff. NOTE: ScPatternAttr *should* be renamed to 'CellAttribute' which describes what it is. The experiencd devs may know what it does, but it is a hindrance for understanding for attacting new devs. I already used now names like CellAttributeHelper/CellAttributeHolder etc., but abstained from renaming ScPatternAttr, see ToDo list below. SfxItemSet discussion: ScPatternAttr still contains a SfxItemSet, or better, a SfxSetItem. For that reason it still depends on access to an SfxItemPool (so there is acces in CellAttributeHelper). This is in principle not needed - no Item (in the range [ATTR_PATTERN_START .. ATTR_PATTERN_END]) needs that. In principle ScPatternAttr could now do it's own handling of those needed Items, however this might be done (linear array, hash-by-WhichID, ...). The Items get translated to and from this to the rest of the office anyways. Note that *merging* of SfxItemSets is *still* needed what means to have WhichID slots in SfxItemState::DONTCARE, see note in ScPatternAttr::ScPatternAttr about that. And there is also the Surrogates stuff which would have to be checked. The other extreme is to use SfxItemSet *more*, e.g. directly derive from SfxItemSet what would make stuff easier, maybe even get back to using the 'regular' Items like all office, I doubt that that would be much slower, so why...? Also possible is to remove that range of Items exclusively used by ScPatternAttr from ScDocumentPool *completely* and create an own Pool for them, owned by CellAttributeHelper. That Pool might even be static global, so all SC Docs could share all those Items - maybe even the ScPatternAttr themselves (except the default per document). That would remove the dependency of ScPatternAttr from a Pool completely. ToDo-List: - rename ScPatternAttr to CellAttribute or similar - use SfxItemSetFixed with range [ATTR_PATTERN_START .. ATTR_PATTERN_END] instead of regular SfxItemSet (if the copy-construtor works now...?) - maybe create own/separate Pool for exclusive Items - make ScAttrEntry more a C++ class by moving SCROW to the private section, add get/set methods and adapt SC Had to add some more usages of CellAttributeHolder to the SC Sort mechanism, there were situations where the sorted ScPatternAttr were replaced in the Table, but the 'sorted' ones were just ScPatternAttr*, thus deleting the valid ones in the Table already. Using CellAttributeHolder makes this safe, too. Added a small, one-entry cache to CellAttributeHelper to buffer the last found buffered ScPattrnAttr. It has a HitRate of ca. 5-6% and brings the UnitTest testSheetCellRangeProperties from 0m48,710s to 0m37,556s. Not too massive, but erery bit counts :-) Also shows that after that change optimizations in the now split functionality is possible and easy. Change-Id: I268a7b2a943ce5ddfe3c75b5e648c0f6b0cedb85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161244 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-11-29sc: fix back color filter entriesHenry Castro1-0/+60
The function "GetFilterEntries" iterates only that contains cell data value entries, the background color filter feature requires to iterate background color attribute which is not stored in multi type vector cells. Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: I372db48d2399f62712f642eefdbfea8885b09f58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159864 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 826eae46095b2184554565bab1792e96964a720f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159905 Tested-by: Jenkins
2023-09-06fix "variable 'nRow' set but not used [-Werror,-Wunused-but-set-variable]"Christian Lohmaier1-0/+2
as seen on non-debug builds with compiling for x86_64 with XCode 14.3.1 Change-Id: Ib0b97cfcf15cc58d08a90bc0b4aaf43fc1be3c05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156614 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2023-06-01tdf#153972 Fix color filter when cells have no contentSamuel Mehrbrodt1-11/+12
Change-Id: I9742fc0627c2311bfe4c067961e0feea476f1899 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151096 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-05-26tdf#154131 Add Detect scientific number optionLaurent Balland1-1/+1
Add a sub case of Detect special numbers for import CSV (SC_IMPORTFILE), paste unformated text (SC_PASTETEXT) and text to columns (SC_TEXTTOCOLUMNS). Following cases are treated: - If "Detect special numbers" is true, then "Detect scientific numbers" must be true and all special formats are treated (date, time, scientific notation) in addition to basic decimal numbers. - If "Detect special numbers" is false and "Detect scientific numbers" is true only scientific notation is treated in addition to basic decimal numbers. - If "Detect special numbers" and "Detect scientific numbers" are both false only basic decimal numbers are recognized as numbers. It is the new case treated by this change The new option bDetectScientificNumber is append to ASCII options Change-Id: I73dff9f75d2c7b07ce155daa29dcc4ca9f288664 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152072 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-05-16Remove nonsense OSL_ENSURE()Eike Rathke1-1/+0
Apparently a legacy leftover; it's perfectly valid to remove EDITATTR along with CONTENTS, i.e. in Cut. Change-Id: I10010e1fc98b5e5863d041d72ddf78d499a0ec45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151846 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-05-11cid#1529968 Dereference null return valueCaolán McNamara1-3/+5
Change-Id: Ib1d3f6229bf884b27b8e697b824e99ffa0af800a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151648 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-08tdf#95520 Autofilter: Sort by colorSamuel Mehrbrodt1-59/+4
Change-Id: I2c1455cc2c741d16f09eccee0bf489f8990684f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151064 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-02-28tdf#153669: Track formulas that stopped listening ...Kohei Yoshida1-10/+45
... then have them start listening again after the copy from clipboard is complete. Note that in case the pasted cells are formula cells, those will be handled together as well. Change-Id: Ia4be814b888734267a39f7c89435011968570b7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147940 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2023-02-24improved fix for CppunitTest_sc_uicalcNoel Grandin1-0/+2
Revert the previous fix (commit 0714dfe7fdb0cd3a49d4eb0e771da8eb4aa84d7a) and implement a better fix, was just a stale pointer Change-Id: I34006c2f387e2a16bcecef56ac9fb46a9669ebbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-14Related: tdf#149665 Unify input of a leading ' apostrophe in non-Text cellEike Rathke1-17/+5
If a cell is not formatted as Text and ScSetStringParam::mbHandleApostrophe is true, all input (except one single apostrophe that otherwise would lead to an empty cell string) now is treated the same and the leading apostrophe is removed and the remainder is set as text content. The Input Line and editing a cell get an apostrophe prepended for the cases needed to generate such escaped string again. This made it necessary to adapt a unit test that exactly checked the old behaviour. Change-Id: I07b35d33f3704970784dc6de1322bda28903bb97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139934 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-09-10Resolves: tdf#150766 Listen to entire shared formula group instead of a sliceEike Rathke1-0/+34
Change-Id: I677602bd3401dbd401e35f7db64cd34d164d9d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139744 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-08-25try harder to ensure InterpretCellsIfNeeded() interprets (tdf#150499)Luboš Luňák1-14/+30
ScFormulaCell::Interpret() tries to interpret the whole formula group (or the given range of it), but it's not guaranteed, and possibly just the called cell will be interpreted. So if a specific range really needs to be interpreted, handle that case. Change-Id: I7fb563ae471eefd49e5bb6c92b6aff98c42a440e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138741 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-07-27Unnecessary to remember mbFiltering at column, tdf#140968 tdf#140978 follow-upEike Rathke1-5/+5
It's inviting confusion and only needed for FilterEntriesHandler, so pass it there. Change-Id: I8056bf8e8f563b28358c46b19071e7caa69c88a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137513 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-07-27FilteredRow is not a property of the column, tdf#117276 follow-upEike Rathke1-7/+7
It's only needed in the FilterEntriesHandler, so pass it there. Change-Id: I5554ad13a43ccce6aafbba82b33418f060173a43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137512 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-07-27Name FilteredRow what it is, not hidden; tdf#117276 follow-upEike Rathke1-2/+2
Also avoid defaulted parameter, it's only one more place to change. Change-Id: I64468fcd7085eff7a49bd0c359fdf14a31058af6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137511 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-07-22tdf#117276 sc: Show hidden filter elements as inactive elementsBalazs Varga1-4/+5
Showing hidden values in the autofilter dropdown (as inactive when it was hidden by another row) - without changing the behaviour of autofilter. First those which belongs to non-hidden rows, then those which belongs to hidden rows. TODO: maybe we can add a global option where the user can switch on/off this feature. Change-Id: Iafeb43176efe7ab422b22697d399c68c95d0319d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136595 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2022-07-05Resolves: tdf#149665 Strip first ' also for multiple '' if following is numericEike Rathke1-8/+19
... and prepend accordingly when editing content. Change-Id: I9b35c4e370323966400e8e7ef3bce95026052f10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136837 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-06-18create getter for ScCellValue::mpFormulaNoel Grandin1-3/+3
so we can assert that it has the correct tag type Change-Id: Iab13a6d6ea1783c69395f06f28732769e5fe8b18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136059 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-17create getter for ScCellValue::mpStringNoel Grandin1-1/+1
so we can assert that it has the correct tag type Change-Id: I8933919aefc2bb22694a283b54dc3de11d16e5a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136002 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-16create getter for ScCellValue::mfValueNoel Grandin1-2/+2
so we can assert that has the correct tag type Change-Id: I0d626130cb014e19239e88a6988018c83d061f68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136001 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-16make meType in ScCellValue privateNoel Grandin1-6/+6
as a first step to wrapping up the internals of this class and adding some asserts Change-Id: Ic13ddd917948dbf3fd6d73f44b8efcc727726baf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135994 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-10loplugin:constantparamNoel Grandin1-2/+2
Change-Id: I8134744b6c1279c497d4763eddf614bb840f7f3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135602 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-22cid#1504533 silence Uncaught exceptionCaolán McNamara1-1/+3
Change-Id: Id2c782e417b673dcc2e2b5170bcaf6b98bef85f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134720 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-06tdf#148383: Obtain start/end strings always in system localeDaniel Kamil Kozar1-2/+2
ScFillSeriesDlg always expects the strings describing the start and end values to be in the system locale. This change ensures that and fixes the bug where using non-locale-default data in the Fill Series dialog leads to an error. Change-Id: I25eafa2174294dc35a63473a54c529c2d7bd87ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132532 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2022-04-22try to limit cell interpreting to only visible cells when drawingLuboš Luňák1-6/+33
If there's a document with a huge formula group, InterpretDirtyCells() on load will only interpret the range needed for drawing. But then scrolling just a bit could result in e.g. IsValue() call on a cell, and that could result in unrestricted Interpret() on the whole huge formula group, which could be slow. So explicitly interpret just the drawn cells in the hope that it'll avoid any further Interpret() calls. Change-Id: I01c9f95cf8a1cf240b798feef27d21010957030c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133306 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-22limit Interpret() for dirty cells only to the given row range (bsc#1197497)Luboš Luňák1-2/+35
ScColumn::InterpretDirtyCells() already takes a row range, and Interpret() can take a range inside a formula group, so don't lose the information in DirtyCellInterpreter, otherwise a whole large formula could be interpreted when just a subset would be enough. Change-Id: I93e5a7a212976be6fd588de6f68204cd1a271348 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133305 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-15Prepare SvNumberFormatter::GetEditFormat() to obtain for another localeEike Rathke1-2/+2
Change-Id: Iab8b9a802ebac60b52007754430352d3de925374 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133026 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-04-04sc: add support for copy/cut and paste of SparklinesTomaž Vajngerl1-0/+14
Currently cut,copy and paste will copy the Sparkline and create a new SparklineGroup for each cell in the new cell range. This probably need to be adjusted so the SparklineGroup is shared. Change-Id: I6f86bb026753b2b4b5bfa46aca4ca9794721f311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132473 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-04-03sc: support deleting a Sparkline with 'Clear Content' functionTomaž Vajngerl1-0/+6
Change-Id: Ida61b402170238fb0505c777e49954c15d376cf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132467 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-03-25loplugin:constantparamNoel Grandin1-45/+1
Change-Id: Id89c74fcd6c6332f5da9f57986bfc2fe075d71c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132087 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-18tdf#133603 reduce some ref-counting during XLSX saveNoel Grandin1-6/+6
Change-Id: I02ed854ba57c7f513205f65ec84cb4e08d3b068f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131728 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-10fix attr iterators to walk even unallocated columns if neededLuboš Luňák1-1/+1
Things like applying bold to an entire row no longer allocates all rows after my recent changes, but the attribute change is done in ScTable to the default attribute of unallocated columns. That means that clamping column positions to the end of allocated columns is no longer valid when handling attributes. Add functions that clamp depending on whether unallocated columns have a non-default attribute set. Change-Id: I879d0a034c0b336064361d0f8cb12e5a8da22b9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131265 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-08sc: add Sparkline to the model as a column multi_type_vectorTomaž Vajngerl1-0/+3
This adds a Sparkline class and a SparklineGroup class. The Sparkline class is added to a cell, and the SparklineGroup is referenced by the Sparkline, so multiple Sparklines can share the same properties. Change-Id: Id309ded34bfa7a35c1be43f7c0543d88594e66ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131162 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-03-05don't bother scanning nonexistent data (tdf#141182)Luboš Luňák1-0/+2
There's no point scanning for non-empty cells after the last data cell, and this avoids processing mdds structures (such as repeated creating of flat_segment_tree). Change-Id: Ibec324aa2de457e8439c38a561f55ced9f478899 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131059 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-02-25convert more MAXCOLCOUNT/MAXROWCOUNTLuboš Luňák1-6/+6
And add GetMax{Col|Row}Count() directly to ScDocument, and also add MAX{COL|ROW}COUNT_JUMBO. Change-Id: Ib92cfbf65dd7cbe87230b02b8916e7cc50fcdbc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130529 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-02-14Recheck modules s[a-c]* with IWYUGabor Kelemen1-1/+0
See tdf#42949 for motivation Change-Id: I867e1f7a2c44210de3281b36e22708a5d32ddb7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129476 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-02-04tdf#146795: Make sure to use valid position hints to avoid crash.Kohei Yoshida1-4/+17
This commit also unifies the code path for both "skip empty cells" option is selected and when that option is not selected, which simplifies the code quite a bit. Change-Id: I21054cccdd9f60e073695091740b9415dfef2985 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129267 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2022-01-29Standardize the flag name on bSkipEmptyCells.Kohei Yoshida1-2/+2
And document what the flag does. This corresponds with the "Skip empty cells" check box in the Paste Special dialog. Change-Id: Ic6cf9099efbee43f737a1472a4e275839e3d2c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129130 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2021-12-06make it clearer that ScHint is modifiedLuboš Luňák1-1/+1
It's somewhat confusing that an accessor is provided to give a reference to internal data and then the object is modified indirectly using the reference. It appears to be only for performance reasons, so I thought that inlining the ctor and ctor could help the compiler to optimize this, but apparently it can't move this outside of the loop, so at least make it clearer. Change-Id: I72cf15d1446daa559ac4079b9478e53694d7d198 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126394 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-11-08optimize VLOOKUP by returning SharedString if possible (tdf#139444)Luboš Luňák1-2/+2
Profiling shows that the slowness mostly comes from converting the cell's SharedString to OUString and then the comparison converts it back. To improve performance, return the SharedString if possible and ignore the OUString. Change-Id: Idb190bd0354cea3185e5ff9ebaf92cab63f23f70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124880 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>