summaryrefslogtreecommitdiff
path: root/svl
AgeCommit message (Collapse)Author
2021-11-18tdf#140086 svl: restore PasswordContainer to single-instanceMichael Stahl
(regression from 7256ff08bc46840bb85fa255ace6541dca91329e) Change-Id: Ib640dea001fc787279761ca72bbc3db46d0102c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125485 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2021-11-18rtl::Static->thread-safe static in svlNoel Grandin
Change-Id: Idadc4dc77eb681a8b8923ffacf37ddbe1d8245e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125425 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-15svl: use std::rotate() in SfxUndoManager::ImplUndo()Miklos Vajna
Instead of manually moving out, moving a range and then moving in. Change-Id: Iaff461e1fcee3936c8ddc02bf471a804e7881aef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125219 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-12sw, out of order undo: allow multiple actions from other viewsMiklos Vajna
Previously we assumed that the action to be executed is always exactly the top of the undo stack minus 1 element. Extend this, so that in case an other view appends two or more elements to the undo stack, we still find our undo action. Obviously only do this if all those undo actions are independent from us. This requires replacing the swap in svl/ with a move-out + move a range down + move in construct. Change-Id: Ic12d32d6eb5e77618d99eddb4fa096802f32d655 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125076 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-11sw, out of order undo: allow a subset of a non-empty redo listMiklos Vajna
Specifically, we used to not allow out of order undo at all if the redo list was non-empty. This relaxes that condition a bit. Out of order undo is OK with a non-empty redo list, in case all undo actions in the redo list are either 1) owned by the current view or 2) independent from the undo action to be executed I.e. if view1 has lots of type undo actions and an view2 adds a single type undo action on top of it, then allow view 1 to execute multiple of its typing undo actions, not just a single one. Change-Id: I2f5d9404a9994ed74b65233d2a315976c27b28b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125023 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-10sw: allow undo of typing in 2 views independent from each otherMiklos Vajna
Undoing out of order is dangerous by default, so limit this to a very specific case as a start, that allows growing in follow-up commits. For now, allow out of order undo if: 1) redo stack is empty 2) we're in LOK mode (different views represent different users) 3) we undo a single action (count is 1) 4) the top undo action doesn't belong to the current view 5) the top and the previous undo actions are independent Which only requires that SwUndoInsert::UndoImpl() is independent for two different paragraphs, which seems to be the case. Independent undo actions opt in for this, currently the only such allowed undo action is SwUndoInsert ("typing"), which adds characters to a single text node. Even those are only considered independent if they operate on different text nodes. On the positive side, this allows out of order undo in the frequent case where two users collaborate on a long document and they just type some new content into the document at different paragraphs. Change-Id: Ibb4551e8f7046b4947491b8bf751eaa0cbb2d060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124949 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-07Resolves: tdf#145386 Use "Default" for LANGUAGE_PROCESS_OR_USER_DEFAULTEike Rathke
There's no, specifically not in Writer, handling of the LCID 0x0400 LANGUAGE_PROCESS_OR_USER_DEFAULT language/locale concept other than the number formatter mapping it to LANGUAGE_SYSTEM. Use the LANGUAGE_SYSTEM "Default" string in UI (status bar, status menu, language list) but keep the LCID, and don't append the resolved locale string as it is also displayed both in the Font Western and CJK listboxes. This ends up as two list entries, like * Default - English (UK) first entry * Default last entry of which the second would be selected. Change-Id: I8d9e4171bee6bbe9d1c9dcfb7a5fa8fc92ea1a2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124449 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-10-31Prepare for removal of non-const operator[] from Sequence in svlMike Kaganski
Change-Id: I6b71a075de5d5ac002dc48cd2bb21ff5bf5dd072 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124395 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-29Fix misuses of NULL across Windows-only codeStephan Bergmann
...which defines NULL as a plain 0 integer literal instead of the GNU __null extension, so clang-cl's -Wnull-conversion cannot kick in. These findings are from an experimental build done with clang-cl and a modified > --- a/clang/lib/Headers/stddef.h > +++ b/clang/lib/Headers/stddef.h > @@ -83,6 +83,10 @@ typedef __WCHAR_TYPE__ wchar_t; > # if !defined(__MINGW32__) && !defined(_MSC_VER) > # define NULL __null > # else > -# define NULL 0 > +# if __cplusplus >= 201103L > +# define NULL nullptr > +# else > +# define NULL 0 > +# endif > # endif > #else > # define NULL ((void*)0) However, that build also ran into lots of places where 3rd-party code in external/ and Windows system headers caused issues when NULL is nullptr (which I worked around with various hacky patches for that build), so this is unfortunately not something that can easily be enabled generally. Change-Id: I10674464498a9bc63578d9e6cc32ddde23ab4f30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124419 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-26tdf#131025 swtable: don't apply number format to non-number textJustin Luth
Applying a numbering style to text causes export to save that out as a number (valued as zero). That is not good because the ODF spec says that a number overrides a string. So don't accept a numbering format on non-number text. Why is this change good? -the cell previously had no direct formatting (by definition). -the cell's previous old format was text (tested). -any numbering format applied obviously isn't correct (by definition). -any previous formatting has already been overwritten with numformat. -the default numbering is appropriate for text. -empty cells still get the numbering format (tested). -odd human-designed formats are accepted as intentional (tested). What are the concerns? -the scope of this change is HUGE, way beyond this bug. -on both my dev box and patch box I saw occassional crashes. -the bug was "fixed" by a different import commit that ensured different languages were treated consistently. So this patch is no longer critical, just nice to have to avoid exporting out-of-spec content. Change-Id: Id3dc5f803c3cf4875bc0cab52d1019a18679da77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123904 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2021-10-25Restore behaviour SvNumberFormatterServiceObj keep LANGUAGE_SYSTEM unresolvedEike Rathke
Semantics were temporarily changed with commit bba6a4ed92a0feb288a9dedd648d623bee02a3ce CommitDate: Mon Oct 25 11:18:31 2021 +0200 Get rid of fuzziness in MsLangId::Conversion::convertIsoNamesToLanguage() Change-Id: I8bbf77998bea81c5691ba518c7ae25093b0df421 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124141 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-10-25Get rid of fuzziness in MsLangId::Conversion::convertIsoNamesToLanguage()Eike Rathke
With on-the-fly LanguageTag the fuzzy fallbacks for a few languages aren't needed anymore. Proper fallbacks should be obtained when needed, like when configuring default locales, or configured values used after. Change-Id: I8b85b8099e085508435036ac846db6c3e516dc23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124127 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-10-25Fix stack-use-after-scopeStephan Bergmann
...during CppunitTest_svl_qa_cppunit, after df42cb6552b20372f62b5a361709670db80e4ed4 "Optimize assignment from OUStringLiteral to OUString", > ==918==ERROR: AddressSanitizer: stack-use-after-scope on address 0x2b2e203b5900 at pc 0x2b2e1b9004f8 bp 0x7ffc06726270 sp 0x7ffc06726268 > READ of size 4 at 0x2b2e203b5900 thread T0 > #0 0x2b2e1b9004f7 in void rtl::str::release<_rtl_uString>(_rtl_uString*) /sal/rtl/strtmpl.hxx:1064:9 > #1 0x2b2e1b8d916c in rtl_uString_release /sal/rtl/ustring.cxx:1785:12 > #2 0x2b2e36263ec5 in rtl::OUString::~OUString() /include/rtl/ustring.hxx:493:9 > #3 0x2b2e3622c5ff in (anonymous namespace)::Test::testTdf103060() /svl/qa/unit/svl.cxx:553:1 [...] > [2304, 2320) 'EXPECTED_G3' (line 550) <== Memory access at offset 2304 is inside this variable (<https://ci.libreoffice.org/job/lo_ubsan/2176/>). (aa2064c5c5f23f6f4b7bc44e12345b37f66995bc "Improve loplugin:stringliteralvar" had failed to introduce those OUStringLiteral variables as static.) Change-Id: I59168979fcc4b055d17d1d4f315577eef1027505 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124134 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-16Simplify vector initialization in svlJulien Nabet
Change-Id: I8ff1eb008f3173791c7c1020db08d29451998f42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123699 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-15Remove non-const Sequence::begin()/end() in internal codeMike Kaganski
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14Avoid COW overhead using css::uno::SequenceMike Kaganski
The scenarios are: 1. Calling sequence's begin() and end() in pairs to pass to algorithms (both calls use getArray(), which does the COW checks) 2. In addition to #1, calling end() again when checking result of find algorithms, and/or begin() to calculate result's distance 3. Using non-const sequences in range-based for loops, which internally do #1 4. Assigning sequence to another sequence variable, and then modifying one of them In many cases, the sequences could be made const, or treated as const for the purposes of the algorithms (using std::as_const, std::cbegin, and std::cend). Where algorithm modifies the sequence, it was changed to only call getArray() once. For that, css::uno::toNonConstRange was introduced, which returns a struct (sublclass of std::pair) with two iterators [begin, end], that are calculated using one call to begin() and one call to getLength(). To handle #4, css::uno::Sequence::swap was introduced, that swaps the internal pointer to uno_Sequence. So when a local Sequence variable should be assigned to another variable, and the latter will be modified further, it's now possible to use swap instead, so the two sequences are kept independent. The modified places were found by temporarily removing non-const end(). Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-12Revert "Use placement new to avoid one of the allocation calls..."Stephan Bergmann
This reverts commit 503ab1ca9ae11978d9717557546c01ff598aaf88, plus follow-up 17915ab5202a4d7456e9bc031c3f6a72bc861844 "fix ubsan alloc-dealloc-mismatch". It failed to properly destroy the object assembly, and caused e.g. CppunitTest_svl_items to fail with > ==850754==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x6060000024e0 in thread T0: > object passed to delete has wrong type: > size of the allocated type: 64 bytes; > size of the deallocated type: 56 bytes. > #0 in operator delete(void*, unsigned long) at /home/sbergman/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3 (workdir/LinkTarget/Executable/cppunittester +0x330ae2) > #1 in SfxItemSet::~SfxItemSet() at svl/source/items/itemset.cxx:202:1 (instdir/program/libsvllo.so +0x110ccf6) > #2 in std::default_delete<SfxItemSet>::operator()(SfxItemSet*) const at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/unique_ptr.h:85:2 (instdir/program/libsvllo.so +0x1142a28) > #3 in std::_Sp_counted_deleter<SfxItemSet*, std::default_delete<SfxItemSet>, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:442:9 (instdir/program/libsvllo.so +0x12696e4) > #4 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:168:6 (instdir/program/libsvllo.so +0xe500b5) [...] > 0x6060000024e0 is located 0 bytes inside of 64-byte region [0x6060000024e0,0x606000002520) > allocated by thread T0 here: > #0 in operator new(unsigned long) at /home/sbergman/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3 (workdir/LinkTarget/Executable/cppunittester +0x32fe7d) > #1 in SfxItemSet::Clone(bool, SfxItemPool*) const at svl/source/items/itemset.cxx:1270:34 (instdir/program/libsvllo.so +0x1127854) > #2 in (anonymous namespace)::Node::setItemSet(SfxItemSet const&) at svl/source/items/stylepool.cxx:65:107 (instdir/program/libsvllo.so +0x1212179) > #3 in StylePoolImpl::insertItemSet(SfxItemSet const&, rtl::OUString const*) at svl/source/items/stylepool.cxx:417:19 (instdir/program/libsvllo.so +0x12103e1) > #4 in StylePool::insertItemSet(SfxItemSet const&, rtl::OUString const*) at svl/source/items/stylepool.cxx:456:17 (instdir/program/libsvllo.so +0x1212ffb) [...] in Clang ASan builds done with -fsized-deallocation. Change-Id: I3ccba7e7d9712ecabf38a0149252d3cd70cdb446 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123446 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-11In O[U]StringBuffer, make string_view params replacements for OUString onesStephan Bergmann
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-10loplugin:moveparam in svlNoel Grandin
Change-Id: Icd45c7f693c866e7eafcf6aeb052a4d190dce38c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123337 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-08loplugin:moveparam in svlNoel Grandin
Change-Id: I58c1ef97fd6cba281c90cc7ed9917e04b7f265ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123187 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-05drop 'using namespace std' in s* + toolkitJulien Nabet
Change-Id: Ibd0b983d46a5683df64b4de79cd444427705e9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123118 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-05fix ubsan alloc-dealloc-mismatchNoel Grandin
after commit 503ab1ca9ae11978d9717557546c01ff598aaf88 Author: Noel Grandin <noelgrandin@gmail.com> Date: Sat Oct 2 16:28:56 2021 +0200 Use placement new to avoid one of the allocation calls... Change-Id: I2eb85c5c1be5d2eaf757d717f03873415e49c9a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-04Fix typosAndrea Gelmini
Change-Id: Id88532da843e659d337f3529333a17a0c00c8328 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123050 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-03Use placement new to avoid one of the allocation calls...Noel Grandin
...when cloning a SfxItemSet. Change-Id: I344fee3863006066eade16db9df37599fc210be3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123001 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-03A more lightweight O[U]StringConcatenationStephan Bergmann
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:constmethod handle more casesNoel Grandin
remove some of the naming limitations, and handle pointer parameters better. I only let the plugin run up till vcl/ Change-Id: Ice916e0157031ab531c47f10778f406b07966251 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30tdf#144697: svl_qa_cppunit: Add unittestXisco Fauli
Change-Id: I7a62f7c5c8e6fceebcb9671fa28ec98dd7a312a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122878 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-09-30loplugin:constparams improve handling of pointer paramsNoel Grandin
Change-Id: I4c0002e72703eded435bfe4985f5b0121bf8524b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122843 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30Resolves: tdf#144697 Format out-of-bounds date(+time) as #FMT errorEike Rathke
i.e. < -32768-01-01 or > 32767-12-31 They couldn't be input or stored as proleptic Gregorian in file formats anyway. Additionally in i18npool handle the absolute year values casting conversion int32 <-> int16 where era 0 BCE year 32768 is fielded as -32768 but still is a valid year for our proleptic Gregorian, so it isn't displayed as --32768. Change-Id: Ifdd482f07e04c2a4296fd0556bbef7f1d3e15676 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122835 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-28drop 'using namespace std' hereRoman Kuznetsov
Change-Id: Ifbbd6e985fb66893dc872522ed5418453ca8e2d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122651 Tested-by: Jenkins Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
2021-09-23Sort ZF_STANDARD_NEWEXTENDED_DATE_... into ZF_STANDARD_DATE categoryEike Rathke
The legacy of binary file format compatible internal indices is gone so categories can as well be enlargened. It doesn't really matter, just a "nicer to see" sequence. Change-Id: Id20e08e8564a281859164d44e2e863e46689b2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122540 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-23Reorder the internal ZF_STANDARD_DATETIME offsets to a more logical sequenceEike Rathke
These once were to be strictly kept for the binary file format but nowadays only serve as a position / key index offset within the numberformat map. Change-Id: I7c61852cc26463b1d4d67a6152501d521440abe1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122530 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-23Add not-quite-ISO date+time with space and milliseconds and locale's separatorEike Rathke
NF_DATETIME_ISO_YYYYMMDD_HHMMSS000 YYYY-MM-DD HH:MM:SS.000 Users may expect to see that if they enter such, instead of the real ISO 8601 "T" format. Change-Id: Iad81750d1c74eedd8d4360163b29ecac98ef6824 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122502 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-21Add ISO 8601 date+time with milliseconds formatEike Rathke
NF_DATETIME_ISO_YYYYMMDDTHHMMSS000 YYYY-MM-DD"T"HH:MM:SS,000 using either ',' or '.' separator, '.' if Time100SecSep is '.' ',' else A prerequisite for tdf#88359 to not lose data when importing such, especially without "Detect special numbers" on. Change-Id: I02ab682636e6ddbcc4537183a3625ea61662f016 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122400 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-21SvNumberformat: preserve error position if already setEike Rathke
ImpSvNumberformatScan::ScanType() may already return an error position in which case FinalScan() is not executed but nResultStringsCnt is set only there and otherwise 0, so after ScanFormat() force a different error position only if both are 0. This in the dialog positions the error selection correctly instead of after the first character. Change-Id: Icb87b212fe8465da8f885514ffa3a3ecc7cd69a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122399 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-20introduce SfxItemSetFixed and use it in DefaultPropertiesNoel Grandin
DefaultProperties::SetObjectItemSet is very hot when loading shapes, and a large chunk of that cost is allocating the pool item array. So use a template class to allocate the array in-line to the class, which means it can be allocated on-stack. Change-Id: Ic53b41f35784726362de38fceb35f8634cddf0a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122310 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-17create OnDemandCharClass cacheNoel Grandin
and use it in SvNumberFormatter for situations where we are rapidly switching locales (e.g. spreadsheet with alternating locales on adjacent rows) Change-Id: Ic35fdbbfbdc960673e91a37efed1d0e12c1a0751 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122264 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-17no need to allocate CharClass separately in SvNumberFormatterNoel Grandin
Change-Id: I79b815567c59702c2d3fe7944bb2f16bacf0e472 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122252 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-17speedup toUpperCase when called in parallelNoel Grandin
by removing locking from CharClass, which means we need to make it an immutable class Since SharedStringPool in sc/ stores a pointer to the CharClass in use, we have to tweak SvtSysLocale so that the object does not change location. Change-Id: I2c62d354fa542ebc04e755ce5b9b9e2ddff76a64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122185 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-17remove GetCharClassPtr from SvtSysLocaleNoel Grandin
we already have GetCharClass and we never return a nullptr Change-Id: I3cb79bc60be614c0474ecfdaad17991f2ecb6368 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122208 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-15loplugin:finalclassesNoel Grandin
Change-Id: I88831f290e1923db6fb5a733746bfa3bc7fbc7e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122148 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4Mike Kaganski
- Change implementations of getSomething to use getSomethingImpl Or where that's impossible, use getSomething_cast to unify this and reduce number of places where we reinterpret_cast. All static methods getting tunnel ids were renamed to getUnoTunnelId, to comply with the convention used in <comphelper/servicehelper.hxx>. TODO (in separate commits): - Revise uses of getSomething to use getFromUnoTunnel Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1Mike Kaganski
The header got some changes: 1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace 2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace of uses of OImplementationId with it, including in XTypeProvider 3. Introduce convenience functions 'getSomething_cast' to cast between sal_Int64 and object pointers uniformly. 4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make it a bit shorter, and to reflect its function better. Templatize it to take also css::uno::Any for convenience. 5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it handle cases both with and without fallback to parent. 6. Adjust UNO3_GETIMPLEMENTATION_* macros TODO (in separate commits): - Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation - Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-13Check string boundsEike Rathke
Doesn't occur in practice because all date acceptance patterns start with a YMD character, enforced by the dialog, but just in case.. Change-Id: I8ed43a272e9501c6977888b1f587ed14c85024ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122025 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-13Resolves: tdf#116184 Check that there is no trailing number behind a matchEike Rathke
... without being separated by a blank so the match is rejected if it doesn't possibly form a date+time input and input can be accepted as decimal fraction. Change-Id: Iabd1d216366ecb8454c59822ce58f112bfa6091e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122024 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-09-09workaround -Wshadow in libcuckooNoel Grandin
that triggers with gcc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0 Change-Id: I038e229890fcc3c8bb7986a747434e9e033b4f5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121838 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-09tdf#130795 use concurrent hashmap in SharedStringPoolNoel Grandin
we are loading a spreadsheet in parallel here, but the parallel threads achievei very little actual concurrency because of heavy contention in the SharedStringPool mutex. So switch to a concurrent hash map. I looked at a couple of different ones (including the Folly one), and this was the one with the simplest resulting code. This takes my load time from 12.5s to 8s Change-Id: I04d6d8e11d613b510eb3bc981f3338819b7ac813 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121717 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-03clang-tidy:readability-redundant-member-initNoel Grandin
Change-Id: I6a2a36c28fafac7002fbe093b22ad186562ea5c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121543 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-01Resolves: tdf#144209 Handle General containing formats in RoundValueAsShown()Eike Rathke
Calling SvNumberformat::GetThousandDivisorPrecision() for a "AA "General format resulted in 3000 as that was implemented for tdf#106253 without taking into account that ImpSvNumberformatInfo::nThousand may be abused under some conditions, which here is having FLAG_STANDARD_IN_FORMAT = 1000 as nThousand, multiplied by 3 gives 3000. Subtracted from the 0 precision gave -3000 decimals for which of course the new rounding produced 0 where it previously simply ignored the decimals and returned the original value. Change-Id: I66afaf1e2d8b2654d9f7cc8cfb66389357fb742d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121447 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-08-24osl::Mutex->std::mutex in OFSStreamContainerNoel Grandin
Change-Id: I1402b66935c0229977357d0a6ec8ed0bc777de3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120904 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>