100 Commits
Author SHA1 Message Date
László Németh 78416405b8 tdf#173389 sw: add tests for improved compound-based "smart" hyphenation
Because losing compound boundary information in the new versions of the
Dutch Hunspell dictionary, add German test documents and unit tests for
compound-based "smart" hyphenation, testing also the Hunspell-based
morphological analysis, which was improved for the languages with
fogemorphemes in commit e668dc84eb.

Also remove the unnecessary dependency of the compound-based "smart"
hyphenation, i.e. Hunspell-based morphological analysis of the test
words from the Dutch and Hungarian *non-compound-based* unit tests.
This enables the plain "smart" hyphenation tests for all versions of
the Dutch and Hungarian Hunspell dictionaries.

The German unit test improves the hyphenation in the following three
lines:

* Unter|drückung: Un-terdrückung -> Unter-drückung

* Gleich|berechtigung: Gleichberech-tigung -> Gleichberechti-gung

* Sklaven|handel: Sklavenhan-del -> Sklaven-handel
  (where the word "Sklave" has got an "n" fogemorpheme).

These 3 lines are 10% of the hyphenated lines, while the German
dictionary still lacks of compound boundary data for all the dictionary
words, only compound splitting heuristics of Hunspell is used here, yet.

Note: The Dutch tests became outdated temporarily because
of the recent version of the Dutch dictionary, where the test
compound words moved into the .dic file, but without compound
boundary information.

Unit testing uses system-installed German spelling and hyphenation
dictionaries. E.g. installation of the missing dictionaries:

sudo apt-get install hunspell-de-de-frami
sudo apt-get install hyphen-de

Follow-up to commit commit f9f694f5d9
"tdf#173389 sw: add compound-based “smart” hyphenation for readability"
and commit e668dc84eb "tdf#173389 cui
offapi sw xmloff: add custom compound-based hyphenation".

Change-Id: I1c1fb28d6c0299a284951adc96b77d3205db5f4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211642
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-10-01 09:30:40 +02:00
László Németh 2caed59ec8 Update git submodules
* Update helpcontent2 from branch 'master'
  to a932a7d6e577a40e47d7da6412ce962c96261e4c
  - tdf#173389 sw: add help for "split compound words" checkbox
    
    I.e. to compound-based "smart" hyphenation.
    
    Follow-up to commit e668dc84eb
    "tdf#173389 cui offapi sw xmloff: add custom compound-based
    hyphenation".
    
    
    Change-Id: I416fd601eb7116d66e06f09bf1d9b0a3363a05ce
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/211608
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth@numbertext.org>
2026-09-30 14:49:42 +02:00
László Németh 53af171437 tdf#173389 sw: fix testing of compound-based "smart" hyphenation
Fix unit testing of commit e668dc84eb.

Unit testing uses system-installed Dutch spelling and hyphenation
dictionaries, and because of lack of them, the unit test was
false negative on the developer machine and on the test servers, too.

Note: e.g. installation of the missing dictionaries:

sudo apt-get install hunspell-nl
sudo apt-get install hyphen-nl

Note: the newer Dutch Hunspell dictionary contains "doeleinde"
as a dictionary word, but without compound information, so
that test case can be disabled during testing.

(It works with the older dictionary of dictionaries/nl, which uses
Hunspell's compound splitting heuristics for recognition of "doeleinde",
so copying these dictionaries allows full testing:

sudo cp ~/libreoffice/dictionaries/nl_NL/nl_NL.* /usr/share/hunspell)

Change-Id: I83c636cfc934c2caa3bd770fe23d498f926e0115
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211380
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-09-23 20:18:52 +02:00
László Németh e668dc84eb tdf#173389 cui offapi sw xmloff: add custom compound-based hyphenation
Add new paragraph justification option "Split compound words" for
custom compound-based "smart" hyphenation. Add compound-based "smart"
hyphenation support for Danish, Dutch, Esperanto, Estonian, German,
Norwegian, Swedish (and potentially, Icelandic, Finnish and
Latvian) languages by fixing Hunspell morphological analysis and the
associated lingucomponent code. (Previously compound-based "smart"
hyphenation was enabled only for Hungarian.)

With the new option it's possible to keep MSO/MS-DOCX interoperability,
also introducing a better hyphenation algorithm for several languages.

Details:

    * Add check box to Alignment in paragraph formatting dialog window;

    * Store properties in paragraph model:

      css::style::ParagraphProperties::ParaIsCompoundBased

    * Implement it by checking the new option in the previously
      added commit f9f694f5d9f39c5801bc5fec45867252c293bbcb;

    * Add ODF import/export (loext:compound-based);

    * Add ODF unit tests by the new tdf173389_smart_hyphenation_nl.odt
      and tdf173389_smart_hyphenation_hu.odt. Now use the previous
      tdf119908_smart_hyphenation_hu for disabled compound-based "smart"
      hyphenation, also the new tdf119908_smart_hyphenation_nl.odt.
      Note: the Dutch test document results better compound-based
      hyphenation in two positions.

    * Add Hunspell patch to fix Danish, Dutch, Esperanto, Estonian,
      German, Norwegian, Swedish (and future Icelandic, Latvian,
      Finnish) morphological analysis for compound word constituents;

    * hyphenimp.cxx hyphenate(): fix tokenization for consecutive
      pa: elements, like resulted in the fixed Hunspell dictionaries.

Follow-up to commit f9f694f5d9
"tdf#173389 sw: add compound-based “smart” hyphenation for readability".

Change-Id: I4414bd588646ecf6dc86b77642833ac9c7820a98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211341
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-09-23 14:38:07 +02:00
László Németh f9f694f5d9 tdf#173389 sw: add compound-based “smart” hyphenation for readability
As a natural extension of the "smart" hyphenation, following
traditional typography, prefer readability of the hyphenated
compound words and better word spacing in the following way:

* when it's possible to hyphenate the same compound word within
  the custom word spacing range, choose compound splitting or
  hyphenate just before the suffix or inside the suffix, not
  inside a compound constituent.

* limit plain, i.e. non-compound-based smart hyphenation, when
  it can results in better word spacing without losing readability:
  do not disable hyphenation within the custom word spacing range, if
  the hyphenation splits the compound word between its constituents;

* if also shrinking results in a non-compound splitting hyphenation
  inside the second or third etc. constituent of a compound word,
  always shrink the line to show bigger part of that non-first
  constituent (within the custom word spacing range).

For these, extend lingucomponent HYPH_COMPOUND_MIN_LEADING and
HYPH_COMPOUND_MIN_TRAILING API to support disabling hyphenation of
non-compound words, also disabling hyphenation inside the first
constituent (but not inside the suffix or just before the suffix).
This allows to recognize compound words during line breaking.
Details: Hyphenator::hyphenate().

The initial development enables compound-based "smart" hyphenation
only for the Hungarian language, yet. The patch contains minor
fixes of the compound-based Hungarian hyphenation, resulting
better compound-based "smart" hyphenation with recognition of
verb prefixes and leg-/legesleg- superlative prefixes. (Note:
this fixed also COMPOUND_MIN_LEADING/TRAILING settings for the
hyphenation of the compound words with dictionary-based hyphenation
(only hy:, without pa: Hunspell dictionary fields, i.e. without
compound splitting heuristics of Hunspell).

Change-Id: I26f31329cdea20f03dbde7742587089eb5df5ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210423
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-09-04 09:40:40 +02:00
László Németh f3d5dbfb18 tdf#172674 sw: fix terminology + UX of new hyphenation settings
Replace label "Less Hyphen" of the new hyphenation slider
with "Fewer Hyphens", also "Hyphenation leveled x%" with
"Hyphenation level x%".

On the General pane of the paragraph style settings, add missing
commas and spaces inside the summary of the enabled new hyphenation
settings. Show only the non-default values here. Remove redundant
"No hyphenation across" title, where its value is a full-text
explanation.

Change-Id: Icc9d8bb4023d03be497d76289967b5d6061316ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209067
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-08-10 19:21:01 +02:00
László Németh cefbfcae51 Update git submodules
* Update helpcontent2 from branch 'master'
  to 1a46f6bccea9c3fecf1cdb684142671825646e7c
  - tdf#172674: sw: fix hyphenation slider label to "Fewer Hyphens"
    
    Change-Id: I6a2b87ed746a8bbe15dc2832a497dc5d22107ca3
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/209068
    Tested-by: Jenkins
    Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
    Reviewed-by: László Németh <nemeth@numbertext.org>
2026-08-10 19:20:04 +02:00
László Németh fc54f170b8 Update git submodules
* Update helpcontent2 from branch 'master'
  to c1ec0774ee9e428b6cf5337e3bfbf3461bb0148d
  - tdf#172674 add help for Better spacing/Less hyphen slider + interop.
    
    Follow-up to core commit 5da16bdc79
    "tdf#172674 offapi cui sw xmloff: add hyphenation slider feature".
    
    Add also information about the requested minimum and maxinum
    word spacing for MS-DOCX paragraph layout interoperability,
    see core commit 5a48070f59
    "tdf#126154 sw offapi xmloff cui: add min/max word spacing".
    
    Change-Id: I66f3d5e1da69bcf7dc3d3b5cc85cc83400333814
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/208297
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth@numbertext.org>
2026-07-20 18:56:57 +02:00
László Németh 5da16bdc79 tdf#172674 offapi cui sw xmloff: add hyphenation slider feature
To solve the trade-off between better spacing and less hyphenation,
support hyphenation level and its user interface, the hyphenation
slider, like DTP software do.

Add new paragraph property com::sun::star::text::ParaHyphenationLevel

The hyphenation slider is the basic interface of DTP software to adjust
single (or all) paragraphs using better word spacing (i.e. more
hyphenation) or less hyphenation (i.e. worse word spacing). It allows 1)
to choose the best from the near equally good layouts and 2) to solve an
extreme bad layout (caused by words without hyphenation or other corner
cases).

– 50% hyphenation level means disabled hyphenation, if minimum
  and maximum word spacing settings allow to break the line within
  words (default interoperability value).

– 100% hyphenation level means using extra hyphenation only if that
  results better word spacing in the line, than breaking within words.

– Between 50% and 100% hyphenation level, use extra hyphenation only if
  its weighted word spacing is better, than breaking the line between
  words (weighting grows with the hyphenation level).

– Between 0% and 50% hyphenation level it means disabled hyphenation
  with increased desired and maximum word spacing, depending on the
  hyphenation level. At %0, the desired word spacing is enlarged to the
  original maximum word spacing, while maximum word spacing is enlarged
  by a single space.

For example, the original 4-page unit test document with the default 50%
hyphenation level contains 14 hyphenations. 100% hyphenation level
results in 22 hyphenations, while 0% only results in 8 hyphenations.

– sw/qa/extras/layout/data/tdf167648_minimum.fodt,
  sw/qa/extras/layout/data/tdf169168_minimum.fodt: set maximum
  word-spacing to 100% from 101% to limit the original unit test only
  for minimum letter spacing.

More information: LO/COOL Book & Typography projects:

https://www.numbertext.org/typography/

https://www.numbertext.org/book/

Follow-up to commit cf104be5cb "tdf#119908
tdf#166113 cool#15973 sw smart justify: fix DOCX hyphenation",
commit d572576dd6
"tdf#119908 cool#15973 sw smart justify: fix "smart" hyphenation",
commit 529755f091
"tdf#166113 sw smart justify: adjust algorithm for interoperability" and
commit 7d08767b89 "tdf#130088 tdf#119908
smart justify: fix DOCX line count + compat opt."

Change-Id: I84b3893ea6c5cd4eff74a73514722285e7071392
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207545
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-07-04 17:11:37 +02:00
László Németh cf104be5cb tdf#119908 tdf#166113 cool#15973 sw smart justify: fix DOCX hyphenation
Setting 150% maximum word spacing instead of 133% during DOCX
import, the improved line breaking fixes DOCX layout
interoperability in the case of hyphenation, too.

Note: justification of MSO 2013 and later uses also a "less
hyphenation" strategy, not only "better word spacing", resulting
different line breaking, when hyphenation is enabled.

Follow-up to commit d572576dd6
"tdf#119908 cool#15973 sw smart justify: fix "smart" hyphenation",
commit 529755f091
"tdf#166113 sw smart justify: adjust algorithm for interoperability"
and commit 7d08767b89
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: I85410b4a73c96dab4ddfc25d894e72780ebe4728
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207508
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-07-03 11:01:51 +02:00
László Németh d572576dd6 tdf#119908 cool#15973 sw smart justify: fix "smart" hyphenation
While some parts of the "smart" hyphenation were implemented,
resulting in better spacing and less hyphenation, now exceeding of
maximum word spacing, also better hyphenation in the same word are
handled in a more interoperable way. Also fix missing calculation
with the length of the hyphen character, and add a better
4-page test document.

Choosing 75% minimum word spacing, 100% desired word spacing
and the 150% maximum word spacing (not the previous 133%),
line breaking is interoperable with the default hyphenation
algorithm of MSO 2013 and later during justification, fixing
the following interoperability issues:

* always prefer shrinking at worse word spacing, when
  it removes a hyphenation

* hyphenation wasn't allowed at shrinking: allow it
  choosing the hyphenation, if needed:

  * when shrinking results the hyphenation inside
    the same word, but with better word spacing;

  * when expansion would exceed maximum word spacing
    (150% of normal word spacing in the case of
    DOCX interoperability)

* BreakWidth() doesn't contain the extra width of the hyphen:
  adding this value, fix comparison of shrinking and expansion
  of word spacing in the case of hyphenated lines, too.

Note: this doesn't fix the DOCX import completely, because
the maximum word spacing is not 150% yet.

Note about layoutwriter testing: the 4-page test document needed
run-time removing of the pages to get correct hyphenation on the
next page.

Adjust unit tests for the improved hyphenation:

* testTdf126154, testTdf126154_minimum_shrinking

* sw/qa/extras/odfexport/data/tdf159923.fodt,
  sw/qa/extras/odfexport/data/tdf159923_stretched.fodt:
  Specify missing minimum and maximum word spacing according to the UX constraints:

  minimum word spacing <= normal word spacing <= maximum word spacing

Change-Id: I9ed134c0d3789ceaa23b6310609d61e2bfcac781
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207506
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-07-03 09:25:49 +02:00
László Németh 65fe9f853e tdf#163309 tdf#172263 sw: set white metadata shadings transparent
Using white color for custom metadata field shadings disables field
shadings. This allows to highlight only custom sets of the metadata
fields, also to fix the visibility of the opening bracket and label
of the bookmark boundary marks by hiding only the metadata field
shadings temporarily or permanently.

Use also smaller brackets and label fonts for custom color and label
at enabled field shadings.

Note: run-time RDF modification of the custom color or disabling field
shadings may need to add/remove a bookmark over the metadata-field or
RDF annotation to update the field shadings immediately.

Follow-up to commit ead4303c2d
"tdf#172263 tdf#163309 sw: fix bookmark boundary mark/label visibility".

Change-Id: Ib39bef91185d9c1d486afdb10c8c8662cd1ab8da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206223
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-06-10 01:24:43 +02:00
László Németh ead4303c2d tdf#172263 tdf#163309 sw: fix bookmark boundary mark/label visibility
Editing the line, using fixed line height or using metadata
fields resulted broken or completely invisible bookmark boundary
marks and metadata labels. Fix these, and improve not only
visualization, but readability of the metadata labels using auto
color label text and improved design.

Details:

tdf#163309 introduced bookmark boundary mark labels, visualizing
boundaries and metadata labels of arbitrary text parts (not only
text portions inside the paragraph, like metadata fields) using
custom metadata colors, keeping also the WYSIWYG text layout
(metadata fields has custom prefix/suffix support, but that
breaks the text layout).

Focusing on the metadata visualization, this patch fixes the
appearance and readability of the metadata annotations and their
custom labels both stored in RDF, but some of the changes added
improved visibility for the plain bookmark boundary marks, too
(they weren't visible in line starting and ending positions at
fixed line height paragraph settings).

= Fields and bookmarks on the same position =

Bookmark boundary marks with metadata visualization are visible
again without enabled field shading, to avoid of the case, when
shading of the RDF metadata fields hid the bookmark boundary
marks in the same position.

= Fix bad clipping at fixed line height =

If bookmark boundary marks are enabled, disable extra clipping of
the text lines at fixed line height:

– to show bookmark boundary marks in line starting and ending
  positions (don't clip them);

– to show the upper part of the brackets (don't clip it).

= Fix editing and overlapping boundary marks =

Use text-size brackets at bookmarks with RDF metadata, not higher
ones, also move the labels nearer to the text as much as possible
to avoid of the different artifacts: editing didn't update the
line completely, overlapping boundary marks, etc.

= New label design with improved readability =

Use thin black letters on gray background, or custom color
background defined in the RDF metadata. This way no need to use
thick letters, as before for the colored text: the black text is
uniformly readable (except on very dark background color – a
future fix to do. Note: simply replacing COL_BLACK with COL_AUTO
doesn't work, because it uses the text background, not the label
background).

Join the labels with the brackets, creating a big labelled
bracket.

Add narrow spaces before and after the label text to get better
visibility in the case of the short labels.

Change to start-bottom labeling, i.e. replace the positions of
the labels: put the fist label under the text at the opening
bracket, and the second label over the text at the closing
bracket, because the annotated headings and proper names always
start with uppercase letters, but mostly end with lowercase ones,
so it is possible to fix editing etc. artifacts with much less
overlapping of the labels and the text.

Enlarge the font size limit for the annotations (12 pt).

Follow-up to commit 412e0ab266
"tdf#150717 sw RDF metadata: add custom color bookmark boundary
marks", commit a4af3948e9
"tdf#163309 sw: clean-up bookmark boundary mark labels", and
commit 3393e52be0 "tdf#163309 sw:
show rdf:type as labels on bookmark boundary marks".

Change-Id: I5f4acb845e9688cc2ef665fcae0f0c7799bd8e8b
Signed-off-by: László Németh <nemeth@numbertext.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205764
Tested-by: Jenkins
2026-05-28 17:26:10 +02:00
László Németh df0f3bebee tdf#98598 tdf#172186 sw: fix Web View with transparent page
Page background with transparent image or transparent color
resulted broken scrolling in Web View, painting page content
without clearing the screen. Force painting of page margin
to clear the screen, as in the Normal View.

Regression since commit 65a56636a6
"tdf#88337 tdf#89193: sw: add missing SwXPageStyle properties".

Change-Id: Id62e300ba951bcb5d623098def7cf3d9d8b16e93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205479
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-05-22 01:58:55 +02:00
László Németh 95425de15b tdf#168705 ooo#4914 sw: add Draft View (distraction-free writing)
Add View->Draft View for distraction-free writing, flattening
multi-column sections and disabling whitespace, including left
page margin. The Draft View keeps fixed line width to avoid of
the window-size, often too long text lines of the Web View, too.

To focus on distraction-free writing, Draft View supports
the followings:

– Hide header/footer

– Changing to Draft View, disable also View->Whitespace
  to remove top and bottom page margins and space between pages

– Hide left page margin, when View->Whitespace is disabled,
  so all the body text (e.g. with different left page margin
  in mirrored page layout) start at the same distance from the
  left page border, which was a basic requirement especially
  for the distraction-free full screen mode (Ctrl-Shift-J).

– Show multi-column sections as single-colum sections (unlike
  the Web View). It keeps the original column width, if it's
  possible, i.e. when all the columns have got the same width.
  This way no need to scroll back and forth to the previous or
  next columns during writing and reading.

– Changing to Normal View from Draft View, enable also
  View->Whitespace to show top and bottom page margins and
  space between pages again.

Note: similar to the Hidden whitespace mode, Draft View setting
is not saved yet.

Change-Id: Ib8e7433467fcb3516eb0f89e39db94ff5b4d5af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204934
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-05-08 16:00:32 +02:00
László Németh 62aecba14c tdf#38159 cui sw offapi xmloff: add paragraph composer
Balance word spacing within the consecutive lines
to get uniform grayness and less rivers for better
readability, enabled by the new paragraph property

com::sun::star::text::ParaComposer

and the following developments:

* Add Paragraph Composer checkbox on Alignment pane of the
  paragraph formatting dialog window (not default yet);

* Implement paragraph composer: big word spacing of a
  line is decreased by shifting the last word from the
  previous line, only if the word spacing is better, than
  before, and the increased word spacing in the previous
  line doesn't exceed the Maximum word spacing (limited
  paragraph composer);

* When Maximum word spacing is not greater than the Desired
  word spacing, shifting of the last word is not limited
  by the Maximum word spacing (unlimited paragraph composer)

* Add loext:paragraph-composer attribute, as LibreOffice
  ODF extension;

* Add ODF unit tests for the limited and not limited
  paragraph composer.

Note: "Smart justify" line breaking algorithm chooses
space shrinking (limited by Minimum word spacing)
only if shifting the last word isn't better based
on the desired word spacing. This was still a greedy
line breaking algorithm, resulting big word spacing
in the lines before a longer word.

The paragraph composer shifts the last word (or the
first part of the hyphenated last word) from the previous
line to decrease big word spacing in the actual line.

Note: balancing very big word spacing in narrow consecutive
lines can result vertical rivers. To avoid this, use limited
paragraph composer by setting maximum word spacing.

Follow-up to "smart justify", word spacing, letter spacing
and glyph scaling developments. Selected commits:
commit 529755f091 "tdf#166113
sw smart justify: adjust algorithm for interoperability",
commit 7d08767b89 "tdf#130088
"tdf#119908 smart justify: fix DOCX line count + compat opt.",
commit 7d6696757d "tdf#159923
sw cui offapi xmloff: add custom word spacing",
commit 5a48070f59 "tdf#126154
sw offapi xmloff cui: add min/max word spacing",
commit f83a04c510 "tdf#167648
cui offapi xmloff sw: add DTP-feature maximum letter spacing",
commit 3c53797210 "tdf#167648
sw letter spacing: implement minimum letter spacing",
commit 45ec7bd761 "tdf#168251
cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF".

Change-Id: I727caad70536c86be524bc9d9b52bc71208c202a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203288
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-04-09 14:42:07 +02:00
László Németh f25371fa95 tdf#169491 tdf#168251 sw glyph scaling: fix all scale width regressions
Do not disable scale width character setting, if it is applied in a text
span (except when the paragraph uses automatic glyph scaling, yet).

Regression since commit 45ec7bd761
"tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF".

Follow-up to commit 7ed8a8ee39
"tdf#171161 tdf#168251 sw glyph scaling: fix scale width regression".

Change-Id: Ic42e58d1b96d9697eb0ddd0d7b999171fc0f39eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201946
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-03-19 04:04:32 +01:00
László Németh 7ed8a8ee39 tdf#171161 tdf#168251 sw glyph scaling: fix scale width regression
Do not disable scale width character setting if
line-level automatic glyph scaling is not applied
in the paragraph.

Regression since commit 45ec7bd761
"tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF".

Change-Id: I3d47be27349f0be4c4c65f1da5662a3daf6c7063
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201528
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-03-12 17:07:34 +01:00
László Németh c29c1fd9c2 tdf#163894 sw DOCX: fix char style-ref at multi-page paragraphs
Fix page -> previous pages -> next pages search order for
pages with paragraphs which overlaps adjacent pages.

Follow-up to commit da88bd54eb
"tdf#163894 sw DOCX: (p)refer char style-ref on the actual page",
commit fce6492756
"tdf#163894 sw DOCX: add character styles to style-ref window",
commit 955f0f9b5e
"tdf#163894 sw DOCX: fix style-ref with character style",
commit d4fdafa103 "tdf#160402
writerfilter,sw: STYLEREF field can refer to character style"
and commit 32c588dd11
"tdf#86790: Add support for a word-style styleref".

Change-Id: I8faf292a699c58e0c38b4e59c021e36c795b5f07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199911
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-02-21 10:43:47 +01:00
László Németh cd9da3e6d7 tdf#32363 sw DOCX: add unit test/documentation for shortening headings
Using Styles fields with custom character styles allows shortening
the numbered headings in the header/footer, both in ODT and DOCX
documents. See test document sw/qa/extras/ooxmlexport/data/tdf32363.docx
for more information.

Follow-up to commit da88bd54eb
"tdf#163894 sw DOCX: (p)refer char style-ref on the actual page",
commit fce6492756
"tdf#163894 sw DOCX: add character styles to style-ref window",
commit 955f0f9b5e
"tdf#163894 sw DOCX: fix style-ref with character style",
commit d4fdafa103 "tdf#160402
writerfilter,sw: STYLEREF field can refer to character style"
and commit 32c588dd11
"tdf#86790: Add support for a word-style styleref".

Change-Id: Ib1908fa392ff838f60c0a2330e2443b558bf48fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199672
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-02-19 10:34:57 +01:00
László Németh da88bd54eb tdf#163894 sw DOCX: (p)refer char style-ref on the actual page
When a paragraph starts before the page, choose
the referred text on the actual page for the header/
footer references. If there is no such text, choose
the nearest one on the previous pages, in the case
of the backward search, too, according to the
interoperability. If there is no other text, choose
the nearest referred text on the next pages.

Follow-up to commit fce6492756
"tdf#163894 sw DOCX: add character styles to style-ref window",
commit 955f0f9b5e
"tdf#163894 sw DOCX: fix style-ref with character style",
commit d4fdafa103 "tdf#160402
writerfilter,sw: STYLEREF field can refer to character style"
and commit 32c588dd11
"tdf#86790: Add support for a word-style styleref".

Change-Id: I2e9dc239202b281989f3d1b1a182e55127f2c419
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199591
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-02-18 13:52:35 +01:00
László Németh fce6492756 tdf#163894 sw DOCX: add character styles to style-ref window
Allow to refer and check character styles in the cross-reference
dialog window, fixing also the associated interoperability issues.
Now it's possible to check the (previously unknown) reference
character style in the DOCX import, also to create new style-ref
fields referring the character styles used in the document.

Follow-up to commit 955f0f9b5e
"tdf#163894 sw DOCX: fix style-ref with character style",
commit d4fdafa103 "tdf#160402
writerfilter,sw: STYLEREF field can refer to character style"
and commit 32c588dd11
"tdf#86790: Add support for a word-style styleref".

Change-Id: I4cb34e8b470114d3beb4573ae14caea5900ac0ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199590
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-02-18 13:50:28 +01:00
László Németh 955f0f9b5e tdf#163894 sw DOCX: fix style-ref with character style
Refer only the text formatted by character style instead
of the whole paragraph text content, when style-ref
field is used with character styles. Since a continuous
text can consist of several hints, concatenate them.

This fixes OOXML/DOCX interoperability, when not the
full paragraph is formatted with the referred character
style (see also DOCX unit tests of the upcoming commits).

Follow-up to commit d4fdafa103
"tdf#160402 writerfilter,sw: STYLEREF field can refer to character
style" and commit 32c588dd11
"tdf#86790: Add support for a word-style styleref".

Change-Id: I73f7a23e0124894c9fdcae516473caac0b5e4169
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199589
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-02-18 13:49:03 +01:00
László Németh 6ab58d91a1 tdf#170177 tdf#132599 sw: disable some hyphenation tests temporarily
Disable layoutwriter6 tests "testTdf165984" and
"testTdf126154_portion" are failed since
commit 391ea3bcb5
"tdf#170177 cui offapi sw xmloff: hyphenate at constituent boundaries".

Disable layoutwriter3 test "testTdf132599_always"
failed on some test platform.

Note: these problems weren't revealed on Jenkins test platforms
because of missing hyphenation dictionaries.

Change-Id: I054adc474784e79cb3ea490e6ab62c357fa8fc8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196643
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2026-01-07 07:57:45 +01:00
László Németh 391ea3bcb5 tdf#170177 cui offapi sw xmloff: hyphenate at constituent boundaries
Add new minimum character limit paragraph property to limit
hyphenation left to the compound constituent boundaries:

  com::sun::star::text::ParaHyphenationCompoundMinTrailingChars

– With the previous option for the hyphenation right to the
  constituent boundary, this new option allow to limit or disable
  hyphenation completely inside the compound constituents, or
  hyphenate only at constituent boundaries, with or without
  inside the suffix of the word or constituents;

– xmloff: add "no-limit" to loext:hyphenation-compound-push-char-count
  and loext:hyphenation-compound-push-char-count;

– "no-limit" values of this and the *LeadingChars option mean
  a maximum value. When both *LeadingChars and *TrailingChars
  got "no-limit", hyphenation before and inside the suffixes are
  forbidden, i.e. it is allowed only at constituent boundaries;

– textflowpage.ui: set max character count to 99, in both options;

– fix ParaHyphenationCompoundMinLeadingChars implementation for
  compound words with multiple constituents, when the middle word(s)
  are shorter, than the limit (e.g. Hungarian "tűz|kő|pattintás"
  wasn't hyphenated as "tűzkő-pattintás", only as "tűz-kőpattintás").

Follow-up to commit 3a332d9f1c
"tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundary"
and commit c899d3608d
"tdf#158885 sw: don't hyphenate right after a stem boundary".

Change-Id: I0b71562727332217364f9ace85e8ac6ea3abc8b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196345
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-12-31 22:54:05 +01:00
László Németh 7e4d45331a tdf#40277 linguistic: recognize compounds from custom dictionary words
Accept compounds separated by hyphens, when some (or all) constituents
of the compound come from the custom dictionaries.

For example, when "CustomWord" added by the user to one of the custom
dictionaries, now "CustomWord-based", "CustomWord-CustomWord",
"CustomWord-based-CustomWord-like" etc. compounds are accepted.

Note: the recursion used by the algorithm is limited by the maximum
allowed word length during spell checking (100 characters).

Change-Id: Ie2e19714ad10b3c7436a442ca8c8775e673da579
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196271
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-12-29 10:05:58 +01:00
László Németh 80dcb39edb tdf#130695 sw linguistic: fix custom abbreviations
linguistic: Abbreviations in the custom dictionary
were accepted without the terminating dot, too
(because bSimilarOnly comparison used by getEntry()
removes all terminating dots during the dictionary
look up.)

Because "Add to [custom] dictionary" always removed
the terminating dot, and direct editing of the custom
dictionaries is still not so comfortable, the following
user-friendly options were implemented for the
abbreviations:

– spell checking dialog: words with multiple dots
  – e.g. F.A.C.S. –, are always added to the custom dictionary
  with the terminating dot to reject the bad abbreviations:
  "e.g", "F.A.C.S" etc.;

– context menu: add optional menu items to the context menu
  of the abbreviations to put the word with the terminating
  dot into the custom dictionaries, e.g. for the word "Corp.":

  * standard.dic (Corp)
  * standard.dic (Corp.)

  as menu items of the the Add to Dictionary submenu.

Change-Id: I54532c0a63af8effe9f103e75e853703d7d57563
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196263
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-12-28 23:48:55 +01:00
László Németh c1702ddc2e tdf#170140 lingucomponent: check words with non-ASCII apostrophe
If the spelling dictionary contains them with non-ASCII apostrophe.

Previously the words were checked only with apostrophes converted
to their ASCII version, resulting continuous false alarms, despite
the correct orthography in the document and in the spelling
dictionary.

Now the words are checked both with ASCII conversion and with
the original non-ASCII apostrophes (because still there are
UTF-8 dictionaries with ASCII apostrophes, moreover, dictionaries
containing mixed apostrophes in the same dic file).

Example words for the Hungarian dictionary: d’Arc, d’Alembert,
McDonald’s (and their several recognized suffixed forms: d’Arcért,
d’Arckal, d’Arcként, d’Arcnak, d’Arcot etc. etc.)

Add unit tests for 1) break iterator and 2) spell checking with
non-ASCII apostrophes.

Change-Id: I24a570df41fa5aba2e7b67dde0db33377717dc2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196248
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-12-28 06:17:07 +01:00
László Németh 09b5b77e02 tdf#162514 i18npool: fix Hungarian ordinal numbers with affix
Restores Hungarian break iterator by recognizing ordinal
numbers with affixes, e.g. "50.-et" etc. (to spell checking
bad forms, like "50.-at").

Regression from commit 44699b3de3
"tdf#49885 BreakIterator rule upgrades".

Follow-up to commit f4fe6df6aa
"tdf#162514 i18npool: Handle abbreviations in dictionary breakiterator"
and commit 167bbe31c0
"tdf#162514 i18npool: apply fix for Hungarian abbreviations, too".

Change-Id: I6b6ea363a509a9d8af8330330f78cc23c210d107
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196225
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-12-26 20:36:41 +01:00
László Németh 167bbe31c0 tdf#162514 i18npool: apply fix for Hungarian abbreviations, too
Restores Hungarian abbreviation handling to spell checking by
applying the fix for dict_word_hu.txt.

Regression from commit 44699b3de3
"tdf#49885 BreakIterator rule upgrades".

Follow-up to commit f4fe6df6aa
"tdf#162514 i18npool: Handle abbreviations in dictionary breakiterator".

Change-Id: I83e30c831759ae896f1db2da697287b8c4dcd26b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196224
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-12-26 11:33:35 +01:00
László Németh 30b57dcd3f Update git submodules
* Update dictionaries from branch 'master'
  to 74b6ae2a2df22fd9d6e253f0391ac3a67cb7b3f8
  - Hungarian dictionary v1.9
    
    Congratulations to László Krasznahorkai, Nobel-Prize winner in
    literature in 2025. Add several words from his first novel and
    recent speeches, also missing word forms, completing their
    morhohological paradigm, for example, support deep vowel harmony
    at “Apokalipszis”: “Apokalipszisnál” etc., not only the already
    supported front one: “Apokalipszisnél” etc.
    
    Complete hyphenation data by manual processing of more than
    25 thousand words, annotating more than 7000 words with
    constituent boundaries, special hyphenation of foreign words
    or proper names with traditional orthography. This fixed
    spell checking of compound words with more than two
    constituents, also hyphenation at constituent boundaries.
    
    See ChangeLog for a more complete list of the recent changes:
    
    https://github.com/laszlonemeth/magyarispell/blob/master/ChangeLog
    
    Change-Id: Ice67dea0e6d985e9cebce591d572c70645e2815c
    Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/195690
    Reviewed-by: László Németh <nemeth@numbertext.org>
    Tested-by: László Németh <nemeth@numbertext.org>
2025-12-16 01:55:45 +01:00
László Németh e35866bad3 Update git submodules
* Update dictionaries from branch 'master'
  to 0f7ce308ab88755131a3811ce493b00932f2c89c
  - Update Hungarian hyphenation dictionary to version v20251213
    
    Source: https://sourceforge.net/projects/magyarispell/files/OOo%20Huhyphn/v20251213/huhyphn_v20251213_LibO.tar.gz/download
    
    Fixed stems (~1080): https://sourceforge.net/projects/magyarispell/files/OOo%20Huhyphn/v20251213/Huhyphn_v20251213_LibO.pdf/download
    
    Change-Id: Ib69bb68002b53a3d05b664db36f0e5897bc48b10
    Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/195611
    Reviewed-by: László Németh <nemeth@numbertext.org>
    Tested-by: László Németh <nemeth@numbertext.org>
2025-12-16 01:55:29 +01:00
László Németh 97f97ba44e tdf#169168 sw letter spacing: extend it for multiportion lines
Enable custom letter spacing and glyph scaling for multiportion
lines, i.e. lines with emphasized and underlined words, or
lines hyphenated automatically or with soft hyphen etc.

For this, width of the text portions are modified temporarily
according to the actual available blank space of the lines
at processing the last text portion. Depending on the filling
of the text line with text portions during line breaking, portion
width data are changed back and forth.

Note: Letter spacing and scaling data are stored in SwLineLayout
instead of SwTextPortion.

Other fixes and changes:

– itrcrsr.cxx: text cursor position follows the custom letter
  spacing and custom glyph scaling applied in the line;

– itradj.cxx: at letter spacing, the enlarged blank space is
  removed after the last letter in the line, fixing jittering
  of the right side of the lines.

– guess.cxx: fix crashing during typing before a terminating
  text portion;

– portxt.cxx: fix bad letter spacing, when the line contains
  zero width characters (soft hyphen, zero-width space etc.);

– testTdf168351: extend test document, because compression is not
  applied in the last line any more. Note: this is likely not a
  problem (in fact, it's the opposite, because filling the last
  line completely can destroy the clear separation of the paragraphs,
  especially without first line indent).

– testTdf168251 and testTdf168448: adjust the tests according to
  the fixed line breaking.

Follow-up to commit 45ec7bd761
"tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF",
commit 3c53797210
"tdf#167648 sw letter spacing: implement minimum letter spacing"
and commit f83a04c510
"tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter
spacing".

Change-Id: I7fc144d499b466ca42f5e1d81e9618fc3fb1f487
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193274
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-11-01 09:46:53 +01:00
László Németh e03dbd2e30 tdf#168528 sw letter spacing: fix false alarm with missing font
Font used by the test is embedded in the document, but
modules with enabled gb_CppunitTest_set_non_application_font_use
failed with false alarms. As a quick fix, move the test
into sw_core_text, where gb_CppunitTest_set_non_application_font_use
is not enabled, and revert the vcl exception added for the
test previously.

Regression by 8306c4e86a
"tdf#168528 sw letter spacing: fix freezing with minimum
spacing/scaling".

Change-Id: I8cad0977510e806596dba8eeb12cb28cc3dbf006
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191529
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-09-26 15:11:22 +02:00
László Németh 8306c4e86a tdf#168528 sw letter spacing: fix freezing with minimum spacing/scaling
Fix never-ending loop in SwTextFrame::Format_() resulted by bad compression of lines with COMPLETE_STRING cut position.

Note: to test the fix of the rare freezing, a subset font has been
created from Source Serif 4 Variable, and embedded in the test file.

Follow-up to commit 33f20d0a0f
"tdf#168351 sw letter spacing: fix spaces in the last line",
commit 45ec7bd761
"tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF",
commit 3c53797210
"tdf#167648 sw letter spacing: implement minimum letter spacing"
and commit f83a04c510
"tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter
spacing".

Change-Id: I517f2b878421df40d69c785155107cf7380f0c0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191432
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-09-25 10:04:24 +02:00
László Németh d86f68e6b8 tdf#168448 sw letter spacing: enable it + glyph scaling at hyphenation
Letter spacing and glyph scaling were disabled in hyphenated lines
because of their broken layout. Now the hyphen mark is positioned
correctly at the end of the line, not before that, applying plus letter
spacing and glyph scaling on horizontal position of the hyphen portion,
and without expanding the text over the hyphen portion.

Follow-up to commit 33f20d0a0f
"tdf#168351 sw letter spacing: fix spaces in the last line",
commit 45ec7bd761
"tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF",
commit 3c53797210
"tdf#167648 sw letter spacing: implement minimum letter spacing"
and commit f83a04c510
"tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter
spacing".

Change-Id: I36ec02be9afc60e1d640c40b628a786aea9a12aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191080
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-09-17 22:58:27 +02:00
László Németh 33f20d0a0f tdf#168351 sw letter spacing: fix spaces in the last line
Minimum letter spacing and glyph scaling were applied in
the last paragraph line incompletely, because of missing
update of the break width, when the last two paragraph
lines were compressed into a single one. This resulted in
calculating more blank space, than available, and positive
kerning, also glyph expansion with missing word spacing and
overlapping words, instead of negative kerning and glyph
compression for the desired word spacing.

Follow-up to commit 45ec7bd761
"tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF",
commit 3c53797210
"tdf#167648 sw letter spacing: implement minimum letter spacing"
and commit f83a04c510
"tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter
spacing".

Change-Id: I0d72a6fa2f9d945bd463fbe162ef5d0eb377f49a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190862
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-09-12 15:27:51 +02:00
László Németh 9d8a54d4b6 tdf#167648 sw letter spacing: fix division by zero
/sw/source/core/text/portxt.cxx:351:90: runtime error: division by zero
    #0 0x7f7bf4700824 in SwTextPortion::SetSpacing(SwTextFormatInfo&, o3tl::strong_int<int, Tag_TextFrameIndex>, int, short) /sw/source/core/text/portxt.cxx:351:90

(<https://ci.libreoffice.org//job/lo_ubsan/3669/>)

Regression from commit 3c53797210
"tdf#167648 sw letter spacing: implement minimum letter spacing".

Change-Id: I1dbea7ce855c1f4cb0604e6f9b96b875dd8eb646
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190608
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-09-05 22:22:32 +02:00
László Németh 45ec7bd761 tdf#168251 cui offapi xmloff sw glyph scaling: extend UNO/UX/ODF
Add new paragraph justification options "Minimum glyph scaling"
and "Maximum glyph scaling" to improve typography, like DTP software
do, allowing to typeset visually better paragraphs, especially narrow
columns without unacceptably big word spacing.

* Add spin boxes to Alignment in paragraph formatting dialog window;

* Store properties in paragraph model:

  css::style::ParagraphProperties::ParaPropScaleWidthMinimum

  css::style::ParagraphProperties::ParaPropScaleWidthMaximum

  Note: desired glyph scaling is already supported by ODF/UNO,
  see css::style::CharacterProperties::CharScaleWidth.

* Implement visual layout of minimum and maximum glyph scaling,
  limited by the available extra word spacing and letter spacing,
  too.

  Note: last line can exceed the paragraph width, because minimum
  glyph scaling, also minimum letter scaling of the last line
  haven't been applied there, yet.

* Add ODF import/export (loext:text-scale-maximum and
  loext:text-scale-minimum, where style:text-scale is for the
  desired text scaling).

* Add ODF unit test.

Note: hyphenated lines, lines with multiple portions haven't
been using custom glyph scaling, yet.

Note: resolution of glyph scaling is 1 percent, which will
avoid of overgeneration of font types using variable fonts.

Change-Id: I9b4576dde4303437b64e37202c47f888f94c3f67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190534
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-09-03 15:22:37 +02:00
László Németh 3c53797210 tdf#167648 sw letter spacing: implement minimum letter spacing
Implement new paragraph justification option "Minimum letter spacing"
allowing to shrink text lines more, choosing better paragraph layout
instead of hyphenation or rivers of space.

* Implement visual layout of minimum letter spacing.

* Enable Minimum letter spacing spin box on Alignment pane of the
  paragraph formatting dialog window

* Remove also desired letter spacing spin box from the alignment pane.
  It will be better to visualize CharKerning with percentage value
  instead of adding a new user interface to the same setting.

* Set minimum and maximum spin box ranges to [-100, 0] and [0, 500],
  and remove unnecessary handlers.

* offapi: extend API description with ranges of letter spacing
  [-100, 500] and word spacing ([0, 1000]).

* Add ODF unit test.

Note: hyphenated lines, lines with multiple portions haven't
been using custom letter spacing, yet.

Note: resolution of the custom letter spacing is only 1/20 point
(1 twip) yet.

Note: adjust testTdf163149 failing on a test machine, maybe
because the DOCX test document contains the not supported Arial
font, resulting small differences based on the font replacement.

Follow-up to commit f83a04c510
"tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter
spacing".

Change-Id: I0d686ccbdaa5324eaf6c4c7f6da0f37e76f60611
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190533
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-09-03 15:21:58 +02:00
László Németh f83a04c510 tdf#167648 cui offapi xmloff sw: add DTP-feature maximum letter spacing
Add new paragraph justification option "Maximum letter spacing"
to distribute letters on (part of) the available blank area of the
justified line instead of overstretching word spacing, like DTP
software do.

This improves typography a lot, allowing typesetting visually better
i.e. more readable paragraphs, minimizing or removing rivers and
too big word spacing (which was common in columns or text without
hyphenation).

* Add spin box to Alignment in paragraph formatting dialog window,
  (also add spin boxes for future Minimum and the alternative
  percent-based Desired letter spacing, see CharKerning);

  For example (only ASCII visualization!), 100% maximum letter
  spacing adds a space character-width blank space between the
  characters, including the original space:

  0%:

  Lorem          ipsum
  pellentesque dolores
  vitae.

  100%:

  L o r e m  i p s u m
  pellentesque dolores
  vitae.

  Normal value: 3%-5% (or more for very narrow columns), which means
  e.g. 1-2 twips (twip = 1/20 pt) letter spacing in a ~12 pt text.

  Note: resolution of the custom letter spacing is only 1 twip yet.

* Store properties in paragraph model:

  css::style::ParagraphProperties::ParaPropLetterSpacingMaximum

  css::style::ParagraphProperties::ParaPropLetterSpacingMinimum

  Note: desired letter spacing is already supported by ODF/UNO,
  see css::style::CharacterProperties::CharKerning.

* Implement visual layout of maximum letter spacing.

  Note: after the last character of the line, there is an
  unwanted letter-spacing, yet (which is visible only with
  big letter-spacing values).

* Add ODF import/export (loext:letter-spacing-maximum and
  loext:letter-spacing-minimum)

* Add ODF unit test.

Note: hyphenated lines and lines with multiple portions do not
yet use custom letter spacing, yet.

Change-Id: Ieac9f21631b90ae46bed4501f12da0d15ed84d63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188653
Tested-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-08-01 11:51:04 +02:00
László Németh c05bc38067 tdf#167298 tdf#166113 sw word spacing: add word spacing indicator
tdf#167298: As an advanced feature for typography and related
development – including bug fixing –, add visualization for
justified text lines with too big word spacing.

tdf#166113: fix bInteropSmartJustify by adding bFullJustified
to avoid unnecessary extra calculation for the last paragraph line.
(Regression since commit 529755f091
"tdf#166113 sw smart justify: adjust algorithm for interoperability",
detected by the word spacing indicator).

The red word spacing indicator line is positioned before
the justified text line, and its width is the extra space
of a space character over the maximum word spacing.

For example, if the font-defined space width is 3 pt,
the maximum word spacing is 150%, spaces expanded to 6 pt in
the justified line results a 6 pt - 3 pt * 1.5 = 1.5 pt width
word spacing indicator.

To enable the word spacing indicator in a justified text,

1) Open "Tools" -> Options" -> "Advanced" -> "Open Expert Configuration";

2) search for "ShowWordSpacingIndicator";

3) double-click on the config entry (or press Enter) to set it to True;

4) Enable Formatting Marks (Control-F10).

Follow-up to commit 5a48070f59
"tdf#126154 sw offapi xmloff cui: add min/max word spacing"
and commit 7d6696757d
"tdf#159923 sw cui offapi xmloff: add custom word spacing".

Change-Id: I315b5e6b8239f4fdc8e69eb45fc292b8d5891138
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187199
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-06-30 18:02:59 +02:00
László Németh 938022c445 tdf#166113 sw smart justify: fix tdf160170.py regression test
Improved interoperability of smart justify has been changed line breaking.

Regression since commit 529755f091

Change-Id: Ib496d0d7b7856bef02b5692d76bdef1c004b3d67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186446
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-06-13 11:29:38 +02:00
László Németh 529755f091 tdf#166113 sw smart justify: adjust algorithm for interoperability
Skip space shrinking, if space expansion is closer (with a
weight) to the desired (100%) word space.

Import DOCX documents with 75% minimum word spacing,
100% desired word spacing and 133% maximum word spacing.

These changes cover MSO smart justify algorithm. Hyphenation and
text portions may need future adjustments.

Modify unit tests according to the changes:

– testTdf126154, testTdf126154_minimum_shrinking,
  testTdf126154_portion: choose maximum word spacing, i.e.
  expansion instead of shrinking, according to the weighted
  distance from the desired word space;

– testTdf163720: set desired word spacing to the minimum
  word spacing in the test document to get back the original
  regression test.

Note: the previous algorithm for disabled hyphenation within
the minimum and maximum word spacing range is replaced
by optimization for the desired word spacing (temporarily).
Interoperability analysis and custom more/less hyphenation
can change this.

Change-Id: Iec0582a497945743f97686743af5ff6609866abe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186138
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-06-09 23:59:40 +02:00
László Németh 41d3574263 tdf#126154 sw word spacing: fix greedy shrinking regression
Fix failing unit test file:///home/sberg/lo/core//sw/qa/extras/layout/data//tdf126154_minimum_shrinking.fodt:
/home/sberg/lo/core/test/source/xmltesttools.cxx:169:(anonymous namespace)::testTdf126154_minimum_shrinking::TestBody
equality assertion failed
- Expected: ,, , , , , , , , Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vesti bulum
- Actual  : ,, , , , , , , , Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vesti bulum c
- In <>, attribute 'portion' of '/root/page[1]/body/txt[18]/SwParaPortion/SwLineLayout[1]' incorrect value.

Regression since commit 01d1037262
"tdf#126154 tdf#149420 tdf#165984 sw: fix hyphenation
zones with portions".

Notes: Instead of the desired word spacing, an extra shrinking
was applied, when minimum and maximum word spacing is specified,
despite that there was no hyphenation with the desired
word spacing.

The first Guess() call is for the original line breaking
with 100% word spacing (specified in the font, no shrinking
or expanding yet), detecting also the possible space count
in the line. The second Guess() call is for both the custom
desired and maximum word spacing. The third Guess() call is
for the minimum word spacing. No need for the third call, if

1) The desired word spacing is 100% (as in the first Guess() call, and

2) There was no hyphenation in the first Guess() call (minimum
word spacing is used only for avoid hyphenation, yet).

Change-Id: Ia2e689800f4bdf94512e8b47bc42d6e77c3723ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185299
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-05-14 13:46:04 +02:00
László Németh 7d4ad3fa74 tdf#155707 sw DOCX: fix Kashida justification import/export/layout
Fix missing import/export of DOCX w:jc=lowKashida/mediumKashida/
highKashida justification settings. Add visualization support
using 133%, 200% and 300% word spacing for them.

Kashida justification allows typesetting less compressed Arabic text,
but this layout lost in Writer, also lost in DOCX/Word completely at
DOCX export of Writer (the settings weren't grab-bagged).

Note: instead of grab-bagging (which applied only at table properties
yet in the case of w:jc), these minimum = desired = maximum word spacing
values carry the Kashida justification setting. (DOCX cannot support
custom word spacing, so this doesn't interfere with the other settings.)

Follow-up to commit 5a48070f59
"tdf#126154 sw offapi xmloff cui: add min/max word spacing",
and commit 7d6696757d
"tdf#159923 sw cui offapi xmloff: add custom word spacing".

Change-Id: Icc41a69742ae604d091c6429441261742fe6f763
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185233
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-05-13 09:45:26 +02:00
László Németh 01d1037262 tdf#126154 tdf#149420 tdf#165984 sw: fix hyphenation zones with portions
When the text line contains text portions, fix disabled hyphenation at
minimum word spacing (implemented by hyphenation zones), paragraph end
zone and hyphenation zone, by calculating with the start of the line
instead of the start of the text portion.

Hyphenation wasn't disabled at minimum word spacing, paragraph end
zone and hyphenation zone, despite the available space, if the text line
contained text portions, e.g. an emphasized word:

tdf#126154: maximum word spacing: if the hyphenated word has
got own text portion, maximum word spacing was not applied.

tdf#165984 paragraph end zone: hyphenation was not always disabled
in the last but one paragraph line (i.e. in the last full paragraph
line), despite the available space in the last paragraph line, if the
line contains a text portion. (Paragraph end zone is applied only
if the text content of the planned last paragraph line is shorter,
than the actual content of the (hyphenated) last full paragraph line.)

tdf#149420: hyphenation zone was not calculated, if the hyphenated word
has own text portion, similar to the paragraph end zone.

Fix also regression of the preference of maximum and minimum
word spacing by checking possible space shrinking in the case, when the
maximum word spacing was also able to disable hyphenation (the unit test
verifies the fix of this regression, too).

Follow-up to commit 3dd2d7f449
"tdf#126154 sw word spacing: fix greedy space shrinking",
commit 5a48070f59
"tdf#126154 sw offapi xmloff cui: add min/max word spacing",
commit 7d6696757d
"tdf#159923 sw cui offapi xmloff: add custom word spacing",
commit 7a1d4b7d1d
"tdf#149420 sw offapi xmloff: add hyphenation zone",
and commit 7d384fb1c2
"tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end zone"

Change-Id: I8b798889edba449d4fd5506a8d1a6fd970c37c3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185116
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-05-12 11:55:31 +02:00
László Németh 3dd2d7f449 tdf#126154 sw word spacing: fix greedy space shrinking
If there are multiple possible break points allowed by minimum
word spacing to avoid of hyphenation, choose the nearest to the
desired word spacing, not the opposite.

Note: fix also potential unit testing problems by using
metric-equivalent Liberation Sans in the old test document
tdf126154.fodt instead of Arial.

Follow-up to commit 5a48070f59
"tdf#126154 sw offapi xmloff cui: add min/max word spacing"
and commit 7d6696757d
"tdf#159923 sw cui offapi xmloff: add custom word spacing".

Change-Id: Ib08e1910997d6e0526edcdb9c8fef10d5c8614d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185058
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-05-08 18:59:28 +02:00
László Németh 5a48070f59 tdf#126154 sw offapi xmloff cui: add min/max word spacing
To avoid of rivers and too much hyphenation, add minimum
and maximum word spacing options, similar to XSL-FO/CSS
and DTP software.

Only limiting hyphenation was implemented: hyphenation
of the words are disabled, if it's possible to expand
or shrink the spaces of the line within the values specified
by the maximum and minimum word spacing. First try to apply
the minimum word spacing, and if not possible, then the
maximum word spacing.

Note: maximum allowed shrinking has been applied for the
hyphenated lines instead of the minimum to remove the
hyphenation, yet. With the suggested default word spacing
values, this results no or minimal differences.

New UNO paragraph properties:

  com::sun::star::text::ParaWordSpacingMinimum

  com::sun::star::text::ParaWordSpacingMaximum

New ODF paragraph attributes:

  loext:word-spacing-minimum

  loext:word-spacing-maximum

New paragraph settings on Text Align pane:

  Minimum word spacing

  Maximum word spacing

While the desired word spacing got "Desired" label.

Note: suggested values of minimum, desired and
maximum word spacing are 80%, 100% and 133% (default
values e.g. in Adobe InDesign), in narrow columns e.g.
60%, 100% and 150%.

Follow-up to commit 7d6696757d
"tdf#159923 sw cui offapi xmloff: add custom word spacing".

Change-Id: I7f2a07f7fdb634cb16cdd8c2c937ca911b968405
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184595
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-04-25 09:54:28 +02:00
László Németh 7d6696757d tdf#159923 sw cui offapi xmloff: add custom word spacing
Add com::sun::star::text::ParaWordSpacing UNO
and loext:word-spacing ODF extensions to set
desired word spacing of a justified paragraph
relative to the width of the space character,
like DTP software do.

Add Justification section and "Word spacing"
spin box to the Text Align pane of paragraph settings.

This extends not only the smart justify interoperability
feature for custom shrinking (until 0%), but for custom
expansion, too, until 1000%, like Adobe InDesign do.

Note: this value hasn't been applied in the last
paragraph line, yet.

See also XSL-FO/CSS word-spacing and
commit 7d08767b89
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: I06f771335135e4682a1d1abfc9a247dbe4bc6b66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184187
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-04-15 22:40:12 +02:00
László Németh 5a905c47ec Update git submodules
* Update helpcontent2 from branch 'master'
  to fcff6cf389b6bf14fae3c796578634b00fb22a0c
  - tdf#165984 sw: document Text Flow -> Paragraph/Column/Page/Spread end zones
    
    Follow-up to commit 7d384fb1c2
    "tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end zone".
    
    Change-Id: Ib045b4a22bffdfa445a01ecac46bc2dca63acc02
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/183648
    Reviewed-by: László Németh <nemeth@numbertext.org>
    Tested-by: Jenkins
2025-04-03 19:12:07 +02:00
László Németh 5daab76058 tdf#165984 sw: don't apply hyphenation zone at disabled hyphenation
Fix unit tests testTdf132599_column and
testTdf132599_page_in_last_column.

In widorp.cxx, end zone is calculated by the inheritance of
the hyphenation zone, and as a regression, it was applied in
the last line enabling hyphenation disabled by hyphenation-keep
and hyphenation-keep-type.

As an optimization, skip also frame update of the last line, when
end zone is not different from the hyphenation zone, i.e. when
the last line has already had correct line break.

Regression from commit 7d384fb1c2
"tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end zone".

Change-Id: Ia54c9164d5297b5a73649259b4a25a808ece68e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183673
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-04-03 18:13:22 +02:00
László Németh d0eaf32858 tdf#165984 offapi: document inheritance of end zones
Document inheritance of the previously added paragraph
properties:

com::sun::star::text::ParaHyphenationZoneAlways
com::sun::star::text::ParaHyphenationZoneColumn
com::sun::star::text::ParaHyphenationZonePage
com::sun::star::text::ParaHyphenationZoneSpread

Follow-up to commit 7d384fb1c2
"tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end
zone" (where the new paragraph properties were introduced).

Change-Id: I90e275472e487a566b8e9cbb3fe511ec1e1e7874
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183603
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-04-02 09:44:59 +02:00
László Németh 4e509260aa tdf#165984 xmloff: don't export default end zone value "no-limit"
They inherit the value of the hyphenation-zone or their
ancestor (paragraph -> column -> page -> spread), so no need
to export the default value "no-limit".

Follow-up to commit 7d384fb1c2
"tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end
zone".

Change-Id: I50a3bb9801402b000fe9861e592958a946953056
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183602
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-04-02 09:42:55 +02:00
László Németh 7afd5aa47c tdf#165354 cui: gray out Move Line at disabling hyphenation
Follow-up to commit 698b38a18f
"tdf#165354 sw cui: implement HyphenationKeepLine – part 3".

Change-Id: I5cff4f280a1166ddd42df25fc53ab1f2ee0dc588
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183601
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-04-02 09:42:19 +02:00
László Németh 7d384fb1c2 tdf#165984 sw cui xmloff: add Paragraph/Column/Page/Spread end zone
Add new hyphenation options to adjust hyphenation, like DTP software do
in accordance with typographic requirements:

– Paragraph/Column/Page/Spread end zone spin boxes to Hyphenate Across
  section of Text Flow pane of paragraph settings;

– loext:hyphenation-zone-always, loext:hyphenation-zone-column,
  loext:hyphenation-zone-page and loext:hyphenation-zone-spread
  ODF extensions;

– widorp.cxx, guess.cxx: handle Column/Page/Spread end zones;

– guess.cxx: handle Paragraph end zone (without portions, yet).

According to their typography, languages with long words need better
adjustment of line break of the last full paragraph/column/page/spread
lines, than simply disabling hyphenation by the recent ODF hyphenation-
keep or its equivalent MS Word OOXML extension. DTP software use
paragraph and column/page/spread end zones to adjust the hyphenation
zones in the last lines, for example, setting Column end zone to the
150% percent of the Hyphenation zone, resulting less hyphenation, also
less short words parts at the end of the columns, pages and spreads,
increasing readability.

Note: the default OOXML hyphenation zone 18 pt (or its MS Word variants,
for example 21.25 pt) disables single letter or narrow 2-letter (li-,
fi-, i.e. fi ligature) hyphenations at 12 pt font height. Setting 27 pt
for Column end zone, all 2-letter hyphenation is disabled in last lines
of columns and pages.

Note: textflow.ui needs multiple adjustment definitions for correct work
of the multiple spin boxes.

Change-Id: I37bbb4da30de0ec75eb8636f70d8e16588c56ed1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183565
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-04-01 17:52:46 +02:00
László Németh e499c8d2fb tdf#165354 sw HyphenationKeepLine: apply it on the sidebar
Use the default HyphenationKeepLine=true, when hyphenation
is enabled by using the sidebar (i.e. Move Line = false).
Otherwise use the actual HyphenationKeepLine setting,
when KeepLineType is modified by the sidebar buttons (instead
of using always the (mostly bad) Move Line = true).

Follow-up to commit f8b9cd8fd1
"tdf#165354 sw xmloff: implement HyphenationKeepLine – part 2"
and commit 3e02ffb76c
"tdf#i165354 sw offapi DOCX: implement HyphenationKeepLine – part 1".

Change-Id: I25bb8b7a1be518f152b056870a313008aa180edb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183031
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-03-17 17:20:53 +01:00
László Németh 8c7c4ada3d Update git submodules
* Update helpcontent2 from branch 'master'
  to 9453c4646b34c22dcf59bc3c9ac8614029dbcad0
  - tdf#165354 sw: document Text Flow->Move Line (HyphenationKeepLine)
    
    Document new Text Flow setting of version 25.8: Hyphenate Across
    by moving only the hyphenated word (disabled Move Line).
    
    Also modify help of Hyphenation Across options to the new
    default "move word" from "move line".
    
    Follow-up to commit 698b38a18f
    "tdf#165354 sw cui: implement HyphenationKeepLine – part 3".
    
    Change-Id: I484a16dfcfbfd03c8c04da2d3d25a6ffa377ba1e
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/182747
    Reviewed-by: László Németh <nemeth@numbertext.org>
    Tested-by: László Németh <nemeth@numbertext.org>
    Tested-by: Jenkins
2025-03-11 13:21:33 +01:00
László Németh 6e31affdba tdf#165354 sw HyphenationKeepLine: fix 3-page or longer paragraphs
Fix layout of 3 or more page long paragraphs (when the third or
more pages start with a hyphenated line) by removing an obsolete/broken
limitation (detection of shifting the entire hyphenated line, when
HyphenationKeepLine is false).

Add more unit tests for long paragraph.

Follow-up to commit e79e12484f
"tdf#165354 sw: fix frame update (HyphenationKeepLine – part 4)".

Change-Id: I8a06ccf3eb7d5f5e5e31478f3765b543bd374da5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182590
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-03-06 21:00:09 +01:00
László Németh e79e12484f tdf#165354 sw: fix frame update (HyphenationKeepLine – part 4)
Fix missing layout frame update, when the last hyphenated
word is moved to the next column (i.e. also text frame or
table cell), page or spread:

– at modifying hyphenation settings: 1) enabling hyphenation
  in the last line again or 2) enabling Move Line;

– at loading columns/frames with hyphenation-keep-line="true"
  setting: hyphenation wasn't disabled in the frames, despite
  the document model (but it was possible to update them by
  using Toggle Formatting Mark);

– at text editing: deleting lines before the line with disabled
  hyphenation didn't enable its hyphenation, despite that the
  line was not the last line on the page any more.

Add various unit tests for columns, frames and tables, when
the last hyphenated word moved or not moved to the next column,
text frame or page:

– hyphenation-keep-type="column":

    – tdf165354_column.fodt: disable hyphenation at the end
      of all columns;

    – tdf165354_frames_on_same_page_no_hyphenation.fodt:
      disable hyphenation at the end of all linked text frames,
      including when they are on the same page.

– hyphenation-keep-type="page":

    – tdf165354_page_in_last_column.fodt: disable hyphenation
      at the end of pages, in columns, too;

    – tdf165354_page_in_not_last_column.fodt: otherwise don't
      disable hyphenation at the end of the non-page-terminating
      columns;

    – tdf165354_frames_on_same_page_hyphenation.fodt:
      don't disable hyphenation at the end a linked text frame,
      if the next frame with the continuation of its text is there
      on the same page.

    – sw/qa/extras/layout/data/tdf165354_page_in_table.fodt:
      disable hyphenation at the end a table cell, if the text
      continues on the next page;

– hyphenation-keep-type="spread":

    – tdf165354_frames_on_spread_hyphenation.fodt:
      don't disable hyphenation at the end a linked text frame,
      if the next frame with the continuation of its text is there
      on the same spread, see at the end of text frame 2 on page 2
      (left page) and its continuation, text frame 3 on page 3 (right
      page of the same spread);

    – tdf165354_frames_on_right_pages_no_hyphenation.fodt:
      disable hyphenation, if the next text frame is there
      in a different spread (i.e. a different right page here);

Follow-up to commit 698b38a18f
"tdf#165354 sw cui: implement HyphenationKeepLine – part 3",
commit f8b9cd8fd1
"tdf#165354 sw xmloff: implement HyphenationKeepLine – part 2"
and commit 3e02ffb76c
"tdf#i165354 sw offapi DOCX: implement HyphenationKeepLine – part 1".

Change-Id: I8f0b879cbac30b7972ee27e473d492d8964b1090
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182549
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-03-06 00:27:09 +01:00
László Németh 38a4d3f0b0 tdf#164823 sfx: fix order of sidebar hyphenation options
Position of hyphenation toolbar and its label was the
same, resulting platform-specific layout problem, e.g. on Windows.

Follow-up to commit 98f7f54046
"tdf#162491 tdf#125032 add hyphenation settings to sidebar".

Change-Id: I97a873fb6c19f283526ee67b89fe310ab9c62acf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182486
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-03-05 10:04:04 +01:00
László Németh fe502cd93b tdf#162840 sfx: fix layout of sidebar hyphenation options
Row-spacing was too small on Windows user interface,
resulting overlapping widget elements.

Follow-up to commit 98f7f54046
"tdf#162491 tdf#125032 add hyphenation settings to sidebar".

Change-Id: I055500cdcef39eef1ecc2fab35eb4cc8ef231992
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182485
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-03-05 10:03:35 +01:00
László Németh 698b38a18f tdf#165354 sw cui: implement HyphenationKeepLine – part 3
Add check box "Move Line" to the Hyphenate Across section
of the Text Flow paragraph settings.

Note: this is the MSO interoperability option of MS Word
Layout Option "Use Word 2013 rules for hyphenation between
pages and columns".

"Move Line" is sensitive only if Hyphenate Across Column,
Page or Spread are disabled (MS Word Layout Option "Allow
hyphenation between pages or columns").

Default value of HyphenationKeepLine is true, i.e. if "Move
Line" is disabled. Enabling Hyphenation Across Spread not only
grays out "Move Line", but disables it, too, to force the default
value, which may be better for interoperability and typography,
too (see description of commit 3e02ffb76c).

Follow-up to commit f8b9cd8fd1
"tdf#165354 sw xmloff: implement HyphenationKeepLine – part 2"
and commit 3e02ffb76c
"tdf#i165354 sw offapi DOCX: implement HyphenationKeepLine – part 1".

Change-Id: Ibc4f3b904bfe1a676195d166a334910c12760ddd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182446
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-03-04 08:49:54 +01:00
László Németh 434af9dea6 tdf#164905 tdf#164499 sw smart justify: fix overlapping text in ToC
Unnecessary calculation with the width of the glue portions resulted
bad ToC, i.e. text lines with tabulators got overlapping text.

Regression from commit 857dd6000c
"tdf#161810 sw smart justify: fix overhanging lines containing tabs".

Revert only the calculation, but not the unit test, which is still
correct, according to commit ed7fbfce0b
"tdf#164499 sw smart justify: disable in tabulated lines to fix ToC".

Change-Id: I3fe6d0d56ea8593ddee23d3c4063024762b65bab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182433
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-03-03 16:28:42 +01:00
László Németh f8b9cd8fd1 tdf#165354 sw xmloff: implement HyphenationKeepLine – part 2
Add loext:hyphenation-keep-line to the ODF export/import
to support HyphenationKeepLine, i.e. MS DOCX compatibility
option useWord2013TrackBottomHyphenation=false, where not
the full hyphenated line, but only the hyphenated word
is shifted to the next text block.

Add unit tests for hyphenation-keep-type="page" and "spread"
with hyphenation-keep-line="true" support.

Follow-up to commit 3e02ffb76c
"tdf#i165354 sw offapi DOCX: implement HyphenationKeepLine – part 1".

Fix unit test testTdf132599_spread, which loaded tdf132599_page.fodt
instead of tdf132599_spread.fodt (duplicating testTdf132599_page).

Restore unit test testTdf160518_auto_in_text_body_style, which was
removed by accident in commit 3e02ffb76c.

Silence the linguistic warning of HyphKeepLine, according to the
commit d25de4a046
"silence unknown property 'HyphNoLastWord'... etc warnings".

Change-Id: Ibb9643f8e20ee2a1456c4d62b901e4c66b57c341
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182424
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-03-03 14:27:40 +01:00
László Németh 33e54802ee tdf#164903 sw inline heading: fix DOCX layout by zeroing top margin
Skip top margin of the paragraph of the inline heading by
direct paragraph formatting to fix DOCX layout interoperability.

Regression from commit 56588663a0
"tdf#131728 sw inline heading: fix DOCX paragraph layout
interoperability".

Change-Id: I9fb485b08b4f3fd7506562e636151ccb6ee7b0a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182138
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-02-25 14:19:06 +01:00
László Németh e5e7e5c6d0 tdf#164878 sw inline heading: skip non-text content, i.e. formula
Formulae with style separator lost their centered position because
of the newly introduced Inline Heading frame around the object.
Limit Inline Heading frames only for paragraphs with text content.

Regression from commit 49765a9e7b
"tdf#48459 tdf#131728 sw inline heading: new frame style: fix DOCX export".

Change-Id: Ibabc0e045045f96dbbe8cfb31f9ce319189ee72a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182127
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-02-25 14:18:49 +01:00
László Németh 3e02ffb76c tdf#i165354 sw offapi DOCX: implement HyphenationKeepLine – part 1
ODF 1.0 feature hyphenation-keep, i.e. disabling hyphenation across
page etc. was implemented by shifting the full hyphenated line
(fixing also the DOCX layout interoperability, when value of the
useWord2013TrackBottomHyphenation MSO DOCX compatibility option is
true). To shift only the last word, add UNO paragraph property

com::sun::star::text::ParagraphHyphenationKeepLine

and the associated layout in Writer core, i.e. disabling
the hyphenation in the last line, instead of line shifting,
if the value of ParagraphHyphenationKeepLine is true.

Fix missing DOCX layout interoperability by mapping the unhandled
useWord2013TrackBottomHyphenation = false case to the new layout.

Note: shifting lines may be better for languages with long
words, but only with 1) typesetting with line-level (greedy)
line breaking instead of the desirable paragraph-level, 2) and
with missing optimized hyphenation at boundaries of compound word
constituents, and 3) forgotting the following: Shifting only words
or word constituents are better for 1) equal line count on pages
and spreads (very basic typographical requirement), 2) disabling
hyphenation really (shifting doesn't guarantee this, because
shifting is limited in a single line, but the previous line can be
hyphenated, too) and 3) more compact typesetting.
Both hyphenation-keep algorithms are important for interoperability,
but the new HyphenationKeepLine can create state-of-the-art automatic
typesetting with the planned improvements.

Follow-up to commit 9574a62add
"tdf#132599 cui offapi sw xmloff: implement hyphenate-keep".
and commit c8ee0e8f58
"tdf160518 DOCX: import hyphenation-keep to fix layout".

Change-Id: Iafa352ec91bbd5d1d227b8480337fa2b9acb5993
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181954
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-02-21 08:52:21 +01:00
László Németh ed7fbfce0b tdf#164499 sw smart justify: disable in tabulated lines to fix ToC
Calculated extra text content without shrinking resulted overhanging
text lines, e.g page numbers over the margin in ToC. Fix it
by skipping space shrinking completely in tabulated lines,
restoring also interoperability.

Regression since commit 53de98b295
"tdf#158333 sw smart justify: fix multiple text portions".

Change-Id: I390a254b8a47c6563d2c01a2f818f5ac6122e2ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181397
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-02-11 18:26:23 +01:00
László Németh d60ea6596f tdf#164932 sw inline heading: unit test for fixed text frame AutoSize
Follow-up to commit b4d41f6b0d
"tdf#164932 sw inline heading: fix frame AutoSize at list offset".

Change-Id: I62521d3672695b35d592b9671c052d091d403b04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181062
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-02-04 00:48:02 +01:00
László Németh b4d41f6b0d tdf#164932 sw inline heading: fix frame AutoSize at list offset
Calculation of AutoSize of text frames was incomplete,
resulting narrower frame width and e.g. two-line numbered inline
heading instead of a single one, if the left offset of the
numbering level in the attached list style was not zero.

This is a general fix for all text frames, not only for
text frames with Inline Heading frame style.

Regression from commit 56588663a0
"tdf#131728 sw inline heading: fix DOCX paragraph layout
interoperability".

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words",
commit d87cf67f8f
"tdf#131728 sw inline heading: fix missing/broken DOCX export",
commit a1dcbd1d1c
"tdf48459 sw inline heading: add Inline Heading frame style"

Change-Id: I4aea651d6982db61af0e423f25152b1401dc16c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181025
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-02-03 11:26:55 +01:00
László Németh f1bbce4068 tdf#164901 sw inline heading: fix lost floating tables
Style separators inside floating tables resulted losing of
the floating tables. In this case, don't handle style separators,
as before commit 56588663a0.

Regression since commit 56588663a0
"tdf#131728 sw inline heading: fix DOCX paragraph layout interoperability".

Change-Id: I30b6683b2312636405960efc65b5af2b6b4dbfa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180925
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-01-30 12:58:18 +01:00
László Németh a4af3948e9 tdf#163309 sw: clean-up bookmark boundary mark labels
Add white background to the labels for better visibility on
colored page/background.

Maximize the size of the label in 3 pt to support very
narrow fixed line spacing of headings.

Follow-up to commit 3393e52be0
"tdf#163309 sw: show rdf:type as labels on bookmark boundary marks".

Change-Id: I986b73892f2caca9ea0c97918db4c45577ada0eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180810
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-01-28 12:09:30 +01:00
László Németh c377f4f038 tdf#121119 master docs at-page anchor: clean-up renaming
Add file name only to the objects anchored at page, not
to all of them.

Follow-up to commit 2f135fa82c
"tdf#121119 master docs at-page anchor: fix missing images",
commit fb4197ed81
"tdf#121119 master docs at-page anchor: fix duplicated images"
and commit 47d596688f
"tdf#121119 master docs at-page anchor: fix runtime duplicated images".

Change-Id: If851818731e87225d53370978a92c02cfb5d7189
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180678
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-01-24 07:40:34 +01:00
László Németh 47d596688f tdf#121119 master docs at-page anchor: fix runtime duplicated images
Asking for "All" update of the master document resulted
duplicated objects anchored at page, loading the subdocuments
again, which contained the images originally.

Follow-up to commit 2f135fa82c
"tdf#121119 master docs at-page anchor: fix missing images"
and commit fb4197ed81
"tdf#121119 master docs at-page anchor: fix duplicated images".

Change-Id: I4c76c325963cd740906045653fc90055ce1840c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180628
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-01-23 17:30:57 +01:00
László Németh fb4197ed81 tdf#121119 master docs at-page anchor: fix duplicated images
Skip saving images anchored at page in the master document,
if they are imported from subdocuments to avoid their duplication
during the round-trip/update of the linked subdocuments.

Follow-up to commit 2f135fa82c
"tdf#121119 master docs at-page anchor: fix missing images".

Change-Id: I731026bee01576fe66c9d677b53c7f85a53230fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180627
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-01-23 17:29:39 +01:00
László Németh 2f135fa82c tdf#121119 master docs at-page anchor: fix missing images
Images and other objects anchored at pages weren't imported
from the subdocuments, resulting broken master document.

Subdocuments are imported as sections of the master document,
but their objects anchored at page need a document-level copy,
not a section one. To calculate the new document-level page
number of the copied object, store and sum the page count
meta data of the previous subdocuments, added to the subdocument-
level page number of the object.

Note: the recent solution doesn't calculate with the own text
content of the master document yet. As a workaround, to get
the original page number exactly, store everything in subdocuments
before the objects anchored at page.

The problem is inherited from OpenOffice.org, see ooo#19131.

Change-Id: I0be80bb27442565764142d2b23b0f56a3421c035
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180626
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-01-23 17:28:07 +01:00
László Németh bfb8f9cae7 tdf#48459 sw inline heading: don't apply inside frames or over 120 chars
Don't apply inline heading 1) in a text frame
2) or if the selected text is over 120 characters.

1) It would be enough to limit this for inline heading
frames, but the recent FN_INSERT_FRAME – which is used
for creating the Inline Heading frame, cannot handle the
insertion inside a frame: the new frame is anchored outside
of the frame, not inside the actual paragraph, resulting
bad layout.

2) Increase also the limit of applying the inline heading
to 120 characters (very upper limit for a long line) from 75.

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words",

Change-Id: I05de4be3a08926fdabad2e601d4bbe57ae25f7c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177739
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-12-03 21:13:54 +01:00
László Németh 20ee4ecfeb tdf#164074 sw inline heading: clean-up outline moving
Fix bad condition with ++std::npos in the following !WithChildren
inline heading branch:

else if( pOutlNdsInline && ++nEndPosInline < pOutlNdsInline->size() )

The problem was reported by Caolán McNamara.

Remove also an unused variable in docnum.cxx.

Follow-up to commit 32398232e9
"tdf#164074 sw inline heading: add up/down outline moving".

Change-Id: I61d75451adeb13fe8e74ce586c4668a8caf0105b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177580
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-11-30 18:37:33 +01:00
László Németh 32398232e9 tdf#164074 sw inline heading: add up/down outline moving
Move inline headings with their outline tree in
Navigator, clicking on the Move Heading Up/Down icons.

Instead of changing CompareSwOutlineNodes, which breaks
the code at other places, add a new SwOutlineNodesInline
and CompareSwOutlineNodesInline to sort inline headings
(put in Inline Heading frames) with normal headings only
for MoveOutlinePara and other part of Navigator's
outline moving.

Reordering chapters and sections using the Navigator was
limited for normal (root) headings, but not for headings
in text frames and tables.

Recent implementation of inline headings use text frames
with Inline Heading frame style, anchored as characters
to their paragraphs. Now these inline headings are movable
with the Navigator, with their outline tree, i.e. the paragraph
where the inline heading anchored as character, the following
paragraphs without inline heading, or the following subsections.

Note: selecting the inline headings is possible by the Navigator
content tree or or by clicking inside the text of the inline
heading in the document.

Note: according to the fix for tdf#143569, multiple headings
in the same text frame or table are ordered alphabetically in
the Navigator. This doesn't effect the inline headings, where
there is only a single heading in an Inline Heading text frame.

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words",
commit d87cf67f8f
"tdf#131728 sw inline heading: fix missing/broken DOCX export"
and commit a1dcbd1d1c
"tdf48459 sw inline heading: add Inline Heading frame style".

Change-Id: I7618aa1d4e1ddc20512d81c9a2babfa660053cbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177438
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-11-28 12:39:47 +01:00
László Németh bcee366d82 tdf#163873 sw inline heading: use HTML text, not lo-res bitmap export
Text frames formatted with Inline Heading style and anchored as
characters were converted to unacceptably low resolution images in
the HTML export. Now the HTML export contains normal h1–h6 elements
with display:inline; CSS setting to get text-based/searchable inline
headings, fixing also the rendering quality.

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words",
commit d87cf67f8f
"tdf#131728 sw inline heading: fix missing/broken DOCX export",
commit a1dcbd1d1c
"tdf48459 sw inline heading: add Inline Heading frame style"
and commit 984f0e49d3
"tdf#163874 sw inline heading: fix XHTML export".

Change-Id: I02f7af8a39314e78d670b4db9a76897e931b3a47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176512
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-11-13 13:07:52 +01:00
László Németh 984f0e49d3 tdf#163874 sw inline heading: fix XHTML export
Text frames anchored as characters, containing inline
headings were exported without display:inline using
the XSLT XHTML filter (see File->Export As), resulting
separated paragraphs for inline headings.

Note: both div and heading elements need display:inline.

This reverts commit d2e8705c9c
"tdf#153839: add newline after certain tags" partially
(and conditionally), because fancy printing is bad here:
the new line between the div element was converted to a space
at display:inline, resulting double space with the original
space between the inline heading and the other text content
of the following part of the paragraph line.

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words",
commit d87cf67f8f
"tdf#131728 sw inline heading: fix missing/broken DOCX export"
and commit a1dcbd1d1c
"tdf48459 sw inline heading: add Inline Heading frame style".

Change-Id: I6623066354a70a69faf14cd30fc2b917c9ec9c90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176511
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-11-13 10:41:34 +01:00
László Németh 4f871a5a9a tdf#48459 sw inline heading: fix bad NC of the new frame style
Which affected translation etc.

Introduced by commit a1dcbd1d1c
"tdf#48459 sw inline heading: add Inline Heading frame style".

Reported by Olivier Hallot with code pointer.

Change-Id: I7fc4cfa685be4374993754a303b4d54df7d1ee37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176210
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-11-13 10:39:54 +01:00
László Németh 42533c94ec tdf#163720 sw smart justify: fix hyphenated single portion lines
Hyphen length wasn't calculated in single portion lines at shrinking,
because the width of the overhanging line without the hyphen overwrote
the calculated correct line width. This resulted less shrinking, than
needed, also lost hyphen in the PDF export.

Regression from commit 22eac3145c
"tdf#162220 sw smart justify: fix shrinking for single portion lines".

Follow-up to commit 17eaebee27
"tdf#119908 sw smart justify: fix justification by shrinking".

Change-Id: I512e7f1f86f80ff6ea3d0b6a0b0db8255f5d0a60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176207
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-11-07 20:35:13 +01:00
László Németh 3056c75db5 tdf#95239 sw: fix wrong order of PDF ToC, if headings put in text frames
PDF outlines (called also as PDF bookmarks or ToC) contained headings in
the wrong order if they were placed in a text frame:

Heading 2 (frame) ... 2
Heading 3 (frame) ... 2
Heading 1 ........... 1

Now PDF export didn't list text frame headings only at the start of the
ToC, but in their correct position and hierarchy, based on the page
and vertical position of the headings:

Heading 1 ................ 1
  Heading 2 (frame) ...... 2
     Heading 3 (frame) ... 2

This is useful for the recently implemented inline headings, where
e.g. APA Style Heading 4 and Heading 5 are there in text frames
anchored as characters, see tdf#48459.

Extend PDFium test environment for bookmarks, and add tdf#131728 DOCX
and an APA Style .fodt unit tests.

Note: if the higher headings are only in text frames, but not the
lower ones, only the order corrected, but not the full hierarchy, yet.

This is a follow-up to commit d87cf67f8f
"tdf#131728 sw inline heading: fix missing/broken DOCX export",
commit a1dcbd1d1c
"tdf#48459 sw inline heading: add Inline Heading frame style" and
commit 49765a9e7b
"tdf#48459 tdf#131728 sw inline heading: new frame style: fix DOCX
export".

Change-Id: I87dffb9244d8aea553c98bf16c70955bb9b732d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176050
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-11-06 17:46:59 +01:00
László Németh 49765a9e7b tdf#48459 tdf#131728 sw inline heading: new frame style: fix DOCX export
Export Inline Heading frame style as OOXML style separator,
fixing interoperability of the newly created inline headings.

Remove frame grab-bagging, use the new Inline Heading
style for round-trip of DOCX documents. Note: paragraph
grab-bagging is used only for the case, where no frame
created for the inline heading (second or more inline
heading paragraphs in the same paragraph layout).

Now the DOCX import uses anchoring as character, fixing layout
problems of short paragraphs with big size headings anchored
*to character* previously.

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words",
commit d87cf67f8f
"tdf#131728 sw inline heading: fix missing/broken DOCX export"
and commit a1dcbd1d1c
"tdf48459 sw inline heading: add Inline Heading frame style".

Change-Id: Idc5f366c7a34f6e018683744475fc87aed0a3d14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175835
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-11-01 10:23:49 +01:00
László Németh a1dcbd1d1c tdf#48459 sw inline heading: add Inline Heading frame style
Add the new frame style Inline Heading with default variable
width and anchoring as character to support UX better
– and later, – interoperability.

Note: the previous commit (7a35f3dc74)
used the Formula style for inline headings.

Note: adjust check_styles.py unit test according to the extended
frame style list.

Follow-up to commit 7a35f3dc74
"tdf#48459 sw inline heading: apply it on the selected words".

Change-Id: I615a53803d755acfbabb77fe53b0e5b60fa9fcc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175834
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-11-01 08:50:54 +01:00
László Németh bb4da18c55 tdf#163699 sw: fix reported crash using the Navigator
"On a specific file, when double-clicking multiple times on
different images in the navigator panel, LO crashes."
reported by Vladimir Tarakanov with a code pointer.

Regression since 3e0650fb16
"tdf#157533 sw: fix cursor position deselecting formula in table".

Change-Id: I550d61d8ee10205ff2357c2511ae0062077d651e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175865
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-10-31 14:26:50 +01:00
László Németh 7a35f3dc74 tdf#48459 sw inline heading: apply it on the selected words
Selected text at the beginning of a paragraph (<= 75 characters)
become text frame based inline heading at applying a paragraph style
(using Formatting toolbar, context menu, Ctrl-1...Ctrl-5 or
Styles sidebar panel).

If the whole paragraph is selected, or if no or multiple
paragraphs are selected, formatting is still applied on the
whole paragraphs.

Using text frames for inline heading is ODF 1.0 compliant
and fully back-compatible with the older Writer versions.

The new inline heading frame contains direct formatting
to zero the upper and bottom paragraph margin to solve
interoperability issues: in MSO, margins of heading styles
are zeroed by using the style separators.

Note: lack of inline heading was a showstopper for creating
APA-, IEEE-, MIL-STD-961E-format, legal etc. documents.

Note: recent Formula frame style will be replaced by the
planned Inline Heading, which will be used by the DOCX filter
to export OOXML style separators instead of text frames.

Change-Id: I6722dcaef046bdbca2fe044d175806fa8c65278c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175580
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-10-26 17:35:09 +02:00
László Németh d87cf67f8f tdf#131728 sw inline heading: fix missing/broken DOCX export
Fix layout interoperability during DOCX round-trip by grab-
bagging w:p/w:pPr/w:rPr/w:specVanish, i.e. the style separators.

Note: use FrameInteropGrabBag to select the text frames, which
are inline headings, exporting only their text content (a single
paragraph), and use also ParaInteropGrabBag to export w:specVanish.

Note: specVanish lost completely originally, converting inline
headings to normal paragraphs.
After commit 56588663a0,
text frames (the workaround for inline heading/ToC/bookmark
support) were exported instead of plain paragraphs, which were
broken at least in LibreOffice.

Follow-up to commit 56588663a0
"tdf#131728 sw inline heading: fix DOCX paragraph layout
interoperability".

Change-Id: Ic61617f9c9652c9364f8262914c66dec093d6910
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175372
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-10-23 18:26:07 +02:00
László Németh 270c96e12c tdf#163575 sw smart justify: fix size resolution for SwBidiPortion
Negative space sizes (i.e. shrunk lines at image wrapping) stored
over LONG_MAX/2, and these values had no resolution in SwBidiPortion,
causing crash/assert in conversion of DOCX document containing e.g.
Arabic text wrapping around images.

Note: apply the resolution in SwDoubleLinePortion, too.

Regression since commit 1fb6de0270
"tdf#163149 sw smart justify: fix line shrinking at image wrapping".

Change-Id: I6e45592c4eed247871d35e1f02fd5a038baddf85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175419
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-10-22 23:11:28 +02:00
László Németh 1fb6de0270 tdf#163149 sw smart justify: fix line shrinking at image wrapping
Limited line width at image wrap could result negative nSpaceAdd
value, i.e. paragraph line with extra letter spacing instead of
line shrinking.

Regression from commit 17eaebee27
"tdf#119908 sw smart justify: fix justification by shrinking".

Change-Id: I76cc3004d246ff7af441ca9a92eaa8fc7b09f01b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174985
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-10-16 11:29:32 +02:00
László Németh 3393e52be0 tdf#163309 sw: show rdf:type as labels on bookmark boundary marks
OOo's RDF handling had limited support to optional metadata visualization, like custom prefix/suffix of metadata fields.
This is a similar visualization for bookmark rdf:type metadata,
but without changing the text layout by enabling/disabling
View->Field Shading.

The labels, i.e. text content of rdf:type have left-aligned
top position after the opening bracket of the optional bookmark
boundary mark, and right-aligned bottom position before the
closing bracket. The labels don't overlap at multiple brackets.

Note: the labels are very next to the line text vertically
to support fixed line height better.

Follow-up to commit 412e0ab266
"tdf#150717 sw RDF metadata: add custom color bookmark boundary marks"

Change-Id: I0756c91b51c706f4c7b70fa07f1c7e8fbbf0dc90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174486
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-10-05 16:20:57 +02:00
László Németh 7a78be5090 tdf#163060 sw smart justify: fix unwanted line break inside words
End-of-line narrow line portion was broken into the
following line, despite that it was inside a word,
if the remaining free space for the line portion
was negative in the line (GetLineWidth()), because
of missing calculation with the extra available
line width resulted by space shrinking.

Regression from commit 53de98b295
"tdf#158333 sw smart justify: fix multiple text portions".

Change-Id: I802b8469c82250be7ac6f3a73a4dc457deb72a19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173961
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-09-26 09:02:28 +02:00
László Németh 2baaf66b71 tdf#163042 sw smart justify: fix cursor of single portion lines
Fixed problems with cursor/pilcrow positions in a shrunk last
line of a paragraph with a single portion:

– clicking before the last or the last but one characters of the line,
  the cursor could be positioned at the end of the line, not before
  the last or the last but one characters (especially a line with
  more spaces and bigger space shrinking).

– when the text cursor was there at the end, the visible cursor position
  was inside the line instead of the end of the line;

– pilcrow symbol was inside the line instead of the end of the line.

Follow-up to commit 6b857398a5
"tdf#162109 sw smart justify: fix overhanging last line"
and commit 22eac3145c
"tdf#162220 sw smart justify: fix shrinking for single portion lines".

Change-Id: I0057f17fe187381c4c5d78574dcd99e0dafc11b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173662
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-09-19 20:17:23 +02:00
László Németh 857dd6000c tdf#161810 sw smart justify: fix overhanging lines containing tabs
Length of tabulator portions wasn't taken into account
during calculating overhanging lines, resulting missing
space shrinking.

Regression from commit 17eaebee27
"tdf#119908 sw smart justify: fix justification by shrinking".

Change-Id: I34bb007940b91e861b24413e76c910ee62aed158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173451
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-09-17 09:18:57 +02:00
László Németh 56588663a0 tdf#131728 sw inline heading: fix DOCX paragraph layout interoperability
Fix layout of paragraph – which contains two paragraph styles –
by importing OOXML style separator using a text frame.

Inline headings – where there is no paragraph break after
the heading, i.e. it's followed by the normal paragraph content –
specified by w:specVanish in OOXML, i.e. a special paragraph with
hidden paragraph mark. These headings were loaded as normal, separated
paragraphs, breaking the paragraph layout with their paragraph breaks.
Map inline headings to inline ODF text frames to keep paragraph layout.
The frame contains the original inline paragraph, still keeping
ODF ToC and PDF bookmark support.

Change-Id: I370245218b860c737e45dc15c6f29d79819c9783
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173326
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-09-15 12:56:56 +02:00
László Németh bcadc9a6ec tdf#162725 sw smart justify: fix last line with multiple portions
Fix last lines of paragraphs, which contains multiple portions,
and exceeded the width of the paragraph because of missing space
shrinking.

Follow-up to commit 6b857398a5
"tdf#162109 sw smart justify: fix overhanging last line" and
commit 22eac3145c
"tdf#162220 sw smart justify: fix shrinking for single portion lines".

This reverts (and improves) the code removed in tdf#162220 (commit
22eac3145c), because that code
still needs for lines with multiple portions.

Change-Id: Id87d87defc79742513ceb0f90b83e6d4f0e4b271
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172692
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-09-02 23:33:13 +02:00
László Németh 1a87cd2902 tdf#162109 tdf#162220 sw smart justify: add unit tests
Follow-up to commit 6b857398a5
"tdf#162109 sw smart justify: fix overhanging last line"
and commit 22eac3145c
"tdf#162220 sw smart justify: fix shrinking for single portion lines".

Change-Id: I046bc3c5f45659442b288952ed1cd5b5cb6c16e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172689
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-08-31 16:20:05 +02:00
László Németh 22eac3145c tdf#162220 sw smart justify: fix shrinking for single portion lines
Follow-up to commit 6b857398a5
"tdf#162109 sw smart justify: fix overhanging last line".

Regression from commit 17eaebee27
"tdf#119908 sw smart justify: fix justification by shrinking".

Change-Id: I6e2dbdbf3628bdae765c235d5f29c1aa0b8987ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172599
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-08-30 00:59:37 +02:00