Commit graph

4383 commits

Author SHA1 Message Date
Caolán McNamara
b95059acaf cid#1607396 silence Overflowed integer argument
Change-Id: I756688604ce80d0e9ca6494826767f49dcc13af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172095
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-20 11:07:15 +02:00
Caolán McNamara
d7056b1456 cid#1558088 COPY_INSTEAD_OF_MOVE
and

cid#1558080 COPY_INSTEAD_OF_MOVE
cid#1558077 COPY_INSTEAD_OF_MOVE
cid#1558055 COPY_INSTEAD_OF_MOVE
cid#1558043 COPY_INSTEAD_OF_MOVE
cid#1558039 COPY_INSTEAD_OF_MOVE
cid#1558015 COPY_INSTEAD_OF_MOVE
cid#1558014 COPY_INSTEAD_OF_MOVE
cid#1558009 COPY_INSTEAD_OF_MOVE
cid#1558002 COPY_INSTEAD_OF_MOVE
cid#1557998 COPY_INSTEAD_OF_MOVE
cid#1557996 COPY_INSTEAD_OF_MOVE
cid#1557990 COPY_INSTEAD_OF_MOVE
cid#1557986 COPY_INSTEAD_OF_MOVE
cid#1557980 COPY_INSTEAD_OF_MOVE
cid#1557971 COPY_INSTEAD_OF_MOVE
cid#1557968 COPY_INSTEAD_OF_MOVE
cid#1557967 COPY_INSTEAD_OF_MOVE
cid#1557961 COPY_INSTEAD_OF_MOVE
cid#1557959 COPY_INSTEAD_OF_MOVE
cid#1557958 COPY_INSTEAD_OF_MOVE
cid#1557956 COPY_INSTEAD_OF_MOVE
cid#1557953 COPY_INSTEAD_OF_MOVE
cid#1557949 COPY_INSTEAD_OF_MOVE
cid#1557947 COPY_INSTEAD_OF_MOVE
cid#1557940 COPY_INSTEAD_OF_MOVE
cid#1557931 COPY_INSTEAD_OF_MOVE
cid#1557930 COPY_INSTEAD_OF_MOVE
cid#1557915 COPY_INSTEAD_OF_MOVE
cid#1557913 COPY_INSTEAD_OF_MOVE
cid#1557910 COPY_INSTEAD_OF_MOVE
cid#1557886 COPY_INSTEAD_OF_MOVE
cid#1557884 COPY_INSTEAD_OF_MOVE
cid#1557880 COPY_INSTEAD_OF_MOVE
cid#1557875 COPY_INSTEAD_OF_MOVE
cid#1557871 COPY_INSTEAD_OF_MOVE
cid#1557862 COPY_INSTEAD_OF_MOVE
cid#1557847 COPY_INSTEAD_OF_MOVE
cid#1557845 COPY_INSTEAD_OF_MOVE
cid#1557844 COPY_INSTEAD_OF_MOVE
cid#1557843 COPY_INSTEAD_OF_MOVE
cid#1557838 COPY_INSTEAD_OF_MOVE
cid#1557835 COPY_INSTEAD_OF_MOVE
cid#1557834 COPY_INSTEAD_OF_MOVE
cid#1557828 COPY_INSTEAD_OF_MOVE
cid#1557823 COPY_INSTEAD_OF_MOVE
cid#1557817 COPY_INSTEAD_OF_MOVE
cid#1557813 COPY_INSTEAD_OF_MOVE
cid#1557812 COPY_INSTEAD_OF_MOVE

Change-Id: I55d4a920daa2d148683419169eb828325fd3c757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171732
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-11 20:14:54 +02:00
Caolán McNamara
e63da1689d cid#1556026 COPY_INSTEAD_OF_MOVE
and

cid#1556027 COPY_INSTEAD_OF_MOVE
cid#1556030 COPY_INSTEAD_OF_MOVE
cid#1556032 COPY_INSTEAD_OF_MOVE
cid#1556036 COPY_INSTEAD_OF_MOVE
cid#1556049 COPY_INSTEAD_OF_MOVE
cid#1557490 COPY_INSTEAD_OF_MOVE

Change-Id: If694c4d518323a8ae58bb13569f401b2b36cd427
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171704
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-08-09 21:00:59 +02:00
Armin Le Grand (Collabora)
af014d1b5d CairoSDPR: Simplify EditEngine text decomposition
The EditEngine decomposes it's content mainly to
Prmitives (there is still a direct paint mode used
in rare remaining cases which we not yet got rid
of). For TABs the special case for 'extended' TABs
(see format/paragraph/Tabs, FillCharacter) was
handed through all layers using method DrawingTab,
put into a DrawPortionInfo and held at the text
primitive (TextSimplePortionPrimitive2D). While
for direct paint the expansion was already done in
ImpEditEngine::Paint anyways (and always painted,
independent from bStripOnly what was unneccessary
and I corrected that, too) it had to be done for
text paint in VclProcessor2D for each repaint.
This is not needed, so now the extended text
created in EditEngine decompose gets used.

This makes a lot of stuff simpler, including
EditEngine/Outliner and some involved classes.
If it somehow should show that it might be
necessary to do that for each paint it should
be done in the obvious way then - using an own
primitive that creates the expansin in the
decomposition (and buffers it).

Change-Id: Ieb02219142af8f6bee01dcd658e08b185a4212cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171380
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-08-01 20:28:36 +02:00
Jaume Pujantell
75aeaab5ef cool#9352 unassign cursor on SdrObjEditView to avoid crash
On stress test with shapes and typing a segfault ocurred due to
using a freed vcl::Cursor.

On SdrObjEditView::SdrEndTextEdit, delete pOLV can delete the cursor
remembered in pTECursorBuffer. But if it is set to the window before
the deletion, it will be safely removed from the window.

And on SdrObjEditView::ModelHasChanged a re-anchoring sets a cursor
on the window that sholdn't be there and other SdrObjEditView can
see, remeber, and use it even after this one died and freed the
cursor.

Change-Id: I3cfef3b68b77e6e6b49c3b68297a6a20e1f9394a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171184
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 3b5738ab1a646d089fa7cc59ffaeda7d011c1e07)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171288
Tested-by: Jenkins
2024-08-01 13:54:28 +02:00
Mike Kaganski
550ef55881 Reintroduce OUString::replaceAt taking an OUString to LIBO_INTERNAL_ONLY
This allows optimizations when 'this' is empty, avoiding allocations, and
making it possible to not special-case it in other places, as was done in
ContentNode::Insert in commit 8ab44b114c
(tdf#161846 avoid allocation in ContentNode::Insert, 2024-07-30).

A couple of disambiguation templated overloads was introduced.

Change-Id: I2b5e94c2175379b2696c34e600393d32731f0ab6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171271
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-07-31 12:15:38 +02:00
Noel Grandin
a1be5ede8e reduce number of GetItem calls
if we already call GetItemState, we can use that call to fetch the item

Change-Id: I736dec9bb56ad3bd66bb53e1cef2cf1e3092821d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171269
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-31 09:54:12 +02:00
Noel Grandin
952ded0894 tdf#161846 no need to CloneAsValue() here
the methods are already returning by value

Change-Id: Ie9eaf2ba3ae0ca4ad79b05229dd6856537580044
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171249
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-31 07:05:52 +02:00
Noel Grandin
24a0ecfc9c tdf#161846 reduce re-alloc in ImpEditEngine::GetSelected
we can fairly easily allocate the exact buffer size we need and avoid
needing to extend the buffer

Change-Id: I7f0b2533dab03452db60ddaa5b8a5f3471c195ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171225
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-30 12:30:07 +02:00
Noel Grandin
8ab44b114c tdf#161846 avoid allocation in ContentNode::Insert
which is fairly common

Change-Id: I3b1ec65d880cb71b8894f292061e23376af177bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171224
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-30 10:39:59 +02:00
Noel Grandin
c39978f41d tdf#161846 use unordered_map in SfxItemPropertyMap
with large property maps, even a binary search starts
showing up, but we can do a O(1) search here by using a map

Change-Id: Ie7916076073e6dd393f0a1fb5a0db1b973999408
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171173
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-29 15:10:19 +02:00
Caolán McNamara
8f008bf4b9 cid#1554812 COPY_INSTEAD_OF_MOVE
and

cid#1555227 COPY_INSTEAD_OF_MOVE
cid#1555329 COPY_INSTEAD_OF_MOVE
cid#1555384 COPY_INSTEAD_OF_MOVE
cid#1555387 COPY_INSTEAD_OF_MOVE
cid#1555399 COPY_INSTEAD_OF_MOVE
cid#1555400 COPY_INSTEAD_OF_MOVE
cid#1555406 COPY_INSTEAD_OF_MOVE

Change-Id: I85dc45e2686c6b3e8b97a23872cb26416edc27c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171178
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-29 14:50:38 +02:00
Caolán McNamara
7f135227a9 cid#1556131 COPY_INSTEAD_OF_MOVE
and

cid#1556135 COPY_INSTEAD_OF_MOVE
cid#1556146 COPY_INSTEAD_OF_MOVE
cid#1556164 COPY_INSTEAD_OF_MOVE
cid#1556171 COPY_INSTEAD_OF_MOVE
cid#1556177 COPY_INSTEAD_OF_MOVE
cid#1556181 COPY_INSTEAD_OF_MOVE
cid#1556182 COPY_INSTEAD_OF_MOVE
cid#1556183 COPY_INSTEAD_OF_MOVE
cid#1556192 COPY_INSTEAD_OF_MOVE
cid#1556201 COPY_INSTEAD_OF_MOVE
cid#1556208 COPY_INSTEAD_OF_MOVE
cid#1556215 COPY_INSTEAD_OF_MOVE
cid#1556224 COPY_INSTEAD_OF_MOVE
cid#1556227 COPY_INSTEAD_OF_MOVE
cid#1556228 COPY_INSTEAD_OF_MOVE
cid#1556238 COPY_INSTEAD_OF_MOVE
cid#1556246 COPY_INSTEAD_OF_MOVE
cid#1556247 COPY_INSTEAD_OF_MOVE
cid#1556288 COPY_INSTEAD_OF_MOVE
cid#1556293 COPY_INSTEAD_OF_MOVE
cid#1556305 COPY_INSTEAD_OF_MOVE
cid#1556310 COPY_INSTEAD_OF_MOVE
cid#1556317 COPY_INSTEAD_OF_MOVE
cid#1556321 COPY_INSTEAD_OF_MOVE
cid#1556322 COPY_INSTEAD_OF_MOVE
cid#1556331 COPY_INSTEAD_OF_MOVE
cid#1556339 COPY_INSTEAD_OF_MOVE
cid#1556342 COPY_INSTEAD_OF_MOVE
cid#1556351 COPY_INSTEAD_OF_MOVE
cid#1556358 COPY_INSTEAD_OF_MOVE
cid#1556370 COPY_INSTEAD_OF_MOVE
cid#1556379 COPY_INSTEAD_OF_MOVE
cid#1556390 COPY_INSTEAD_OF_MOVE
cid#1556423 COPY_INSTEAD_OF_MOVE
cid#1556532 COPY_INSTEAD_OF_MOVE
cid#1556561 COPY_INSTEAD_OF_MOVE
cid#1556662 COPY_INSTEAD_OF_MOVE
cid#1556704 COPY_INSTEAD_OF_MOVE
cid#1556730 COPY_INSTEAD_OF_MOVE
cid#1556988 COPY_INSTEAD_OF_MOVE
cid#1557071 COPY_INSTEAD_OF_MOVE
cid#1557081 COPY_INSTEAD_OF_MOVE
cid#1557177 COPY_INSTEAD_OF_MOVE

Change-Id: I2c723f0fe9a4eefa62a68f47049ed690d06eb0ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170932
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-24 22:12:32 +02:00
Tuukka Orava
f0a79b4dc1 tdf#147021 Use std::size instead of SAL_N_ELEMENTS in editeng
Change-Id: I6cf0557b1e44dff08fa1efa4aefa14dec276458e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167134
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Jenkins
2024-07-24 10:32:08 +02:00
Noel Grandin
512357eafd improve ImpEditEngine::SetParaAttribs a little
avoid doing GetItemState if we don't have a wrong list (the common case)

Change-Id: I3a1a22da657835ae37e8025d8ce21ad14d4e2c39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170890
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-23 12:26:50 +02:00
Heiko Tietze
8534ad7b7b Resolves tdf#159541 - Fix font color must not change depending on background
Change-Id: I954c9e3f8502a5243c664ed0bf066fb4c4cb4ccc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169991
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-07-22 13:01:43 +02:00
Noel Grandin
c3e8dbc139 Improve the perf for pool item scanning..
for large complex documents with lots of shapes.

When that happens, we spend a lot of time scanning the std::unordered_set inside DefaultItemInstanceManager.

Since most of our items are already capable of being hashed, and thus avoiding the scanning cost, make it so we can use the HashableItemInstanceManager most of the time.

Change-Id: I43f4c04e956d316c976bea67d1941529d2d91182
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170813
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Tested-by: Armin Le Grand <Armin.Le.Grand@me.com>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-22 11:29:32 +02:00
Gabor Kelemen
e1a351ca19 Remove now unneeded osl/diagnose.h
followup to commit 57c228803e

Change-Id: Iebfb23bb65e2bf898bf27f367cc9641f47a14cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167998
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
2024-07-20 10:20:31 +02:00
Xisco Fauli
4dbaa38315 tdf#55693: port test to CppunitTest_sw_autocorrect
so we can get rid of TestAutoCorrDoc, only used for
test purposes

Change-Id: I0931fa76550358d071ebdec364fd6b55485bb3b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170680
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-07-18 23:26:04 +02:00
Noel Grandin
cd3382cd72 make EditSelection single-arg constructor explicit
Change-Id: Id7a81db385dd3ca30daa37ba74a82d06c417a51c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170678
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-18 15:33:36 +02:00
Jonathan Clark
aa938fe03c tdf#150621 Changed Korean word counting to use words
Previously, Writer counted characters for all CJK languages, rather than
words. This is the correct behavior for Chinese and Japanese, which make
extensive use of ideographs. However, it is not correct for Korean.

This change adjusts the Writer word count algorithm to count Korean
words, rather than Korean characters.

Change-Id: I6e77136867baca1a7b51248886ee5fd7073ad364
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170621
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-07-17 15:45:41 +02:00
Caolán McNamara
8d279e8c4f cid#1607843 Use of auto that causes a copy
and

cid#1555160 Use of auto that causes a copy

Change-Id: I2e2056ddbfb2d11d288a5b2df273e8bc049387fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170455
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-07-15 11:11:08 +02:00
Yuki Joou
cfe6ce1656 tdf#145538 - related: Make tools::PolyPolygon iterable
This patch allows tools::PolyPolygon to be iterated using c++11's
fancy range-based for-loops. It also upgrades a bunch of old-style
for-loops iterating over polypolygons to the new style to make code
more readable.

Note that not all for-loops iterating over polypolygons have been
upgraded, as I didn't find a way to automatically find those. I just
did a few I found manually.

Change-Id: Ifa8d0d44e6f0aa28fdcfd87d70058b12f48c1349
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168730
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-14 12:24:14 +02:00
Noel Grandin
3fcdebc472 use DeleteOnDeinit for EditEngine pool
to avoid it accidentally coming to life during shutdown.

Change-Id: I016a3396639c30350432b60c375c9777e551eb84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170425
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-13 18:48:25 +02:00
Armin Le Grand (allotropia)
ece698a575 ITEM: replaced typeid/hash_code with SfxItemType
for the ItemInstanceManager the identification was done
using typeid/hash_code, but that has problems - it is
only defined to be identical for two instances of the
same type, but other types can have the same code.
Thanks to Noel to find that out, that is not reliable
to be used.
In the meantime we have SfxItemType to identify Item
instances, so I changed the code to use that.
The master had five additionally added Items that
use the (2a) method of this mechanism (see comments
in svl/source/items/globalpool.cxx for that). The
gloal is to use as less as possible of this Items in
that mechanism, so I checked.
For four of these hashing was used, so the mem/runtime
aspect is okay -> access is fast enough to prefer
mem over runtime. Adding hashed Items (or any other
fast mechanism) is always okay.
One did not have that (SvxBoxItem) and used just the
fallback ItemInstanceManager, so I removed it. We
now have 18 Items for which that mechanism is
initialized immediately.
Noel also already moved the countdown for starting
to use the mechanism in case of default handling
(case (1), NUMBER_OF_UNSHARED_INSTANCES) to the
unorderd_set. someting I had already planned to do,
too - thanks!

Change-Id: Icf6f427e5ea64672f385357aaad75bb5b7fcbf98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170314
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-11 11:01:01 +02:00
Caolán McNamara
e68f28ec9f cid#1607892 COPY_INSTEAD_OF_MOVE
and

cid#1607910 COPY_INSTEAD_OF_MOVE
cid#1607818 COPY_INSTEAD_OF_MOVE
cid#1557402 COPY_INSTEAD_OF_MOVE
cid#1556530 COPY_INSTEAD_OF_MOVE
cid#1557396 COPY_INSTEAD_OF_MOVE
cid#1556522 COPY_INSTEAD_OF_MOVE
cid#1555628 COPY_INSTEAD_OF_MOVE
cid#1554705 COPY_INSTEAD_OF_MOVE

Change-Id: Iae3fbf4a04bf3714f416995640b9d70fe204cf73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170321
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-11 09:26:28 +02:00
Noel Grandin
fddda044b5 Revert "fix and simplify the ItemInstanceManager mechanism"
This reverts commit 85fd526fc6.

Change-Id: I5019f72f88497f50a77666d57f2d16c2749bd1c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170218
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-09 21:15:07 +02:00
Caolán McNamara
b8e46cb2f5 cid#1545961 COPY_INSTEAD_OF_MOVE
Change-Id: I40a4dc9bc13bfb769b2f9f15b0ab1ff9490639da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170076
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-07 10:41:41 +02:00
Noel Grandin
5e7c94c602 fill in more SfxItemType values
found by doing some git grepping, we should now have values
for all items in the hierarchy

Change-Id: I397ca7e8f53f53737201385c4c8029b436895c1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170016
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-05 20:08:57 +02:00
Noel Grandin
269654fe17 fix asan build
after commit 85fd526fc6
"fix and simplify the ItemInstanceManager mechanism"

The problem is that some *Item classes in sw/ and sc/
share WhichIds, and a whole bunch of SfxBoolItem
subclasses share the same SfxItemType enum value.
So we ended up mixing and matching objects
of different concrete subclasses in a given
*ItemManager collection.

Add some asserts to the global pool code to catch
issues like this earlier on.

Add unique value of the SfxItemType enum for all
the SfxBoolItem subclasses

Change-Id: I3c8d4e02be1cd412b0292e973a6498df5f8e7102
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170003
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-05 08:59:49 +02:00
Noel Grandin
59ec1c4322 make SvxColorItem hashable
Change-Id: Ic96d53c113cd6ae5b805df5a8e80d4da7adfec59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169966
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-04 13:59:15 +02:00
Noel Grandin
2fcad7783d make SvxAdjustItem hashable
Change-Id: Ic5c78a0de4e7edafc0ba97bf69d43c377f7b5503
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169633
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-04 09:19:01 +02:00
Noel Grandin
6e1a55dfbd make SvxEscapementItem hashable
Change-Id: Ic03c78f6dde68f5557d474147336fa62be6f3aaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-04 09:18:35 +02:00
Noel Grandin
85fd526fc6 fix and simplify the ItemInstanceManager mechanism
The mechanism is currently broken because it uses hash values as keys,
in two different places. But hash values are not required to be unique,
and as soon as there are enough items of a given type, a collision is
inevitable.

So just simplify this whole mechanism. There is no reason we need
type-specific item managers. Stuff everything into a single global pool,
that uses hashing correctly.

Notes

(*) Performance, as far as I can tell, is the same or slightly better.

(*) I removed the NUMBER_OF_UNSHARED_INSTANCES thing, in favour
of just having a simpler mechanism

Change-Id: I9068baf9bf6fae2500ae5748c6d1aabe6c3a18a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169709
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-03 09:28:11 +02:00
Caolán McNamara
21f58d0411 cid#1545929 Using invalid iterator
Change-Id: I7d798b233eae9906f9caff9da411b27d3e26ebb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169858
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-02 13:41:50 +02:00
Caolán McNamara
f02d75147e cid#1604131 Dereference null return value
Change-Id: Id790c9f8433e7dd780aeaec1a1dd614c6ab3daa9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169791
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-07-01 13:44:32 +02:00
Caolán McNamara
3c93be6759 cid#1604130 Dereference null return value
Change-Id: Icd6bf3bc72ac9728b4a7f3c602cb919bfdef18e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169790
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-01 13:44:24 +02:00
Noel Grandin
4637bad647 call fillDecimal() in SvxTabStop constructor
otherwise we get the weird behaviour where two SvxTabStop instances
which are constructed the same, return false from operator==
because one instance has had getDecimal() called on it, and the
other not.

Change-Id: I1f708c1b1e03efcd9fc554eaf2777c4c3e8a80b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169774
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-01 08:56:44 +02:00
Mike Kaganski
0748844975 Simplify some uses of convertTwipToMm100
Change-Id: I073ac7358c1bcb82992ec7746f4b3986d6d35633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169755
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-06-29 14:37:45 +02:00
László Németh
50be3fa1f0 tdf#141773 AutoCorrect: fix broken [All] dictionaries
This reverts commit ae56dc05b2
"tdf#96787: AutoCorrect: after deleting a replacement entry, it's still used".

Change-Id: Ifb4cf1b359b852c7610337d4bd389a8ca5dce610
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169713
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-06-29 09:25:26 +02:00
Andrea Gelmini
aa80eaeeab Fix "lets see" -> "let's see"
Change-Id: I7aa939681720bc0dc81c8f114a3608a8cdfb4f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169722
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-06-28 22:24:50 +02:00
Noel Grandin
86f296e82b use more ASSERT_CHANGE_REFCOUNTED_ITEM
which did I not see when I did
    commit cb3c65fb70
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Thu Jun 27 19:24:28 2024 +0200
    assert when SfxObjectItems are modified while in a pool

Change-Id: I16e2ee72eda4b3ca69f83eb70ad4f4b0a14748a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169696
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-06-28 14:58:33 +02:00
Noel Grandin
cb3c65fb70 assert when SfxObjectItems are modified while in a pool
which has always been a problem, but becomes a more obvious problem when
I implement some upcoming optimisations

Change-Id: I8b0368b0b8e9a726c71d241841afeed3876281d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169657
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-06-28 09:17:52 +02:00
Justin Luth
5c6c6a73e9 tdf#43767 mso-format layout: no smallcaps applied to numbering
If the paragraph marker is formatted as Uppercase,
then Uppercase is applied to that line's numbering as well.
However, if the marker is formatted as SmallCaps,
it MUST NOT be applied for MSO formats.

Apparently MSO only supports Uppercase and SmallCaps,
not Lowercase or Titlease.

I don't like these adhoc exceptions, so I didn't
attempt to apply them to ODF formats.
Let's keep it simple for ODF - any char format that applies
to the entire paragraph should apply to numbering as well
(except for the existing underline/overline exceptions).
- if you don't like that char attributes apply at all, blame MSO.
- if you don't like that DOCX is missing your goofy formatting,
  blame MSO for being inconsistent.

ooxmlexport12's tdf143384_tableInFoot_negativeMargins.docx
is almost interesting because it applies superscript
and small caps. However, the list is already uppercase,
so it can't be used for the test.

make CppunitTest_sw_ooxmlexport21 \
    CPPUNIT_TEST_NAME=testTdf43767_caseMapNumbering

Change-Id: I273baebc996adfd001e1c591dbb9aef9272a42f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169476
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2024-06-28 01:24:36 +02:00
Noel Grandin
534b8f6d8a reduce boilerplate code for type-specific ItemInstanceManagers
create a template class to reduce repetition

Change-Id: I8c9c71fdfdac20a3b34432affac07aa1d46e8373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169613
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-06-27 12:51:43 +02:00
Noel Grandin
40e0885130 fix O(n^2) behaviour when fetching field info from EditEngine
Change-Id: I324a1814fc1b3321eed5b29922790600e7092c17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169344
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-06-22 14:00:49 +02:00
Noel Grandin
858bc4d76b no need to call FormatDoc() after calling CheckIdleFormatter()
CheckIdleFormatter() already does that

Change-Id: Ie6b9e3285303899e3f67cccb0fc5f5625c8db684
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169343
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-06-22 14:00:41 +02:00
Noel Grandin
6e3cefc89e move ensureDocumentFormatted from EditEngine to ImpEditEngine
so we have the implementation in one class, instead of bouncing
back and forth between two.

Change-Id: I851578ff553b01fb7d48cf5aa8f7a2d795496751
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169340
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-06-21 20:51:41 +02:00
Theppitak Karoonboonyanan
76c96ca7c9 tdf#158454 Add Thai Autocorrect Support, coding part
SvxAutoCorrDoc::ChgAutoCorrWord() implementations: correct multiple patterns

* include/editeng/svxacorr.hxx, editeng/source/misc/svxacorr.cxx:
  - Add classes SvxAutocorrWordList::{Iterator,WordSearchStatus}.
  - Make SvxAutocorrWordList::SearchWordsInList() return WordSearchStatus
    so the search can be continued with the added
    SvxAutocorrWordList::SearchWordsNext() method.
  - Make SvxAutoCorrect::SearchWordsInList(), and its lcl_SearchWordsInList()
    companion, return WordSearchStatus propagated from
    SvxAutocorrWordList::SearchWordsInList().
  - SvxAutocorrWordList::WordMatches():
      The existing mechanism of preventing collision of patterns like in
    tdf#83037 (→ and ← and ↔ autocorrect collisions) was by storing
    the matched string of wildcard pattern back to the list without
    overwriting existing one. If the matched string was found in the list,
    it would just be treated as no matching.
      While this worked well for collision prevention, it caused failure
    on the new exhaustive wildcard pattern visiting method when autocorrecting
    the second text chunk with the same content. In such situation,
    all intermediate stages of corrections of the first text chunk would be
    recorded into the list. And, in the second chunk, the first stage would
    just be applied from the recorded pattern, but all the next stages
    would be refused due to the "collision" with the recorded patterns.
    Moreover, the new method would cause the list to grow more quickly
    as the autocorrections are done.
      To solve the problem, just "peek" for the collision instead of
    actually storing it. And SvxAutocorrWordList::ContainsPattern()
    is added for this purpose.
* editeng/qa/unit/core-test.cxx:
  - Modify TestAutoCorrDoc::ChgAutoCorrWord() to iterate through all patterns,
    instead of finishing at the first one.
* editeng/source/editeng/edtspell.cxx:
  - Ditto for EdtAutoCorrDoc::ChgAutoCorrWord().
* sw/source/core/edit/acorrect.cxx:
  - Ditto for SwAutoCorrDoc::ChgAutoCorrWord().
  - SwAutoCorrDoc::ChgAutoCorrWord(): Remove old dead code for autocorrection
    on text with redlines.
* sw/qa/extras/uiwriter/uiwriter6.cxx,
  +sw/qa/extras/uiwriter/data/tdf158454.odt:
  - Add unit test "testTdf158454".

Change-Id: I8fb4a628a977b79b0ed2f239fd3749f15823b5df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160160
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-06-21 20:34:22 +02:00
Noel Grandin
86a827da7c loplugin:unusedfields
Change-Id: I4bc67811e228b4806db9f9b9bf9fb0de0eb36de2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169263
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-06-20 14:03:21 +02:00