summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-03-23faster bulk insert into o3tl::sorted_vector (tdf#117366)Luboš Luňák
Repeated insert() into o3tl::sorted_vector can turn out to be pathological, repeatedly moving most items aside for each element inserted. Make it possible to insert a normal vector that's been pre-sorted and made unique. 31s->9s for loading tdf#117366. Change-Id: If3a0366dd240ad46c23f5f3dc04e781b8c4b2aa2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131085 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23don't try to spellcheck after last data cell (tdf#122827)Luboš Luňák
Change-Id: I728e7f19a521f5f3583b4963d84c7d36527c8842 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131076 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23compress RowHidden()/GetRowHeight() use in excel export (tdf#126326)Luboš Luňák
Change-Id: Idc6a704cfc820bbbb2b51eff8db8159c251ea9ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131062 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23don't bother tracking changes if both cells are empty (tdf#141174)Luboš Luňák
AppendContent() does something only if the cells differ, which can't be the case if they're both empty, so skip unallocated cells. Change-Id: I367801bac30a8ee641b4ce608392124bac6ef47a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131060 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23don't bother scanning nonexistent data (tdf#141182)Luboš Luňák
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-03-23make sc_namedrangesobj test work with 16k columnsLuboš Luňák
'row1' is not a valid named range with 16k columns, it's a cell address. Since the named range is constructed by the test, not even 582fc887f1faafe8ff5f16a13a0208483a93353f can take care of it, so rename such ranges. Change-Id: I6643953d41e391c8c3cfc55768b06d61d9fcb0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131046 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23remove more hardcoded sheet sizes from Calc testsLuboš Luňák
E.g. sctablesheetobj test had the limits hardcoded, even as actual numbers. Apparently some tests cannot easily access global settings, but this at least makes it easy to check all tests after modifying ScSheetLimits::CreateDefault(). Change-Id: I6cff577fb01b1ea262dcd1f9fde24e114e19abdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131040 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23remove more hardcoded MAXROWLuboš Luňák
Change-Id: Ica57f18d3fd1bf9ec06f05869f4a956d7d1097b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131036 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23introduce ScColumnData for ScColumn/ScTable code sharingLuboš Luňák
Since columns are allocated dynamically on demand, up until this commit ScTable had ScPatternAttr member for unallocated columns that it was using in place of those unallocated columns. But that meant either copy&pasting pieces of code from ScColumn, or having extra slightly more cumbersome shared function in ScColumn, or even nothing. Improve this by creating ScColumnData, which will be used as ScColumn base class to keep things working as before, but ScTable now also contains one ScColumnData instance and so it can also call its functions. Change-Id: If1d842c4a5aec32e2a7729358006d79cd831349f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131034 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23keep conflicting named ranges working with 16k columnsLuboš Luňák
Named ranges named e.g. 'num1' are actually valid cell addresses when using 16k columns. We prevent naming ranges in a way that would make them conflict, but it's possible to read them from a saved file that was created with fewer columns, and in such cases formulas using them would silently refer to those cells instead of to the named range. I don't see anything in the ODF spec, but OOXML in 18.2.5 recommends this in case there are conflicts (only outside of the normal Excel range of A1-XFD1048576, inside they are always meant to be references, but our normal range currently is only 1k columns, and it's simpler and probably harmless to always resolve a conflict this way). I can optimize performance of this in another commit if needed. Change-Id: I46aef54b069700e7bf268b50fdc1a88989f3ee29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130891 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23set properly attributes for cells in unallocated Calc columnsLuboš Luňák
ScTable::ApplySelectionCache() was setting attributes only for allocated columns, so e.g. selecting a whole column and making it bold didn't actually set all of it bold. Make sure it set it for all columns, and make use of the default attribute for unallocated columns to avoid allocating columns just to set them the same attribute. Change-Id: Ie9886317d7a91c6a43951af69b717f9ba32a1c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130984 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23provide MAXCOL/MAXROW also as stringsLuboš Luňák
Primarily for use in tests. Change-Id: Icb962cbdfa63a3b50115314e9afd46f3fa1a928a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130939 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23make ScMarkData::IsAllMarked() work also for simple marksLuboš Luňák
Change-Id: I41009c83827619605b4cfc4909f1d9922cde68a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130923 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23improve ScMark* classes a bitLuboš Luňák
Bin pointless empty destructors, make trivial functions inline, return value by simply returning it. Change-Id: Ia71e73262802bbe6b022ca4bafb2b958ffdf39f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130915 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23function that modifies data should not be called IsXXX()Luboš Luňák
IsXXX() is for const functions that check something. Using it for functions that modify data is confusing. Some of them even are in fact const, and the problem got "fixed" by making data mutable *sigh*. Change-Id: Ic385c96d6c32c818a8a6baa77ab025aab2c45a03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130890 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23fix incorrect search startLuboš Luňák
A mistake from 05259e880db187f6698d6d545504775459d6e96a, the second if branch doesn't guarantee anything about where EXC_XF_NOTFOUND elements start. Change-Id: I942f87a7320c13a8f87ab3c9f1683a75d7a1e135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130876 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23reuse a vector instead of repeatedly creating it (tdf#95346)Luboš Luňák
With some documents this actually is a noticeable cost. Change-Id: Ibaf2157eeba83e0c8f78c7ba058771f92bb44e24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130795 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23try to avoid using map when searching most used item (tdf#95346)Luboš Luňák
The last item is usually going to be the most common, so first check that. Change-Id: Ibad8b6bb9a829a96691c10b780b8e52610475126 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130794 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23compress calls to AdjustRowHeight() to just one call (tdf#94677)Luboš Luňák
This function imports only text, so I think doing one big call at the end should be fine. Change-Id: I267f5857ac11cfb95245434333f2ca5fa7e662cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130789 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23make Calc jumbo sheets an explicit build featureLuboš Luňák
On 32bit platforms tools::Long is 32bit, which is not enough for pixel coordinates with 1m+ Calc rows+. So do not allow jumbo sheets for such platforms. Change-Id: I2ebd56a051470d33fca967918af3e7d2b0172dc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130713 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23make named ranges in tests work with 16k columnsLuboš Luňák
References like 'day1' are valid cell addresses with 16k columns, since they go up to XFD1. Since addresses currently take precedence over names, rename ranges to not conflict. Change-Id: Iab63947565ed176c98bc541de6189d7ee9e8d255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130728 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23fix inverted conditionLuboš Luňák
Logic says that 'contains' should be '!empty()'. And checking history shows that 94d76cef1f71056fab106caf4cc8e65504475615 inverted the condition presumably by mistake. Change-Id: I6c0ddc6486a5fb89eb39b93e32ee52d478c05927 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130543 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23do not allocate so many CellInfo objects in FillInfo()Luboš Luňák
FillInfo() is used for drawing to screen, so it's given a range of rows and columns, but drawing also depends on all cells to the left (e.g. their width, for position), so it allocated CellInfo for all columns starting from 0. But with many columns this can easily mean allocating and initializing a large amount of memory, easily 90MiB with a maximized window and going to XFD1, and handling all that can be slow enough to be seen when moving around. Since only few of the CellInfo fields are actually needed for all columns, split them into a separate smaller BasicCellInfo, and allocate CellInfo only for columns that need it. And exception is the nRotMaxCol code (for rotated cells?), which accesses more of the fields, so for that case allocate the same way as before. Change-Id: I2f0f2a9c27b1a8b74b70fc2d208d0689e16ee1a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130607 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23do not repeatedly call ColHidden()Luboš Luňák
The function returns the last column that has the same return value, so reuse the return value until that column. Change-Id: I5d19478ee37068049d4ff035efcacdb5eb724e15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130606 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23optimize ScColumns::HasCellNotes()Luboš Luňák
This probably doesn't matter much for optimized code, but in dbgutil builds this avoids all the libstdc++ iterators mutex locking (WTH does libstdc++ debug mode need to lock anything?). It's functionally equivalent (similarly to ScColumn::IsEmptyData(), and the container can contain only notes or empty elements), and cuts run time of e.g. sc_uicalc test to about a half. Change-Id: Ibb2bd8be522de889a8a06cbb7a4f880c9b065c71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130604 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23do not fail import if there are only warningsLuboš Luňák
When opening CVE-2012-4233-4.xls or ofz5527-1.xls in LO UI, they show a warning about too many columns (presumably because Excel as of now supports 16k and LO only 1k columns by default), but besides stripping the extra columns they otherwise actually load normally. But ScFiltersTest::testCVEs() fails loading them just because of the warning. And if 16k columns are forced for the tests, the files unexpectedly load fine, making the test fail. ScDocShell::ConvertFrom() is rather inconsistent on whether only a warning results in a failed load or not, but most seem not to return failure on only warnings, and I think that makes sense, so make code paths for all formats consistently handle it that way. Change-Id: I202f29f5a5a44aecd34b84cf2f8180222e8d870a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130500 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23make VBAMacroTest::testVba() pass with huge sheetsLuboš Luňák
One test checked for the last cell being $IV$8 or $AMJ$8. Simply add $XFD$8 to the list of possible values. Change-Id: I96685c4404b3281d64622380e7d42614adb1c041 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130570 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23lock paint when VBA sets value for a number of Calc cellsLuboš Luňák
VBAMacroTest::testVba() spends the majority of time repeatedly repainting. Change-Id: Iea69221834b80b0fbe484ee3ec5f64ba9e28e37d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130569 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23convert more MAXCOLCOUNT/MAXROWCOUNTLuboš Luňák
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-03-23move simple checks out of DEBUG_COLUMN_STORAGELuboš Luňák
These few look like useful assertions and they should be cheap, so keep only the extensive checks inside the #if block. Change-Id: I9e6851d25d8b4d637041c1efe1d9712d410262e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130003 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23don't try to delete unallocated columnsLuboš Luňák
Change-Id: I1508f9eb624a78946f5216078953ce8f95e566b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130522 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23fix copy&paste mistakeLuboš Luňák
Introduced in bc734289e5542a0ffa04c0ac3cd1aa7cb1810be0. Change-Id: I5b844e579d6ebfb7be5edaa15944a6df1af66394 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130517 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23handle hardcoded MAXCOL/MAXROW in ScInterpreterLuboš Luňák
The change from <= to < is intentional to compensate for the change from MAXCOLCOUNT to MAXCOL (there's no MAXCOLCOUNT_JUMBO and I don't want to add it). Change-Id: I223b2fd3b1a9e22e82f6a31d16d44c98ae43876d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130436 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23remove MAXCOL/MAXROW from ScViewDataLuboš Luňák
Change-Id: I12461bac8dd127075ee9071e1015561f7a029624 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130435 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23check valid col in ScTable::GetDataEntries()Luboš Luňák
Presumably uncovered by 823eb92025853d120c17790d1c8efde59f033c69 no longer allocating a column on GetPattern(). Change-Id: I2f23414a912ec1a0f22b4b88ea367423fb6fb7e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130388 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23fix more MAXCOL/MAXROW in testsLuboš Luňák
Change-Id: I7e3444f0b2ee5a4297705a24fbab3bfb96904b8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130387 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23use 64bit for window sizes (tdf#147458)Luboš Luňák
Change-Id: Iaa240aeae8bacbff6bccd9bf0721a02414b6f47d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130288 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23optimize XclExpRowBuffer::GetOrCreateRow() (tdf#140893)Luboš Luňák
This gets called often especially with larger spreadsheets. Change-Id: I6acf23d0942d1745a52963c9b5b08453e1ec28bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130207 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23optimize AreaBroadcast() a bitLuboš Luňák
Use ComputeAreaPoints() rather than repeated ComputeSlotOffset(). Change-Id: If7869fe4c37a1e844ec9e6513a7c1799290c077f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130204 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23remove MAXCOL/MAXROW from ScAddress/ScRange (tdf#147509)Luboš Luňák
Change-Id: I4e80bba8b866f9915a6600ce67774380e619c2e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130188 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23convert more MAXCOL/MAXROWLuboš Luňák
Change-Id: Ifb2c9ea7b440890224c7e837422c8a1358f8c5b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130143 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23remove MAXCOLCOUNT from calc pivot implementationLuboš Luňák
It appears that PIVOT_DATA_FIELD is just a custom special value that's outside of the valid column range, but otherwise the value doesn't matter, and -1 is generic. Change-Id: Ieac1d4e3391f76350dc420e6b2ae9ed9f35d35f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130124 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23fix range checking when parsing Calc cell address (tdf#147451)Luboš Luňák
The document contains 'Sheet1', which Calc first tried to parse as a normal address, since it matches the format of e.g. 'XFD1'. The code parsed column into SCCOL (sal_Int16), which with 16k column limit overflowed and the code failed to detect the problem. Change-Id: I470db1b670dbff7bdc8013bede0a0b011e88c372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130073 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23optimize blank cell Excel export (tdf#133749)Luboš Luňák
The code in XclExpRow::Finalize() apparently creates an array of indexes for blank cells, and then uses it to efficiently write many blank cells (or whatever it's all exactly). But especially with huge sheets all this processing is basically repeatedly checking for all the blank cells at the end of the rows. Optimize this by calculating where the all the remaining blank cells start and process those more efficiently or sometimes even just plain ignore them. Possibly this could be optimized even more if I understood the code better, but this seems to be good enough. I've also changed some of the loops to use indexing instead of iterators, as libstdc++ debug iterators are horribly slow here (which possibly may even make a difference for Jenkins builds). Change-Id: Iafe36ccd2795a85b10b98cf84c041a7427aabc29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130046 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23std::map -> std::unordered_mapLuboš Luňák
Change-Id: I70a039af151b7dd398d2665e6fc9bb825f719e39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130006 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23fix maxrow/maxcol mixupLuboš Luňák
In 5e402bac39dc4245844efbde442bdb3bd993a157 I accidentally converted a couple of MAXCOLCOUNT to GetMaxRowCount(). Change-Id: I2f22e614fb79b8e651308bd4dbddcd7e04651903 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130057 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23remove MAXCOL/MAXROW from ScExternalRefCacheLuboš Luňák
The range is used just for filtering out, and since this is about references to other documents, I wasn't sure which document to use as the limits, so I did a copy that of the functions that returns all. Change-Id: I9711534004796496558848adef03d38ddb115441 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129988 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23do not allocate columns in ScTable::GetPattern()Luboš Luňák
Otherwise e.g. going to the last column allocates all columns. Change-Id: I9cbdb18545bb200379616484c46c85ca31833563 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129995 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23clamp ColumnSpanSet::executeAction() to allocated columnsLuboš Luňák
It's already done by executeColumnAction() and currently existing actions do not need unallocated columns. This prevents allocating all columns e.g. when selecting a full row just because ScDocument::GetRangeScriptType() gets called. Change-Id: I517ce14a756be83a385968549b32d430274b8002 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129993 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-03-23do not allocate columns in ScTable::GetNumberFormat()Luboš Luňák
Change-Id: I9347f1d638473f9bcca9b96640a71ae1ef09e415 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129997 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>