summaryrefslogtreecommitdiff
path: root/svl/source
AgeCommit message (Collapse)Author
2023-09-11ITEM: Diverse further changes/cleanups/preparationArmin Le Grand (allotropia)
Added a counter for SfxItemSet usages, similar to the already added one for SfxPoolItems to allow quick info about evtl. problems/drawbacks of changes. Replaced enum SfxItemKind in favour of settable boolean flags directly at SfxPoolItem. These are organized as bitfield, do not need more space as the enum and allow to be set separately and multiple ones at the same time. Flags for PoolDefault/StaticDefault/DeleteOnIdle use this now and are quickly accessible booleans. It is not a problem that theoretically the flags for PoolDefault/StaticDefault could now both be set - this is internal to SfxItem stuff and not accessible from normal code, so can be managed. Added for debug build a bitfield boolean m_bDeleted that will be set in the SfxPoolItem destructor. Of course it's usability will depend on the freed space not yet being re-used, but will hopefully help in the debugger to detect reasons for failure (would have helped at least me before). Added for replacement of virtual method IsVoidItem() another bitfield bool m_bIsVoidItem that is set in the constructors of SfxVoidItem. Also had to add some constructors to do that which were defaulted before. This is mainly because the base class SfxPoolItem does *not* have a copy-constructor that copies the members (flags/RefCnt/WhichID) and we should keep that 'indirect reset' when Cloning. isVoidItem() is now a simple boolean member access - the bitfield does the needed masking. This spares one entry in the virtual function table of SfxPoolItem which is derived more than 500 times. Used the results of the experiment at https://gerrit.libreoffice.org/c/core/+/156774 to change some accesses to IsVoidItem() to use SfxItemState instead. This is for preparation of splitting up the two usages of SfxVoidItems, see commit text in the experiment. If this shows problems in the future those six places documented there may have to be changed back to use the new isVoidItem(), but should also check the ptr this time to be non-zero. Removed SFX_ITEMS_SPECIAL that is no more used anywhere. Change-Id: Ib687ca2362d72a4651c75aee0c67029088f68947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156805 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-09-09Fix typoAndrea Gelmini
Change-Id: I89d3a3074929ba867975ae57d350b7e4211ed67c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156757 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-09Fix typoAndrea Gelmini
Change-Id: I88d79ca31981a49736af571067831c703cf65d3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156755 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-09Fix typoAndrea Gelmini
Change-Id: I1a853bec38ce31d7961a150d4f3958c38c896559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156756 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-09Fix typoAndrea Gelmini
Change-Id: Icf7b6216180fe259cc9c529ea5c48720324c9262 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156759 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-08ITEM: preparations for more/easier changes IIArmin Le Grand (allotropia)
Again this is a change to improve understandabilty/changeability of SfxItemSet code plus some cleanups. Still did a callgrind round to check - it slightly got faster. In a start/load(complex SW doc)/ show/shutdown cycle compared with master I get 96.722 mio cycles compared with 99.851 mio in master. Main focus was to isolate two aspects: preparation and cleanup of an Item for usage in an SfxItemSet. For that we now have implCreateItemEntry: to do all needed actions to create/prepare an Item for membership, including evtl. AddRef/Cloning/using ItemPool stuff. implCleanupItemEntry: to do all needed actios to correctly clean that Item up again. All formally accesses distributed over SfxItemSet (and other places) are cleaned-up to use these. The Item-counter in DBG code that I already added helped a lot to do this. Also cleaned up PutImpl to 1st check if action is necessary (Item is already in place) or not, reducing spot to cleanup an Item that was handed over as bPassingOwnership to one place. I also added a 2nd flag, bItemIsSetMember, that tells if the Item given as input is already member of an SfxItemSet, in that case a shortcut can be used (increase AddRef, use). Adapted all places AFAP to use the new container interface (begin(), end(), ...) where useful. Made GetItemState inline and directly use the tooling method. Same for InvalidateItem. Added much more comments to describe what's going on or to hint at problems (check for CAUTION). Removed PutDirect - not needed anymore, probably was there to not get recursive death loop with callbacks in SW. More smaller changes. Checked with all apps, played around. Still, stuff may come up, so I put on gerrit the tests will show and give further hints. At last SfxItemSet is a minefield :-) Had to adapt SfxItemSet::implCreateItemEntry when input Item is a StaticDefaultItem. SfxItemPool::PutImpl needs to be called in that case. Had to correct bItemIsSetMember in all cases if the transfer of SfxPoolItems is between SfxItemSets with different SfxItemPools. This is and will be necessary as long as the Items are stored at the pool. After a hard deep-dive I found the error: m_nCount was not in all cases correct, invalid items get counted. Win build *insists* for initialzation of local var aEntry in SfxItemSet::PutImpl, triggers warning C4701: "potentially uninitialized local variable 'aEntry' used". This is not the case here, but I know of no way to silence the warning in another way, so added an extra-call to begin(). Re-added to use static pool defaults directly, possible After the fix 6d8c6e8d60956fd36094035a526c1a29a902204b, thanks for that. This avoids some cloning of Items. CAUTION: static default items are not *that* static as it seems (or: should be). If they are freed with the Pool (see ::ReleaseDefaults) they will be deleted. If the target pool is different from the source pool static default items from the source pool can be used that then might be deleted (sigh). A solution would be to change all pools to really work on static instances of default items. Another one would be to know here that the targetPool != sourcePool, so maybe extend bItemIsSetMember -> bSamePool. A good test for this is CppunitTest_chart2_uichart/testTdf98690. Until solving/cleaning up we unfortunately *have* to continue to clone static default items... Change-Id: Ibd8dc6d612f594a5ad88c75fcee8726d89a6090c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156306 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-09-07tdf#141123: impossible to replace an event after it has been setJulien Nabet
Change-Id: Iabecd5b4cff803e45fede6b25db03d553eb835a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156651 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-18ITEM: preparations for more/easier changesArmin Le Grand (allotropia)
This change is not about speed improvements but diverse preparations to make changes/reading/understanding easier. It does not change speed AFAIK. Added a global static debug-only counter to allow getting an overview over number of all allocated SfxPoolItem's and the still alloated ones at office shutdown. The values are used in Application::~Application to make a short info statement. It allows to be able to quickly detect if an error in future changes may lead to memory losses - these would show in dramaitically higher numbers then (hopefully) immediately. Moved SfxVoidItem to own source/header. Added container library interface support to SfxItemSet, adapted already some methods to use it - not all possible, I will commit & get status from gerrit 1st if all still works and then continue. Changed INVALID_POOL_ITEM from -1 to use a global unique incarnation of an isolated derivation from SfxPoolItem. It allows to avoid the (-1) pointer hack. Since still just pointers are compared it's not worse. NOTE: That way, more 'special' SfxPoolItem's may be used for more States - a candidate is e.g. SfxVoidItem(0) which represents ::DISABLED state -- unfortunately not only, it is also used (mainly for UI stuff) with 'real' WhichIDs - hard to sort out, will have to stay that way for now AFAIK. Changed INVALID_POOL_ITEM stuff to use a static extern incarnated item in combination with a inline method to return it, called GetGlobalStaticInvalidItemInstance(). Isolated create/cleanup of a SfxPoolItem entry in SfxItemSet to further modularize/simplify that. It is currently from constructor & destructor but already shows that PoolDefaults are handled differently - probably an error. Still, for now, do no change in behaviour (yet). Got regular 'killed by the Kill-Wrapper' messages from gerrit, seems to have to do with UITest_sw_findReplace. That python/c++ scripting stuff is hard to debug, but finally I identified the problem has to do with the INVALID_POOL_ITEM change. It was in SfxItemSet::InvalidateAllItems() where still a (-1) was used -> chaos in detecting invalid items. Change-Id: I595e1f25ab660c35c4f2d19c233d1dfadfe25214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155675 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-08-11fix SfxBroadcaster::ForAllListenersNoel Grandin
regression from commit 7c66fc45239d2589e90fd694d54b3ff826b1bd15 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu Jun 1 14:22:57 2023 +0200 use internal iterator for SfxBroadcaster Change-Id: Ibd3abf23337c8fb0937d245474f2b89c8936a3ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-10ITEM: improve SfxItemSet notification callbackArmin Le Grand (allotropia)
When browsing cachegrind data I stumbled over the notification callback used by Writer in SfxItemSet::Changed. That is a virtual method that gets called in quite some places to forward item changes, SW uses it to record these. For that purpose always (quite some) data gets prepared without checking if this is necessary, this uses calls to ::Get and ::GetDefaultItem to have either the old or new Item from the parent or default (pool). This is not needed - except for Writer. Even there this mechanism is not always active. Thus I: - removed SfxItemSet::Changed, replaced with a settable callback member of type std::function<...>. Thus one less virtual function and depenence in SfxItemSet - added a callback functor to SwAttrSet that can be set at the SfxItemSet it is derived from - setting/releasing this only in used cases. It is not even used all the time in SW. - moved the creation/processing of needed data to a member function in SW (SwAttrSet::changeCallback). All processing and evtl. needed data is now created there - on demand. - adapted all places in SfxItemSet where that mechanism is used to only call it if set & without pre-calculating anything - since all former calls/usages were pretty similar I could put all of this to SwAttrSet::changeCallback This leads to use that only when needed now. Naturally, SW will potentially profit less than the other apps. Here are callgrind numbers with this change using OfficeStart, DocLoad, DocClose, OfficeShutdown. This change also has potential avantages @runtime/UI which also did all preparations to call SfxItemSet::Changed all the time: Writer doc: 0,9907 ~1% old: 93842 mio new: 92971 mio Draw/Impress doc: 0,9971 ~2,8% old: 170023 mio new: 169544 mio ::Get reduces from 1416103 to 293874 calls ::GetDefaultItem reduces from 2252336 to 1927209 calls (nearly half) Calc doc: 0.9868 ~1,3% old: 194708 mio new: 192130 mio ::Get reduces from 882298 to 880087 calls ::GetDefaultItem reduces from 4611901 to 2633555 calls (nearly half) Of course this highly depends on the used test documents, so it can only be a excerpt result. Also adapted SfxItemSet::MergeRange a little bit: Do nothing not only when a single new slot is already contaioned, but check if all slots are already present. This works well and fast using the formally added caching mechanism. Change-Id: I4d369d2e5b21aa7a21687177518150515e3de954 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-08-07Fix typosAndrea Gelmini
Change-Id: If6cdd69d4508cc938ee90f286b2a6103f24a917b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155430 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-08-07ITEM: speedup WhichRanges access by bufferingArmin Le Grand (allotropia)
I checked for was to speedup SfxItemSet stuff, so had (besides other things) a look at WhichRangesContainer and it's usage(s). Problem with the WhichRanges is that a WhichID which you try to find is usually inside that range, so binary search is no option. You have to detect in which range the WhichID is hosted and can the directly calculate the index into the array of Items at the SfxtemSet. Currently when needing to transform a WhichID to an index into the array of Items in SfxItemSet the array of the WhichRangesContainer is searched linearly from the start every time. This can be a little bit speed up by buffering the last successful 'hit' and trying to re-use it. Also the special case of a single WhichPair (e.g. UI stuff) is worth having a look. All acesses to that transformation are changed to use the tooling method getOffsetFromWhich() at the WhichRangesContainer which does the transformation. This also needed cleanup of ItemOffsetHint instances & stuff around it. It does not more than before but also profits from the single entry buffer. I added some DBG_UTIL-based stuff to watch the hit/miss ratio, which is heavily changing from app to app & usage, but varies around 1.5 to 3.5, also saw 6.5 and more at document import. NOTE: I already checked if sorting the WhichPair(s) in WhichRangesContainer by their 'width' (highest WhichID mnius lowest WhichID helps. The idea was when the Items would be used in a regular manner that when having the widest WhichPairs at the start, the buffer would even be better used - but doing tests in all apps shows nearly no gain, so I left that out. NOTE: Not too much speedup, but faster... Had to deep-debug due to CppunitTest_sw_odfexport failing, found a slight diff between GetItemState impls, corrected. Also added more changes, e.g. TotalCount is now a member to not always have to calculate it from the WhichRangesContainer. Extended GetWhichByPos to 1st try to find a set Item, else iterate over WhichRangesContainer. This is due to SfxItemIter's implementations of GetItemState and ClearItem which both up to now just accessed the SfxPoolItem array of the SfxItemSet, ignoring that no Item (nullptr) or state DONTCARE (-1) may have been set there (no item is prevented by ite Iterator, but better be careful). Added WhichRangesContainer::getWhichFromOffset and made SfxItemSet::GetWhichByOffset use it. Addedd optimizations there for single-entry WhichPair and using the buffer at WhichRangesContainer which is possible. Removed debug comparing stuff (had a test that used the former adapted GetItemStateImpl method in SfxItemSet::GetItemState and compared with the changed GetItemState_ForWhichID). Added some comments and assertions where useful. Made ClearSingleItem_ForOffset work without handing over WhichID, that makes calls using it simpler and avoids calculating the WhichID just for that call. Change-Id: I54de552368b654f00f115978715f8241eb603752 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155316 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-08-03move SwVirtPageNumInfo to SfxHintBjoern Michaelsen
- also remove now obsolete GetInfo overrides Change-Id: Iaac75ed2e53daead06242ce4620fd2b879909e02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155061 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-08-02Silence some bogus -Werror=array-bounds etc. with GCC 12 and -std=c++20Stephan Bergmann
...as witnessed with patch set 1 of <https://gerrit.libreoffice.org/c/core/+/155121/1> "Bump baseline to C++20", > In file included from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:46, > from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/ios:40, > from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/ostream:38, > from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/ustring.hxx:34, > from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/svl/gridprinter.hxx:13, > from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svl/source/misc/gridprinter.cxx:10: > In function ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = long unsigned int; _Args = {const long unsigned int&}]’, > inlined from ‘static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = long unsigned int; _Args = {const long unsigned int&}; _Tp = long unsigned int]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/alloc_traits.h:518:21, > inlined from ‘constexpr void std::vector<_Tp, _Alloc>::_M_realloc_insert(iterator, _Args&& ...) [with _Args = {const long unsigned int&}; _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/vector.tcc:462:28, > inlined from ‘constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_vector.h:1287:21, > inlined from ‘mdds::mtv::soa::multi_type_vector<Traits>::iterator mdds::mtv::soa::multi_type_vector<Traits>::set_cell_to_empty_block(size_type, size_type, const T&) [with T = rtl::OUString; Traits = mdds::multi_type_matrix<svl::{anonymous}::matrix_traits>::mtv_trait]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:2995:50, > inlined from ‘mdds::mtv::soa::multi_type_vector<Traits>::iterator mdds::mtv::soa::multi_type_vector<Traits>::set_impl(size_type, size_type, const T&) [with T = rtl::OUString; Traits = mdds::multi_type_matrix<svl::{anonymous}::matrix_traits>::mtv_trait]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:1240:72, > inlined from ‘mdds::mtv::soa::multi_type_vector<Traits>::iterator mdds::mtv::soa::multi_type_vector<Traits>::set(size_type, const T&) [with T = rtl::OUString; Traits = mdds::multi_type_matrix<svl::{anonymous}::matrix_traits>::mtv_trait]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:696:14, > inlined from ‘void mdds::multi_type_matrix<Traits>::set(size_type, size_type, const string_type&) [with Traits = svl::{anonymous}::matrix_traits]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/multi_type_matrix_def.inl:356:5, > inlined from ‘void svl::GridPrinter::set(size_t, size_t, const rtl::OUString&)’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svl/source/misc/gridprinter.cxx:68:25: > /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_construct.h:97:14: error: array subscript 0 is outside array bounds of ‘long unsigned int [0]’ [-Werror=array-bounds] > 97 | { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); } > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (<https://ci.libreoffice.org/job/gerrit_linux_gcc_release/148699/>), etc. (The curly braces in sw/source/core/doc/doc.cxx had to be added to avoid an ensuing bogus > sw/source/core/doc/doc.cxx: In static member function ‘static void SwDoc::CalculatePagePairsForProspectPrinting(const SwRootFrame&, SwRenderData&, const SwPrintUIOptions&, sal_Int32)’: > sw/source/core/doc/doc.cxx:1000:5: error: ‘else’ without a previous ‘if’ > 1000 | else > | ^~~~ ) Change-Id: I902f6d74d897b9bf281dc9c821aff30e7e72582a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155215 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-07-22SfxItemSetHint is deadNoel Grandin
since commit 519876dffdc8c93710af543cc11332dab9a50c14 Author: Mike Kaganski <mike.kaganski@collabora.com> Date: Tue Jul 18 23:45:47 2023 +0300 Cleanup SfxApplication::Get/SetOptions, and drop unused SIDs Change-Id: I8d306bf6792630cfdaa0a0ac8b77730e1e1f0070 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-19Cleanup SfxApplication::Get/SetOptions, and drop unused SIDsMike Kaganski
The removed stuff was never used elsewhere; e.g. all uses of GetOptions use Which Ranges that don't include the removed identifiers. Elements removed from SetOptions weren't passed to that function from anywhere. Change-Id: Id81b57014b82f89538a46a609f3e4b328864bbcf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154604 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-17Simplify a bitMike Kaganski
Change-Id: I20e7c1082687d780eded364f2620dd0dcbe831ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154532 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-16SfxAllEnumItem::GetTextCount should return sal_uInt16Mike Kaganski
To be consistent with its other methods (Get/SetTextByPos), taking sal_uInt16 Change-Id: I1c6e7c9fcb8bb6bf57d4ed4481240e0c7b606049 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154460 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-05SvtCJKOptions::EOption is unusedNoel Grandin
ever since commit 5db72ef0b381671b7867bda759098a92909e06d8 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Mon Jul 26 13:51:57 2021 +0200 drop SvtLanguageOptions class Change-Id: I2d56b0c21510239ef1ee1d0b95748641d485580c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154053 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-30Drop SfxStyleSheetBasePool::SetParentMaxim Monastirsky
Use SfxStyleSheetBase::SetParent directly instead. The base class was just calling it anyway, while the SwDocStyleSheetPool override was mostly a copy & paste of its override in SwDocStyleSheet. Change-Id: I18d8208ed2d079e0f2ce4f13a5dbdda6fe4730e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153773 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2023-06-29loplugin:unusedmethodsNoel Grandin
Change-Id: I95ab7581dec35b113cb657ce8e5ee27c89c73593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153746 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-28Simplify SvxSearchItem::PutValue a bitMike Kaganski
Change-Id: I2cbc5dce800b773e6c20cb3ea6f0e520a3f69db9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153688 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-28Drop i18nutil::SearchOptionsMike Kaganski
It was mostly unused by now, only remained in a couple of function arguments, where callers actually passed SearchOptions2, and where internally it was converted back to SearchOptions2. Change-Id: Ib188ec3bf0de6d1f70a04eb90fb3a577df8b3d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153687 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-26new loplugin:constexprliteralNoel Grandin
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-21Require icu-i18n >= 66Khaled Hosny
We were requiring ICU 4.6 which was released in 2011, and ifdef'ing our way through newer ICU versions. ICU is a core dependency and it makes no sense to build LibreOffice with such ancient versions of it. This change requires ICU 66 (released in 2020), and removes all the ifdefs for older versions. There are more cleanups to do, but these will be done separately. Change-Id: I2e4f7608a08f4d531b0a4c74bbfdf91a451f833f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153387 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-21svl: Use DateTime::Sub() instead of operator-()Eike Rathke
Change-Id: I036798013404df4bcfb988d4f231fcf30cec3162 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153382 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-18Use getXWeak in svlMike Kaganski
Change-Id: Ia000bf4afa60a4e5bf1469fef7a611ab07e73331 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150872 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-16tdf#103064 sw,editeng: make para styles work inside commentsMaxim Monastirsky
- Style objects for comments are stored in a dedicated stylesheet pool, and constantly updated from the "real" styles using modification broadcasts. In theory, it should be possible to use same objects for both Writer core and EditEngine, as they use separate item ranges. But unfortunately SwDocStyleSheetPool isn't really a styles container, but just a wrapper around Writer's core styles, with a single mxStyleSheet member that is filled each time with data from different styles (while EditEngine expects different styles to be represented by different objects). - EditEngine switched to allow duplicate listeners for styles - one per paragraph. The use case is 2 paragraphs of the same style, and then one of them is switched to another style. In that case we still need to keep listening to the former style for the other paragraph. There is probably some opportunity for optimization, but it should be good enough for now. - Copying formatted text from document's body doesn't preserve style assignment for now. The editeng RTF import should be tweaked to not insert styles into our "special" stylesheet pool (or somehow forward them to Writer's core style handling) before we can enable this part. Change-Id: Ib67c5388f9cd078c73ec0d453017f815843161ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153156 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2023-06-11use internal iterator for SfxBroadcasterNoel Grandin
So we can avoid exposing the internal listener vector. (which allows further optimisations) Change-Id: If288141a37314dcc01d203029dc51c71ec2b7f54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152857 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-10ofz#59696 AbrtCaolán McNamara
Change-Id: I4cf6043f55a7aae23b6a801dd41b0912b68e1d3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152836 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-07tdf#155376 partially convert SvCTLOptions to officecfgNoel Grandin
When accessibility is enabled, Calc will add tens of thousands of listeners. We then spend a significant chunk of time creating SvCTLOptions objects (attached to ImpEditEngine) and adding and removing those objects from the related listener lists. But the required information is already globally cached by the officecfg module, so we can avoid that overhead and just fetch it directly from officecfg. Change-Id: I7ff55fd7c4926866eb7086812275ba8bd6e84c75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152645 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-01sw doc model xml dump: show address of SfxBoolItemsMiklos Vajna
I want to know when a relevant keep-with-next pool item is read, but there are many of them, so seeing the pointer address is helpful. Change-Id: I5ff7654430a41eaea6c7b0cf722e34256cdd4d3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152480 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-05-31do not throw DisposedException when inside a dispose() methodNoel Grandin
There is no need to do this, as the documentation of css.lang.XComponent::dispose at udkapi/com/sun/star/lang/XComponent.idl states: After this method has been called, the object should behave as passive as possible, thus it should ignore all calls Otherwise, the effect of throwing here is mostly to disturb the flow of logic in caller code, preventing other parts of teardown from proceeding smoothly. Change-Id: I30e6d1b35f85b727debf4405a995fdc0a4fccde6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152450 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-26tdf#150028 Treat decimal separator after [SS]Laurent Balland
Only decimal separator after S or SS was treated This change adds [S] and [SS] to treat formats like [SS].00 Update: correct export to XML Add QA unit tests Change-Id: I97ce4084d3caab2fcd18f1c70cd4221596290563 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151823 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-05-04Resolves: tdf#134308 if max undo is 0, treat as if no undoCaolán McNamara
Change-Id: I7eaa71d80718a4350ba6a3d7ff19ce09e1ac3aa3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151354 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-03tdf#145925: Support AutoCapitalize in DOI recognitionBaole Fang
Sometimes, the first character of the doi string is auto capitalized, which isn't recognized as DOI. Now, the doi detection is able to recognize doi string with the first character capitalized, like what is done in url recognition. Change-Id: I95334941dc4cda3095f1750fea927640dea55e23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151142 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-27tdf#145925: Add DOI recognitionBaole Fang
Detect DOI string in the form of "doi:10.*" and add hyperlink to it. It works the same way as url recognition. Change-Id: I3c4e78a110fd81ad7e727d5e9acee7e51127466a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150954 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-21loplugin:unnecessarygetstr extend to checking std::string::c_strNoel Grandin
Change-Id: I17398e2a6a31a2c98ba8e54b5c8045f22aee8759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-06tdf#153887 Fraction number format: avoid 0/0Laurent Balland
If round value is an integer and there is no integer part in the number format, then nDiv was wrongly forced to 0. Add corresponding unit tests. Change-Id: Ib69393eca8f6c2bdda0eacfc83637ab0c971ff2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149118 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-03-30loplugin:stringadd in starmath..svlNoel Grandin
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: Id8f229c3a5223dee8d2710caf15d4612594fc763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149748 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-23rtl::Static to thread-safe-staticNoel Grandin
Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-18loplugin:stringadd use more O[U]StringCharNoel Grandin
Change-Id: I196e4539ad430a39415eff9d7170b33df7228230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149062 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-14tdf#117037 - Support Unicode minus (0x2212) in the number scannerAndreas Heinisch
Change-Id: I5b2cd4f3d6ac23e10dc0745819c7955d0a8ff170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148432 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-03-14elide some temporary OStringsNoel Grandin
where we can pass a string_view into OStringToOUString Change-Id: If7803ba49aa15f6e9c7bd386d32fb84003155390 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148844 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-14svl: fix CppunitTest_desktop_lib's DesktopLOKTest::testSignDocument_PEM_PDFMiklos Vajna
The problem was that this test passed when the entire suite was running, but not as an individual test. Digging deeper, this didn't pass in isolation because the test loads a private key into memory (which is not in the NSS DB) and since commit 5592ee094ca9f09bfcc16537d931518d4e6b2231 (svl: fix testSignDocument_PEM_PDF with "dbm:" NSS DB, 2022-04-28) we delete that in-memory key as a workaround for the NSS dbm -> sqlite transition. Fix the problem by not deleting the in-memory private key in the LOK case: this makes the test (operating in a stateless mode, with in-memory keys) pass again and keeps the desktop signing (working with the NSS DB) working. I noticed this test failure as a local test update of libxmlsec to 1.3 RC started to fail here even when the whole suite was running, but looks like this was working by accident before anyway, and the fix doesn't hurt for libxmlsec 1.2, either. Change-Id: Id365ddc5c5d04d538609f444c0e3c4ab4b32a6fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148817 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-03-13make more use of OUStringBuffer::append(OUStringConcat)Noel Grandin
where we can avoid constructing temporary OUStrings Change-Id: I0eacd68a8d1b450894c2ea769055f16886b78ad0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148780 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-13Introduce OUStringBuffer::insert taking OUStringConcatMike Kaganski
Avoids some (re)allocations, and aligns with already existing append Change-Id: I536ba50f56fc560c0f6e8c0a8b65bd4248896a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148777 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-10improve loplugin:unnecessarylockingNoel Grandin
to find more locking we can remove Change-Id: Ief7bc5ec2a1ff31f22a0ad366910b7fcc4725818 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-28no need to allocate Date separately in ImpSvNumberInputScanNoel Grandin
it is only one pointer big Change-Id: I8b0b7ea0cf69cecabc2ddfb7e5d134037221057c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147946 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-25refactor DocPosUpdate, part 2Bjoern Michaelsen
- separate the message send from the field manager to the fields containing no start index from those send from the field to the frames containing an index - use member functions where possible: SwFieldType, SwFormatField, SwTextNode Change-Id: I488e4003b75bf7b0ae700f39e2364d6e34a8bbfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147490 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>