core.git: sw/qa sw/source

2024-04-28 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   50 
 sw/source/uibase/docvw/edtwin.cxx   |   12 +++-
 2 files changed, 60 insertions(+), 2 deletions(-)

New commits:
commit 30de13743f144aced83bc43d310592f82788c910
Author: László Németh 
AuthorDate: Fri Apr 26 22:03:53 2024 +0200
Commit: László Németh 
CommitDate: Mon Apr 29 00:16:31 2024 +0200

tdf#160836 sw: resize rows at images cropped by row height

Fixed row height can crop cell content, including images
anchored as character. Resizing the row height with mouse
was not possible there, because selection of the cropped
image avoided to drag & drop the horizontal cell border.

Change-Id: I6dde79e77563468059794548b6c058cad61586a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166795
Reviewed-by: László Németh 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index e6cff1c8ae9a..ce525954ace9 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1504,6 +1504,56 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842)
 CPPUNIT_ASSERT(pWrtShell->IsCursorInTable());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// set table row height by drag & drop at images cropped by the fixed row 
height
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pPageFly = dynamic_cast(rPageObjs[0]);
+CPPUNIT_ASSERT(pPageFly);
+auto pTable = dynamic_cast(pPageFly->GetLower());
+CPPUNIT_ASSERT(pTable);
+auto pRow1 = pTable->GetLower();
+CPPUNIT_ASSERT(pRow1->IsRowFrame());
+auto pCellA1 = pRow1->GetLower();
+CPPUNIT_ASSERT(pCellA1);
+const SwRect& rCellA1Rect = pCellA1->getFrameArea();
+auto nRowHeight = rCellA1Rect.Height();
+// select center of the bottom border of the first table cell
+Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, 
rCellA1Rect.Top() + nRowHeight);
+// halve the row height
+Point ptTo(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() 
+ 0.5 * nRowHeight);
+vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin();
+Point aFrom = rEditWin.LogicToPixel(ptFrom);
+MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK | 
MouseEventModifiers::SELECT,
+   MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent);
+Point aTo = rEditWin.LogicToPixel(ptTo);
+MouseEvent aMoveEvent(aTo, 1, MouseEventModifiers::SIMPLECLICK | 
MouseEventModifiers::SELECT,
+  MOUSE_LEFT);
+TrackingEvent aTEvt(aMoveEvent, TrackingEventFlags::Repeat);
+// drag & drop of cell border inside the document (and outside the table)
+// still based on the ruler code, use that to simulate dragging
+pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt);
+TrackingEvent aTEvt2(aMoveEvent, TrackingEventFlags::End);
+pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt2);
+Scheduler::ProcessEventsToIdle();
+rEditWin.CaptureMouse();
+rEditWin.ReleaseMouse();
+
+// this was 3910 (not modified row height previously)
+CPPUNIT_ASSERT_EQUAL(tools::Long(1980), pCellA1->getFrameArea().Height());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132)
 {
 createSwDoc();
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 6bd10d4d580f..c0d4a0837f17 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3154,9 +3154,13 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 SwTab nMouseTabCol = SwTab::COL_NONE;
 const bool bTmp = !rSh.IsDrawCreate() && !m_pApplyTempl && 
!rSh.IsInSelect()
   && aMEvt.GetClicks() == 1 && MOUSE_LEFT == 
aMEvt.GetButtons();
+
 if (  bTmp &&
  SwTab::COL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) 
&&
- !rSh.IsObjSelectable( aDocPos ) )
+ ( !rSh.IsObjSelectable( aDocPos ) ||
+ // allow resizing row height, if the image is anchored as 
character in the cell
+ ( rSh.ShouldObjectBeSelected(aDocPos) &&
+ !( SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == 
nMouseTabCol ) ) ) )
 {
 // Enhanced table selection
 if ( SwTab::SEL_HORI <= nMouseTabCol && SwTab::COLSEL_VERT >= 
nMouseTabCol )
@@ -4025,8 +4029,12 @@ bool SwEditWin::changeMousePointer(Point const & 
rDocPoint)
 SwWrtShell & rShell = m_rView.GetWrtShell();
 
  

core.git: 2 commits - sw/qa sw/source

2024-04-28 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf160842.fodt |   75 +
 sw/qa/extras/uiwriter/uiwriter6.cxx   |  107 ++
 sw/source/core/frmedt/feshview.cxx|   22 ++
 sw/source/uibase/uiview/viewtab.cxx   |2 
 4 files changed, 205 insertions(+), 1 deletion(-)

New commits:
commit f3b899655018397e71300dbb32cdf4f82940a68b
Author: László Németh 
AuthorDate: Sat Apr 27 00:26:54 2024 +0200
Commit: László Németh 
CommitDate: Mon Apr 29 00:16:21 2024 +0200

tdf#160842 sw: select cell content instead of cropped part of image

It was not possible to select and edit the content of the bottom
cell, if an image cropped by the fixed row height "covered" it,
i.e. the image was in the previous row, anchored as character.

Note: table cells with fixed row height are usable to crop images
easily, with a single drag & drop, according to the requirement of
the text layout, while the cell above or bottom of the cell with
image is for the caption of the image. This is very useful to
adjust a book layout with sections with multiple columns and
illustrations.

Change-Id: I8683b4066db6ce43549ec3aa69b0e639a59e3681
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166794
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data/tdf160842.fodt 
b/sw/qa/extras/uiwriter/data/tdf160842.fodt
new file mode 100644
index ..217b9c1a9570
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf160842.fodt
@@ -0,0 +1,75 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+ 
+  
+   
+   
+
+ 
+
iVBORw0KGgoNSUhEUgICCAIAAAD91JpzFklEQVQI12P2Ytilf46NeWX3
+ a804HgAg7QTAqXPBTwBJRU5ErkJggg==
+
+   
+  
+
+   
+   
+
+ Lorem ipsum dolor sit amet, consectetur 
adipiscing.
+
+   
+  
+ 
+
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 51f15a09f2d8..e6cff1c8ae9a 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -55,6 +55,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1463,6 +1467,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773)
 CPPUNIT_ASSERT_EQUAL(tools::Long(810), pCellA1->getFrameArea().Height());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+

dictionaries.git: Changes to 'refs/tags/cp-24.04.1-3'

2024-04-22 Thread László Németh (via logerrit)
Tag 'cp-24.04.1-3' created by Andras Timar  at 
2024-04-22 06:34 +

cp-24.04.1-3

Changes since cp-24.04.1-2-3:
---
 0 files changed
---


core.git: helpcontent2

2024-04-11 Thread László Németh (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 11ed593acc339d848806cd263e1de9503965a53a
Author: László Németh 
AuthorDate: Thu Apr 11 17:42:19 2024 +0200
Commit: Gerrit Code Review 
CommitDate: Thu Apr 11 17:42:19 2024 +0200

Update git submodules

* Update helpcontent2 from branch 'master'
  to 58350a811a8001f72b13f6ca3def5f32ea904e72
  - tdf#132599 add "Hyphenation across" options

Document new options of LO 24.8 to control hyphenation
in last line of a column, page or spread.

Follow-up to core commit 6e8819f29b6051a0e551d77512830539913ec277
"tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type",
core commit 9574a62add8e4901405e12117e75c86c2d2c2f21
"tdf#132599 cui offapi sw xmloff: implement hyphenate-keep" and
core commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463
"tdf160518 DOCX: import hyphenation-keep to fix layout".

Change-Id: I1d7d6ef1b154f7c6dd55e99584d1d27ce46899ac
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/166009
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index c2b91a5c78e0..58350a811a80 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit c2b91a5c78e053498f5ff6a411c314e36eb4a859
+Subproject commit 58350a811a8001f72b13f6ca3def5f32ea904e72


help.git: source/text

2024-04-11 Thread László Németh (via logerrit)
 source/text/swriter/01/05030200.xhp |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 58350a811a8001f72b13f6ca3def5f32ea904e72
Author: László Németh 
AuthorDate: Thu Apr 11 13:38:42 2024 +0200
Commit: Olivier Hallot 
CommitDate: Thu Apr 11 17:42:19 2024 +0200

tdf#132599 add "Hyphenation across" options

Document new options of LO 24.8 to control hyphenation
in last line of a column, page or spread.

Follow-up to core commit 6e8819f29b6051a0e551d77512830539913ec277
"tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type",
core commit 9574a62add8e4901405e12117e75c86c2d2c2f21
"tdf#132599 cui offapi sw xmloff: implement hyphenate-keep" and
core commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463
"tdf160518 DOCX: import hyphenation-keep to fix layout".

Change-Id: I1d7d6ef1b154f7c6dd55e99584d1d27ce46899ac
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/166009
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/source/text/swriter/01/05030200.xhp 
b/source/text/swriter/01/05030200.xhp
index 9f0c9735a0..6722ef29b4 100644
--- a/source/text/swriter/01/05030200.xhp
+++ b/source/text/swriter/01/05030200.xhp
@@ -72,6 +72,17 @@
 
 Hyphenate last word
 Hyphenate the last word of 
paragraphs. Disabling this feature prevents the creation of almost empty lines 
containing only half a word.
+Hyphenation across
+Control 
hyphenation in the last line of a column, page or spread.
+
+Column
+Deselect this check box to prevent 
words from being hyphenated across a column or page.
+
+Page
+Deselect this check box to prevent 
words from being hyphenated across a page.
+
+Spread
+Deselect this check box to prevent 
words from being hyphenated across a spread. (A spread is a set of two pages 
that are visible to the reader at the same time.)
 Breaks
 Specify the 
page or column break 
options.
 


core.git: cui/source cui/uiconfig editeng/source include/editeng include/sfx2 include/unotools include/xmloff offapi/com schema/libreoffice svx/sdi sw/inc sw/qa sw/source writerfilter/source xmloff/in

2024-04-11 Thread László Németh (via logerrit)
 cui/source/inc/paragrph.hxx|   13 
 cui/source/tabpages/paragrph.cxx   |  102 +++-
 cui/uiconfig/ui/textflowpage.ui|  105 +++-
 editeng/source/items/paraitem.cxx  |   82 +--
 editeng/source/rtf/rtfitem.cxx |2 
 include/editeng/editrids.hrc   |8 
 include/editeng/hyphenzoneitem.hxx |   12 
 include/editeng/memberids.h|3 
 include/sfx2/msg.hxx   |1 
 include/unotools/linguprops.hxx|4 
 include/xmloff/xmltoken.hxx|2 
 include/xmloff/xmltypes.hxx|1 
 offapi/com/sun/star/style/ParagraphProperties.idl  |   15 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng|   16 
 svx/sdi/svxitems.sdi   |3 
 sw/inc/inspectorproperties.hrc |1 
 sw/inc/unoprnms.hxx|1 
 sw/qa/extras/odfexport/data/tdf132599_column.fodt  |  198 
+++
 sw/qa/extras/odfexport/data/tdf132599_page_in_last_column.fodt |  196 
+++
 sw/qa/extras/odfexport/data/tdf132599_page_in_not_last_column.fodt |  198 
+++
 sw/qa/extras/odfexport/data/tdf132599_spread-left-page.fodt|  252 
++
 sw/qa/extras/odfexport/data/tdf132599_spread.fodt  |  241 
+
 sw/qa/extras/odfexport/odfexport2.cxx  |   65 ++
 sw/qa/uitest/styleInspector/styleInspector.py  |   20 
 sw/qa/uitest/styleInspector/tdf137513.py   |2 
 sw/source/core/text/inftxt.cxx |   26 -
 sw/source/core/text/widorp.cxx |   32 +
 sw/source/core/unocore/unomapproperties.hxx|6 
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx  |1 
 writerfilter/source/dmapper/PropertyIds.cxx|1 
 writerfilter/source/dmapper/PropertyIds.hxx|1 
 writerfilter/source/dmapper/SettingsTable.cxx  |3 
 xmloff/inc/xmlprop.hxx |1 
 xmloff/source/core/xmltoken.cxx|2 
 xmloff/source/text/txtprhdl.cxx|   13 
 xmloff/source/text/txtprmap.cxx|1 
 xmloff/source/token/tokens.txt |2 
 37 files changed, 1515 insertions(+), 117 deletions(-)

New commits:
commit 6e8819f29b6051a0e551d77512830539913ec277
Author: László Németh 
AuthorDate: Wed Apr 10 12:27:38 2024 +0200
Commit: László Németh 
CommitDate: Thu Apr 11 10:20:41 2024 +0200

tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type

Support XSL attribute "column" and CSS 4 attribute "spread",
stored in loext:hyphenation-keep-type, to give better control
over hyphenation-keep. E.g. spread: both parts of a hyphenated
word shall lie within a single spread, i.e. when the next page
is not visible at the same time (e.g. the next page is not a
right page of a book).

– css::style::ParaHyphenationKeep is a boolean property now,
  importing hyphenation-keep = "page" as true.

– type of ParaHyphenationKeep, including the new non-ODF types
  is stored in the new ParagraphProperties::ParaHyphenationKeepType.

– default value of ParaHyphenationKeepType is COLUMN for
  interoperability.

– Add checkboxes to Text Flow -> Hyphenation Across in
  paragraph dialog:

  * Column (previously: Hyphenate across column and page)
  * Page
  * Spread

  – enabling/disabling them follows XSL/CSS 4/loext, i.e.
possible combinations:

  * No Hyphenation across
(hyphenation-keep = "page" and loext:hyphenation-keep-type = "column")

  * Hyphenation across [x] Column
(hyphenation-keep = "page" and loext:hyphenation-keep-type = "page")

  * Hyphenation across [x] Column [x] Page
(hyphenation-keep = "page" and loext:hyphenation-keep-type = "spread")

  * Hyphenation across [x] Column [x] Page [x] Spread
(hyphenation-keep = "auto")

– Add ODF import/export

– Update DOCX import

– Add ODF unit tests

Note: recent implementation depends on widow settings: disabling widow
handling allows hyphenation across columns and pages not only in table
cells.

Note: RTF import-only, but not used bPageEnd has been renamed to bKeep.
  

core.git: Branch 'distro/collabora/co-23.05' - dictionaries

2024-04-09 Thread László Németh (via logerrit)
 dictionaries |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8df77099766c2fb56b0c9be9eef34c54f5011b6a
Author: László Németh 
AuthorDate: Tue Apr 9 17:53:42 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Tue Apr 9 18:53:42 2024 +0200

Update git submodules

* Update dictionaries from branch 'distro/collabora/co-23.05'
  to 3564cb05559c1ea6c34ee89bfb02caee2637028a
  - Hungarian dictionary v1.8.1

Added new words, fixes, and decomposition data of ~6500 compound words
for better hyphenation. See tdf#158885 for COMPOUNDLEFTHYPHENMIN
implementation in LibreOffice, where Hunspell filters out compound word
boundaries from libhyphen-based hyphenation breaks, restricting 
hyphenation
near the compound boundary according to spelling and typography rules.

Change-Id: I22a7b70513d0a59d7a31462fcb46efd53cfe8ad7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165439
Tested-by: László Németh 
Reviewed-by: László Németh 

  - Updated Hungarian hyphenation dictionary to version v20240321

source: 
https://sourceforge.net/projects/magyarispell/files/OOo%20Huhyphn/v20240321-0.1/
Change-Id: If470f5854511cac6f0a355e4d006abf9e3976f90
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165166
Tested-by: László Németh 
Reviewed-by: László Németh 

  - use general label for Turkish dictionary

to be consistent with labels for other dictionaries

Change-Id: If01f9a9292fc15f3ff06f608b87273bc4e300e2f
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/162946
Reviewed-by: Kevin Suo 
Tested-by: Kevin Suo 

  - update hunspell dictionaries for Turkish language

This dictionary is more accurate and efficient than the current 
dictionary. It was benchmarked and compared to existing hunspell Turkish 
dictionaries. Please see: https://github.com/tdd-ai/hunspell-tr

Edit: Updated the dictionary to include proper names.

Change-Id: Ie23273274bc60ce6ac53a12ff92ad529bd0339a7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/118649
Reviewed-by: Muhammet Kara 
Tested-by: Muhammet Kara 

  - Updated Afrikaans dictionary

Change-Id: Ief9cb53fdcbf794d1c54f4f5008f80b9975453d8
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/163265
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 
(cherry picked from commit 55f4731d574aeec252379ac66326bcea6df2f823)
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/163280
Tested-by: Adolfo Jayme Barrientos 
Reviewed-by: Adolfo Jayme Barrientos 

  - tdf#159164 Update the English dictionaries: GB+ZA+AU+CA+US

Change-Id: I1ad3cb7a283f85cd8260d2d12f3abd78dfcf6206
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/162881
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 
(cherry picked from commit 208a9fd80b2a182fe20f224cd615119c6323ae2e)
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/162899

  - tdf#156723 False positives in pt-BR lightproof

Salário mínimo

Change-Id: I5d060d90b7915b91d44b8dd2cb9bd4cf79115012
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/161572
Tested-by: Olivier Hallot 
Reviewed-by: Olivier Hallot 
(cherry picked from commit fda9b47d9ce58f16441d6e0ec23f8aac655c1428)
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/161559

  - Updated Slovenian thesaurus

Change-Id: Ib3c9a0b4a36398b25def93bbbc62a9bcc8e3fa2c
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/161569
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

  - Belarusian hunspell dictionary update

Change-Id: I3d2a0f62fe59f46f201a4c7d596a22fd04efe017
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/159516
Tested-by: Vasily Melenchuk 
Reviewed-by: Vasily Melenchuk 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 15c78fe07964b0457639ff02cd8c15d0d2d844b6)
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/161108

  - Update the Korean Dictionaries: ko-KR

Update Korean dictionary file (ko_KR.dic) by DaeHyun Sung (2023.05.14)
Also, update readme description

Change-Id: Iebaad8c33d8a94bfa4e7427c0a3d218ea4d7c109
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/151732
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

  - Updated the English dictionaries: GB

Change-Id: I9950273688ccb0d9743d168b1a928e91942c38a3
Reviewed-on: 

dictionaries.git: Branch 'distro/collabora/co-23.05' - 25 commits - af_ZA/af_ZA.aff af_ZA/af_ZA.dic af_ZA/description.xml be_BY/be-official.aff be_BY/be-official.dic be_BY/description.xml ca/descripti

2024-04-09 Thread László Németh (via logerrit)
 .gitreview|7 
 Dictionary_es.mk  |4 
 Dictionary_id.mk  |3 
 af_ZA/af_ZA.aff   |  175 
 af_ZA/af_ZA.dic   |30255 --
 af_ZA/description.xml |2 
 be_BY/be-official.aff |19696 -
 be_BY/be-official.dic |273559 +++---
 be_BY/description.xml |2 
 ca/LICENSES-en.txt|2 
 ca/LLICENCIES-ca.txt  |2 
 ca/README_ca.txt  |   24 
 ca/README_hyph_ca.txt |   32 
 ca/README_thes_ca.txt |   18 
 ca/description.xml|2 
 ca/dictionaries/ca-valencia.aff   | 5075 
 ca/dictionaries/ca-valencia.dic   |412234 ++-
 ca/dictionaries/ca.aff| 5057 
 ca/dictionaries/ca.dic|411426 ++-
 ca/dictionaries/hyph_ca.dic   | 5542 
 ca/dictionaries/th_ca_ES_v3.dat   |132242 +++-
 ca/package-description.txt|2 
 da_DK/README_da_DK.txt|2 
 da_DK/da_DK.aff   |  708 
 da_DK/da_DK.dic   |24605 +
 da_DK/description.xml |2 
 da_DK/th_da_DK.dat| 3888 
 en/Linguistic.xcu |2 
 en/README_en_GB.txt   |  241 
 en/changelog.txt  |  156 
 en/description.xml|2 
 en/dialog/en_en_US.properties |2 
 en/dictionaries.xcu   |6 
 en/en_AU.aff  |6 
 en/en_CA.aff  |6 
 en/en_GB.aff  | 1643 
 en/en_GB.dic  |10520 
 en/en_US.aff  |6 
 en/en_ZA.aff  | 1341 
 en/en_ZA.dic  |  113 
 en/package-description.txt|   10 
 en/pythonpath/lightproof_impl_en.py   |2 
 es/description.xml|2 
 es/dictionaries.xcu   |   15 
 es/es.aff | 6907 
 es/es.dic |70159 
 es/es_AR.dic  |  106 
 es/es_BO.dic  |  106 
 es/es_CL.dic  |  107 
 es/es_CO.dic  |  107 
 es/es_CR.dic  |  110 
 es/es_CU.dic  |  106 
 es/es_DO.dic  |  106 
 es/es_EC.dic  |  109 
 es/es_ES.dic  |  106 
 es/es_GQ.dic  |  119 
 es/es_GT.dic  |  112 
 es/es_HN.dic  |  114 
 es/es_MX.dic  |  115 
 es/es_NI.dic  |  113 
 es/es_PA.dic  |  108 
 es/es_PE.dic  |  106 
 es/es_PH.dic  |  109 
 es/es_PR.dic  |  106 
 es/es_PY.dic  |  106 
 es/es_SV.dic  |  109 
 es/es_US.dic  |  106 
 es/es_UY.dic  |  106 
 es/es_VE.dic  |  106 
 es/package-description.txt|2 
 hu_HU/README_hu_HU.txt|8 
 hu_HU/README_hyph_hu_HU.txt   |2 
 hu_HU/description.xml |2 
 hu_HU/hu_HU.aff   |79685 ++---
 hu_HU/hu_HU.dic   |157990 +-
 hu_HU/hyph_hu_HU.dic  | 4614 
 id/README-dict.adoc   |  137 
 id/README-dict.md |   55 
 id/description.xml|2 
 id/id_ID.aff  |  107 
 id/id_ID.dic  |19909 +
 ko_KR/README_ko_KR.txt|3 
 ko_KR/ko_KR.dic   |  144 
 oc_FR/LICENCES-fr.txt |   50 
 oc_FR/LICENSES-en.txt |   26 
 oc_FR/README_oc_FR.txt|  109 
 oc_FR/description.xml |8 
 oc_FR/oc_FR.aff   |  172 
 oc_FR/oc_FR.dic   | 4708 
 pt_BR/dialog/pt_BR_en_US.properties   |2 
 pt_BR/pythonpath/lightproof_impl_pt_BR.py |2 
 pt_BR/pythonpath/lightproof_pt_BR.py  |6 
 sk_SK/README_en.txt   |5 
 sk_SK/README_sk.txt   |5 
 sk_SK/description.xml |2 
 sk_SK/release_en.txt  | 

core.git: Branch 'distro/collabora/co-24.04' - dictionaries

2024-04-09 Thread László Németh (via logerrit)
 dictionaries |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 64f98c67ad5b4e6a7c57c028a204ccc5c43de03c
Author: László Németh 
AuthorDate: Tue Apr 9 17:24:11 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Tue Apr 9 18:24:11 2024 +0200

Update git submodules

* Update dictionaries from branch 'distro/collabora/co-24.04'
  to 12518d479bc574492d6da740e9176649725c
  - Hungarian dictionary v1.8.1

Added new words, fixes, and decomposition data of ~6500 compound words
for better hyphenation. See tdf#158885 for COMPOUNDLEFTHYPHENMIN
implementation in LibreOffice, where Hunspell filters out compound word
boundaries from libhyphen-based hyphenation breaks, restricting 
hyphenation
near the compound boundary according to spelling and typography rules.

Change-Id: I22a7b70513d0a59d7a31462fcb46efd53cfe8ad7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165439
Tested-by: László Németh 
Reviewed-by: László Németh 

  - Updated Hungarian hyphenation dictionary to version v20240321

source: 
https://sourceforge.net/projects/magyarispell/files/OOo%20Huhyphn/v20240321-0.1/
Change-Id: If470f5854511cac6f0a355e4d006abf9e3976f90
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165166
Tested-by: László Németh 
Reviewed-by: László Németh 

  - use general label for Turkish dictionary

to be consistent with labels for other dictionaries

Change-Id: If01f9a9292fc15f3ff06f608b87273bc4e300e2f
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/162946
Reviewed-by: Kevin Suo 
Tested-by: Kevin Suo 

  - update hunspell dictionaries for Turkish language

This dictionary is more accurate and efficient than the current 
dictionary. It was benchmarked and compared to existing hunspell Turkish 
dictionaries. Please see: https://github.com/tdd-ai/hunspell-tr

Edit: Updated the dictionary to include proper names.

Change-Id: Ie23273274bc60ce6ac53a12ff92ad529bd0339a7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/118649
Reviewed-by: Muhammet Kara 
Tested-by: Muhammet Kara 

diff --git a/dictionaries b/dictionaries
index a62f9b3e6b2d..12518d47 16
--- a/dictionaries
+++ b/dictionaries
@@ -1 +1 @@
-Subproject commit a62f9b3e6b2de1366d826a5bacf19ae63e527ead
+Subproject commit 12518d479bc574492d6da740e9176649725c


dictionaries.git: Branch 'distro/collabora/co-24.04' - 4 commits - hu_HU/hu_HU.aff hu_HU/hu_HU.dic hu_HU/hyph_hu_HU.dic hu_HU/README_hu_HU.txt hu_HU/README_hyph_hu_HU.txt tr_TR/COPYING.MPL tr_TR/descr

2024-04-09 Thread László Németh (via logerrit)
 hu_HU/README_hu_HU.txt  |8 
 hu_HU/README_hyph_hu_HU.txt |2 
 hu_HU/hu_HU.aff |58746 ++---
 hu_HU/hu_HU.dic |126894 ++--
 hu_HU/hyph_hu_HU.dic| 4614 
 tr_TR/COPYING.MPL   |  373 
 tr_TR/LICENSE   |2 
 tr_TR/README.txt|   16 
 tr_TR/description.xml   |4 
 tr_TR/tr_TR.aff |171333 
 tr_TR/tr_TR.dic |447000 
+++-
 11 files changed, 338854 insertions(+), 470138 deletions(-)

New commits:
commit 12518d479bc574492d6da740e9176649725c
Author: László Németh 
AuthorDate: Thu Mar 28 00:19:22 2024 +0100
Commit: Andras Timar 
CommitDate: Tue Apr 9 18:23:25 2024 +0200

Hungarian dictionary v1.8.1

Added new words, fixes, and decomposition data of ~6500 compound words
for better hyphenation. See tdf#158885 for COMPOUNDLEFTHYPHENMIN
implementation in LibreOffice, where Hunspell filters out compound word
boundaries from libhyphen-based hyphenation breaks, restricting hyphenation
near the compound boundary according to spelling and typography rules.

Change-Id: I22a7b70513d0a59d7a31462fcb46efd53cfe8ad7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165439
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/hu_HU/README_hu_HU.txt b/hu_HU/README_hu_HU.txt
index 8593ed0..468cdee 100644
--- a/hu_HU/README_hu_HU.txt
+++ b/hu_HU/README_hu_HU.txt
@@ -1,17 +1,17 @@
-Magyar Ispell helyesírási szótár – 1.8 szótárállományok morfológiai adatokkal
+Magyar Ispell helyesírási szótár – 1.8.1 szótárállományok morfológiai adatokkal
 
 A szótárállományok a LibreOffice projekt részeként a következő nyílt forráskódú
 licencek bármelyike alapján szabadon felhasználhatóak, de mindenféle garancia 
nélkül:
 
 MPLv2 vagy LesserGPLv3+
 
-(c) Németh László és Godó Ferenc, 2023
+(c) Németh László és Godó Ferenc, 2024
 
 Honlap: http://magyarispell.sf.net
 
 --
 
-Hungarian Hunspell dictionaries version 1.8 with morphological data
+Hungarian Hunspell dictionaries version 1.8.1 with morphological data
 
 These files are part of the LibreOffice project.
 
@@ -26,6 +26,6 @@ Software distributed under these licenses is distributed on 
an "AS IS" basis,
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the licences
 for the specific language governing rights and limitations under the licenses.
 
-2023 (c) László Németh & Ferenc Godó
+2024 (c) László Németh & Ferenc Godó
 
 Home: http://magyarispell.sf.net
diff --git a/hu_HU/hu_HU.aff b/hu_HU/hu_HU.aff
index 4bddd3e..1812c72 100644
--- a/hu_HU/hu_HU.aff
+++ b/hu_HU/hu_HU.aff
@@ -6,11 +6,11 @@
 # GPL/LGPL/MPL license as published by the FSF and Mozilla Foundation.
 #
 #
-# Version: May 2023, 1.8
+# Version: March 2024, 1.8.1
 #
 # Home page: http://magyarispell.sourceforge.net
 #
-# 2002-2023 (c) L�szl� N�meth  and Ferenc God�
+# 2002-2024 (c) L�szl� N�meth  and Ferenc God�
 #
 # Thanks to
 # Tam�s Sz�nt� ,
@@ -30,7 +30,7 @@
 # amelyet N�meth L�szl� �s God� Ferenc k�sz�tett, �s a GPL/LGPL/MPL licenc
 # alatt k�zz�tett a http://magyarispell.sourceforge.net oldalon.
 #
-# Magyar Ispell 1.8, 2023-05
+# Magyar Ispell 1.8.1, 2024-03
 #
 # K�sz�net illeti a k�vetkez�ket:
 #
@@ -52,7 +52,7 @@
 NAME Magyar Ispell helyes�r�si sz�t�r
 LANG hu_HU
 HOME http://magyarispell.sourceforge.net
-VERSION Magyar 1.8
+VERSION Magyar 1.8.1
 SET UTF-8
 KEY öüó|qwertzuiopőú|asdfghjkléáű|íyxcvbnm
 TRY íóútaeslzánorhgkiédmyőpvöbucfjüűxwq-.à
@@ -157,7 +157,7 @@ ICONV fl fl
 # - multicharacter suggestions
 # - well-sorted suggestions
 
-REP 170
+REP 171
 REP í i
 REP i í
 REP ó o
@@ -328,8 +328,9 @@ REP ssal$ sszal
 REP ssé$ sszé
 REP ssá$ sszá
 REP ^megfed megfedd
+REP lengépszer legnépszer REP # lengépszerűbb->legnépszerűbb
 
-AF 1548
+AF 1559
 AF V˯j�L�n�TtYc��l # 1
 AF Um��yiYc� # 2
 AF �CWR̯j���y���Yc� # 3
@@ -369,7 +370,7 @@ AF uQ # 36
 AF �AUʮi���yǿ�Yc� # 37
 AF W̯j�M���RTtvc�� # 38
 AF Uʮi�K�m�QYc��k # 39
-AF tV˯j�L�n�RYc��l # 40
+AF tV˯j�L�n��y���RTYc� # 40
 AF wYUm���ic�k # 41
 AF wYUʮi�K�m�Ssc��k # 42
 AF VN˯j�L���TtYc�� # 43
@@ -546,1339 +547,1350 @@ AF KU
 AF A���UQ # 214
 AF W�yjYc� # 215
 AF Uʮi$s�m�QYc��k # 216
-AF Um�yiYc���K��ǿ�Ss� # 217
-AF UVʮ˯ij��KL��n�m�TtYcklSs # 218
-AF UVʮ˯ij��KL��n�m�QRYckl # 219
-AF Uʮi�K�m�q�Q,�k # 220
-AF W̯j�M���q�Tt,�l # 221
-AF �BVR˯j��q���,� # 222
-AF W̯j�B��q���R,�l # 223
-AF �CWR̯j��q�,� # 224
-AF V˯j�L�n�q�Tt,�l # 225
-AF ��mAFUKQ # 226
-AF �BVR˯j��q�,� # 227
-AF �AUQʮi��q�,� # 228
-AF Uʮi�K�m�q�Ss,� # 229
-AF Uʮi�A��qǿ�Q,�k # 230
-AF Uʮi�K�m�q�Ss,�k # 231
-AF V˯j�L�n�q�R,�l # 232
-AF V˯j�L�n�q���Tt,�l # 233
-AF V˯j�L�n�q���R,�l� # 234
-AF ��nBGVLR # 235
-AF ���BGVLTt # 236
-AF W̯j�M���q���R,�l # 237
-AF �BVR˯j��q���,�� # 238
-AF W̯j�M���q���Tt,�� # 239
-AF V˯j�B��q���R,�l # 240
-AF 

core.git: editeng/source sw/qa writerfilter/source

2024-04-04 Thread László Németh (via logerrit)
 editeng/source/items/paraitem.cxx  
|2 
 sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx 
|binary
 sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx 
|binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
|   64 ++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx   
|3 
 writerfilter/source/dmapper/PropertyIds.cxx
|1 
 writerfilter/source/dmapper/PropertyIds.hxx
|1 
 writerfilter/source/dmapper/SettingsTable.cxx  
|   17 ++
 writerfilter/source/dmapper/SettingsTable.hxx  
|2 
 9 files changed, 85 insertions(+), 5 deletions(-)

New commits:
commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463
Author: László Németh 
AuthorDate: Thu Apr 4 14:08:23 2024 +0200
Commit: László Németh 
CommitDate: Thu Apr 4 22:46:12 2024 +0200

tdf160518 DOCX: import hyphenation-keep to fix layout

To fix layout interoperability, import DOCX compatSettings
allowHyphenationAtTrackBottom and useWord2013TrackBottomHyphenation
as hyphenation-keep setting "COLUMN", shifting last hyphenated
lines of pages and columns, like MSO does.

Follow-up to commit 9574a62add8e4901405e12117e75c86c2d2c2f21
"tdf#132599 cui offapi sw xmloff: implement hyphenate-keep".

Change-Id: Ib2a06efc22a4f30d8f8be8a752460b09d09e97a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165798
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/editeng/source/items/paraitem.cxx 
b/editeng/source/items/paraitem.cxx
index 3e99813f628d..4103fe2ea521 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -616,7 +616,7 @@ boolSvxHyphenZoneItem::QueryValue( uno::Any& rVal, 
sal_uInt8 nMemberId ) con
 bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 {
 nMemberId &= ~CONVERT_TWIPS;
-sal_Int16 nNewVal = 0;
+sal_Int32 nNewVal = 0; // sal_Int32 needs for MID_HYPHEN_KEEP
 
 if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS &&
 nMemberId != MID_HYPHEN_NO_LAST_WORD )
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx
new file mode 100644
index ..61e81cf1f539
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx 
differ
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx
new file mode 100644
index ..26acacc462b3
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index a045a03407ff..c33275b62394 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -28,6 +28,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -1424,6 +1426,68 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159032, 
"tdf124795-5.docx")
 CPPUNIT_ASSERT_EQUAL(57, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160518, 
"tdf160518_useWord2013TrackBottomHyphenation.docx")
+{
+uno::Reference xHyphenator = 
LinguMgr::GetHyphenator();
+if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString(
+return;
+
+// TODO: fix export too
+if (isExported())
+return;
+// This was 2 (without shifting last hyphenated line of the page)
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf160518_compatible, 
"tdf160518_allowHyphenationAtTrackBottom.docx")
+{
+uno::Reference xHyphenator = 
LinguMgr::GetHyphenator();
+if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString(
+return;
+
+// TODO: fix export too
+if (isExported())
+return;
+// This is still 2
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT, 
"tdf160518_useWord2013TrackBottomHyphenation.docx")
+{
+uno::Reference xHyphenator = 
LinguMgr::GetHyphenator();
+if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString(
+return;
+
+// TODO: fix export too
+if (isExported())
+return;
+// This was 2 (without shifting last hyphenated line of the page)
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+// check compatibility option in ODT export/import, too
+saveAndReload("writer8");
+
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT_compatible, 

core.git: helpcontent2

2024-04-01 Thread László Németh (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c7582ceae710c1a81f75c63541f332052ca7aab0
Author: László Németh 
AuthorDate: Mon Apr 1 14:33:06 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Mon Apr 1 15:33:06 2024 +0200

Update git submodules

* Update helpcontent2 from branch 'master'
  to c2349a58a8e43f44a796f8e21053f4ca6de6fb4c
  - tdf#106733 tdf#158885 add "Exclude from hyphenation, Compound 
characters...

Document new and updated hyphenation options of LO 24.8:

New options:

– "Exclude from hyphenation" (Character->Position);

– "Compound constituent characters at line end" (Paragraph->Text Flow).

Updated (moved and negated) options (Paragraph->Text Flow):

– "Hyphenate words in CAPS" and

– "Hyphenate last word".

Follow-up to core commit 3a332d9f1cacb3c6f81fcf6c08afa51d091ddff4
"tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundary",
core commit 03c5a31a0f374a90fbc821718c14dc5f8a385adf
"tdf#106733 sw cui: add CharNoHyphenation checkbox",
core commit b5e275f47a54bd7fee39dad516a433fde5be872d
"tdf#106733 sw: implement CharNoHyphenation"
and core commit 73bd04a71e741788a2f2f3b26cc46ddb6a361372
"tdf#106733 xmloff: keep fo:hyphenate in character formatting".

Change-Id: Ief37df057bec1ea286c7334a200fe6abcc8995d3
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/165565
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index cff8d0c49290..c2349a58a8e4 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit cff8d0c49290f86a40af8e258e37ace0d067afeb
+Subproject commit c2349a58a8e43f44a796f8e21053f4ca6de6fb4c


help.git: source/text

2024-04-01 Thread László Németh (via logerrit)
 source/text/shared/01/05020500.xhp  |5 +
 source/text/swriter/01/05030200.xhp |   18 ++
 2 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit c2349a58a8e43f44a796f8e21053f4ca6de6fb4c
Author: László Németh 
AuthorDate: Sat Mar 30 02:26:06 2024 +0100
Commit: Olivier Hallot 
CommitDate: Mon Apr 1 15:33:06 2024 +0200

tdf#106733 tdf#158885 add "Exclude from hyphenation, Compound characters...

Document new and updated hyphenation options of LO 24.8:

New options:

– "Exclude from hyphenation" (Character->Position);

– "Compound constituent characters at line end" (Paragraph->Text Flow).

Updated (moved and negated) options (Paragraph->Text Flow):

– "Hyphenate words in CAPS" and

– "Hyphenate last word".

Follow-up to core commit 3a332d9f1cacb3c6f81fcf6c08afa51d091ddff4
"tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundary",
core commit 03c5a31a0f374a90fbc821718c14dc5f8a385adf
"tdf#106733 sw cui: add CharNoHyphenation checkbox",
core commit b5e275f47a54bd7fee39dad516a433fde5be872d
"tdf#106733 sw: implement CharNoHyphenation"
and core commit 73bd04a71e741788a2f2f3b26cc46ddb6a361372
"tdf#106733 xmloff: keep fo:hyphenate in character formatting".

Change-Id: Ief37df057bec1ea286c7334a200fe6abcc8995d3
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/165565
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/source/text/shared/01/05020500.xhp 
b/source/text/shared/01/05020500.xhp
index 903a8f9a33..bc091094a4 100644
--- a/source/text/shared/01/05020500.xhp
+++ b/source/text/shared/01/05020500.xhp
@@ -108,6 +108,11 @@
 Pair 
kerning
 Automatically adjust the character 
spacing for specific letter combinations.
 Kerning is only available for 
certain font types and requires that your printer support this 
option.
+Hyphenation
+Skip hyphenation for selected 
words.
+
+Exclude from hyphenation
+It prevents hyphenation of the selected 
word or words in a paragraph hyphenated automatically.
 
 
 
diff --git a/source/text/swriter/01/05030200.xhp 
b/source/text/swriter/01/05030200.xhp
index 8b7e3e0527..9f0c9735a0 100644
--- a/source/text/swriter/01/05030200.xhp
+++ b/source/text/swriter/01/05030200.xhp
@@ -48,18 +48,15 @@
 
 Automatically
 Automatically inserts hyphens where they 
are needed in a paragraph.
-
-Don't hyphenate words in CAPS
-Avoids hyphenating words written entirely 
in capital letters, such as initialisms.
-
-Don't hyphenate the last word
-Avoids hyphenating the last word of 
paragraphs. This feature can help prevent these words from being split up 
across pages, affecting readability.
 
 Characters at line end
 Enter the minimum number of characters to 
leave at the end of the line before a hyphen is inserted.
 
 Characters at line begin
 Enter the minimum number of characters 
that must appear at the beginning of the line after the 
hyphen.
+
+Compound constituent characters at line end
+Set 3 (or more) characters to 
improve the hyphenation in Danish, Dutch, German, Hungarian, Norwegian and 
Swedish by preferring the hyphenation between constituents of a compound word 
instead of breaking the second (third etc.) constituent right after its first 2 
characters.
 
 Maximum consecutive hyphenated lines
 Enter the maximum number of consecutive 
lines that can be hyphenated.
@@ -68,8 +65,13 @@
 Enter the minimum word length in 
characters that can be hyphenated.
 
 Hyphenation zone
-To reduce hyphenation, enter the 
length of the hyphenation zone. Instead of the possible hyphenation, the line 
will break between words, if the remaining horizontal space does not exceed the 
hyphenation zone. Hyphenation zone results in enlarged spaces between words in 
justified text, and greater distance from paragraph margins in non-justified 
text.
-
+To reduce hyphenation, enter the 
length of the hyphenation zone. Instead of the possible hyphenation, the line 
will break between words, if the remaining horizontal space does not exceed the 
hyphenation zone. Hyphenation zone results in enlarged spaces between words in 
justified text, and greater distance from paragraph margins in non-justified 
text.
+
+Hyphenate words in CAPS
+Hyphenate words written entirely in 
capital letters, such as initialisms.
+
+Hyphenate last word
+Hyphenate the last word of 
paragraphs. Disabling this feature prevents the creation of almost empty lines 
containing only half a word.
 Breaks
 Specify the 
page or column break 
options.
 


core.git: dictionaries

2024-03-28 Thread László Németh (via logerrit)
 dictionaries |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 28d1744552fc7d2144b77a07993918ef33905f1f
Author: László Németh 
AuthorDate: Thu Mar 28 10:56:58 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Thu Mar 28 10:56:58 2024 +0100

Update git submodules

* Update dictionaries from branch 'master'
  to c5b2a36bde02841590b8ccc490ca88bfdb69f153
  - Hungarian dictionary v1.8.1

Added new words, fixes, and decomposition data of ~6500 compound words
for better hyphenation. See tdf#158885 for COMPOUNDLEFTHYPHENMIN
implementation in LibreOffice, where Hunspell filters out compound word
boundaries from libhyphen-based hyphenation breaks, restricting 
hyphenation
near the compound boundary according to spelling and typography rules.

Change-Id: I22a7b70513d0a59d7a31462fcb46efd53cfe8ad7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165439
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/dictionaries b/dictionaries
index 491736b0e775..c5b2a36bde02 16
--- a/dictionaries
+++ b/dictionaries
@@ -1 +1 @@
-Subproject commit 491736b0e775f7d4a0bfd9ed9ce94ec296e3e988
+Subproject commit c5b2a36bde02841590b8ccc490ca88bfdb69f153


dictionaries.git: hu_HU/hu_HU.aff hu_HU/hu_HU.dic hu_HU/README_hu_HU.txt

2024-03-28 Thread László Németh (via logerrit)
 hu_HU/README_hu_HU.txt |8 
 hu_HU/hu_HU.aff|58746 +++---
 hu_HU/hu_HU.dic|126894 
-
 3 files changed, 93528 insertions(+), 92120 deletions(-)

New commits:
commit c5b2a36bde02841590b8ccc490ca88bfdb69f153
Author: László Németh 
AuthorDate: Thu Mar 28 00:19:22 2024 +0100
Commit: László Németh 
CommitDate: Thu Mar 28 10:56:58 2024 +0100

Hungarian dictionary v1.8.1

Added new words, fixes, and decomposition data of ~6500 compound words
for better hyphenation. See tdf#158885 for COMPOUNDLEFTHYPHENMIN
implementation in LibreOffice, where Hunspell filters out compound word
boundaries from libhyphen-based hyphenation breaks, restricting hyphenation
near the compound boundary according to spelling and typography rules.

Change-Id: I22a7b70513d0a59d7a31462fcb46efd53cfe8ad7
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165439
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/hu_HU/README_hu_HU.txt b/hu_HU/README_hu_HU.txt
index 8593ed0..468cdee 100644
--- a/hu_HU/README_hu_HU.txt
+++ b/hu_HU/README_hu_HU.txt
@@ -1,17 +1,17 @@
-Magyar Ispell helyesírási szótár – 1.8 szótárállományok morfológiai adatokkal
+Magyar Ispell helyesírási szótár – 1.8.1 szótárállományok morfológiai adatokkal
 
 A szótárállományok a LibreOffice projekt részeként a következő nyílt forráskódú
 licencek bármelyike alapján szabadon felhasználhatóak, de mindenféle garancia 
nélkül:
 
 MPLv2 vagy LesserGPLv3+
 
-(c) Németh László és Godó Ferenc, 2023
+(c) Németh László és Godó Ferenc, 2024
 
 Honlap: http://magyarispell.sf.net
 
 --
 
-Hungarian Hunspell dictionaries version 1.8 with morphological data
+Hungarian Hunspell dictionaries version 1.8.1 with morphological data
 
 These files are part of the LibreOffice project.
 
@@ -26,6 +26,6 @@ Software distributed under these licenses is distributed on 
an "AS IS" basis,
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the licences
 for the specific language governing rights and limitations under the licenses.
 
-2023 (c) László Németh & Ferenc Godó
+2024 (c) László Németh & Ferenc Godó
 
 Home: http://magyarispell.sf.net
diff --git a/hu_HU/hu_HU.aff b/hu_HU/hu_HU.aff
index 4bddd3e..1812c72 100644
--- a/hu_HU/hu_HU.aff
+++ b/hu_HU/hu_HU.aff
@@ -6,11 +6,11 @@
 # GPL/LGPL/MPL license as published by the FSF and Mozilla Foundation.
 #
 #
-# Version: May 2023, 1.8
+# Version: March 2024, 1.8.1
 #
 # Home page: http://magyarispell.sourceforge.net
 #
-# 2002-2023 (c) L�szl� N�meth  and Ferenc God�
+# 2002-2024 (c) L�szl� N�meth  and Ferenc God�
 #
 # Thanks to
 # Tam�s Sz�nt� ,
@@ -30,7 +30,7 @@
 # amelyet N�meth L�szl� �s God� Ferenc k�sz�tett, �s a GPL/LGPL/MPL licenc
 # alatt k�zz�tett a http://magyarispell.sourceforge.net oldalon.
 #
-# Magyar Ispell 1.8, 2023-05
+# Magyar Ispell 1.8.1, 2024-03
 #
 # K�sz�net illeti a k�vetkez�ket:
 #
@@ -52,7 +52,7 @@
 NAME Magyar Ispell helyes�r�si sz�t�r
 LANG hu_HU
 HOME http://magyarispell.sourceforge.net
-VERSION Magyar 1.8
+VERSION Magyar 1.8.1
 SET UTF-8
 KEY öüó|qwertzuiopőú|asdfghjkléáű|íyxcvbnm
 TRY íóútaeslzánorhgkiédmyőpvöbucfjüűxwq-.à
@@ -157,7 +157,7 @@ ICONV fl fl
 # - multicharacter suggestions
 # - well-sorted suggestions
 
-REP 170
+REP 171
 REP í i
 REP i í
 REP ó o
@@ -328,8 +328,9 @@ REP ssal$ sszal
 REP ssé$ sszé
 REP ssá$ sszá
 REP ^megfed megfedd
+REP lengépszer legnépszer REP # lengépszerűbb->legnépszerűbb
 
-AF 1548
+AF 1559
 AF V˯j�L�n�TtYc��l # 1
 AF Um��yiYc� # 2
 AF �CWR̯j���y���Yc� # 3
@@ -369,7 +370,7 @@ AF uQ # 36
 AF �AUʮi���yǿ�Yc� # 37
 AF W̯j�M���RTtvc�� # 38
 AF Uʮi�K�m�QYc��k # 39
-AF tV˯j�L�n�RYc��l # 40
+AF tV˯j�L�n��y���RTYc� # 40
 AF wYUm���ic�k # 41
 AF wYUʮi�K�m�Ssc��k # 42
 AF VN˯j�L���TtYc�� # 43
@@ -546,1339 +547,1350 @@ AF KU
 AF A���UQ # 214
 AF W�yjYc� # 215
 AF Uʮi$s�m�QYc��k # 216
-AF Um�yiYc���K��ǿ�Ss� # 217
-AF UVʮ˯ij��KL��n�m�TtYcklSs # 218
-AF UVʮ˯ij��KL��n�m�QRYckl # 219
-AF Uʮi�K�m�q�Q,�k # 220
-AF W̯j�M���q�Tt,�l # 221
-AF �BVR˯j��q���,� # 222
-AF W̯j�B��q���R,�l # 223
-AF �CWR̯j��q�,� # 224
-AF V˯j�L�n�q�Tt,�l # 225
-AF ��mAFUKQ # 226
-AF �BVR˯j��q�,� # 227
-AF �AUQʮi��q�,� # 228
-AF Uʮi�K�m�q�Ss,� # 229
-AF Uʮi�A��qǿ�Q,�k # 230
-AF Uʮi�K�m�q�Ss,�k # 231
-AF V˯j�L�n�q�R,�l # 232
-AF V˯j�L�n�q���Tt,�l # 233
-AF V˯j�L�n�q���R,�l� # 234
-AF ��nBGVLR # 235
-AF ���BGVLTt # 236
-AF W̯j�M���q���R,�l # 237
-AF �BVR˯j��q���,�� # 238
-AF W̯j�M���q���Tt,�� # 239
-AF V˯j�B��q���R,�l # 240
-AF W̯j�M���q���Tt,�l # 241
-AF W̯j�M���q���R,�l� # 242
-AF W̯j�M���q�R,�l # 243
-AF W̯j�M���q�Tt,� # 244
-AF W̯j�M���q���Tt,� # 245
-AF Um�yiYc���K�q�Ss,� # 246
-AF W̯j�M���q�R,� # 247
-AF Uʮi�K�m�q�Q,� # 248
-AF Uʮi�K�m�qǿ�Ss,� # 249
-AF Uʮi�K�m�qǿ�Ss,�k # 250
-AF Uʮi�A��qǿ�Q,� # 251
-AF �AUQʮi��q�,� # 252
-AF 

core.git: dictionaries

2024-03-22 Thread László Németh (via logerrit)
 dictionaries |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cfd84d8a2add8b5c121d027458ac7692d90b5c7a
Author: László Németh 
AuthorDate: Fri Mar 22 15:47:59 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Fri Mar 22 15:47:59 2024 +0100

Update git submodules

* Update dictionaries from branch 'master'
  to 491736b0e775f7d4a0bfd9ed9ce94ec296e3e988
  - Updated Hungarian hyphenation dictionary to version v20240321

source: 
https://sourceforge.net/projects/magyarispell/files/OOo%20Huhyphn/v20240321-0.1/
Change-Id: If470f5854511cac6f0a355e4d006abf9e3976f90
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165166
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/dictionaries b/dictionaries
index 5da9e11ea767..491736b0e775 16
--- a/dictionaries
+++ b/dictionaries
@@ -1 +1 @@
-Subproject commit 5da9e11ea767529d55630a96fb11d58a3e2b0694
+Subproject commit 491736b0e775f7d4a0bfd9ed9ce94ec296e3e988


dictionaries.git: hu_HU/hyph_hu_HU.dic hu_HU/README_hyph_hu_HU.txt

2024-03-22 Thread László Németh (via logerrit)
 hu_HU/README_hyph_hu_HU.txt |2 
 hu_HU/hyph_hu_HU.dic| 4614 +++-
 2 files changed, 4574 insertions(+), 42 deletions(-)

New commits:
commit 491736b0e775f7d4a0bfd9ed9ce94ec296e3e988
Author: László Németh 
AuthorDate: Fri Mar 22 15:07:48 2024 +0100
Commit: László Németh 
CommitDate: Fri Mar 22 15:47:59 2024 +0100

Updated Hungarian hyphenation dictionary to version v20240321

source: 
https://sourceforge.net/projects/magyarispell/files/OOo%20Huhyphn/v20240321-0.1/
Change-Id: If470f5854511cac6f0a355e4d006abf9e3976f90
Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/165166
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/hu_HU/README_hyph_hu_HU.txt b/hu_HU/README_hyph_hu_HU.txt
index 3f86548..bca57ed 100644
--- a/hu_HU/README_hyph_hu_HU.txt
+++ b/hu_HU/README_hyph_hu_HU.txt
@@ -1,6 +1,6 @@
 % Hungarian hyphenation patterns with non-standard hyphenation patch
 % --
-% Patch version: 2010-10-07
+% Patch version: 2024-03-21
 %
 % Language: Hungarian (hu HU)
 % Origin:   http://www.github.hu/bencenagy/huhyphn
diff --git a/hu_HU/hyph_hu_HU.dic b/hu_HU/hyph_hu_HU.dic
index d419ee1..0924dab 100644
--- a/hu_HU/hyph_hu_HU.dic
+++ b/hu_HU/hyph_hu_HU.dic
@@ -256,7 +256,6 @@ COMPOUNDRIGHTHYPHENMIN 3
 .ba2b1a2rá
 .1ba
 .b2abar
-.ba1ba
 .ba2bál
 .ba1bá
 .ba2b1e2
@@ -689,7 +688,6 @@ COMPOUNDRIGHTHYPHENMIN 3
 .fa1i
 .fa2leg
 .fa1le
-.fa2n1év
 .fa1né
 .fa2r1ont
 .fa1ro
@@ -75142,7 +75140,6 @@ s1s1zé
 össz1e1gye
 összeg2y
 1vi
-vis6sz3e6rek
 vis2s2z
 vis1s1ze
 vissze1re
@@ -91409,15 +91406,9 @@ expressz1ké
 .geron1to
 .geronto1fi
 .geron7t8ofil
-pszichog6ráfi1a
 pszi1c2h
 pszi1c1ho
 pszichog1rá
-pszichográ1fi
-pszichog8ráfi1a
-pszichográ1fi
-pszichog6ráfi1á
-pszichog8ráfi1á
 .tele6g7ráf
 .te1le
 .teleg1rá
@@ -91455,15 +91446,12 @@ c5cs2é./cs=,1,1
 c5cs2á./cs=,1,1
 c5cse2l./cs=,1,1
 c5csa2l./cs=,1,1
-.öc5c1sü/cs=,2,1
 .öc2c2s
 .öc5c1se/cs=,2,1
 .öc5c1sé/cs=,2,1
-aöc5c1sü/cs=,3,1
 aöc2c2s
 aöc5c1se/cs=,3,1
 aöc5c1sé/cs=,3,1
-söc5c1sü/cs=,3,1
 söc2c2s
 söc5c1se/cs=,3,1
 söc5c1sé/cs=,3,1
@@ -91486,7 +91474,6 @@ szkec5csem/cs=,5,1
 szkec5csen/cs=,5,1
 szkec5csed/cs=,5,1
 szkec5cs2e./cs=,5,1
-szkec5c1sü/cs=,5,1
 szkec5csetek/cs=,5,1
 szkeccse1te
 sztrec5cse2t./cs=,6,1
@@ -91501,7 +91488,6 @@ sztrec5csem/cs=,6,1
 sztrec5csen/cs=,6,1
 sztrec5csed/cs=,6,1
 sztrec5cs2e./cs=,6,1
-sztrec5c1sü/cs=,6,1
 sztrec5csetek/cs=,6,1
 sztreccse1te
 rec5c1se/cs=,3,1
@@ -91511,12 +91497,8 @@ puc2c2s
 puc1c1sa
 puc5c1so/cs=,3,1
 puc5c1su/cs=,3,1
-puc5c1si/cs=,3,1
-puc5c1sé/cs=,3,1
 pric5c1se/cs=,4,1
 pric5c1sé/cs=,4,1
-pric5c1si/cs=,4,1
-pric5c1sü/cs=,4,1
 fröc5csök/cs=,4,1
 fröc2c2s
 fröc1c1sö
@@ -91539,41 +91521,28 @@ fröc5csös/cs=,4,1
 ffröc5csös/cs=,4,1
 fröc5csöz/cs=,4,1
 ffröc5csöz/cs=,4,1
-fröc5c1sü/cs=,4,1
-ffröc5c1sü/cs=,4,1
 fröc5csen/cs=,4,1
 fröc1c1se
 ffröc5csen/cs=,4,1
 ffröc1c1se
 fröc5c1sé/cs=,4,1
 ffröc5c1sé/cs=,4,1
-fröc5c1s1i/cs=,4,1
-ffröc5c1s1i/cs=,4,1
 mec5cse2t./cs=,3,1
 mec2c2s
 mec1c1se
-mec5c1sé/cs=,3,1
 mec5csér2t./cs=,3,1
 mec5csi2g./cs=,3,1
 mec1c1si
-mec5csem/cs=,3,1
-mec5csen/cs=,3,1
-mec5csed/cs=,3,1
 mec5cs2e./cs=,3,1
 mec5csek/cs=,3,1
 mec5cse1i/cs=,3,1
-mec5csét/cs=,3,1
 mec5cséb/cs=,3,1
 mec5csérő2l./cs=,3,1
 meccsé1rő
 mec5csér2e./cs=,3,1
 meccsé1re
-mec5cséh/cs=,3,1
 mec5csé1i/cs=,3,1
-mec5csén/cs=,3,1
-mec5csév/cs=,3,1
 mec5cses/cs=,3,1
-mec5c1sü/cs=,3,1
 mec5csetek/cs=,3,1
 meccse1te
 nuc5c1se/cs=,3,1
@@ -91582,14 +91551,11 @@ glec5cser/cs=,4,1
 g2lecc
 glec2c2s
 glec1c1se
-gic5c1se/cs=,3,1
 gic5cse2t./cs=,3,1
 gic2c2s
-gic5c1sé/cs=,3,1
 gic5csér2t./cs=,3,1
 gic5csi2g./cs=,3,1
 gic1c1si
-gic5c1sü/cs=,3,1
 fuc5c1so/cs=,3,1
 fuc2c2s
 ffuc5c1so/cs=,3,1
@@ -95870,7 +95836,6 @@ jes5szus/sz=,3,1
 jes2s2z
 jes1s1zu
 dres5s1zú/sz=,4,1
-dres5s1zi/sz=,4,1
 dos5szi1é/sz=,3,1
 dos2s2z
 dos1s1zi
@@ -95945,7 +95910,6 @@ asszis2z
 dres5s1zé/sz=,4,1
 dres5sz2i2g./sz=,4,1
 as5szonn/sz=,2,1
-proces5szor/sz=,6,1
 proces2s2z
 proces1s1zo
 szeces5s1zi/sz=,6,1
@@ -95953,7 +95917,6 @@ s2ze1ce
 s2zeces2s2z
 stres5szek/sz=,5,1
 stres1s1ze
-stres5sze2l./sz=,5,1
 stres5szelt/sz=,5,1
 stres5szeln/sz=,5,1
 stres5sze1lé/sz=,5,1
@@ -96022,7 +95985,6 @@ fos1s1zí
 ffos1s1zí
 pres5s1zé/sz=,4,1
 dis5s1zo/sz=,3,1
-pres5s1zo/sz=,4,1
 pres5s1zó/sz=,4,1
 bas5s1zi/sz=,3,1
 as5szonán/sz=,2,1
@@ -96121,9 +96083,7 @@ ps5sze2l./sz=,2,1
 ps1s1ze
 rs5sz2á./sz=,2,1
 rs5sza2l./sz=,2,1
-rs5sz2é./sz=,2,1
 rs1s1zé
-rs5sze2l./sz=,2,1
 ús5sz2á./sz=,2,1
 ús5sza2l./sz=,2,1
 üs5sz2é./sz=,2,1
@@ -97294,7 +97254,6 @@ ra2ó1fi
 ős3sz1fi
 ős3sz1fl
 2v1e2lefl
-.rén3szarvas7szán
 íz1p1fi
 2z1átfl
 fly1átfl
@@ -97723,3 +97682,4576 @@ r2t1á1fi
 2b1ujj1fi
 r2t1ofl
 y1év1fi
+.rep8i7k8öltség
+.hős1t2r
+.cé1dé
+.versenye1ge
+.mikrotra1u
+.brin2g1a2u
+.bóra1cé
+.als2ká
+.euros1po
+.bőrpig1me
+.to1a
+.zse2ba
+.tejelő1á
+.bringau2tat
+.zuha1nó
+.virá8g7g8y8ant
+.pszeudosz1fé
+.hip1ho
+.menses1p2robl
+.makrogerinc1te

core.git: cui/source cui/uiconfig editeng/source include/editeng include/linguistic include/unotools include/xmloff lingucomponent/source linguistic/source offapi/com schema/libreoffice svx/sdi sw/inc

2024-03-20 Thread László Németh (via logerrit)
 cui/source/inc/paragrph.hxx |2 
 cui/source/tabpages/paragrph.cxx|   12 
 cui/uiconfig/ui/textflowpage.ui |   50 ++-
 editeng/source/items/paraitem.cxx   |   13 
 include/editeng/editrids.hrc|1 
 include/editeng/hyphenzoneitem.hxx  |4 
 include/editeng/memberids.h |1 
 include/linguistic/lngprophelp.hxx  |4 
 include/unotools/linguprops.hxx |2 
 include/xmloff/xmltoken.hxx |1 
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx   |6 
 linguistic/source/lngprophelp.cxx   |   15 
 offapi/com/sun/star/style/ParagraphProperties.idl   |7 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |9 
 svx/sdi/svxitems.sdi|1 
 sw/inc/inspectorproperties.hrc  |5 
 sw/inc/unoprnms.hxx |2 
 sw/qa/extras/layout/data/tdf158885_compound-remain.fodt |  195 
 sw/qa/extras/layout/data/tdf158885_not_compound-remain.fodt |  195 
 sw/qa/extras/layout/layout2.cxx |   48 ++
 sw/qa/extras/odfexport/data/tdf158885_compound-remain.fodt  |  195 
 sw/qa/extras/odfexport/odfexport2.cxx   |8 
 sw/qa/uitest/styleInspector/styleInspector.py   |   20 -
 sw/qa/uitest/styleInspector/tdf137513.py|2 
 sw/source/core/text/inftxt.cxx  |   17 -
 sw/source/core/unocore/unomapproperties.hxx |2 
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx   |2 
 xmloff/inc/xmlprop.hxx  |2 
 xmloff/source/core/xmltoken.cxx |3 
 xmloff/source/text/txtprmap.cxx |1 
 xmloff/source/token/tokens.txt  |1 
 31 files changed, 799 insertions(+), 27 deletions(-)

New commits:
commit 3a332d9f1cacb3c6f81fcf6c08afa51d091ddff4
Author: László Németh 
AuthorDate: Mon Mar 18 21:55:23 2024 +0100
Commit: László Németh 
CommitDate: Wed Mar 20 13:04:09 2024 +0100

tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundary

Add new hyphenation option "Compound characters at line end",
equivalent of libhyphen's COMPOUNDLEFTHYPHENMIN, to limit bad
pattern based hyphenation of compound words using morphological
analysis of Hunspell.

* Add checkbox to Text Flow in paragraph formatting dialog window
* Store property in paragraph model:
  css::style::ParagraphProperties::ParaHyphenationCompoundMinLeadingChars
* Add ODF import/export (loext:hyphenation-compound-remain-char-count)
* Add ODF unit tests

Note: slower Hunspell based hyphenation is used only if
ParaHyphenationCompoundMinLeadingChars >= 3 (we assume that
libhyphen hyphenation patterns cover the smaller distances
correctly). Hunpell based hyphenation doesn't introduce
new hyphenation breaks, only detects the stem boundaries
from the libhyphen based hyphenation breaks.

Follow-up to commit c899d3608d30f3ab4c2bc193c1fcd765221614a4
"tdf#158885 sw: don't hyphenate right after a stem boundary",
replacing hyphenation zone dependence with the new "Compound
characters at line end".

Note: preset COMPOUNDLEFTHYPHENMIN values aren't loaded yet
from hyphenation dictionaries.

Note: the suffix of the last stem of the compound is always
hyphenated, i.e. the distance limits only hyphenation
inside the stem, not inside its suffix or at the end of the
stem before the suffix.

Change-Id: I46a0288929a66f7453e3ff97fbc5a0c6a01f038f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164983
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 0972203be73f..dde2eda5fac4 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -237,6 +237,8 @@ private:
 std::unique_ptr m_xExtHyphenBeforeBox;
 std::unique_ptr m_xAfterText;
 std::unique_ptr m_xExtHyphenAfterBox;
+std::unique_ptr m_xCompoundBeforeText;
+std::unique_ptr m_xExtCompoundHyphenBeforeBox;
 std::unique_ptr m_xMaxHyphenLabel;
 std::unique_ptr m_xMaxHyphenEdit;
 std::unique_ptr m_xMinWordLabel;
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index a1403b30ea74..abe2a1adc315 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1625,6 +1625,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* 
rOutSet )
  

core.git: cui/source cui/uiconfig editeng/source include/editeng include/unotools include/xmloff offapi/com offapi/UnoApi_offapi.mk svx/sdi sw/CppunitTest_sw_odfexport2.mk sw/inc sw/qa sw/source xmlof

2024-03-04 Thread László Németh (via logerrit)
 cui/source/inc/paragrph.hxx   |5 
 cui/source/tabpages/paragrph.cxx  |   37 -
 cui/uiconfig/ui/textflowpage.ui   |  100 --
 editeng/source/items/paraitem.cxx |   32 
 include/editeng/editrids.hrc  |5 
 include/editeng/hyphenzoneitem.hxx|4 
 include/editeng/memberids.h   |1 
 include/unotools/linguprops.hxx   |2 
 include/xmloff/xmltypes.hxx   |1 
 offapi/UnoApi_offapi.mk   |1 
 offapi/com/sun/star/style/ParagraphProperties.idl |8 +
 offapi/com/sun/star/text/ParagraphHyphenationKeepType.idl |   63 
 svx/sdi/svxitems.sdi  |1 
 sw/CppunitTest_sw_odfexport2.mk   |1 
 sw/inc/inspectorproperties.hrc|1 
 sw/inc/unoprnms.hxx   |1 
 sw/qa/extras/odfexport/data/tdf132599_auto.fodt   |   49 ++
 sw/qa/extras/odfexport/data/tdf132599_page.fodt   |   49 ++
 sw/qa/extras/odfexport/odfexport2.cxx |   27 +++
 sw/qa/uitest/styleInspector/styleInspector.py |   20 +-
 sw/qa/uitest/styleInspector/tdf137513.py  |2 
 sw/source/core/text/inftxt.cxx|   16 +-
 sw/source/core/text/itrform2.cxx  |1 
 sw/source/core/text/porlay.hxx|3 
 sw/source/core/text/widorp.cxx|   42 +
 sw/source/core/unocore/unomapproperties.hxx   |2 
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |1 
 xmloff/inc/xmlprop.hxx|1 
 xmloff/source/text/txtprhdl.cxx   |   13 +
 xmloff/source/text/txtprmap.cxx   |1 
 30 files changed, 423 insertions(+), 67 deletions(-)

New commits:
commit 9574a62add8e4901405e12117e75c86c2d2c2f21
Author: László Németh 
AuthorDate: Thu Feb 29 14:07:34 2024 +0100
Commit: László Németh 
CommitDate: Mon Mar 4 23:39:51 2024 +0100

tdf#132599 cui offapi sw xmloff: implement hyphenate-keep

Both parts of a hyphenated word shall lie within a single
page with ODF paragraph setting fo:hyphenation-keep="page".
The implementation follows the default page layout of
MSO 2016 and newer by shifting the bottom hyphenated line
to the next page (and to the next column, see last note).

Note: this is a MSO DOCX interoperability feature, used
also in DTP software, XSL and CSS.

* Add checkbox/combobox to Text Flow in paragraph dialog
* Store property in paragraph model 
(com::sun::star::style::ParagraphProperties::ParaHyphenationKeep)
* Add ODF import/export
* Add ODF unit tests

New constants of com::sun::star::text::ParagraphHyphenationKeepType,
containing ODF AUTO and PAGE (borrowed from XSL), and for the
planned extension ParaHyphenationKeepType of ParagraphProperties:

– COLUMN (standard XSL value, defined in
  https://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#hyphenation-keep)

– SPREAD and ALWAYS (CSS 4 values of hyphenate-limit-last,
  equivalent of hyphenation-keep, defined in
  https://www.w3.org/TR/css-text-4/#hyphenate-line-limits).

Note: the implementation truncates only a single hyphenated
line, like MSO does: the pages can end in hyphenated
lines (i.e. in the case of consecutive hyphenated lines),
but less often, than before.

Clean-up hyphenation dialog by collecting "Don't hyphenate"
options at the end of the hyphenation settings, and negating them
(similar to MSO and DTP), adding also the new option
"Hyphenate across column and page":

[x] Hyphenate words in CAPS
[x] Hyphenate last word
[x] Hyphenate across column and page

Note: ODF fo:hyphenation-keep has got only "auto" and
"page" attributes, while XSL defines also "column".
Because of the interoperability with MSO and DTP,
fo:hyphenation-keep="page" is interpreted as
XSL "column", avoiding hyphenation at the end
of column, not only at the end of page.

Change-Id: I5c6b7adc0671a5a790568e7bf1d33256e607f85f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164158
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 9e78c8311015..0972203be73f 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -223,6 +223,7 @@ private:
 weld::TriStateEnabled aKeepParaState;
 weld::TriStateEnabled aOrphanState;
 weld::TriStateEnabled aWidowState;
+weld::TriStateEnabled aKeepState;
 
 

core.git: cui/source cui/uiconfig editeng/source include/editeng sw/qa sw/source

2024-01-24 Thread László Németh (via logerrit)
 cui/source/inc/chardlg.hxx|1 
 cui/source/tabpages/chardlg.cxx   |   25 
 cui/uiconfig/ui/positionpage.ui   |   49 
 editeng/source/items/textitem.cxx |   14 +++-
 include/editeng/editrids.hrc  |1 
 include/editeng/nhypitem.hxx  |4 +
 sw/qa/uitest/writer_tests2/formatCharacter.py |5 +
 sw/qa/uitest/writer_tests8/tdf106733.py   |   78 ++
 sw/source/core/access/AccessibilityCheck.cxx  |6 ++
 sw/source/core/bastyp/init.cxx|2 
 sw/source/core/layout/wsfrm.cxx   |1 
 sw/source/core/unocore/unomap.cxx |2 
 sw/source/core/unocore/unomapproperties.hxx   |2 
 13 files changed, 182 insertions(+), 8 deletions(-)

New commits:
commit 03c5a31a0f374a90fbc821718c14dc5f8a385adf
Author: László Németh 
AuthorDate: Wed Jan 24 13:25:21 2024 +0100
Commit: László Németh 
CommitDate: Wed Jan 24 20:57:37 2024 +0100

tdf#106733 sw cui: add CharNoHyphenation checkbox

On Position tab of Character formatting dialog window
as a new checkbox "Exclude from hyphenation" (UX design
by Heiko Tietze).

With this, it's possible to disable hyphenation
with direct character formatting (e.g. combined with
Find All), or using character styles, and setting
"Exclude from hyphenation" in them. This feature
is conformant to the OpenDocument standard, and
unlike the previous locale=None workaround, it keeps
spell checking and locale dependent text layout.

Note: Clear direct formatting (Ctrl-M) is an
alternative way to remove the enabled CharNoHyphenation
(e.g. in version 24.2, where this commit won't
be back-ported).

Follow-up to commit b5e275f47a54bd7fee39dad516a433fde5be872d
"tdf#106733 sw: implement CharNoHyphenation".

Change-Id: I26823e6ec2a3ca39dcf0f7c051d96e638921c589
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162514
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 6d6bf958c2e2..b484c7419b83 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -269,6 +269,7 @@ private:
 
 std::unique_ptr m_xKerningMF;
 std::unique_ptr m_xPairKerningBtn;
+std::unique_ptr m_xNoHyphenationBtn;
 
 voidInitialize();
 voidUpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 
nEscProp, short nEsc );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index e851816c1787..86b183fe4160 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2429,6 +2430,7 @@ SvxCharPositionPage::SvxCharPositionPage(weld::Container* 
pPage, weld::DialogCon
 , m_xScaleWidthMF(m_xBuilder->weld_metric_spin_button("scalewidthsb", 
FieldUnit::PERCENT))
 , m_xKerningMF(m_xBuilder->weld_metric_spin_button("kerningsb", 
FieldUnit::POINT))
 , m_xPairKerningBtn(m_xBuilder->weld_check_button("pairkerning"))
+, m_xNoHyphenationBtn(m_xBuilder->weld_check_button("nohyphenation"))
 {
 m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", 
m_aPreviewWin));
 #ifdef IOS
@@ -2794,6 +2796,16 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
 else
 m_xPairKerningBtn->set_active(false);
 
+// No hyphenation
+nWhich = GetWhich( sal_uInt16(19) );  // number borrowed from 
RES_CHRATR_NOHYPHEN
+if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
+{
+const SvxNoHyphenItem& rItem = static_cast(rSet->Get( nWhich ));
+m_xNoHyphenationBtn->set_active(rItem.GetValue());
+}
+else
+m_xNoHyphenationBtn->set_active(false);
+
 // Scale Width
 nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
 if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
@@ -2874,6 +2886,7 @@ void SvxCharPositionPage::ChangesApplied()
 m_xScaleWidthMF->save_value();
 m_xKerningMF->save_value();
 m_xPairKerningBtn->save_state();
+m_xNoHyphenationBtn->save_state();
 }
 
 bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
@@ -2963,6 +2976,18 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
 else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
 rSet->InvalidateItem(nWhich);
 
+// No hyphenation
+
+nWhich = GetWhich( sal_uInt16(19) );  // number borrowed from 
RES_CHRATR_NOHYPHEN
+
+if (m_xNoHyphenationBtn->get_state_changed_from_saved())
+{
+rSet->Put( SvxNoHyphenItem( m_xNoHyphenationBtn->get_active(), nWhich 
) );
+bModified = true;
+}
+else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
+rSet->InvalidateItem(nWhich);
+
 // Scale Width
 nWhich = GetWhich( 

core.git: Branch 'libreoffice-24-2' - 2 commits - offapi/com sw/inc sw/qa sw/source xmloff/source

2024-01-24 Thread László Németh (via logerrit)
 offapi/com/sun/star/style/CharacterProperties.idl |8 +
 sw/inc/ndtxt.hxx  |2 
 sw/qa/uitest/data/tdf106733.fodt  |   66 
 sw/qa/uitest/writer_tests8/tdf106733.py   |  112 ++
 sw/qa/uitest/writer_tests8/tdf159102.py   |   42 +---
 sw/source/core/inc/txtfrm.hxx |2 
 sw/source/core/text/guess.cxx |7 +
 sw/source/core/text/txtfrm.cxx|4 
 sw/source/core/txtnode/thints.cxx |   25 +++-
 xmloff/source/text/txtprmap.cxx   |2 
 10 files changed, 244 insertions(+), 26 deletions(-)

New commits:
commit de8a6c90c7aa5d26f758a590bad955cd62251702
Author: László Németh 
AuthorDate: Mon Jan 22 15:22:39 2024 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 24 12:12:18 2024 +0100

tdf#106733 sw: fix bad downcast in SwTextNode::GetLang()

Fix bad cast of SvxNoHyphenItem to SvxLanguageItem
reported by :

  /sw/source/core/txtnode/thints.cxx:3560:16: runtime error: downcast of 
address 0x6030005e44d0 which does not point to an object of type 'const 
SvxLanguageItem'
  0x6030005e44d0: note: object is of type 'SvxNoHyphenItem'
   1a 00 00 00  90 e3 d5 77 5c 7f 00 00  00 00 00 00 13 00 be be  16 00 00 
00 92 01 be be  00 00 00 00
^~~
vptr for 'SvxNoHyphenItem'
  #0 0x7f5bda7e8c0c in SwTextNode::GetLang(int, int, unsigned short, 
bool) const /sw/source/core/txtnode/thints.cxx:3560:16

Regression since commit b5e275f47a54bd7fee39dad516a433fde5be872d
"tdf#106733 sw: implement CharNoHyphenation".

Change-Id: I0c6f60a4074f8fd6da26674cace47f5c5e32afd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162401
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 9193e61d3e7b850b3715c848c09434e24855340b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162379
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index a7dff69e1c2e..cf5e1ff1cccf 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3555,7 +3555,7 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, 
const sal_Int32 nLen,
 }
 }
 }
-if( LANGUAGE_DONTKNOW == nRet )
+if( LANGUAGE_DONTKNOW == nRet && !bNoneIfNoHyphenation )
 {
 nRet = static_cast(GetSwAttrSet().Get( 
nWhichId )).GetLanguage();
 if( LANGUAGE_DONTKNOW == nRet )
commit 04c92ff9cfec039f7fc03277de46d77bb3109431
Author: László Németh 
AuthorDate: Fri Jan 19 01:29:34 2024 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 24 12:12:12 2024 +0100

tdf#106733 sw: implement CharNoHyphenation

Implement CharNoHyphenation character property to
disable automatic hyphenation of words in paragraphs
with enabled hyphenation.

Fix also fo:hyphenate mapping to CharNoHyphenation
using automatic inversion of their boolean values
defined by xmloff's XML_TYPE_NBOOL, as suggested by
Michael Stahl.

Update also the test for tdf#159102 to check the available
hyphenation dictionary (also custom hyphenation patterns
work only with supported locales of the hyphenator).

Note: patch of thints.cxx contains also partial revert
of commit 53b289eabb3d265b47bc7fb6cc430291c97f0c0b
"use more TypedWhichId".

Follow-up to commit 73bd04a71e741788a2f2f3b26cc46ddb6a361372
"tdf#106733 xmloff: keep fo:hyphenate in character formatting".

Change-Id: If99b94ddcd44a5c2426e646be149078a3b9773b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162300
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162283
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/offapi/com/sun/star/style/CharacterProperties.idl 
b/offapi/com/sun/star/style/CharacterProperties.idl
index 6502a47b2886..aaff4a569455 100644
--- a/offapi/com/sun/star/style/CharacterProperties.idl
+++ b/offapi/com/sun/star/style/CharacterProperties.idl
@@ -325,7 +325,13 @@ published service CharacterProperties
 
 
 /** This optional property determines if the word can be hyphenated at the
-character.
+character by automatic hyphenation.
+
+Setting to `true` will disable hyphenation enabled by 
ParaIsHyphenation.
+
+Note: implemented since LibreOffice 24.2.
+
+@see ParaIsHyphenation
  */
 [optional, property] boolean CharNoHyphenation;
 
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 3f99919f77b2..352dad71c247 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -720,7 +720,7 @@ public:
 void fillSoftPageBreakList( 

core.git: Branch 'libreoffice-24-2' - sw/qa sw/source

2024-01-22 Thread László Németh (via logerrit)
 sw/qa/uitest/data/tdf159102.fodt|   61 
 sw/qa/uitest/writer_tests8/tdf159102.py |   81 
 sw/source/core/text/portxt.cxx  |   12 +++-
 3 files changed, 151 insertions(+), 3 deletions(-)

New commits:
commit d8116658ecf66d915ae8cf6510a76ee628c45431
Author: László Németh 
AuthorDate: Wed Jan 10 20:41:04 2024 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 23 00:31:18 2024 +0100

tdf#159102 sw smart justify: fix automatic hyphenation

As before with soft hyphens, automatic hyphenation
could result too much shrinking, because of calculating
with an extra non-existing space in the line.

Also try to shrink the line only if a space likely
will be available in it.

During testing, extend user dictionary temporarily
with custom automatic hyphenation to avoid of false tests
because of non-available hyphenation patterns. (Note: maybe
the other tests with non-user dictionary based automatic
hyphenations are not correct.)

Follow-up to commit d511367c102ef2ada0f73dbe81744d39865d58ba
"tdf#195085 sw smart justify: fix bad shrinking at soft hyphen".

Change-Id: I58ecb8f1ea9f55ef2457d7ff4aca6aefa59a6dd1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162199
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 7c1f4dd740c32050480f3ab678805ad3c4c748bb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162219
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/uitest/data/tdf159102.fodt b/sw/qa/uitest/data/tdf159102.fodt
new file mode 100644
index ..dfe9fc18872b
--- /dev/null
+++ b/sw/qa/uitest/data/tdf159102.fodt
@@ -0,0 +1,61 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   true
+   high-resolution
+  
+ 
+ 
+  
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cursus egestas.
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cursus 
egestas.
+  
+ 
+
diff --git a/sw/qa/uitest/writer_tests8/tdf159102.py 
b/sw/qa/uitest/writer_tests8/tdf159102.py
new file mode 100644
index ..07152ada3999
--- /dev/null
+++ b/sw/qa/uitest/writer_tests8/tdf159102.py
@@ -0,0 +1,81 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import 

core.git: sw/source

2024-01-22 Thread László Németh (via logerrit)
 sw/source/core/txtnode/thints.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9193e61d3e7b850b3715c848c09434e24855340b
Author: László Németh 
AuthorDate: Mon Jan 22 15:22:39 2024 +0100
Commit: László Németh 
CommitDate: Mon Jan 22 16:56:43 2024 +0100

tdf#106733 sw: fix bad downcast in SwTextNode::GetLang()

Fix bad cast of SvxNoHyphenItem to SvxLanguageItem
reported by :

  /sw/source/core/txtnode/thints.cxx:3560:16: runtime error: downcast of 
address 0x6030005e44d0 which does not point to an object of type 'const 
SvxLanguageItem'
  0x6030005e44d0: note: object is of type 'SvxNoHyphenItem'
   1a 00 00 00  90 e3 d5 77 5c 7f 00 00  00 00 00 00 13 00 be be  16 00 00 
00 92 01 be be  00 00 00 00
^~~
vptr for 'SvxNoHyphenItem'
  #0 0x7f5bda7e8c0c in SwTextNode::GetLang(int, int, unsigned short, 
bool) const /sw/source/core/txtnode/thints.cxx:3560:16

Regression since commit b5e275f47a54bd7fee39dad516a433fde5be872d
"tdf#106733 sw: implement CharNoHyphenation".

Change-Id: I0c6f60a4074f8fd6da26674cace47f5c5e32afd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162401
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 184866daf3e0..5b78ea29eb84 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3555,7 +3555,7 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, 
const sal_Int32 nLen,
 }
 }
 }
-if( LANGUAGE_DONTKNOW == nRet )
+if( LANGUAGE_DONTKNOW == nRet && !bNoneIfNoHyphenation )
 {
 nRet = static_cast(GetSwAttrSet().Get( 
nWhichId )).GetLanguage();
 if( LANGUAGE_DONTKNOW == nRet )


core.git: Branch 'libreoffice-24-2' - sw/qa xmloff/inc xmloff/source

2024-01-22 Thread László Németh (via logerrit)
 sw/qa/extras/odfexport/data/tdf106733.fodt |   66 +
 sw/qa/extras/odfexport/odfexport2.cxx  |   20 
 xmloff/inc/xmlprop.hxx |1 
 xmloff/source/text/txtprmap.cxx|4 -
 4 files changed, 89 insertions(+), 2 deletions(-)

New commits:
commit 05292d3fd50c64ac0b2a927334c39fe63aa3a108
Author: László Németh 
AuthorDate: Thu Jan 18 14:53:24 2024 +0100
Commit: Michael Stahl 
CommitDate: Mon Jan 22 13:01:10 2024 +0100

tdf#106733 xmloff: keep fo:hyphenate in character formatting

In the case of character formatting, map fo:hyphenate to the
unused CharNoHyphenation character property to keep it
during ODF import/export instead of losing it completely.

This is the first step to disable hyphenation for single
words or text spans in paragraphs with automatic hyphenation.

Note: using fo:hyphenate as character property is part of
the ODF standard.

Note: the old workaround to disable hyphenation, changing
the language of the text to None had got some serious fallbacks:
losing spell checking and losing language-dependent text
layout (supported by both OpenType and Graphite font engines
in LibreOffice).

Change-Id: I9565c3efbbb6e6d970fb03710e8c932ad72ab57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162257
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 956f81ebc9d70507a4a976bfe42c99175dbf3632)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162272
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/odfexport/data/tdf106733.fodt 
b/sw/qa/extras/odfexport/data/tdf106733.fodt
new file mode 100644
index ..fa9a02440573
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf106733.fodt
@@ -0,0 +1,66 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+ 
+ 
+  
+   
+   
+  
+  
+  
+   
+  
+  
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+   
+   
+  
+  
+   
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   Hyphenate
+   The Earth is no different to any other 
celestial body out there in space. It merely moves along in space inertially. 
Even just one inch above the surface of the Earth is space, except that it has an atmosphere.
+   Don’t hyphenate (direct 
formatting)
+   The Earth is no different to any other 
celestial body out there in space. It merely moves along in space inertially. 
Even just one inch above the surface of the Earth is space, except that it has an atmosphere.
+   Don’t hyphenate 
(character style)
+   The Earth is no different to any other 
celestial body out there in space. It merely moves along in space inertially. 
Even just one inch above the surface of the Earth is space, except that it has an 
atmosphere.

core.git: offapi/com sw/inc sw/qa sw/source xmloff/source

2024-01-19 Thread László Németh (via logerrit)
 offapi/com/sun/star/style/CharacterProperties.idl |8 +
 sw/inc/ndtxt.hxx  |2 
 sw/qa/uitest/data/tdf106733.fodt  |   66 
 sw/qa/uitest/writer_tests8/tdf106733.py   |  112 ++
 sw/qa/uitest/writer_tests8/tdf159102.py   |   42 +---
 sw/source/core/inc/txtfrm.hxx |2 
 sw/source/core/text/guess.cxx |7 +
 sw/source/core/text/txtfrm.cxx|4 
 sw/source/core/txtnode/thints.cxx |   23 +++-
 xmloff/source/text/txtprmap.cxx   |2 
 10 files changed, 243 insertions(+), 25 deletions(-)

New commits:
commit b5e275f47a54bd7fee39dad516a433fde5be872d
Author: László Németh 
AuthorDate: Fri Jan 19 01:29:34 2024 +0100
Commit: László Németh 
CommitDate: Fri Jan 19 17:37:41 2024 +0100

tdf#106733 sw: implement CharNoHyphenation

Implement CharNoHyphenation character property to
disable automatic hyphenation of words in paragraphs
with enabled hyphenation.

Fix also fo:hyphenate mapping to CharNoHyphenation
using automatic inversion of their boolean values
defined by xmloff's XML_TYPE_NBOOL, as suggested by
Michael Stahl.

Update also the test for tdf#159102 to check the available
hyphenation dictionary (also custom hyphenation patterns
work only with supported locales of the hyphenator).

Note: patch of thints.cxx contains also partial revert
of commit 53b289eabb3d265b47bc7fb6cc430291c97f0c0b
"use more TypedWhichId".

Follow-up to commit 73bd04a71e741788a2f2f3b26cc46ddb6a361372
"tdf#106733 xmloff: keep fo:hyphenate in character formatting".

Change-Id: If99b94ddcd44a5c2426e646be149078a3b9773b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162300
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/offapi/com/sun/star/style/CharacterProperties.idl 
b/offapi/com/sun/star/style/CharacterProperties.idl
index 6502a47b2886..aaff4a569455 100644
--- a/offapi/com/sun/star/style/CharacterProperties.idl
+++ b/offapi/com/sun/star/style/CharacterProperties.idl
@@ -325,7 +325,13 @@ published service CharacterProperties
 
 
 /** This optional property determines if the word can be hyphenated at the
-character.
+character by automatic hyphenation.
+
+Setting to `true` will disable hyphenation enabled by 
ParaIsHyphenation.
+
+Note: implemented since LibreOffice 24.2.
+
+@see ParaIsHyphenation
  */
 [optional, property] boolean CharNoHyphenation;
 
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 3f99919f77b2..352dad71c247 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -720,7 +720,7 @@ public:
 void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const;
 
 LanguageType GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0,
-sal_uInt16 nScript = 0 ) const;
+sal_uInt16 nScript = 0, bool bNoneIfNoHyphenation = false 
) const;
 
 /// in ndcopy.cxx
 bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx.
diff --git a/sw/qa/uitest/data/tdf106733.fodt b/sw/qa/uitest/data/tdf106733.fodt
new file mode 100644
index ..fa9a02440573
--- /dev/null
+++ b/sw/qa/uitest/data/tdf106733.fodt
@@ -0,0 +1,66 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 

core.git: sw/qa xmloff/inc xmloff/source

2024-01-18 Thread László Németh (via logerrit)
 sw/qa/extras/odfexport/data/tdf106733.fodt |   66 +
 sw/qa/extras/odfexport/odfexport2.cxx  |   20 
 xmloff/inc/xmlprop.hxx |1 
 xmloff/source/text/txtprmap.cxx|4 -
 4 files changed, 89 insertions(+), 2 deletions(-)

New commits:
commit 73bd04a71e741788a2f2f3b26cc46ddb6a361372
Author: László Németh 
AuthorDate: Thu Jan 18 14:53:24 2024 +0100
Commit: László Németh 
CommitDate: Fri Jan 19 00:42:36 2024 +0100

tdf#106733 xmloff: keep fo:hyphenate in character formatting

In the case of character formatting, map fo:hyphenate to the
unused CharNoHyphenation character property to keep it
during ODF import/export instead of losing it completely.

This is the first step to disable hyphenation for single
words or text spans in paragraphs with automatic hyphenation.

Note: using fo:hyphenate as character property is part of
the ODF standard.

Note: the old workaround to disable hyphenation, changing
the language of the text to None had got some serious fallbacks:
losing spell checking and losing language-dependent text
layout (supported by both OpenType and Graphite font engines
in LibreOffice).

Change-Id: I9565c3efbbb6e6d970fb03710e8c932ad72ab57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162257
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/odfexport/data/tdf106733.fodt 
b/sw/qa/extras/odfexport/data/tdf106733.fodt
new file mode 100644
index ..fa9a02440573
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf106733.fodt
@@ -0,0 +1,66 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+ 
+ 
+  
+   
+   
+  
+  
+  
+   
+  
+  
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+   
+   
+  
+  
+   
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   Hyphenate
+   The Earth is no different to any other 
celestial body out there in space. It merely moves along in space inertially. 
Even just one inch above the surface of the Earth is space, except that it has an atmosphere.
+   Don’t hyphenate (direct 
formatting)
+   The Earth is no different to any other 
celestial body out there in space. It merely moves along in space inertially. 
Even just one inch above the surface of the Earth is space, except that it has an atmosphere.
+   Don’t hyphenate 
(character style)
+   The Earth is no different to any other 
celestial body out there in space. It merely moves along in space inertially. 
Even just one inch above the surface of the Earth is space, except that it has an 
atmosphere.
+   
+  
+ 
+
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index b64811866a10..708a4f94cba0 100644
--- 

core.git: sw/qa sw/source

2024-01-17 Thread László Németh (via logerrit)
 sw/qa/uitest/data/tdf159102.fodt|   61 
 sw/qa/uitest/writer_tests8/tdf159102.py |   81 
 sw/source/core/text/portxt.cxx  |   12 +++-
 3 files changed, 151 insertions(+), 3 deletions(-)

New commits:
commit 8b393bba9bd4f8988457f3a78b0306462bf2
Author: László Németh 
AuthorDate: Wed Jan 10 20:41:04 2024 +0100
Commit: László Németh 
CommitDate: Thu Jan 18 01:29:38 2024 +0100

tdf#159102 sw smart justify: fix automatic hyphenation

As before with soft hyphens, automatic hyphenation
could result too much shrinking, because of calculating
with an extra non-existing space in the line.

Also try to shrink the line only if a space likely
will be available in it.

During testing, extend user dictionary temporarily
with custom automatic hyphenation to avoid of false tests
because of non-available hyphenation patterns. (Note: maybe
the other tests with non-user dictionary based automatic
hyphenations are not correct.)

Follow-up to commit d511367c102ef2ada0f73dbe81744d39865d58ba
"tdf#195085 sw smart justify: fix bad shrinking at soft hyphen".

Change-Id: I58ecb8f1ea9f55ef2457d7ff4aca6aefa59a6dd1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162199
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/uitest/data/tdf159102.fodt b/sw/qa/uitest/data/tdf159102.fodt
new file mode 100644
index ..dfe9fc18872b
--- /dev/null
+++ b/sw/qa/uitest/data/tdf159102.fodt
@@ -0,0 +1,61 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   true
+   high-resolution
+  
+ 
+ 
+  
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cursus egestas.
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cursus 
egestas.
+  
+ 
+
diff --git a/sw/qa/uitest/writer_tests8/tdf159102.py 
b/sw/qa/uitest/writer_tests8/tdf159102.py
new file mode 100644
index ..07152ada3999
--- /dev/null
+++ b/sw/qa/uitest/writer_tests8/tdf159102.py
@@ -0,0 +1,81 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+# handle tdf#119908 smart justify with automatic hyphenation

core.git: Branch 'libreoffice-7-6' - editeng/inc editeng/source sw/qa

2024-01-11 Thread László Németh (via logerrit)
 editeng/inc/editattr.hxx|1 
 editeng/source/editeng/impedit3.cxx |4 ++
 sw/qa/extras/layout/data/tdf129357.fodt |   48 
 sw/qa/extras/layout/layout2.cxx |   17 +++
 4 files changed, 70 insertions(+)

New commits:
commit f62c5ae27190b1f338fbd68ff03df9423b97f7ba
Author: László Németh 
AuthorDate: Fri Dec 8 08:13:42 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Jan 11 13:18:07 2024 +0100

tdf#129357 editeng: show soft hyphen in text boxes and shapes

Shapes and text boxes didn't show the optional hyphen
at line break.

Change-Id: I5cc842964fc91571e5c55995981de697da966b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160453
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 1e121850c3a42bb0ccbf90fccd7870de3b27d11b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160471
Reviewed-by: Michael Stahl 

diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx
index fcc14ba5ce25..0a042dbf8d7e 100644
--- a/editeng/inc/editattr.hxx
+++ b/editeng/inc/editattr.hxx
@@ -53,6 +53,7 @@ class SfxGrabBagItem;
 
 #define CH_FEATURE_OLD  (sal_uInt8) 0xFF
 #define CH_FEATURE  u'\x0001'
+#define CH_SOFTHYPHEN   u'\x00AD'
 
 // DEF_METRIC: For my pool, the DefMetric should always appear when
 // GetMetric (nWhich)!
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index ce79f8bfe1d2..f9ba6282fdb3 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2021,6 +2021,10 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
 i18n::LineBreakResults aLBR = _xBI->getLineBreak(
 pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, 
aHyphOptions, aUserOptions );
 nBreakPos = aLBR.breakIndex;
+
+// show soft hyphen
+if ( nBreakPos && CH_SOFTHYPHEN == pNode->GetString()[ 
sal_Int32(nBreakPos) - 1 ] )
+bHyphenated = true;
 }
 else
 {
diff --git a/sw/qa/extras/layout/data/tdf129357.fodt 
b/sw/qa/extras/layout/data/tdf129357.fodt
new file mode 100644
index ..9cf563d71710
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf129357.fodt
@@ -0,0 +1,48 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2023-12-07T18:38:07.3012800122023-12-07T18:42:50.197688001PT4M44S1LibreOfficeDev/24.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/47e8abdafa26e64647e32d8577cb27e54cd843d1
+ 
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+ 
+  hyphena­tion
+ 
+
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 9cbae8ae114a..d57788f5413c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -519,6 +519,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150790)
 "colors", "#Bookmark 2 Bookmark End#Bookmark 3 Bookmark 
Start");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357)
+{
+createSwDoc("tdf129357.fodt");
+SwDoc* pDoc = getSwDoc();
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Dump the rendering of the first page as an XML file.
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+// visible soft hyphen
+assertXPathContent(pXmlDoc, 
"/metafile/push/push/push/push/push/textarray[2]/text", "-");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering)
 {
 createSwDoc("tdf42748.fodt");


core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2024-01-10 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf159026.docx |binary
 sw/qa/extras/uiwriter/uiwriter8.cxx   |   58 ++
 sw/source/core/frmedt/tblsel.cxx  |4 +-
 3 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit 1b79e993fefbf102466f7a0e394e71478a643896
Author: László Németh 
AuthorDate: Mon Jan 8 01:28:36 2024 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 10 15:08:45 2024 +0100

tdf#159026 sw: fix Undo crash with tracked floating table deletion

In Hide Changes mode, tracked deletion of a floating table,
and after that, its frame resulted a crash during Undos.

Regression from commit 0c6221e1545e7b96d9df23cdc24302c28ae935b8
"tdf#148227 sw: fix Undo of tracked row deletion in Hide Changes mode".

Change-Id: I3fd88a30df2739ce8a3cdc24da07684a3ac5a41b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161777
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit f5a00d9ffb8325f4b9fed21b5c96ca005e11b1bb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161758
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit de7e0bc32d3629063f13250ae3b7c9f934fba046)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161855
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/uiwriter/data/tdf159026.docx 
b/sw/qa/extras/uiwriter/data/tdf159026.docx
new file mode 100644
index ..65bfaae3e423
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf159026.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 04655535c2d5..a928bea1695d 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -15,9 +15,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -236,6 +238,62 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf159026)
+{
+// load a floating table (tables in DOCX footnotes
+// imported as floating tables in Writer)
+createSwDoc("tdf159026.docx");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+// hide changes
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+// select table with SelectionSupplier
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xSelSupplier(xModel->getCurrentController(),
+  
uno::UNO_QUERY_THROW);
+// select floating table (table in a frame)
+xSelSupplier->select(xIndexAccess->getByIndex(0));
+
+// delete table with track changes
+dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+
+// tracked table deletion
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+// hidden table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//tab", 0);
+
+// delete frame
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess2(xTextFramesSupplier->getTextFrames(),
+  uno::UNO_QUERY);
+xSelSupplier->select(xIndexAccess2->getByIndex(0));
+dispatchCommand(mxComponent, ".uno:Delete", {});
+
+// undo frame deletion
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+// undo tracked table deletion
+
+// This resulted crashing
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347)
 {
 // load a 2-row table, set Hide Changes mode and delete the table with 
change tracking
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 48a92366509c..ec56a5285675 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2383,7 +2383,9 @@ void FndBox_::MakeFrames( SwTable  )
 for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j )
 {
 SwTableLine * pLine = rTable.GetTabLines()[j];
-if ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) )
+if ( ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) ) &&
+ 

core.git: Branch 'libreoffice-24-2' - sw/qa sw/source

2024-01-10 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf159085.fodt |   61 
 sw/qa/extras/layout/layout3.cxx |   24 
 sw/source/core/text/portxt.cxx  |9 
 3 files changed, 93 insertions(+), 1 deletion(-)

New commits:
commit 6bd230862605760bd4357e6e4bba2c91dcbe5438
Author: László Németh 
AuthorDate: Tue Jan 9 13:35:23 2024 +0100
Commit: László Németh 
CommitDate: Wed Jan 10 13:11:50 2024 +0100

tdf#159085 sw smart justify: fix bad shrinking at soft hyphen

Soft hyphen in the word could result too much shrinking,
calculating with an extra (non-existing) space.

Change-Id: If8b7af40ff50d12c0f2428a6f2475e261fbd0f42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161827
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit f35d7b0484205e6c8daef795f787e5d6cbc88fc8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161769
Tested-by: László Németh 

diff --git a/sw/qa/extras/layout/data/tdf159085.fodt 
b/sw/qa/extras/layout/data/tdf159085.fodt
new file mode 100644
index ..efd0e98e9213
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf159085.fodt
@@ -0,0 +1,61 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   true
+   high-resolution
+  
+ 
+ 
+  
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cur­sus egestas.
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cur­sus 
egestas.
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index f660334012d0..e17eaa108a30 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -244,6 +244,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
 "venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis ");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159085)
+{
+createSwDoc("tdf159085.fodt");
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// This was "... cursus" instead of breaking the word at soft hyphen
+assertXPath(
+pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr, 
"portion"_ostr,
+u"venenatis, quis commodo dolor posuere. Curabitur dignissim sapien 
quis cur­"_ustr);
+
+// This was 

core.git: sw/qa sw/source

2024-01-09 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf159085.fodt |   61 
 sw/qa/extras/layout/layout3.cxx |   24 
 sw/source/core/text/portxt.cxx  |9 
 3 files changed, 93 insertions(+), 1 deletion(-)

New commits:
commit d511367c102ef2ada0f73dbe81744d39865d58ba
Author: László Németh 
AuthorDate: Tue Jan 9 13:35:23 2024 +0100
Commit: László Németh 
CommitDate: Tue Jan 9 20:03:00 2024 +0100

tdf#195085 sw smart justify: fix bad shrinking at soft hyphen

Soft hyphen in the word could result too much shrinking,
calculating with an extra (non-existing) space.

Change-Id: If8b7af40ff50d12c0f2428a6f2475e261fbd0f42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161827
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/data/tdf159085.fodt 
b/sw/qa/extras/layout/data/tdf159085.fodt
new file mode 100644
index ..efd0e98e9213
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf159085.fodt
@@ -0,0 +1,61 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   true
+   high-resolution
+  
+ 
+ 
+  
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cur­sus egestas.
+   venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis cur­sus 
egestas.
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index da882cba559d..e4bfc5195b4b 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -246,6 +246,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
 "venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis ");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159085)
+{
+createSwDoc("tdf159085.fodt");
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// This was "... cursus" instead of breaking the word at soft hyphen
+assertXPath(
+pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr, 
"portion"_ostr,
+u"venenatis, quis commodo dolor posuere. Curabitur dignissim sapien 
quis cur­"_ustr);
+
+// This was "... cursus" instead of breaking the word at soft hyphen
+assertXPath(
+pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[1]"_ostr, 
"portion"_ostr,

core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-09 Thread László Németh (via logerrit)
 sw/source/core/text/porlin.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ac96909729152d01b0a20c8e6ca204e6bc3d7160
Author: László Németh 
AuthorDate: Fri Jan 5 08:00:19 2024 +0100
Commit: László Németh 
CommitDate: Tue Jan 9 10:36:08 2024 +0100

tdf#159034 sw smart justify: fix position of shading

E.g. shading of soft hyphens didn't follow space shrinking.

Follow-up to commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position".

Change-Id: Icdce4736d9c76ff1fbe9dd140b9f1c091e605452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161654
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 7a1470fd97d52c5196a0800dd64f4c8899909c4b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161762
Tested-by: László Németh 

diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 4f93c9d727ce..a420d64301ff 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -89,8 +89,8 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
 const sal_uInt16 nHalfView = nViewWidth / 2;
 sal_uInt16 nLastWidth = pLast->Width() + pLast->ExtraBlankWidth();
 
-if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() )
-nLastWidth += pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf );
+if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd(/*bShrink=*/true) )
+nLastWidth += pLast->CalcSpacing( rInf.GetSpaceAdd(/*bShrink=*/true), 
rInf );
 
 sal_uInt16 nPos;
 SwTextPaintInfo aInf( rInf );


core.git: Branch 'libreoffice-24-2' - sw/qa sw/source

2024-01-09 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf159026.docx |binary
 sw/qa/extras/uiwriter/uiwriter8.cxx   |   58 ++
 sw/source/core/frmedt/tblsel.cxx  |4 +-
 3 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit de7e0bc32d3629063f13250ae3b7c9f934fba046
Author: László Németh 
AuthorDate: Mon Jan 8 01:28:36 2024 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 9 09:37:13 2024 +0100

tdf#159026 sw: fix Undo crash with tracked floating table deletion

In Hide Changes mode, tracked deletion of a floating table,
and after that, its frame resulted a crash during Undos.

Regression from commit 0c6221e1545e7b96d9df23cdc24302c28ae935b8
"tdf#148227 sw: fix Undo of tracked row deletion in Hide Changes mode".

Change-Id: I3fd88a30df2739ce8a3cdc24da07684a3ac5a41b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161777
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit f5a00d9ffb8325f4b9fed21b5c96ca005e11b1bb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161758
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf159026.docx 
b/sw/qa/extras/uiwriter/data/tdf159026.docx
new file mode 100644
index ..65bfaae3e423
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf159026.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 9aaafa1e6967..4fa027b0515b 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -15,9 +15,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -239,6 +241,62 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf159026)
+{
+// load a floating table (tables in DOCX footnotes
+// imported as floating tables in Writer)
+createSwDoc("tdf159026.docx");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+// hide changes
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+// select table with SelectionSupplier
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xSelSupplier(xModel->getCurrentController(),
+  
uno::UNO_QUERY_THROW);
+// select floating table (table in a frame)
+xSelSupplier->select(xIndexAccess->getByIndex(0));
+
+// delete table with track changes
+dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+
+// tracked table deletion
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+// hidden table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//tab"_ostr, 0);
+
+// delete frame
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess2(xTextFramesSupplier->getTextFrames(),
+  uno::UNO_QUERY);
+xSelSupplier->select(xIndexAccess2->getByIndex(0));
+dispatchCommand(mxComponent, ".uno:Delete", {});
+
+// undo frame deletion
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+// undo tracked table deletion
+
+// This resulted crashing
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347)
 {
 // load a 2-row table, set Hide Changes mode and delete the table with 
change tracking
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 48a92366509c..ec56a5285675 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2383,7 +2383,9 @@ void FndBox_::MakeFrames( SwTable  )
 for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j )
 {
 SwTableLine * pLine = rTable.GetTabLines()[j];
-if ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) )
+if ( ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) ) &&
+// tdf#159026 fix Undo crash with floating tables
+pUpperFrame->GetUpper() )
 

core.git: sw/qa sw/source

2024-01-08 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf159026.docx |binary
 sw/qa/extras/uiwriter/uiwriter8.cxx   |   58 ++
 sw/source/core/frmedt/tblsel.cxx  |4 +-
 3 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit 14c0f2cd140da66d38a8282332f2cb734bb74e39
Author: László Németh 
AuthorDate: Mon Jan 8 01:28:36 2024 +0100
Commit: László Németh 
CommitDate: Mon Jan 8 13:20:11 2024 +0100

tdf#159026 sw: fix Undo crash with tracked floating table deletion

In Hide Changes mode, tracked deletion of a floating table,
and after that, its frame resulted a crash during Undos.

Regression from commit 0c6221e1545e7b96d9df23cdc24302c28ae935b8
"tdf#148227 sw: fix Undo of tracked row deletion in Hide Changes mode".

Change-Id: I3fd88a30df2739ce8a3cdc24da07684a3ac5a41b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161777
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data/tdf159026.docx 
b/sw/qa/extras/uiwriter/data/tdf159026.docx
new file mode 100644
index ..65bfaae3e423
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf159026.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 2cfcc2066c41..4aebc11b237a 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -15,9 +15,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -241,6 +243,62 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf159026)
+{
+// load a floating table (tables in DOCX footnotes
+// imported as floating tables in Writer)
+createSwDoc("tdf159026.docx");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+// hide changes
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+// select table with SelectionSupplier
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xSelSupplier(xModel->getCurrentController(),
+  
uno::UNO_QUERY_THROW);
+// select floating table (table in a frame)
+xSelSupplier->select(xIndexAccess->getByIndex(0));
+
+// delete table with track changes
+dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+
+// tracked table deletion
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+// hidden table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//tab"_ostr, 0);
+
+// delete frame
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess2(xTextFramesSupplier->getTextFrames(),
+  uno::UNO_QUERY);
+xSelSupplier->select(xIndexAccess2->getByIndex(0));
+dispatchCommand(mxComponent, ".uno:Delete", {});
+
+// undo frame deletion
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+// undo tracked table deletion
+
+// This resulted crashing
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347)
 {
 // load a 2-row table, set Hide Changes mode and delete the table with 
change tracking
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 48a92366509c..ec56a5285675 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2383,7 +2383,9 @@ void FndBox_::MakeFrames( SwTable  )
 for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j )
 {
 SwTableLine * pLine = rTable.GetTabLines()[j];
-if ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) )
+if ( ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) ) &&
+// tdf#159026 fix Undo crash with floating tables
+pUpperFrame->GetUpper() )
 ::lcl_InsertRow( *pLine,
 static_cast(pUpperFrame), 
pSibling );
 }


core.git: sw/source

2024-01-07 Thread László Németh (via logerrit)
 sw/source/core/text/porlin.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7a1470fd97d52c5196a0800dd64f4c8899909c4b
Author: László Németh 
AuthorDate: Fri Jan 5 08:00:19 2024 +0100
Commit: László Németh 
CommitDate: Mon Jan 8 01:37:35 2024 +0100

tdf#159034 sw smart justify: fix position of shading

E.g. shading of soft hyphens didn't follow space shrinking.

Follow-up to commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position".

Change-Id: Icdce4736d9c76ff1fbe9dd140b9f1c091e605452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161654
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 4f93c9d727ce..a420d64301ff 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -89,8 +89,8 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
 const sal_uInt16 nHalfView = nViewWidth / 2;
 sal_uInt16 nLastWidth = pLast->Width() + pLast->ExtraBlankWidth();
 
-if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() )
-nLastWidth += pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf );
+if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd(/*bShrink=*/true) )
+nLastWidth += pLast->CalcSpacing( rInf.GetSpaceAdd(/*bShrink=*/true), 
rInf );
 
 sal_uInt16 nPos;
 SwTextPaintInfo aInf( rInf );


core.git: Branch 'libreoffice-24-2' - sw/qa sw/source

2024-01-05 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf124795-5.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |6 ++
 sw/source/core/text/portxt.cxx |1 +
 3 files changed, 7 insertions(+)

New commits:
commit 9e201cbdc31caca694e067ee0f66cce2b07c9778
Author: László Németh 
AuthorDate: Fri Jan 5 01:11:34 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jan 5 15:49:09 2024 +0100

tdf#159032 sw smart justify: fix crash with complex tables

Regression from commit 36bfc86e27fa03ee16f87819549ab126c5a68cac
"tdf#119908 tdf#158776 sw smart justify: shrink only spaces"

Change-Id: Ia3f39ad6549ea909bfe327ff8c8cbde821b90f46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161652
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 99f022bdeb2817cceffc90ff3b3439cdc4550424)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161638
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx
new file mode 100644
index ..19fd5f49c89c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 0656bb868795..4b0fbdd13716 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1414,6 +1414,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158436, "tdf158436.docx")
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf159032, "tdf124795-5.docx")
+{
+// This resulted crashing
+CPPUNIT_ASSERT_EQUAL(57, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testHyphenationAuto)
 {
 loadAndReload("hyphenation.odt");
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index bcc547d1796b..3dcdf37ecc90 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -308,6 +308,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo  )
 // adjusted line by shrinking spaces using the know space count from the 
first Guess() call
 const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
 if ( bFull && rAdjust == SvxAdjust::Block &&
+ aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
  rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
 DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
  // tdf#158436 avoid shrinking at underflow, e.g. no-break space after 
a


core.git: sw/qa sw/source

2024-01-04 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf124795-5.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |6 ++
 sw/source/core/text/portxt.cxx |1 +
 3 files changed, 7 insertions(+)

New commits:
commit 96b3ed389fa5d434ed738d7f84dada4b6e2fabec
Author: László Németh 
AuthorDate: Fri Jan 5 01:11:34 2024 +0100
Commit: László Németh 
CommitDate: Fri Jan 5 06:08:09 2024 +0100

tdf#159032 sw smart justify: fix crash with complex tables

Regression from commit 36bfc86e27fa03ee16f87819549ab126c5a68cac
"tdf#119908 tdf#158776 sw smart justify: shrink only spaces"

Change-Id: Ia3f39ad6549ea909bfe327ff8c8cbde821b90f46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161652
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx
new file mode 100644
index ..19fd5f49c89c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 0656bb868795..4b0fbdd13716 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1414,6 +1414,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158436, "tdf158436.docx")
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf159032, "tdf124795-5.docx")
+{
+// This resulted crashing
+CPPUNIT_ASSERT_EQUAL(57, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testHyphenationAuto)
 {
 loadAndReload("hyphenation.odt");
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 0372a357df6e..228e2e02e4d6 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -308,6 +308,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo  )
 // adjusted line by shrinking spaces using the know space count from the 
first Guess() call
 const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
 if ( bFull && rAdjust == SvxAdjust::Block &&
+ aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
  rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
 DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
  // tdf#158436 avoid shrinking at underflow, e.g. no-break space after 
a


core.git: include/linguistic lingucomponent/source linguistic/source

2023-12-31 Thread László Németh (via logerrit)
 include/linguistic/lngprophelp.hxx|8 
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |  181 ++
 linguistic/source/lngprophelp.cxx |   15 +
 3 files changed, 202 insertions(+), 2 deletions(-)

New commits:
commit c899d3608d30f3ab4c2bc193c1fcd765221614a4
Author: László Németh 
AuthorDate: Sun Dec 31 14:30:05 2023 +0100
Commit: László Németh 
CommitDate: Mon Jan 1 00:42:35 2024 +0100

tdf#158885 sw: don't hyphenate right after a stem boundary

in compound words to get better typography or orthography
with more readable text, if hyphenation zone is enabled.

If there are multiple possible break points in the word
according to the libhyphen based hyphenation, keep only
the best ones using Hunspell morphological data
based on compound word decomposition of non-dictionary
words (pa: fields), and extra morphological data of dictionary
words (hy: fields) or their combination.

For readability and tradition, orthography and typography
prefer or only allow hyphenation between stems in compound
words in several languages, like Danish, Dutch, German,
Hungarian, Norwegian and Sweden.

Hyphenation zone is to avoid of too much or bad hyphenation.
Preferring stem boundaries for hyphenation within the hyphenation
zone is a natural extension of  it, i.e. skip hyphenation within
stems, if there is stem boundary within the hyphenation zone.

Now skip break points after skip boundaries, if their
distance is 3 or less characters (COMPOUNDLEFTHYPHENMIN = 4).

Skip also break points on stem boundaries, if there is a
weighted stem boundary before them within 3 characters.

Weighted stem boundaries are there between the pa: fields,
(stems resulted by the compound word decomposition),
or in hy: field, boundaries marked by double || instead of
a single |.

More information: man (5) hunspell, and option -m hunspell.

Note: break points skipped only in the last stems for languages
with fogemorphemes, yet, because of their incomplete Hunspell
output for morphological analysis.

Change-Id: I739908716d11a9c2db0c9d36fba8657ba6f53bee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161498
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/include/linguistic/lngprophelp.hxx 
b/include/linguistic/lngprophelp.hxx
index 85b32b7cec3e..a3ad3d2665ac 100644
--- a/include/linguistic/lngprophelp.hxx
+++ b/include/linguistic/lngprophelp.hxx
@@ -242,13 +242,15 @@ class PropertyHelper_Hyphen final :
 // default values
 sal_Int16   nHyphMinLeading,
 nHyphMinTrailing,
-nHyphMinWordLength;
+nHyphMinWordLength,
+nHyphTextHyphenZone;
 bool bNoHyphenateCaps;
 
 // return values, will be set to default value or current temporary value
 sal_Int16   nResHyphMinLeading,
 nResHyphMinTrailing,
-nResHyphMinWordLength;
+nResHyphMinWordLength,
+nResHyphTextHyphenZone;
 bool bResNoHyphenateCaps;
 
 PropertyHelper_Hyphen( const PropertyHelper_Hyphen & ) = delete;
@@ -275,6 +277,7 @@ public:
 sal_Int16   GetMinLeading() const   { return 
nResHyphMinLeading; }
 sal_Int16   GetMinTrailing() const  { return 
nResHyphMinTrailing; }
 sal_Int16   GetMinWordLength() const{ return 
nResHyphMinWordLength; }
+sal_Int16   GetTextHyphenZone() const   { return 
nResHyphTextHyphenZone; }
 bool IsNoHyphenateCaps() const { return bResNoHyphenateCaps; }
 };
 
@@ -298,6 +301,7 @@ public:
 sal_Int16   GetMinLeading() const;
 sal_Int16   GetMinTrailing() const;
 sal_Int16   GetMinWordLength() const;
+sal_Int16   GetTextHyphenZone() const;
 bool IsNoHyphenateCaps() const;
 /// @throws css::uno::RuntimeException
 bool addLinguServiceEventListener(
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 8ac156ef8cb3..cb66c585e9fa 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -20,10 +20,13 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -53,6 +56,10 @@
 #include 
 #include 
 #include 
+#include 
+
+// XML-header to query SPELLML support
+constexpr OUStringLiteral SPELLML_SUPPORT = u"";
 
 using namespace utl;
 using namespace osl;
@@ -63,6 +70,13 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::linguistic2;
 using namespace linguistic;
 
+static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
+{
+uno::Reference< XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
+uno::Reference< XLinguServiceManager2 > xRes = 

core.git: Branch 'libreoffice-24-2' - sw/qa sw/source

2023-12-28 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |6 ++
 sw/source/core/text/guess.cxx   |   15 ++-
 sw/source/core/text/guess.hxx   |2 +-
 sw/source/core/text/portxt.cxx  |   25 -
 4 files changed, 37 insertions(+), 11 deletions(-)

New commits:
commit 8d247e3ad47e0b828437abb019e1573dbb1c05b1
Author: László Németh 
AuthorDate: Tue Dec 19 11:58:40 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 28 13:49:48 2023 +0100

tdf#119908 tdf#158776 sw smart justify: shrink only spaces

For interoperability, only shrink spaces up to 20%,
not the lines up to 2%.

Follow-up to commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position"
and commit 7d08767b890e723cd502b1c61d250924f695eb98
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: Idb43161cb5a57c3412abd3f0eb266c6afbe5363c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160988
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 36bfc86e27fa03ee16f87819549ab126c5a68cac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161325
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index ea2c3a52d24e..ec7d740cf74f 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -236,6 +236,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
 "portion"_ostr,
 // This was "...et ", not "...et magnis "
 "consequat arcu ut diam tempor luctus. Cum sociis natoque 
penatibus et magnis ");
+
+// tdf#158776 don't shrink line 11 of paragraph 4
+assertXPath(pXmlDoc, 
"/root/page/body/txt[4]/SwParaPortion/SwLineLayout[11]"_ostr,
+"portion"_ostr,
+// This was "...quis curcus ", not "...quis "
+"venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis ");
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158419)
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 37a2147d0987..6123ad1b6767 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -50,7 +50,7 @@ bool IsBlank(sal_Unicode ch) { return ch == CH_BLANK || ch == 
CH_FULL_BLANK || c
 // returns true if no line break has to be performed
 // otherwise possible break or hyphenation position is determined
 bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo ,
-const sal_uInt16 nPorHeight )
+const sal_uInt16 nPorHeight, sal_Int32 
nSpacesInLine )
 {
 m_nCutPos = rInf.GetIdx();
 
@@ -80,15 +80,12 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 
 const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
 
-// allow shrinking, i.e. more text in justified lines, depending on the 
justification algorithm
-if ( rAdjust == SvxAdjust::Block && 
rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
-DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
- // tdf#158436 avoid shrinking at underflow, e.g. no-break space
- // after a very short word resulted endless loop
- !rInf.IsUnderflow() )
+// allow up to 20% shrinking of the spaces
+if ( nSpacesInLine )
 {
-// allow up to 2% shrinking of the line
-nLineWidth = nLineWidth / 0.98 + rInf.X() / 0.98 - rInf.X();
+static constexpr OUStringLiteral STR_BLANK = u" ";
+sal_Int16 nSpaceWidth = rInf.GetTextSize(STR_BLANK).Width();
+nLineWidth += nSpacesInLine * (nSpaceWidth/0.8 - nSpaceWidth);
 }
 
 // tdf#104668 space chars at the end should be cut if the compatibility 
option is enabled
diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index f83c7e280ae4..5a7a9ac1cfa2 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -46,7 +46,7 @@ public:
 
 // true, if current portion still fits to current line
 bool Guess( const SwTextPortion& rPor, SwTextFormatInfo ,
-const sal_uInt16 nHeight );
+const sal_uInt16 nHeight, sal_Int32 nSpacesInLine = 0 );
 bool AlternativeSpelling( const SwTextFormatInfo , const 
TextFrameIndex nPos );
 
 SwHangingPortion* GetHangingPortion() const { return m_pHanging.get(); }
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 9631fc232dc3..0d3960c1bcbc 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -302,7 +302,30 @@ bool SwTextPortion::Format_( SwTextFormatInfo  )
 }
 
 SwTextGuess aGuess;
-const bool bFull = !aGuess.Guess( *this, rInf, Height() );
+bool bFull = !aGuess.Guess( *this, rInf, Height() );
+
+// tdf#158776 for the 

core.git: sw/qa sw/source

2023-12-19 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |6 ++
 sw/source/core/text/guess.cxx   |   15 ++-
 sw/source/core/text/guess.hxx   |2 +-
 sw/source/core/text/portxt.cxx  |   25 -
 4 files changed, 37 insertions(+), 11 deletions(-)

New commits:
commit 36bfc86e27fa03ee16f87819549ab126c5a68cac
Author: László Németh 
AuthorDate: Tue Dec 19 11:58:40 2023 +0100
Commit: László Németh 
CommitDate: Tue Dec 19 22:18:13 2023 +0100

tdf#119908 tdf#158776 sw smart justify: shrink only spaces

For interoperability, only shrink spaces up to 20%,
not the lines up to 2%.

Follow-up to commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position"
and commit 7d08767b890e723cd502b1c61d250924f695eb98
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: Idb43161cb5a57c3412abd3f0eb266c6afbe5363c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160988
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index ea2c3a52d24e..ec7d740cf74f 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -236,6 +236,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
 "portion"_ostr,
 // This was "...et ", not "...et magnis "
 "consequat arcu ut diam tempor luctus. Cum sociis natoque 
penatibus et magnis ");
+
+// tdf#158776 don't shrink line 11 of paragraph 4
+assertXPath(pXmlDoc, 
"/root/page/body/txt[4]/SwParaPortion/SwLineLayout[11]"_ostr,
+"portion"_ostr,
+// This was "...quis curcus ", not "...quis "
+"venenatis, quis commodo dolor posuere. Curabitur dignissim 
sapien quis ");
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158419)
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 37a2147d0987..6123ad1b6767 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -50,7 +50,7 @@ bool IsBlank(sal_Unicode ch) { return ch == CH_BLANK || ch == 
CH_FULL_BLANK || c
 // returns true if no line break has to be performed
 // otherwise possible break or hyphenation position is determined
 bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo ,
-const sal_uInt16 nPorHeight )
+const sal_uInt16 nPorHeight, sal_Int32 
nSpacesInLine )
 {
 m_nCutPos = rInf.GetIdx();
 
@@ -80,15 +80,12 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 
 const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
 
-// allow shrinking, i.e. more text in justified lines, depending on the 
justification algorithm
-if ( rAdjust == SvxAdjust::Block && 
rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
-DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
- // tdf#158436 avoid shrinking at underflow, e.g. no-break space
- // after a very short word resulted endless loop
- !rInf.IsUnderflow() )
+// allow up to 20% shrinking of the spaces
+if ( nSpacesInLine )
 {
-// allow up to 2% shrinking of the line
-nLineWidth = nLineWidth / 0.98 + rInf.X() / 0.98 - rInf.X();
+static constexpr OUStringLiteral STR_BLANK = u" ";
+sal_Int16 nSpaceWidth = rInf.GetTextSize(STR_BLANK).Width();
+nLineWidth += nSpacesInLine * (nSpaceWidth/0.8 - nSpaceWidth);
 }
 
 // tdf#104668 space chars at the end should be cut if the compatibility 
option is enabled
diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index f83c7e280ae4..5a7a9ac1cfa2 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -46,7 +46,7 @@ public:
 
 // true, if current portion still fits to current line
 bool Guess( const SwTextPortion& rPor, SwTextFormatInfo ,
-const sal_uInt16 nHeight );
+const sal_uInt16 nHeight, sal_Int32 nSpacesInLine = 0 );
 bool AlternativeSpelling( const SwTextFormatInfo , const 
TextFrameIndex nPos );
 
 SwHangingPortion* GetHangingPortion() const { return m_pHanging.get(); }
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 9631fc232dc3..0d3960c1bcbc 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -302,7 +302,30 @@ bool SwTextPortion::Format_( SwTextFormatInfo  )
 }
 
 SwTextGuess aGuess;
-const bool bFull = !aGuess.Guess( *this, rInf, Height() );
+bool bFull = !aGuess.Guess( *this, rInf, Height() );
+
+// tdf#158776 for the last full text portion, call Guess() again to allow 
more text in the
+// adjusted line by shrinking spaces using the know space count from the 
first Guess() 

core.git: editeng/inc editeng/source sw/qa

2023-12-08 Thread László Németh (via logerrit)
 editeng/inc/editattr.hxx|1 
 editeng/source/editeng/impedit3.cxx |4 ++
 sw/qa/extras/layout/data/tdf129357.fodt |   48 
 sw/qa/extras/layout/layout2.cxx |   17 +++
 4 files changed, 70 insertions(+)

New commits:
commit 326660093c903427285cfebaef12ecab1236b2db
Author: László Németh 
AuthorDate: Fri Dec 8 08:13:42 2023 +0100
Commit: László Németh 
CommitDate: Fri Dec 8 15:21:33 2023 +0100

tdf#129357 editeng: show soft hyphen in text boxes and shapes

Shapes and text boxes didn't show the optional hyphen
at line break.

Change-Id: I5cc842964fc91571e5c55995981de697da966b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160453
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx
index bb609ac1e996..3a619a5e85b8 100644
--- a/editeng/inc/editattr.hxx
+++ b/editeng/inc/editattr.hxx
@@ -54,6 +54,7 @@ class SfxGrabBagItem;
 
 #define CH_FEATURE_OLD  (sal_uInt8) 0xFF
 #define CH_FEATURE  u'\x0001'
+#define CH_SOFTHYPHEN   u'\x00AD'
 
 // DEF_METRIC: For my pool, the DefMetric should always appear when
 // GetMetric (nWhich)!
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 7402487120e1..b24cc004011c 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1975,6 +1975,10 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
 i18n::LineBreakResults aLBR = _xBI->getLineBreak(
 pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, 
aHyphOptions, aUserOptions );
 nBreakPos = aLBR.breakIndex;
+
+// show soft hyphen
+if ( nBreakPos && CH_SOFTHYPHEN == pNode->GetString()[ 
sal_Int32(nBreakPos) - 1 ] )
+bHyphenated = true;
 }
 else
 {
diff --git a/sw/qa/extras/layout/data/tdf129357.fodt 
b/sw/qa/extras/layout/data/tdf129357.fodt
new file mode 100644
index ..9cf563d71710
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf129357.fodt
@@ -0,0 +1,48 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2023-12-07T18:38:07.3012800122023-12-07T18:42:50.197688001PT4M44S1LibreOfficeDev/24.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/47e8abdafa26e64647e32d8577cb27e54cd843d1
+ 
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+ 
+  hyphena­tion
+ 
+
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 12dba9a65ce6..800e5749fe2c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -642,6 +642,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150790)
 "colors"_ostr, "#Bookmark 2 Bookmark End#Bookmark 3 Bookmark 
Start");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357)
+{
+createSwDoc("tdf129357.fodt");
+SwDoc* pDoc = getSwDoc();
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Dump the rendering of the first page as an XML file.
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+// visible soft hyphen
+assertXPathContent(pXmlDoc, 
"/metafile/push/push/push/push/push/textarray[2]/text"_ostr, "-");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering)
 {
 createSwDoc("tdf42748.fodt");


[Libreoffice-commits] core.git: sw/qa sw/source

2023-12-04 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf158436.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |6 ++
 sw/source/core/text/guess.cxx|5 -
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7059a1858ddb044c5f3f0c8e0386d3e1d9dd2b5f
Author: László Németh 
AuthorDate: Mon Dec 4 15:33:14 2023 +0100
Commit: László Németh 
CommitDate: Mon Dec 4 21:41:04 2023 +0100

tdf#119908 tdf#158439 sw smart justify: fix freezing with NBSP

Stop shrinking during underflow, because it resulted
endless layout loop, e.g. when a very short word followed
by a no-break space.

Regression from commit 7d08767b890e723cd502b1c61d250924f695eb98
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: Id832b7fdbc01453a30067995e14e5430b0a15232
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160316
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf158436.docx 
b/sw/qa/extras/ooxmlexport/data/tdf158436.docx
new file mode 100644
index ..8cdcd21b4c1a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf158436.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index d9ef6b8a48d0..0656bb868795 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1408,6 +1408,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130088, "tdf130088.docx")
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf158436, "tdf158436.docx")
+{
+// This resulted freezing
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testHyphenationAuto)
 {
 loadAndReload("hyphenation.odt");
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 5e66b366c63f..37a2147d0987 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -82,7 +82,10 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 
 // allow shrinking, i.e. more text in justified lines, depending on the 
justification algorithm
 if ( rAdjust == SvxAdjust::Block && 
rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
-DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING))
+DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
+ // tdf#158436 avoid shrinking at underflow, e.g. no-break space
+ // after a very short word resulted endless loop
+ !rInf.IsUnderflow() )
 {
 // allow up to 2% shrinking of the line
 nLineWidth = nLineWidth / 0.98 + rInf.X() / 0.98 - rInf.X();


[Libreoffice-commits] core.git: sw/qa

2023-11-29 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 93ab1bc6be7b46226874810ec4fc3c61d5d0fc7c
Author: László Németh 
AuthorDate: Wed Nov 29 20:56:38 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 30 08:35:03 2023 +0100

tdf#158419 sw: revert lost unit test testOfz64109

which was removed accidentally by commit 
20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position".

Change-Id: Ia96d9d8d8980dbf05aaa58d454e2d9b568555d81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160129
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 843712e62221..f919a6452912 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -864,6 +864,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testAbi11870)
 createSwDoc("abi11870-2.odt");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testOfz64109)
+{
+//just care it doesn't assert
+createSwDoc("ofz64109-1.fodt");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf118719)
 {
 // Insert a page break.


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-29 Thread László Németh (via logerrit)
 sw/qa/core/text/text.cxx   |   12 ++--
 sw/source/core/text/porexp.cxx |5 +
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 78872cc81bf4b1377c9cae8f9040a2443d0690c0
Author: László Németh 
AuthorDate: Tue Nov 28 19:39:16 2023 +0100
Commit: László Németh 
CommitDate: Wed Nov 29 10:16:28 2023 +0100

tdf#157768 sw: fix lost character background of NBSP

Regression from commit 28675af84ae8e2342bd78be3696dc09de6ce5cc5
"tdf#41652: Variable width NBSP".

Change-Id: I066ecadac8961b182f8580147b197f13dd0daae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160054
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 8951b9fb6a82..7340a151d1f4 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1263,9 +1263,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
 
 nSectionAfterNBSPX_legacy_leftAligned
-= getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[4]"_ostr, "x"_ostr).toInt32();
 nSectionAfterNBSPX_legacy_justified
-= getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[10]"_ostr, "x"_ostr).toInt32();
 }
 
 // Measure the X of sections after NBSPs in a file with the option enabled
@@ -1278,9 +1278,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
 
 nSectionAfterNBSPX_optionDisabled_leftAligned
-= getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[4]"_ostr, "x"_ostr).toInt32();
 nSectionAfterNBSPX_optionDisabled_justified
-= getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[10]"_ostr, "x"_ostr).toInt32();
 }
 
 // Measure the X of the sections after NBSPs in a file with the option 
enabled
@@ -1293,9 +1293,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
 
 nSectionAfterNBSPX_optionEnabled_leftAligned
-= getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[4]"_ostr, "x"_ostr).toInt32();
 nSectionAfterNBSPX_optionEnabled_justified
-= getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[10]"_ostr, "x"_ostr).toInt32();
 }
 
 // Assert left aligned NBSP for the legacy file is larger than zero
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 56e3d7c34265..0884db6fce76 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -211,6 +211,7 @@ void SwBlankPortion::Paint( const SwTextPaintInfo  ) 
const
 // Draw field shade (can be disabled individually)
 if (!m_bMulti) // No gray background for multiportion brackets
 rInf.DrawViewOpt(*this, PortionType::Blank);
+SwExpandPortion::Paint(rInf);
 
 if (m_cChar == CHAR_HARDBLANK)
 {
@@ -242,10 +243,6 @@ void SwBlankPortion::Paint( const SwTextPaintInfo  ) 
const
 aInf.GetFont()->SetColor(colorBackup);
 }
 }
-else
-{
-SwExpandPortion::Paint(rInf);
-}
 }
 
 bool SwBlankPortion::GetExpText( const SwTextSizeInfo& rInf, OUString  ) 
const


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-28 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |   48 +++-
 sw/source/core/text/itrcrsr.cxx |4 +--
 sw/source/core/text/porlay.hxx  |7 -
 3 files changed, 45 insertions(+), 14 deletions(-)

New commits:
commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
Author: László Németh 
AuthorDate: Tue Nov 28 15:09:52 2023 +0100
Commit: László Németh 
CommitDate: Wed Nov 29 00:16:08 2023 +0100

tdf#119908 tdf#158419 sw smart justify: fix cursor position

Text cursor didn't follow the new word positions yet, because
of unsigned casting of the negative shrinking value.

Revert the temporary change of GetLLSpaceAdd() added by
commit 17eaebee279772b6062ae3448012133897fc71bb
"tdf#119908 sw smart justify: fix justification by shrinking".

Follow-up to commit 53de98b29548ded88e0a44c80256fc5e340d551e
"tdf#158333 sw smart justify: fix multiple text portions".

Change-Id: I82cb395fc5af800d8da67d27c16c5ed6837df695
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160050
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index dc70bf41b6f8..843712e62221 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -237,6 +237,48 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
 "consequat arcu ut diam tempor luctus. Cum sociis natoque 
penatibus et magnis ");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158419)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// second paragraph.
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+SwWrtShell* pWrtShell = pShell->GetWrtShell();
+SwPosition aPosition(*pWrtShell->GetCursor()->Start());
+SwTwips nSecondParaLeft
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"left"_ostr).toInt32();
+SwTwips nSecondParaWidth
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"width"_ostr).toInt32();
+SwTwips nSecondParaTop
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+SwTwips nSecondParaHeight
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"height"_ostr).toInt32();
+Point aPoint;
+
+// click at the end of the second line of the second paragraph
+// (a line shrunk by the new justification)
+
+aPoint.setX(nSecondParaLeft + nSecondParaWidth);
+aPoint.setY(nSecondParaTop + (nSecondParaHeight / 6) * 1.5);
+SwCursorMoveState aState(CursorMoveState::NONE);
+pLayout->GetModelPositionForViewPoint(, aPoint, );
+// Without the accompanying fix in place, this test would have failed: 
character position was 155,
+// i.e. cursor was before the end of the paragraph.
+CPPUNIT_ASSERT_EQUAL(static_cast(156), 
aPosition.GetContentIndex());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
 {
 createSwDoc("tdf106234.fodt");
@@ -822,12 +864,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testAbi11870)
 createSwDoc("abi11870-2.odt");
 }
 
-CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testOfz64109)
-{
-//just care it doesn't assert
-createSwDoc("ofz64109-1.fodt");
-}
-
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf118719)
 {
 // Insert a page break.
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 7a7024d97a09..1770361c19de 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1371,7 +1371,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InSpaceGrp() && nSpaceAdd )
 {
 const_cast(GetInfo()).SetIdx( nCurrStart );
-nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
+nWidth = nWidth + sal_Int16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
 }
 if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
 ( pPor->IsMultiPortion() && 
static_cast(pPor)->HasTabulator() )
@@ -1415,7 +1415,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InSpaceGrp() && nSpaceAdd )
 {
 const_cast(GetInfo()).SetIdx( nCurrStart );
-nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
+nWidth = nWidth + sal_Int16( pPor->CalcSpacing( nSpaceAdd, 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-27 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |   36 
 sw/source/core/text/guess.cxx   |2 +-
 sw/source/core/text/porlin.cxx  |4 ++--
 sw/source/core/text/portxt.cxx  |3 ++-
 4 files changed, 41 insertions(+), 4 deletions(-)

New commits:
commit 53de98b29548ded88e0a44c80256fc5e340d551e
Author: László Németh 
AuthorDate: Thu Nov 23 14:01:10 2023 +0100
Commit: László Németh 
CommitDate: Mon Nov 27 14:48:19 2023 +0100

tdf#158333 sw smart justify: fix multiple text portions

Multiple text portions, e.g. if some part of a line
contains direct character formatting breaks DOCX
interoperability of justified paragraphs.

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

Change-Id: Ia53e763fdba89bb733bde088874e641b25d733f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159862
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 797b41fc7baf..dc70bf41b6f8 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -201,6 +201,42 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908)
 CPPUNIT_ASSERT_GREATER(sal_Int32(5840), nPortionWidth);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
+{
+createSwDoc("tdf130088.docx");
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// shrink line 2
+assertXPath(
+pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]", 
"portion",
+"viverra odio. Donec auctor molestie sem, sit amet tristique lectus 
hendrerit sed. ");
+
+// shrink line 7
+assertXPath(
+pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[7]", 
"portion",
+// This was "...diam ", not "...diam tempor "
+"laoreet vel leo nec, volutpat facilisis eros. Donec consequat arcu ut 
diam tempor ");
+
+// shrink line 2 of paragraph 2
+assertXPath(
+pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]", 
"portion",
+// This was "...Cras ", not "...Cras sodales "
+"Donec auctor molestie sem, sit amet tristique lectus hendrerit sed. 
Cras sodales ");
+
+// shrink line 2 of paragraph 4
+assertXPath(pXmlDoc, 
"/root/page/body/txt[4]/SwParaPortion/SwLineLayout[2]", "portion",
+// This was "...et ", not "...et magnis "
+"consequat arcu ut diam tempor luctus. Cum sociis natoque 
penatibus et magnis ");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
 {
 createSwDoc("tdf106234.fodt");
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 6d92b64d9fce..5e66b366c63f 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -85,7 +85,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING))
 {
 // allow up to 2% shrinking of the line
-nLineWidth /= 0.98;
+nLineWidth = nLineWidth / 0.98 + rInf.X() / 0.98 - rInf.X();
 }
 
 // tdf#104668 space chars at the end should be cut if the compatibility 
option is enabled
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index fdd0ffba53b9..6d0992f1abf6 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -276,9 +276,9 @@ void SwLinePortion::Move(SwTextPaintInfo & rInf) const
 bool bCounterDir = ( ! bFrameDir && DIR_RIGHT2LEFT == rInf.GetDirection() 
) ||
(   bFrameDir && DIR_LEFT2RIGHT == rInf.GetDirection() 
);
 
-if ( InSpaceGrp() && rInf.GetSpaceAdd() )
+if ( InSpaceGrp() && rInf.GetSpaceAdd(/*bShrink=*/true) )
 {
-SwTwips nTmp = PrtWidth() + CalcSpacing( rInf.GetSpaceAdd(), rInf );
+SwTwips nTmp = PrtWidth() + CalcSpacing( 
rInf.GetSpaceAdd(/*bShrink=*/true), rInf );
 if( rInf.IsRotated() )
 rInf.Y( rInf.Y() + ( bB2T ? -nTmp : nTmp ) );
 else if ( bCounterDir )
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 1e2f8d1823d0..ff6d40cd4d95 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -668,7 +668,8 @@ tools::Long SwTextPortion::CalcSpacing( tools::Long 
nSpaceAdd, const SwTextSizeI
 }
 }
 
-return sal_Int32(nCnt) * nSpaceAdd / SPACING_PRECISION_FACTOR;
+return sal_Int32(nCnt) * (nSpaceAdd > LONG_MAX/2 ? LONG_MAX/2 - nSpaceAdd 
: nSpaceAdd)
+ / 

[Libreoffice-commits] core.git: sw/qa

2023-11-17 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf130088.docx |binary
 sw/qa/extras/layout/layout3.cxx |   21 +
 2 files changed, 21 insertions(+)

New commits:
commit c1803de8a093739d189be54b2d9bd5634e9e79ee
Author: László Németh 
AuthorDate: Thu Nov 16 23:48:03 2023 +0100
Commit: László Németh 
CommitDate: Fri Nov 17 09:33:06 2023 +0100

tdf#119908 sw smart justify: add unit test

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

Change-Id: I88cc7876c06729f81b9d61fed7456be801dc6373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159525
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/data/tdf130088.docx 
b/sw/qa/extras/layout/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf130088.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index b390e6e38b9c..11a9c0191d24 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -172,6 +172,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128966)
 xmlXPathFreeObject(pXmlObj);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908)
+{
+createSwDoc("tdf130088.docx");
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Keep real width of the exceeding line portions to calculate shrinking
+sal_Int32 nPortionWidth
+= getXPath(pXmlDoc, 
"/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[2]",
+   "width")
+  .toInt32();
+// This was 5806 (not real portion width, but stripped to the line width)
+CPPUNIT_ASSERT_GREATER(sal_Int32(5840), nPortionWidth);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
 {
 createSwDoc("tdf106234.fodt");


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-16 Thread László Németh (via logerrit)
 sw/qa/core/text/frmform.cxx |4 +---
 sw/source/core/inc/drawfont.hxx |6 +-
 sw/source/core/text/inftxt.cxx  |2 +-
 sw/source/core/text/inftxt.hxx  |6 --
 sw/source/core/text/itradj.cxx  |   13 -
 sw/source/core/text/porlay.hxx  |7 ++-
 sw/source/core/text/portxt.cxx  |7 +--
 7 files changed, 30 insertions(+), 15 deletions(-)

New commits:
commit 17eaebee279772b6062ae3448012133897fc71bb
Author: László Németh 
AuthorDate: Wed Nov 15 23:31:12 2023 +0100
Commit: László Németh 
CommitDate: Thu Nov 16 16:21:06 2023 +0100

tdf#119908 sw smart justify: fix justification by shrinking

Shrink the exceeding lines by shrinking the spaces
between the words.

Because the negative spacing values are used
for the extra space between the characters in the main
data structure of the justified line layout, and not for
the space between the words, like the positive values,
the negative space values for shrinking are stored over
LONG_MAX/2 as absolute values to avoid of bigger changes
of the data structure before designing a better
justification algorithm, where it's possible to mix
different methods for the more visible text layout.

Note: the text cursor doesn't follow the new word
positions yet.

Follow-up to commit 7d08767b890e723cd502b1c61d250924f695eb98
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: I9a63b5a93d6bce230e963ebc88ea2d0f9aa8fffb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159511
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/core/text/frmform.cxx b/sw/qa/core/text/frmform.cxx
index b321fca51cee..3d43bde6aa9c 100644
--- a/sw/qa/core/text/frmform.cxx
+++ b/sw/qa/core/text/frmform.cxx
@@ -63,9 +63,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableNegativeVertOffset)
 CPPUNIT_ASSERT_LESS(pPara2->getFrameArea().Top(), rFlyRect.Bottom());
 }
 
-// FIXME: because breaking the lines at the right place, this test
-// became obsolete: proposed fix is to modify compatibilityMode to "14"
-// in the DOCX test file to use the old justification algorithm
+// FIXME: because breaking the lines at the right place, test document became 
obsolete
 #if 0
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 {
diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index 3d58f5fcd09d..fe6a44264759 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -544,7 +544,11 @@ public:
 }
 else
 {
-m_nSpace = nNew;
+// negative space (shrinking) stored over LONG_MAX/2
+if ( nNew < LONG_MAX/2 )
+m_nSpace = nNew;
+else
+m_nSpace = LONG_MAX/2 - nNew;
 m_nCharacterSpacing = 0;
 }
 #ifdef DBG_UTIL
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 82bbf9d879bf..129234c8a4cf 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -634,7 +634,7 @@ void SwTextPaintInfo::DrawText_( const OUString , 
const SwLinePortion 
 aDrawInf.SetUnderFnt( m_pUnderFnt );
 
 const tools::Long nSpaceAdd = ( rPor.IsBlankPortion() || 
rPor.IsDropPortion() ||
- rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
+ rPor.InNumberGrp() ) ? 0 : 
GetSpaceAdd(/*bShrink=*/true);
 if ( nSpaceAdd )
 {
 TextFrameIndex nCharCnt(0);
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 62cca26ac08f..f2f6d146136e 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -443,8 +443,10 @@ public:
 void SetSpaceIdx( sal_uInt16 nNew ) { m_nSpaceIdx = nNew; }
 void IncSpaceIdx() { ++m_nSpaceIdx; }
 void RemoveFirstSpaceAdd() { m_pSpaceAdd->erase( m_pSpaceAdd->begin() ); }
-tools::Long GetSpaceAdd() const
-{ return ( m_pSpaceAdd && m_nSpaceIdx < m_pSpaceAdd->size() )
+tools::Long GetSpaceAdd( bool bShrink = false ) const
+{ return ( m_pSpaceAdd && m_nSpaceIdx < m_pSpaceAdd->size() &&
+   // get shrink data only if asked explicitly, otherwise zero 
it
+   ( bShrink || (*m_pSpaceAdd)[m_nSpaceIdx] < LONG_MAX/2 ) )
? (*m_pSpaceAdd)[m_nSpaceIdx] : 0; }
 
 void SetpSpaceAdd( std::vector* pNew ){ m_pSpaceAdd = pNew; }
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index b72a8d59f5f7..4dcaf03df1f8 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -290,6 +290,8 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
 bool bDoNotJustifyTab = false;
 
 SwLinePortion *pPos = pCurrent->GetNextPortion();
+// calculate real text width for shrinking
+tools::Long nBreakWidth = 0;
 
 while( pPos )
 {
@@ -367,6 +369,11 @@ 

[Libreoffice-commits] core.git: include/sfx2 sw/inc sw/qa sw/source sw/uiconfig

2023-11-08 Thread László Németh (via logerrit)
 include/sfx2/AccessibilityIssue.hxx  |1 
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   12 
 sw/qa/core/accessibilitycheck/data/LinkedImageTest.fodt  |   18 ++
 sw/source/core/access/AccessibilityCheck.cxx |   42 +-
 sw/source/core/access/AccessibilityIssue.cxx |1 
 sw/source/core/inc/AccessibilityIssue.hxx|1 
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx|   40 +++--
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx|3 +
 sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui   |   44 ---
 10 files changed, 146 insertions(+), 17 deletions(-)

New commits:
commit 0156cba6e34026f8fa0f2912e503378a5ec2208d
Author: László Németh 
AuthorDate: Wed Nov 8 11:04:40 2023 +0100
Commit: László Németh 
CommitDate: Wed Nov 8 21:16:59 2023 +0100

tdf#43784 tdf#158114 sw accessibility: check missing linked graphic

Show missing linked graphics and their abbreviated paths,
(and as tooltips, full paths) in the accessibility checker.

Change-Id: Ia378f4ea3260251d1b2530fadc48aea6e0323a08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159150
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/include/sfx2/AccessibilityIssue.hxx 
b/include/sfx2/AccessibilityIssue.hxx
index ac9ad6adb73b..92bef3d7d6a2 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -27,6 +27,7 @@ enum class AccessibilityIssueID
 DOCUMENT_LANGUAGE,
 DOCUMENT_BACKGROUND,
 STYLE_LANGUAGE,
+LINKED_GRAPHIC,
 NO_ALT_OLE,
 NO_ALT_GRAPHIC,
 NO_ALT_SHAPE,
diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 44dd7217dc04..8073f9cc1c73 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -14,6 +14,7 @@
 #define NC_(Context, String) TranslateId(Context, u8##String)
 
 #define STR_NO_ALT  NC_("STR_NO_ALT", "%OBJECT_NAME%")
+#define STR_LINKED_GRAPHIC  NC_("STR_LINKED_GRAPHIC", 
"“%OBJECT_NAME%” referenced as “%LINK%”.")
 #define STR_TABLE_MERGE_SPLIT   NC_("STR_TABLE_MERGE_SPLIT", "Table 
“%OBJECT_NAME%” contains merges or splits.")
 #define STR_FAKE_NUMBERING  NC_("STR_FAKE_NUMBERING", "Simulated 
numbering “%NUMBERING%”.")
 #define STR_HYPERLINK_TEXT_IS_LINK  NC_("STR_HYPERLINK_TEXT_IS_LINK", 
"Hyperlink text is the same as the link address “%LINK%”.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 72337e62d6e0..117b48d01661 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -84,6 +84,18 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckBackgroundImage)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckLinkedImage)
+{
+createSwDoc("LinkedImageTest.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::LINKED_GRAPHIC, 
aIssues[1]->m_eIssueID);
+}
+
 CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace)
 {
 createSwDoc("NewlineTest.odt");
diff --git a/sw/qa/core/accessibilitycheck/data/LinkedImageTest.fodt 
b/sw/qa/core/accessibilitycheck/data/LinkedImageTest.fodt
new file mode 100644
index ..c73162b18372
--- /dev/null
+++ b/sw/qa/core/accessibilitycheck/data/LinkedImageTest.fodt
@@ -0,0 +1,18 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 

[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/unx

2023-11-06 Thread László Németh (via logerrit)
 vcl/inc/svdata.hxx |3 +++
 vcl/source/control/imp_listbox.cxx |2 +-
 vcl/unx/gtk3/gtkframe.cxx  |6 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 698935c220131bc761eb9cf25e01fa91087a788e
Author: László Németh 
AuthorDate: Mon Nov 6 23:56:57 2023 +0100
Commit: László Németh 
CommitDate: Tue Nov 7 07:16:01 2023 +0100

tdf#152155 vcl: fix gtk popup listbox positions on sidebar

It was fixed only on Wayland previously.

Follow-up to commit 15cdee0d846854b50dd04626b73499bef9305e00
"Resolves: tdf#152155 use gtk's knowledge of relative widget positions".

Change-Id: I7a8b17189b319146142a2193ec4b5ec41e2c2d27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159020
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 104b9543b74a..fd7ae855b5f2 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -118,6 +118,9 @@ class UITestLogger;
 #define SV_ICON_ID_DATABASE12
 #define SV_ICON_ID_FORMULA 13
 
+const FloatWinPopupFlags LISTBOX_FLOATWINPOPUPFLAGS = FloatWinPopupFlags::Down 
|
+FloatWinPopupFlags::NoHorzPlacement | 
FloatWinPopupFlags::AllMouseButtonClose;
+
 namespace com::sun::star::datatransfer::clipboard { class XClipboard; }
 
 namespace vcl
diff --git a/vcl/source/control/imp_listbox.cxx 
b/vcl/source/control/imp_listbox.cxx
index 04919ca26f20..bb4da51859b0 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -3011,7 +3011,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool 
bStartTracking )
 pGrandparentOutDev->ReMirror( aRect );
 
 // mouse-button right: close the List-Box-Float-win and don't stop the 
handling fdo#84795
-StartPopupMode( aRect, FloatWinPopupFlags::Down | 
FloatWinPopupFlags::NoHorzPlacement | FloatWinPopupFlags::AllMouseButtonClose );
+StartPopupMode( aRect, LISTBOX_FLOATWINPOPUPFLAGS );
 
 if( nPos != LISTBOX_ENTRY_NOTFOUND )
 mpImplLB->ShowProminentEntry( nPos );
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index b1bf8474b1b2..f063f80b7dea 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3091,8 +3091,12 @@ void GtkSalFrame::EndSetClipRegion()
 
 void GtkSalFrame::PositionByToolkit(const tools::Rectangle& rRect, 
FloatWinPopupFlags nFlags)
 {
-if (ImplGetSVData()->maNWFData.mbCanDetermineWindowPosition)
+if ( ImplGetSVData()->maNWFData.mbCanDetermineWindowPosition &&
+// tdf#152155 cannot determine window positions of popup listboxes on 
sidebar
+nFlags != LISTBOX_FLOATWINPOPUPFLAGS )
+{
 return;
+}
 
 m_aFloatRect = rRect;
 m_nFloatFlags = nFlags;


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-02 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   55 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   36 +++---
 2 files changed, 80 insertions(+), 11 deletions(-)

New commits:
commit 3e266d5902439f34bc5559d6871f8c9fd6e579bb
Author: László Németh 
AuthorDate: Thu Nov 2 13:15:52 2023 +0100
Commit: László Németh 
CommitDate: Fri Nov 3 00:53:49 2023 +0100

tdf#158039 sw track changes: fix cycle case of selected sentences

Previous tracked changes of cycle case weren't removed, if
the selection doesn't end in a tracked change, i.e. sentences
with punctuation, or selections end in a capitalized word etc.

Fix also lost selection of multiple selected nodes.

Follow up to commit 4cf8de89bad9143a5b2dd3d6351080bf62b76029
"tdf#157667 sw track changes: fix cycle case on multiple words",
commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking" and
commit 79435eb55ef226fb0e3507aabdc2f8af062680f6
"tdf#157988 sw track changes: fix cycle case on a selected word".

Change-Id: I24476c359200a25ca9bcd467c33b0ebeb1afb037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158804
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 8e6b91043b0b..30c449a597ac 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -796,7 +796,62 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157667)
 "Integer sodalesINTEGER SODALES tincidunt tristique."));
 
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+}
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf158039)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select the first sentence
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 26, 
/*bBasicCall=*/false);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesINTEGER SODALES tincidunt tristique."));
+
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
 
 CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d51565c5eaee..d36ee7a8b31a 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3055,17 +3055,27 @@ void 
DocumentContentOperationsManager::TransliterateText(
 if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) 
&&
 pEnd->GetContentIndex() > 0 )
 {
-SwPosition aPos(*pEnd->GetContentNode(), pEnd->GetContentIndex() - 
1);
-SwRedlineTable::size_type n = 0;
+// search all own redlines within the selected area
+SwRedlineTable::size_type n = SwRedlineTable::npos;
+const SwRedlineTable& aRedlineTable = rIDRA.GetRedlineTable();
+for( SwRedlineTable::size_type m = 0; m < aRedlineTable.size(); 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - 2 commits - sw/qa sw/source vcl/qa

2023-11-02 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   69 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   38 
 vcl/qa/cppunit/pdfexport/data/tdf157679.pptx|binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |   28 ++
 4 files changed, 135 insertions(+)

New commits:
commit 6bf92349cab2a558a8160ad6ace409cd4b6f260e
Author: László Németh 
AuthorDate: Mon Oct 30 14:42:34 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Nov 2 09:29:56 2023 +0100

tdf#157988 sw track changes: fix cycle case on a selected word

Cycle case didn't work on a selected word, only on the
word under the cursor without selection.

Add unit test also for tdf#141198.

Follow up to commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking".

Change-Id: I0c1361c78d09e9b8743192a47dcdfa6f6da52e38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158666
Tested-by: Jenkins
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158686

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index edfc5c153afc..316181c37cff 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -689,6 +689,75 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+
+// select the second word
+dispatchCommand(mxComponent, ".uno:GoToNextWord", {});
+dispatchCommand(mxComponent, ".uno:SelectWord", {});
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSODALES"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+// tdf#141198 cycle case without selection: the word under the cursor
+
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSODALES"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 47e5b818b2fb..bac73a325a5f 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3036,6 +3036,44 @@ void DocumentContentOperationsManager::TransliterateText(
 return;
 }
 }
+else
+{
+bool bHasTrackedChange = false;
+IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess();
+if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) 
&&
+pEnd->GetContentIndex() > 0 )
+{
+SwPosition aPos(*pEnd->GetContentNode(), pEnd->GetContentIndex() - 
1);
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - 2 commits - include/oox oox/source sd/qa sw/qa sw/source

2023-11-01 Thread László Németh (via logerrit)
 dev/null  |binary
 include/oox/drawingml/shape.hxx   |3 ---
 oox/source/drawingml/shape.cxx|2 --
 oox/source/drawingml/shapecontext.cxx |2 --
 oox/source/ppt/pptshape.cxx   |4 
 sd/qa/unit/import-tests2.cxx  |   11 ---
 sw/qa/extras/uiwriter/data/tdf130088.docx |binary
 sw/qa/extras/uiwriter/uiwriter6.cxx   |   27 +++
 sw/source/core/txtnode/txtedt.cxx |9 -
 9 files changed, 35 insertions(+), 23 deletions(-)

New commits:
commit f0a9b44059f76f79ffddfdc012026ff2c592b5c1
Author: László Németh 
AuthorDate: Fri Oct 27 09:43:44 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Nov 2 00:52:52 2023 +0100

tdf#157937 sw: fix freezing of cycle case on tracked changes

Add loop control to avoid never-ending iteration on selected
text with tracked changes, where transliteration can result
empty strings.

Regression since commit 2d3c77e9b10f20091ef338e262ba7756eb280ce9
"tdf#109266 sw change tracking: track transliteration".

Change-Id: Ia5f92adfdda33562b4d1abe72c51134be8304639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158525
Tested-by: Jenkins
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158535

diff --git a/sw/qa/extras/uiwriter/data/tdf130088.docx 
b/sw/qa/extras/uiwriter/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf130088.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 73178363b8fb..edfc5c153afc 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -662,6 +662,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790)
 CPPUNIT_ASSERT(dynamic_cast(mxComponent.get()));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select paragraph
+pWrtShell->SelPara(nullptr);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This resulted freezing
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 71ee1fd93a24..2f3e7aa6db86 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1973,6 +1973,7 @@ void SwTextNode::TransliterateText(
 
 sal_Int32 nEndPos = 0;
 LanguageType nLang = LANGUAGE_NONE;
+sal_Int32 nLoopControlRuns = 0;
 do {
 if( pIter )
 {
@@ -2005,7 +2006,13 @@ void SwTextNode::TransliterateText(
 }
 
 nStt = nEndPos;
-} while( nEndPos < nEnd && pIter && pIter->Next() );
+
+// tdf#157937 selection containing tracked changes needs loop 
control:
+// stop looping, if there are too much empty transliterations
+if ( sChgd.isEmpty() )
+++nLoopControlRuns;
+
+} while( nEndPos < nEnd && pIter && pIter->Next() && nLoopControlRuns 
< 100 );
 }
 
 if (aChanges.empty())
commit 5879d4d242fb9b4227de068aa1adc3621e190754
Author: Xisco Fauli 
AuthorDate: Mon Oct 23 15:34:58 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Nov 2 00:52:44 2023 +0100

tdf#157679: Revert "pptx: import shape text from master page"

This reverts commit ae3b97a69688553e6c40ef4b64655db09d5a0f5e.

Change-Id: I39fd84b5efbff0a2cafe090f4f866c801cef19b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158357
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 3b37c5fa7dce7718b566ad4f4fe80191b64cd533)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158544

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 4c8be792e7f6..ccf477bef805 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -237,8 +237,6 @@ public:
 voidsetTxbxHasLinkedTxtBox( const bool rhs){ 
mbHasLinkedTxbx = rhs; };
 const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-31 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   43 ++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   68 
 2 files changed, 96 insertions(+), 15 deletions(-)

New commits:
commit 4cf8de89bad9143a5b2dd3d6351080bf62b76029
Author: László Németh 
AuthorDate: Tue Oct 31 15:51:09 2023 +0100
Commit: László Németh 
CommitDate: Tue Oct 31 23:07:01 2023 +0100

tdf#157667 sw track changes: fix cycle case on multiple words

Fix tracked cycle case on multiple selected words.

Follow up to commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking" and
commit 79435eb55ef226fb0e3507aabdc2f8af062680f6
"tdf#157988 sw track changes: fix cycle case on a selected word".

Change-Id: I81566f8be0cf6f4af6ed4af031116bd19e3884d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158732
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 83bc43f6d866..8e6b91043b0b 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -759,6 +759,49 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988)
 CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157667)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select the first three words
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 25, 
/*bBasicCall=*/false);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesINTEGER SODALES tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 54b29b9b766c..d51565c5eaee 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2984,7 +2984,8 @@ void DocumentContentOperationsManager::TransliterateText(
 sal_Int32 nEndCnt = pEnd->GetContentIndex();
 
 SwTextNode* pTNd = pStt->GetNode().GetTextNode();
-if( (pStt == pEnd) && pTNd )  // no selection?
+bool bNoSelection = (pStt == pEnd) && pTNd;  // no selection?
+if ( bNoSelection )
 {
 /* Check if cursor is inside of a word */
 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
@@ -3061,27 +3062,52 @@ void 
DocumentContentOperationsManager::TransliterateText(
 rIDRA.GetRedlineTable().FindAtPosition( aPos, 
n );
 if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 0 )
 {
-const SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[n-1];
-if ( RedlineType::Delete == pFnd2->GetType() &&
-  m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() 
&&
-  *pFnd2->End() == *pFnd->Start() &&
-  pFnd->GetAuthor() == pFnd2->GetAuthor() )
+SwWrtShell *pWrtShell = dynamic_cast(
+
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell());
+
+sal_Int32 nRejectedCharacters = 0;
+SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[--n];
+// loop on all redlines of a case changing, and reject them
+while ( ( ( RedlineType::Insert == pFnd->GetType() &&
+RedlineType::Delete == pFnd2->GetType() ) 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-30 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   69 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   38 
 2 files changed, 107 insertions(+)

New commits:
commit 79435eb55ef226fb0e3507aabdc2f8af062680f6
Author: László Németh 
AuthorDate: Mon Oct 30 14:42:34 2023 +0100
Commit: László Németh 
CommitDate: Mon Oct 30 21:54:07 2023 +0100

tdf#157988 sw track changes: fix cycle case on a selected word

Cycle case didn't work on a selected word, only on the
word under the cursor without selection.

Add unit test also for tdf#141198.

Follow up to commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking".

Change-Id: I0c1361c78d09e9b8743192a47dcdfa6f6da52e38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158666
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 53f6dce1a56a..83bc43f6d866 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -690,6 +690,75 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+
+// select the second word
+dispatchCommand(mxComponent, ".uno:GoToNextWord", {});
+dispatchCommand(mxComponent, ".uno:SelectWord", {});
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSODALES"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+// tdf#141198 cycle case without selection: the word under the cursor
+
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSODALES"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 3f4c99a8f487..54b29b9b766c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3047,6 +3047,44 @@ void DocumentContentOperationsManager::TransliterateText(
 return;
 }
 }
+else
+{
+bool bHasTrackedChange = false;
+IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess();
+if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) 
&&
+pEnd->GetContentIndex() > 0 )
+{
+SwPosition aPos(*pEnd->GetContentNode(), pEnd->GetContentIndex() - 
1);
+SwRedlineTable::size_type n = 0;
+
+const SwRangeRedline* pFnd =
+rIDRA.GetRedlineTable().FindAtPosition( aPos, 
n );
+if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-27 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf130088.docx |binary
 sw/qa/extras/uiwriter/uiwriter6.cxx   |   27 +++
 sw/source/core/txtnode/txtedt.cxx |9 -
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit e079bb35429603988d2fd4ddf18b0f501a847a2c
Author: László Németh 
AuthorDate: Fri Oct 27 09:43:44 2023 +0200
Commit: László Németh 
CommitDate: Fri Oct 27 15:10:33 2023 +0200

tdf#157937 sw: fix freezing of cycle case on tracked changes

Add loop control to avoid never-ending iteration on selected
text with tracked changes, where transliteration can result
empty strings.

Regression since commit 2d3c77e9b10f20091ef338e262ba7756eb280ce9
"tdf#109266 sw change tracking: track transliteration".

Change-Id: Ia5f92adfdda33562b4d1abe72c51134be8304639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158525
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data/tdf130088.docx 
b/sw/qa/extras/uiwriter/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf130088.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index dd0b1d6f468c..53f6dce1a56a 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -663,6 +663,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790)
 CPPUNIT_ASSERT(dynamic_cast(mxComponent.get()));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select paragraph
+pWrtShell->SelPara(nullptr);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This resulted freezing
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 71ee1fd93a24..2f3e7aa6db86 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1973,6 +1973,7 @@ void SwTextNode::TransliterateText(
 
 sal_Int32 nEndPos = 0;
 LanguageType nLang = LANGUAGE_NONE;
+sal_Int32 nLoopControlRuns = 0;
 do {
 if( pIter )
 {
@@ -2005,7 +2006,13 @@ void SwTextNode::TransliterateText(
 }
 
 nStt = nEndPos;
-} while( nEndPos < nEnd && pIter && pIter->Next() );
+
+// tdf#157937 selection containing tracked changes needs loop 
control:
+// stop looping, if there are too much empty transliterations
+if ( sChgd.isEmpty() )
+++nLoopControlRuns;
+
+} while( nEndPos < nEnd && pIter && pIter->Next() && nLoopControlRuns 
< 100 );
 }
 
 if (aChanges.empty())


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source

2023-10-17 Thread László Németh (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |2 ++
 sw/qa/core/text/frmform.cxx   |5 +
 sw/qa/extras/ooxmlexport/data/tdf130088.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   11 +++
 sw/source/core/doc/DocumentSettingManager.cxx |   11 +++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/text/guess.cxx |8 
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 9 files changed, 61 insertions(+)

New commits:
commit 7d08767b890e723cd502b1c61d250924f695eb98
Author: László Németh 
AuthorDate: Mon Oct 16 19:39:30 2023 +0200
Commit: László Németh 
CommitDate: Tue Oct 17 10:37:23 2023 +0200

tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt.

Writer typeset DOCX files with more lines/pages, because of
new default paragraph justification algorithm of MSO 2013 and
newer, which resulted in losing text layout interoperability
for new DOCX documents.

Add new compatibility option "JustifyLinesWithShrinking" to
store also the new type of justification in OpenDocument files.

First analysis of the unknown justification algorithm shows
up to 2% shrinking of plain justified line. Apply this value
to break the lines in the same (or very similar) positions
during importing a DOCX file with compatibilityMode >= 15
(created in MSO 2013 or newer), to avoid typesetting more lines
and pages.

Note: shrinking will be added by the next commits, fixing
the temporary exceeding lines.

Change-Id: I9a00db888e9af3f6723e4c502158e8e56a00ef02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158063
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 8e5e3a587997..b8077ea9ad56 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -94,6 +94,8 @@ enum class DocumentSettingId
 HYPHENATE_URLS, ///< tdf#152952
 DO_NOT_BREAK_WRAPPED_TABLES,
 ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
+// tdf#119908 new paragraph justification
+JUSTIFY_LINES_WITH_SHRINKING,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/core/text/frmform.cxx b/sw/qa/core/text/frmform.cxx
index ee791f325729..b321fca51cee 100644
--- a/sw/qa/core/text/frmform.cxx
+++ b/sw/qa/core/text/frmform.cxx
@@ -63,6 +63,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableNegativeVertOffset)
 CPPUNIT_ASSERT_LESS(pPara2->getFrameArea().Top(), rFlyRect.Bottom());
 }
 
+// FIXME: because breaking the lines at the right place, this test
+// became obsolete: proposed fix is to modify compatibilityMode to "14"
+// in the DOCX test file to use the old justification algorithm
+#if 0
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 {
 // Given a document with a 6-page floating table and some anchor text:
@@ -81,6 +85,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 // anchors of non-last split fly frames should contain no text.
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
pAnchor->GetOffset().get());
 }
+#endif
 
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidLastManipOfst)
 {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf130088.docx 
b/sw/qa/extras/ooxmlexport/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130088.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index dd0c1a75e48f..704166e695a5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1397,6 +1397,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx")
 }
 #endif
 
+DECLARE_OOXMLEXPORT_TEST(testTdf130088, "tdf130088.docx")
+{
+// This was 2 (justification without shrinking resulted more lines)
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// check compatibility option in ODT export/import, too
+saveAndReload("writer8");
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, 
"cont-sect-break-header-footer.docx")
 {
 // Load a document with a continuous section break on page 2.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 53bd26fa9d08..86aa3ede7e81 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -255,6 +255,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 return mbDoNotBreakWrappedTables;
 case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
 return mbAllowTextAfterFloatingTableBreak;
+case 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-10-11 Thread László Németh (via logerrit)
 sw/source/core/txtnode/txtedt.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit f3c084853331a9552821c369349398f964c73ab6
Author: László Németh 
AuthorDate: Tue Oct 10 15:49:38 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 11 10:52:21 2023 +0200

tdf#157442 sw: fix spell checking of words next to digits

If the preceding or subsequent word was a number or a word with
numbers, misspelled words were accepted as correct.

Note: it occurred with disabled "Check words with numbers"
(default setting in Options – Language Settings – Writing Aids).

Regression from commit 5619fc438273cd15e78539e78b8af751bca24b1a
"tdf#154499 sw spell checking: add 2-word phrase checking".

Change-Id: I4478c89d04ebf971925d4bdd56aaebc7ce8fb77e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157799
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 4df899de2ac51e684e83ab95dd25fc752ce2e92e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157775
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 1e9082201f7a..71ee1fd93a24 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1077,9 +1078,11 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs)
 const OUString& rActualWord = aScanner.GetPrevWord();
 bCalledNextWord = true;
 // check space separated word pairs in the dictionary, 
e.g. "vice versa"
-if ( !((bNextWord && pArgs->xSpeller->isValid( 
rActualWord + " " + aScanner.GetWord(),
+if ( !((bNextWord && 
!linguistic::HasDigits(aScanner.GetWord()) &&
+pArgs->xSpeller->isValid( rActualWord + " " + 
aScanner.GetWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() )) ||
-   ( !sPrevWord.isEmpty() && pArgs->xSpeller->isValid( 
sPrevWord + " " + rActualWord,
+   ( !sPrevWord.isEmpty() && 
!linguistic::HasDigits(sPrevWord) &&
+pArgs->xSpeller->isValid( sPrevWord + " " + 
rActualWord,
 static_cast(eActLang), Sequence< 
PropertyValue >() ))) )
 {
 // make sure the selection build later from the 
data
@@ -1395,9 +1398,11 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, 
sal_Int32 nActPos)
 bNextWord = aScanner.NextWord();
 bCalledNextWord = true;
 // check space separated word pairs in the dictionary, 
e.g. "vice versa"
-if ( !((bNextWord && xSpell->isValid( 
aScanner.GetPrevWord() + " " + aScanner.GetWord(),
+if ( !((bNextWord && 
!linguistic::HasDigits(aScanner.GetWord()) &&
+xSpell->isValid( aScanner.GetPrevWord() + " " + 
aScanner.GetWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() )) ||
-   (!sPrevWord.isEmpty() && xSpell->isValid( sPrevWord 
+ " " + aScanner.GetPrevWord(),
+   (!sPrevWord.isEmpty() && 
!linguistic::HasDigits(sPrevWord) &&
+xSpell->isValid( sPrevWord + " " + 
aScanner.GetPrevWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() ))) )
 {
 sal_Int32 nSmartTagStt = nBegin;


[Libreoffice-commits] core.git: sw/source

2023-10-11 Thread László Németh (via logerrit)
 sw/source/core/txtnode/txtedt.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit a822df6379606ab9f62d6ebb2318d0294d9c959c
Author: László Németh 
AuthorDate: Tue Oct 10 15:49:38 2023 +0200
Commit: László Németh 
CommitDate: Wed Oct 11 09:00:37 2023 +0200

tdf#157442 sw: fix spell checking of words next to digits

If the preceding or subsequent word was a number or a word with
numbers, misspelled words were accepted as correct.

Note: it occurred with disabled "Check words with numbers"
(default setting in Options – Language Settings – Writing Aids).

Regression from commit 5619fc438273cd15e78539e78b8af751bca24b1a
"tdf#154499 sw spell checking: add 2-word phrase checking".

Change-Id: I4478c89d04ebf971925d4bdd56aaebc7ce8fb77e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157799
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 1e9082201f7a..71ee1fd93a24 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1077,9 +1078,11 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs)
 const OUString& rActualWord = aScanner.GetPrevWord();
 bCalledNextWord = true;
 // check space separated word pairs in the dictionary, 
e.g. "vice versa"
-if ( !((bNextWord && pArgs->xSpeller->isValid( 
rActualWord + " " + aScanner.GetWord(),
+if ( !((bNextWord && 
!linguistic::HasDigits(aScanner.GetWord()) &&
+pArgs->xSpeller->isValid( rActualWord + " " + 
aScanner.GetWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() )) ||
-   ( !sPrevWord.isEmpty() && pArgs->xSpeller->isValid( 
sPrevWord + " " + rActualWord,
+   ( !sPrevWord.isEmpty() && 
!linguistic::HasDigits(sPrevWord) &&
+pArgs->xSpeller->isValid( sPrevWord + " " + 
rActualWord,
 static_cast(eActLang), Sequence< 
PropertyValue >() ))) )
 {
 // make sure the selection build later from the 
data
@@ -1395,9 +1398,11 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, 
sal_Int32 nActPos)
 bNextWord = aScanner.NextWord();
 bCalledNextWord = true;
 // check space separated word pairs in the dictionary, 
e.g. "vice versa"
-if ( !((bNextWord && xSpell->isValid( 
aScanner.GetPrevWord() + " " + aScanner.GetWord(),
+if ( !((bNextWord && 
!linguistic::HasDigits(aScanner.GetWord()) &&
+xSpell->isValid( aScanner.GetPrevWord() + " " + 
aScanner.GetWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() )) ||
-   (!sPrevWord.isEmpty() && xSpell->isValid( sPrevWord 
+ " " + aScanner.GetPrevWord(),
+   (!sPrevWord.isEmpty() && 
!linguistic::HasDigits(sPrevWord) &&
+xSpell->isValid( sPrevWord + " " + 
aScanner.GetPrevWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() ))) )
 {
 sal_Int32 nSmartTagStt = nBegin;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-10-09 Thread László Németh (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   34 
 1 file changed, 34 insertions(+)

New commits:
commit 985015195007ee236e62254bc5685816f7e4ec5a
Author: László Németh 
AuthorDate: Wed Sep 27 00:41:22 2023 +0200
Commit: László Németh 
CommitDate: Mon Oct 9 15:52:26 2023 +0200

tdf#141198 sw: fix cycle case with change tracking

Fix cycle case with change tracking by rejecting
changes of the word, and setting the cursor inside
the original word.

Previously the cycle case resulted only in a tracked
deletion and tracked insertion, putting the text
cursor at after the word, so it was not possible to
cycle on the different cases e.g. by pressing Shift-F3
multiple times (and moving the text cursor inside
the tracked insertion didn't help, because resulted
in broken text at asking for the next cycle).

A regression from commit 2d3c77e9b10f20091ef338e262ba7756eb280ce9
"tdf#109266 sw change tracking: track transliteration".

Change-Id: I819cf0ec722d54852bfc31f7765e0f06e2a07fd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157303
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit dc748d7dbd114fbf663752258dbaf003af2926c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157321
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f7d24dd55ea0..47e5b818b2fb 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -2999,6 +3001,38 @@ void DocumentContentOperationsManager::TransliterateText(
 }
 } else {
 /* Cursor is not inside of a word. Nothing should happen. */
+/* Except in the case of change tracking, when the cursor is at 
the end of the change */
+/* Recognize and reject the previous deleted and inserted words to 
allow to cycle */
+IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess();
+if ( IDocumentRedlineAccess::IsShowChanges( 
rIDRA.GetRedlineFlags() ) &&
+pStt->GetContentIndex() > 0 )
+{
+SwPosition aPos(*pStt->GetContentNode(), 
pStt->GetContentIndex() - 1);
+SwRedlineTable::size_type n = 0;
+
+const SwRangeRedline* pFnd =
+rIDRA.GetRedlineTable().FindAtPosition( 
aPos, n );
+if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 0 )
+{
+const SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[n-1];
+if ( RedlineType::Delete == pFnd2->GetType() &&
+  
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() &&
+  *pFnd2->End() == *pFnd->Start() &&
+  pFnd->GetAuthor() == pFnd2->GetAuthor() )
+{
+SwPosition aPos2(*pFnd2->End());
+rIDRA.RejectRedline(*pFnd, true);
+rIDRA.RejectRedline(*pFnd2, true);
+// positionate the text cursor inside the changed word 
to allow to cycle
+if ( SwWrtShell *pWrtShell = dynamic_cast(
+
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()) )
+{
+pWrtShell->GetCursor()->GetPoint()->
+Assign(*aPos2.GetContentNode(), 
aPos2.GetContentIndex() - 1);
+}
+}
+}
+}
 return;
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/qa sw/source

2023-09-29 Thread László Németh (via logerrit)
 sw/inc/doc.hxx   |2 
 sw/inc/swtable.hxx   |4 -
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   79 +++
 sw/source/core/doc/tblrwcl.cxx   |9 ++-
 sw/source/core/docnode/ndtbl.cxx |4 -
 sw/source/core/frmedt/fetab.cxx  |5 +-
 sw/source/core/table/swnewtable.cxx  |8 +--
 sw/source/uibase/dochdl/swdtflvr.cxx |   16 ---
 8 files changed, 98 insertions(+), 29 deletions(-)

New commits:
commit 2886d09892220058d34112968d4788bc3acc08da
Author: László Németh 
AuthorDate: Thu Sep 28 17:32:24 2023 +0200
Commit: László Németh 
CommitDate: Fri Sep 29 09:03:58 2023 +0200

tdf#157492 sw: fix tracked drag & drop of table row

Selecting table rows by the left row border, and
moving them via drag & drop resulted only tracked
deletion, but not tracked insertion.

See also commit 3e6125c72f8c07c14df42d45571cab44f24e9f70
"tdf#155846 sw tracked table column: fix drag & drop".

This reverts also commit 5a1c19624eda0c8b847af0dcee70b82502578ceb
"tdf#146965 sw track changes: fix tracked table row moving".

Change-Id: I7287e46188eee123b5fd36a5ec7ac5311699840b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157382
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 65efbf64cfa30ba96bc9f0ba539eb1414b861c49)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157323
Tested-by: Jenkins

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 86fd5a67c8ca..04e12b2a4967 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1208,7 +1208,7 @@ public:
 void InsertRow( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertRow( const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt = 1, bool bBehind = true );
+sal_uInt16 nCnt = 1, bool bBehind = true, bool 
bInsertDummy = true );
 
 // Delete Columns/Rows in table.
 enum class RowColMode { DeleteRow = 0, DeleteColumn = 1, DeleteProtected = 
2 };
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index a7d1bd87d4d4..3d0a5732d188 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -167,7 +167,7 @@ private:
 bool NewSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
 std::optional CollectBoxSelection( const SwPaM& rPam ) 
const;
 void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
-bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind 
);
+bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind, 
bool bInsertDummy );
 bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, 
bool, bool bInsertDummy );
 void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* 
);
 void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
@@ -254,7 +254,7 @@ public:
 bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
 sal_uInt16 nCnt, bool bBehind, bool bInsertDummy );
 bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt, bool bBehind );
+sal_uInt16 nCnt, bool bBehind, bool bInsertDummy = true );
 void PrepareDelBoxes( const SwSelBoxes& rBoxes );
 bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* 
pMerged,
 SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder );
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 716b995ec5ac..73178363b8fb 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -930,6 +930,85 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf147181_TrackedMovingOfMultipleTable
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable2b->getRows()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157492_TrackedMovingRow)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Create a table
+SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+(void)>InsertTable(TableOpt, 4, 3);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// fill table with data
+for (int i = 0; i < 3; ++i)
+{
+pWrtShell->Insert("x");
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
+}
+
+Scheduler::ProcessEventsToIdle();
+
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/qa sw/source

2023-09-29 Thread László Németh (via logerrit)
 sw/inc/doc.hxx   |2 
 sw/inc/swtable.hxx   |4 -
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   82 +++
 sw/source/core/doc/tblrwcl.cxx   |5 +-
 sw/source/core/docnode/ndtbl.cxx |4 -
 sw/source/core/frmedt/fetab.cxx  |5 +-
 sw/source/core/table/swnewtable.cxx  |   12 +++--
 sw/source/uibase/dochdl/swdtflvr.cxx |6 +-
 8 files changed, 105 insertions(+), 15 deletions(-)

New commits:
commit c35828816f6fd9eff6e0d4f0f50b5312090b012e
Author: László Németh 
AuthorDate: Wed Sep 27 22:10:15 2023 +0200
Commit: László Németh 
CommitDate: Fri Sep 29 09:03:35 2023 +0200

tdf#155846 sw tracked table column: fix drag & drop

Selecting table columns by the top border, and
moving them via drag & drop resulted only tracked
deletion, but not tracked insertion.

See also commit 912336f3c85d9a631fa0ac0f270bab04b204f619
"tdf#154599 sw: fix crash at drag & drop table columns".

Change-Id: Ib392f0700ec8c17a342df435c8bb1883967b0711
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157370
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 1d94699594f7515aa82bdeeb537eb89849f84de3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157320
Tested-by: László Németh 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 335ccff90317..86fd5a67c8ca 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1204,7 +1204,7 @@ public:
 void InsertCol( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertCol( const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt = 1, bool bBehind = true );
+sal_uInt16 nCnt = 1, bool bBehind = true, bool 
bInsertDummy = true );
 void InsertRow( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertRow( const SwSelBoxes& rBoxes,
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index e8b4ad35602f..a7d1bd87d4d4 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -168,7 +168,7 @@ private:
 std::optional CollectBoxSelection( const SwPaM& rPam ) 
const;
 void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
 bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind 
);
-bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool 
);
+bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, 
bool, bool bInsertDummy );
 void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* 
);
 void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
 void NewSetTabCols( Parm , const SwTabCols , const SwTabCols ,
@@ -252,7 +252,7 @@ public:
 void PrepareDeleteCol( tools::Long nMin, tools::Long nMax );
 
 bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt, bool bBehind );
+sal_uInt16 nCnt, bool bBehind, bool bInsertDummy );
 bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
 sal_uInt16 nCnt, bool bBehind );
 void PrepareDelBoxes( const SwSelBoxes& rBoxes );
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 3c7f616a5be3..716b995ec5ac 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -979,6 +979,88 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf154599_MovingColumn)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155846_MovingColumn)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Create a table
+SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+(void)>InsertTable(TableOpt, 4, 3);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// fill table with data
+for (int i = 0; i < 4; ++i)
+{
+pWrtShell->Insert("x");
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN);
+}
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Reference xCellA1(xTable1->getCellByName("A1"), 
uno::UNO_QUERY);
+xCellA1->setString("A1");
+uno::Reference xCellA2(xTable1->getCellByName("A2"), 
uno::UNO_QUERY);
+xCellA2->setString("A2");
+uno::Reference xCellA3(xTable1->getCellByName("A3"), 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-09-28 Thread László Németh (via logerrit)
 sw/inc/doc.hxx   |2 
 sw/inc/swtable.hxx   |4 -
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   79 +++
 sw/source/core/doc/tblrwcl.cxx   |9 ++-
 sw/source/core/docnode/ndtbl.cxx |4 -
 sw/source/core/frmedt/fetab.cxx  |5 +-
 sw/source/core/table/swnewtable.cxx  |8 +--
 sw/source/uibase/dochdl/swdtflvr.cxx |   16 ---
 8 files changed, 98 insertions(+), 29 deletions(-)

New commits:
commit 65efbf64cfa30ba96bc9f0ba539eb1414b861c49
Author: László Németh 
AuthorDate: Thu Sep 28 17:32:24 2023 +0200
Commit: László Németh 
CommitDate: Thu Sep 28 22:50:35 2023 +0200

tdf#157492 sw: fix tracked drag & drop of table row

Selecting table rows by the left row border, and
moving them via drag & drop resulted only tracked
deletion, but not tracked insertion.

See also commit 3e6125c72f8c07c14df42d45571cab44f24e9f70
"tdf#155846 sw tracked table column: fix drag & drop".

This reverts also commit 5a1c19624eda0c8b847af0dcee70b82502578ceb
"tdf#146965 sw track changes: fix tracked table row moving".

Change-Id: I7287e46188eee123b5fd36a5ec7ac5311699840b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157382
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ba05ef371056..5fd6b58064c3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1208,7 +1208,7 @@ public:
 void InsertRow( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertRow( const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt = 1, bool bBehind = true );
+sal_uInt16 nCnt = 1, bool bBehind = true, bool 
bInsertDummy = true );
 
 // Delete Columns/Rows in table.
 enum class RowColMode { DeleteRow = 0, DeleteColumn = 1, DeleteProtected = 
2 };
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index a7d1bd87d4d4..3d0a5732d188 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -167,7 +167,7 @@ private:
 bool NewSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
 std::optional CollectBoxSelection( const SwPaM& rPam ) 
const;
 void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
-bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind 
);
+bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind, 
bool bInsertDummy );
 bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, 
bool, bool bInsertDummy );
 void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* 
);
 void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
@@ -254,7 +254,7 @@ public:
 bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
 sal_uInt16 nCnt, bool bBehind, bool bInsertDummy );
 bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt, bool bBehind );
+sal_uInt16 nCnt, bool bBehind, bool bInsertDummy = true );
 void PrepareDelBoxes( const SwSelBoxes& rBoxes );
 bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* 
pMerged,
 SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder );
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 5ef637c356e6..a02ebf08c6a0 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -926,6 +926,85 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf147181_TrackedMovingOfMultipleTable
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable2b->getRows()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157492_TrackedMovingRow)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Create a table
+SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+(void)>InsertTable(TableOpt, 4, 3);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// fill table with data
+for (int i = 0; i < 3; ++i)
+{
+pWrtShell->Insert("x");
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
+}
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Reference xCellA1(xTable1->getCellByName("A1"), 
uno::UNO_QUERY);
+xCellA1->setString("A1");
+uno::Reference xCellB1(xTable1->getCellByName("B1"), 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-09-28 Thread László Németh (via logerrit)
 sw/inc/doc.hxx   |2 
 sw/inc/swtable.hxx   |4 -
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   82 +++
 sw/source/core/doc/tblrwcl.cxx   |5 +-
 sw/source/core/docnode/ndtbl.cxx |4 -
 sw/source/core/frmedt/fetab.cxx  |5 +-
 sw/source/core/table/swnewtable.cxx  |   12 +++--
 sw/source/uibase/dochdl/swdtflvr.cxx |6 +-
 8 files changed, 105 insertions(+), 15 deletions(-)

New commits:
commit 3e6125c72f8c07c14df42d45571cab44f24e9f70
Author: László Németh 
AuthorDate: Wed Sep 27 22:10:15 2023 +0200
Commit: László Németh 
CommitDate: Thu Sep 28 17:34:34 2023 +0200

tdf#155846 sw tracked table column: fix drag & drop

Selecting table columns by the top border, and
moving them via drag & drop resulted only tracked
deletion, but not tracked insertion.

See also commit 912336f3c85d9a631fa0ac0f270bab04b204f619
"tdf#154599 sw: fix crash at drag & drop table columns".

Change-Id: Ib392f0700ec8c17a342df435c8bb1883967b0711
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157370
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a84df42b8c87..ba05ef371056 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1204,7 +1204,7 @@ public:
 void InsertCol( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertCol( const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt = 1, bool bBehind = true );
+sal_uInt16 nCnt = 1, bool bBehind = true, bool 
bInsertDummy = true );
 void InsertRow( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertRow( const SwSelBoxes& rBoxes,
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index e8b4ad35602f..a7d1bd87d4d4 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -168,7 +168,7 @@ private:
 std::optional CollectBoxSelection( const SwPaM& rPam ) 
const;
 void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
 bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind 
);
-bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool 
);
+bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, 
bool, bool bInsertDummy );
 void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* 
);
 void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
 void NewSetTabCols( Parm , const SwTabCols , const SwTabCols ,
@@ -252,7 +252,7 @@ public:
 void PrepareDeleteCol( tools::Long nMin, tools::Long nMax );
 
 bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt, bool bBehind );
+sal_uInt16 nCnt, bool bBehind, bool bInsertDummy );
 bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
 sal_uInt16 nCnt, bool bBehind );
 void PrepareDelBoxes( const SwSelBoxes& rBoxes );
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index f1f349779dac..5ef637c356e6 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -975,6 +975,88 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf154599_MovingColumn)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155846_MovingColumn)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Create a table
+SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+(void)>InsertTable(TableOpt, 4, 3);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// fill table with data
+for (int i = 0; i < 4; ++i)
+{
+pWrtShell->Insert("x");
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN);
+}
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Reference xCellA1(xTable1->getCellByName("A1"), 
uno::UNO_QUERY);
+xCellA1->setString("A1");
+uno::Reference xCellA2(xTable1->getCellByName("A2"), 
uno::UNO_QUERY);
+xCellA2->setString("A2");
+uno::Reference xCellA3(xTable1->getCellByName("A3"), 
uno::UNO_QUERY);
+xCellA3->setString("A3");
+uno::Reference xCellA4(xTable1->getCellByName("A4"), 
uno::UNO_QUERY);
+xCellA4->setString("A4");
+
+

[Libreoffice-commits] core.git: sw/qa sw/source

2023-09-28 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests7/tdf156900.py |   46 
 sw/source/core/frmedt/fetab.cxx |   28 ---
 2 files changed, 58 insertions(+), 16 deletions(-)

New commits:
commit 5d490133efe7a2509515ac6d85ed3db0a7988b3c
Author: László Németh 
AuthorDate: Wed Sep 27 14:16:53 2023 +0200
Commit: László Németh 
CommitDate: Thu Sep 28 09:37:13 2023 +0200

tdf#156900 sw tracked table column: fix row deletion

If the last deleted table column was hidden, it was
not possible to delete the table rows.

Regression from commit aff269c18b9029fec992135a406dc5031927c401
"tdf#155345 sw tracked table column: hide them in Hide Changes mode".

Change-Id: I51b78f6f5552bdba2240bf278ac1d796830a1beb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157330
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/uitest/writer_tests7/tdf156900.py 
b/sw/qa/uitest/writer_tests7/tdf156900.py
new file mode 100644
index ..545be94242f4
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf156900.py
@@ -0,0 +1,46 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+# Bug 156900 - no row deletion when there is a hidden last column
+
+class tdf156900(UITestCase):
+def test_tdf156900(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+# delete last column
+self.xUITest.executeCommand(".uno:GoRight")
+self.xUITest.executeCommand(".uno:GoRight")
+self.xUITest.executeCommand(".uno:GoRight")
+self.xUITest.executeCommand(".uno:GoRight")
+self.xUITest.executeCommand(".uno:DeleteColumns")
+
+# hide changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# delete first row
+self.xUITest.executeCommand(".uno:DeleteRows")
+
+# accept all changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+tables = self.document.getTextTables()
+# This was 3 (not deleted row)
+self.assertEqual(len(tables[0].getRows()), 2)
+
+# show changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 59b031ce772a..74b9874dc5ac 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -425,8 +425,10 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
 
 // tracked deletion: remove only textbox content,
 // and set HasTextChangesOnly table line property to false
+SwEditShell* pEditShell = nullptr;
 if ( bRecordChanges )
 {
+pEditShell = GetDoc()->GetEditShell();
 SvxPrintItem aHasTextChangesOnly(RES_PRINT, false);
 GetDoc()->SetRowNotTracked( *getShellCursor( false ), 
aHasTextChangesOnly );
 
@@ -436,7 +438,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
 // don't need to remove the row frames in Show Changes mode
 if ( !bRecordAndHideChanges )
 {
-if (SwEditShell* pEditShell = GetDoc()->GetEditShell())
+if ( pEditShell )
 pEditShell->Delete(false);
 
 EndAllActionAndCall();
@@ -540,36 +542,30 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
 }
 
 // delete row content in Hide Changes mode
-if ( bRecordAndHideChanges )
+if ( pEditShell && bRecordAndHideChanges )
 {
-SwEditShell* pEditShell = GetDoc()->GetEditShell();
-
-// select the rows deleted with change tracking
-if ( SwWrtShell* pWrtShell = dynamic_cast(this) )
+// select the row deleted with change tracking cell by cell to 
handle
+// the already deleted cells
+SwWrtShell* pWrtShell = dynamic_cast(this);
+for (SwSelBoxes::size_type nBox = 0; pWrtShell && nBox < 
aBoxes.size(); ++nBox)
 {
 pWrtShell->SelectTableRow();
 SwCursor* pTableCursor = 
static_cast(GetTableCursor());
-auto pStt = aBoxes[0];
-auto pEnd = aBoxes.back();
-if ( pTableCursor )
-   

[Libreoffice-commits] core.git: sw/source

2023-09-27 Thread László Németh (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   34 
 1 file changed, 34 insertions(+)

New commits:
commit dc748d7dbd114fbf663752258dbaf003af2926c3
Author: László Németh 
AuthorDate: Wed Sep 27 00:41:22 2023 +0200
Commit: László Németh 
CommitDate: Wed Sep 27 08:22:11 2023 +0200

tdf#141198 sw: fix cycle case with change tracking

Fix cycle case with change tracking by rejecting
changes of the word, and setting the cursor inside
the original word.

Previously the cycle case resulted only in a tracked
deletion and tracked insertion, putting the text
cursor at after the word, so it was not possible to
cycle on the different cases e.g. by pressing Shift-F3
multiple times (and moving the text cursor inside
the tracked insertion didn't help, because resulted
in broken text at asking for the next cycle).

A regression from commit 2d3c77e9b10f20091ef338e262ba7756eb280ce9
"tdf#109266 sw change tracking: track transliteration".

Change-Id: I819cf0ec722d54852bfc31f7765e0f06e2a07fd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157303
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 091da2714e02..8516a43485dd 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3000,6 +3002,38 @@ void DocumentContentOperationsManager::TransliterateText(
 }
 } else {
 /* Cursor is not inside of a word. Nothing should happen. */
+/* Except in the case of change tracking, when the cursor is at 
the end of the change */
+/* Recognize and reject the previous deleted and inserted words to 
allow to cycle */
+IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess();
+if ( IDocumentRedlineAccess::IsShowChanges( 
rIDRA.GetRedlineFlags() ) &&
+pStt->GetContentIndex() > 0 )
+{
+SwPosition aPos(*pStt->GetContentNode(), 
pStt->GetContentIndex() - 1);
+SwRedlineTable::size_type n = 0;
+
+const SwRangeRedline* pFnd =
+rIDRA.GetRedlineTable().FindAtPosition( 
aPos, n );
+if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 0 )
+{
+const SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[n-1];
+if ( RedlineType::Delete == pFnd2->GetType() &&
+  
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() &&
+  *pFnd2->End() == *pFnd->Start() &&
+  pFnd->GetAuthor() == pFnd2->GetAuthor() )
+{
+SwPosition aPos2(*pFnd2->End());
+rIDRA.RejectRedline(*pFnd, true);
+rIDRA.RejectRedline(*pFnd2, true);
+// positionate the text cursor inside the changed word 
to allow to cycle
+if ( SwWrtShell *pWrtShell = dynamic_cast(
+
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()) )
+{
+pWrtShell->GetCursor()->GetPoint()->
+Assign(*aPos2.GetContentNode(), 
aPos2.GetContentIndex() - 1);
+}
+}
+}
+}
 return;
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-09-19 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx   |4 
 sw/source/core/table/swtable.cxx |2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 --
 sw/source/filter/ww8/docxattributeoutput.hxx |4 
 4 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit a4bef51e14c7829b368bda0cf06c87c16a03b1b1
Author: László Németh 
AuthorDate: Wed Sep 13 10:42:45 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 19 11:46:25 2023 +0200

tdf#157187 sw tracked table column: fix DOCX export

DOCX export of tracked table column changes
could result dummy content boxes and missing
tracked table column changes in MSO, i.e. lost
interoperability. As a workaround, skip
exporting content boxes within tracked table cells.

Note: bad 0x01 characters and incomplete w:sdt export in table
cells since commit b5c616d10bff3213840d4893d13b4493de71fa56
"tdf#104823: support for sdt plain text fields".

See also commit 4697d2bda1b37f9cf8b301f5bf044c2390f56333
"tdf#157011 sw tracked table column: fix DOCX import of empty cell".

Change-Id: I32f77c7532a9cc6bf5d88a626ac3c62a5c02a34a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156895
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit a388a0d245314182694ea7d7f16c71290a3e4ba2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156881
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index e5a585f01d68..243bfffb23c2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1335,6 +1335,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf157011, 
"tdf157011_ins_del_empty_cols.docx")
 
 // This was 4 (missing tracked table cell deletions)
 assertXPath(pXmlDoc, "//w:del", 6);
+
+// tdf#157187 This was false (dummy w:tc/w:p/w:sdt/w:sdtContent 
content box)
+assertXPath(pXmlDoc, "//w:tc/w:p/w:del", 6);
+assertXPath(pXmlDoc, "//w:tc/w:p/w:ins", 3);
 }
 }
 
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 0fbede71641f..e5a2ccba936f 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2262,7 +2262,7 @@ bool SwTableBox::IsEmpty( bool bWithRemainingNestedTable 
) const
 
 // tdf#157011 OOXML w:std cell content is imported with terminating 
0x01 characters,
 // i.e. an empty box can contain double 0x01: handle it to avoid 
losing change tracking
-// FIXME regression since LibreOffice 7.3?
+// FIXME regression since commit 
b5c616d10bff3213840d4893d13b4493de71fa56
 if ( pCNd && pCNd->Len() == 2 && pCNd->GetTextNode() )
 {
 const OUString  = pCNd->GetTextNode()->GetText();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index c780454e8a6e..8b4c14c488ce 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2010,7 +2010,10 @@ void DocxAttributeOutput::EndRun(const SwTextNode* 
pNode, sal_Int32 nPos, sal_In
 {
 auto pTextContentControl = 
static_txtattr_cast(pAttr);
 m_pContentControl = 
pTextContentControl->GetContentControl().GetContentControl();
-WriteContentControlStart();
+if (!m_tableReference.m_bTableCellChanged)
+{
+WriteContentControlStart();
+}
 }
 }
 
@@ -2036,7 +2039,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 {
 sal_Int32 nEnd = nPos + nLen;
 SwTextAttr* pAttr = pNode->GetTextAttrAt(nPos, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Default);
-if (pAttr && *pAttr->GetEnd() == nEnd)
+if (pAttr && *pAttr->GetEnd() == nEnd && 
!m_tableReference.m_bTableCellChanged)
 {
 WriteContentControlEnd();
 }
@@ -4722,6 +4725,12 @@ void DocxAttributeOutput::StartTableCell( 
ww8::WW8TableNodeInfoInner::Pointer_t
 
 InitTableHelper( pTableTextNodeInfoInner );
 
+// check tracked table column deletion or insertion
+const SwTableBox* pTabBox = pTableTextNodeInfoInner->getTableBox();
+SwRedlineTable::size_type nChange = pTabBox->GetRedline();
+if (nChange != SwRedlineTable::npos)
+m_tableReference.m_bTableCellChanged = true;
+
 m_pSerializer->startElementNS(XML_w, XML_tc);
 
 // Write the cell properties here
@@ -4742,6 +4751,7 @@ void DocxAttributeOutput::EndTableCell(sal_uInt32 nCell)
 
 m_tableReference.m_bTableCellOpen = false;
 m_tableReference.m_bTableCellParaSdtOpen = false;
+m_tableReference.m_bTableCellChanged = false;
 }
 
 void DocxAttributeOutput::StartStyles()
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-09-13 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx   |4 
 sw/source/core/table/swtable.cxx |2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 --
 sw/source/filter/ww8/docxattributeoutput.hxx |4 
 4 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit d23ba9e6103bba27b57c59505641cc64db63ec98
Author: László Németh 
AuthorDate: Wed Sep 13 10:42:45 2023 +0200
Commit: László Németh 
CommitDate: Wed Sep 13 23:37:02 2023 +0200

tdf#157187 sw tracked table column: fix DOCX export

DOCX export of tracked table column changes
could result dummy content boxes and missing
tracked table column changes in MSO, i.e. lost
interoperability. As a workaround, skip
exporting content boxes within tracked table cells.

Note: bad 0x01 characters and incomplete w:sdt export in table
cells since commit b5c616d10bff3213840d4893d13b4493de71fa56
"tdf#104823: support for sdt plain text fields".

See also commit 4697d2bda1b37f9cf8b301f5bf044c2390f56333
"tdf#157011 sw tracked table column: fix DOCX import of empty cell".

Change-Id: I32f77c7532a9cc6bf5d88a626ac3c62a5c02a34a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156895
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index e5a585f01d68..243bfffb23c2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1335,6 +1335,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf157011, 
"tdf157011_ins_del_empty_cols.docx")
 
 // This was 4 (missing tracked table cell deletions)
 assertXPath(pXmlDoc, "//w:del", 6);
+
+// tdf#157187 This was false (dummy w:tc/w:p/w:sdt/w:sdtContent 
content box)
+assertXPath(pXmlDoc, "//w:tc/w:p/w:del", 6);
+assertXPath(pXmlDoc, "//w:tc/w:p/w:ins", 3);
 }
 }
 
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index ca360e324081..3d53ef518903 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2267,7 +2267,7 @@ bool SwTableBox::IsEmpty( bool bWithRemainingNestedTable 
) const
 
 // tdf#157011 OOXML w:std cell content is imported with terminating 
0x01 characters,
 // i.e. an empty box can contain double 0x01: handle it to avoid 
losing change tracking
-// FIXME regression since LibreOffice 7.3?
+// FIXME regression since commit 
b5c616d10bff3213840d4893d13b4493de71fa56
 if ( pCNd && pCNd->Len() == 2 && pCNd->GetTextNode() )
 {
 const OUString  = pCNd->GetTextNode()->GetText();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4b51f52c6796..6d67081e932f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2013,7 +2013,10 @@ void DocxAttributeOutput::EndRun(const SwTextNode* 
pNode, sal_Int32 nPos, sal_In
 {
 auto pTextContentControl = 
static_txtattr_cast(pAttr);
 m_pContentControl = 
pTextContentControl->GetContentControl().GetContentControl();
-WriteContentControlStart();
+if (!m_tableReference.m_bTableCellChanged)
+{
+WriteContentControlStart();
+}
 }
 }
 
@@ -2039,7 +2042,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 {
 sal_Int32 nEnd = nPos + nLen;
 SwTextAttr* pAttr = pNode->GetTextAttrAt(nPos, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Default);
-if (pAttr && *pAttr->GetEnd() == nEnd)
+if (pAttr && *pAttr->GetEnd() == nEnd && 
!m_tableReference.m_bTableCellChanged)
 {
 WriteContentControlEnd();
 }
@@ -4725,6 +4728,12 @@ void DocxAttributeOutput::StartTableCell( 
ww8::WW8TableNodeInfoInner::Pointer_t
 
 InitTableHelper( pTableTextNodeInfoInner );
 
+// check tracked table column deletion or insertion
+const SwTableBox* pTabBox = pTableTextNodeInfoInner->getTableBox();
+SwRedlineTable::size_type nChange = pTabBox->GetRedline();
+if (nChange != SwRedlineTable::npos)
+m_tableReference.m_bTableCellChanged = true;
+
 m_pSerializer->startElementNS(XML_w, XML_tc);
 
 // Write the cell properties here
@@ -4745,6 +4754,7 @@ void DocxAttributeOutput::EndTableCell(sal_uInt32 nCell)
 
 m_tableReference.m_bTableCellOpen = false;
 m_tableReference.m_bTableCellParaSdtOpen = false;
+m_tableReference.m_bTableCellChanged = false;
 }
 
 void DocxAttributeOutput::StartStyles()
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index e8b255bdc990..88fbeeaf740f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-09-07 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx  |   15 
++
 sw/source/core/table/swtable.cxx|   10 ++
 3 files changed, 25 insertions(+)

New commits:
commit e6fc440bdb02c6a815153275ef1c7ded6f8d4a7a
Author: László Németh 
AuthorDate: Wed Sep 6 18:01:28 2023 +0200
Commit: László Németh 
CommitDate: Thu Sep 7 10:40:46 2023 +0200

tdf#157011 sw tracked table column: fix DOCX import of empty cell

OOXML w:std elements are imported with 0x01 characters in text
content of tracked table columns (as a regression in LO 7.3?),
losing change tracking data. Fix this temporarily by completing
SwTableBox::IsEmpty() handling the bad 0x01 characters of the
imported tracked empty cells.

See also commit a483a44ca00f43a64ae51d62b8fbb4129a413f6d
"tdf#143215 DOCX import: fix tracked empty row insertion/deletion".

Change-Id: I4895754e540cca6ba2cb3442f24a8affcedd51fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156626
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit ec2de3e6f8e1dcca52e7e3cf36146d683afbf4f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156601
Tested-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx 
b/sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx
new file mode 100644
index ..5ebb98fda0d7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index e406d546aea6..e5a585f01d68 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1323,6 +1323,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf150824, "tdf150824.fodt")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf157011, "tdf157011_ins_del_empty_cols.docx")
+{
+// check tracked table column insertions and deletions with empty cells
+if (isExported())
+{
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+// This was 1 (missing tracked table cell insertions)
+assertXPath(pXmlDoc, "//w:ins", 3);
+
+// This was 4 (missing tracked table cell deletions)
+assertXPath(pXmlDoc, "//w:del", 6);
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf150824_regression, "ooo30436-1-minimized.sxw")
 {
 // There should be no crash during loading of the document
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 04d58363b97d..0fbede71641f 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2259,6 +2259,16 @@ bool SwTableBox::IsEmpty( bool bWithRemainingNestedTable 
) const
 const SwContentNode *pCNd = pFirstNode->GetContentNode();
 if ( pCNd && !pCNd->Len() )
 return true;
+
+// tdf#157011 OOXML w:std cell content is imported with terminating 
0x01 characters,
+// i.e. an empty box can contain double 0x01: handle it to avoid 
losing change tracking
+// FIXME regression since LibreOffice 7.3?
+if ( pCNd && pCNd->Len() == 2 && pCNd->GetTextNode() )
+{
+const OUString  = pCNd->GetTextNode()->GetText();
+if ( rText[0] == 0x01 && rText[1] == 0x01 )
+return true;
+}
 }
 else if ( bWithRemainingNestedTable )
 {


[Libreoffice-commits] core.git: sw/qa sw/source

2023-09-06 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx  |   15 
++
 sw/source/core/table/swtable.cxx|   10 ++
 3 files changed, 25 insertions(+)

New commits:
commit 4697d2bda1b37f9cf8b301f5bf044c2390f56333
Author: László Németh 
AuthorDate: Wed Sep 6 18:01:28 2023 +0200
Commit: László Németh 
CommitDate: Wed Sep 6 20:33:16 2023 +0200

tdf#157011 sw tracked table column: fix DOCX import of empty cell

OOXML w:std elements are imported with 0x01 characters in text
content of tracked table columns (as a regression in LO 7.3?),
losing change tracking data. Fix this temporarily by completing
SwTableBox::IsEmpty() handling the bad 0x01 characters of the
imported tracked empty cells.

See also commit a483a44ca00f43a64ae51d62b8fbb4129a413f6d
"tdf#143215 DOCX import: fix tracked empty row insertion/deletion".

Change-Id: I4895754e540cca6ba2cb3442f24a8affcedd51fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156626
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx 
b/sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx
new file mode 100644
index ..5ebb98fda0d7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf157011_ins_del_empty_cols.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index e406d546aea6..e5a585f01d68 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1323,6 +1323,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf150824, "tdf150824.fodt")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf157011, "tdf157011_ins_del_empty_cols.docx")
+{
+// check tracked table column insertions and deletions with empty cells
+if (isExported())
+{
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+// This was 1 (missing tracked table cell insertions)
+assertXPath(pXmlDoc, "//w:ins", 3);
+
+// This was 4 (missing tracked table cell deletions)
+assertXPath(pXmlDoc, "//w:del", 6);
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf150824_regression, "ooo30436-1-minimized.sxw")
 {
 // There should be no crash during loading of the document
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index f42b9ad95ce5..ca360e324081 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2264,6 +2264,16 @@ bool SwTableBox::IsEmpty( bool bWithRemainingNestedTable 
) const
 const SwContentNode *pCNd = pFirstNode->GetContentNode();
 if ( pCNd && !pCNd->Len() )
 return true;
+
+// tdf#157011 OOXML w:std cell content is imported with terminating 
0x01 characters,
+// i.e. an empty box can contain double 0x01: handle it to avoid 
losing change tracking
+// FIXME regression since LibreOffice 7.3?
+if ( pCNd && pCNd->Len() == 2 && pCNd->GetTextNode() )
+{
+const OUString  = pCNd->GetTextNode()->GetText();
+if ( rText[0] == 0x01 && rText[1] == 0x01 )
+return true;
+}
 }
 else if ( bWithRemainingNestedTable )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6-1' - sw/qa sw/source

2023-09-06 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests7/tdf156784.py |   38 
 sw/source/core/crsr/crsrsh.cxx  |9 +++
 sw/source/core/frmedt/fetab.cxx |3 +-
 3 files changed, 49 insertions(+), 1 deletion(-)

New commits:
commit 720d333f4460ea50cad3c32f721e213b36c0140f
Author: László Németh 
AuthorDate: Thu Aug 24 16:27:16 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Sep 6 14:08:45 2023 +0200

tdf#156784 sw tracked table column: fix crash at Select All

Section starting table with hidden deleted first column
freezed at Select All, resulting crash because of infinite
recursion during waiting frame creation of a hidden cell
without frame in Hide Changes mode.

Regression from commit d1004cdd6a445ae73673b0ca360ae034b0ec09f2
"tdf#150673 sw offapi: add change tracking of table column deletion".

Change-Id: I15d9fa0138261d7a95c6e34a8d07fb2e001d0c7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156056
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 15639650efb2fa44e96fdc2bd46a64931b9a3329)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156134
Tested-by: László Németh 
(cherry picked from commit 49bfb463aebcfbe3935bc9989d9a1c5689149a09)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156378
Reviewed-by: Michael Stahl 
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py 
b/sw/qa/uitest/writer_tests7/tdf156784.py
new file mode 100644
index ..5cac8fc628db
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf156784.py
@@ -0,0 +1,38 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+# Bug 156784 - crash fix: Select All in section starting table with hidden 
first column
+
+class tdf156784(UITestCase):
+def test_tdf156784(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+# delete first column
+self.xUITest.executeCommand(".uno:DeleteColumns")
+
+# hide changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# select cell content
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# This resulted crashing (select section starting table with 
hidden first column)
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# show changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f22e0bc9450a..4d69e2a6d705 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace util;
@@ -2168,6 +2169,14 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, 
bool bIdleEnd )
 // created, because there used to be a Frame here!
 if ( !pFrame )
 {
+// skip, if it is a hidden deleted cell without frame
+if ( GetLayout()->IsHideRedlines() )
+{
+const SwStartNode* pNd = 
pShellCursor->GetPointNode().FindTableBoxStartNode();
+if ( pNd && pNd->GetTableBox()->GetRedlineType() == 
RedlineType::Delete )
+return;
+}
+
 do
 {
 CalcLayout();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index dced56c1f2a0..59b031ce772a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1175,7 +1175,8 @@ bool SwFEShell::CanUnProtectCells() const
 {
 SwFrame *pFrame = GetCurrFrame();
 do {
-pFrame = pFrame->GetUpper();
+if ( pFrame )
+pFrame = pFrame->GetUpper();
 } while ( pFrame && !pFrame->IsCellFrame() );
 if( pFrame )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-29 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests7/tdf156784.py |   38 
 sw/source/core/crsr/crsrsh.cxx  |9 +++
 sw/source/core/frmedt/fetab.cxx |3 +-
 3 files changed, 49 insertions(+), 1 deletion(-)

New commits:
commit 49bfb463aebcfbe3935bc9989d9a1c5689149a09
Author: László Németh 
AuthorDate: Thu Aug 24 16:27:16 2023 +0200
Commit: László Németh 
CommitDate: Tue Aug 29 15:06:04 2023 +0200

tdf#156784 sw tracked table column: fix crash at Select All

Section starting table with hidden deleted first column
freezed at Select All, resulting crash because of infinite
recursion during waiting frame creation of a hidden cell
without frame in Hide Changes mode.

Regression from commit d1004cdd6a445ae73673b0ca360ae034b0ec09f2
"tdf#150673 sw offapi: add change tracking of table column deletion".

Change-Id: I15d9fa0138261d7a95c6e34a8d07fb2e001d0c7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156056
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 15639650efb2fa44e96fdc2bd46a64931b9a3329)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156134
Tested-by: László Németh 

diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py 
b/sw/qa/uitest/writer_tests7/tdf156784.py
new file mode 100644
index ..5cac8fc628db
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf156784.py
@@ -0,0 +1,38 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+# Bug 156784 - crash fix: Select All in section starting table with hidden 
first column
+
+class tdf156784(UITestCase):
+def test_tdf156784(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+# delete first column
+self.xUITest.executeCommand(".uno:DeleteColumns")
+
+# hide changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# select cell content
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# This resulted crashing (select section starting table with 
hidden first column)
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# show changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f22e0bc9450a..4d69e2a6d705 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace util;
@@ -2168,6 +2169,14 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, 
bool bIdleEnd )
 // created, because there used to be a Frame here!
 if ( !pFrame )
 {
+// skip, if it is a hidden deleted cell without frame
+if ( GetLayout()->IsHideRedlines() )
+{
+const SwStartNode* pNd = 
pShellCursor->GetPointNode().FindTableBoxStartNode();
+if ( pNd && pNd->GetTableBox()->GetRedlineType() == 
RedlineType::Delete )
+return;
+}
+
 do
 {
 CalcLayout();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index dced56c1f2a0..59b031ce772a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1175,7 +1175,8 @@ bool SwFEShell::CanUnProtectCells() const
 {
 SwFrame *pFrame = GetCurrFrame();
 do {
-pFrame = pFrame->GetUpper();
+if ( pFrame )
+pFrame = pFrame->GetUpper();
 } while ( pFrame && !pFrame->IsCellFrame() );
 if( pFrame )
 {


[Libreoffice-commits] core.git: sw/qa sw/source

2023-08-26 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests7/tdf156784.py |   38 
 sw/source/core/crsr/crsrsh.cxx  |9 +++
 sw/source/core/frmedt/fetab.cxx |3 +-
 3 files changed, 49 insertions(+), 1 deletion(-)

New commits:
commit e16e84c44fc7517529c8a183fbd8f97c0c3e380e
Author: László Németh 
AuthorDate: Thu Aug 24 16:27:16 2023 +0200
Commit: László Németh 
CommitDate: Sun Aug 27 01:20:27 2023 +0200

tdf#156784 sw tracked table column: fix crash at Select All

Section starting table with hidden deleted first column
freezed at Select All, resulting crash because of infinite
recursion during waiting frame creation of a hidden cell
without frame in Hide Changes mode.

Regression from commit d1004cdd6a445ae73673b0ca360ae034b0ec09f2
"tdf#150673 sw offapi: add change tracking of table column deletion".

Change-Id: I15d9fa0138261d7a95c6e34a8d07fb2e001d0c7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156056
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py 
b/sw/qa/uitest/writer_tests7/tdf156784.py
new file mode 100644
index ..5cac8fc628db
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf156784.py
@@ -0,0 +1,38 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+# Bug 156784 - crash fix: Select All in section starting table with hidden 
first column
+
+class tdf156784(UITestCase):
+def test_tdf156784(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+# delete first column
+self.xUITest.executeCommand(".uno:DeleteColumns")
+
+# hide changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# select cell content
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# This resulted crashing (select section starting table with 
hidden first column)
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# show changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f22e0bc9450a..4d69e2a6d705 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace util;
@@ -2168,6 +2169,14 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, 
bool bIdleEnd )
 // created, because there used to be a Frame here!
 if ( !pFrame )
 {
+// skip, if it is a hidden deleted cell without frame
+if ( GetLayout()->IsHideRedlines() )
+{
+const SwStartNode* pNd = 
pShellCursor->GetPointNode().FindTableBoxStartNode();
+if ( pNd && pNd->GetTableBox()->GetRedlineType() == 
RedlineType::Delete )
+return;
+}
+
 do
 {
 CalcLayout();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index dced56c1f2a0..59b031ce772a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1175,7 +1175,8 @@ bool SwFEShell::CanUnProtectCells() const
 {
 SwFrame *pFrame = GetCurrFrame();
 do {
-pFrame = pFrame->GetUpper();
+if ( pFrame )
+pFrame = pFrame->GetUpper();
 } while ( pFrame && !pFrame->IsCellFrame() );
 if( pFrame )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-18 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests7/tdf156783.py |   63 
 sw/source/core/crsr/crsrsh.cxx  |2 -
 2 files changed, 64 insertions(+), 1 deletion(-)

New commits:
commit 2748138cb5c1ad03ef794f8411e28e02de608f39
Author: László Németh 
AuthorDate: Wed Aug 16 21:41:26 2023 +0200
Commit: László Németh 
CommitDate: Fri Aug 18 11:27:39 2023 +0200

tdf#156783 sw tracked table column: fix crash setting border

or border padding without correct table cursor.

Table formatting is allowed on text selections starting
with tables, but adding border or border padding
resulted crashing. This regression became more visible
with hidden deleted table columns, where SelectTable
(e.g. Ctrl-A) doesn't select the whole table, but only
the text content of the visible cells, and in the case
of hidden right table columns, without table cursor.

Manual test: insert two tables in the document, and in the
first cell of the first table, select the whole document
by  pressing Ctrl-A 2 times or more. In table settings,
enable table border or modify padding to crash LibreOffice.

Regression since version 7.5.

Change-Id: If8ebb52c7662ff37ac42348c8f412549b793b6d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155749
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 3a2d3926bbaf6907a50b595d867d7e36cc4ffeaa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155773

diff --git a/sw/qa/uitest/writer_tests7/tdf156783.py 
b/sw/qa/uitest/writer_tests7/tdf156783.py
new file mode 100644
index ..2ccdb7dcf6e1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf156783.py
@@ -0,0 +1,63 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_url_for_data_file
+
+# Bug 156783 - crash fix: setting table border on a table without correct 
table cursor
+
+class tdf156783(UITestCase):
+def test_tdf156783(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+# select all tables
+self.xUITest.executeCommand(".uno:SelectAll")
+self.xUITest.executeCommand(".uno:SelectAll")
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# dialog Table Properties - Borders
+with 
self.ui_test.execute_dialog_through_command(".uno:TableDialog", 
close_button="ok") as xDialog:
+tabcontrol = xDialog.getChild("tabcontrol")
+select_pos(tabcontrol, "3")
+
+sync = xDialog.getChild("sync")
+rightmf = xDialog.getChild("rightmf")
+leftmf = xDialog.getChild("leftmf")
+topmf = xDialog.getChild("topmf")
+bottommf = xDialog.getChild("bottommf")
+sync.executeAction("CLICK", tuple())
+
+rightmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+rightmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+rightmf.executeAction("TYPE", 
mkPropertyValues({"TEXT":"72pt"}))
+leftmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+leftmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
+topmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+topmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+topmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
+bottommf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+bottommf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+bottommf.executeAction("TYPE", 
mkPropertyValues({"TEXT":"72pt"}))
+
+self.assertEqual(get_state_as_dict(rightmf)["Text"], u"72pt")
+self.assertEqual(get_state_as_dict(leftmf)["Text"], u"72pt")
+self.assertEqual(get_state_as_dict(topmf)["Text"], u"72pt")
+self.assertEqual(get_state_as_dict(bottommf)["Text"], u"72pt")
+
+# 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-08-17 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests7/tdf156783.py |   63 
 sw/source/core/crsr/crsrsh.cxx  |2 -
 2 files changed, 64 insertions(+), 1 deletion(-)

New commits:
commit e79f0f65ab06baafc7e8a6aeb1d89ca748087b24
Author: László Németh 
AuthorDate: Wed Aug 16 21:41:26 2023 +0200
Commit: László Németh 
CommitDate: Fri Aug 18 00:06:43 2023 +0200

tdf#156783 sw tracked table column: fix crash setting border

or border padding without correct table cursor.

Table formatting is allowed on text selections starting
with tables, but adding border or border padding
resulted crashing. This regression became more visible
with hidden deleted table columns, where SelectTable
(e.g. Ctrl-A) doesn't select the whole table, but only
the text content of the visible cells, and in the case
of hidden right table columns, without table cursor.

Manual test: insert two tables in the document, and in the
first cell of the first table, select the whole document
by  pressing Ctrl-A 2 times or more. In table settings,
enable table border or modify padding to crash LibreOffice.

Regression since version 7.5.

Change-Id: If8ebb52c7662ff37ac42348c8f412549b793b6d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155749
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/uitest/writer_tests7/tdf156783.py 
b/sw/qa/uitest/writer_tests7/tdf156783.py
new file mode 100644
index ..2ccdb7dcf6e1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf156783.py
@@ -0,0 +1,63 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_url_for_data_file
+
+# Bug 156783 - crash fix: setting table border on a table without correct 
table cursor
+
+class tdf156783(UITestCase):
+def test_tdf156783(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+
+# select all tables
+self.xUITest.executeCommand(".uno:SelectAll")
+self.xUITest.executeCommand(".uno:SelectAll")
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# dialog Table Properties - Borders
+with 
self.ui_test.execute_dialog_through_command(".uno:TableDialog", 
close_button="ok") as xDialog:
+tabcontrol = xDialog.getChild("tabcontrol")
+select_pos(tabcontrol, "3")
+
+sync = xDialog.getChild("sync")
+rightmf = xDialog.getChild("rightmf")
+leftmf = xDialog.getChild("leftmf")
+topmf = xDialog.getChild("topmf")
+bottommf = xDialog.getChild("bottommf")
+sync.executeAction("CLICK", tuple())
+
+rightmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+rightmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+rightmf.executeAction("TYPE", 
mkPropertyValues({"TEXT":"72pt"}))
+leftmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+leftmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
+topmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+topmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+topmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
+bottommf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+bottommf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+bottommf.executeAction("TYPE", 
mkPropertyValues({"TEXT":"72pt"}))
+
+self.assertEqual(get_state_as_dict(rightmf)["Text"], u"72pt")
+self.assertEqual(get_state_as_dict(leftmf)["Text"], u"72pt")
+self.assertEqual(get_state_as_dict(topmf)["Text"], u"72pt")
+self.assertEqual(get_state_as_dict(bottommf)["Text"], u"72pt")
+
+# Without the fix in place, this test would have crashed here
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-08-16 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit cfc49650d37e2a0eb28111097d7fc8453d9cafee
Author: László Németh 
AuthorDate: Mon Aug 14 16:40:34 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 16 19:41:57 2023 +0200

tdf#156782 sw tracked table column: fix missing right table border

Last visible column of a table followed with hidden deleted columns
hid also the right border of the table, if the inner vertical column
borders drawn only by left-only borders (like in the default table
style).

See also commit f9898fa64bd2a575be94c309b43373de53c5331b
"tdf#150308 sw: fix missing top table border after hidden table rows"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: I5e98c6751d889f8d5a3f7f2b0b31e44149742e25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155669
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit f7189c63b297b8756f02be65a7050609599651af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155704
Tested-by: Jenkins

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 117ac8eb5e61..c9fcc98436b6 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2828,6 +2828,29 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 && rBoxItem.GetBottom());
 }
 
+/**
+ * Special case:
+ * last visible cell of a table row followed with a hidden deleted cell,
+ * and the right border of the visible cell was painted by its left border
+ */
+static bool lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow(
+SwFrame const& rFrame, SvxBoxItem const& rBoxItem)
+{
+SwRowFrame const*const pThisRowFrame =
+dynamic_cast(rFrame.GetUpper());
+const SwCellFrame* pThisCell = static_cast();
+
+return pThisRowFrame
+// last visible cell
+&& !rFrame.GetNext()
+// it has only left border
+&& !rBoxItem.GetRight()
+&& rBoxItem.GetLeft()
+// last visible table cell isn't equal to the last cell:
+// there are invisible deleted cells in Hide Changes mode
+&& pThisRowFrame->GetTabLine()->GetTabBoxes().back() != 
pThisCell->GetTabBox();
+}
+
 void SwTabFramePainter::Insert(const SwFrame& rFrame, const SvxBoxItem& 
rBoxItem, const SwRect& rPaintArea)
 {
 // build 4 line entries for the 4 borders:
@@ -2837,6 +2860,9 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 
 bool const 
bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 mrTabFrame, rFrame, rBoxItem));
+bool const bLeftAsRight(lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow(
+rFrame, rBoxItem));
+
 bool const bVert = mrTabFrame.IsVertical();
 bool const bR2L  = mrTabFrame.IsRightToLeft();
 
@@ -2898,7 +2924,7 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 }
 
 SwLineEntry aRight (nRight,  nTop,  nBottom, bRightIsOuter,
-bVert ? (bBottomAsTop ? aB : aT) : (bR2L ? aL : aR));
+bVert ? (bBottomAsTop ? aB : aT) : ((bR2L || bLeftAsRight) ? aL : 
aR));
 if (bWordTableCell && rBoxItem.GetRight())
 {
 aRight.LimitVerticalEndPos(rFrame, SwLineEntry::VerticalType::RIGHT);


[Libreoffice-commits] core.git: sw/source

2023-08-16 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit a9b3d3ec7fe6fe995b689c1de7e065b68845ea85
Author: László Németh 
AuthorDate: Mon Aug 14 16:40:34 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 16 10:58:36 2023 +0200

tdf#156782 sw tracked table column: fix missing right table border

Last visible column of a table followed with hidden deleted columns
hid also the right border of the table, if the inner vertical column
borders drawn only by left-only borders (like in the default table
style).

See also commit f9898fa64bd2a575be94c309b43373de53c5331b
"tdf#150308 sw: fix missing top table border after hidden table rows"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: I5e98c6751d889f8d5a3f7f2b0b31e44149742e25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155669
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 8b44b33445d5..e1f6e12827fe 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2829,6 +2829,29 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 && rBoxItem.GetBottom());
 }
 
+/**
+ * Special case:
+ * last visible cell of a table row followed with a hidden deleted cell,
+ * and the right border of the visible cell was painted by its left border
+ */
+static bool lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow(
+SwFrame const& rFrame, SvxBoxItem const& rBoxItem)
+{
+SwRowFrame const*const pThisRowFrame =
+dynamic_cast(rFrame.GetUpper());
+const SwCellFrame* pThisCell = static_cast();
+
+return pThisRowFrame
+// last visible cell
+&& !rFrame.GetNext()
+// it has only left border
+&& !rBoxItem.GetRight()
+&& rBoxItem.GetLeft()
+// last visible table cell isn't equal to the last cell:
+// there are invisible deleted cells in Hide Changes mode
+&& pThisRowFrame->GetTabLine()->GetTabBoxes().back() != 
pThisCell->GetTabBox();
+}
+
 void SwTabFramePainter::Insert(const SwFrame& rFrame, const SvxBoxItem& 
rBoxItem, const SwRect& rPaintArea)
 {
 // build 4 line entries for the 4 borders:
@@ -2838,6 +2861,9 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 
 bool const 
bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 mrTabFrame, rFrame, rBoxItem));
+bool const bLeftAsRight(lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow(
+rFrame, rBoxItem));
+
 bool const bVert = mrTabFrame.IsVertical();
 bool const bR2L  = mrTabFrame.IsRightToLeft();
 
@@ -2899,7 +2925,7 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 }
 
 SwLineEntry aRight (nRight,  nTop,  nBottom, bRightIsOuter,
-bVert ? (bBottomAsTop ? aB : aT) : (bR2L ? aL : aR));
+bVert ? (bBottomAsTop ? aB : aT) : ((bR2L || bLeftAsRight) ? aL : 
aR));
 if (bWordTableCell && rBoxItem.GetRight())
 {
 aRight.LimitVerticalEndPos(rFrame, SwLineEntry::VerticalType::RIGHT);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-14 Thread László Németh (via logerrit)
 sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt |   25 +
 sw/qa/core/txtnode/txtnode.cxx |   26 
++
 sw/source/core/edit/edsect.cxx |   21 +++-
 3 files changed, 71 insertions(+), 1 deletion(-)

New commits:
commit 7dbecdd63c292ba28aa5bb7143be5b0560f38c4e
Author: László Németh 
AuthorDate: Thu Aug 10 13:37:13 2023 +0200
Commit: László Németh 
CommitDate: Mon Aug 14 11:13:38 2023 +0200

tdf#156492 sw: fix alt-Enter in cells merged vertically

Inserting empty paragragh after the tables didn't work,
if the bottom right corner of the table contains cells
merged vertically.

Manual test: positionate the text cursor at the end
of the last paragraph of the bottom right cell of the
table (which contains also cells merged vertically), and
press alt-Enter to insert an empty paragraph after the
table.

Note: SpecialInsert, i.e. inserting empty paragraph by pressing
alt-Enter is the quick and sometimes the only possible way to insert
an empty paragraph before or after tables and sections.

Change-Id: Ic845c3d683a561784afe69588b3b1538e82c35c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/16
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit ab60445f9250087029d5f1879668340277721efa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155487
Tested-by: László Németh 

diff --git a/sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt 
b/sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt
new file mode 100644
index ..55ba746b669c
--- /dev/null
+++ b/sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt
@@ -0,0 +1,25 @@
+
+
+ 
+  
+   
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+
+ 
+  
+ 
+ 
+
+   
+   
+  
+ 
+
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 640df69ed211..4a4bf9901a2f 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -64,6 +64,32 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese)
 assertXPath(pXmlDoc, "//font[1]", "vertical", "false");
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSpecialInsertAfterMergedCells)
+{
+// Load a document with a table with bottom right cells merged vertically.
+// SpecialInsert with alt-Enter must work here, too.
+createSwDoc("special-insert-after-merged-cells.fodt");
+SwDoc* pDoc = getSwDoc();
+SwNodeOffset const nNodes(pDoc->GetNodes().Count());
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwDocShell* pShell = pTextDoc->GetDocShell();
+SwWrtShell* pWrtShell = pShell->GetWrtShell();
+// go to the merged cell
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+// When pressing alt-Enter on the keyboard:
+SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin();
+vcl::KeyCode aKeyCode(KEY_RETURN, KEY_MOD2);
+KeyEvent aKeyEvent(' ', aKeyCode);
+rEditWin.KeyInput(aKeyEvent);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: nNodes + 1
+// - Actual  : nNodes
+// i.e. new empty paragraph wasn't inserted under the table
+CPPUNIT_ASSERT_EQUAL(nNodes + 1, pDoc->GetNodes().Count());
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor)
 {
 createSwDoc("textbox-copy-anchor.docx");
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 6116a422557f..a7e652aea9de 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -356,12 +356,31 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
 // we found an end if
 // - we're at or just before an end node
 // - there are only end nodes between the current node and
-//   pInnermostNode's end node
+//   pInnermostNode's end node or
+// - there are only end nodes between the last table cell merged with
+//   the current cell and pInnermostNode's end node
 SwNodeIndex aEnd( pCurrentPos->GetNode() );
 if( rCurrentNode.IsContentNode() &&
 ( pCurrentPos->GetContentIndex() ==
   rCurrentNode.GetContentNode()->Len() ) )
+{
 ++aEnd;
+
+// tdf#156492 handle cells merged vertically in the bottom right 
corner
+if ( pInnermostNode->IsTableNode() )
+{
+const SwNode* pTableBoxStartNode = 
pCurrentPos->GetNode().FindTableBoxStartNode();
+const SwTableBox* pTableBox = 
pTableBoxStartNode->GetTableBox();
+if ( pTableBox && pTableBox->getRowSpan() > 1 )
+{
+const SwTableNode* pTableNd = 
pInnermostNode->FindTableNode();
+pTableBox 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-14 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |   30 ++
 sw/source/core/frmedt/fetab.cxx |   33 +++--
 2 files changed, 53 insertions(+), 10 deletions(-)

New commits:
commit dfa57ee45bf9aef73f8bf385b089739ee0572998
Author: László Németh 
AuthorDate: Tue Aug 8 19:46:15 2023 +0200
Commit: László Németh 
CommitDate: Mon Aug 14 11:13:14 2023 +0200

tdf#156487 sw tracked table column: fix Hide Changes

In Hide Changes mode, deleting table columns with change tracking
wasn't applied on the table layout immediately, only using Show
Changes and Hide Changes again. Now the deleted column removed from
the table instead leaving an empty table column.

Also revert commit 33058b5dc47a140516669945efbdd30ea65138a6
"tdf#156544 sw tracked table column: delete empty column".

See also commit a74c51025fa4519caaf461492e4ed8e68bd34885
"tdf#146962 sw: hide deleted row at deletion in Hide Changes".

Change-Id: If03d2bc5996a168cb44839b0753effb9031edbc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155522
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 43b128a960d1712b984402e1b69cefecdb75462a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155478
Tested-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 3e8babfff390..285a3adb7c61 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2777,6 +2777,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156487)
+{
+// load a table, and delete a column in Hide Changes mode
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn on red-lining and hide changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+CPPUNIT_ASSERT_MESSAGE("redlines shouldn't be visible",
+   !IDocumentRedlineAccess::IsShowChanges(
+   
pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// delete table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+// Dump the rendering of the first page as an XML file.
+SwDocShell* pShell = pDoc->GetDocShell();
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+// This would be 2 without hiding the first cell
+assertXPath(pXmlDoc, "/metafile/push/push/push/textarray/text", 1);
+}
+
 #ifndef DBG_UTIL
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498)
 {
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index a766596daa29..dced56c1f2a0 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -279,11 +279,14 @@ bool SwFEShell::DeleteCol()
 
 CurrShell aCurr( this );
 
+bool bRecordChanges = GetDoc()->GetDocShell()->IsChangeRecording();
+bool bRecordAndHideChanges = bRecordChanges &&
+
GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines();
+
 // tracked deletion: remove only textbox content,
 // and set IsNoTracked table box property to false
-if ( GetDoc()->GetDocShell()->IsChangeRecording() )
+if ( bRecordChanges )
 {
-bool bDeletedEmptyCell = false;
 StartUndo(SwUndoId::COL_DELETE);
 StartAllAction();
 
@@ -296,6 +299,10 @@ bool SwFEShell::DeleteCol()
 
 TableWait aWait( 20, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() );
 
+SwTableNode* pTableNd = pFrame->IsTextFrame()
+? 
static_cast(pFrame)->GetTextNodeFirst()->FindTableNode()
+: static_cast(pFrame)->GetNode()->FindTableNode();
+
 for (size_t i = 0; i < aBoxes.size(); ++i)
 {
 SwTableBox *pBox = aBoxes[i];
@@ -318,24 +325,30 @@ bool SwFEShell::DeleteCol()
 aCursor.GetMark()->SetContent(0);
 rIDRA.SetRedlineFlags_intern( eOld );
 rIDCO.DeleteAndJoin( aCursor );
-bDeletedEmptyCell = true;
 }
 
 }
 }
 
 SwEditShell* pEditShell = GetDoc()->GetEditShell();
-SwRedlineTable::size_type nPrev = pEditShell->GetRedlineCount();
 pEditShell->Delete();
 
+// remove cell frames in Hide Changes mode (and table frames, if 
needed)
+if ( bRecordAndHideChanges )
+{
+// remove all frames of the table, and make them again without the 
deleted ones
+   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-14 Thread László Németh (via logerrit)
 sw/qa/uitest/table/tdf146145.py |   32 
 sw/source/core/crsr/trvltbl.cxx |2 +-
 sw/source/core/frmedt/fetab.cxx |   26 --
 3 files changed, 49 insertions(+), 11 deletions(-)

New commits:
commit 855a43795d047445ab59d6de889b858f4f8e0f79
Author: László Németh 
AuthorDate: Thu Aug 3 12:00:07 2023 +0200
Commit: László Németh 
CommitDate: Mon Aug 14 11:12:44 2023 +0200

tdf#156595 sw tracked table column: fix crash at row deletion

In Hide Changes mode, deleting a row, which has
a hidden column deletion before the first cell,
resulted a crash because of missing cell frame/table
cursor.

Regression from commit aff269c18b9029fec992135a406dc5031927c401
"tdf#155345 sw tracked table column: hide them in Hide Changes mode".

Note: it seems, plain uiwriter testing is not enough to catch
the problem.

Change-Id: I12675ecd402d6411107b90809728454f13e60580
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155287
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 1d12c5de5ab39fba33e016299cc8234475003612)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155295
Tested-by: Jenkins

diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py
index 84cda61a6cd1..55d2092ca51e 100644
--- a/sw/qa/uitest/table/tdf146145.py
+++ b/sw/qa/uitest/table/tdf146145.py
@@ -250,4 +250,36 @@ class tdf146145(UITestCase):
 xToolkit.processEventsToIdle()
 self.assertEqual(len(tables[0].getColumns()), 5)
 
+   def test_crashWithHiddenFirstTableColumn(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+# delete first table column
+self.xUITest.executeCommand(".uno:DeleteColumns")
+
+# Check enabling Accept/Reject Track Change icons
+# and Accept Change/Reject Change context menu items
+# on table columns with tracked deletion or insertion
+
+# enable Track Changes toolbar
+
self.xUITest.executeCommand(".uno:AvailableToolbars?Toolbar:string=changes")
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+xToolkit.processEventsToIdle()
+
+# cursor at changed text: Accept Track Change is enabled
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# hide changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+while self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+self.assertFalse(self.is_enabled_Accept_Track_Change())
+
+# Without the fix in place, this test would have crashed here
+self.xUITest.executeCommand(".uno:DeleteRows")
+
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 0aaa899b5a46..689457d02863 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -128,7 +128,7 @@ bool SwCursorShell::SelTableRowOrCol( bool bRow, bool 
bRowSimple )
 {
 // check if the current cursor's SPoint/Mark are in a table
 SwFrame *pFrame = GetCurrFrame();
-if( !pFrame->IsInTab() )
+if( !pFrame || !pFrame->IsInTab() )
 return false;
 
 const SwTabFrame* pTabFrame = pFrame->FindTabFrame();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 8a6a664fe206..a766596daa29 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -535,18 +535,24 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
 if ( SwWrtShell* pWrtShell = dynamic_cast(this) )
 {
 pWrtShell->SelectTableRow();
-SwShellTableCursor* pTableCursor = GetTableCursor();
+SwCursor* pTableCursor = 
static_cast(GetTableCursor());
 auto pStt = aBoxes[0];
 auto pEnd = aBoxes.back();
-pTableCursor->DeleteMark();
-
-// set start and end of the selection
-pTableCursor->GetPoint()->Assign( 
*pEnd->GetSttNd()->EndOfSectionNode() );
-pTableCursor->Move( fnMoveBackward, GoInContent );
-pTableCursor->SetMark();
-pTableCursor->GetPoint()->Assign( 
*pStt->GetSttNd()->EndOfSectionNode() );
-pTableCursor->Move( fnMoveBackward, GoInContent );
-pWrtShell->UpdateCursor();
+if ( pTableCursor )
+pTableCursor->DeleteMark();
+else
+

[Libreoffice-commits] core.git: sw/qa sw/source

2023-08-10 Thread László Németh (via logerrit)
 sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt |   25 +
 sw/qa/core/txtnode/txtnode.cxx |   26 
++
 sw/source/core/edit/edsect.cxx |   21 +++-
 3 files changed, 71 insertions(+), 1 deletion(-)

New commits:
commit 8258a70a7ca596a8ce5ff417f312a99a96694bed
Author: László Németh 
AuthorDate: Thu Aug 10 13:37:13 2023 +0200
Commit: László Németh 
CommitDate: Thu Aug 10 18:49:30 2023 +0200

tdf#156492 sw: fix alt-Enter in cells merged vertically

Inserting empty paragragh after the tables didn't work,
if the bottom right corner of the table contains cells
merged vertically.

Manual test: positionate the text cursor at the end
of the last paragraph of the bottom right cell of the
table (which contains also cells merged vertically), and
press alt-Enter to insert an empty paragraph after the
table.

Note: SpecialInsert, i.e. inserting empty paragraph by pressing
alt-Enter is the quick and sometimes the only possible way to insert
an empty paragraph before or after tables and sections.

Change-Id: Ic845c3d683a561784afe69588b3b1538e82c35c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/16
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt 
b/sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt
new file mode 100644
index ..55ba746b669c
--- /dev/null
+++ b/sw/qa/core/txtnode/data/special-insert-after-merged-cells.fodt
@@ -0,0 +1,25 @@
+
+
+ 
+  
+   
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+
+ 
+  
+ 
+ 
+
+   
+   
+  
+ 
+
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 640df69ed211..4a4bf9901a2f 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -64,6 +64,32 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese)
 assertXPath(pXmlDoc, "//font[1]", "vertical", "false");
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSpecialInsertAfterMergedCells)
+{
+// Load a document with a table with bottom right cells merged vertically.
+// SpecialInsert with alt-Enter must work here, too.
+createSwDoc("special-insert-after-merged-cells.fodt");
+SwDoc* pDoc = getSwDoc();
+SwNodeOffset const nNodes(pDoc->GetNodes().Count());
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwDocShell* pShell = pTextDoc->GetDocShell();
+SwWrtShell* pWrtShell = pShell->GetWrtShell();
+// go to the merged cell
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+// When pressing alt-Enter on the keyboard:
+SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin();
+vcl::KeyCode aKeyCode(KEY_RETURN, KEY_MOD2);
+KeyEvent aKeyEvent(' ', aKeyCode);
+rEditWin.KeyInput(aKeyEvent);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: nNodes + 1
+// - Actual  : nNodes
+// i.e. new empty paragraph wasn't inserted under the table
+CPPUNIT_ASSERT_EQUAL(nNodes + 1, pDoc->GetNodes().Count());
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor)
 {
 createSwDoc("textbox-copy-anchor.docx");
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 6116a422557f..a7e652aea9de 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -356,12 +356,31 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
 // we found an end if
 // - we're at or just before an end node
 // - there are only end nodes between the current node and
-//   pInnermostNode's end node
+//   pInnermostNode's end node or
+// - there are only end nodes between the last table cell merged with
+//   the current cell and pInnermostNode's end node
 SwNodeIndex aEnd( pCurrentPos->GetNode() );
 if( rCurrentNode.IsContentNode() &&
 ( pCurrentPos->GetContentIndex() ==
   rCurrentNode.GetContentNode()->Len() ) )
+{
 ++aEnd;
+
+// tdf#156492 handle cells merged vertically in the bottom right 
corner
+if ( pInnermostNode->IsTableNode() )
+{
+const SwNode* pTableBoxStartNode = 
pCurrentPos->GetNode().FindTableBoxStartNode();
+const SwTableBox* pTableBox = 
pTableBoxStartNode->GetTableBox();
+if ( pTableBox && pTableBox->getRowSpan() > 1 )
+{
+const SwTableNode* pTableNd = 
pInnermostNode->FindTableNode();
+pTableBox = & pTableBox->FindEndOfRowSpan( 
pTableNd->GetTable(),
+
pTableBox->getRowSpan() );
+  

[Libreoffice-commits] core.git: sw/qa sw/source

2023-08-09 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |   30 ++
 sw/source/core/frmedt/fetab.cxx |   33 +++--
 2 files changed, 53 insertions(+), 10 deletions(-)

New commits:
commit f65c04b2b32a9e00dd05a16614b4dedb86171c97
Author: László Németh 
AuthorDate: Tue Aug 8 19:46:15 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 9 17:22:21 2023 +0200

tdf#156487 sw tracked table column: fix Hide Changes

In Hide Changes mode, deleting table columns with change tracking
wasn't applied on the table layout immediately, only using Show
Changes and Hide Changes again. Now the deleted column removed from
the table instead leaving an empty table column.

Also revert commit 33058b5dc47a140516669945efbdd30ea65138a6
"tdf#156544 sw tracked table column: delete empty column".

See also commit a74c51025fa4519caaf461492e4ed8e68bd34885
"tdf#146962 sw: hide deleted row at deletion in Hide Changes".

Change-Id: If03d2bc5996a168cb44839b0753effb9031edbc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155522
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 3e8babfff390..285a3adb7c61 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2777,6 +2777,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156487)
+{
+// load a table, and delete a column in Hide Changes mode
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn on red-lining and hide changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+CPPUNIT_ASSERT_MESSAGE("redlines shouldn't be visible",
+   !IDocumentRedlineAccess::IsShowChanges(
+   
pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// delete table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+// Dump the rendering of the first page as an XML file.
+SwDocShell* pShell = pDoc->GetDocShell();
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+// This would be 2 without hiding the first cell
+assertXPath(pXmlDoc, "/metafile/push/push/push/textarray/text", 1);
+}
+
 #ifndef DBG_UTIL
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498)
 {
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index a766596daa29..dced56c1f2a0 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -279,11 +279,14 @@ bool SwFEShell::DeleteCol()
 
 CurrShell aCurr( this );
 
+bool bRecordChanges = GetDoc()->GetDocShell()->IsChangeRecording();
+bool bRecordAndHideChanges = bRecordChanges &&
+
GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines();
+
 // tracked deletion: remove only textbox content,
 // and set IsNoTracked table box property to false
-if ( GetDoc()->GetDocShell()->IsChangeRecording() )
+if ( bRecordChanges )
 {
-bool bDeletedEmptyCell = false;
 StartUndo(SwUndoId::COL_DELETE);
 StartAllAction();
 
@@ -296,6 +299,10 @@ bool SwFEShell::DeleteCol()
 
 TableWait aWait( 20, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() );
 
+SwTableNode* pTableNd = pFrame->IsTextFrame()
+? 
static_cast(pFrame)->GetTextNodeFirst()->FindTableNode()
+: static_cast(pFrame)->GetNode()->FindTableNode();
+
 for (size_t i = 0; i < aBoxes.size(); ++i)
 {
 SwTableBox *pBox = aBoxes[i];
@@ -318,24 +325,30 @@ bool SwFEShell::DeleteCol()
 aCursor.GetMark()->SetContent(0);
 rIDRA.SetRedlineFlags_intern( eOld );
 rIDCO.DeleteAndJoin( aCursor );
-bDeletedEmptyCell = true;
 }
 
 }
 }
 
 SwEditShell* pEditShell = GetDoc()->GetEditShell();
-SwRedlineTable::size_type nPrev = pEditShell->GetRedlineCount();
 pEditShell->Delete();
 
+// remove cell frames in Hide Changes mode (and table frames, if 
needed)
+if ( bRecordAndHideChanges )
+{
+// remove all frames of the table, and make them again without the 
deleted ones
+// TODO remove only the deleted frames
+pTableNd->DelFrames();
+
+if ( !pTableNd->GetTable().IsDeleted() )
+{
+

[Libreoffice-commits] core.git: sw/qa sw/source

2023-08-03 Thread László Németh (via logerrit)
 sw/qa/uitest/table/tdf146145.py |   32 
 sw/source/core/crsr/trvltbl.cxx |2 +-
 sw/source/core/frmedt/fetab.cxx |   26 --
 3 files changed, 49 insertions(+), 11 deletions(-)

New commits:
commit d17b16215629ff078d5707309115233d4752f7d8
Author: László Németh 
AuthorDate: Thu Aug 3 12:00:07 2023 +0200
Commit: László Németh 
CommitDate: Thu Aug 3 14:53:59 2023 +0200

tdf#156595 sw tracked table column: fix crash at row deletion

In Hide Changes mode, deleting a row, which has
a hidden column deletion before the first cell,
resulted a crash because of missing cell frame/table
cursor.

Regression from commit aff269c18b9029fec992135a406dc5031927c401
"tdf#155345 sw tracked table column: hide them in Hide Changes mode".

Note: it seems, plain uiwriter testing is not enough to catch
the problem.

Change-Id: I12675ecd402d6411107b90809728454f13e60580
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155287
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py
index 84cda61a6cd1..55d2092ca51e 100644
--- a/sw/qa/uitest/table/tdf146145.py
+++ b/sw/qa/uitest/table/tdf146145.py
@@ -250,4 +250,36 @@ class tdf146145(UITestCase):
 xToolkit.processEventsToIdle()
 self.assertEqual(len(tables[0].getColumns()), 5)
 
+   def test_crashWithHiddenFirstTableColumn(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+# accept all tracked changes
+self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
+# delete first table column
+self.xUITest.executeCommand(".uno:DeleteColumns")
+
+# Check enabling Accept/Reject Track Change icons
+# and Accept Change/Reject Change context menu items
+# on table columns with tracked deletion or insertion
+
+# enable Track Changes toolbar
+
self.xUITest.executeCommand(".uno:AvailableToolbars?Toolbar:string=changes")
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+xToolkit.processEventsToIdle()
+
+# cursor at changed text: Accept Track Change is enabled
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# hide changes
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+while self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+self.assertFalse(self.is_enabled_Accept_Track_Change())
+
+# Without the fix in place, this test would have crashed here
+self.xUITest.executeCommand(".uno:DeleteRows")
+
+self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 0aaa899b5a46..689457d02863 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -128,7 +128,7 @@ bool SwCursorShell::SelTableRowOrCol( bool bRow, bool 
bRowSimple )
 {
 // check if the current cursor's SPoint/Mark are in a table
 SwFrame *pFrame = GetCurrFrame();
-if( !pFrame->IsInTab() )
+if( !pFrame || !pFrame->IsInTab() )
 return false;
 
 const SwTabFrame* pTabFrame = pFrame->FindTabFrame();
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 8a6a664fe206..a766596daa29 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -535,18 +535,24 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
 if ( SwWrtShell* pWrtShell = dynamic_cast(this) )
 {
 pWrtShell->SelectTableRow();
-SwShellTableCursor* pTableCursor = GetTableCursor();
+SwCursor* pTableCursor = 
static_cast(GetTableCursor());
 auto pStt = aBoxes[0];
 auto pEnd = aBoxes.back();
-pTableCursor->DeleteMark();
-
-// set start and end of the selection
-pTableCursor->GetPoint()->Assign( 
*pEnd->GetSttNd()->EndOfSectionNode() );
-pTableCursor->Move( fnMoveBackward, GoInContent );
-pTableCursor->SetMark();
-pTableCursor->GetPoint()->Assign( 
*pStt->GetSttNd()->EndOfSectionNode() );
-pTableCursor->Move( fnMoveBackward, GoInContent );
-pWrtShell->UpdateCursor();
+if ( pTableCursor )
+pTableCursor->DeleteMark();
+else
+pTableCursor = GetCursor(true);
+
+if ( pTableCursor )
+{
+// set start and end of the 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-03 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |   76 
 sw/source/core/frmedt/fetab.cxx |4 +
 2 files changed, 79 insertions(+), 1 deletion(-)

New commits:
commit 72cf81802b7a9c4ce64cf853a80f2660da5ee26e
Author: László Németh 
AuthorDate: Tue Aug 1 13:10:07 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 3 11:50:36 2023 +0200

tdf#156544 sw tracked table column: delete empty column

Empty table columns were removed without change tracking
in Record Changes mode, too.

Follow-up to commit fe43f5971dfd2a121634eea9e39c7ad0cf3f962a
"tdf#156475 sw tracked table column: delete empty cell".

Change-Id: I8154cb1c75cf793f5a60e8259a91dd779fc766e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155153
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 33058b5dc47a140516669945efbdd30ea65138a6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155187
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 07579cc6662a..3e8babfff390 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2701,6 +2701,82 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
+{
+// load a table, and insert a column without change tracking,
+// and delete the first column with the empty cell in the second row with 
change tracking
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn off red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be off",
+   !pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// insert table column without change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+
+// check table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[1]/cell", 3);
+
+// turn on red-lining
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// go to the empty column
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+// delete table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+
+// This was 2 (deleted column)
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 3);
+
+// accept the deletion of the empty column
+dispatchCommand(mxComponent, ".uno:AcceptTrackedChange", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+
+// test Undo/Redo
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 3);
+
+dispatchCommand(mxComponent, ".uno:Redo", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+}
+
 #ifndef DBG_UTIL
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498)
 {
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index c271d975d567..8a6a664fe206 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -283,6 +283,7 @@ bool SwFEShell::DeleteCol()
 // and set IsNoTracked table box property to false
 if ( GetDoc()->GetDocShell()->IsChangeRecording() )
 {
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-02 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |   63 
 sw/source/core/frmedt/fetab.cxx |   17 +
 2 files changed, 80 insertions(+)

New commits:
commit e91faddabdf5d586c0044a3e125bdea6c2e21532
Author: László Németh 
AuthorDate: Thu Jul 27 15:40:52 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 2 12:14:41 2023 +0200

tdf#156475 sw tracked table column: delete empty cell

Tracking changes, only non-empty cells of the deleted
columns got coloring, and were hidden in Hide Changes
mode.

Add dummy text content to empty cells of the deleted
columns to get visible deletion in Show Changes mode,
also working context menu in that cell; to allow hiding
them in Hide Changes mode, also to store the time stamp
of the deletion, if all the other rows are removed during
editing.

Follow-up to commit 472abf99a4d90d7a53316394a2e51a26b7e62345
"tdf#155341 sw tracked table column: add insertion".

Change-Id: Ieb5d237b3c82c81fded25608ef3d2906d7474003
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154994
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit fe43f5971dfd2a121634eea9e39c7ad0cf3f962a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154962

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 937567b9b2bc..07579cc6662a 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2605,6 +2605,69 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156474)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, tdf156475)
+{
+// load a table, and insert a row without change tracking,
+// and delete the first column with the empty cell in the second row with 
change tracking
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn off red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be off",
+   !pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// insert table row
+dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
+
+// check table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 2);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[1]/cell", 2);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[2]/cell", 2);
+
+// turn on red-lining
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// delete table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+// go down to the empty cell
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Down(/*bSelect=*/false);
+
+// Without the fix in place, this couldn't work
+dispatchCommand(mxComponent, ".uno:AcceptTrackedChange", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 2);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[1]/cell", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[2]/cell", 1);
+
+// test Undo/Redo
+for (sal_Int32 i = 0; i < 4; ++i)
+{
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+
+for (sal_Int32 i = 0; i < 4; ++i)
+{
+dispatchCommand(mxComponent, ".uno:Redo", {});
+}
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 {
 // load a table, and delete the first column with enabled change tracking:
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index daca7b86bc9c..c271d975d567 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -37,6 +37,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -302,6 +304,21 @@ bool SwFEShell::DeleteCol()
 SwCursor aCursor( SwPosition(aIdx), nullptr );
 SvxPrintItem aHasTextChangesOnly(RES_PRINT, false);
 GetDoc()->SetBoxAttr( aCursor, aHasTextChangesOnly );
+
+// add dummy text content to the empty box for 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-08-02 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx   |   49 ++
 sw/source/core/doc/DocumentRedlineManager.cxx |3 -
 2 files changed, 50 insertions(+), 2 deletions(-)

New commits:
commit 6725d03d9a4f0562922e91c88d4494f5b74be063
Author: László Németh 
AuthorDate: Wed Jul 26 11:00:38 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 2 10:50:27 2023 +0200

tdf#156474 sw tracked table column: fix accept of insertion

Accepting tracked table column insertion didn't reset
HasTextChangesOnly bit of the table cells, resulting
blue/pink cells (i.e. column change) after modifying
only text content of the text, and later bad column
deletion at accepting text-only deletion and at rejecting
text-only insertion.

Follow-up to commit 472abf99a4d90d7a53316394a2e51a26b7e62345
"tdf#155341 sw tracked table column: add insertion".

Change-Id: I2e06e1b064d51c5e7cf8140a5fd7932e7be4f765
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154935
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 4caebc0b54461a1aadc8378a6749c0d5f05d7204)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154951

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index dfe0cc80f7ec..937567b9b2bc 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2556,6 +2556,55 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156474)
+{
+// load a table, and insert a column with change tracking
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn on red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+
+// there is a table in the text with two columns
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getColumns()->getCount());
+
+// insert table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+
+// 3 columns
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+// accept tracked changes: remove HasTextChangesOnly = false of the 
inserted cells
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+
+// still 3 columns
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+// delete the text content (dummy character of the previous text change) 
of the newly
+// inserted cell, and accept tracked changes
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+dispatchCommand(mxComponent, ".uno:SwBackspace", {});
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+
+// This was 2 columns (not removed HasTextChangesOnly = false resulted 
column deletion
+// instead of deleting only content of the cell)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 {
 // load a table, and delete the first column with enabled change tracking:
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index efed70b44a1a..898590d6201b 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -517,8 +517,7 @@ namespace
 const SvxPrintItem *pHasBoxTextChangesOnlyProp =
 
pBox->GetFrameFormat()->GetAttrSet().GetItem(RES_PRINT);
 // table cell property "HasTextChangesOnly" is set and its value is 
false
-if ( bRejectDeletion && pHasBoxTextChangesOnlyProp &&
-!pHasBoxTextChangesOnlyProp->GetValue() )
+if ( pHasBoxTextChangesOnlyProp && 
!pHasBoxTextChangesOnlyProp->GetValue() )
 {
 SvxPrintItem aUnsetTracking(RES_PRINT, true);
 SwCursor aCursor( *pPos, nullptr );


[Libreoffice-commits] core.git: sw/qa sw/source

2023-08-01 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |   76 
 sw/source/core/frmedt/fetab.cxx |4 +
 2 files changed, 79 insertions(+), 1 deletion(-)

New commits:
commit 33058b5dc47a140516669945efbdd30ea65138a6
Author: László Németh 
AuthorDate: Tue Aug 1 13:10:07 2023 +0200
Commit: László Németh 
CommitDate: Tue Aug 1 17:22:03 2023 +0200

tdf#156544 sw tracked table column: delete empty column

Empty table columns were removed without change tracking
in Record Changes mode, too.

Follow-up to commit fe43f5971dfd2a121634eea9e39c7ad0cf3f962a
"tdf#156475 sw tracked table column: delete empty cell".

Change-Id: I8154cb1c75cf793f5a60e8259a91dd779fc766e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155153
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 07579cc6662a..3e8babfff390 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2701,6 +2701,82 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544)
+{
+// load a table, and insert a column without change tracking,
+// and delete the first column with the empty cell in the second row with 
change tracking
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn off red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be off",
+   !pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// insert table column without change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+
+// check table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[1]/cell", 3);
+
+// turn on red-lining
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// go to the empty column
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+// delete table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+
+// This was 2 (deleted column)
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 3);
+
+// accept the deletion of the empty column
+dispatchCommand(mxComponent, ".uno:AcceptTrackedChange", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+
+// test Undo/Redo
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 3);
+
+dispatchCommand(mxComponent, ".uno:Redo", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+}
+
 #ifndef DBG_UTIL
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498)
 {
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index c271d975d567..8a6a664fe206 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -283,6 +283,7 @@ bool SwFEShell::DeleteCol()
 // and set IsNoTracked table box property to false
 if ( GetDoc()->GetDocShell()->IsChangeRecording() )
 {
+bool bDeletedEmptyCell = false;
 StartUndo(SwUndoId::COL_DELETE);
 StartAllAction();
 
@@ -317,6 +318,7 @@ bool SwFEShell::DeleteCol()
  

[Libreoffice-commits] core.git: sw/qa sw/source

2023-07-27 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |   63 
 sw/source/core/frmedt/fetab.cxx |   17 +
 2 files changed, 80 insertions(+)

New commits:
commit fe43f5971dfd2a121634eea9e39c7ad0cf3f962a
Author: László Németh 
AuthorDate: Thu Jul 27 15:40:52 2023 +0200
Commit: László Németh 
CommitDate: Thu Jul 27 23:45:53 2023 +0200

tdf#156475 sw tracked table column: delete empty cell

Tracking changes, only non-empty cells of the deleted
columns got coloring, and were hidden in Hide Changes
mode.

Add dummy text content to empty cells of the deleted
columns to get visible deletion in Show Changes mode,
also working context menu in that cell; to allow hiding
them in Hide Changes mode, also to store the time stamp
of the deletion, if all the other rows are removed during
editing.

Follow-up to commit 472abf99a4d90d7a53316394a2e51a26b7e62345
"tdf#155341 sw tracked table column: add insertion".

Change-Id: Ieb5d237b3c82c81fded25608ef3d2906d7474003
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154994
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 937567b9b2bc..07579cc6662a 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2605,6 +2605,69 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156474)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, tdf156475)
+{
+// load a table, and insert a row without change tracking,
+// and delete the first column with the empty cell in the second row with 
change tracking
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn off red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be off",
+   !pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// insert table row
+dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
+
+// check table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 2);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[1]/cell", 2);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[2]/cell", 2);
+
+// turn on red-lining
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// delete table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+// go down to the empty cell
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Down(/*bSelect=*/false);
+
+// Without the fix in place, this couldn't work
+dispatchCommand(mxComponent, ".uno:AcceptTrackedChange", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row", 2);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[1]/cell", 1);
+assertXPath(pXmlDoc, "//page[1]//body/tab/row[2]/cell", 1);
+
+// test Undo/Redo
+for (sal_Int32 i = 0; i < 4; ++i)
+{
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+
+for (sal_Int32 i = 0; i < 4; ++i)
+{
+dispatchCommand(mxComponent, ".uno:Redo", {});
+}
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 {
 // load a table, and delete the first column with enabled change tracking:
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index daca7b86bc9c..c271d975d567 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -37,6 +37,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -302,6 +304,21 @@ bool SwFEShell::DeleteCol()
 SwCursor aCursor( SwPosition(aIdx), nullptr );
 SvxPrintItem aHasTextChangesOnly(RES_PRINT, false);
 GetDoc()->SetBoxAttr( aCursor, aHasTextChangesOnly );
+
+// add dummy text content to the empty box for change tracking
+if ( pBox->IsEmpty() )
+{
+IDocumentContentOperations& rIDCO = 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-07-26 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx   |   49 ++
 sw/source/core/doc/DocumentRedlineManager.cxx |3 -
 2 files changed, 50 insertions(+), 2 deletions(-)

New commits:
commit 7f0e31976793c2701110742eb3d7ef4858eec72a
Author: László Németh 
AuthorDate: Wed Jul 26 11:00:38 2023 +0200
Commit: László Németh 
CommitDate: Wed Jul 26 16:09:03 2023 +0200

tdf#156474 sw tracked table column: fix accept of insertion

Accepting tracked table column insertion didn't reset
HasTextChangesOnly bit of the table cells, resulting
blue/pink cells (i.e. column change) after modifying
only text content of the text, and later bad column
deletion at accepting text-only deletion and at rejecting
text-only insertion.

Follow-up to commit 472abf99a4d90d7a53316394a2e51a26b7e62345
"tdf#155341 sw tracked table column: add insertion".

Change-Id: I2e06e1b064d51c5e7cf8140a5fd7932e7be4f765
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154935
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index dfe0cc80f7ec..937567b9b2bc 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2556,6 +2556,55 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletion)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156474)
+{
+// load a table, and insert a column with change tracking
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn on red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+
+// there is a table in the text with two columns
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getColumns()->getCount());
+
+// insert table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+
+// 3 columns
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+// accept tracked changes: remove HasTextChangesOnly = false of the 
inserted cells
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+
+// still 3 columns
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+// delete the text content (dummy character of the previous text change) 
of the newly
+// inserted cell, and accept tracked changes
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+dispatchCommand(mxComponent, ".uno:SwBackspace", {});
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+
+// This was 2 columns (not removed HasTextChangesOnly = false resulted 
column deletion
+// instead of deleting only content of the cell)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 {
 // load a table, and delete the first column with enabled change tracking:
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index efed70b44a1a..898590d6201b 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -517,8 +517,7 @@ namespace
 const SvxPrintItem *pHasBoxTextChangesOnlyProp =
 
pBox->GetFrameFormat()->GetAttrSet().GetItem(RES_PRINT);
 // table cell property "HasTextChangesOnly" is set and its value is 
false
-if ( bRejectDeletion && pHasBoxTextChangesOnlyProp &&
-!pHasBoxTextChangesOnlyProp->GetValue() )
+if ( pHasBoxTextChangesOnlyProp && 
!pHasBoxTextChangesOnlyProp->GetValue() )
 {
 SvxPrintItem aUnsetTracking(RES_PRINT, true);
 SwCursor aCursor( *pPos, nullptr );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source

2023-07-24 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf149498.docx |binary
 sw/qa/extras/uiwriter/uiwriter5.cxx   |   18 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +++--
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 3ec09683bcbf85e42940108fa2ec0c49ad7d3d8b
Author: László Németh 
AuthorDate: Fri Jul 21 17:35:12 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 24 12:01:38 2023 +0200

tdf#149498 sw: fix Undo crash at bookmark over cells

Importing DOCX files with bookmarks between w:p paragraph
elements resulted bookmark ranges over cell boundaries
within text tables, causing crash with Undo.

Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519
to avoid bookmark ranges over cell boundaries, creating
only collapsed bookmarks here, as before.

Regression from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519
"tdf#145720 DOCX export: fix loss of tracked moving".

Note: to avoid of another assertion, skip testing with
debug builds.

Change-Id: I3ed6daa55323f20130fcee6cc24d00a480731d0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154743
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit b081a818b1c3024d7ec5cc5b3a251109a1d9b08d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154708
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/data/tdf149498.docx 
b/sw/qa/extras/uiwriter/data/tdf149498.docx
new file mode 100644
index ..b310e88aa735
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf149498.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 88868f8086c2..dfe0cc80f7ec 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2589,6 +2589,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
 }
 
+#ifndef DBG_UTIL
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498)
+{
+// load a table, and delete the first column with enabled change tracking:
+// now the column is not deleted silently, but keeps the deleted cell 
content,
+// and only accepting it will result the deletion of the table column.
+createSwDoc("tdf149498.docx");
+
+// select table, copy, paste and Undo
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+// this would crash due to bookmark over cell boundary
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+#endif
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWithExport)
 {
 // load a table, and delete the first column with enabled change tracking:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4a32891f2503..77a68dd5a535 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -8420,10 +8420,11 @@ void DomainMapper_Impl::StartOrEndBookmark( const 
OUString& rId )
 // then  move the bookmark-End to the earlier paragraph
 if (IsOutsideAParagraph())
 {
-// keep bookmark range
+// keep bookmark range, if it doesn't exceed cell boundary
 uno::Reference< text::XTextRange > xStart = 
xCursor->getStart();
 xCursor->goLeft( 1, false );
-xCursor->gotoRange(xStart, true );
+if (m_nTableDepth == 0 || !m_bFirstParagraphInCell)
+xCursor->gotoRange(xStart, true );
 }
 uno::Reference< container::XNamed > xBkmNamed( xBookmark, 
uno::UNO_QUERY_THROW );
 SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), 
"writerfilter.dmapper", "anonymous bookmark");


[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-07-21 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf149498.docx |binary
 sw/qa/extras/uiwriter/uiwriter5.cxx   |   18 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +++--
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 818f8f13128ba78769b4f542ed1efef658de38d9
Author: László Németh 
AuthorDate: Fri Jul 21 17:35:12 2023 +0200
Commit: László Németh 
CommitDate: Sat Jul 22 01:14:19 2023 +0200

tdf#149498 sw: fix Undo crash at bookmark over cells

Importing DOCX files with bookmarks between w:p paragraph
elements resulted bookmark ranges over cell boundaries
within text tables, causing crash with Undo.

Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519
to avoid bookmark ranges over cell boundaries, creating
only collapsed bookmarks here, as before.

Regression from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519
"tdf#145720 DOCX export: fix loss of tracked moving".

Note: to avoid of another assertion, skip testing with
debug builds.

Change-Id: I3ed6daa55323f20130fcee6cc24d00a480731d0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154743
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data/tdf149498.docx 
b/sw/qa/extras/uiwriter/data/tdf149498.docx
new file mode 100644
index ..b310e88aa735
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf149498.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 88868f8086c2..dfe0cc80f7ec 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2589,6 +2589,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747)
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
 }
 
+#ifndef DBG_UTIL
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498)
+{
+// load a table, and delete the first column with enabled change tracking:
+// now the column is not deleted silently, but keeps the deleted cell 
content,
+// and only accepting it will result the deletion of the table column.
+createSwDoc("tdf149498.docx");
+
+// select table, copy, paste and Undo
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+// this would crash due to bookmark over cell boundary
+dispatchCommand(mxComponent, ".uno:Undo", {});
+}
+#endif
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWithExport)
 {
 // load a table, and delete the first column with enabled change tracking:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ec1766f9e750..a9522e53db2c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -8454,10 +8454,11 @@ void DomainMapper_Impl::StartOrEndBookmark( const 
OUString& rId )
 // then  move the bookmark-End to the earlier paragraph
 if (IsOutsideAParagraph())
 {
-// keep bookmark range
+// keep bookmark range, if it doesn't exceed cell boundary
 uno::Reference< text::XTextRange > xStart = 
xCursor->getStart();
 xCursor->goLeft( 1, false );
-xCursor->gotoRange(xStart, true );
+if (m_nTableDepth == 0 || !m_bFirstParagraphInCell)
+xCursor->gotoRange(xStart, true );
 }
 uno::Reference< container::XNamed > xBkmNamed( xBookmark, 
uno::UNO_QUERY_THROW );
 SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), 
"writerfilter.dmapper", "anonymous bookmark");


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source

2023-07-20 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0a5c49aa4f65c8e661f7da3934ab9bea8cacf662
Author: László Németh 
AuthorDate: Tue Jul 18 16:41:52 2023 +0200
Commit: László Németh 
CommitDate: Thu Jul 20 12:19:58 2023 +0200

tdf#150308 sw: fix missing top table border after hidden table rows

First visible line of a table with preceding hidden deleted rows
hid also the top border of the table, if the inner horizontal row
borders drawn only by bottom-only borders (like in the default table
style).

Note: re-use an existing workaround to show the missing line,
see commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628
"fdo#39415: sw: fix collapsing border painting more:"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: Ia8476a2ec592be1dc36e0ea71c10a71c257c29e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154595
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 379acb934164e673b708d0f3ec6b3ec046c8d73f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154612
Tested-by: László Németh 
(cherry picked from commit bd392b1f7a7378e571e67858cb4bff3161ef07c1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154626
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index dbb1272efa9e..e86ad990f83c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2798,6 +2798,8 @@ void SwTabFramePainter::FindStylesForLine( Point& 
rStartPoint,
 /**
  * Special case: #i9860#
  * first line in follow table without repeated headlines
+ * Special case: tdf#150308
+ * first visible line of a table with preceding hidden deleted rows
  */
 static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 SwTabFrame const& rTabFrame, SwFrame const& rFrame, SvxBoxItem const& 
rBoxItem)
@@ -2806,7 +2808,11 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 dynamic_cast(rFrame.GetUpper());
 return (pThisRowFrame
 && (pThisRowFrame->GetUpper() == )
-&& rTabFrame.IsFollow()
+&& ( rTabFrame.IsFollow()
+// tdf#150308 first table row isn't equal to the table row of the 
first
+// row frame of the first table frame: there are invisible deleted 
rows
+// in Hide Changes mode before the first visible table row
+|| rTabFrame.GetTable()->GetTabLines().front() != 
pThisRowFrame->GetTabLine() )
 && !rTabFrame.GetTable()->GetRowsToRepeat()
 &&  (  !pThisRowFrame->GetPrev()
 || static_cast(pThisRowFrame->GetPrev())


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-07-19 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0eb44f8c6ad764d8c2d044603f8f2aa84e3c7892
Author: László Németh 
AuthorDate: Tue Jul 18 16:41:52 2023 +0200
Commit: László Németh 
CommitDate: Thu Jul 20 00:31:37 2023 +0200

tdf#150308 sw: fix missing top table border after hidden table rows

First visible line of a table with preceding hidden deleted rows
hid also the top border of the table, if the inner horizontal row
borders drawn only by bottom-only borders (like in the default table
style).

Note: re-use an existing workaround to show the missing line,
see commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628
"fdo#39415: sw: fix collapsing border painting more:"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: Ia8476a2ec592be1dc36e0ea71c10a71c257c29e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154595
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 379acb934164e673b708d0f3ec6b3ec046c8d73f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154612
Tested-by: László Németh 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 47e56b390712..0a43dbb587ab 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2804,6 +2804,8 @@ void SwTabFramePainter::FindStylesForLine( Point& 
rStartPoint,
 /**
  * Special case: #i9860#
  * first line in follow table without repeated headlines
+ * Special case: tdf#150308
+ * first visible line of a table with preceding hidden deleted rows
  */
 static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 SwTabFrame const& rTabFrame, SwFrame const& rFrame, SvxBoxItem const& 
rBoxItem)
@@ -2812,7 +2814,11 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 dynamic_cast(rFrame.GetUpper());
 return (pThisRowFrame
 && (pThisRowFrame->GetUpper() == )
-&& rTabFrame.IsFollow()
+&& ( rTabFrame.IsFollow()
+// tdf#150308 first table row isn't equal to the table row of the 
first
+// row frame of the first table frame: there are invisible deleted 
rows
+// in Hide Changes mode before the first visible table row
+|| rTabFrame.GetTable()->GetTabLines().front() != 
pThisRowFrame->GetTabLine() )
 && !rTabFrame.GetTable()->GetRowsToRepeat()
 &&  (  !pThisRowFrame->GetPrev()
 || static_cast(pThisRowFrame->GetPrev())


[Libreoffice-commits] core.git: sw/source

2023-07-19 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit f9898fa64bd2a575be94c309b43373de53c5331b
Author: László Németh 
AuthorDate: Tue Jul 18 16:41:52 2023 +0200
Commit: László Németh 
CommitDate: Wed Jul 19 10:07:00 2023 +0200

tdf#150308 sw: fix missing top table border after hidden table rows

First visible line of a table with preceding hidden deleted rows
hid also the top border of the table, if the inner horizontal row
borders drawn only by bottom-only borders (like in the default table
style).

Note: re-use an existing workaround to show the missing line,
see commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628
"fdo#39415: sw: fix collapsing border painting more:"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: Ia8476a2ec592be1dc36e0ea71c10a71c257c29e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154595
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 69f78db19c59..117ac8eb5e61 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2805,6 +2805,8 @@ void SwTabFramePainter::FindStylesForLine( Point& 
rStartPoint,
 /**
  * Special case: #i9860#
  * first line in follow table without repeated headlines
+ * Special case: tdf#150308
+ * first visible line of a table with preceding hidden deleted rows
  */
 static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 SwTabFrame const& rTabFrame, SwFrame const& rFrame, SvxBoxItem const& 
rBoxItem)
@@ -2813,7 +2815,11 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 dynamic_cast(rFrame.GetUpper());
 return (pThisRowFrame
 && (pThisRowFrame->GetUpper() == )
-&& rTabFrame.IsFollow()
+&& ( rTabFrame.IsFollow()
+// tdf#150308 first table row isn't equal to the table row of the 
first
+// row frame of the first table frame: there are invisible deleted 
rows
+// in Hide Changes mode before the first visible table row
+|| rTabFrame.GetTable()->GetTabLines().front() != 
pThisRowFrame->GetTabLine() )
 && !rTabFrame.GetTable()->GetRowsToRepeat()
 &&  (  !pThisRowFrame->GetPrev()
 || static_cast(pThisRowFrame->GetPrev())


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source

2023-07-18 Thread László Németh (via logerrit)
 sc/source/core/data/table2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0985431e0c5e0baab80df0450c6b7a3699430c87
Author: László Németh 
AuthorDate: Fri Jul 14 18:41:31 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 18 12:16:09 2023 +0200

tdf#156286 sc: fix crash with column deletion

Skip negative indices, which caused the crash, when
more columns were deleted, than the remaining columns
before them.

Regression from commit dd8e061406fac581d399da088c7f0187278035dc
"tdf#153437 sc: fix broken formatting without performance regression".

Change-Id: I223e2fbb321fc4bd2ddb7a67a16a64c69e1e7872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154445
Reviewed-by: Czeber László 
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit e4ae409b8e57f5efe53af7bacd08b0d226a0d96f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154456

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index dbcd594fd62a..18fac8ddd176 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -401,7 +401,7 @@ void ScTable::DeleteCol(
 for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].SwapCol(aCol[nCol - nSize]);
 // When delete column(s), initialize the last columns from the default 
attributes
-for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol)
+for (SCCOL nCol = aCol.size() < static_cast(nSize) ? 0 : 
aCol.size() - nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false);
 }
 else


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-07-18 Thread László Németh (via logerrit)
 sc/source/core/data/table2.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7b6812c267356a7fb204b393f4625f8ff4fd296e
Author: László Németh 
AuthorDate: Fri Jul 14 18:41:31 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Jul 18 11:22:44 2023 +0200

tdf#156286 sc: fix crash with column deletion

Skip negative indices, which caused the crash, when
more columns were deleted, than the remaining columns
before them.

Regression from commit dd8e061406fac581d399da088c7f0187278035dc
"tdf#153437 sc: fix broken formatting without performance regression".

Change-Id: I223e2fbb321fc4bd2ddb7a67a16a64c69e1e7872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154445
Reviewed-by: Czeber László 
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154575
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a4758d088ac0..53ba083929c4 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -400,8 +400,8 @@ void ScTable::DeleteCol(
 {
 for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].SwapCol(aCol[nCol - nSize]);
-// When delete column(s), inicialize the last columns from the default 
attributes
-for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol)
+// When delete column(s), initialize the last columns from the default 
attributes
+for (SCCOL nCol = aCol.size() < static_cast(nSize) ? 0 : 
aCol.size() - nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false);
 }
 else


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source

2023-07-17 Thread László Németh (via logerrit)
 sc/source/core/data/table2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2198fd843b71ea6c8152f882b107eac7b3edd647
Author: László Németh 
AuthorDate: Fri Jul 14 18:41:31 2023 +0200
Commit: László Németh 
CommitDate: Mon Jul 17 23:57:33 2023 +0200

tdf#156286 sc: fix crash with column deletion

Skip negative indices, which caused the crash, when
more columns were deleted, than the remaining columns
before them.

Regression from commit dd8e061406fac581d399da088c7f0187278035dc
"tdf#153437 sc: fix broken formatting without performance regression".

Change-Id: I223e2fbb321fc4bd2ddb7a67a16a64c69e1e7872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154445
Reviewed-by: Czeber László 
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit e4ae409b8e57f5efe53af7bacd08b0d226a0d96f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154538

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index ee65a31ab6bf..027e2b424544 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -401,7 +401,7 @@ void ScTable::DeleteCol(
 for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].SwapCol(aCol[nCol - nSize]);
 // When delete column(s), initialize the last columns from the default 
attributes
-for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol)
+for (SCCOL nCol = aCol.size() < static_cast(nSize) ? 0 : 
aCol.size() - nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false);
 }
 else


[Libreoffice-commits] core.git: sc/source

2023-07-14 Thread László Németh (via logerrit)
 sc/source/core/data/table2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e4ae409b8e57f5efe53af7bacd08b0d226a0d96f
Author: László Németh 
AuthorDate: Fri Jul 14 18:41:31 2023 +0200
Commit: László Németh 
CommitDate: Sat Jul 15 00:05:04 2023 +0200

tdf#156286 sc: fix crash with column deletion

Skip negative indices, which caused the crash, when
more columns were deleted, than the remaining columns
before them.

Regression from commit dd8e061406fac581d399da088c7f0187278035dc
"tdf#153437 sc: fix broken formatting without performance regression".

Change-Id: I223e2fbb321fc4bd2ddb7a67a16a64c69e1e7872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154445
Reviewed-by: Czeber László 
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index cb1316ef9e35..ab1516b8297d 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -401,7 +401,7 @@ void ScTable::DeleteCol(
 for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].SwapCol(aCol[nCol - nSize]);
 // When delete column(s), initialize the last columns from the default 
attributes
-for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol)
+for (SCCOL nCol = aCol.size() < static_cast(nSize) ? 0 : 
aCol.size() - nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false);
 }
 else


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5-5' - sw/qa writerfilter/source

2023-07-12 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf153804.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   17 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 +-
 4 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit a468c85b44684ec4217566157323e064b5db9f96
Author: László Németh 
AuthorDate: Thu Jul 6 17:31:20 2023 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 12 09:18:02 2023 +0200

tdf#153804 DOCX import: fix lost footnotes in case of comments

Incomplete handling of m_bIsFootnote had a conflict with
XNote stream COMMENTS (i.e. not FOOTNOTES and ENDNOTES)
since commit 96a856f87f16cca2e039c973c18d57c8b9dca362
in DomainMapper::lcl_checkId(), resulting lost (order or
content) of footnotes, when were comments in the document.

Regression from commit 96a856f87f16cca2e039c973c18d57c8b9dca362
"tdf#152206 DOCX import: fix mixed first footnote".

Change-Id: I8d6901e8db1e183b959fecd350d6a263e79b5591
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154147
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 6d153fa9f5277b7324885e18b0a63e1af830b6c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154186
Tested-by: Jenkins
(cherry picked from commit 1e9e2ff5316a6d934205f1c01a57f80ef4e8657d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154188
Reviewed-by: Michael Stahl 
Reviewed-by: Xisco Fauli 
Reviewed-by: Michael Weghorn 
Tested-by: Michael Weghorn 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf153804.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153804.docx
new file mode 100644
index ..65a1fdfa8e17
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf153804.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c6949b14e6bc..458235ca26aa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1342,6 +1342,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153255)
 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg4."), 
xFootnote4->getString().trim() );
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf153804)
+{
+loadAndSave("tdf153804.docx");
+xmlDocUniquePtr pXml = parseExport("word/footnotes.xml");
+CPPUNIT_ASSERT(pXml);
+
+uno::Reference xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xFootnotes = 
xFootnotesSupplier->getFootnotes();
+uno::Reference xLastFootnote(xFootnotes->getByIndex(1), 
uno::UNO_QUERY);
+// This was empty
+CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg 6"), 
xLastFootnote->getString().trim() );
+
+uno::Reference xLastButOne(xFootnotes->getByIndex(0), 
uno::UNO_QUERY);
+// This was empty
+CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg5"), 
xLastButOne->getString().trim() );
+}
+
 // skip test for macOS (missing fonts?)
 #if !defined(MACOSX)
 DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7fb017154135..366f51a454b3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3815,7 +3815,7 @@ void DomainMapper_Impl::PopFootOrEndnote()
 }
 m_aRedlines.pop();
 m_eSkipFootnoteState = SkipFootnoteSeparator::OFF;
-m_bInFootOrEndnote = false;
+m_bInFootOrEndnote = m_bInFootnote = false;
 m_pFootnoteContext = nullptr;
 m_bFirstParagraphInCell = m_bSaveFirstParagraphInCell;
 }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 168f3bfb8b08..fab303cf3e3e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -872,7 +872,7 @@ public:
 void PushFootOrEndnote( bool bIsFootnote );
 void PopFootOrEndnote();
 bool IsInFootOrEndnote() const { return m_bInFootOrEndnote; }
-bool IsInFootnote() const { return m_bInFootnote; }
+bool IsInFootnote() const { return IsInFootOrEndnote() && m_bInFootnote; }
 
 void StartCustomFootnote(const PropertyMapPtr pContext);
 void EndCustomFootnote();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa

2023-07-10 Thread László Németh (via logerrit)
 sw/qa/core/layout/data/floattable-2cols.docx|binary
 sw/qa/core/layout/data/floattable-compat14-body.docx|binary
 sw/qa/core/layout/data/floattable-compat14-nosplit.docx |binary
 sw/qa/core/layout/data/floattable-compat14.docx |binary
 sw/qa/core/layout/data/floattable-footer-2rows.docx |binary
 sw/qa/core/layout/data/floattable-footer.docx   |binary
 sw/qa/core/layout/data/floattable-widow.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx  |   10 ++
 8 files changed, 10 insertions(+)

New commits:
commit a1f7f54202ed610da60e58d18af552ae39f5603a
Author: László Németh 
AuthorDate: Thu Jun 29 11:13:28 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 10 13:52:31 2023 +0200

tdf#146346 fix unit test & extend it to empty multi-page footnote

Implementing multi-page floating tables resulted a partial
regression here: not last table of the footnote, but empty
paragraph under it resulted an empty split footnote on the
second page, without noticing the problem.

Problem with the previous unit test of tdf#146346 was
reported by Mike Kaganski: "using getPages, does *not*
fail when there are two pages - because getPages is
(problematically) implemented as jumping to the end of
the document (body!), and texting which page is this; and
for the original problem, only a part of footnotes moved
to the second page, while all the body text was on the page 1."

Add unit test to catch the original problem (all tables of the
footnote must be on the first page), which fix likely wasn't
tested correctly using only getPages(), also add a (disabled) test
for the new regression, too.

Follow-up to commit d1ac8df139a2a65db45d1970ccc0b80e17d827f6
"tdf#146346 DOCX import: fix table margins in footnotes".

(cherry picked from commit 7520349b61a74e93a1d5d992f41b60631c3c5937)

[ Miklos: also now CppunitTest_sw_core_layout would fail, so pick a
number of test document updates from commit
fc1b9ab2913bc8c2d8414b6d8de3ceed3910c5d8 (tdf#133560: re-anchor objects,
to use paragraph's dispose for bEndOfDocument, 2023-06-23) from master,
too. ]

Change-Id: I6006db3fe2b5e6f7029a8a2d5d9cf99a17ec2ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154237
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/layout/data/floattable-2cols.docx 
b/sw/qa/core/layout/data/floattable-2cols.docx
index c43779f2aac9..b55bc8dd49b8 100644
Binary files a/sw/qa/core/layout/data/floattable-2cols.docx and 
b/sw/qa/core/layout/data/floattable-2cols.docx differ
diff --git a/sw/qa/core/layout/data/floattable-compat14-body.docx 
b/sw/qa/core/layout/data/floattable-compat14-body.docx
index 134128348ce2..fc25b867afc9 100644
Binary files a/sw/qa/core/layout/data/floattable-compat14-body.docx and 
b/sw/qa/core/layout/data/floattable-compat14-body.docx differ
diff --git a/sw/qa/core/layout/data/floattable-compat14-nosplit.docx 
b/sw/qa/core/layout/data/floattable-compat14-nosplit.docx
index 7d24d95aa92f..bd3f09c69e65 100644
Binary files a/sw/qa/core/layout/data/floattable-compat14-nosplit.docx and 
b/sw/qa/core/layout/data/floattable-compat14-nosplit.docx differ
diff --git a/sw/qa/core/layout/data/floattable-compat14.docx 
b/sw/qa/core/layout/data/floattable-compat14.docx
index 5afb0af477d8..19221609ddee 100644
Binary files a/sw/qa/core/layout/data/floattable-compat14.docx and 
b/sw/qa/core/layout/data/floattable-compat14.docx differ
diff --git a/sw/qa/core/layout/data/floattable-footer-2rows.docx 
b/sw/qa/core/layout/data/floattable-footer-2rows.docx
index 72013be28fbd..0d3db047c125 100644
Binary files a/sw/qa/core/layout/data/floattable-footer-2rows.docx and 
b/sw/qa/core/layout/data/floattable-footer-2rows.docx differ
diff --git a/sw/qa/core/layout/data/floattable-footer.docx 
b/sw/qa/core/layout/data/floattable-footer.docx
index 52cc73b17dfb..731e4fdb23a5 100644
Binary files a/sw/qa/core/layout/data/floattable-footer.docx and 
b/sw/qa/core/layout/data/floattable-footer.docx differ
diff --git a/sw/qa/core/layout/data/floattable-widow.docx 
b/sw/qa/core/layout/data/floattable-widow.docx
index 4a70c942c976..c3f17e6cd9ed 100644
Binary files a/sw/qa/core/layout/data/floattable-widow.docx and 
b/sw/qa/core/layout/data/floattable-widow.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c6949b14e6bc..5cc20d556853 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1348,6 +1348,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx")
 {
 // This was 2 (by bad docDefault vertical margins around tables in 
footnotes)
 CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// only first page has table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// check first page: all tables on 

  1   2   3   4   5   6   7   8   9   10   >