170 Commits
Author SHA1 Message Date
Andrea Gelmini 179a31e987 Removed duplicated include
Change-Id: I81bd1625316de0191cb443e8167c4f925ddfa111
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211757
Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
Tested-by: Jenkins
2026-10-03 09:09:41 +02:00
Xisco Fauli 693d5f6c6b CppunitTest_editeng_core: use CPPUNIT_TEST_FIXTURE
Change-Id: Ic998ad967c60ce1846689a234f7304f5aef3136c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211661
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-01 14:23:03 +02:00
Noel Grandin b00fc0d4e7 add some editeng/sd unit tests
which will be useful in upcoming changes to EditEngine/Outliner

Change-Id: I762a5b213f3ee9a65a83ac8b17d377f9d91a2a2a
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13817
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit a6899cb5b04532f2efa24619b93ba0e9fef6c344)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211654
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 13:53:06 +02:00
Noel Grandin 212d17f7ea add a non-const GetEditEngine() method to Outliner
to avoid const-casting all over the place

Change-Id: I75f3442341894dbe4e12cc7995669dc7f3bf63f7
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13354
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 318e2cf839c6311d4a69572b4534f554bdda3f96)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211604
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-01 09:01:52 +02:00
Noel Grandin fcf0bcc0f9 Hold EditTextObject by value in OutlinerParaObjData, not by pointer
OutlinerParaObjData is already ref-counted data, no need
for further indirection.

Unfortunately, this sets off a larger chain of changes
than I would have preferred, but we end up storing
EditTextObject on the stack much more than before, so
that worked out well.

Change-Id: Ie7d0ccfbfeec4e6935f2ed6b8ad48aadfe1bac20
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10973
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit fbf7d1bc7142d3f0e4e5f959983dea065afc5ea3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210927
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 16:27:02 +02:00
Khaled Hosny 7eef6029ec tdf#171624: Make font variation settings per script
We had only one shared setting for the three script groups, which means
the same variation settings are applied to the three groups, which makes
no sense as they often use entirely different fonts.

Change-Id: I6f2a8b4d1c9e0357a6b2d8f4e1c7093b5a2d6e84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209222
Tested-by: Jenkins
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
2026-08-18 00:28:11 +02:00
Khaled Hosny b99991ff8d tdf#172647: Store font’s typographic name in the editeng model
Rewrite font family and subfamily to use typographic names if they are
using legacy names, so we can elsewhere always assume typographic names
are used.

Change-Id: I8db2d4cf801c50794ff38b7d9e6d8419e66f5680
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207547
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
Tested-by: Khaled Hosny <khaled@libreoffice.org>
2026-07-14 00:14:45 +02:00
Jonathan Clark ed67bd2bdc tdf#172081 Don't extend style:writing-mode-automatic DF to new paras
Writer and Edit Engine use style:writing-mode-automatic direct
formatting to mark paragraphs for which the user has manually set a
paragraph direction. This is important to stop paragraphs from flapping
if the user sets a direction that disagrees with our heuristic, and then
keeps typing in the same paragraph.

This change updates Writer and EE to no longer extend this DF to new
paragraphs, such as those made by pressing enter while typing naturally
in a document. Previously, this DF was extended in a manner consistent
with other types of paragraph DF. That was conceptually valid, but in
this case it created some confusing results where automatic writing
modes would seem to arbitrarily stop working the first time an explicit
direction is set.

Change-Id: I54f2d522a72c504a5d27197bca526e4085381d8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205505
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-05-22 02:27:21 +02:00
Michael Meeks be1915d07b editeng: don't preserve escapement attribute on paragraph break.
This fixes a particuarly annoying habit of a trailing superscript
ordinal suffix getting dragged into the next bullet and causing
the unwary user weird small fonts, and non-aligned bullets.

Nail only the most obvious case, leaving multi-line superscript
in-place, and ignoring other attributes.

Include unit test.

Change-Id: I9ba5009ed17377e5c2f24c9edb74c3a1c1393cd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199203
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 03ed94560aaa20070708b265d3a551c862718bc3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204606
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-30 19:18:01 +02:00
s-AustinAvery 4771e823dc tdf#168520 give automated tests more readable names
testTdf147196 renamed to testTdf147196TitleCaseMultilineTransliteration
testTdf148148 renamed to testTdf148148CaseWhitespaceOnlyTransliteration

Change-Id: I74dcb6d14ca1c073b0053a3dbc15c786b6c672e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204201
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2026-04-25 09:35:01 +02:00
Khaled Hosny a9dc959cc9 vcl: Rename vcl::FontVariation to vcl::font::Variation
For consistncy, similar to vcl::font::Feature.

Change-Id: Idf3673bf1a1690e0ec64b6459925abef6e41b40d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203272
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
Tested-by: Jenkins
2026-04-07 05:20:00 +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
Noel Grandin 5505d3bc4d loplugin:constparams
Change-Id: I33c701be5a441c1121b797f1eb5a8bda6fc3f89b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200927
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-03-04 11:29:39 +01:00
Mike Kaganski b801ea3788 Fix Windows build
C:/lo/core/editeng/qa/unit/core-ttest.cxx(2447): error C2672: 'CppUnit::assertEquals':
no matching overloaded function found

Change-Id: I9ff0a59fc3ee6de00ba3a54442f66feb66a9d25e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198042
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-01-24 16:24:41 +01:00
Jonathan Clark 974d50f66f tdf#157037 Auto-detect paragraph directions in plain text
Updates Writer and Edit Engine to automatically set paragraph directions
when opening or pasting plain text.

Change-Id: I9c81b0313d6ab717c064c2bc35043a86f2c8ea5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197924
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-01-24 00:48:10 +01:00
Gabor Kelemen c0b14ab9aa tdf#146619 Use more forward declarations in include/vcl/[A-Z]*
Found after running bin/find-unneeded-includes --headersfwd include/vcl/[A-Z]*

This shaves off about 100M input, not bad for such a small amount
of files checked

This time --headersfwd skips files that contain #if defs,
in hope of not breaking builds that are not checked by CI

(...except for include/vcl/BitmapTools.hxx - this was cleaned accidentally,
due to a bug in the bin/find-unneeded-includes script that is fixed
by the previous commit 930ff2b830
- but let's keep this anyway, it seems fine)

Change-Id: Ia8e49d94f6adb3cdbedbc40ffa56dbf846c9b6e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196235
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2026-01-05 11:10:28 +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
Jonathan Clark 3c9fdd9aeb tdf#163618 editeng: Fix excessive overlap in justified Arabic script
Fixes a bug causing editeng to insert kashida glyphs in positions where
there is not enough space for them. The root cause was failing to
account for the extra space used by blanks while rejecting candidate
kashida positions.

Change-Id: I1e22f758af0a88c2070f31cca040570f3a730c08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184282
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2025-04-16 17:38:33 +02:00
Mohamed Ali c069f50a9e tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I958365b3db058ec809702a5ddde1d153467f21ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177158
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2024-11-24 09:29:59 +01:00
Mike Kaganski f9cac88fc2 Let ESelection use EPaM for simplification
And drop EPosition, which duplicates EPaM, except for its default
ctor (used in a single place).

Change-Id: I48bb6dafcba84465d61579df0ec71b815945532a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177075
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-11-24 08:12:55 +01:00
Noel Grandin 5de73f04f3 new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-04 08:51:00 +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
Jonathan Clark 6eb0523e27 tdf#162803 editeng: Fix invalid kashida array after layout
This change updates editeng to clear the kashida array during layout, at
the same time it clears other justification data.

Previously, editeng could recycle stale kashida arrays and apply them to
lines with different lengths. This would result in stray kashida
rendered at inappropriate positions in lines, or accessing memory past
the end of the kashida array, resulting in assertions or
nondeterministic crashes.

Change-Id: I9c06239298d630f2d61b5e67a54f4c3e079c1193
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172967
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2024-09-09 15:43:42 +02:00
Jonathan Clark 7ff601feca tdf#151748 editeng: Fix crash in kashida justification after update
Commit 937023bca4 aggravated a bug that
would cause editeng to use stale kashida positions after document
changes (for example, font changes). This could cause crashes or
spurious kashida, and both much more often after the above commit.

This change fixes the underlying logic error.

Change-Id: Id6465e739740a38ed11c9d9378d30faa51948731
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172866
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2024-09-04 19:29:51 +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 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
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 0572ef356b loplugin:ostr in various
Change-Id: I7aa8ed716998a185996482dc561219b398a1c919
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169080
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-06-18 13:16:23 +02:00
Oliver Specht 6a36c75fae prefer simple HTML format over RTF while pasting clipboard content
This changes applies to draw text, only
JUnit test is included
Basic HTML table import is included.

Change-Id: I00387f3932c0aa54099c9bc7390ad86b4398b417
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162871
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-06-14 11:18:38 +02:00
Oliver Specht de8eaca887 Case Rotation in Impress and Writer improved
Word boundaries at the end of the paragraph are now correctly detected.
Sentence case is not applied without multi word selection in Writer anymore.

Change-Id: If6e2eeaa1ecca215d583e8f33364db466bf7c57d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166928
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-05-08 10:25:08 +02:00
Noel Grandin 37722469be loplugin:ostr in editeng
Change-Id: I7353710e1558d486130ace09844ce97150eb4c43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167272
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-07 14:59:35 +02:00
Oliver Specht 51964bb719 tdf#63259 Cycle case should work on end of words
Now words are selected if the cursor is positioned at the end of
the word. SENTENCE_CASE does not force sentence selection anymore.

Change-Id: I672352b2c18bb695004fd4eb0f20ae5fd7a0ac53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164546
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-12 10:32:10 +01:00
Andrea Gelmini 9d74fdd465 Fix typo
Change-Id: I1dfd26367974b614660fcb50724b9b2d419ac55a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163559
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
2024-02-19 04:16:54 +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
Miklos Vajna 0503f6718f tdf#159507 editeng: support pasting HTML fragments
Commit ce53519f02 (cool#8023 editeng:
support HTML paste, 2024-01-24) added support for pasting HTML files
into Calc cells while editing, but this doesn't work when only a HTML
fragment is provided, without headers and footers.

The HTML code in ImpEditEngine::PasteText() was modeled after the
HTML_SIMPLE case, which is some custom format from MSIE and that
rejected the data in case the header didn't match, so the HTML case also
required a HTML header in the above commit, but this doesn't work for
HTML fragments.

Fix the problem by just dropping the header check in
ImpEditEngine::PasteText(), because that data already comes from the
text/html slot of the clipboard, so there is already indication about
the file format, even without the header. And without headers, it's
almost impossible to recognize if the HTML fragment is a HTML one or
not.

Note that this is the HTML paste when a cell edit is active, the normal
Calc HTML paste is a different codepath, in sc/.

Change-Id: I4d37d80f947880fe22051c5fe84dc6bbc257e108
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162927
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-02-02 09:09:21 +01:00
Miklos Vajna ce53519f02 cool#8023 editeng: support HTML paste
editeng text (e.g. Writer shape text or Calc cell text edit) had working
plain text and RTF paste, but HTML paste was not working.

This is typically not noticed because desktop paste usually goes via
RTF, but it can be visible when a LOK client just puts the best format
on the clipboard, i.e. HTML is provided, but RTF is unavailable in the
browser and plain text is also not written to the LOK clipboard.

Fix the problem by connecting the existing ImpEditEngine::ReadHTML() to
the generic ImpEditEngine::PasteText(): this already worked for plain
text and RTF, but not for HTML.

Note that "SIMPLE_HTML" was already supported, but that's not really
HTML but some custom format that contains HTML, and it's claimed that MS
IE 4.0 produced this.

Change-Id: Ib41529c66d9bda30cc4ed5faca4a99274ae594d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162449
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-01-24 22:21:04 +01:00
Tomaž Vajngerl dcff97abcd editeng: add EditLineList test
Change-Id: Iaec97999ae9ea0a01251e4449d3c7b74aa3539d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162072
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-16 13:02:27 +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 67abfa11b6 editeng: add simple test for CreateLines method
Change-Id: I4fd13727a1edc20220a95dd4899b91bdef088111
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162011
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-14 04:51:36 +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 5b4dfce893 editeng: cleanup operators and constructors for EditSelection + test
Move the constructors into class body, cleanup operators so they
use more standard class based operators and use default for !=
as it will just be a neagtion of ==.

Change-Id: I1b99db6c9a82468ab76091eb93a5f3641024c65b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161365
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-31 10:32:00 +01:00
Tomaž Vajngerl ac481d5df4 editeng: cleanup operators and constructors for EditPaM + test
Move the constructors into class body, cleanup operators so they
use more standard class based operators and use default for !=
as it will just be a neagtion of ==.

Change-Id: I6534db60dcb23cb3daefb91d5f27579a690a9637
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161364
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-31 07:49:39 +01:00
Tomaž Vajngerl 72fde57386 editeng: EditLine test and refactor constructors, operators
Change-Id: Ia60ce07073725bf66bf299edaf7b3cd24cfe59c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161358
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-30 14:16:43 +01:00
Andrea Gelmini 9cf4e435c4 Fix typo
Change-Id: Ie4af9884dca493646636dc60a1605a748d50ad1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161376
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-28 10:44:53 +01:00
Tomaž Vajngerl ff0a9cb65a editeng: add EPaM unit tests
Change-Id: Icc15746bf2712bae446f16fd378f94f8be5ec61e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161342
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28 08:05:43 +01:00
Tomaž Vajngerl 23bef8567e editeng: add ESelection unit tests
Change-Id: I79cff7b08944fe81c785c224587e4e6f6c8ff9c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161339
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28 04:21:17 +01:00
Stephan Bergmann b4844c310b Repurpose loplugin:stringstatic for O[U]String vars that can be constexpr
...now that warning about O[U]String vars that could be O[U]StringLiteral is no
longer useful

Change-Id: I389e72038171f28482049b41f6224257dd11f452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15 21:15:49 +02:00
Tomaž Vajngerl 4fd6b12575 editeng: move the methods into Test class definition
This makes makes all the Test class methods contined in the
class definition body, so more readable and less noise for the
actual test definitions.

Change-Id: I3ea177f27aa868a396e537b1682ce91d93c1208e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157837
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-10-12 05:08:27 +02:00
Armin Le Grand (allotropia) c351f920c4 ITEM: preparations for more/easier changes
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-18 10:37:44 +02:00
Henry Castro 5435c1b80e editeng: qa: add single line unit test
Signed-off-by: Henry Castro <hcastro@collabora.com>
Change-Id: I8abd816ec7c115d5a1f17d3b68e3e758cea02d82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148002
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153404
Tested-by: Jenkins
2023-06-22 00:40:43 +02:00