588 Commits
Author SHA1 Message Date
Noel Grandin 90f327c670 merge OutlinerEditEng into EditEngine
as part of the process of simplifying the whole Outliner vs EditEngine
infrastructure.

Change-Id: Ia4f173ba41b374864cc4e47d895b037d6493a08f
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13238
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 196eccebee433d3cfe170786a81ea39f5c491ec1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211615
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 09:01:56 +02:00
Michael Weghorn f26084217a weld: Move weld::Button to own header/Rename weld.hxx
In the past, weld.hxx used to contain the class
definitions for weld::Widget and all subclasses.

By now, weld::Widget and almost all subclasses have
been moved to separate headers, to make it easier
to keep the overview and to avoid having to
recompile ~all UI code when one class changes.

By now, only weld::Button is left in weld.hxx.
Rename the header to Button.hxx.
Drop weld.hxx includes and instead add Button.hxx
includes (or weld::Button forward declarations) where
weld::Button is used.
(Don't simply replace all weld.hxx includes with
Button.hxx ones, since many of them were for the
use of other widgets that have since been moved
to their own headers.)

Add further includes where needed now that the
(direct or transitive) includes of weld.hxx were removed.

Change-Id: I8ea6201446a418d5e38b46337059dcd517ee29d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205937
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-06-05 07:58:07 +02:00
Neil Roberts b07500ec55 autocorrect: Add method to SvxAutoCorrDoc to retrieve paragraph text
The autocorrect functions take as arguments an abstract interface to a
document and a string reference containing the text for the paragraph
being updated. The string needs to be a reference to the actual text
used for the document because the functions rely on it being
automatically updated when modifications are made to the paragraph. This
causes problems when redlines are enabled and the text comes from a
MergedPara because some operations can cause the MergedPara to be
recreated. The SvxAutoCorrect::DoAutoCorrect function has many
workarounds to try and fix this problem. The one from the commit below
tries to fix it for the case where a small group of autocorrect
functions can all be run together by making a temporary copy of the
string. This isn’t ideal because the different functions can no longer
see the result of the other functions. This is particularly bad for the
Esperanto hat function that was added after the patch was created. For
example “cxu” at the start of a sentence will be corrected to “Cu”
instead of “Ĉu” beause the word capitaliser can’t see the result of the
esperanto hat function adding the hat so it only capitalises the letter
“c”.

To fix this this patch adds a method to SvxAutoCorrDoc to get the latest
version of the paragraph text. That way each function can query the
string at the start and it won’t matter if it comes from a recreated
MergedPara. Ideally I think we should eventually move all autocorrect
functions to use this method and then remove the rTxt parameter to make
the code a bit more robust.

commit 22baeb9f9e
Author: Andras Timar <andras.timar@collabora.com>
Date:   Thu Mar 19 10:19:21 2026 +0100

    sw autocorrect: fix use-after-free with track changes enabled

Change-Id: Id407be018bdfa31c6f4642a9503c65e4c9e736d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205235
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
2026-05-18 12:37:17 +02:00
Khaled Hosny f02741f3e6 tdf#171624: Add SvxFontVariationsItem and EditEngine plumbing
Change-Id: I2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203244
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
Tested-by: Jenkins
2026-04-06 17:13:04 +02:00
Khaled Hosny d128bdf1fe tdf#153368: Support optical size for variable fonts, part 2
Add SvxOpticalSizingItem and EditEngine plumbing. Mostly mindlessly
copying stuff here. Lets hope for the best.

Change-Id: Idf0b062ff955fa35bd04c8e69c103e15887932f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200501
Tested-by: Jenkins
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
2026-03-02 21:45:06 +01:00
Michael Weghorn 5b16b3acc6 weld: Move weld.hxx and weldutils.hxx to new include/vcl/weld subdir
This is in preparation of moving code out of weld.hxx
to separate headers/source files, in order to make it
easier to keep an overview and to avoid having to
recompile ~all UI code when anything changes.

Also move weldutils.cxx to a new vcl/source/weld
directory.

Change-Id: Ia75b42f21e560dd248307282a522f186a64cd742
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195777
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-12-17 18:20:13 +01:00
Sergey Anisimov 629dab07c8 tdf#163691 - Use std::copy_n() instead of memcpy()
Change-Id: I5ffd3ea19eda9038620c7a0e07d074ceb928af1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192172
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-10-28 14:34:44 +01:00
Gabor Kelemen f9af3767bd tdf#146619 Run IWYU on editeng/
Change-Id: I2c124548ab312ec21558f22207952d2315f5a805
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190908
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
2025-09-19 08:21:25 +02:00
Noel Grandin 6d0e5ddede remove BitmapEx
all use-sites have been converted to Bitmap

Change-Id: I1a8842217a266eef100bd387ab013b004e532256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190618
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-09-05 19:45:45 +02:00
Noel Grandin 7ad5ed8aed bFirstCharIsRightPunctuation is unused
since
    commit 83ffcdd964
    Author: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
    Date:   Mon Aug 4 14:15:15 2025 +0200
    StripPortions: Further simplify EditEngine

Change-Id: I93bf65d053b76b9402cc3352185e458073fdd63c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189515
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-08-13 19:35:14 +02:00
Armin Le Grand (collabora) 83ffcdd964 StripPortions: Further simplify EditEngine
Since 6c8b802051 which is
'StripPortions: full Primitive usage for EditEngine Paint'
all DrawText_To* methods were already using a full
conversion to Primitives which then get painted directly,
see commit comment there.

Since then no complaints/errors came up I now continue
to move EditEngine to Primitive usage. Lots of code for
the still also existing DirectPaint gets removed.

I also drive forward changes to have less parameters
for the ImpEditEngine::StripAllPortions method. It is
already cleared by the former possible rotation, this
can (and is) replaced by embedding the result to a
transform primitive doing that rotation. I changed
two of three using methods to strip always to
position (0, 0) which can also be unified to embedding
to a transformation. The third one will need some more
work here due to doing wild things in Outliner mode in
Impress (callbacks & creating Primitives in fixed
positions for which an embedding translate would be
wrong).

When being able to strip without position and rotation
the result will be usable to be buffered, so the goal
is to re-use that, transformed as needed (translate,
scale, rotate, ...) as long as the text itself does
not change.

Change-Id: I52ab548ccbb1b5b3b16c50451a314bc7f3b39d93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188918
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2025-08-04 20:35:16 +02:00
Miklos Vajna efc58eeb17 CppunitTest_editeng_editeng: avoid gb_CppunitTest_use_library_objects
It leads to ODR violation since 006c8f2d75
(tdf#166882 - sd odf clipboard: fix missing copy/pasted graphic bullets,
2025-07-30), see
<https://gerrit.libreoffice.org/c/core/+/188532/7#message-87c0be80800615710c3411e7adf686c6ac1eb36f>.

Change-Id: Ia9ef2fb970d05873d7d40f460c8ed09fb709e4c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188655
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-07-31 20:10:08 +02:00
Noel Grandin 4f8b32e92c Drop separate EditTextObject itempool
and just have a single pool for the EditEngine machinery.

I cannot find a reason for a separat pool anymore, probably
it was a thing from the distant past.

This also shaves 5% off the load time of tdf#162126 because
we no longer have to spend losts of time re-creating SfxItemSets
because they belong to different pools.

Change-Id: I837045809dc292548b10e2cf5173d2a29b0879a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187969
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-07-19 14:23:31 +02:00
Armin Le Grand (Collabora) 04bd455e36 StripPortions: Move tooling closer to EditEngine/Outliner II
Moved central stuff needed for decompose to Primitives
closer to EditEngine/Outliner. There is now a
StripPortionsHelper as abstract base class with two virtual
methods replacing the lambdas used before. That is easily
implementable to all needs. Adapted all usages. Also the
methods for creating needed Primitives from DrawPortionInfo
or DrawBulletInfo is now local/private in EditEngine.

This step should still change nothing in functionality, but
is more preparation to be able to directly create Primitives
from Outliner/EditEngine setups for paint and (re)use.

Change-Id: Ie2bcebf4030128f88be229d789944cc2842eafb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187045
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2025-06-26 23:18:44 +02:00
Jonathan Clark 0b979c50b6 tdf#166011 Implemented style:script-type
Implemented the ODF 1.0 style:script-type text property. This property
can be used by documents to influence which script type-dependent
attributes are used when rendering certain characters.

This implementation uses the following semantics:

- If unset, the behavior is as it was in previous versions.
- If set to latin, asian, or complex, those characters not mapped by the
  ODF standard to a script type are treated as latin, asian, or complex,
  respectively.
- If set to ignore, all characters will be treated as latin. This value
  is intended to be used for interoperability with file formats that
  don't implement script types (e.g. HTML).

Change-Id: If81a1390ee455fd971dea655d161d9c3f44fd08a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186309
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2025-06-10 07:09:17 +02:00
Jonathan Clark f08a984a94 editeng: Initial ruby character implementation
Implements a minimal functional version of ruby character layout and
rendering in Edit Engine. Many features are missing from this
implementation, and will be added in future commits.

Currently, ruby characters cannot be created via the user interface.
Ruby character styles are also currently hard-coded.

Change-Id: Ia7c18ccae6c37cd320acc214574ba3123c18ddb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185210
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2025-05-15 13:06:12 +02:00
Michael Stahl 55793ae8c8 LOCRDT fix conditional compilation
Add a config header for this, and split yrs.hxx in two because the
actual libyrs.h is only needed in 2 files.

Change-Id: I30453fda3082f977e328ed56a4a101743ecdd586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185329
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2025-05-15 09:24:48 +02:00
Michael Stahl ee7ab3d463 LOCRDT editeng,sw: yrs weak link peer cursors for editengine
Replace unreliable integer cursors with WeakRef cursors which maintain
their position automatically.

This requires yrs v0.23.1 with the yweak_read() function.

Unfortunately this crashes currently, so hide it behind #if YRS_WEAK.

https://github.com/y-crdt/y-crdt/issues/536

Change-Id: I74ec1eaa25c7cb554efd38ee632df041ac92d5c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183311
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2025-05-13 10:00:20 +02:00
Michael Stahl 0ff4c66190 LOCRDT editeng,sw: yrs peer cursors for editengine
The cursors are represented as integers in yrs as a first step, which
isn't ideal.

Surprisingly EditView doesn't really have functions to correct the
cursor, only ImpEditEngine::UpdateSelections() for the case when nodes
are deleted, apparently there's only one active EditView at a time
typically so it wasn't needed?  Typically the active EditView's cursor
is assigned from a return value of ImpEditEngine.

Add some new functions to correct peer cursors and call them all over
ImpEditEngine; unfortunately UpdateSelectionsDelete() isn't easy to get
working on EditView's actual EditSelection cursor so leave that for the
future...

To fix EE paint of non-active comment, add SwAnnotationWin::Paint()

To get things to paint with "gen", it's enough to invalidate the
SwAnnotationWin, but for gtk3 a queue_draw() must be called, else it's
only painted when clicking on the window.

Cursors are painted in color in SidebarTextControl::Paint()

Change-Id: Id8696238290405554ece1b9961676972a559b58e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181679
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2025-05-12 11:33:51 +02:00
Michael Stahl 8f8034177b LOCRDT editeng,sfx2,sw: experimental yrs collab
This can be enabled in configure via --with-yrs=...; see also README.yrs

Currently this is hardcoded to run over a local named pipe.

Everything related to editengine is implemented in EditDoc and made
accessible via its wrapper classes; everything related to communication
and accessing sw's comment is implemented in sw::DocumentStateManager.

The acceptor starts in SwView::SwView(), once SwPostItMgr exists.

There is a hack in SfxFrameLoader_Impl::load() to fetch the document
that the accepting soffice has loaded, and load it in the connecting
soffice as well.

Change-Id: I89476b5864b70f479bcf15989374c1c65b5da9ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175652
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2025-05-07 13:36:01 +02:00
Simon Chenery 8a32f77178 tdf#164954 fix mis-spelled "punktuation" in variable name in TextPortion.hxx
Change-Id: I0d93d4e75652dbe2cca8227f95883e26b25faf76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184968
Reviewed-by: David Gilbert <freedesktop@treblig.org>
Tested-by: Jenkins
2025-05-07 00:37:53 +02:00
Noel Grandin 8049d3f234 tdf#166194 Chinese characters crowd in cell
regressioon from
    commit 11b1557147
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Wed Oct 30 09:51:26 2024 +0200
    convert KernArray from sal_Int32 to double

Change-Id: I5c9a9d6caa0091f4be1c3307cc842b2ea4662728
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184449
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-04-22 21:53:19 +02:00
Gabor Kelemen ce15f14eb7 Remove obsolete fw declarations from editeng/
found with bin/find-unneeded-includes --fwdecl

Change-Id: Ic021d9a47f9974d20ef011b34f4897847dd2628a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183884
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2025-04-17 00:23:07 +02:00
Armin Le Grand (Collabora) 3da1198179 Make conversion to Primitives more accessible for EditEngine/Outliner
When checking how TextEdit on the Overlay may be doable in Calc
I stumbled about that I initially did that based on Outliner
(svx) for all DrawObjects/Draw/Impress, but it is not accessible
from EditEngine.
Calc again just uses an EditEngine for TextEdit in Cell, so I
checked doability. Quite some stuff has to be changed, basically
instead of unsing IMPL/DECL_LINK I use lambda functions now. The
former callbacks were anyways exclusively used for this and had
no general used case.
Also simplified and cleaned up quite some other stuff, some
member functions could be removed, some helper classes deleted
or simplified/streamlined.
This should do no change to existing decomposes or edit views,
but will make it possible to move in the direction of CellEdit
on the Overlay and also prepares decompositions there to allow
going in the direction of primitive based paints in Calc.

Change-Id: Ia9c4c1129c9579ba4870b091977082e5f0d319f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183388
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Tested-by: Jenkins
2025-03-27 18:56:22 +01:00
Noel Grandin 5fa7281135 move some fields from OutlinerEditEng to Outliner
as the comment indicates, that is where they belong

Change-Id: I0078a359253d86d0197a87fade5a2de7579be042
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181273
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-02-08 08:18:17 +01:00
rafaelhlima 80c9089765 tdf#164685 Cleanup SfxItemSetFixed - Part 2
This is the continuation of the cleanup of class SfxItemSetFixed.

This patch contains a few edge cases, more specifically when SfxItemSetFixed is used in header files.

Change-Id: I2ed48177ca53311b20b9e2a8aed95d3b1c87f250
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180309
Tested-by: Jenkins
Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
2025-01-31 00:58:48 +01:00
Oliver Specht fdb13df0cb tdf#163634 Format empty paragraph if they have a bullet/numbering
Some optimization in commit 52abeff6d5836b29dbefe69f284bbd89f6672ae2
ignores paragph attributes if the paragraph is empty.
But it is not empty if it has an active list.

Change-Id: I8885d0f201fc48279263a3d41ec6d660b534ded2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178311
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-12-11 16:10:53 +01:00
Bogdan Buzea f66d3e5502 tdf#152299 - Remove unused define(s) from C/C++ files
Change-Id: I183330f8c2e947d6c8dffbcabc7da6c115e08a8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176963
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-11-23 15:00:23 +01:00
Bogdan Buzea 061b9dc1f5 tdf#152299 - Remove unused define(s) from C/C++ files
Change-Id: Iae168766fdfcbf4c68aa0770b0c42e96a61001c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176964
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-11-23 09:56:31 +01:00
Noel Grandin 11b1557147 convert KernArray from sal_Int32 to double
which allows us to eliminate a bunch of rounding at various layers, and
consequently maintain a lot more precision

Change-Id: I911dedd7c041c1d67396c082e5695346ea689acb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175814
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-10-31 12:10:52 +01: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
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 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
Tomaž Vajngerl 7f4d31f2d6 editeng: prefix EditLine members, clean-up
Change-Id: Ie8c8ee86f139854137ba95875f51ddaf64cc5848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165336
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-04-04 04:06:20 +02:00
Tomaž Vajngerl 347890c05e editeng: remove getHeight as a similar GetHeight already exits
Change-Id: I947b736b2c1eb8a6f0155460b4dc61d504623ca2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163510
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-02-17 12:07:20 +01:00
Attila Szűcs 9ed6d80622 tdf#154248 sd: change multiline field wrapping
Modified ImpEditEngine::CreateLines and ImpEditEngine::Paint
to wrap multiline fields (hyperlinks) to wrap better:

Multiline hyperlinks can start/end in the middle of a line.
like this:
text hyperlink-start
hyperlink-line2.....
hyperlink-end text

Start of the lines of the multiline hyperlinks now follow the line
start (for example if the 1. line has a bullet/indent, and the
2. line does not then the multiline hyperlink 2. line will start
where normal 2. line would start)

Changed the way how fields wrapped while editing.. (we didn't split
fields into lines, when its textbox is edited, but now we do)
This way it is more a WYSIWYG editor. (when we edit, we see what
we will get)

Changed the constant reference rLine to non-constant pointer
pLine, because this hack change the actual line to the next line
at the end of a muliline hyperlink, so the algotithm will
continue calculating with the next line, as if it would be still
the previous line.

Change-Id: I2c67f4ae1b86ee9c73f01ae0c045f02e56a09c1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162503
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-02-16 18:10:51 +01:00
Armin Le Grand (allotropia) ca3c6d468f ITEM: ItemPool Rework (I)
Driving forward the Item reworks I now take the
ItemPool in focus: It now does not hold any items
anymore and should be renamed to something like
ItemInfoProvider/ItemHelper, since it's main purpose
is to provide the Defaults for the Item functionality.

There is that SfxItemInfo, only a struct and bundling
SlotID and ItemFlags. There are also the DefaultItems,
just handled as ptrs in an array. It is/was always
error-prone to keep these in sync. Remember that it's
also necessary for the order to not only being sorted
but being increments of one with no gaps allowed in
the WhichIDs to which the Items are bound.

I now bundled that to a new class ItemInfo that joins
WhichID, SlotID, ItemFlags and the default Item. This
is a pure virtual base class, it comes in three
derivations:

(1) ItemInfoStatic:
This is supposed to be global static and hosts the
Item in a std::unique_ptr to ensure cleanup. It is
designed to be constructed once during runtime and
being shared globally. It allows the ItemPtr to be
nullptr to mark as non-static (if initial static is
not possible for some reason) but still offers the
needed data. Most cases (95%+) are of that case.
The contained Item is owned by that instance. The
flag isStaticDefault() is set at the Item.

(2) ItemInfoDynamic:
This is supposed to be used for cases where the Item
cannot be static: Mainly for SfxSetItem (that needs
a Pool itself in the contained SfxItemSet, so lifetime
is bound to that Pool), but other cases showed up in
the transition. These instances live while the Pool
lives and get destructed when the Pool goes down.
Also uses std::unique_ptr for the Item instance for
as much automated cleanup as possible, the contained
Item is owned by that instance, the instance by the
Pool. The flag isDynamicDefault() is set at the Item.

(3) ItemInfoUser:
This is used for UserDefaults that can be set for
every ItemInfo entry to 'overshadow' the default
from the 'outside'. It uses a regular Item and
the central access methods implCreateItemEntry/
implCleanupItemEntry to manage the Item instance,
thus works like a SfxPoolItemHolder. The Item
instance can be globally shared and re-used even
when the Pool goes down. Instances belong to the
Pool and are cleaned up when the Pool goes down.
This Item does not need any further flag to be
set.

The ItemInfos are organized using a class
called ItemInfoPackage:

This bundles groups of ItemInfoStatic to
functional instances. There are derivations/
implementations of this e.g. for Writer ItemPool
bundling all the needed defaults for Writer,
similar for draw/impress, Calc and other usages.

These ItemInfoPackage can be 'registered' at an
ItemPool using it's method registerItemInfoPackage.
This does all the needed stuff to setup that
group of ItemInfos at the Pool (It even sets
internal vars First/LastWhich, that info can just
be derived from the buildup ItemInfo Ptrs).

The ItemInfoPackage has methods 'size()' and
'getItemInfo(index) to allow looping over it
and deliver the infos the Pool needs. The
(forced, pure virtual) overloads of getItemInfo
in the specific implementations check for the
ItemPtr being nullptr and create a exclusive
incarnation of ItemInfoDynamic for the Pool if
needed, returning that. The Pool owns the
ItemInfoDynamic incarnations and uses the
ItemInfoStatic directly. On shutdown it cleans
up the ItemInfoDynamic as needed.

The ItemInfoUser is used by the Pool when a
UserDefault is set/used: for SetUserDefaultItem,
GetUserDefaultItem, ResetUserDefaultItem. It
is not held in a 2nd list, but directly in the
list of ItemInfo'ptrs: To keep track of this
an unordered_map is used that helds the original
ItemInfo associated with the WhichID. That way
no two lookups (as before) are needed to get the
current Pool's default for any WhichID.

The derivations of ItemInfoPackage are
encapsulated and just allow access to an
ItemInfoPackage& with a single method as
return value. All use a static local instance
of a std::array<ItemInfoStatic, FIXED_SIZE>
which constructs all ItemInfoStatic and the
static Item instances - if already possible.
Sometimes it is necessary to overload the
constructor to set some static instances
for Items later than the lib init. These are
also just marked with nullptr as Item instance.
Some need to overload getItemInfo to complete
instances of ItemInfoStatic, if needed, or
create and deliver instances of ItemInfoDynamic.

The registerItemInfoPackage also offers a
optional lambda callback: there were two cases
where local data from the Pool was needed to
incarnate the item - just add that to the
call to registerItemInfoPackage if needed,
see examples in the adapted code.

For the re-use of Items this means that now
in SfxItemSet/SfxPoolItemHolder *true* static
Items can and will be used without RefCount
directly and globally. This is also the case
for dynamic Items, with the exception of
differing Pools for SfxSetItems which cannot
be done.

Future:
That design is already prepared to allow
solving that Pool-chaining problem: currently
there are master/sub-pools and all accesses
have to traverse that structure before even
doing anything.
For the future the idea is more to 'compose'
a Pool by registering ItemInfoPackages, e.g.
for Writer pool you may start with SfxItemPool,
register the writer-specific ItemInfoPackage,
then the one for DrawingLayer (if needed) and
the one for EditEngine.
It should also be possible to get to smaller
granularities of that packages. Ideas for
new ones will emerge. We might also think
about composing Pools which can e.g. run Writer
and Chart, so allowing to use Chart *without*
OLE stuff in Writer - just ideas...

More changes:
- Adapted all stuff, cleaned up old stuff/
  definitions
- Removed FreezeIdRanges, that can be done
  once per Pool on-demand (and cannot be
  forgotten to be called)
- Merged XOutdevItemPool with SdrItemPool
  and offered a ItemInfoPackage which joins
  both needed sets of Items
- All the cleanup hassle with Pools and
  defaults cleaned up
- Adapted all access methods of the pool
  to use that new stuff. Pool chaining
  currently stays, but I use a central
  method 'getTargetPool' instead of
  recursive calling to get the correct
  Pool for the action

Change-Id: I2b8d3d4c3cc80b1d0d0b3c0f4bd90d7656b4bab7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163157
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-02-12 10:35:33 +01:00
Tomaž Vajngerl a476aa8d22 editeng: make TextPortionList iterable with ranged for
Change-Id: Ifbddd99b5877c71ebbec064672b75877fe06ccd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163226
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-02-12 07:27:47 +01:00
Tomaž Vajngerl d0d83b8b4a editeng: move isEmpty impl. from ParaPortion to TextPortionList
Change-Id: Ib305963b1f5ffcef9122dd4353826cc9033810f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163225
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-02-12 07:27:40 +01:00
Tomaž Vajngerl 3fa841c864 editeng: prefix members of ParaPortion & add some access methods
Change-Id: I6be67530690d1d5ee1236d654dd65cc8545e95d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163224
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-02-12 07:27:34 +01:00
Attila Szűcs acd3f201a9 tdf#154248 Impress: fix color of hyperlink
Added a new FindAttrib method that searches in the attribs
a bit different.
The original FindAttrib searches in attribs as if their position
intervals are closed from both side [Start,End].
However, the actual attribs array was created using PaMs as positions,
and these are right-opened intervals [Start,End)

Change-Id: I9a46b6b27ce447366fc20af1b46fd60b5c745359
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161836
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162158
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-16 12:06:45 +01:00
Tomaž Vajngerl bf6cf27763 editeng: return ParaPortion from the list as a ref.
Change operator[] for getRef(..) method, so instead of returning
a pointer, return a reference to ParaPortion instead. This also
needs changes to the code, because we now need to make sure before
hand that the ParaPortion is really available in the list and when
this is not possible or convenient, the change the call to use
existing "SafeGetObject" instead. Add "exists" to check if the
object is available in the ParaPortionList.

In addition add "lastIndex" method to return the index of the
last ParaPortion in the list (shortcut for Count() - 1).

Change-Id: Id52c38f996468af51c75d50185110ec8502169e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162071
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-15 14:28:11 +01:00
Tomaž Vajngerl bf82669bf7 editeng: use unique_ptr for Append and Insert into a EditLineList
We can better handle the lifecycle of the EditLine this way.

Change-Id: I6fa3834bfdc19576158370a2c82da0771529a7f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162010
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-14 04:51:27 +01:00
Tomaž Vajngerl e7e7449729 editeng: add begin, end, MarkAllSelectionsInvalid to ParaPortionList
begin, end to make iteration work with range for

Change-Id: Ia64d4f8102485b257e190fc702e4aa734a81d866
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161530
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-02 04:12:51 +01:00
Tomaž Vajngerl 92a9fa82f4 editeng: remove operator[] for EditDoc (use GetObject instead)
Change-Id: Ie41d2baf84d230b9ee280859d390e24b9da70be7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161482
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-02 04:11:16 +01:00
Tomaž Vajngerl 3461a0027c editeng: better lifecycle control for ContentNode in EditDoc
Don't use raw pointers, when it is possible to move the unique_ptr
around into another object that is responsible for the object's
ownership.
The ContentNode is either in a vector in the EditDoc class or it
is moved to the EditUndoDelContent class for the undo/redo action.
Those 2 classes are responsible for freeing the ContentNode.

Change-Id: I977d8e418947bb48781f23575d62420260025e57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161480
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-02 01:20:53 +01:00
Tomaž Vajngerl 417d1d56b3 editeng: make it clear EditDoc is responsible for ContentNodes
Change-Id: I38b9b1a5ba48d73438865f5a040f2483f6814c40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161479
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-01 09:21:14 +01:00
Tomaž Vajngerl 252c0316c3 editeng: prefix members of EditDoc
Change-Id: I403db061b6e3e184e97c5ec3ce5746d2fdff0749
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161478
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-01 09:21:06 +01:00
Tomaž Vajngerl ee2164d484 editeng: simplify constr. and destr. of ParaPortion{List}
Change-Id: I8f7e242b66463baa9adcc0dee8eb8f4206630c7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161477
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-01 09:20:57 +01:00
Tomaž Vajngerl 275860e607 editeng: move ParaPortionList into its own header file
Change-Id: Ibb1c9feb989a7dc3127e21c5a4dcda41b64fc84b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161476
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-01 04:34:28 +01:00