summaryrefslogtreecommitdiff
path: root/sw/qa/extras/layout
AgeCommit message (Collapse)Author
2 hourstdf#159029 sw: layout: fix cell vertical orientation after splitMichael Stahl
The vertical alignment of cells is implemented in SwCellFrame::Format(), but it is disabled if IsRebuildLastLine() is true (apparently since the time when splitting table rows was first implemented in commit 90b73c7b667b06d42f5e37196d25a85b6c787f33 "INTEGRATION: CWS cellbreak") which is in 2 different cases: 1. when another line fits on the page, around a call to lcl_RecalcRow(pLastLine) after RemoveFollowFlowLine() - this is the relevant case when the paragraph is deleted This case used to work by accident before commit 068c133ac41c97652909b88c432e3b73010efc3e, when after RemoveFollowFlowLine() of row 406 the text frame moved to the top, then a Split of the row after the one containing the last part of the merged cell with the problem was attempted and failed, and in lcl_RecalcRow() after the Split the alignment was fixed; this commit changed it so that the first row frame 6 had an invalid position, which caused an earlier correction of the position of all the cells and text frames during the lcl_RecalcRow() after joining the follow, where m_bIsRebuildLastLine was set. 2. after a successful Split() with bTryToSplit=true, i.e., a row was split - this is the relevant case on Undo of the paragraph delete This actually was a problem already before the above mentioned commit, but then it could be "fixed" by clicking on the cell, which stopped to work. Here there is no RemoveFollowFlowLine() at the start, but then again a failed attempt to Split a row followed by a successful Split between rows; before the 2nd Split the text frame is correctly positioned and valid, but then lcl_RecalcSplitLine() calling lcl_ShrinkCellsAndAllContent() moves the text frame up. In both cases, explicitly invalidate the PrtArea of cells in the last row where a vertical orientation is set. (regression from commit 068c133ac41c97652909b88c432e3b73010efc3e) Change-Id: I7d2e85bb76a4b77c7871d759abbebd6abeb31282 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181113 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
17 hourstdf#164932 sw inline heading: unit test for fixed text frame AutoSizeLászló Németh
Follow-up to commit b4d41f6b0deb0299cd01173c150c5b94568c9a21 "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>
6 dayssw: layout: fix loop with table at the end of a sectionMichael Stahl
There is a table alone in a section, and there are 2 rows in the table, with the 2nd row split across page 1 and page 2. Due to space for another line of text being available, the table frame first does RemoveFollowFlowLine() etc and grows much higher than the section frame upper. Then in SwTabFrame::Join(), the section frame on page 2 is destroyed via SwSectionFrame::DelEmpty() so the section frame on page 1 doesn't have a follow. Then a SwTabFrame::Split() happens, and lcl_ShrinkCellsAndAllContent() ends up shrinking the section frame to 0 height (because there is no follow currently seen by SwSectionFrame::ToMaximize()), which is wrong as there is a 1st row in the table, so the table is still height 3712. If the table is directly in the body, then this works because the body frame doesn't shrink or grow. Then when the text frame in the 2nd row is formatted, it can't grow because SetRestrictTableGrowth(true) was called as a follow flow line exists, and in SwTabFrame::GrowFrame() nReal is -2777 due to the SwTabFrame being higher than the upper; the result is that the text frame is the same height/split at the same line as before SwTabFrame::MakeAll(). Then the whole thing happens again until eventually warn:sw.layout:875613:875613:sw/source/core/layout/layouter.cxx:194: Looping Louie: Stage 1! Try to detect situation of too high table in section and propagate Shrink only until the section is the same height as the table. Change-Id: If4b6db8b03d93a3227ad223203f2b0c3f73d3cc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180857 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
8 daystdf#164803 sw: Revert use ext leading for grid spacing on DOC importJonathan Clark
Removes an incorrect fix for tdf#129808, which was introducing unintended document layout issues. This reverts commit 43fc662520e5488cbeadd6eb60a24374a837dca4 Author: Jonathan Clark <jonathan@libreoffice.org> Date: Thu Jan 23 09:04:10 2025 -0700 tdf#164803 sw: Fix SwTextSizeInfo applying grid metrics without grid and commit 2155684c819dcdc52968c59276046fb0cad83561 Author: Jonathan Clark <jonathan@libreoffice.org> Date: Thu Sep 19 22:05:08 2024 -0600 tdf#129808 sw: Use ext leading for text grid spacing on DOC import Change-Id: I356dc045aaf0b60a3b7fcd6e43fd98ccccc25ec6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180796 Reviewed-by: Jonathan Clark <jonathan@libreoffice.org> Tested-by: Jenkins
11 dayssw: layout: fix bad split table resulting in empty cellMichael Stahl
The problem is that the table goes into an infinite loop of splitting and joining, because there is a temporarily negative PrtArea height in the top row's cells (-170), because of setting all heights to 0. This causes an inconsistency where it is first joined because in ShouldBwdMoved() another line of text in the right column cell can move backward, but then there isn't enough space for another row as the negative cell PrtArea height is added to the available space and so the line won't fit in SwTextFrameBreak::IsInside(); the same situation occurs until a "Looping Louie" aborts the iteration with a bad result. This is somehow caused by the hidden section following the table, but not sure how exactly (the "if (pNxt->IsHiddenNow()) bCalcNxt = false" suspect code was actually added in a later commit). Prevent it by preventing negative PrtArea heights. (regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1) Change-Id: I36ce8a8bf750cf407cece5ad3cc23374182179de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180719 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
12 daystdf#164803 sw: Fix SwTextSizeInfo applying grid metrics without gridJonathan Clark
Writer has two grid attributes: the document-level grid item, which controls whether the grid is enabled; and a paragraph-level grid item, which controls whether the document grid applies to the paragraph. Previously, SwTextSizeInfo populated its snap-to-grid flag based only on the paragraph-level attribute. Downstream code was expected to double-check that the grid is actually enabled using the document-level item. As shown by tdf#164803, this is error-prone. Now, SwTextSizeInfo only sets the snap-to-grid flag when the grid is enabled by both attributes. Change-Id: I6528f653748de942f42da11e34ff340cb3db37e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180676 Reviewed-by: Jonathan Clark <jonathan@libreoffice.org> Tested-by: Jenkins
2024-12-11crashtesting: fix assert while parsing tdf94588-1.odtJonathan Clark
Some ODF parsing code uses relative indices into XMLPropertyMapEntry arrays to enumerate related attributes. This change moves some recently-added paragraph property entries to the end of the respective array, fixing an assertion caused by accessing unexpected attributes via these hard-coded relative indices. Problem since: commit 7e4f4a0ccd3c56093dec44c7dcdd14c8b34623c3 tdf#163913 Implement font-relative margins Change-Id: Ia2671372f0152e4efb98bd25b390638e4458a1b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178318 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-12-06tdf#159549 sw: fix ODF import of newly colliding Body Text stylesMichael Stahl
Commit c83d241effbd09491e9f96d3e435ab91700f58b0 "tdf#154933 Rename "Text Body" para style to "Body Text"" introduced a regression when importing certain ODF documents, but the problem is actually pre-existing. What happens is that first the built-in "Text body" style is created, and then a non-built-in style with the same translated name as "Text body" is imported, and instead of creating a new style, the built-in one is found and used, and so its properties are overwritten. The root cause is that SwStyleNameMapper::FillProgName() and in particular SwStyleNameMapper::FillUIName() are defined poorly, ever since they were introduced in 2001 in commit 4fbc9dd48b7cebb304010e7337b1bbc3936c7923 It becomes obvious relatively quickly that the way style names work is that at the UNO API level, the "ProgName" (internal, non-localised) names are used, and at the core document level, the "UIName" (localised) names are used. This is in itself questionable - why is the translation from ProgName to UIName not done in the UI? - but also very expensive to change now. So then the UNO services are responsible for translating between ProgName and UIName. But the 2 functions don't do that properly; both need to check if the given name is a known ProgName *or* a known UIName, and rename it in case it collides with a known target name; also the 2 functions need to cancel each other out, not add " (user)" at the end in both directions. Fixing this causes numerous tests to fail, due to: 1. the UNO services calling themselves with already converted style names, which are then translated a second time, which fails now. (or calling the wrong function like SwXStyleFamily::getByIndex()) 2. many tests call the UNO API with UINames instead of ProgNames 3. somehow the writerfilter import is also changed, causing failures in e.g. testTdf113182 and testTdf104492 4. buggy code elsewhere (lcl_getUsedPageStyles()), problem similar to 1., for PageDescs 5. potentially more buggy code yet to be discovered (definitely table styles, forgot which test that was) So limit this fix for now to only paragraph styles, and don't do it in writerfilter import, now at least sw.check passes. Change-Id: I5cbdf3e174622e83f9af8787c3671b88c0e37bac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177858 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Jenkins
2024-12-02tdf#164098 sw: Fix word overflow kashida justification crashJonathan Clark
This change fixes an infinite recursion crash while updating kashida insertion positions. This crash could occur if a word is too long to fit on a page and is broken onto another line, with the best-fit valid kashida insertion position on the previous line, and the following line also containing valid kashida insertion positions. Change-Id: Ifc3320765f35ccdc49bbf179446bc03654e2596d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177709 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-12-02unotest,sw: introduce queryDispatchStatus()Michael Stahl
... and reset the view options that are toggled in testHiddenParagraphFollowFrame and testHiddenParagraphFlys. Backporting these tests to the libreoffice-24-8 branch broke 2 unrelated tests because of the changed view settings: Test name: (anonymous namespace)::testHiddenSectionPageDescs::TestBody equality assertion failed - Expected: 532 - Actual : 798 - In <>, attribute 'height' of '/root/page[2]/body/section[1]/infos/bounds' incorrect value. xmltesttools.cxx:203:Assertion Test name: (anonymous namespace)::testTable0HeightRows::TestBody equality assertion failed - Expected: 28 - Actual : 22 - In <>, XPath '/root/page[1]/body/tab/row' number of nodes is incorrect Change-Id: Ie58242348fecabe163e54048f3896c6d427d2608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177691 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-11-29sw: layout: fix toggling Hidden Paragraphs not shrinking flysMichael Stahl
There are 2 as-char flys with 2 hidden paragraphs each, and when turning off show hidden paragraphs, the paragraphs shrink to height 0 but the flys don't - this is because due to other hidden paragraphs earlier, the position of the flys change and Shrink() is called before MakePos() and then it uses the old position to check and that results in a negative nRstHeight, so the upper doesn't actually shrink. Fix this by always calling MakePos() before MakeValidZeroHeight(). (presumably regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 or one of its follow-ups) Change-Id: I9a4ffadff02b6a2bc59c6a37aa15abec429e1068 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177524 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2024-11-29sw: layout: fix toggling Hidden Paragraphs that have followsMichael Stahl
When a hidden paragraph is split across pages, there is nothing that joins its follow (SwContentFrame::MakePrtArea() has code to do it but it wasn't called even before the previous commit?) and when the follow is formatted is doesn't move back. So just join all follows asap in SwContentFrame::MakeAll(). (presumably regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 or one of its follow-ups) Change-Id: Icecdf17c1c1e11a3b62c7e5bf2c6624f234c94f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177500 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2024-11-28tdf#163913 Implement font-relative marginsJonathan Clark
This change adds loext:margin-left and loext:margin-right, which implement margins that support font-relative units. See tdf#36709 for additional details. Change-Id: I31b0dd2b6f98cb5b02fd4dca3608db6fdee4054c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177473 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-11-25tdf#152839 remove paragraph spacing attributes in fill cellsOliver Specht
Invisible cells in Word are added to Writer tables to get regular tables. Borders of such cells are allready switched off. Now also paragraph spacing is removed to not determine the row height. Change-Id: I27d3d033de54f051527cf29e2655e7a564d1a5ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176219 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Jenkins
2024-11-21sw: layout: fix unhiding section containing multiple page breaksMichael Stahl
With multiple page breaks in a hidden section, the following frames were only moved on the first break, and with the second break the frames go out of order in SwSectionFrame::SwClientNotify(). Also handle multiple columns there. (regression from commit a97e245ba11598050e1800fde9ace796d20e9df2) Change-Id: I4120e72bf083f3bed75f9305fbd757efd55f0b3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176773 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-11-18CppunitTest_sw_layoutwriter2: split in twoXisco Fauli
It already had 109 tests Change-Id: I52e7416091bb3ffa80c39a1409dc283771f7d9ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176710 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-11-12loplugin:reftotemp in swNoel Grandin
Change-Id: I370d18643b0c83c60846a0b6f051440a043c647a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-07tdf#163720 sw smart justify: fix hyphenated single portion linesLászló Németh
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 22eac3145ca62d15b47d95f4df60ce38d4f5aa46 "tdf#162220 sw smart justify: fix shrinking for single portion lines". Follow-up to commit 17eaebee279772b6062ae3448012133897fc71bb "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-06tdf#162268 sw: formatting: paragraph style also applies to para markerMichael Stahl
... so check it in SwTextFrame::IsHiddenNow(). During RTF import, the \v produces a RTFSprm that may be deleted before inserting by cloneAndDeduplicate() because the style already has the same value; this happens in one paragraph in the table in the footer of the bugdoc and that's why that row is visible. (regression from commit 7b8cec8322b60673e686660caf875bc71117bbd0) Change-Id: I064ecdc04c26afab7ef2196ac4da338b9d0bb1f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176093 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-11-06tdf#162268 sw: layout: hidden formatting is ignored on cell end markerMichael Stahl
... in Word, so ignore it in Writer on the last paragraph in a cell. (regression from commit 7b8cec8322b60673e686660caf875bc71117bbd0) Word also uses hidden character formatting on the row end marker to determine if a row should be hidden; this isn't possible yet. Change-Id: I7ceaea0d807193155631083616a93cdd058e20d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176060 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2024-10-31convert KernArray from sal_Int32 to doubleNoel Grandin
which allows us to eliminate a bunch of rounding at various layers, and consequently maintain a lot more precision Change-Id: I911dedd7c041c1d67396c082e5695346ea689acb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175814 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-10-29UnoApiTest: check mxComponent right after loadingXisco Fauli
Change-Id: Ia834d19a5af999440f7d5847aeeae863daacd952 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175784 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-10-29UnoApiTest: rename load to loadFromURL and use it everywhereXisco Fauli
Change-Id: Ie67eebec74f783fa0c29acfb23bb83bc582812b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175724 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-10-25sw/qa: simplify a bitXisco Fauli
Change-Id: I5d75561f06ce4f981927afb333af5a99bd7ffe26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175645 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-10-25SwModelTestBase: assert SwDoc inside getSwDoc()Xisco Fauli
Change-Id: Icf70904a963b099db6c8be0384cbed92b93a28eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175581 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-25sw/qa: use getSwDocShell() when possibleXisco Fauli
Change-Id: Ia2e3dad4e62fb084c3a88564deb137cbcc7728b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175573 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-25-Werror,-Wunused-variableStephan Bergmann
...after 64e8d5d8b9a56f31caff66675180342773f847a0 "sw/qa: use getSwDoc() more" Change-Id: Ib13fe63cac26ff083da5d8c104921c510fa5bb7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175579 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-24sw/qa: use getSwDoc() moreXisco Fauli
Change-Id: I742309d99c4d9839dcd4f8b747fc9aef549998ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175555 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-17CppunitTest_sw_layoutwriter3: split in twoXisco Fauli
it already has 133 tests Change-Id: Idb67ab8af7ead44db1330a0437cc099c39b65cd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175073 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-10-16tdf#163149 sw smart justify: fix line shrinking at image wrappingLászló Németh
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 17eaebee279772b6062ae3448012133897fc71bb "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-05tdf#163285: consider page body frame height to allow the splitMike Kaganski
This improves on commit b271cc46851c61ddef20dc869bf339c857f76b18 (tdf#123116 sw layout: allow rows larger than page to split anyway, 2020-03-12). Change-Id: I9327a18146d795c65528b0f16cefc81721266046 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174534 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-05Use good old string literals in assertXPath and friendsMike Kaganski
These are only sent to an external API expecting char*-like strings, or for comparison. Having every assertXPath having three of _[ou]str is too much syntactic noise, making the unit tests almost unreadable. Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2024-10-01tdf#163230: make loop control hack more specificMike Kaganski
Commit 0c49aa58cfbb81073e34b1d47861a5a1fdd44114 (tdf#161508: add another loop control hack, 2024-06-11) only checked the frame area sizes and positions, but ignores the "valid" frags. It turns out, that these flags also needed when checking the loop condition. Change-Id: If155f2424b9a02cad6bf6d5c931dfccfb110d4c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174310 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-01sw: fix hyphenation dependencies of CppunitTestsMichael Stahl
testTdf123898 fails locally but passes on Jenkins, because in Jenkins builds the hyphenation data doesn't exist yet (as verified by a CPPUNIT_ASSERT(xHyphenator->hasLocale(lang::Locale("de", "DE", OUString()))) in first revision of this patch. Add makefile dependencies to all sw tests that call hasLocale(). The test still needs to check though in case --without-myspell-dicts is used. Failure looks ignorable, adapt the test: Test name: (anonymous namespace)::testTdf123898::TestBody equality assertion failed - Expected: PortionType::Para - Actual : PortionType::Text Change-Id: Iaa94e248b01f7bab7f8451f6b0ff08a7d0a8e9b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168669 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-27tdf#162268 sw: IgnoreHiddenCharsForLineCalculationMichael Stahl
The other problem here is that if hidden text isn't displayed, SwLineLayout::CalcLine() doesn't ignore the hidden text portion when calculating the line height. This is apparently the case all the way back to OOo 3.3, but it doesn't make much sense, so change the default to ignore hidden text here, except if a pre-existing ODF document is imported. Change-Id: Ief3f62bbdb6ac0ac79b54d6885a711128ad8d81f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174041 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-27tdf#162268 sw: ApplyParagraphMarkFormatToEmptyLineAtEndOfParagraphMichael Stahl
Commit 2b47fae7e3e23ee7c733708500cb0482ad7f8af1 introduced the compatibility setting ApplyTextAttrToEmptyLineAtEndOfParagraph, but that was probably a mistake. What Word is doing there is not applying a text attribute but applying the formatting of the paragraph marker; add a new compatibility setting ApplyParagraphMarkFormatToEmptyLineAtEndOfParagraph to do this. Change SwAttrIter to apply the RES_PARATR_LIST_AUTOFMT formatting when the position behind the last character is reached, and use it to set the height of the last line in SwLineLayout::CalcLine() in case it is empty or contains only spaces/tabs. Frustratingly this requires another change to fdo74110.docx to get rid of some odd font that's applied to the paragraph marker. Also, change SwTextFrame::IsHiddenNow() to take into account paragraph marker formatting; if all characters are hidden but the paragraph marker isn't hidden, the paragraph is still displayed in Word. Change-Id: Icccd3e822ad0301ccbe373b50431c3254f691d6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173880 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-26tdf#163060 sw smart justify: fix unwanted line break inside wordsLászló Németh
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 53de98b29548ded88e0a44c80256fc5e340d551e "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-20i#94666 sw: layout: fix problem with WIDOW_MAGIC in sectionsMichael Stahl
This was already fixed in CWS sw301bf03 with commit 5559afee02fc2be18cded35a17a03aa8191b08f5 but then broken again, perhaps by commit f2e3655255db4032738849cd4b77ce67a6e2c984 "Avoid -fsanitize=signed-integer-overflow", which changed a magic constant, effectively disabling the fix. The problem (in a different document than attached at the bug) is that the first text frame 128 in a section frame 258 gets its height set to WIDOW_MAGIC in CalcPreps(), which grows the section frame to the maximum allowed by its upper, and then when the real size of the text frame is set it shrinks the section frame to be far too small, so the last text frames and the whole table remain formatted at a position on the page but are not painted because the paint is cut off at the (wrong) bottom of the section frame. (On master, the problem with the internal document cannot be reproduced due to some other change which causes the text frame at the cut-off position to have mbFramePrintAreaValid=false which causes it to MoveFwd and that calls SwSectionFrame::SimpleFormat() which fixes the height, but that all looks accidental.) Change-Id: If13d993a0cab5701f45223a70b2c5c8b0690ebeb (cherry picked from commit d77d3af9e4983edd7cd1cac5faecd8253db1a6ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173672 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2024-09-20tdf#152298: Handle "keep with next, allow split, span some rows" caseMike Kaganski
All the rows on the table in bugdoc require to be kept with next (their first cells' first paragraphs have that flag). The layout finds the table break position after row 39; but then it checks that that row should be kept with row 38, that with row 37, and so on. The layout loop happens because the search for the break position can't find a row. But cell A38 spans over four rows; in this case, Word checks if this row can split, and splits the spanning cells, apparently as keeping "part" of the row with next. This change implements that algorithm. Change-Id: I234694138ac6b660781ad773cef20151daf874eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173675 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2024-09-19tdf#163042 sw smart justify: fix cursor of single portion linesLászló Németh
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 6b857398a59d16308d6185d01e003e401439f060 "tdf#162109 sw smart justify: fix overhanging last line" and commit 22eac3145ca62d15b47d95f4df60ce38d4f5aa46 "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-17tdf#161810 sw smart justify: fix overhanging lines containing tabsLászló Németh
Length of tabulator portions wasn't taken into account during calculating overhanging lines, resulting missing space shrinking. Regression from commit 17eaebee279772b6062ae3448012133897fc71bb "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-12Temporarily skip unit tests on native arm64 buildBalazs Varga
which indicating unit test fails. Change-Id: I2689b0dda888e15e52ca60cc18e1705a1aefe968 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173143 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Tested-by: Jenkins
2024-09-06tdf#152142 sw: fix RTL as-char textbox compat flag special caseJonathan Clark
Fixes an issue causing incorrect textbox positions when the containing shape is anchored 'as character' inside RTL text, with the DoNotMirrorRtlDrawObjs compatibility flag set. Change-Id: I58cade8b91925dda188a1ef8fd078ccfdc3fea56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172938 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-09-05sw: fix hiding of flys in hidden sectionsMichael Stahl
There are 2 different ways to hide flys, either destroy the SwFlyFrames (as is done for delete redlines or fieldmarks) or move them to an invisible layer (as is done for field-hidden paragraphs). Previously for hidden sections the FlyFrames would be destroyed, but it's easier now to move them to invisible layer. HideAndShowObjects() needs to be recursive so it can hide flys that are anchored in a table. (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f) Change-Id: Ideab0343315e575c066eb9e2e901d2ee0acabe3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172865 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
2024-09-03sw: fix problem with 0-height text frames after unhiding sectionMichael Stahl
Not sure how this happens, apparently only in some specific circumstance, but the problem is that the SwTextFrame::Format() does nothing because !aAccess.GetPara()->GetReformat().Len(). Also adapt the loop in SwSectionFrame::SwClientNotify() to columns. (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f) Change-Id: Iba0b1657f915530ab9841823ad5ad1e7faa15e8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172776 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-02tdf#162725 sw smart justify: fix last line with multiple portionsLászló Németh
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 6b857398a59d16308d6185d01e003e401439f060 "tdf#162109 sw smart justify: fix overhanging last line" and commit 22eac3145ca62d15b47d95f4df60ce38d4f5aa46 "tdf#162220 sw smart justify: fix shrinking for single portion lines". This reverts (and improves) the code removed in tdf#162220 (commit 22eac3145ca62d15b47d95f4df60ce38d4f5aa46), 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-02sw: view settings for testHiddenSectionPageDescsMichael Stahl
Should be more reliable. Change-Id: If04f1e246112b1a133773263b2b07ac3870d1676 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172656 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-02tdf#152919: Add comment about unittestXisco Fauli
Covered by unittest added in a97e245ba11598050e1800fde9ace796d20e9df2 "sw: layout: fix page breaks when unhiding a hidden section" See https://gerrit.libreoffice.org/c/core/+/172663/comments/86259634_a0fdbeff Change-Id: Ib1913c04c6a487c2009228d66788c8d065e3405f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172734 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-08-31tdf#162109 tdf#162220 sw smart justify: add unit testsLászló Németh
Follow-up to commit 6b857398a59d16308d6185d01e003e401439f060 "tdf#162109 sw smart justify: fix overhanging last line" and commit 22eac3145ca62d15b47d95f4df60ce38d4f5aa46 "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-30tdf#155229 Calculate row height incl. border if 'atLeast' is setOliver Specht
Word includes the width of horizontal borders when calculating row height in case the row height is set as "atLeast" This is now handled via a compat flag for doc/rtf/docx formats. The default for ODF is unspecified, which (sanely) continues to treat the row size of "atLeast" and "fixed" as measuring the same thing. Change-Id: I37778e5cdc6e083e94a17f50bd0b75a291ededcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169611 Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>