ESC meeting minutes: 2024-05-30

2024-05-30 Thread Miklos Vajna

* Present:
+ Heiko, Olivier, Eike, Ilmari, Jonathan, Michael W, Regina, Stephan, 
sockseight, Xisco, Thorsten, Caolan, Hossein, Cloph, Stephane, Miklos

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)
  + patch in gerrit pending CI

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC2 this week, to be tagged tomorrow
+ 24.8:
+ feature freeze (beta1) in 1 week
+ string / UI freeze 3 weeks after that
+ late features?
  + LET() Calc function (Thorsten)
+ Also, any idea when WASM TB will be upgraded? (Julien)
  + previously think it was a compiler failure (Cloph)
  + probably need a patch for lode.git first
  + wasn't aware of the tinderbox, doesn't send mails (Stephan)
+ can probably look at that next week
+ any reason why failure mails are not sent out? (Stephan)
  + nobody wanted to work on this (Cloph)
  + will turn it on, then (Stephan)
  + https://ci.libreoffice.org/view/tb%20platform%20status/ shows this as 
red as well (Miklos)
  + annoying vs useful ratio, probably useful to send mails failures for 
now (Thorsten)

* Documentation (Olivier)
+ Helpcontents2
   + Completion of new MS functions Help pages (ohallot)
  + XLOOKUP, RANDARRAY, SORTBY...
   + Updates and fixes (erack, S. Horacek, D. Maddern, A. Barrientos)
+ Guides
   + Work in progress.
+ Question1: Calc functions argument naming
   + Verbose? e.g. =FUNCTION (Argument one; Argument two,...)
   + Mnemonic? e.g. =FUNCTION (Arg1; Arg2;...)
   + no strong opinion (Thorsten)
   + tend to prefer the mnemonics, these have to fit into a tooltip (Eike)
   + the wizard & help pages should have the same name (Olivier)
   + prefer verbose (Heiko)
 + easier to understand that way
   + the one doing the work gets to decide (Cloph)
+ Question2: New dialog layout
   + Stability/rendering among OS's.
   + Screenshooting for documentation
   + see "Vertical tabpages state" below (Miklos)
+ Bugzilla Documentation statistics
245(245) bugs open
+ Updates:
BZ changes   1 week1 month   3 months   12 months
   created 17(1) 47(3) 113(1) 224(3)
 commented 20(-17)   89(-2)257(-19)   871(3)
  resolved 10(3) 30(3)  67(5) 131(7)
+ top 10 contributors:
  Dione Maddern made 53 changes in 1 month, and 84 changes in 1 year
  Olivier Hallot made 51 changes in 1 month, and 247 changes in 1 year
  Stéphane Guillou made 17 changes in 1 month, and 247 changes in 1 year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Heiko Tietze made 7 changes in 1 month, and 77 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 71 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Bogdan B made 4 changes in 1 month, and 13 changes in 1 year
  Ilmari Lauhakangas made 4 changes in 1 month, and 69 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 40(40) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  7(4) 13(3) 18(4)   25(3)
 commented 92(63)   226(67)   553(41)1757(47)
   removed  0(0)  1(-2) 5(0)   10(-1)
  resolved  6(1) 27(-1)80(1)  293(3)
+ top 10 contributors:
  Heiko Tietze made 109 changes in 1 month, and 965 changes in 1 year
  Stéphane Guillou made 97 changes in 1 month, and 671 changes in 1 year
  Vernon, Stuart Foote made 57 changes in 1 month, and 327 changes in 1 
year
  Eyal Rozenberg made 53 changes in 1 month, and 166 changes in 1 year
  Dieter made 26 changes in 1 month, and 127 changes in 1 year
  Ady made 11 changes in 1 month, and 120 changes in 1 year
  m.a.riosv made 11 changes in 1 month, and 48 changes in 1 year
  Henschel, Regina made 11 changes in 1 month, and 38 changes in 1 year
  Jérôme made 10 changes in 1 month, and 14 changes in 1 year
  Rafael Lima made 10 changes in 1 month, and 59 changes in 1 year
+ [Bug 157580] Allow notebookbar and groupedbarcompact groups sections to be
   shown/hidden based on available space instead of only their order
+ [Bug 161304] context menu Column deletion duplicates Cut shortcut
+ [Bug 160999] Find sidebar results presented with huge gratuitous spaces
+ [Bug 161276] Add booklet option to print smaller format booklet
 -> + [Bug 161032] Allow removing bundled extensions
  + dictionaries in particular
+ [Bug 

ESC meeting minutes: 2024-05-30

2024-05-30 Thread Miklos Vajna

* Present:
+ Heiko, Olivier, Eike, Ilmari, Jonathan, Michael W, Regina, Stephan, 
sockseight, Xisco, Thorsten, Caolan, Hossein, Cloph, Stephane, Miklos

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)
  + patch in gerrit pending CI

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC2 this week, to be tagged tomorrow
+ 24.8:
+ feature freeze (beta1) in 1 week
+ string / UI freeze 3 weeks after that
+ late features?
  + LET() Calc function (Thorsten)
+ Also, any idea when WASM TB will be upgraded? (Julien)
  + previously think it was a compiler failure (Cloph)
  + probably need a patch for lode.git first
  + wasn't aware of the tinderbox, doesn't send mails (Stephan)
+ can probably look at that next week
+ any reason why failure mails are not sent out? (Stephan)
  + nobody wanted to work on this (Cloph)
  + will turn it on, then (Stephan)
  + https://ci.libreoffice.org/view/tb%20platform%20status/ shows this as 
red as well (Miklos)
  + annoying vs useful ratio, probably useful to send mails failures for 
now (Thorsten)

* Documentation (Olivier)
+ Helpcontents2
   + Completion of new MS functions Help pages (ohallot)
  + XLOOKUP, RANDARRAY, SORTBY...
   + Updates and fixes (erack, S. Horacek, D. Maddern, A. Barrientos)
+ Guides
   + Work in progress.
+ Question1: Calc functions argument naming
   + Verbose? e.g. =FUNCTION (Argument one; Argument two,...)
   + Mnemonic? e.g. =FUNCTION (Arg1; Arg2;...)
   + no strong opinion (Thorsten)
   + tend to prefer the mnemonics, these have to fit into a tooltip (Eike)
   + the wizard & help pages should have the same name (Olivier)
   + prefer verbose (Heiko)
 + easier to understand that way
   + the one doing the work gets to decide (Cloph)
+ Question2: New dialog layout
   + Stability/rendering among OS's.
   + Screenshooting for documentation
   + see "Vertical tabpages state" below (Miklos)
+ Bugzilla Documentation statistics
245(245) bugs open
+ Updates:
BZ changes   1 week1 month   3 months   12 months
   created 17(1) 47(3) 113(1) 224(3)
 commented 20(-17)   89(-2)257(-19)   871(3)
  resolved 10(3) 30(3)  67(5) 131(7)
+ top 10 contributors:
  Dione Maddern made 53 changes in 1 month, and 84 changes in 1 year
  Olivier Hallot made 51 changes in 1 month, and 247 changes in 1 year
  Stéphane Guillou made 17 changes in 1 month, and 247 changes in 1 year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Heiko Tietze made 7 changes in 1 month, and 77 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 71 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Bogdan B made 4 changes in 1 month, and 13 changes in 1 year
  Ilmari Lauhakangas made 4 changes in 1 month, and 69 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 40(40) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  7(4) 13(3) 18(4)   25(3)
 commented 92(63)   226(67)   553(41)1757(47)
   removed  0(0)  1(-2) 5(0)   10(-1)
  resolved  6(1) 27(-1)80(1)  293(3)
+ top 10 contributors:
  Heiko Tietze made 109 changes in 1 month, and 965 changes in 1 year
  Stéphane Guillou made 97 changes in 1 month, and 671 changes in 1 year
  Vernon, Stuart Foote made 57 changes in 1 month, and 327 changes in 1 
year
  Eyal Rozenberg made 53 changes in 1 month, and 166 changes in 1 year
  Dieter made 26 changes in 1 month, and 127 changes in 1 year
  Ady made 11 changes in 1 month, and 120 changes in 1 year
  m.a.riosv made 11 changes in 1 month, and 48 changes in 1 year
  Henschel, Regina made 11 changes in 1 month, and 38 changes in 1 year
  Jérôme made 10 changes in 1 month, and 14 changes in 1 year
  Rafael Lima made 10 changes in 1 month, and 59 changes in 1 year
+ [Bug 157580] Allow notebookbar and groupedbarcompact groups sections to be
   shown/hidden based on available space instead of only their order
+ [Bug 161304] context menu Column deletion duplicates Cut shortcut
+ [Bug 160999] Find sidebar results presented with huge gratuitous spaces
+ [Bug 161276] Add booklet option to print smaller format booklet
 -> + [Bug 161032] Allow removing bundled extensions
  + dictionaries in particular
+ [Bug 

core.git: Branch 'distro/collabora/co-23.05' - sw/CppunitTest_sw_core_text.mk sw/qa sw/source

2024-05-30 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_core_text.mk|1 
 sw/qa/core/text/data/clearing-break-wrap-through.docx |binary
 sw/qa/core/text/txtfly.cxx|   52 ++
 sw/source/core/text/txtfly.cxx|7 ++
 4 files changed, 60 insertions(+)

New commits:
commit af5b508e92bd9df21ba821f266ec4ede606677aa
Author: Miklos Vajna 
AuthorDate: Thu May 30 08:10:13 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 30 15:39:26 2024 +0200

tdf#161318 sw clearing break: ignore wrap-through anchored objects

Import the bugdoc: we expect just a single page for the 2 paragraphs,
but the second paragraph goes to a 2nd page.

What seems to happen since commit
f86d1482bef285f90079b5130e410646db96cf58 (sw clearing breaks: add DOCX
import, 2022-03-08) is that on one hand, SwTextFly::ForEach() ignores
wrap-through shapes, but at the same time SwTextFly::GetMaxBottom() did
not, and this lead to a loop: the first paragraph kept growing till the
shape was shifted to page 2, but then the same first paragraph was
reduced to just 2 lines, goto 1.

Fix the problem by extending SwTextFly::GetMaxBottom() to also ignore
wrap-though shapes: this is the intention, just clearing breaks were not
tested with wrap-though wrap mode before.

This is a reduced bugdoc, the original one even produced warnings like:
warn:legacy.osl:12034:12034:sw/source/core/layout/flowfrm.cxx:2667: 
 - layout loop control for layout action  applied!
without the fix, and these are now gone.

(cherry picked from commit 304cc248f15d795bc9fe8b751b0d98841b8ff5d1)

Conflicts:
sw/CppunitTest_sw_core_text.mk

Change-Id: Iaf9849dbf8e1a8e5d625d3c19b99636247804cdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168254
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
(cherry picked from commit 317ca78624b1594a40c4917482e99d10bd8e2780)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168262
Reviewed-by: Miklos Vajna 

diff --git a/sw/CppunitTest_sw_core_text.mk b/sw/CppunitTest_sw_core_text.mk
index ce27696b3c4c..5e623d3b0cd0 100644
--- a/sw/CppunitTest_sw_core_text.mk
+++ b/sw/CppunitTest_sw_core_text.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,sw_core_text, \
 sw/qa/core/text/porlay \
 sw/qa/core/text/porrst \
 sw/qa/core/text/text \
+sw/qa/core/text/txtfly \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,sw_core_text, \
diff --git a/sw/qa/core/text/data/clearing-break-wrap-through.docx 
b/sw/qa/core/text/data/clearing-break-wrap-through.docx
new file mode 100644
index ..c96e8c27da5e
Binary files /dev/null and 
b/sw/qa/core/text/data/clearing-break-wrap-through.docx differ
diff --git a/sw/qa/core/text/txtfly.cxx b/sw/qa/core/text/txtfly.cxx
new file mode 100644
index ..461ed81e2203
--- /dev/null
+++ b/sw/qa/core/text/txtfly.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace
+{
+/// Covers sw/source/core/text/txtfly.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/core/text/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testClearingBreakWrapThrough)
+{
+// Given a document with a clearing break, then a shape in the next 
paragraph:
+createSwDoc("clearing-break-wrap-through.docx");
+
+// When laying out that document:
+calcLayout();
+
+// Then make sure we layout these 2 paragraphs on a single page, since 
there is enough space for
+// them:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage);
+// Without the accompanying fix in place, this test would have failed, we 
had an unexpected 2nd
+// page.
+CPPUNIT_ASSERT(!pPage->GetNext());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index a4f625651f1e..dc4d24f27aab 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1043,6 +1043,13 @@ SwTwips SwTextFly::GetMaxBottom(const SwBreakPortion& 
rPortion, const SwTextForm
 continue;
 }
 
+const SwFormatSurround& rSurround = 
pAnchoredObj->GetFrameFormat().GetSurround();
+if (rSurrou

core.git: Branch 'distro/collabora/co-24.04' - sw/CppunitTest_sw_core_text.mk sw/qa sw/source

2024-05-30 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_core_text.mk|1 
 sw/qa/core/text/data/clearing-break-wrap-through.docx |binary
 sw/qa/core/text/txtfly.cxx|   52 ++
 sw/source/core/text/txtfly.cxx|7 ++
 4 files changed, 60 insertions(+)

New commits:
commit 317ca78624b1594a40c4917482e99d10bd8e2780
Author: Miklos Vajna 
AuthorDate: Thu May 30 08:10:13 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 30 14:09:53 2024 +0200

tdf#161318 sw clearing break: ignore wrap-through anchored objects

Import the bugdoc: we expect just a single page for the 2 paragraphs,
but the second paragraph goes to a 2nd page.

What seems to happen since commit
f86d1482bef285f90079b5130e410646db96cf58 (sw clearing breaks: add DOCX
import, 2022-03-08) is that on one hand, SwTextFly::ForEach() ignores
wrap-through shapes, but at the same time SwTextFly::GetMaxBottom() did
not, and this lead to a loop: the first paragraph kept growing till the
shape was shifted to page 2, but then the same first paragraph was
reduced to just 2 lines, goto 1.

Fix the problem by extending SwTextFly::GetMaxBottom() to also ignore
wrap-though shapes: this is the intention, just clearing breaks were not
tested with wrap-though wrap mode before.

This is a reduced bugdoc, the original one even produced warnings like:
warn:legacy.osl:12034:12034:sw/source/core/layout/flowfrm.cxx:2667: 
 - layout loop control for layout action  applied!
without the fix, and these are now gone.

(cherry picked from commit 304cc248f15d795bc9fe8b751b0d98841b8ff5d1)

Conflicts:
sw/CppunitTest_sw_core_text.mk

Change-Id: Iaf9849dbf8e1a8e5d625d3c19b99636247804cdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168254
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 

diff --git a/sw/CppunitTest_sw_core_text.mk b/sw/CppunitTest_sw_core_text.mk
index ce27696b3c4c..5e623d3b0cd0 100644
--- a/sw/CppunitTest_sw_core_text.mk
+++ b/sw/CppunitTest_sw_core_text.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,sw_core_text, \
 sw/qa/core/text/porlay \
 sw/qa/core/text/porrst \
 sw/qa/core/text/text \
+sw/qa/core/text/txtfly \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,sw_core_text, \
diff --git a/sw/qa/core/text/data/clearing-break-wrap-through.docx 
b/sw/qa/core/text/data/clearing-break-wrap-through.docx
new file mode 100644
index ..c96e8c27da5e
Binary files /dev/null and 
b/sw/qa/core/text/data/clearing-break-wrap-through.docx differ
diff --git a/sw/qa/core/text/txtfly.cxx b/sw/qa/core/text/txtfly.cxx
new file mode 100644
index ..461ed81e2203
--- /dev/null
+++ b/sw/qa/core/text/txtfly.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace
+{
+/// Covers sw/source/core/text/txtfly.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/core/text/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testClearingBreakWrapThrough)
+{
+// Given a document with a clearing break, then a shape in the next 
paragraph:
+createSwDoc("clearing-break-wrap-through.docx");
+
+// When laying out that document:
+calcLayout();
+
+// Then make sure we layout these 2 paragraphs on a single page, since 
there is enough space for
+// them:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage);
+// Without the accompanying fix in place, this test would have failed, we 
had an unexpected 2nd
+// page.
+CPPUNIT_ASSERT(!pPage->GetNext());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 7c4d9a2e160d..45eea853 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1051,6 +1051,13 @@ SwTwips SwTextFly::GetMaxBottom(const SwBreakPortion& 
rPortion, const SwTextForm
 continue;
 }
 
+const SwFormatSurround& rSurround = 
pAnchoredObj->GetFrameFormat()->GetSurround();
+if (rSurround.GetValue() == text::WrapTextMode_THROUGH)
+{
+// Wrap through has no influence on clearing breaks.
+continue;
+}
+
 S

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-30 Thread Miklos Vajna (via logerrit)
 sw/qa/filter/ww8/ww8.cxx |   30 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   13 +++
 sw/source/filter/ww8/docxattributeoutput.hxx |2 -
 sw/source/filter/ww8/docxexport.cxx  |4 +--
 4 files changed, 46 insertions(+), 3 deletions(-)

New commits:
commit d0ee0c93d6145542d82ba62887f4e5a3691333fe
Author: Miklos Vajna 
AuthorDate: Wed May 29 13:34:25 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 30 14:08:24 2024 +0200

tdf#160984 sw continuous endnotes: DOCX: export of  pos == 
sectEnd

In case a DOCX file is re-exported to Word and it collected endnotes at
section end, this setting was lost on save.

The relevant markup seems to be  -> , though that's a per-section setting in Writer, and is
a per-doc setting in Word.

Fix the problem by doing it similar to
DocxExport::WriteDocumentBackgroundFill(), which takes the first page
style in a similar case; here we take the first section format.

This is meant to be good enough for the DOCX editing case, where we know
all sections have the same endnote position properties anyway.

(cherry picked from commit 566c7017a84e3d573de85a6d986b81d3f59de0fa)

Change-Id: I95508296e31c9be34196bdc0da2177101647abf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168241
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 4cbbfe5fbf31..070565345a2d 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -564,6 +565,35 @@ CPPUNIT_TEST_FIXTURE(Test, testNullPointerDereference)
 createSwDoc("null-pointer-dereference.doc");
 CPPUNIT_ASSERT_EQUAL(6, getPages());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEnd)
+{
+// Given a document, endnotes at collected at section end:
+createSwDoc();
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->SplitNode();
+pWrtShell->Up(/*bSelect=*/false);
+pWrtShell->Insert("x");
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+SwSectionData aSection(SectionType::Content, 
pWrtShell->GetUniqueSectionName());
+pWrtShell->StartAction();
+SfxItemSetFixed 
aSet(pWrtShell->GetAttrPool());
+aSet.Put(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+pWrtShell->InsertSection(aSection, );
+pWrtShell->EndAction();
+pWrtShell->InsertFootnote(OUString(), /*bEndNote=*/true);
+
+// When saving to DOCX:
+save("Office Open XML Text");
+
+// Then make sure the endnote position is section end:
+xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
+OUString aPos = getXPath(pXmlDoc, "/w:settings/w:endnotePr/w:pos"_ostr, 
"val"_ostr);
+// Without the accompanying fix in place, this test would have failed with:
+// - XPath '/w:settings/w:endnotePr/w:pos' number of nodes is incorrect
+// i.e. the default position was used: document end.
+CPPUNIT_ASSERT_EQUAL(OUString("sectEnd"), aPos);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3201321a6328..2f77cf07b06a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -127,6 +127,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -8786,6 +8787,18 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( 
::sax_fastparser::FSHelperPtr
 const SwEndNoteInfo& info, int listtag )
 {
 fs->startElementNS(XML_w, tag);
+
+SwSectionFormats& rSections = m_rExport.m_rDoc.GetSections();
+if (!rSections.empty())
+{
+SwSectionFormat* pFormat = rSections[0];
+bool bEndnAtEnd = pFormat->GetEndAtTextEnd().IsAtEnd();
+if (bEndnAtEnd)
+{
+fs->singleElementNS(XML_w, XML_pos, FSNS(XML_w, XML_val), 
"sectEnd");
+}
+}
+
 OString aCustomFormat;
 OString fmt = lcl_ConvertNumberingType(info.m_aFormat.GetNumberingType(), 
nullptr, aCustomFormat);
 if (!fmt.isEmpty() && aCustomFormat.isEmpty())
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 10f39debc2a0..b23f5b98ee7e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -1109,7 +1109,7 @@ public:
 void FootnotesEndnotes( bool bFootnotes );
 
 /// writes the footnotePr/endnotePr (depending on tag) section
-static void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr const & 
fs, int tag, const SwEndNoteInfo& info, int listtag );
+void Writ

core.git: sw/CppunitTest_sw_core_text.mk sw/qa sw/source

2024-05-30 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_core_text.mk|1 
 sw/qa/core/text/data/clearing-break-wrap-through.docx |binary
 sw/qa/core/text/txtfly.cxx|   52 ++
 sw/source/core/text/txtfly.cxx|7 ++
 4 files changed, 60 insertions(+)

New commits:
commit 304cc248f15d795bc9fe8b751b0d98841b8ff5d1
Author: Miklos Vajna 
AuthorDate: Thu May 30 08:10:13 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 30 13:30:40 2024 +0200

tdf#161318 sw clearing break: ignore wrap-through anchored objects

Import the bugdoc: we expect just a single page for the 2 paragraphs,
but the second paragraph goes to a 2nd page.

What seems to happen since commit
f86d1482bef285f90079b5130e410646db96cf58 (sw clearing breaks: add DOCX
import, 2022-03-08) is that on one hand, SwTextFly::ForEach() ignores
wrap-through shapes, but at the same time SwTextFly::GetMaxBottom() did
not, and this lead to a loop: the first paragraph kept growing till the
shape was shifted to page 2, but then the same first paragraph was
reduced to just 2 lines, goto 1.

Fix the problem by extending SwTextFly::GetMaxBottom() to also ignore
wrap-though shapes: this is the intention, just clearing breaks were not
tested with wrap-though wrap mode before.

This is a reduced bugdoc, the original one even produced warnings like:
warn:legacy.osl:12034:12034:sw/source/core/layout/flowfrm.cxx:2667: 
 - layout loop control for layout action  applied!
without the fix, and these are now gone.

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

diff --git a/sw/CppunitTest_sw_core_text.mk b/sw/CppunitTest_sw_core_text.mk
index 95b69b90113b..8c215dfab4e1 100644
--- a/sw/CppunitTest_sw_core_text.mk
+++ b/sw/CppunitTest_sw_core_text.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,sw_core_text, \
 sw/qa/core/text/porlay \
 sw/qa/core/text/porrst \
 sw/qa/core/text/text \
+sw/qa/core/text/txtfly \
 sw/qa/core/text/widorp \
 ))
 
diff --git a/sw/qa/core/text/data/clearing-break-wrap-through.docx 
b/sw/qa/core/text/data/clearing-break-wrap-through.docx
new file mode 100644
index ..c96e8c27da5e
Binary files /dev/null and 
b/sw/qa/core/text/data/clearing-break-wrap-through.docx differ
diff --git a/sw/qa/core/text/txtfly.cxx b/sw/qa/core/text/txtfly.cxx
new file mode 100644
index ..461ed81e2203
--- /dev/null
+++ b/sw/qa/core/text/txtfly.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace
+{
+/// Covers sw/source/core/text/txtfly.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/core/text/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testClearingBreakWrapThrough)
+{
+// Given a document with a clearing break, then a shape in the next 
paragraph:
+createSwDoc("clearing-break-wrap-through.docx");
+
+// When laying out that document:
+calcLayout();
+
+// Then make sure we layout these 2 paragraphs on a single page, since 
there is enough space for
+// them:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage);
+// Without the accompanying fix in place, this test would have failed, we 
had an unexpected 2nd
+// page.
+CPPUNIT_ASSERT(!pPage->GetNext());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 7c4d9a2e160d..45eea853 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1051,6 +1051,13 @@ SwTwips SwTextFly::GetMaxBottom(const SwBreakPortion& 
rPortion, const SwTextForm
 continue;
 }
 
+const SwFormatSurround& rSurround = 
pAnchoredObj->GetFrameFormat()->GetSurround();
+if (rSurround.GetValue() == text::WrapTextMode_THROUGH)
+{
+// Wrap through has no influence on clearing breaks.
+continue;
+}
+
 SwRect aRect(pAnchoredObj->GetObjRectWithSpaces());
 
 if (m_pCurrFrame->IsVertical())


core.git: Branch 'distro/collabora/co-24.04' - libreofficekit/README.md

2024-05-30 Thread Miklos Vajna (via logerrit)
 libreofficekit/README.md |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit fd22acaf8914b11962d6667eacfc47e514fc7b43
Author: Miklos Vajna 
AuthorDate: Wed May 29 08:21:37 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 30 10:24:35 2024 +0200

lok: document some guidelines on how to not end up with too many callbacks

In general, the existing command dispatch, command value getter &
command state callback is meant to be enough for most needs.

(cherry picked from commit ff0cb77a6c9fec7127c26f63a420e877ac4f852e)

Change-Id: Ibba5455b461a8eac052f17ac5e824ddea42755f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168240
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/libreofficekit/README.md b/libreofficekit/README.md
index 95a33707a28a..148879ec57fc 100644
--- a/libreofficekit/README.md
+++ b/libreofficekit/README.md
@@ -81,6 +81,20 @@ once a feature works there, then implement the Android part, 
with its slower
 development iteration (slow uploading to the device, the need to link all
 object files into a single `.so`, etc).
 
+### LOK API guidelines
+
+Introducing explicit new API under `include/LibreOfficeKit/` adds type safety 
but listing each &
+every micro-feature in those headers don't scale. Before extending those 
headers, consider using one
+of the following alternatives, which require no changes to these headers:
+
+- LOK client → core direction: use `postUnoCommand()` to dispatch an UNO 
command, optionally with
+  parameters.
+- core → LOK client direction:
+  - Use `getCommandValues()` when this is initiated by the LOK client.
+  - Use `LOK_CALLBACK_STATE_CHANGED` with a JSON payload when this is 
initiated by core.
+
+It's useful to stick to these if possible, only add new C++ API when these are 
not a good fit.
+
 * Debugging with gdb and `gtktiledviewer`
 
 To run `gtktiledviewer`:


core.git: sw/qa sw/source

2024-05-29 Thread Miklos Vajna (via logerrit)
 sw/qa/filter/ww8/ww8.cxx |   30 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   13 +++
 sw/source/filter/ww8/docxattributeoutput.hxx |2 -
 sw/source/filter/ww8/docxexport.cxx  |4 +--
 4 files changed, 46 insertions(+), 3 deletions(-)

New commits:
commit 566c7017a84e3d573de85a6d986b81d3f59de0fa
Author: Miklos Vajna 
AuthorDate: Wed May 29 13:34:25 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 29 20:10:50 2024 +0200

tdf#160984 sw continuous endnotes: DOCX: export of  pos == 
sectEnd

In case a DOCX file is re-exported to Word and it collected endnotes at
section end, this setting was lost on save.

The relevant markup seems to be  -> , though that's a per-section setting in Writer, and is
a per-doc setting in Word.

Fix the problem by doing it similar to
DocxExport::WriteDocumentBackgroundFill(), which takes the first page
style in a similar case; here we take the first section format.

This is meant to be good enough for the DOCX editing case, where we know
all sections have the same endnote position properties anyway.

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

diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 4cbbfe5fbf31..070565345a2d 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -564,6 +565,35 @@ CPPUNIT_TEST_FIXTURE(Test, testNullPointerDereference)
 createSwDoc("null-pointer-dereference.doc");
 CPPUNIT_ASSERT_EQUAL(6, getPages());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEnd)
+{
+// Given a document, endnotes at collected at section end:
+createSwDoc();
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->SplitNode();
+pWrtShell->Up(/*bSelect=*/false);
+pWrtShell->Insert("x");
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+SwSectionData aSection(SectionType::Content, 
pWrtShell->GetUniqueSectionName());
+pWrtShell->StartAction();
+SfxItemSetFixed 
aSet(pWrtShell->GetAttrPool());
+aSet.Put(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+pWrtShell->InsertSection(aSection, );
+pWrtShell->EndAction();
+pWrtShell->InsertFootnote(OUString(), /*bEndNote=*/true);
+
+// When saving to DOCX:
+save("Office Open XML Text");
+
+// Then make sure the endnote position is section end:
+xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
+OUString aPos = getXPath(pXmlDoc, "/w:settings/w:endnotePr/w:pos"_ostr, 
"val"_ostr);
+// Without the accompanying fix in place, this test would have failed with:
+// - XPath '/w:settings/w:endnotePr/w:pos' number of nodes is incorrect
+// i.e. the default position was used: document end.
+CPPUNIT_ASSERT_EQUAL(OUString("sectEnd"), aPos);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1532ecf72c81..971f27df0314 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -127,6 +127,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -8780,6 +8781,18 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( 
::sax_fastparser::FSHelperPtr
 const SwEndNoteInfo& info, int listtag )
 {
 fs->startElementNS(XML_w, tag);
+
+SwSectionFormats& rSections = m_rExport.m_rDoc.GetSections();
+if (!rSections.empty())
+{
+SwSectionFormat* pFormat = rSections[0];
+bool bEndnAtEnd = pFormat->GetEndAtTextEnd().IsAtEnd();
+if (bEndnAtEnd)
+{
+fs->singleElementNS(XML_w, XML_pos, FSNS(XML_w, XML_val), 
"sectEnd");
+}
+}
+
 OString aCustomFormat;
 OString fmt = lcl_ConvertNumberingType(info.m_aFormat.GetNumberingType(), 
nullptr, aCustomFormat);
 if (!fmt.isEmpty() && aCustomFormat.isEmpty())
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index b1da698c3dec..063cb02bbc69 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -1109,7 +1109,7 @@ public:
 void FootnotesEndnotes( bool bFootnotes );
 
 /// writes the footnotePr/endnotePr (depending on tag) section
-static void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr const & 
fs, int tag, const SwEndNoteInfo& info, int listtag );
+void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr const & fs, int 
tag, const SwEndNoteInfo&

core.git: libreofficekit/README.md

2024-05-29 Thread Miklos Vajna (via logerrit)
 libreofficekit/README.md |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit ff0cb77a6c9fec7127c26f63a420e877ac4f852e
Author: Miklos Vajna 
AuthorDate: Wed May 29 08:21:37 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 29 19:32:19 2024 +0200

lok: document some guidelines on how to not end up with too many callbacks

In general, the existing command dispatch, command value getter &
command state callback is meant to be enough for most needs.

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

diff --git a/libreofficekit/README.md b/libreofficekit/README.md
index 95a33707a28a..148879ec57fc 100644
--- a/libreofficekit/README.md
+++ b/libreofficekit/README.md
@@ -81,6 +81,20 @@ once a feature works there, then implement the Android part, 
with its slower
 development iteration (slow uploading to the device, the need to link all
 object files into a single `.so`, etc).
 
+### LOK API guidelines
+
+Introducing explicit new API under `include/LibreOfficeKit/` adds type safety 
but listing each &
+every micro-feature in those headers don't scale. Before extending those 
headers, consider using one
+of the following alternatives, which require no changes to these headers:
+
+- LOK client → core direction: use `postUnoCommand()` to dispatch an UNO 
command, optionally with
+  parameters.
+- core → LOK client direction:
+  - Use `getCommandValues()` when this is initiated by the LOK client.
+  - Use `LOK_CALLBACK_STATE_CHANGED` with a JSON payload when this is 
initiated by core.
+
+It's useful to stick to these if possible, only add new C++ API when these are 
not a good fit.
+
 * Debugging with gdb and `gtktiledviewer`
 
 To run `gtktiledviewer`:


ESC meeting agenda: 2024-05-30 16:00 CEST

2024-05-29 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC2 this week?
+ 24.8:
+ feature freeze (beta1) in 1 week
+ string / UI freeze 3 weeks after that

* Documentation (Olivier)
+ Bugzilla Documentation statistics
245(245) bugs open
+ Updates:
BZ changes   1 week1 month   3 months   12 months
   created 17(1) 47(3) 113(1) 224(3)
 commented 20(-17)   89(-2)257(-19)   871(3)
  resolved 10(3) 30(3)  67(5) 131(7)
+ top 10 contributors:
  Dione Maddern made 53 changes in 1 month, and 84 changes in 1 year
  Olivier Hallot made 51 changes in 1 month, and 247 changes in 1 year
  Stéphane Guillou made 17 changes in 1 month, and 247 changes in 1 year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Heiko Tietze made 7 changes in 1 month, and 77 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 71 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Bogdan B made 4 changes in 1 month, and 13 changes in 1 year
  Ilmari Lauhakangas made 4 changes in 1 month, and 69 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 40(40) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  7(4) 13(3) 18(4)   25(3)
 commented 92(63)   226(67)   553(41)1757(47)
   removed  0(0)  1(-2) 5(0)   10(-1)
  resolved  6(1) 27(-1)80(1)  293(3)
+ top 10 contributors:
  Heiko Tietze made 109 changes in 1 month, and 965 changes in 1 year
  Stéphane Guillou made 97 changes in 1 month, and 671 changes in 1 year
  Vernon, Stuart Foote made 57 changes in 1 month, and 327 changes in 1 
year
  Eyal Rozenberg made 53 changes in 1 month, and 166 changes in 1 year
  Dieter made 26 changes in 1 month, and 127 changes in 1 year
  Ady made 11 changes in 1 month, and 120 changes in 1 year
  m.a.riosv made 11 changes in 1 month, and 48 changes in 1 year
  Henschel, Regina made 11 changes in 1 month, and 38 changes in 1 year
  Jérôme made 10 changes in 1 month, and 14 changes in 1 year
  Rafael Lima made 10 changes in 1 month, and 59 changes in 1 year

* Vertical tabpages state (Samuel)
  + review the state this week

* Crash Testing (Caolan)
+ 24(+1) import failure, 20(+2) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.1.177(+0)
+ 24.2.1.215782(+611)
+ 24.2.2.212792(+1102)
+ 24.2.3.25213(+2237)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months 12 months
  open  94(38) 183(37) 183(36)   183(36)
   reviews 300(-62)   1310(-12)   3386(-152)   12504(18)
merged 217(-37)   1245(-59)   3239(-146)   12693(-25)
 abandoned   7(-3)  48(-5) 162(-13)  659(0)
   own commits 160(-17)899(-47)   2328(-72) 9268(-5)
review commits  52(-20)229(-4) 795(-25) 3008(3)
contributor...   1 week 1 month 3 months 12 months
  open  36(0)  100(5)  102(6)102(6)
   reviews 696(-34)   3110(-22)   7580(-246)   29560(10)
merged  16(-9)  82(-8) 347(-19) 1575(-14)
 abandoned   8(1)   27(-1) 140(-140) 710(6)
   own commits  17(-18)101(-6) 397(-16) 1141(4)
review commits   0(0)0(0)0(0)  0(0)
+ easyHack statistics:
   needsDevEval 9(9)   needsUXEval 1(1)   cleanup_comments 328(328)
   total 410(410)   assigned 28(28)   open 348(348)
+ top 10 contributors:
  Dione Maddern made 21 patches in 1 month, and 55 patches in 1 year
  Weblate made 5 patches in 1 month, and 27 patches in 1 year
  Jakub Kościelak made 4 patches in 1 month, and 7 patches in 1 year
  LeSasse made 4 patches in 1 month, and 23 patches in 1 year
made 3 patches in 1 month, and 8 patches in 1 year
  Hubert Figuière made 3 patches in 1 month, and 8 patches in 1 year
 

ESC meeting agenda: 2024-05-30 16:00 CEST

2024-05-29 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC2 this week?
+ 24.8:
+ feature freeze (beta1) in 1 week
+ string / UI freeze 3 weeks after that

* Documentation (Olivier)
+ Bugzilla Documentation statistics
245(245) bugs open
+ Updates:
BZ changes   1 week1 month   3 months   12 months
   created 17(1) 47(3) 113(1) 224(3)
 commented 20(-17)   89(-2)257(-19)   871(3)
  resolved 10(3) 30(3)  67(5) 131(7)
+ top 10 contributors:
  Dione Maddern made 53 changes in 1 month, and 84 changes in 1 year
  Olivier Hallot made 51 changes in 1 month, and 247 changes in 1 year
  Stéphane Guillou made 17 changes in 1 month, and 247 changes in 1 year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Heiko Tietze made 7 changes in 1 month, and 77 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 71 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Bogdan B made 4 changes in 1 month, and 13 changes in 1 year
  Ilmari Lauhakangas made 4 changes in 1 month, and 69 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 40(40) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  7(4) 13(3) 18(4)   25(3)
 commented 92(63)   226(67)   553(41)1757(47)
   removed  0(0)  1(-2) 5(0)   10(-1)
  resolved  6(1) 27(-1)80(1)  293(3)
+ top 10 contributors:
  Heiko Tietze made 109 changes in 1 month, and 965 changes in 1 year
  Stéphane Guillou made 97 changes in 1 month, and 671 changes in 1 year
  Vernon, Stuart Foote made 57 changes in 1 month, and 327 changes in 1 
year
  Eyal Rozenberg made 53 changes in 1 month, and 166 changes in 1 year
  Dieter made 26 changes in 1 month, and 127 changes in 1 year
  Ady made 11 changes in 1 month, and 120 changes in 1 year
  m.a.riosv made 11 changes in 1 month, and 48 changes in 1 year
  Henschel, Regina made 11 changes in 1 month, and 38 changes in 1 year
  Jérôme made 10 changes in 1 month, and 14 changes in 1 year
  Rafael Lima made 10 changes in 1 month, and 59 changes in 1 year

* Vertical tabpages state (Samuel)
  + review the state this week

* Crash Testing (Caolan)
+ 24(+1) import failure, 20(+2) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.1.177(+0)
+ 24.2.1.215782(+611)
+ 24.2.2.212792(+1102)
+ 24.2.3.25213(+2237)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months 12 months
  open  94(38) 183(37) 183(36)   183(36)
   reviews 300(-62)   1310(-12)   3386(-152)   12504(18)
merged 217(-37)   1245(-59)   3239(-146)   12693(-25)
 abandoned   7(-3)  48(-5) 162(-13)  659(0)
   own commits 160(-17)899(-47)   2328(-72) 9268(-5)
review commits  52(-20)229(-4) 795(-25) 3008(3)
contributor...   1 week 1 month 3 months 12 months
  open  36(0)  100(5)  102(6)102(6)
   reviews 696(-34)   3110(-22)   7580(-246)   29560(10)
merged  16(-9)  82(-8) 347(-19) 1575(-14)
 abandoned   8(1)   27(-1) 140(-140) 710(6)
   own commits  17(-18)101(-6) 397(-16) 1141(4)
review commits   0(0)0(0)0(0)  0(0)
+ easyHack statistics:
   needsDevEval 9(9)   needsUXEval 1(1)   cleanup_comments 328(328)
   total 410(410)   assigned 28(28)   open 348(348)
+ top 10 contributors:
  Dione Maddern made 21 patches in 1 month, and 55 patches in 1 year
  Weblate made 5 patches in 1 month, and 27 patches in 1 year
  Jakub Kościelak made 4 patches in 1 month, and 7 patches in 1 year
  LeSasse made 4 patches in 1 month, and 23 patches in 1 year
made 3 patches in 1 month, and 8 patches in 1 year
  Hubert Figuière made 3 patches in 1 month, and 8 patches in 1 year
 

core.git: Branch 'distro/collabora/co-24.04' - writerfilter/qa writerfilter/source

2024-05-29 Thread Miklos Vajna (via logerrit)
 writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx|   22 
++
 writerfilter/qa/cppunittests/dmapper/data/endnote-at-section-end.docx |binary
 writerfilter/source/dmapper/PropertyMap.cxx   |7 
++-
 writerfilter/source/dmapper/SettingsTable.cxx |   13 
+
 writerfilter/source/dmapper/SettingsTable.hxx |2 
 5 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 812d5e98dc2a96e9b7351d19ab33031af7d90221
Author: Miklos Vajna 
AuthorDate: Tue May 28 13:26:05 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed May 29 09:16:13 2024 +0200

tdf#160984 sw continuous endnotes: DOCX: import  pos == sectEnd

Word can have per-section endnotes, but if endnotes are collected at the
end of the section vs document end is a per-document setting.

The DOC import already handles this in wwSectionManager::InsertSection()
when it constructs an SwFormatEndAtTextEnd with FTNEND_ATTXTEND.

Fix the problem by doing the same in writerfilter: in case settings.xml
wants at-section-end endnotes, set EndnoteIsCollectAtTextEnd to true
when applying section properties.

The export side still needs doing.

(cherry picked from commit 2d2dd56e0b2dc708f1f758d7fc9a1263ff09b83c)

Conflicts:
writerfilter/source/dmapper/PropertyMap.cxx

Change-Id: Ibad9c2d62a2945ee42877c849482feee60a50178
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168179
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx 
b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
index 52814727f91c..bf7a4e48de49 100644
--- a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -87,6 +88,27 @@ CPPUNIT_TEST_FIXTURE(Test, testAddVerticalFrameOffsetsRTF)
 // i.e. table top should be ~2748, but was less, leading to an overlap.
 CPPUNIT_ASSERT_GREATER(nFlyBottom, nTableTop);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnoteAtSectionEnd)
+{
+// Given a document with at-section-end endnotes enabled:
+loadFromFile(u"endnote-at-section-end.docx");
+
+// Go to the second paragraph, which is inside Word's second section:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+xParaEnum->nextElement();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+uno::Reference xSection;
+xPara->getPropertyValue("TextSection") >>= xSection;
+bool bEndnoteIsCollectAtTextEnd = false;
+xSection->getPropertyValue("EndnoteIsCollectAtTextEnd") >>= 
bEndnoteIsCollectAtTextEnd;
+// Without the accompanying fix in place, this test would have failed, 
endnotes were always at
+// document end.
+CPPUNIT_ASSERT(bEndnoteIsCollectAtTextEnd);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 
a/writerfilter/qa/cppunittests/dmapper/data/endnote-at-section-end.docx 
b/writerfilter/qa/cppunittests/dmapper/data/endnote-at-section-end.docx
new file mode 100644
index ..cf61262c7d59
Binary files /dev/null and 
b/writerfilter/qa/cppunittests/dmapper/data/endnote-at-section-end.docx differ
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 73d53a7e7c96..14299eaf7a88 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -749,7 +749,7 @@ void SectionPropertyMap::DontBalanceTextColumns()
 }
 }
 
-void SectionPropertyMap::ApplySectionProperties( const uno::Reference< 
beans::XPropertySet >& xSection, DomainMapper_Impl& /*rDM_Impl*/ )
+void SectionPropertyMap::ApplySectionProperties( const uno::Reference< 
beans::XPropertySet >& xSection, DomainMapper_Impl& rDM_Impl )
 {
 try
 {
@@ -758,6 +758,11 @@ void SectionPropertyMap::ApplySectionProperties( const 
uno::Reference< beans::XP
 std::optional< PropertyMap::Property > pProp = getProperty( 
PROP_WRITING_MODE );
 if ( pProp )
 xSection->setPropertyValue( "WritingMode", pProp->second );
+
+if (rDM_Impl.GetSettingsTable()->GetEndnoteIsCollectAtSectionEnd())
+{
+xSection->setPropertyValue("EndnoteIsCollectAtTextEnd", 
uno::Any(true));
+}
 }
 }
 catch ( uno::Exception& )
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilt

core.git: sw/qa sw/source

2024-05-28 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/SettingsTable.cxx|   22 
 sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx |binary
 sw/source/writerfilter/dmapper/PropertyMap.cxx  |9 
 sw/source/writerfilter/dmapper/SettingsTable.cxx|   13 +++
 sw/source/writerfilter/dmapper/SettingsTable.hxx|2 +
 5 files changed, 45 insertions(+), 1 deletion(-)

New commits:
commit 2d2dd56e0b2dc708f1f758d7fc9a1263ff09b83c
Author: Miklos Vajna 
AuthorDate: Tue May 28 13:26:05 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 28 17:13:08 2024 +0200

tdf#160984 sw continuous endnotes: DOCX: import  pos == sectEnd

Word can have per-section endnotes, but if endnotes are collected at the
end of the section vs document end is a per-document setting.

The DOC import already handles this in wwSectionManager::InsertSection()
when it constructs an SwFormatEndAtTextEnd with FTNEND_ATTXTEND.

Fix the problem by doing the same in writerfilter: in case settings.xml
wants at-section-end endnotes, set EndnoteIsCollectAtTextEnd to true
when applying section properties.

The export side still needs doing.

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

diff --git a/sw/qa/writerfilter/dmapper/SettingsTable.cxx 
b/sw/qa/writerfilter/dmapper/SettingsTable.cxx
index 503b28d45c95..ef94a60fc544 100644
--- a/sw/qa/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/qa/writerfilter/dmapper/SettingsTable.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -87,6 +88,27 @@ CPPUNIT_TEST_FIXTURE(Test, testAddVerticalFrameOffsetsRTF)
 // i.e. table top should be ~2748, but was less, leading to an overlap.
 CPPUNIT_ASSERT_GREATER(nFlyBottom, nTableTop);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnoteAtSectionEnd)
+{
+// Given a document with at-section-end endnotes enabled:
+loadFromFile(u"endnote-at-section-end.docx");
+
+// Go to the second paragraph, which is inside Word's second section:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+xParaEnum->nextElement();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+uno::Reference xSection;
+xPara->getPropertyValue("TextSection") >>= xSection;
+bool bEndnoteIsCollectAtTextEnd = false;
+xSection->getPropertyValue("EndnoteIsCollectAtTextEnd") >>= 
bEndnoteIsCollectAtTextEnd;
+// Without the accompanying fix in place, this test would have failed, 
endnotes were always at
+// document end.
+CPPUNIT_ASSERT(bEndnoteIsCollectAtTextEnd);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx 
b/sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx
new file mode 100644
index ..cf61262c7d59
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx differ
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index f52d37764402..02951c73cbcd 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -74,6 +74,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace com::sun::star;
 
 namespace writerfilter::dmapper {
@@ -756,7 +758,7 @@ void SectionPropertyMap::DontBalanceTextColumns()
 }
 }
 
-void SectionPropertyMap::ApplySectionProperties( const uno::Reference< 
beans::XPropertySet >& xSection, DomainMapper_Impl& /*rDM_Impl*/ )
+void SectionPropertyMap::ApplySectionProperties( const uno::Reference< 
beans::XPropertySet >& xSection, DomainMapper_Impl& rDM_Impl )
 {
 try
 {
@@ -765,6 +767,11 @@ void SectionPropertyMap::ApplySectionProperties( const 
uno::Reference< beans::XP
 std::optional< PropertyMap::Property > pProp = getProperty( 
PROP_WRITING_MODE );
 if ( pProp )
 xSection->setPropertyValue( "WritingMode", pProp->second );
+
+if (rDM_Impl.GetSettingsTable()->GetEndnoteIsCollectAtSectionEnd())
+{
+
xSection->setPropertyValue(UNO_NAME_ENDNOTE_IS_COLLECT_AT_TEXT_END, 
uno::Any(true));
+}
 }
 }
 catch ( uno::Exception& )
diff --git a/sw/source/writerfilter/dmapper/SettingsTable.cxx 
b/sw/source/writerfilter/dmapper/SettingsTable.cxx
index 4d6fe6b13441..57f6566c2135 100644
--- a/sw/source/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/source/write

core.git: sw/inc sw/source

2024-05-28 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtftntx.hxx  |1 +
 sw/source/core/layout/atrfrm.cxx |8 
 2 files changed, 9 insertions(+)

New commits:
commit f4ec4f6068a1ca265dd25c479cc40c546ae9223e
Author: Miklos Vajna 
AuthorDate: Tue May 28 09:51:56 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 28 15:11:34 2024 +0200

sw doc model xml dump: show SwFormatEndAtTextEnd

Decides if endnotes are collected at section end or the normal doc end.
Previously only the pool item name was visible, not the value.

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

diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx
index a5de432ccad7..16e63657abf7 100644
--- a/sw/inc/fmtftntx.hxx
+++ b/sw/inc/fmtftntx.hxx
@@ -110,6 +110,7 @@ public:
 }
 
 virtual SwFormatEndAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) const 
override;
+void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 inline const SwFormatFootnoteAtTextEnd ::GetFootnoteAtTextEnd(bool 
bInP) const
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 67047d7b0bf9..0dee2d60520f 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1993,6 +1993,14 @@ SwFormatEditInReadonly* SwFormatEditInReadonly::Clone( 
SfxItemPool* ) const
 return new SwFormatEditInReadonly( *this );
 }
 
+void SwFormatEndAtTextEnd::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatEndAtTextEnd"));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), 
BAD_CAST(OString::number(Which()).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), 
BAD_CAST(OString::number(GetValue()).getStr()));
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 SwFormatLayoutSplit* SwFormatLayoutSplit::Clone( SfxItemPool* ) const
 {
 return new SwFormatLayoutSplit( *this );


core.git: sw/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 sw/source/core/txtnode/thints.cxx  |4 ++--
 sw/source/core/unocore/unoportenum.cxx |2 +-
 sw/source/core/unocore/unotext.cxx |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 350a2dfa74bbc9d82f6555c0f3d679b6c53fe353
Author: Miklos Vajna 
AuthorDate: Mon May 27 11:05:37 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 28 00:21:50 2024 +0200

sw: rename SwIndexes to SwContentIndexes in comments

Leftover from commit 9fdb06d65a8f2c3401392bffee9c4639e178aada (rename
SwIndex->SwContentIndex, 2022-07-25).

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

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 5da054405ef5..729a5443b03b 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1421,7 +1421,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 assert(CH_TXTATR_BREAKWORD == 
m_Text[pAttr->GetStart()]
 || CH_TXTATR_INWORD == 
m_Text[pAttr->GetStart()]);
 m_Text = m_Text.replaceAt(pAttr->GetStart(), 1, 
u"");
-// Update SwIndexes
+// Update SwContentIndexes
 SwContentIndex aTmpIdx( this, pAttr->GetStart() );
 Update(aTmpIdx, 1, UpdateMode::Negative);
 }
@@ -1461,7 +1461,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 assert(CH_TXTATR_BREAKWORD == m_Text[pAttr->GetStart()]
 || CH_TXTATR_INWORD == m_Text[pAttr->GetStart()]);
 m_Text = m_Text.replaceAt(pAttr->GetStart(), 1, u"");
-// Update SwIndexes
+// Update SwContentIndexes
 SwContentIndex aTmpIdx( this, pAttr->GetStart() );
 Update(aTmpIdx, 1, UpdateMode::Negative);
 }
diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 58657677429c..d975f3c20960 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -200,7 +200,7 @@ namespace
 
 SwTextNode* pTextNode = rUnoCursor.GetPoint()->GetNode().GetTextNode();
 assert(pTextNode);
-// A text node already knows its marks via its SwIndexes.
+// A text node already knows its marks via its SwContentIndexes.
 o3tl::sorted_vector aSeenMarks;
 for (const SwContentIndex* pIndex = pTextNode->GetFirstIndex(); 
pIndex; pIndex = pIndex->GetNext())
 {
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 39b2016335ba..fd2811f05743 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1664,7 +1664,7 @@ SwXText::convertToTextFrame(
 xNewFrame->SwXFrame::setPropertyValue(rValue.Name, rValue.Value);
 }
 
-{   // has to be in a block to remove the SwIndexes before
+{   // has to be in a block to remove the SwContentIndexes before
 // DelFullPara is called
 const uno::Reference< text::XTextRange> xInsertTextRange =
 new SwXTextRange(*pStartPam, this);
@@ -1677,7 +1677,7 @@ SwXText::convertToTextFrame(
 assert(pTextNode);
 if (!pTextNode || !pTextNode->Len()) // don't remove if it contains 
text!
 {
-{   // has to be in a block to remove the SwIndexes before
+{   // has to be in a block to remove the SwContentIndexes before
 // DelFullPara is called
 SwPaM aMovePam( pStartPam->GetPointNode() );
 if (aMovePam.Move( fnMoveForward, GoInContent ))


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-section-delete.docx |binary
 sw/qa/core/layout/ftnfrm.cxx  |   31 ++
 sw/source/core/layout/ftnfrm.cxx  |4 +
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit ba0f1432e2162d32103e20d2030cf79b3dd4e2f7
Author: Miklos Vajna 
AuthorDate: Mon May 27 09:41:18 2024 +0200
Commit: Caolán McNamara 
CommitDate: Mon May 27 14:31:05 2024 +0200

tdf#160984 sw continuous endnotes: fix crash on loading 
forum-mso-en-7731.docx

Regression from commit 1ae5ea3f78cca11ba18f2dd1a06f875263336a3b
(tdf#160984 sw continuous endnotes: enable DOCX import, 2024-05-21), the
bugdoc crashed in SwSectionFrame::GetEndSectFormat_().

What seems to happen is that the first endnote is added to page 1, then
more content is inserted, so the endnote is moved to page 2, which
leaves an empty endnote section on page 1, which is marked for deletion
in SwSectionFrame::MakeAll(), and will be deleted in
SwRootFrame::DeleteEmptySct_(). At some point (after marking for
deletion, before deletion) SwFootnoteBossFrame::AppendFootnote() tries
to find the first endnote section in the layout, and finds this section,
but it crashes because there is no SwSection attached to it, as marking
for deletion in SwSectionFrame::DelEmpty() clears that.

Fix the problem by ignoring to-be-deleted sections in
SwFootnoteBossFrame::AppendFootnote(): this way a new, usable section
will be created and the to-be-deleted section go away as the layout
finishes.

An alternative would be to check for SwSectionFrame::GetSection()
earlier, as we iterate on pages (hoping that this way we find a later
page that has a not-dead endnote section), but that leads to 6 pages
instead of 4 pages for the bugdoc, so don't go that way.

(cherry picked from commit 3f2d0414686a8f9a042413c47c4c8ffa5d61f436)

Change-Id: I9a21cbccb5a088314520c7ade55dbdf9966d1265
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168099
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/layout/data/inline-endnote-section-delete.docx 
b/sw/qa/core/layout/data/inline-endnote-section-delete.docx
new file mode 100644
index ..bf3d3e60d890
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-section-delete.docx differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index a7640e26ca9a..98387be6a983 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -17,6 +17,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /// Covers sw/source/core/layout/ftnfrm.cxx fixes.
 class Test : public SwModelTestBase
@@ -122,4 +124,33 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnotePosition)
 CPPUNIT_ASSERT_EQUAL(static_cast(269), nEndnoteContTopMargin);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteSectionDelete)
+{
+// Given a document, ContinuousEndnotes is true, 3 pages, endnodes start 
on page 2:
+// When laying out that document:
+createSwDoc("inline-endnote-section-delete.docx");
+
+// First page: just body text:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+auto pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(!pBodyFrame->GetLastLower()->IsSctFrame());
+// Second page: ends with endnotes:
+pPage = pPage->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(pBodyFrame->GetLastLower()->IsSctFrame());
+auto pSection = static_cast(pBodyFrame->GetLastLower());
+CPPUNIT_ASSERT(pSection->IsEndNoteSection());
+// Third page: just endnotes:
+pPage = pPage->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(pBodyFrame->GetLower()->IsSctFrame());
+pSection = static_cast(pBodyFrame->GetLower());
+CPPUNIT_ASSERT(pSection->IsEndNoteSection());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 46312f9f4e89..1c6b221cf511 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1601,7 +1601,9 @@ void SwFootnoteBossFrame::AppendFootnote( SwContentFrame 
*pRef, SwTextFootnote *
 pEndnoteSection = pPage->GetEndNoteSection();
 }
 // If there are no endnotes sections yet, create one at the end of 
the document.
-if (!pEndnoteSection)
+

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/paintfrm.cxx |   10 ++
 sw/source/core/layout/paintfrm.cxx |9 -
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 69bbd6378ed7a7b7765948d5ec08673866947d5d
Author: Miklos Vajna 
AuthorDate: Fri May 24 10:51:31 2024 +0200
Commit: Caolán McNamara 
CommitDate: Mon May 27 14:30:44 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote separator length

See
<https://bug-attachments.documentfoundation.org/attachment.cgi?id=194324>,
Word has a longer separator line for the foot/endnote than Writer for
this bugdoc.

Writer defaults to 25% of the body frame width in the SwPageFootnoteInfo
ctor, and we don't seem to change that in the DOCX import. Word has a
static 2 inches setting, which is only reduced if it would go outside
the body frame.

Fix the problem by extending SwFootnoteContFrame::PaintLine() in the
DocumentSettingId::CONTINUOUS_ENDNOTES case to do the same.

I searched the OOXML spec and the MS implementer notes, they don't
specify this 2 inches length, but it seems static: the value doesn't
change with the page size. With this, the single-section bugdoc is now
rendered fine.

(cherry picked from commit 755f3bebd96ec7ae43b1dcf247f907b9c15c1995)

Change-Id: I3bb23680937580179b8d37c940ea14e0f80fc7f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168088
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index 8e7154db2501..a5213c57d639 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -177,6 +177,16 @@ CPPUNIT_TEST_FIXTURE(Test, 
testInlineEndnoteSeparatorPosition)
 // - Actual  : 2060
 // i.e. the upper spacing was too low.
 CPPUNIT_ASSERT_EQUAL(static_cast(2164), nEndnoteSeparatorY);
+
+// Also make sure the separator length is correct:
+auto nEndnoteSeparatorStart = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"x"_ostr).toInt32();
+auto nEndnoteSeparatorEnd = getXPath(pXmlDoc, "//polygon/point[2]"_ostr, 
"x"_ostr).toInt32();
+sal_Int32 nEndnoteSeparatorLength = nEndnoteSeparatorEnd - 
nEndnoteSeparatorStart;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2880
+// - Actual  : 2340
+// i.e. the separator wasn't 2 inches long, but was shorter vs Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(2880), 
nEndnoteSeparatorLength);
 }
 }
 
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index b45226bbbcb6..89ea71f9acb7 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5777,7 +5777,7 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
 SwTwips nPrtWidth = aRectFnSet.GetWidth(getFramePrintArea());
 Fraction aFract( nPrtWidth, 1 );
 aFract *= rInf.GetWidth();
-const SwTwips nWidth = static_cast(aFract);
+SwTwips nWidth = static_cast(aFract);
 
 SwTwips nX = aRectFnSet.GetPrtLeft(*this);
 switch ( rInf.GetAdj() )
@@ -5808,6 +5808,13 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
 // Word style: instead of fixed value, upper spacing is 60% of all 
space.
 auto nPrintAreaTop = 
static_cast(getFramePrintArea().Top());
 aPoint.setY(getFrameArea().Pos().Y() + nPrintAreaTop * 0.6);
+
+// Length is 2 inches, but don't paint outside the container frame.
+nWidth = o3tl::convert(2, o3tl::Length::in, o3tl::Length::twip);
+if (nWidth > nPrtWidth)
+{
+nWidth = nPrtWidth;
+}
 }
 oLineRect.emplace(aPoint, Size(nWidth, rInf.GetLineWidth()));
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/paintfrm.cxx |   20 
 sw/source/core/layout/paintfrm.cxx |   27 ---
 2 files changed, 40 insertions(+), 7 deletions(-)

New commits:
commit 461447cfdca85298435b0e029b1c1418789618ad
Author: Miklos Vajna 
AuthorDate: Thu May 23 15:31:05 2024 +0200
Commit: Caolán McNamara 
CommitDate: Mon May 27 14:30:26 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote separator position

See <https://bugs.documentfoundation.org/attachment.cgi?id=194306>, the
total height of the endnote separator is now correct, but the
distribution of upper space, line width, lower space is still bad, when
compared to Word.

Our model is 2 spacings and a line width, while Word seems to simply
split the amount of available space: 60% goes above the separator and
the rest goes below.

Fix the problem by breaking up the monster expression for the separator
rectangle in SwFootnoteContFrame::PaintLine(), and then the compat +
horizontal case can do the 60% spacing in the Word compat mode.

The width of the separator is still not correct.

(cherry picked from commit f1d0b4e34a1f467e9f54baa7ac31ca28fdae3efb)

Change-Id: Ic065c138041892225b3c1b7d4bd64d4f1c625611
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168007
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index b5990648b20f..8e7154db2501 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -158,6 +158,26 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder)
 // bottom border.
 CPPUNIT_ASSERT_EQUAL(static_cast(2), aHorizontalBorderEnds.size());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteSeparatorPosition)
+{
+// Given a document with a Word-style endnote separator:
+createSwDoc("inline-endnote-position.docx");
+SwDocShell* pDocShell = getSwDocShell();
+
+// When rendering that document:
+std::shared_ptr xMetaFile = pDocShell->GetPreviewMetaFile();
+
+// Then make sure the separator upper spacing is 60% of all space, 
matching Word:
+MetafileXmlDump aDumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+auto nEndnoteSeparatorY = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"y"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2164
+// - Actual  : 2060
+// i.e. the upper spacing was too low.
+CPPUNIT_ASSERT_EQUAL(static_cast(2164), nEndnoteSeparatorY);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index ff5abcfcf898..b45226bbbcb6 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5793,13 +5793,26 @@ void SwFootnoteContFrame::PaintLine( const SwRect& 
rRect,
 assert(false);
 }
 SwTwips nLineWidth = rInf.GetLineWidth();
-const SwRect aLineRect = aRectFnSet.IsVert() ?
-SwRect( 
Point(getFrameArea().Left()+getFrameArea().Width()-rInf.GetTopDist()-nLineWidth,
-  nX), Size( nLineWidth, nWidth ) )
-: SwRect( Point( nX, getFrameArea().Pos().Y() + rInf.GetTopDist() 
),
-Size( nWidth, rInf.GetLineWidth()));
-if ( aLineRect.HasArea() && rInf.GetLineStyle() != 
SvxBorderLineStyle::NONE)
-PaintBorderLine( rRect, aLineRect , pPage, (),
+std::optional oLineRect;
+if (aRectFnSet.IsVert())
+{
+
oLineRect.emplace(Point(getFrameArea().Left()+getFrameArea().Width()-rInf.GetTopDist()-nLineWidth,
+  nX), Size( nLineWidth, nWidth ) );
+}
+else
+{
+Point aPoint(nX, getFrameArea().Pos().Y() + rInf.GetTopDist());
+const IDocumentSettingAccess& rIDSA = 
GetFormat()->getIDocumentSettingAccess();
+if (rIDSA.get(DocumentSettingId::CONTINUOUS_ENDNOTES))
+{
+// Word style: instead of fixed value, upper spacing is 60% of all 
space.
+auto nPrintAreaTop = 
static_cast(getFramePrintArea().Top());
+aPoint.setY(getFrameArea().Pos().Y() + nPrintAreaTop * 0.6);
+}
+oLineRect.emplace(aPoint, Size(nWidth, rInf.GetLineWidth()));
+}
+if ( oLineRect->HasArea() && rInf.GetLineStyle() != 
SvxBorderLineStyle::NONE)
+PaintBorderLine( rRect, *oLineRect , pPage, (),
 rInf.GetLineStyle() );
 }
 


core.git: sw/qa sw/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-section-delete.docx |binary
 sw/qa/core/layout/ftnfrm.cxx  |   31 ++
 sw/source/core/layout/ftnfrm.cxx  |4 +
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 3f2d0414686a8f9a042413c47c4c8ffa5d61f436
Author: Miklos Vajna 
AuthorDate: Mon May 27 09:41:18 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 27 11:27:34 2024 +0200

tdf#160984 sw continuous endnotes: fix crash on loading 
forum-mso-en-7731.docx

Regression from commit 1ae5ea3f78cca11ba18f2dd1a06f875263336a3b
(tdf#160984 sw continuous endnotes: enable DOCX import, 2024-05-21), the
bugdoc crashed in SwSectionFrame::GetEndSectFormat_().

What seems to happen is that the first endnote is added to page 1, then
more content is inserted, so the endnote is moved to page 2, which
leaves an empty endnote section on page 1, which is marked for deletion
in SwSectionFrame::MakeAll(), and will be deleted in
SwRootFrame::DeleteEmptySct_(). At some point (after marking for
deletion, before deletion) SwFootnoteBossFrame::AppendFootnote() tries
to find the first endnote section in the layout, and finds this section,
but it crashes because there is no SwSection attached to it, as marking
for deletion in SwSectionFrame::DelEmpty() clears that.

Fix the problem by ignoring to-be-deleted sections in
SwFootnoteBossFrame::AppendFootnote(): this way a new, usable section
will be created and the to-be-deleted section go away as the layout
finishes.

An alternative would be to check for SwSectionFrame::GetSection()
earlier, as we iterate on pages (hoping that this way we find a later
page that has a not-dead endnote section), but that leads to 6 pages
instead of 4 pages for the bugdoc, so don't go that way.

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

diff --git a/sw/qa/core/layout/data/inline-endnote-section-delete.docx 
b/sw/qa/core/layout/data/inline-endnote-section-delete.docx
new file mode 100644
index ..bf3d3e60d890
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-section-delete.docx differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index a7640e26ca9a..98387be6a983 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -17,6 +17,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /// Covers sw/source/core/layout/ftnfrm.cxx fixes.
 class Test : public SwModelTestBase
@@ -122,4 +124,33 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnotePosition)
 CPPUNIT_ASSERT_EQUAL(static_cast(269), nEndnoteContTopMargin);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteSectionDelete)
+{
+// Given a document, ContinuousEndnotes is true, 3 pages, endnodes start 
on page 2:
+// When laying out that document:
+createSwDoc("inline-endnote-section-delete.docx");
+
+// First page: just body text:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+auto pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(!pBodyFrame->GetLastLower()->IsSctFrame());
+// Second page: ends with endnotes:
+pPage = pPage->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(pBodyFrame->GetLastLower()->IsSctFrame());
+auto pSection = static_cast(pBodyFrame->GetLastLower());
+CPPUNIT_ASSERT(pSection->IsEndNoteSection());
+// Third page: just endnotes:
+pPage = pPage->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(pBodyFrame->GetLower()->IsSctFrame());
+pSection = static_cast(pBodyFrame->GetLower());
+CPPUNIT_ASSERT(pSection->IsEndNoteSection());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 548d8228063e..bb35d1c1025c 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1626,7 +1626,9 @@ void SwFootnoteBossFrame::AppendFootnote( SwContentFrame 
*pRef, SwTextFootnote *
 pEndnoteSection = pPage->GetEndNoteSection();
 }
 // If there are no endnotes sections yet, create one at the end of 
the document.
-if (!pEndnoteSection)
+// Ignore sections which are already marked for deletion, they 
don't have an SwSection
+

core.git: include/svx svx/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 include/svx/fmview.hxx |   10 ++--
 svx/source/form/fmview.cxx |  106 ++---
 2 files changed, 58 insertions(+), 58 deletions(-)

New commits:
commit 2ef33247b7a3c07dde18d3cd6fd989fcb8ea4ddc
Author: Miklos Vajna 
AuthorDate: Mon May 27 08:11:33 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 27 10:45:40 2024 +0200

svx: prefix members of FmFormView

See tdf#94879 for motivation.

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

diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx
index a1a08de5e56b..e601047eff00 100644
--- a/include/svx/fmview.hxx
+++ b/include/svx/fmview.hxx
@@ -53,8 +53,8 @@ namespace com::sun::star::form {
 
 class SVXCORE_DLLPUBLIC FmFormView : public E3dView
 {
-rtl::Reference pImpl;
-FmFormShell*pFormShell;
+rtl::Reference m_pImpl;
+FmFormShell*m_pFormShell;
 
 void Init();
 
@@ -128,11 +128,11 @@ public:
 
 SVX_DLLPRIVATE void ChangeDesignMode(bool bDesign);
 
-SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl.get(); }
-SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
+SVX_DLLPRIVATE FmXFormView* GetImpl() const { return m_pImpl.get(); }
+SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return m_pFormShell; }
 
 struct FormShellAccess { friend class FmFormShell; private: 
FormShellAccess() { } };
- void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = 
pShell; }
+ void SetFormShell( FmFormShell* pShell, FormShellAccess ) { m_pFormShell 
= pShell; }
 
 struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
 void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { 
E3dView::SetMoveOutside( _bMoveOutside ); }
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 2a07073d66b9..a26895653833 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -72,8 +72,8 @@ FmFormView::FmFormView(
 
 void FmFormView::Init()
 {
-pFormShell = nullptr;
-pImpl = new FmXFormView(this);
+m_pFormShell = nullptr;
+m_pImpl = new FmXFormView(this);
 
 // set model
 SdrModel* pModel = ();
@@ -114,10 +114,10 @@ void FmFormView::Init()
 
 FmFormView::~FmFormView()
 {
-if (pFormShell)
-suppress_fun_call_w_exception(pFormShell->SetView(nullptr));
+if (m_pFormShell)
+suppress_fun_call_w_exception(m_pFormShell->SetView(nullptr));
 
-pImpl->notifyViewDying();
+m_pImpl->notifyViewDying();
 }
 
 FmFormPage* FmFormView::GetCurPage()
@@ -131,23 +131,23 @@ void FmFormView::MarkListHasChanged()
 {
 E3dView::MarkListHasChanged();
 
-if ( !(pFormShell && IsDesignMode()) )
+if ( !(m_pFormShell && IsDesignMode()) )
 return;
 
 FmFormObj* pObj = getMarkedGrid();
-if ( pImpl->m_pMarkedGrid && pImpl->m_pMarkedGrid != pObj )
+if ( m_pImpl->m_pMarkedGrid && m_pImpl->m_pMarkedGrid != pObj )
 {
-pImpl->m_pMarkedGrid = nullptr;
-if ( pImpl->m_xWindow.is() )
+m_pImpl->m_pMarkedGrid = nullptr;
+if ( m_pImpl->m_xWindow.is() )
 {
-pImpl->m_xWindow->removeFocusListener(pImpl);
-pImpl->m_xWindow = nullptr;
+m_pImpl->m_xWindow->removeFocusListener(m_pImpl);
+m_pImpl->m_xWindow = nullptr;
 }
 SetMoveOutside(false);
 //OLMRefreshAllIAOManagers();
 }
 
-pFormShell->GetImpl()->SetSelectionDelayed_Lock();
+m_pFormShell->GetImpl()->SetSelectionDelayed_Lock();
 }
 
 namespace
@@ -179,7 +179,7 @@ void FmFormView::AddDeviceToPaintView(OutputDevice& 
rNewDev, vcl::Window* pWindo
 // #i39269# / 2004-12-20 / frank.schoenh...@sun.com
 const SdrPageWindow* pPageWindow = findPageWindow( this,  );
 if ( pPageWindow )
-pImpl->addWindow( *pPageWindow );
+m_pImpl->addWindow( *pPageWindow );
 }
 
 
@@ -187,7 +187,7 @@ void FmFormView::DeleteDeviceFromPaintView(OutputDevice& 
rNewDev)
 {
 const SdrPageWindow* pPageWindow = findPageWindow( this,  );
 if ( pPageWindow )
-pImpl->removeWindow( pPageWindow->GetControlContainer() );
+m_pImpl->removeWindow( pPageWindow->GetControlContainer() );
 
 E3dView::DeleteDeviceFromPaintView(rNewDev);
 }
@@ -211,10 +211,10 @@ void FmFormView::ChangeDesignMode(bool bDesign)
 DeactivateControls( GetSdrPageView() );
 
 // --- 2. simulate a deactivation (the shell will handle some things there 
...?)
-if ( pFormShell && pFormShell->GetImpl() )
-pFormShell->GetImpl()->viewDeactivated_Lock(*this);
+if ( m_pFormShell && m_pFormShell->GetImpl() )
+m_pFormShell->GetImpl()->viewDeactivated

core.git: sw/CppunitTest_sw_writerfilter_dmapper.mk sw/CppunitTest_sw_writerfilter_filter.mk sw/CppunitTest_sw_writerfilter_filters_test.mk sw/CppunitTest_sw_writerfilter_misc.mk sw/CppunitTest_sw_wri

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_writerfilter_dmapper.mk   |   22 
 sw/CppunitTest_sw_writerfilter_filter.mk|2 -
 sw/CppunitTest_sw_writerfilter_filters_test.mk  |2 -
 sw/CppunitTest_sw_writerfilter_misc.mk  |2 -
 sw/CppunitTest_sw_writerfilter_ooxml.mk |2 -
 sw/CppunitTest_sw_writerfilter_rtftok.mk|   14 +-
 sw/qa/writerfilter/dmapper/CellColorHandler.cxx |2 -
 sw/qa/writerfilter/dmapper/DomainMapper.cxx |2 -
 sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx |2 -
 sw/qa/writerfilter/dmapper/DomainMapperTableManager.cxx |2 -
 sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx|2 -
 sw/qa/writerfilter/dmapper/GraphicImport.cxx|2 -
 sw/qa/writerfilter/dmapper/PropertyMap.cxx  |2 -
 sw/qa/writerfilter/dmapper/SdtHelper.cxx|2 -
 sw/qa/writerfilter/dmapper/SettingsTable.cxx|2 -
 sw/qa/writerfilter/dmapper/TableManager.cxx |2 -
 sw/qa/writerfilter/dmapper/TextEffectsHandler.cxx   |2 -
 sw/qa/writerfilter/filter/WriterFilter.cxx  |2 -
 sw/qa/writerfilter/filters-test/filters-test.cxx|3 --
 sw/qa/writerfilter/ooxml/ooxml.cxx  |2 -
 sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx   |2 -
 sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx |2 -
 sw/qa/writerfilter/rtftok/rtfdispatchvalue.cxx  |2 -
 sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx   |2 -
 sw/qa/writerfilter/rtftok/rtfsdrimport.cxx  |2 -
 sw/qa/writerfilter/rtftok/rtfsprm.cxx   |2 -
 sw/qa/writerfilter/rtftok/rtftokenizer.cxx  |2 -
 27 files changed, 43 insertions(+), 44 deletions(-)

New commits:
commit 8112883acf0015066f21dece7e1109dbda3e4cae
Author: Miklos Vajna 
AuthorDate: Fri May 24 16:07:55 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 17:34:09 2024 +0200

sw qa: rename writerfilter/cppunittests to just writerfilter

15:47  noelgrandin: any objections to go further with your 
writerfilter rename and turn sw/qa/writerfilter/cppunittests/* into 
sw/qa/writerfilter/* ? (suggest to either do it now or not at all if we're past 
the libreoffice-24-8 branch-off)
15:59  vmiklos, not at all, go for it

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

diff --git a/sw/CppunitTest_sw_writerfilter_dmapper.mk 
b/sw/CppunitTest_sw_writerfilter_dmapper.mk
index ecae5cf7db7e..d865706c2b50 100644
--- a/sw/CppunitTest_sw_writerfilter_dmapper.mk
+++ b/sw/CppunitTest_sw_writerfilter_dmapper.mk
@@ -17,17 +17,17 @@ $(eval $(call 
gb_CppunitTest_use_externals,sw_writerfilter_dmapper,\
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_writerfilter_dmapper, \
-sw/qa/writerfilter/cppunittests/dmapper/CellColorHandler \
-sw/qa/writerfilter/cppunittests/dmapper/DomainMapperTableHandler \
-sw/qa/writerfilter/cppunittests/dmapper/DomainMapperTableManager \
-sw/qa/writerfilter/cppunittests/dmapper/DomainMapper \
-sw/qa/writerfilter/cppunittests/dmapper/DomainMapper_Impl \
-sw/qa/writerfilter/cppunittests/dmapper/GraphicImport \
-sw/qa/writerfilter/cppunittests/dmapper/TableManager \
-sw/qa/writerfilter/cppunittests/dmapper/TextEffectsHandler \
-sw/qa/writerfilter/cppunittests/dmapper/PropertyMap \
-sw/qa/writerfilter/cppunittests/dmapper/SdtHelper \
-sw/qa/writerfilter/cppunittests/dmapper/SettingsTable \
+sw/qa/writerfilter/dmapper/CellColorHandler \
+sw/qa/writerfilter/dmapper/DomainMapperTableHandler \
+sw/qa/writerfilter/dmapper/DomainMapperTableManager \
+sw/qa/writerfilter/dmapper/DomainMapper \
+sw/qa/writerfilter/dmapper/DomainMapper_Impl \
+sw/qa/writerfilter/dmapper/GraphicImport \
+sw/qa/writerfilter/dmapper/TableManager \
+sw/qa/writerfilter/dmapper/TextEffectsHandler \
+sw/qa/writerfilter/dmapper/PropertyMap \
+sw/qa/writerfilter/dmapper/SdtHelper \
+sw/qa/writerfilter/dmapper/SettingsTable \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,sw_writerfilter_dmapper, \
diff --git a/sw/CppunitTest_sw_writerfilter_filter.mk 
b/sw/CppunitTest_sw_writerfilter_filter.mk
index ad61c66f1ed4..e627d43d2180 100644
--- a/sw/CppunitTest_sw_writerfilter_filter.mk
+++ b/sw/CppunitTest_sw_writerfilter_filter.mk
@@ -17,7 +17,7 @@ $(eval $(call 
gb_CppunitTest_use_externals,sw_writerfilter_filter,\
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_writerfilter_filter, \
-sw/qa/writerfilter/cppunittests/filter/WriterFilter \
+sw/qa/writerfilter/filter/WriterFilter \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,sw_writerfilter_filter, \
diff --git a/sw/CppunitTest_sw_writerfilter_filters_test.mk 
b/sw

core.git: sw/inc sw/source

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/inc/contentindex.hxx|2 +-
 sw/source/core/txtnode/ndtxt.cxx   |2 +-
 sw/source/core/unocore/unotext.cxx |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6de49dee825c6bd093007b4c954f97812c3fdb47
Author: Miklos Vajna 
AuthorDate: Fri May 24 13:09:36 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 14:22:07 2024 +0200

sw: rename SwIndex to SwContentIndex in comments

Leftover from commit 9fdb06d65a8f2c3401392bffee9c4639e178aada (rename
SwIndex->SwContentIndex, 2022-07-25).

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

diff --git a/sw/inc/contentindex.hxx b/sw/inc/contentindex.hxx
index 873e1512ca4f..ea54b1c052a2 100644
--- a/sw/inc/contentindex.hxx
+++ b/sw/inc/contentindex.hxx
@@ -44,7 +44,7 @@ private:
 SwContentIndex * m_pNext;
 SwContentIndex * m_pPrev;
 
-/// points to the SwRangeRedline (if any) that contains this SwIndex, via 
SwPosition and SwPaM
+/// points to the SwRangeRedline (if any) that contains this 
SwContentIndex, via SwPosition and SwPaM
 SwRangeRedline * m_pRangeRedline = nullptr;
 
 /// Pointer to a mark that owns this position to allow fast lookup of 
marks of an SwContentIndexReg.
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 34619f0c7dfb..1d71a1cd8169 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1455,7 +1455,7 @@ void SwTextNode::Update(
 if (!(eMode & UpdateMode::Negative) && !(eMode & UpdateMode::Delete))
 {
 std::vector vMyRedlines;
-// walk the list of SwIndex attached to me and see if any of them are 
redlines
+// walk the list of SwContentIndex attached to me and see if any of 
them are redlines
 const SwContentIndex* pContentNodeIndex = GetFirstIndex();
 while (pContentNodeIndex)
 {
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 50d9f75db63f..39b2016335ba 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1579,7 +1579,7 @@ SwXText::convertToTextFrame(
 (pStartStartNode != GetStartNode()))
 {
 // if not - remove the additional paragraphs and throw
-oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes
+oAnchorCheckPam.reset(); // clear SwContentIndex before deleting 
nodes
 if (bParaBeforeInserted)
 {
 SwCursor aDelete(*pStartPam->GetPoint(), nullptr);
@@ -1653,7 +1653,7 @@ SwXText::convertToTextFrame(
 }
 }
 }
-oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes
+oAnchorCheckPam.reset(); // clear SwContentIndex before deleting nodes
 
 const rtl::Reference xNewFrame =
 SwXTextFrame::CreateXTextFrame(*m_pImpl->m_pDoc, nullptr);


core.git: sw/qa sw/source

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/qa/uitest/data/keep-aspect-ratio.odt |binary
 sw/qa/uitest/ui/frmdlg/frmdlg.py|   20 
 sw/source/ui/frmdlg/frmpage.cxx |6 +-
 sw/source/uibase/inc/frmpage.hxx|1 +
 4 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit a3150fc8a59662ce8630cfc64fec9cd083ac7d36
Author: Miklos Vajna 
AuthorDate: Fri May 24 12:06:55 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 13:58:07 2024 +0200

tdf#145972 sw image dialog: fix bad rel width w/ pt units and kept aspect 
ratio

Regression from commit 02c435082058ecf7f9d4d73cb47d31d0218dc10d (sw keep
aspect ratio: add filter for this setting, 2021-06-07), once UI units
are set to poins (instead of cms), the image dialog for the bugdoc was
showing 5% width instead of 48%.

48% is roughtly correct, visually the image is taking half of the body
frame width. Previously the bad rel size didn't happen because we didn't
save the "keep aspect ratio" to documents, so it was off by the time the
dialog was initialized.

Fix the problem by introducing a new flag, so we can differentiate
between the user changine the width or height vs the dialog being
initialized. RelSizeClickHdl() is meant to adjust the other axis in the
user case, and this is not wanted in the init case.

A higher level fix would be to make sure once aspect ratio is kept,
that ratio is stored in documents explicitly, so we can say 50% wide
with e.g. 4:3 ratio, that would avoid all this trouble by even looking
at the calculated sizes when we want to work with percents. This storing
of the aspect ratio is not done here.

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

diff --git a/sw/qa/uitest/data/keep-aspect-ratio.odt 
b/sw/qa/uitest/data/keep-aspect-ratio.odt
new file mode 100644
index ..2545b34e91f7
Binary files /dev/null and b/sw/qa/uitest/data/keep-aspect-ratio.odt differ
diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py
index aa2d4fba7aff..a37062c1d392 100644
--- a/sw/qa/uitest/ui/frmdlg/frmdlg.py
+++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py
@@ -150,4 +150,24 @@ class Test(UITestCase):
 # complexity.
 self.assertEqual(visible, "false")
 
+def test_keep_aspect_ratio_init(self):
+# Change from inch to pt to hit the rounding error. 6 means Point, see
+# officecfg/registry/schema/org/openoffice/Office/Writer.xcs.
+with 
self.ui_test.set_config('/org.openoffice.Office.Writer/Layout/Other/MeasureUnit',
 6):
+# Given a document with an image, width is relative:
+with 
self.ui_test.load_file(get_url_for_data_file("keep-aspect-ratio.odt")) as 
xComponent:
+xComponent.CurrentController.select(xComponent.DrawPage[0])
+# Wait until SwTextShell is replaced with SwDrawShell after 
120 ms, as set in the SwView
+# ctor.
+time.sleep(0.2)
+# When opening the image properties dialog:
+with 
self.ui_test.execute_dialog_through_command(".uno:FrameDialog") as xDialog:
+xWidth = xDialog.getChild("width")
+frame_width = get_state_as_dict(xWidth)["Value"]
+# Then make sure the width is 48%:
+# Without the accompanying fix in place, this test would have 
failed with:
+# AssertionError: '5' != '48'
+# i.e. the reported size was close to zero instead of ~half of 
the page width.
+self.assertEqual(frame_width, "48")
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 589af7dbb0a0..bd58f2ab7246 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2182,7 +2182,7 @@ IMPL_LINK( SwFramePage, ModifyHdl, 
weld::MetricSpinButton&, rEdit, void )
 {
 SwTwips nWidth  = static_cast< SwTwips 
>(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
 SwTwips nHeight = static_cast< SwTwips 
>(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
-if (m_xFixedRatioCB->get_active())
+if (m_xFixedRatioCB->get_active() && !m_bIgnoreFixedRatio)
 {
 if ( == m_xWidthED->get())
 {
@@ -2385,14 +2385,18 @@ void SwFramePage::Init(const SfxItemSet& rSet)
 !m_xRelWidthCB->get_active())
 {
 m_xRelWidthCB->set_active(true);
+m_bIgnoreFixedRatio = true;
 RelSizeClickHdl(*m_xRelWidthCB);
+m_bIgnoreFixedRatio = false;
 m_xWidthED->set_value(rSize.GetWidthPe

core.git: sw/qa sw/source

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/paintfrm.cxx |   10 ++
 sw/source/core/layout/paintfrm.cxx |9 -
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 755f3bebd96ec7ae43b1dcf247f907b9c15c1995
Author: Miklos Vajna 
AuthorDate: Fri May 24 10:51:31 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 12:36:21 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote separator length

See
<https://bug-attachments.documentfoundation.org/attachment.cgi?id=194324>,
Word has a longer separator line for the foot/endnote than Writer for
this bugdoc.

Writer defaults to 25% of the body frame width in the SwPageFootnoteInfo
ctor, and we don't seem to change that in the DOCX import. Word has a
static 2 inches setting, which is only reduced if it would go outside
the body frame.

Fix the problem by extending SwFootnoteContFrame::PaintLine() in the
DocumentSettingId::CONTINUOUS_ENDNOTES case to do the same.

I searched the OOXML spec and the MS implementer notes, they don't
specify this 2 inches length, but it seems static: the value doesn't
change with the page size. With this, the single-section bugdoc is now
rendered fine.

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

diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index 8e7154db2501..a5213c57d639 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -177,6 +177,16 @@ CPPUNIT_TEST_FIXTURE(Test, 
testInlineEndnoteSeparatorPosition)
 // - Actual  : 2060
 // i.e. the upper spacing was too low.
 CPPUNIT_ASSERT_EQUAL(static_cast(2164), nEndnoteSeparatorY);
+
+// Also make sure the separator length is correct:
+auto nEndnoteSeparatorStart = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"x"_ostr).toInt32();
+auto nEndnoteSeparatorEnd = getXPath(pXmlDoc, "//polygon/point[2]"_ostr, 
"x"_ostr).toInt32();
+sal_Int32 nEndnoteSeparatorLength = nEndnoteSeparatorEnd - 
nEndnoteSeparatorStart;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2880
+// - Actual  : 2340
+// i.e. the separator wasn't 2 inches long, but was shorter vs Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(2880), 
nEndnoteSeparatorLength);
 }
 }
 
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index b139a75094da..a0d5f0d8a629 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5772,7 +5772,7 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
 SwTwips nPrtWidth = aRectFnSet.GetWidth(getFramePrintArea());
 Fraction aFract( nPrtWidth, 1 );
 aFract *= rInf.GetWidth();
-const SwTwips nWidth = static_cast(aFract);
+SwTwips nWidth = static_cast(aFract);
 
 SwTwips nX = aRectFnSet.GetPrtLeft(*this);
 switch ( rInf.GetAdj() )
@@ -5803,6 +5803,13 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
 // Word style: instead of fixed value, upper spacing is 60% of all 
space.
 auto nPrintAreaTop = 
static_cast(getFramePrintArea().Top());
 aPoint.setY(getFrameArea().Pos().Y() + nPrintAreaTop * 0.6);
+
+// Length is 2 inches, but don't paint outside the container frame.
+nWidth = o3tl::convert(2, o3tl::Length::in, o3tl::Length::twip);
+if (nWidth > nPrtWidth)
+{
+nWidth = nPrtWidth;
+}
 }
 oLineRect.emplace(aPoint, Size(nWidth, rInf.GetLineWidth()));
 }


ESC meeting minutes: 2024-05-23

2024-05-24 Thread Miklos Vajna

* Present:
+ sockseight, Heiko, Michael W, Ilmari, Jonathan, Caolan, Hossein, Eike, 
Moritz, Cloph, Xisco, Miklos

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC1 was tagged this week, 24.2.4 RC2 next week
+ 24.8:
+ feature freeze (beta1) in 2 weeks
+ string / UI freeze 3 weeks after that

* Documentation (Olivier)
+ Missing Olivier
+ Bugzilla Documentation statistics
255(255) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 16(4)44(-2)112(5) 221(1)
 commented 37(25)   91(21)276(31)868(31)
  resolved  7(1)27(-1) 62(5) 124(1)
+ top 10 contributors:
  Olivier Hallot made 46 changes in 1 month, and 243 changes in 1 year
  Dione Maddern made 28 changes in 1 month, and 59 changes in 1 year
  Stéphane Guillou made 24 changes in 1 month, and 247 changes in 1 year
  Vernon, Stuart Foote made 23 changes in 1 month, and 107 changes in 1 
year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Heiko Tietze made 10 changes in 1 month, and 77 changes in 1 year
  Ilmari Lauhakangas made 10 changes in 1 month, and 69 changes in 1 
year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 74 changes in 1 year
  Cor Nouws made 6 changes in 1 month, and 9 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 37(37) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  3(-4) 10(-3) 14(-4)  22(-3)
 commented 29(-31)   159(-47)   512(-48)   1710(-47)
   removed  0(0)   3(-1)  5(0)   11(0)
  resolved  5(-3) 28(-4) 79(-1) 290(-7)
+ top 10 contributors:
  Heiko Tietze made 94 changes in 1 month, and 956 changes in 1 year
  Vernon, Stuart Foote made 65 changes in 1 month, and 312 changes in 1 
year
  Eyal Rozenberg made 58 changes in 1 month, and 171 changes in 1 year
  Stéphane Guillou made 48 changes in 1 month, and 624 changes in 1 year
  Dieter made 16 changes in 1 month, and 124 changes in 1 year
  Weghorn, Michael made 8 changes in 1 month, and 23 changes in 1 year
  Olivier Hallot made 8 changes in 1 month, and 22 changes in 1 year
  Jakub Kościelak made 6 changes in 1 month, and 6 changes in 1 year
  Henschel, Regina made 6 changes in 1 month, and 33 changes in 1 year
  Roman Kuznetsov made 5 changes in 1 month, and 41 changes in 1 year
+ [Bug 161234] Issues with the new cell outline in Calc 24.8
+ [Bug 161223] basic HTML cell render
+ [Bug 161218] Inconsistent and confusing Text Flow | Break options in
   Table Properties
+ [Bug 161204] UI - dashed outline for active cell border
+ [Bug 161205] Font selection dialog doesn't persist choice of RTL-CTL +
   auto-chooses CJK
+ [Bug 161203] When applying a style by double-clicking it in sidebar style 
list,
   keep list scroll position
+ [Bug 160896] Allow referencing Column & Row with Base 1 instead of 0 in 
Basic
+ [Bug 161149] Cancel all ability to apply direct formatting, and only allow
   formatting via styles
+ [Bug 160881] Forms: Checkboxes and Radiobuttons couldn't set readonly, 
only
   could set disabled
+ [Bug 160874] Calc fails to suggest correction for formula cell without 
equal sign

* Vertical tabpages state (Samuel)
  + review the state in 1 week
  + no news (Heiko)

* Crash Testing (Caolan)
+ 23(-2) import failure, 18(-1) export failures
  - https://wiki.documentfoundation.org/Development/Crashtesting

  - https://bugs.documentfoundation.org/show_bug.cgi?id=161232

  - https://bugs.documentfoundation.org/show_bug.cgi?id=160862

+ 0 coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 7.6.6.36050(+937)
+ 7.6.7.2457(+354)
+ 24.2.0.318611(+663)
+ 24.2.1.215171(+694)
+ 24.2.2.211690(+1291)
+ 24.2.3.22976(+1539)

+ new in 24.2:

https://crashreport.libreoffice.org/stats/signature/SfxItemPool::unregisterSfxPoolItem(SfxPoolItem%20const%20&)

* Mentoring (Hossein)
 + Reviewed submissions from newcomers
 + New EasyHack around QueryWizard
   tdf#161144 - Query wizard confuses columns with the same name in different 
tables
   https://bugs.documentfoundation.org/show_bug.cgi?id=161144
 => Will create a project on VolunteerMatch for porting it to Python (hopefully 
after GSoC)
  committer...   1 week 

ESC meeting minutes: 2024-05-23

2024-05-24 Thread Miklos Vajna

* Present:
+ sockseight, Heiko, Michael W, Ilmari, Jonathan, Caolan, Hossein, Eike, 
Moritz, Cloph, Xisco, Miklos

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC1 was tagged this week, 24.2.4 RC2 next week
+ 24.8:
+ feature freeze (beta1) in 2 weeks
+ string / UI freeze 3 weeks after that

* Documentation (Olivier)
+ Missing Olivier
+ Bugzilla Documentation statistics
255(255) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 16(4)44(-2)112(5) 221(1)
 commented 37(25)   91(21)276(31)868(31)
  resolved  7(1)27(-1) 62(5) 124(1)
+ top 10 contributors:
  Olivier Hallot made 46 changes in 1 month, and 243 changes in 1 year
  Dione Maddern made 28 changes in 1 month, and 59 changes in 1 year
  Stéphane Guillou made 24 changes in 1 month, and 247 changes in 1 year
  Vernon, Stuart Foote made 23 changes in 1 month, and 107 changes in 1 
year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Heiko Tietze made 10 changes in 1 month, and 77 changes in 1 year
  Ilmari Lauhakangas made 10 changes in 1 month, and 69 changes in 1 
year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 74 changes in 1 year
  Cor Nouws made 6 changes in 1 month, and 9 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 37(37) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  3(-4) 10(-3) 14(-4)  22(-3)
 commented 29(-31)   159(-47)   512(-48)   1710(-47)
   removed  0(0)   3(-1)  5(0)   11(0)
  resolved  5(-3) 28(-4) 79(-1) 290(-7)
+ top 10 contributors:
  Heiko Tietze made 94 changes in 1 month, and 956 changes in 1 year
  Vernon, Stuart Foote made 65 changes in 1 month, and 312 changes in 1 
year
  Eyal Rozenberg made 58 changes in 1 month, and 171 changes in 1 year
  Stéphane Guillou made 48 changes in 1 month, and 624 changes in 1 year
  Dieter made 16 changes in 1 month, and 124 changes in 1 year
  Weghorn, Michael made 8 changes in 1 month, and 23 changes in 1 year
  Olivier Hallot made 8 changes in 1 month, and 22 changes in 1 year
  Jakub Kościelak made 6 changes in 1 month, and 6 changes in 1 year
  Henschel, Regina made 6 changes in 1 month, and 33 changes in 1 year
  Roman Kuznetsov made 5 changes in 1 month, and 41 changes in 1 year
+ [Bug 161234] Issues with the new cell outline in Calc 24.8
+ [Bug 161223] basic HTML cell render
+ [Bug 161218] Inconsistent and confusing Text Flow | Break options in
   Table Properties
+ [Bug 161204] UI - dashed outline for active cell border
+ [Bug 161205] Font selection dialog doesn't persist choice of RTL-CTL +
   auto-chooses CJK
+ [Bug 161203] When applying a style by double-clicking it in sidebar style 
list,
   keep list scroll position
+ [Bug 160896] Allow referencing Column & Row with Base 1 instead of 0 in 
Basic
+ [Bug 161149] Cancel all ability to apply direct formatting, and only allow
   formatting via styles
+ [Bug 160881] Forms: Checkboxes and Radiobuttons couldn't set readonly, 
only
   could set disabled
+ [Bug 160874] Calc fails to suggest correction for formula cell without 
equal sign

* Vertical tabpages state (Samuel)
  + review the state in 1 week
  + no news (Heiko)

* Crash Testing (Caolan)
+ 23(-2) import failure, 18(-1) export failures
  - https://wiki.documentfoundation.org/Development/Crashtesting

  - https://bugs.documentfoundation.org/show_bug.cgi?id=161232

  - https://bugs.documentfoundation.org/show_bug.cgi?id=160862

+ 0 coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 7.6.6.36050(+937)
+ 7.6.7.2457(+354)
+ 24.2.0.318611(+663)
+ 24.2.1.215171(+694)
+ 24.2.2.211690(+1291)
+ 24.2.3.22976(+1539)

+ new in 24.2:

https://crashreport.libreoffice.org/stats/signature/SfxItemPool::unregisterSfxPoolItem(SfxPoolItem%20const%20&)

* Mentoring (Hossein)
 + Reviewed submissions from newcomers
 + New EasyHack around QueryWizard
   tdf#161144 - Query wizard confuses columns with the same name in different 
tables
   https://bugs.documentfoundation.org/show_bug.cgi?id=161144
 => Will create a project on VolunteerMatch for porting it to Python (hopefully 
after GSoC)
  committer...   1 week 

core.git: sw/qa sw/source

2024-05-23 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/paintfrm.cxx |   20 
 sw/source/core/layout/paintfrm.cxx |   27 ---
 2 files changed, 40 insertions(+), 7 deletions(-)

New commits:
commit f1d0b4e34a1f467e9f54baa7ac31ca28fdae3efb
Author: Miklos Vajna 
AuthorDate: Thu May 23 15:31:05 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 23 21:01:31 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote separator position

See <https://bugs.documentfoundation.org/attachment.cgi?id=194306>, the
total height of the endnote separator is now correct, but the
distribution of upper space, line width, lower space is still bad, when
compared to Word.

Our model is 2 spacings and a line width, while Word seems to simply
split the amount of available space: 60% goes above the separator and
the rest goes below.

Fix the problem by breaking up the monster expression for the separator
rectangle in SwFootnoteContFrame::PaintLine(), and then the compat +
horizontal case can do the 60% spacing in the Word compat mode.

The width of the separator is still not correct.

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

diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index b5990648b20f..8e7154db2501 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -158,6 +158,26 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder)
 // bottom border.
 CPPUNIT_ASSERT_EQUAL(static_cast(2), aHorizontalBorderEnds.size());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteSeparatorPosition)
+{
+// Given a document with a Word-style endnote separator:
+createSwDoc("inline-endnote-position.docx");
+SwDocShell* pDocShell = getSwDocShell();
+
+// When rendering that document:
+std::shared_ptr xMetaFile = pDocShell->GetPreviewMetaFile();
+
+// Then make sure the separator upper spacing is 60% of all space, 
matching Word:
+MetafileXmlDump aDumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+auto nEndnoteSeparatorY = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"y"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2164
+// - Actual  : 2060
+// i.e. the upper spacing was too low.
+CPPUNIT_ASSERT_EQUAL(static_cast(2164), nEndnoteSeparatorY);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 8c0f4f876847..b139a75094da 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5788,13 +5788,26 @@ void SwFootnoteContFrame::PaintLine( const SwRect& 
rRect,
 assert(false);
 }
 SwTwips nLineWidth = rInf.GetLineWidth();
-const SwRect aLineRect = aRectFnSet.IsVert() ?
-SwRect( 
Point(getFrameArea().Left()+getFrameArea().Width()-rInf.GetTopDist()-nLineWidth,
-  nX), Size( nLineWidth, nWidth ) )
-: SwRect( Point( nX, getFrameArea().Pos().Y() + rInf.GetTopDist() 
),
-Size( nWidth, rInf.GetLineWidth()));
-if ( aLineRect.HasArea() && rInf.GetLineStyle() != 
SvxBorderLineStyle::NONE)
-PaintBorderLine( rRect, aLineRect , pPage, (),
+std::optional oLineRect;
+if (aRectFnSet.IsVert())
+{
+
oLineRect.emplace(Point(getFrameArea().Left()+getFrameArea().Width()-rInf.GetTopDist()-nLineWidth,
+  nX), Size( nLineWidth, nWidth ) );
+}
+else
+{
+Point aPoint(nX, getFrameArea().Pos().Y() + rInf.GetTopDist());
+const IDocumentSettingAccess& rIDSA = 
GetFormat()->getIDocumentSettingAccess();
+if (rIDSA.get(DocumentSettingId::CONTINUOUS_ENDNOTES))
+{
+// Word style: instead of fixed value, upper spacing is 60% of all 
space.
+auto nPrintAreaTop = 
static_cast(getFramePrintArea().Top());
+aPoint.setY(getFrameArea().Pos().Y() + nPrintAreaTop * 0.6);
+}
+oLineRect.emplace(aPoint, Size(nWidth, rInf.GetLineWidth()));
+}
+if ( oLineRect->HasArea() && rInf.GetLineStyle() != 
SvxBorderLineStyle::NONE)
+PaintBorderLine( rRect, *oLineRect , pPage, (),
 rInf.GetLineStyle() );
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sw/inc sw/qa sw/source

2024-05-23 Thread Miklos Vajna (via logerrit)
 sw/inc/pagedesc.hxx |2 
 sw/qa/core/layout/data/inline-endnote-position.docx |binary
 sw/qa/core/layout/ftnfrm.cxx|   20 
 sw/source/core/layout/ftnfrm.cxx|   49 +++-
 sw/source/filter/ww8/docxattributeoutput.cxx|   10 +++-
 5 files changed, 77 insertions(+), 4 deletions(-)

New commits:
commit dbc5e22e4e1ae730f70664472a3d4d72688d629e
Author: Miklos Vajna 
AuthorDate: Wed May 22 13:56:40 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 23 17:10:31 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote container's top margin

Comparing the Word vs Writer output for the bugdoc, the vertical
position of the endnote text is not correct: the y pos should be larger
than it is, see the red reference at e.g.
<https://bug-attachments.documentfoundation.org/attachment.cgi?id=194265>.

Seems this is caused by the different height of the rectangle around the
endnote separator: the top margin is 124 twips in Writer, which is a
hardcoded default from the SwPageFootnoteInfo ctor, while Word has this
separator as a special character, inside a paragraph, which inherits the
height of the default paragraph style.

Fix the problem by extending sw::FootnoteSeparatorHeight() to also work
from RES_POOLCOLL_STANDARD in the Word compat case. Note that it's not
enough to take the font size (11pt in this case) from the paragraph
style, we want to work with the real font, which knows the spacing
between lines (15% in this case). SwFont::GetHeight() has this logic,
it's also what e.g. SwTextFrame::FormatEmpty() uses.

Note that footnotes have the same problem, but given that they grow from
the bottom of the page, the text position was correct, even if the
separator height is incorrect. Also, the separator line itself is not
changed in this commit, we just make sure that the height is OK, so text
below the line has the correct position.

(cherry picked from commit d1ddd136a1b0e452492464d58715eaec144fd811)

Change-Id: If1f4757908355abc81ee711de5ab9db4c751354c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167984
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index ddc7e659a5bb..d9b58a4bb357 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -399,7 +399,7 @@ public:
 namespace sw {
 class PageFootnoteHint final : public SfxHint {};
 
-SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwPageFootnoteInfo const&);
+SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwDoc& rDoc, 
SwPageFootnoteInfo const&);
 }
 
 typedef boost::multi_index_container<
diff --git a/sw/qa/core/layout/data/inline-endnote-position.docx 
b/sw/qa/core/layout/data/inline-endnote-position.docx
new file mode 100644
index ..3905208f9f0e
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-position.docx differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 1cf31809e5a7..a7640e26ca9a 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -102,4 +102,24 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndSection)
 CPPUNIT_ASSERT_EQUAL(2, nToplevelSections);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnotePosition)
+{
+// Given a document, ContinuousEndnotes is true:
+createSwDoc("inline-endnote-position.docx");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the endnote separator (line + spacing around it) is 
large enough, so the
+// endnote text below the separator has the correct position:
+sal_Int32 nEndnoteContTopMargin
+= parseDump("//column/ftncont/infos/prtBounds"_ostr, 
"top"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 269
+// - Actual  : 124
+// i.e. the top margin wasn't the default font size with its spacing, but 
the Writer default,
+// which shifted endnote text up, incorrectly.
+CPPUNIT_ASSERT_EQUAL(static_cast(269), nEndnoteContTopMargin);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 61a8385d51fc..46312f9f4e89 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -42,9 +42,41 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #define ENDNOTE 0x8000
 
+namespace
+{
+/// Calculates the height of the line that hosts the separator line (the top 
margin of the
+/// container), based on the default paragraph style in rDoc.
+bool FootnoteSeparatorHeightFromParagraph(SwDoc& rDo

core.git: Branch 'distro/collabora/co-24.04' - writerfilter/qa writerfilter/source

2024-05-23 Thread Miklos Vajna (via logerrit)
 writerfilter/qa/cppunittests/filter/WriterFilter.cxx  |   
26 ++
 writerfilter/qa/cppunittests/filter/data/inline-endnote-and-footnote.docx 
|binary
 writerfilter/source/filter/WriterFilter.cxx   |
1 
 3 files changed, 27 insertions(+)

New commits:
commit 10b1f037288f107357bd4402ff65528f76544b0c
Author: Miklos Vajna 
AuthorDate: Tue May 21 08:15:53 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 23 15:59:22 2024 +0200

tdf#160984 sw continuous endnotes: enable DOCX import

This was working for DOC already.

For DOCX, this was already enabled once with commit
f9982c24066d6dd2f938cc20176af0f196bc018f (tdf#58521 DOCX import: enable
ContinuousEndnotes compat flag, 2021-07-13), but then it was reverted
later with commit commit eeda1b35a6e87d5349545464da33d997c52f15e3
(Revert "tdf#58521 DOCX import: enable ContinuousEndnotes compat flag",
2021-08-10), because of tdf#143456.

Enable it again, now that the section-based layout seems good enough to
handle larger number of endnotes, e.g. the 48 endnotes from tdf#143456.

(cherry picked from commit 1ae5ea3f78cca11ba18f2dd1a06f875263336a3b)

Change-Id: Id221f31f9208e84db2c358546d4d6ceea991b6b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167924
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/writerfilter/qa/cppunittests/filter/WriterFilter.cxx 
b/writerfilter/qa/cppunittests/filter/WriterFilter.cxx
index ae741085277c..be9139c5c229 100644
--- a/writerfilter/qa/cppunittests/filter/WriterFilter.cxx
+++ b/writerfilter/qa/cppunittests/filter/WriterFilter.cxx
@@ -50,6 +50,32 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjs)
 // i.e. the shape was on the left margin.
 CPPUNIT_ASSERT_GREATER(nBodyRight, nShapeLeft);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnoteDOCX)
+{
+// Given a DOCX file with an endnote and then a footnote:
+loadFromFile(u"inline-endnote-and-footnote.docx");
+
+// When laying out that document:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+css::uno::Reference xDumper(xModel->getCurrentController(), 
uno::UNO_QUERY);
+OString aDump = xDumper->dump("layout").toUtf8();
+auto pCharBuffer = reinterpret_cast(aDump.getStr());
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer));
+
+// Then make sure the footnote is below the endnote:
+// Without the accompanying fix in place, this test would have failed with:
+// - xpath should match exactly 1 node
+// i.e. the endnote was also in the footnote container, not at the end of 
the body text.
+sal_Int32 nEndnoteTop
+= getXPath(pXmlDoc, 
"/root/page/body/section/column/ftncont/ftn/infos/bounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+sal_Int32 nFootnoteTop
+= getXPath(pXmlDoc, "/root/page/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+// Endnote at the end of body text, footnote at page bottom.
+CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git 
a/writerfilter/qa/cppunittests/filter/data/inline-endnote-and-footnote.docx 
b/writerfilter/qa/cppunittests/filter/data/inline-endnote-and-footnote.docx
new file mode 100644
index ..84343b8afa45
Binary files /dev/null and 
b/writerfilter/qa/cppunittests/filter/data/inline-endnote-and-footnote.docx 
differ
diff --git a/writerfilter/source/filter/WriterFilter.cxx 
b/writerfilter/source/filter/WriterFilter.cxx
index 44efc0c42cfc..f7654681f6ee 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -332,6 +332,7 @@ void WriterFilter::setTargetDocument(const 
uno::Reference& xDo
 // rely on default for HyphenateURLs=false
 // rely on default for 
APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH=true
 xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true));
+xSettings->setPropertyValue("ContinuousEndnotes", uno::Any(true));
 }
 
 void WriterFilter::setSourceDocument(const uno::Reference& 
xDoc)


core.git: sw/qa

2024-05-23 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfexport/rtfexport8.cxx |  540 --
 1 file changed, 322 insertions(+), 218 deletions(-)

New commits:
commit a4ec8307e342bd83e287b197ffac822ac7e9f599
Author: Miklos Vajna 
AuthorDate: Thu May 23 08:06:53 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 23 09:46:38 2024 +0200

CppunitTest_sw_rtfexport8: avoid DECLARE_RTFEXPORT_TEST

No need to go via Writer-specific macros here.

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

diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index e05eb817d07f..33219edcfe9d 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -53,133 +53,191 @@ public:
 }
 };
 
-DECLARE_RTFEXPORT_TEST(testTdf155663, "piccrop.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf155663)
 {
-auto const xShape(getShape(1));
-if (!isExported())
-{
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Height);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Width);
-}
-else // bit of rounding loss?
-{
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Height);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Width);
-}
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123), 
getProperty(xShape, "GraphicCrop").Top);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
- getProperty(xShape, 
"GraphicCrop").Bottom);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
- getProperty(xShape, 
"GraphicCrop").Left);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
- getProperty(xShape, 
"GraphicCrop").Right);
+auto verify = [this]() {
+auto const xShape(getShape(1));
+if (!isExported())
+{
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Width);
+}
+else // bit of rounding loss?
+{
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Width);
+}
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Top);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Bottom);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Left);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Right);
+};
+createSwDoc("piccrop.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf158586_0)
 {
-// The specified page break must be lost because it is in a text frame
-CPPUNIT_ASSERT_EQUAL(1, getPages());
-CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
-
-// There should be no empty paragraph at the start
-xmlDocUniquePtr pLayout = parseLayoutDump();
-assertXPath(pLayout, "//anchored"_ostr, 1);
-assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page");
+auto verify = [this]() {
+// The specified page break must be lost because it is in a text frame
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+// There should be no empty paragraph at the start
+xmlDocUniquePtr pLayout = parseLayoutDump();
+assertXPath(pLayout, "//anchored"_ostr, 1);
+assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First 
page");
+};
+createSwDoc("tdf158586_pageBreak0.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf158586_0B, "tdf158586_pageBreak0B.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf158586_0B)
 {
-// The specified page break must be lost because it is in a text frame
-CPPUNIT_ASSERT_EQUAL(1, getPages());
-CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
-
-// There should be no empty paragraph at the start
-xmlDocUniquePtr pLayout = parseLayoutDump();
-assertXPath(pLayout, "//anchored"_ostr, 1);
-assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page");
+auto verify = [this]() {
+// The specified page break must be lost because it is in a text frame
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+   

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source xmloff/qa

2024-05-23 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/fly-rel-width-rounding.odt |binary
 sw/qa/core/layout/fly.cxx |   25 ++
 sw/source/core/layout/fly.cxx |5 ++--
 xmloff/qa/unit/text.cxx   |4 +--
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 991341f9f69fded9c9573d91b2d65fc6a37b3132
Author: Miklos Vajna 
AuthorDate: Wed May 22 08:47:32 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 23 09:20:46 2024 +0200

Related: tdf#145972 sw images: fix rounding error in relative size 
calculation

Open the bugdoc, see that the image is roughly half of the page width,
right click, properties, UI shows that the width of the image is 5% of
the width of the entire page. This only happens if tools -> options ->
writer -> general sets the UI units to points, the default cm case is
fine.

This went wrong with commit 9e8712ed6f9fb5dbd971e352a5709bd45fadc74f (sw
image dialog: fix fallback width/height for images with relative sizes,
2022-03-17), because the layout size started to matter more after that
commit. This lead to the nWidth !=
m_xWidthED->get_value(FieldUnit::TWIP) check in SwFramePage::Init() to
be true, because 11906 * 0.48 is 5714.88, so you got 5714 in the layout,
but got 5715 with rounding in SwFramePage::Reset() (which tries to calc
the page width based on the 48% and the fly width). And once we had that
mismatch, we went down the wrong path.

Fix the problem by using rtl::math::round() in SwFlyFrame::CalcRel(), so
the relative width twips value is 5715 everywhere: once we have
consisteny, the UI value is correct, too.

Note that the original bugdoc needs more fixing, this just fixes the
bugdoc where KeepRatio is false.

Change-Id: I1e8782c95a0cf9d97375c36d41134735c01f3e46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167916
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167926
(cherry picked from commit 3046bd0e30406d37813ce3eaa65f71f5ed10ab13)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167980
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
b/sw/qa/core/layout/data/fly-rel-width-rounding.odt
new file mode 100644
index ..b70b9e51a917
Binary files /dev/null and b/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
differ
diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
index 47cfb40fa6e7..81df20af3b35 100644
--- a/sw/qa/core/layout/fly.cxx
+++ b/sw/qa/core/layout/fly.cxx
@@ -86,6 +86,31 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNegativeHeight)
 }
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFlyRelWithRounding)
+{
+// Given a document where page width is 21.001cm (11906 twips), and the 
image width is 48% of
+// the page width:
+createSwDoc("fly-rel-width-rounding.odt");
+
+// When laying out that document:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+// Then make sure that we calculate the width of the fly correctly:
+auto pPage = pLayout->GetLower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+tools::Long nFlyWidth = pFly->getFrameArea().Width();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 5715
+// - Actual  : 5714
+// i.e. 5714.88 was truncated, not rounded.
+CPPUNIT_ASSERT_EQUAL(static_cast(5715), nFlyWidth);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index b454bd95917f..fd95ce192cf7 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -70,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2845,9 +2846,9 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize  ) 
const
 }
 
 if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setWidth( nRelWidth * rSz.GetWidthPercent() / 100 );
+aRet.setWidth(rtl::math::round(double(nRelWidth) * 
rSz.GetWidthPercent() / 100));
 if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
+aRet.setHeight(rtl::math::round(double(nRelHeight) * 
rSz.GetHeightPercent() / 100));
 
 if ( rSz.GetHeight() && rSz.GetWidthPercent() == 
SwF

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

2024-05-22 Thread Miklos Vajna (via logerrit)
 sw/inc/pagedesc.hxx |2 
 sw/qa/core/layout/data/inline-endnote-position.docx |binary
 sw/qa/core/layout/ftnfrm.cxx|   20 
 sw/source/core/layout/ftnfrm.cxx|   49 +++-
 sw/source/filter/ww8/docxattributeoutput.cxx|   10 +++-
 5 files changed, 77 insertions(+), 4 deletions(-)

New commits:
commit d1ddd136a1b0e452492464d58715eaec144fd811
Author: Miklos Vajna 
AuthorDate: Wed May 22 13:56:40 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 22 17:50:10 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote container's top margin

Comparing the Word vs Writer output for the bugdoc, the vertical
position of the endnote text is not correct: the y pos should be larger
than it is, see the red reference at e.g.
<https://bug-attachments.documentfoundation.org/attachment.cgi?id=194265>.

Seems this is caused by the different height of the rectangle around the
endnote separator: the top margin is 124 twips in Writer, which is a
hardcoded default from the SwPageFootnoteInfo ctor, while Word has this
separator as a special character, inside a paragraph, which inherits the
height of the default paragraph style.

Fix the problem by extending sw::FootnoteSeparatorHeight() to also work
from RES_POOLCOLL_STANDARD in the Word compat case. Note that it's not
enough to take the font size (11pt in this case) from the paragraph
style, we want to work with the real font, which knows the spacing
between lines (15% in this case). SwFont::GetHeight() has this logic,
it's also what e.g. SwTextFrame::FormatEmpty() uses.

Note that footnotes have the same problem, but given that they grow from
the bottom of the page, the text position was correct, even if the
separator height is incorrect. Also, the separator line itself is not
changed in this commit, we just make sure that the height is OK, so text
below the line has the correct position.

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

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 3ec919ce3c83..a8241f15f6f0 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -399,7 +399,7 @@ public:
 namespace sw {
 class PageFootnoteHint final : public SfxHint {};
 
-SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwPageFootnoteInfo const&);
+SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwDoc& rDoc, 
SwPageFootnoteInfo const&);
 }
 
 typedef boost::multi_index_container<
diff --git a/sw/qa/core/layout/data/inline-endnote-position.docx 
b/sw/qa/core/layout/data/inline-endnote-position.docx
new file mode 100644
index ..3905208f9f0e
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-position.docx differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 1cf31809e5a7..a7640e26ca9a 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -102,4 +102,24 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndSection)
 CPPUNIT_ASSERT_EQUAL(2, nToplevelSections);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnotePosition)
+{
+// Given a document, ContinuousEndnotes is true:
+createSwDoc("inline-endnote-position.docx");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the endnote separator (line + spacing around it) is 
large enough, so the
+// endnote text below the separator has the correct position:
+sal_Int32 nEndnoteContTopMargin
+= parseDump("//column/ftncont/infos/prtBounds"_ostr, 
"top"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 269
+// - Actual  : 124
+// i.e. the top margin wasn't the default font size with its spacing, but 
the Writer default,
+// which shifted endnote text up, incorrectly.
+CPPUNIT_ASSERT_EQUAL(static_cast(269), nEndnoteContTopMargin);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index b7851a131e44..548d8228063e 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -42,9 +42,41 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #define ENDNOTE 0x8000
 
+namespace
+{
+/// Calculates the height of the line that hosts the separator line (the top 
margin of the
+/// container), based on the default paragraph style in rDoc.
+bool FootnoteSeparatorHeightFromParagraph(SwDoc& rDoc, SwTwips& rHeight)
+{
+const SwTextFormatColl* pDefaultParaFormat
+= 
rDoc.getIDocument

ESC meeting agenda: 2024-05-23 16:00 CEST

2024-05-22 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC2 next week?
+ 24.8:
+ feature freeze in 2 weeks?
+ string / UI freeze 3 weeks after that

* Documentation (Olivier)
+ Bugzilla Documentation statistics
255(255) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 16(4)44(-2)112(5) 221(1)
 commented 37(25)   91(21)276(31)868(31)
  resolved  7(1)27(-1) 62(5) 124(1)
+ top 10 contributors:
  Olivier Hallot made 46 changes in 1 month, and 243 changes in 1 year
  Dione Maddern made 28 changes in 1 month, and 59 changes in 1 year
  Stéphane Guillou made 24 changes in 1 month, and 247 changes in 1 year
  Vernon, Stuart Foote made 23 changes in 1 month, and 107 changes in 1 
year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Heiko Tietze made 10 changes in 1 month, and 77 changes in 1 year
  Ilmari Lauhakangas made 10 changes in 1 month, and 69 changes in 1 
year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 74 changes in 1 year
  Cor Nouws made 6 changes in 1 month, and 9 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 37(37) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  3(-4) 10(-3) 14(-4)  22(-3)
 commented 29(-31)   159(-47)   512(-48)   1710(-47)
   removed  0(0)   3(-1)  5(0)   11(0)
  resolved  5(-3) 28(-4) 79(-1) 290(-7)
+ top 10 contributors:
  Heiko Tietze made 94 changes in 1 month, and 956 changes in 1 year
  Vernon, Stuart Foote made 65 changes in 1 month, and 312 changes in 1 
year
  Eyal Rozenberg made 58 changes in 1 month, and 171 changes in 1 year
  Stéphane Guillou made 48 changes in 1 month, and 624 changes in 1 year
  Dieter made 16 changes in 1 month, and 124 changes in 1 year
  Weghorn, Michael made 8 changes in 1 month, and 23 changes in 1 year
  Olivier Hallot made 8 changes in 1 month, and 22 changes in 1 year
  Jakub Kościelak made 6 changes in 1 month, and 6 changes in 1 year
  Henschel, Regina made 6 changes in 1 month, and 33 changes in 1 year
  Roman Kuznetsov made 5 changes in 1 month, and 41 changes in 1 year

* Vertical tabpages state (Samuel)
  + review the state in 1 week

* Crash Testing (Caolan)
+ 23(-2) import failure, 18(-1) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.0.2174(+1)
+ 24.2.0.318611(+663)
+ 24.2.1.177(+4)
+ 24.2.1.215171(+694)
+ 24.2.2.211690(+1291)
+ 24.2.3.22976(+1539)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months12 months
  open  56(-33)146(-14)147(-13) 147(-13)
   reviews 362(44)1322(72)3538(-56)   12486(28)
merged 254(-56)   1304(60)3385(-38)   12718(4)
 abandoned  10(-5)  53(-8) 175(1)   659(-2)
   own commits 177(-50)946(33)2400(20) 9273(-1)
review commits  72(34) 233(15) 820(-19)3005(11)
contributor...   1 week  1 month3 months 12 months
  open  36(-19)  95(-8) 96(-7)96(-7)
   reviews 730(-164)   3132(82)   7826(-104)   29550(-24)
merged  25(10)   90(4) 366(-11) 1589(6)
 abandoned   7(7)28(-5)280(1)704(5)
   own commits  35(21)  107(10)413(-16) 1137(23)
review commits   0(0) 0(0)   0(0)  0(0)
+ easyHack statistics:
   needsDevEval 9(9)   needsUXEval 1(1)   cleanup_comments 326(326)
   total 410(410)   assigned 27(27)   open 348(348)
+ top 10 contributors:
  Dione Maddern made 11 patches in 1 month, and 45 patches in 1 year
  Jakub Kościelak made 7 patches in 1 month, and 7 patches in 1 year
  Stéphane Guillou made 5 patches in 1 month, and 60 patches in 1 year
  Weblate made 4 patches in 1 month, and 25 patches in 1 year
made 4 patches in 1 month, 

ESC meeting agenda: 2024-05-23 16:00 CEST

2024-05-22 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:
+ MAR update: include OS info in the user agent or file a bug to do it 
(Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC2 next week?
+ 24.8:
+ feature freeze in 2 weeks?
+ string / UI freeze 3 weeks after that

* Documentation (Olivier)
+ Bugzilla Documentation statistics
255(255) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 16(4)44(-2)112(5) 221(1)
 commented 37(25)   91(21)276(31)868(31)
  resolved  7(1)27(-1) 62(5) 124(1)
+ top 10 contributors:
  Olivier Hallot made 46 changes in 1 month, and 243 changes in 1 year
  Dione Maddern made 28 changes in 1 month, and 59 changes in 1 year
  Stéphane Guillou made 24 changes in 1 month, and 247 changes in 1 year
  Vernon, Stuart Foote made 23 changes in 1 month, and 107 changes in 1 
year
  Dieter made 13 changes in 1 month, and 18 changes in 1 year
  Heiko Tietze made 10 changes in 1 month, and 77 changes in 1 year
  Ilmari Lauhakangas made 10 changes in 1 month, and 69 changes in 1 
year
  Óvári made 10 changes in 1 month, and 13 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 74 changes in 1 year
  Cor Nouws made 6 changes in 1 month, and 9 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 37(37) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  3(-4) 10(-3) 14(-4)  22(-3)
 commented 29(-31)   159(-47)   512(-48)   1710(-47)
   removed  0(0)   3(-1)  5(0)   11(0)
  resolved  5(-3) 28(-4) 79(-1) 290(-7)
+ top 10 contributors:
  Heiko Tietze made 94 changes in 1 month, and 956 changes in 1 year
  Vernon, Stuart Foote made 65 changes in 1 month, and 312 changes in 1 
year
  Eyal Rozenberg made 58 changes in 1 month, and 171 changes in 1 year
  Stéphane Guillou made 48 changes in 1 month, and 624 changes in 1 year
  Dieter made 16 changes in 1 month, and 124 changes in 1 year
  Weghorn, Michael made 8 changes in 1 month, and 23 changes in 1 year
  Olivier Hallot made 8 changes in 1 month, and 22 changes in 1 year
  Jakub Kościelak made 6 changes in 1 month, and 6 changes in 1 year
  Henschel, Regina made 6 changes in 1 month, and 33 changes in 1 year
  Roman Kuznetsov made 5 changes in 1 month, and 41 changes in 1 year

* Vertical tabpages state (Samuel)
  + review the state in 1 week

* Crash Testing (Caolan)
+ 23(-2) import failure, 18(-1) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.0.2174(+1)
+ 24.2.0.318611(+663)
+ 24.2.1.177(+4)
+ 24.2.1.215171(+694)
+ 24.2.2.211690(+1291)
+ 24.2.3.22976(+1539)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months12 months
  open  56(-33)146(-14)147(-13) 147(-13)
   reviews 362(44)1322(72)3538(-56)   12486(28)
merged 254(-56)   1304(60)3385(-38)   12718(4)
 abandoned  10(-5)  53(-8) 175(1)   659(-2)
   own commits 177(-50)946(33)2400(20) 9273(-1)
review commits  72(34) 233(15) 820(-19)3005(11)
contributor...   1 week  1 month3 months 12 months
  open  36(-19)  95(-8) 96(-7)96(-7)
   reviews 730(-164)   3132(82)   7826(-104)   29550(-24)
merged  25(10)   90(4) 366(-11) 1589(6)
 abandoned   7(7)28(-5)280(1)704(5)
   own commits  35(21)  107(10)413(-16) 1137(23)
review commits   0(0) 0(0)   0(0)  0(0)
+ easyHack statistics:
   needsDevEval 9(9)   needsUXEval 1(1)   cleanup_comments 326(326)
   total 410(410)   assigned 27(27)   open 348(348)
+ top 10 contributors:
  Dione Maddern made 11 patches in 1 month, and 45 patches in 1 year
  Jakub Kościelak made 7 patches in 1 month, and 7 patches in 1 year
  Stéphane Guillou made 5 patches in 1 month, and 60 patches in 1 year
  Weblate made 4 patches in 1 month, and 25 patches in 1 year
made 4 patches in 1 month, 

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

2024-05-22 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/fly-rel-width-rounding.odt |binary
 sw/qa/core/layout/fly.cxx |   25 ++
 sw/source/core/layout/fly.cxx |5 ++--
 xmloff/qa/unit/text.cxx   |4 +--
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 3046bd0e30406d37813ce3eaa65f71f5ed10ab13
Author: Miklos Vajna 
AuthorDate: Wed May 22 08:47:32 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 22 13:44:49 2024 +0200

Related: tdf#145972 sw images: fix rounding error in relative size 
calculation

Open the bugdoc, see that the image is roughly half of the page width,
right click, properties, UI shows that the width of the image is 5% of
the width of the entire page. This only happens if tools -> options ->
writer -> general sets the UI units to points, the default cm case is
fine.

This went wrong with commit 9e8712ed6f9fb5dbd971e352a5709bd45fadc74f (sw
image dialog: fix fallback width/height for images with relative sizes,
2022-03-17), because the layout size started to matter more after that
commit. This lead to the nWidth !=
m_xWidthED->get_value(FieldUnit::TWIP) check in SwFramePage::Init() to
be true, because 11906 * 0.48 is 5714.88, so you got 5714 in the layout,
but got 5715 with rounding in SwFramePage::Reset() (which tries to calc
the page width based on the 48% and the fly width). And once we had that
mismatch, we went down the wrong path.

Fix the problem by using rtl::math::round() in SwFlyFrame::CalcRel(), so
the relative width twips value is 5715 everywhere: once we have
consisteny, the UI value is correct, too.

Note that the original bugdoc needs more fixing, this just fixes the
bugdoc where KeepRatio is false.

Change-Id: I1e8782c95a0cf9d97375c36d41134735c01f3e46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167916
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167926

diff --git a/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
b/sw/qa/core/layout/data/fly-rel-width-rounding.odt
new file mode 100644
index ..b70b9e51a917
Binary files /dev/null and b/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
differ
diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
index 47cfb40fa6e7..81df20af3b35 100644
--- a/sw/qa/core/layout/fly.cxx
+++ b/sw/qa/core/layout/fly.cxx
@@ -86,6 +86,31 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNegativeHeight)
 }
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFlyRelWithRounding)
+{
+// Given a document where page width is 21.001cm (11906 twips), and the 
image width is 48% of
+// the page width:
+createSwDoc("fly-rel-width-rounding.odt");
+
+// When laying out that document:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+// Then make sure that we calculate the width of the fly correctly:
+auto pPage = pLayout->GetLower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+tools::Long nFlyWidth = pFly->getFrameArea().Width();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 5715
+// - Actual  : 5714
+// i.e. 5714.88 was truncated, not rounded.
+CPPUNIT_ASSERT_EQUAL(static_cast(5715), nFlyWidth);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index b454bd95917f..fd95ce192cf7 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -70,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2845,9 +2846,9 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize  ) 
const
 }
 
 if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setWidth( nRelWidth * rSz.GetWidthPercent() / 100 );
+aRet.setWidth(rtl::math::round(double(nRelWidth) * 
rSz.GetWidthPercent() / 100));
 if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
+aRet.setHeight(rtl::math::round(double(nRelHeight) * 
rSz.GetHeightPercent() / 100));
 
 if ( rSz.GetHeight() && rSz.GetWidthPercent() == 
SwFormatFrameSize::SYNCED )
 {
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index e6433b2b70f9..2da04387d707 100644
--- a/xmloff/qa/unit/text.cx

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

2024-05-22 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/fly-rel-width-rounding.odt |binary
 sw/qa/core/layout/fly.cxx |   25 ++
 sw/source/core/layout/fly.cxx |5 ++--
 xmloff/qa/unit/text.cxx   |4 +--
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 080afd6a345e5dffd924100b5a3ff9c028f5b094
Author: Miklos Vajna 
AuthorDate: Wed May 22 08:47:32 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 22 10:27:36 2024 +0200

Related: tdf#145972 sw images: fix rounding error in relative size 
calculation

Open the bugdoc, see that the image is roughly half of the page width,
right click, properties, UI shows that the width of the image is 5% of
the width of the entire page. This only happens if tools -> options ->
writer -> general sets the UI units to points, the default cm case is
fine.

This went wrong with commit 9e8712ed6f9fb5dbd971e352a5709bd45fadc74f (sw
image dialog: fix fallback width/height for images with relative sizes,
2022-03-17), because the layout size started to matter more after that
commit. This lead to the nWidth !=
m_xWidthED->get_value(FieldUnit::TWIP) check in SwFramePage::Init() to
be true, because 11906 * 0.48 is 5714.88, so you got 5714 in the layout,
but got 5715 with rounding in SwFramePage::Reset() (which tries to calc
the page width based on the 48% and the fly width). And once we had that
mismatch, we went down the wrong path.

Fix the problem by using rtl::math::round() in SwFlyFrame::CalcRel(), so
the relative width twips value is 5715 everywhere: once we have
consisteny, the UI value is correct, too.

Note that the original bugdoc needs more fixing, this just fixes the
bugdoc where KeepRatio is false.

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

diff --git a/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
b/sw/qa/core/layout/data/fly-rel-width-rounding.odt
new file mode 100644
index ..b70b9e51a917
Binary files /dev/null and b/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
differ
diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
index 47cfb40fa6e7..81df20af3b35 100644
--- a/sw/qa/core/layout/fly.cxx
+++ b/sw/qa/core/layout/fly.cxx
@@ -86,6 +86,31 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNegativeHeight)
 }
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFlyRelWithRounding)
+{
+// Given a document where page width is 21.001cm (11906 twips), and the 
image width is 48% of
+// the page width:
+createSwDoc("fly-rel-width-rounding.odt");
+
+// When laying out that document:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+// Then make sure that we calculate the width of the fly correctly:
+auto pPage = pLayout->GetLower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+tools::Long nFlyWidth = pFly->getFrameArea().Width();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 5715
+// - Actual  : 5714
+// i.e. 5714.88 was truncated, not rounded.
+CPPUNIT_ASSERT_EQUAL(static_cast(5715), nFlyWidth);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 549681ca7227..a3c9ac84e7c2 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -70,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2845,9 +2846,9 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize  ) 
const
 }
 
 if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setWidth( nRelWidth * rSz.GetWidthPercent() / 100 );
+aRet.setWidth(rtl::math::round(double(nRelWidth) * 
rSz.GetWidthPercent() / 100));
 if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
+aRet.setHeight(rtl::math::round(double(nRelHeight) * 
rSz.GetHeightPercent() / 100));
 
 if ( rSz.GetHeight() && rSz.GetWidthPercent() == 
SwFormatFrameSize::SYNCED )
 {
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 1679af04bc1f..f95e07e42578 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -508,11 +508,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelat

core.git: include/svx svx/source

2024-05-21 Thread Miklos Vajna (via logerrit)
 include/svx/svdundo.hxx   |2 +-
 svx/source/svdraw/svdundo.cxx |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit f2ba39c5e7ae28a832e707667a0a61736f65ebda
Author: Miklos Vajna 
AuthorDate: Tue May 21 08:32:27 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 21 13:05:42 2024 +0200

svx: prefix members of SdrUndoDelPage

See tdf#94879 for motivation.

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

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 5af5c584eda1..e1b778064e6d 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -594,7 +594,7 @@ class SVXCORE_DLLPUBLIC SdrUndoDelPage final : public 
SdrUndoPageList
 {
 // When deleting a MasterPage, we remember all relations of the
 // Character Page with the MasterPage in this UndoGroup.
-std::unique_ptr pUndoGroup;
+std::unique_ptr m_pUndoGroup;
 std::unique_ptr mpFillBitmapItem;
 bool mbHasFillBitmap;
 
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 1b52ee945957..bec090c6339c 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -1408,12 +1408,12 @@ SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg)
 
 if(mxPage.get() == )
 {
-if(!pUndoGroup)
+if(!m_pUndoGroup)
 {
-pUndoGroup.reset( new SdrUndoGroup(m_rMod) );
+m_pUndoGroup.reset( new SdrUndoGroup(m_rMod) );
 }
 
-
pUndoGroup->AddAction(m_rMod.GetSdrUndoFactory().CreateUndoPageRemoveMasterPage(*pDrawPage));
+
m_pUndoGroup->AddAction(m_rMod.GetSdrUndoFactory().CreateUndoPageRemoveMasterPage(*pDrawPage));
 }
 }
 }
@@ -1428,10 +1428,10 @@ void SdrUndoDelPage::Undo()
 if (bool(mpFillBitmapItem))
 restoreFillBitmap();
 ImpInsertPage(nPageNum);
-if (pUndoGroup!=nullptr)
+if (m_pUndoGroup!=nullptr)
 {
 // recover master page relationships
-pUndoGroup->Undo();
+m_pUndoGroup->Undo();
 }
 }
 


core.git: sw/qa sw/source

2024-05-21 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx  | 
  26 ++
 sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx 
|binary
 sw/source/writerfilter/filter/WriterFilter.cxx   | 
   1 
 3 files changed, 27 insertions(+)

New commits:
commit 1ae5ea3f78cca11ba18f2dd1a06f875263336a3b
Author: Miklos Vajna 
AuthorDate: Tue May 21 08:15:53 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 21 10:42:40 2024 +0200

tdf#160984 sw continuous endnotes: enable DOCX import

This was working for DOC already.

For DOCX, this was already enabled once with commit
f9982c24066d6dd2f938cc20176af0f196bc018f (tdf#58521 DOCX import: enable
ContinuousEndnotes compat flag, 2021-07-13), but then it was reverted
later with commit commit eeda1b35a6e87d5349545464da33d997c52f15e3
(Revert "tdf#58521 DOCX import: enable ContinuousEndnotes compat flag",
2021-08-10), because of tdf#143456.

Enable it again, now that the section-based layout seems good enough to
handle larger number of endnotes, e.g. the 48 endnotes from tdf#143456.

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

diff --git a/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx 
b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
index 10b8cab57a45..e084f0fa52ee 100644
--- a/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
+++ b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
@@ -50,6 +50,32 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjs)
 // i.e. the shape was on the left margin.
 CPPUNIT_ASSERT_GREATER(nBodyRight, nShapeLeft);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnoteDOCX)
+{
+// Given a DOCX file with an endnote and then a footnote:
+loadFromFile(u"inline-endnote-and-footnote.docx");
+
+// When laying out that document:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+css::uno::Reference xDumper(xModel->getCurrentController(), 
uno::UNO_QUERY);
+OString aDump = xDumper->dump("layout").toUtf8();
+auto pCharBuffer = reinterpret_cast(aDump.getStr());
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer));
+
+// Then make sure the footnote is below the endnote:
+// Without the accompanying fix in place, this test would have failed with:
+// - xpath should match exactly 1 node
+// i.e. the endnote was also in the footnote container, not at the end of 
the body text.
+sal_Int32 nEndnoteTop
+= getXPath(pXmlDoc, 
"/root/page/body/section/column/ftncont/ftn/infos/bounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+sal_Int32 nFootnoteTop
+= getXPath(pXmlDoc, "/root/page/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+// Endnote at the end of body text, footnote at page bottom.
+CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git 
a/sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx 
b/sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx
new file mode 100644
index ..84343b8afa45
Binary files /dev/null and 
b/sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx 
differ
diff --git a/sw/source/writerfilter/filter/WriterFilter.cxx 
b/sw/source/writerfilter/filter/WriterFilter.cxx
index 742ae2bbeee2..ee8131f95ae3 100644
--- a/sw/source/writerfilter/filter/WriterFilter.cxx
+++ b/sw/source/writerfilter/filter/WriterFilter.cxx
@@ -333,6 +333,7 @@ void WriterFilter::setTargetDocument(const 
uno::Reference& xDo
 // rely on default for HyphenateURLs=false
 // rely on default for 
APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH=true
 xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true));
+xSettings->setPropertyValue("ContinuousEndnotes", uno::Any(true));
 }
 
 void WriterFilter::setSourceDocument(const uno::Reference& 
xDoc)


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

2024-05-17 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 63ba90e6aea1554d6ee2d50b9439312a4b7ee483
Author: Miklos Vajna 
AuthorDate: Fri May 17 13:54:26 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri May 17 15:24:31 2024 +0200

desktop: fix warning C4100: 'pThis': unreferenced formal parameter

SAL_UNUSED_PARAMETER expands to nothing in the Windows case, though not
sure why this started to matter only now.

Change-Id: I7f7369c650af0585cb742c1fb4e7a111e270df63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167775
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8edd138cc907..a61eb3ff0879 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7289,7 +7289,7 @@ static void doc_setViewTimezone(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* /*p
 }
 }
 
-static void doc_setViewReadOnly(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* 
pThis, int nId, const bool readOnly)
+static void doc_setViewReadOnly(LibreOfficeKitDocument* /*pThis*/, int nId, 
const bool readOnly)
 {
 comphelper::ProfileZone aZone("doc_setViewReadOnly");
 
@@ -7299,7 +7299,7 @@ static void doc_setViewReadOnly(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* pTh
 SfxLokHelper::setViewReadOnly(nId, readOnly);
 }
 
-static void doc_setAllowChangeComments(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* pThis, int nId, const bool allow)
+static void doc_setAllowChangeComments(LibreOfficeKitDocument* /*pThis*/, int 
nId, const bool allow)
 {
 comphelper::ProfileZone aZone("doc_setAllowChangeComments");
 


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-17 Thread Miklos Vajna (via logerrit)
 sw/qa/filter/ww8/ww8.cxx  |7 ++-
 sw/source/core/inc/frame.hxx  |3 +++
 sw/source/core/layout/findfrm.cxx |   11 +++
 sw/source/filter/ww8/ww8par.cxx   |7 ---
 4 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 135e86e7e3bafdb0ab39a372a989854eefefe30c
Author: Miklos Vajna 
AuthorDate: Thu May 16 08:46:36 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri May 17 12:03:49 2024 +0200

tdf#160984 sw continuous endnotes, DOC import: enable this unconditionally

DOC files with <= 2 endnotes were imported fine, but not if they had
more endnotes.

This was added in commit dc11f5b151e1a2ea2623fc8cf806a400763955d9
(tdf#143445 DOC import: limit the usage of the CONTINUOUS_ENDNOTES
compat flag, 2023-05-23), because mapping endnotes to footnotes was a
dead-end.

The limitation can be dropped: I checked that the tdf#143445 bugdoc with
all its 72 endnotes is laid out reasonably.

Also add a new SwFrame::DynCastColumnFrame() to easily get a column
frame from a frame using our own RTTI, if we have it anyway.

(cherry picked from commit d74fb6b571304b41c13b7a6dcdd2b853bfca7210)

Change-Id: If7fd856f5dc5f1feb1366fca69a2ad6b3602044d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167763
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index af19051a03e5..4cbbfe5fbf31 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -30,6 +30,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace
 {
@@ -298,7 +300,10 @@ CPPUNIT_TEST_FIXTURE(Test, test3Endnotes)
 SwDoc* pDoc = getSwDoc();
 SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
 SwPageFrame* pPage = pLayout->GetLastPage();
-SwFootnoteContFrame* pFootnoteCont = pPage->FindFootnoteCont();
+SwContentFrame* pLastContent = pPage->FindLastBodyContent();
+SwFrame* pSectionFrame = pLastContent->GetNext();
+auto pColumnFrame = pSectionFrame->GetLower()->DynCastColumnFrame();
+SwFootnoteContFrame* pFootnoteCont = pColumnFrame->FindFootnoteCont();
 int nEndnotes = 0;
 for (SwFrame* pLower = pFootnoteCont->GetLower(); pLower; pLower = 
pLower->GetNext())
 {
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index a86358508182..b662adc89086 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -40,6 +40,7 @@ namespace drawinglayer::processor2d { class BaseProcessor2D; }
 class SwLayoutFrame;
 class SwRootFrame;
 class SwPageFrame;
+class SwColumnFrame;
 class SwBodyFrame;
 class SwFlyFrame;
 class SwSectionFrame;
@@ -876,6 +877,8 @@ public:
 const SwTextFrame* DynCastTextFrame() const;
 SwPageFrame* DynCastPageFrame();
 const SwPageFrame* DynCastPageFrame() const;
+SwColumnFrame* DynCastColumnFrame();
+const SwColumnFrame* DynCastColumnFrame() const;
 inline bool IsNoTextFrame() const;
 // Frames where its PrtArea depends on their neighbors and that are
 // positioned in the content flow
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 378e451b9f89..4efa25e553e6 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1973,4 +1974,14 @@ const SwPageFrame* SwFrame::DynCastPageFrame() const
 return IsPageFrame() ? static_cast(this) : nullptr;
 }
 
+SwColumnFrame* SwFrame::DynCastColumnFrame()
+{
+return IsColumnFrame() ? static_cast(this) : nullptr;
+}
+
+const SwColumnFrame* SwFrame::DynCastColumnFrame() const
+{
+return IsColumnFrame() ? static_cast(this) : nullptr;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index c88990a5f663..3f18c2058122 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5195,13 +5195,6 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const 
*pGloss)
 if( m_xWDop->nEdn )
 aInfo.m_nFootnoteOffset = m_xWDop->nEdn - 1;
 m_rDoc.SetEndNoteInfo( aInfo );
-
-if (m_xSBase->GetEndnoteCount() > 2)
-{
-// This compatibility flag only works in easy cases, disable it 
for anything non-trivial
-// for now.
-
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, 
false);
-}
 }
 
 if (m_xWwFib->m_lcbPlcfhdd)


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

2024-05-17 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/calcmove.cxx   |   24 +++
 sw/qa/core/layout/data/ignore-top-margin-fly.odt |binary
 sw/source/core/layout/calcmove.cxx   |6 +
 3 files changed, 30 insertions(+)

New commits:
commit 9b508c45a7c30a5c1847b7d93f2a26a653102588
Author: Miklos Vajna 
AuthorDate: Fri May 17 08:07:23 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 17 11:00:10 2024 +0200

tdf#160952 sw: ignore top margin only at page top, not in fly

See

<https://gerrit.libreoffice.org/c/core/+/167671/2#message-8603b129dd8bd72608259571056ded950182ca96>,
multi-column shape text can't appear in DOCX files, so collapsing upper
spacing in that case is not correct, avoid it.

Change-Id: Icf69c8d84fdd15d6e3289ff614b2f6ba7cee1e0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167758
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit b969e692000f50aafacc2eb577f545b8836dcc26)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167683
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
index a44dc1256b83..ad53df9bd0f4 100644
--- a/sw/qa/core/layout/calcmove.cxx
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -58,6 +58,30 @@ CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginTable)
 // i.e. the top margin in B1's first paragraph was ignored, but not in 
Word.
 CPPUNIT_ASSERT_EQUAL(static_cast(2000), nParaTopMargin);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginFly)
+{
+// Given a document with compat flags like DOCX (>= Word 2013), 2 pages, 
multi-col fly frame on
+// page 2:
+createSwDoc("ignore-top-margin-fly.odt");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure that the top margin is not ignored inside shape text:
+sal_Int32 nParaTopMargin
+= getXPath(
+  pXmlDoc,
+  
"/root/page[2]/body/section/column[2]/body/txt/anchored/fly/column/body/txt/infos/prtBounds"_ostr,
+  "top"_ostr)
+  .toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 4000
+// - Actual  : 0
+// i.e. the top margin was ignored inside shape text for Word compat, 
while multi-col shape text
+// is a Writer feature.
+CPPUNIT_ASSERT_EQUAL(static_cast(4000), nParaTopMargin);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin-fly.odt 
b/sw/qa/core/layout/data/ignore-top-margin-fly.odt
new file mode 100644
index ..51bda8fe40a9
Binary files /dev/null and b/sw/qa/core/layout/data/ignore-top-margin-fly.odt 
differ
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 63c774c25cd6..f358d74af0bd 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1092,6 +1092,12 @@ bool SwFrame::IsCollapseUpper() const
 return false;
 }
 
+if (IsInFly())
+{
+// Not in a page's body.
+return false;
+}
+
 // Word >= 2013 style: when we're at the top of the page's body, but not 
on the first page, then
 // ignore the upper margin for paragraphs.
 if (GetPrev() || !GetUpper() || !GetUpper()->IsBodyFrame())


core.git: sw/qa sw/source

2024-05-17 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/calcmove.cxx   |   24 +++
 sw/qa/core/layout/data/ignore-top-margin-fly.odt |binary
 sw/source/core/layout/calcmove.cxx   |6 +
 3 files changed, 30 insertions(+)

New commits:
commit b969e692000f50aafacc2eb577f545b8836dcc26
Author: Miklos Vajna 
AuthorDate: Fri May 17 08:07:23 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 17 09:21:37 2024 +0200

tdf#160952 sw: ignore top margin only at page top, not in fly

See

<https://gerrit.libreoffice.org/c/core/+/167671/2#message-8603b129dd8bd72608259571056ded950182ca96>,
multi-column shape text can't appear in DOCX files, so collapsing upper
spacing in that case is not correct, avoid it.

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

diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
index a44dc1256b83..ad53df9bd0f4 100644
--- a/sw/qa/core/layout/calcmove.cxx
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -58,6 +58,30 @@ CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginTable)
 // i.e. the top margin in B1's first paragraph was ignored, but not in 
Word.
 CPPUNIT_ASSERT_EQUAL(static_cast(2000), nParaTopMargin);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginFly)
+{
+// Given a document with compat flags like DOCX (>= Word 2013), 2 pages, 
multi-col fly frame on
+// page 2:
+createSwDoc("ignore-top-margin-fly.odt");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure that the top margin is not ignored inside shape text:
+sal_Int32 nParaTopMargin
+= getXPath(
+  pXmlDoc,
+  
"/root/page[2]/body/section/column[2]/body/txt/anchored/fly/column/body/txt/infos/prtBounds"_ostr,
+  "top"_ostr)
+  .toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 4000
+// - Actual  : 0
+// i.e. the top margin was ignored inside shape text for Word compat, 
while multi-col shape text
+// is a Writer feature.
+CPPUNIT_ASSERT_EQUAL(static_cast(4000), nParaTopMargin);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin-fly.odt 
b/sw/qa/core/layout/data/ignore-top-margin-fly.odt
new file mode 100644
index ..51bda8fe40a9
Binary files /dev/null and b/sw/qa/core/layout/data/ignore-top-margin-fly.odt 
differ
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index ea27716aaeed..6e8112308002 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1092,6 +1092,12 @@ bool SwFrame::IsCollapseUpper() const
 return false;
 }
 
+if (IsInFly())
+{
+// Not in a page's body.
+return false;
+}
+
 // Word >= 2013 style: when we're at the top of the page's body, but not 
on the first page, then
 // ignore the upper margin for paragraphs.
 if (GetPrev() || !GetUpper() || !GetUpper()->IsBodyFrame())


ESC meeting minutes: 2024-05-16

2024-05-16 Thread Miklos Vajna

* Present:
+ Heiko, Olivier, Thorsten, Cloph, Hossein, Ilmari, Jonathan, Michael W, 
Xisco, Michael S, Caolan, Stephane, Miklos

* Completed Action Items:
+ tdf#99528 Vertical tabs: invite Samuel next week if there are still 
burning fires (Heiko)
  + Samuel says not needed
  + revert for 24.8 if needed
  + unfortunately couldn't make it to the call (Thorsten)
  + the intention is to fix this, so it doesn't look broken
  + suggest to have a week before UI freeze to see where we are
  + original idea came from UX
  + afraid to wait for too long (Heiko)
  + if the change is controversial, agree (Thorsten)
+ if desirable: try to fix it
+ committed to put some effort into this
+ no very strong opinion on this
  + 4 high severity bugs for this topic so far (Xisco)
+ feels broken in its current state (Heiko)
  + except on gtk3
  + suggest to review the state in 2 weeks and see the direction (Miklos)
  + like the idea + a recurring item (Xisco)
+ send welcome mail for Jonathan (Xisco)
+ enable the commit bit for Jonathan (Cloph)
* Pending Action Items:

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC1 this week, today evening
+ 24.8: alpha was tagged earlier this week
+ feature freeze in 3 weeks
+ string / UI freeze 4 weeks after that
+ bug with Linux packaging: missing mapping, locally patched for now
  + if you have a late feature proposal, announce that here
  + MAR updater:
+ 2 channels?
+ keep on the old channel as long as possible?
+ update to the new channel as soon as possible?
+ stick to how the old update notification did it?
+ could also provide a dummy update to stop updates
+ context (Thorsten)
  + plan: 24.8 is enabled by default, without any user interaction
  + channel name is baked into the version
  + can tell people to edit some files
  + easiest is to decide on one policy and go with that
  + if we stop supporting a Windows version, there is no good option to 
do that
+ least bad: product is discontinued, then no obligation to have 
working LO there
+ perhaps update Windows requirement for 24.8, then we're good for 
the next few years
+ last time an ICU update triggered the Windows bump (Cloph)
  + concern: we ship an update then the new version can't be launched 
anymore
  + or only partially
  + if we stick to just 1 policy, then dummy update is a trick
+ if the update check sends OS info, it's easier
+ if single channel, which variant to use? (Cloph)
  + switch later, sooner, something in-between?
  + play it safe and start with the in-branch update first and only do 
major updates in the next cycle?
+ what browsers do (Hossein)
  + Chrome has 3 channels: stable, dev, canary
  + Firefox: minor versions (automatic) and then a major version 
(manually)
+ and now just similar to Chrome (automatic for all)
  + look at if this is relevant for us
  + browers always try to get to the latest (Thorsten)
  + for us: when a major update the least distruptive
  + can decide later when to cross-update (Cloph)
+ mid-cycle or when EOL is reached?
  + care about: the expecation is that EOL version is automatically 
updated (Thorsten)
+ stop running unmaintained, insecure software
  + run update in the background, then user decides if update now or 
later? (Hossein)
+ strongly feel against the idea of keep running insecure version 
(Thorsten)
+ default should be to update (unless you go via tools -> options)
+ agree, default to update is good (Hossein)
  + include OS info in the user agent? (Cloph)
+ like the idea (Thorsten)
AI: do this or file a bug to do it (Cloph)

* Documentation (Olivier)
+ Helpcontent2
   + Help for RANDARRAY (ohallot, fito, Balasz)
   + Updates and fixes (ohallot)
+ Extended tips
   + Calc option view page (D. Maddern)
+ Guides
   + Work in progress.
   + IMpress 24.2 soon to be announced
+ Bugzilla Documentation statistics
257(257) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 12(-2)   46(7) 107(0) 220(-5)
 commented 12(-8)   70(9) 245(-10)   837(-17)
  resolved  6(-1)   28(5)  57(3) 123(2)
+ top 10 contributors:
  Olivier Hallot made 58 changes in 1 month, and 242 changes in 1 year
  Stéphane Guillou made 31 changes in 1 month, and 237 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 106 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  

ESC meeting minutes: 2024-05-16

2024-05-16 Thread Miklos Vajna

* Present:
+ Heiko, Olivier, Thorsten, Cloph, Hossein, Ilmari, Jonathan, Michael W, 
Xisco, Michael S, Caolan, Stephane, Miklos

* Completed Action Items:
+ tdf#99528 Vertical tabs: invite Samuel next week if there are still 
burning fires (Heiko)
  + Samuel says not needed
  + revert for 24.8 if needed
  + unfortunately couldn't make it to the call (Thorsten)
  + the intention is to fix this, so it doesn't look broken
  + suggest to have a week before UI freeze to see where we are
  + original idea came from UX
  + afraid to wait for too long (Heiko)
  + if the change is controversial, agree (Thorsten)
+ if desirable: try to fix it
+ committed to put some effort into this
+ no very strong opinion on this
  + 4 high severity bugs for this topic so far (Xisco)
+ feels broken in its current state (Heiko)
  + except on gtk3
  + suggest to review the state in 2 weeks and see the direction (Miklos)
  + like the idea + a recurring item (Xisco)
+ send welcome mail for Jonathan (Xisco)
+ enable the commit bit for Jonathan (Cloph)
* Pending Action Items:

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC1 this week, today evening
+ 24.8: alpha was tagged earlier this week
+ feature freeze in 3 weeks
+ string / UI freeze 4 weeks after that
+ bug with Linux packaging: missing mapping, locally patched for now
  + if you have a late feature proposal, announce that here
  + MAR updater:
+ 2 channels?
+ keep on the old channel as long as possible?
+ update to the new channel as soon as possible?
+ stick to how the old update notification did it?
+ could also provide a dummy update to stop updates
+ context (Thorsten)
  + plan: 24.8 is enabled by default, without any user interaction
  + channel name is baked into the version
  + can tell people to edit some files
  + easiest is to decide on one policy and go with that
  + if we stop supporting a Windows version, there is no good option to 
do that
+ least bad: product is discontinued, then no obligation to have 
working LO there
+ perhaps update Windows requirement for 24.8, then we're good for 
the next few years
+ last time an ICU update triggered the Windows bump (Cloph)
  + concern: we ship an update then the new version can't be launched 
anymore
  + or only partially
  + if we stick to just 1 policy, then dummy update is a trick
+ if the update check sends OS info, it's easier
+ if single channel, which variant to use? (Cloph)
  + switch later, sooner, something in-between?
  + play it safe and start with the in-branch update first and only do 
major updates in the next cycle?
+ what browsers do (Hossein)
  + Chrome has 3 channels: stable, dev, canary
  + Firefox: minor versions (automatic) and then a major version 
(manually)
+ and now just similar to Chrome (automatic for all)
  + look at if this is relevant for us
  + browers always try to get to the latest (Thorsten)
  + for us: when a major update the least distruptive
  + can decide later when to cross-update (Cloph)
+ mid-cycle or when EOL is reached?
  + care about: the expecation is that EOL version is automatically 
updated (Thorsten)
+ stop running unmaintained, insecure software
  + run update in the background, then user decides if update now or 
later? (Hossein)
+ strongly feel against the idea of keep running insecure version 
(Thorsten)
+ default should be to update (unless you go via tools -> options)
+ agree, default to update is good (Hossein)
  + include OS info in the user agent? (Cloph)
+ like the idea (Thorsten)
AI: do this or file a bug to do it (Cloph)

* Documentation (Olivier)
+ Helpcontent2
   + Help for RANDARRAY (ohallot, fito, Balasz)
   + Updates and fixes (ohallot)
+ Extended tips
   + Calc option view page (D. Maddern)
+ Guides
   + Work in progress.
   + IMpress 24.2 soon to be announced
+ Bugzilla Documentation statistics
257(257) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 12(-2)   46(7) 107(0) 220(-5)
 commented 12(-8)   70(9) 245(-10)   837(-17)
  resolved  6(-1)   28(5)  57(3) 123(2)
+ top 10 contributors:
  Olivier Hallot made 58 changes in 1 month, and 242 changes in 1 year
  Stéphane Guillou made 31 changes in 1 month, and 237 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 106 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-16 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-and-section.odt |binary
 sw/qa/core/layout/ftnfrm.cxx  |   18 ++
 sw/source/core/layout/ftnfrm.cxx  |   16 +++-
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit a8216967ebe242c379b7df1267836c4ec5a566a4
Author: Miklos Vajna 
AuthorDate: Wed May 15 13:25:13 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 16 16:02:17 2024 +0200

tdf#161083 sw continuous endnotes: fix layout with a section at doc end

Open the bugdoc, notice warnings like:

warn:legacy.osl:15059:15059:sw/source/core/layout/wsfrm.cxx:910: Frame tree 
is inconsistent.

Which means we try to insert the new section frame under body frame, but
the insert point is behind a frame which is not a direct child of the
body frame.

This went wrong in commit 6885dcd7ec7b82a946d8344bfc27a3e88eecc44a
(tdf#160984 sw continuous endnotes: switch to a section-based layout,
2024-05-14), where I didn't consider the case of having a continuous
section break at the Word doc end, which maps to a section frame before
the section frame of the endnotes in Writer.

Fix the problem by walking up the parent chain till we find the last
direct child of the body frame, which is typically not required, except
when having one or more (nested) section frames at the end of the
document.

Interestingly tdf#143456 had the same problem, which was the bugdoc to
trigger the revert of the old continuous endnotes code for DOCX in
eeda1b35a6e87d5349545464da33d997c52f15e3 (Revert "tdf#58521 DOCX import:
enable ContinuousEndnotes compat flag", 2021-08-10).

(cherry picked from commit 82dd81a9d2049ac95535880fc67c1867f90e1427)

Change-Id: I664672b91087217008a42120e8201c39e2a0a423
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167728
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/core/layout/data/inline-endnote-and-section.odt 
b/sw/qa/core/layout/data/inline-endnote-and-section.odt
new file mode 100644
index ..4518904f6009
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-and-section.odt differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 71fd3fd67150..1cf31809e5a7 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -84,4 +84,22 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnote)
 CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndSection)
+{
+// Given a document ending with a section, ContinuousEndnotes is true:
+createSwDoc("inline-endnote-and-section.odt");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the endnote section is after the section at the end of 
the document, not
+// inside it:
+int nToplevelSections = countXPathNodes(pXmlDoc, 
"/root/page/body/section"_ostr);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 1
+// and we even crashed on shutdown.
+CPPUNIT_ASSERT_EQUAL(2, nToplevelSections);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 4be87ee57ccd..61a8385d51fc 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1560,7 +1560,21 @@ void SwFootnoteBossFrame::AppendFootnote( SwContentFrame 
*pRef, SwTextFootnote *
 {
 SwSection* pSwSection = 
pDoc->GetEndNoteInfo().GetSwSection(*pDoc);
 pEndnoteSection = new SwSectionFrame(*pSwSection, pPage);
-pEndnoteSection->InsertBehind(pPage->FindBodyCont(), 
pPage->FindLastBodyContent());
+SwLayoutFrame* pParent = pPage->FindBodyCont();
+SwFrame* pBefore = pPage->FindLastBodyContent();
+while (pBefore)
+{
+// Check if the last content frame is directly under the 
body frame or there is
+// something in-between, e.g. a section frame.
+if (pBefore->GetUpper() == pParent)
+{
+break;
+}
+
+// If so, insert behind the parent of the content frame, 
not inside the parent.
+pBefore = pBefore->GetUpper();
+}
+pEndnoteSection->InsertBehind(pParent, pBefore);
 pEndnoteSection->Init();
 pEndnoteSection->SetEndNoteSection(true);
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-16 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-and-footnote.doc |binary
 sw/qa/core/layout/ftnfrm.cxx   |   21 +++
 sw/source/core/layout/flowfrm.cxx  |   37 -
 sw/source/core/layout/ftnfrm.cxx   |   45 ++---
 sw/source/core/text/txtftn.cxx |   10 ---
 5 files changed, 83 insertions(+), 30 deletions(-)

New commits:
commit ad3586d6c6b03d588a45610e1f091f83b16b83a2
Author: Miklos Vajna 
AuthorDate: Tue May 14 08:28:33 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 16 15:57:41 2024 +0200

tdf#160984 sw continuous endnotes: switch to a section-based layout

The original layout added in commit
4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add
ContinuousEndnotes layout compat option, 2019-09-30) puts endnotes to
the footnote container on the last page, which fixes the page count but
the endnote position is wrong: should be after the body text, not at the
bottom of the page.

Now that we can have an endnote section (with one or more section frames
at a layout level), we have a container that can span over multiple
pages, is at the end of the document and is inline.

Fix the bad position by:

1) Reverting the layout changes from the old approach, which gives us a
   bad position for the endnote.

2) Creating an endnote section frame on demand in
   SwFootnoteBossFrame::AppendFootnote().

3) Moving part of the endnote to a next page works out of the box, but
   moving part of the endnote to a previous page needs explicit handling
   in SwFlowFrame::MoveBwd(), similar to how SwFrame::GetPrevSctLeaf()
   does this in the simple section case. This needs explicit handling,
   because the body frame of the endnote section is empty, all content goes
   to its endnote container.

Note that this just reimplements the compat flag, but its enablement
(only for DOC import, only for <= 2 endnotes) stays unchanged for now.

(cherry picked from commit 6885dcd7ec7b82a946d8344bfc27a3e88eecc44a)

Change-Id: I8b271895aeff378418aed8705fe6b99a69232bd2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167727
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/layout/data/inline-endnote-and-footnote.doc 
b/sw/qa/core/layout/data/inline-endnote-and-footnote.doc
new file mode 100644
index ..39c5636e1e12
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-and-footnote.doc differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 4c874202da3f..71fd3fd67150 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -63,4 +63,25 @@ CPPUNIT_TEST_FIXTURE(Test, testFlySplitFootnoteLayout)
 CPPUNIT_ASSERT(pPage->FindFootnoteCont());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnote)
+{
+// Given a DOC file with an endnote and then a footnote:
+createSwDoc("inline-endnote-and-footnote.doc");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the footnote is below the endnote:
+// Without the accompanying fix in place, this test would have failed with:
+// - xpath should match exactly 1 node
+// i.e. the endnote was also in the footnote container, not at the end of 
the body text.
+sal_Int32 nEndnoteTop
+= 
parseDump("/root/page/body/section/column/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr)
+  .toInt32();
+sal_Int32 nFootnoteTop
+= parseDump("/root/page/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+// Endnote at the end of body text, footnote at page bottom.
+CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 37fd20b323d7..1cb5cf7bf47a 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2257,18 +2257,47 @@ bool SwFlowFrame::MoveBwd( bool  )
 const bool bEndnote = pFootnote->GetAttr()->GetFootnote().IsEndNote();
 const IDocumentSettingAccess& rSettings
 = pFootnote->GetAttrSet()->GetDoc()->getIDocumentSettingAccess();
-if( bEndnote && pFootnote->IsInSct() )
+bool bContEndnotes = 
rSettings.get(DocumentSettingId::CONTINUOUS_ENDNOTES);
+if( bEndnote && pFootnote->IsInSct() && !bContEndnotes)
 {
 SwSectionFrame* pSect = pFootnote->FindSctFrame();
 if( pSect->IsEndnAtEnd() )
 // Endnotes at the end of the section.
 pRef = pSect->FindLastContent( SwFindMode::LastCnt

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

2024-05-16 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/calcmove.cxx  |   19 +++
 sw/qa/core/layout/data/ignore-top-margin-table.docx |binary
 sw/source/core/layout/calcmove.cxx  |6 +++---
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit ed4316d109841c31de49493092d82b40259e818a
Author: Miklos Vajna 
AuthorDate: Tue May 14 13:49:51 2024 +0200
Commit: Michael Stahl 
CommitDate: Thu May 16 09:40:52 2024 +0200

tdf#160952 sw: ignore top margin only at page top, not e.g. table top

The bugdoc has a table at the top of the 2nd page and we ignored the top
margin inside the table cell (for the first paragraph), while this
doesn't happen in Word.

As mentioned at

<https://gerrit.libreoffice.org/c/core/+/167221/3#message-c03abf8e8e3cd20d49006058e6b3eb130585ff8f>,
the old code assumed "top of the page" for all frames not having a
previous frame, while that code was only tested with text frames
directly in the body frame of a page frame.

Fix the problem by limiting this "collapse upper spacing" behavior to
frames directly in body frames. This keeps the old bugdoc working, but
is meant to restore the old, wanted behavior in other cases like e.g. in
table cells.

If later it's discovered that upper spacing collapsing is wanted in
other contexts, those are best added on a case by case basis.

Change-Id: Ieb93facd8b2e7f6412fd20873c10ce6c8b775619
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167631
    Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 6025ac371bd5cd07c0af550d78db323ad394173b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167671
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
index 3e4deec52ae8..a44dc1256b83 100644
--- a/sw/qa/core/layout/calcmove.cxx
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -39,6 +39,25 @@ CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMargin)
 // i.e. the top margin in the first para of a non-first page wasn't 
ignored, like in Word.
 CPPUNIT_ASSERT_EQUAL(static_cast(0), nParaTopMargin);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginTable)
+{
+// Given a DOCX (>= Word 2013) file, with 2 pages:
+// When loading that document:
+createSwDoc("ignore-top-margin-table.docx");
+
+// Then make sure that the paragraph on the 2nd page in B1 has a top 
margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, 
"/root/page[2]/body/tab/row/cell[2]/txt/infos/prtBounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2000
+// - Actual  : 0
+// i.e. the top margin in B1's first paragraph was ignored, but not in 
Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(2000), nParaTopMargin);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin-table.docx 
b/sw/qa/core/layout/data/ignore-top-margin-table.docx
new file mode 100644
index ..c82f6d63c13f
Binary files /dev/null and 
b/sw/qa/core/layout/data/ignore-top-margin-table.docx differ
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 081472b98ee3..63c774c25cd6 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1092,9 +1092,9 @@ bool SwFrame::IsCollapseUpper() const
 return false;
 }
 
-// Word >= 2013 style: when we're at the top of the page, but not on the 
first page, then ignore
-// the upper margin for paragraphs.
-if (GetPrev())
+// Word >= 2013 style: when we're at the top of the page's body, but not 
on the first page, then
+// ignore the upper margin for paragraphs.
+if (GetPrev() || !GetUpper() || !GetUpper()->IsBodyFrame())
 {
 return false;
 }


core.git: sw/qa

2024-05-16 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfexport/rtfexport7.cxx | 1348 --
 1 file changed, 822 insertions(+), 526 deletions(-)

New commits:
commit 55eb6fc8b83fe2f846a4f7448271a5b0fe03fbfc
Author: Miklos Vajna 
AuthorDate: Thu May 16 08:00:20 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 16 08:48:06 2024 +0200

CppunitTest_sw_rtfexport7: avoid DECLARE_RTFEXPORT_TEST

No need to go via Writer-specific macros here.

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

diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx 
b/sw/qa/extras/rtfexport/rtfexport7.cxx
index d0803d6bcb74..57162cf30df1 100644
--- a/sw/qa/extras/rtfexport/rtfexport7.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport7.cxx
@@ -43,29 +43,41 @@ public:
 }
 };
 
-DECLARE_RTFEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testPictureWrapPolygon)
 {
-// The problem was that the wrap polygon was ignored during import.
-drawing::PointSequenceSequence aSeqSeq
-= getProperty(getShape(1), 
"ContourPolyPolygon");
-// This was 0: the polygon list was empty.
-CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
-
-drawing::PointSequence aSeq = aSeqSeq[0];
-CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
-
-// The shape also didn't have negative top / left coordinates.
-CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-1177)),
- getProperty(getShape(1), 
"HoriOrientPosition"));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)),
- getProperty(getShape(1), 
"VertOrientPosition"));
+auto verify = [this]() {
+// The problem was that the wrap polygon was ignored during import.
+drawing::PointSequenceSequence aSeqSeq
+= getProperty(getShape(1), 
"ContourPolyPolygon");
+// This was 0: the polygon list was empty.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
+
+drawing::PointSequence aSeq = aSeqSeq[0];
+CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
+
+// The shape also didn't have negative top / left coordinates.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-1177)),
+ getProperty(getShape(1), 
"HoriOrientPosition"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)),
+ getProperty(getShape(1), 
"VertOrientPosition"));
+};
+createSwDoc("picture-wrap-polygon.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf113408, "tdf113408.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf113408)
 {
-// This was 0, left margin was not inherited from style properly.
-CPPUNIT_ASSERT_EQUAL(static_cast(1270),
- getProperty(getParagraph(1), 
"ParaLeftMargin"));
+auto verify = [this]() {
+// This was 0, left margin was not inherited from style properly.
+CPPUNIT_ASSERT_EQUAL(static_cast(1270),
+ getProperty(getParagraph(1), 
"ParaLeftMargin"));
+};
+createSwDoc("tdf113408.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testAbi10039)
@@ -85,30 +97,42 @@ CPPUNIT_TEST_FIXTURE(Test, testAbi10076)
 // Just make sure that we don't crash after exporting a fully calculated 
layout.
 }
 
-DECLARE_RTFEXPORT_TEST(testEm, "em.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testEm)
 {
-// Test all possible cc* control words.
-CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE,
- getProperty(getRun(getParagraph(1), 1), 
"CharEmphasis"));
-CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE,
- getProperty(getRun(getParagraph(1), 2), 
"CharEmphasis"));
-CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::ACCENT_ABOVE,
- getProperty(getRun(getParagraph(1), 3), 
"CharEmphasis"));
-// This was missing.
-CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::CIRCLE_ABOVE,
- getProperty(getRun(getParagraph(1), 4), 
"CharEmphasis"));
-// This one, too.
-CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_BELOW,
- getProperty(getRun(getParagraph(1), 5), 
"CharEmphasis"));
+auto verify = [this]() {
+// Test all possible cc* control words.
+CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::NONE,
+ getProperty(getRun(getParagraph(1), 
1), "CharEmphasis"));
+CPPUNIT_ASSERT_EQUAL(text::FontEmphasis::DOT_ABOVE,
+ getProperty(getRun(getParagraph(1), 
2), "Cha

core.git: sw/qa sw/source

2024-05-15 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-and-section.odt |binary
 sw/qa/core/layout/ftnfrm.cxx  |   18 ++
 sw/source/core/layout/ftnfrm.cxx  |   16 +++-
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 82dd81a9d2049ac95535880fc67c1867f90e1427
Author: Miklos Vajna 
AuthorDate: Wed May 15 13:25:13 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 15 16:54:05 2024 +0200

tdf#161083 sw continuous endnotes: fix layout with a section at doc end

Open the bugdoc, notice warnings like:

warn:legacy.osl:15059:15059:sw/source/core/layout/wsfrm.cxx:910: Frame tree 
is inconsistent.

Which means we try to insert the new section frame under body frame, but
the insert point is behind a frame which is not a direct child of the
body frame.

This went wrong in commit 6885dcd7ec7b82a946d8344bfc27a3e88eecc44a
(tdf#160984 sw continuous endnotes: switch to a section-based layout,
2024-05-14), where I didn't consider the case of having a continuous
section break at the Word doc end, which maps to a section frame before
the section frame of the endnotes in Writer.

Fix the problem by walking up the parent chain till we find the last
direct child of the body frame, which is typically not required, except
when having one or more (nested) section frames at the end of the
document.

Interestingly tdf#143456 had the same problem, which was the bugdoc to
trigger the revert of the old continuous endnotes code for DOCX in
eeda1b35a6e87d5349545464da33d997c52f15e3 (Revert "tdf#58521 DOCX import:
enable ContinuousEndnotes compat flag", 2021-08-10).

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

diff --git a/sw/qa/core/layout/data/inline-endnote-and-section.odt 
b/sw/qa/core/layout/data/inline-endnote-and-section.odt
new file mode 100644
index ..4518904f6009
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-and-section.odt differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 71fd3fd67150..1cf31809e5a7 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -84,4 +84,22 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnote)
 CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndSection)
+{
+// Given a document ending with a section, ContinuousEndnotes is true:
+createSwDoc("inline-endnote-and-section.odt");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the endnote section is after the section at the end of 
the document, not
+// inside it:
+int nToplevelSections = countXPathNodes(pXmlDoc, 
"/root/page/body/section"_ostr);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 1
+// and we even crashed on shutdown.
+CPPUNIT_ASSERT_EQUAL(2, nToplevelSections);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index e03519ed3040..b7851a131e44 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1585,7 +1585,21 @@ void SwFootnoteBossFrame::AppendFootnote( SwContentFrame 
*pRef, SwTextFootnote *
 {
 SwSection* pSwSection = 
pDoc->GetEndNoteInfo().GetSwSection(*pDoc);
 pEndnoteSection = new SwSectionFrame(*pSwSection, pPage);
-pEndnoteSection->InsertBehind(pPage->FindBodyCont(), 
pPage->FindLastBodyContent());
+SwLayoutFrame* pParent = pPage->FindBodyCont();
+SwFrame* pBefore = pPage->FindLastBodyContent();
+while (pBefore)
+{
+// Check if the last content frame is directly under the 
body frame or there is
+// something in-between, e.g. a section frame.
+if (pBefore->GetUpper() == pParent)
+{
+break;
+}
+
+// If so, insert behind the parent of the content frame, 
not inside the parent.
+pBefore = pBefore->GetUpper();
+}
+pEndnoteSection->InsertBehind(pParent, pBefore);
 pEndnoteSection->Init();
 pEndnoteSection->SetEndNoteSection(true);
 }


ESC meeting agenda: 2024-05-16 16:00 CEST

2024-05-15 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:
+ tdf#99528 Vertical tabs: invite Samuel next week if there are still 
burning fires (Heiko)
+ send welcome mail for Jonathan (Xisco)
+ enable the commit bit for Jonathan (Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC1 this week?
+ 24.8: feature freeze in 3 weeks
+ string / UI freeze 4 weeks after that
  + if you have a late feature proposal, announce that here

* Documentation (Olivier)
+ Bugzilla Documentation statistics
257(257) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 12(-2)   46(7) 107(0) 220(-5)
 commented 12(-8)   70(9) 245(-10)   837(-17)
  resolved  6(-1)   28(5)  57(3) 123(2)
+ top 10 contributors:
  Olivier Hallot made 58 changes in 1 month, and 242 changes in 1 year
  Stéphane Guillou made 31 changes in 1 month, and 237 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 106 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  Heiko Tietze made 7 changes in 1 month, and 77 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 74 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  nobu made 4 changes in 1 month, and 16 changes in 1 year
  Dieter made 3 changes in 1 month, and 8 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 39(39) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  7(3) 13(3) 18(3)   25(4)
 commented 60(-4)   206(20)   560(35)1757(-4)
   removed  0(0)  4(0)  5(0)   11(-1)
  resolved  8(0) 32(1) 80(1)  297(-11)
+ top 10 contributors:
  Heiko Tietze made 111 changes in 1 month, and 986 changes in 1 year
  Vernon, Stuart Foote made 105 changes in 1 month, and 329 changes in 
1 year
  Eyal Rozenberg made 45 changes in 1 month, and 160 changes in 1 year
  Stéphane Guillou made 40 changes in 1 month, and 612 changes in 1 year
  Dieter made 32 changes in 1 month, and 147 changes in 1 year
  Cor Nouws made 21 changes in 1 month, and 32 changes in 1 year
  Ilmari Lauhakangas made 12 changes in 1 month, and 129 changes in 1 
year
  Roman Kuznetsov made 9 changes in 1 month, and 45 changes in 1 year
  Olivier Hallot made 8 changes in 1 month, and 22 changes in 1 year
  Aron Budea made 6 changes in 1 month, and 22 changes in 1 year

* Crash Testing (Caolan)
+ 25(+1) import failure, 19(-1) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.1.173(+0)
+ 24.2.1.214477(+739)
+ 24.2.2.210399(+1469)
+ 24.2.3.21437(+950)

* Mentoring (Hossein)
  committer...   1 week  1 month 3 months 12 months
  open  89(8)   160(18) 160(-18)  160(-18)
   reviews 318(-132)   1250(44)3594(-124)   12458(-4)
merged 310(-40)1244(104)   3423(54) 12714(121)
 abandoned  15(2)61(6)  174(2)661(5)
   own commits 227(-23) 913(86)2380(77)  9274(45)
review commits  38(-13) 218(-6) 839(-32) 2994(-18)
contributor...   1 week 1 month 3 months12 months
  open  55(18) 103(26) 103(0)   103(0)
   reviews 894(-68)   3050(276)   7930(24)29574(52)
merged  15(-8)  86(-12)377(-8) 1583(-52)
 abandoned   0(-9)  33(-16)279(-9)  699(-5)
   own commits  14(-11) 97(-8) 429(-20)1114(-12)
review commits   0(0)0(0)0(0) 0(0)
+ easyHack statistics:
   needsDevEval 8(8)   needsUXEval 1(1)   cleanup_comments 326(326)
   total 409(409)   assigned 26(26)   open 349(349)
+ top 10 contributors:
  Jakub Kościelak made 5 patches in 1 month, and 5 patches in 1 year
made 4 patches in 1 month, and 7 patches in 1 year
  Kira Tubo made 4 patches in 1 month, and 14 patches in 1 year
  Armin Le Grand (allotropia) made 4 patches in 1 month, and 86 patches 
in 1 year
  

ESC meeting agenda: 2024-05-16 16:00 CEST

2024-05-15 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:
+ tdf#99528 Vertical tabs: invite Samuel next week if there are still 
burning fires (Heiko)
+ send welcome mail for Jonathan (Xisco)
+ enable the commit bit for Jonathan (Cloph)

* Release Engineering update (Cloph)
+ 24.2: 24.2.4 RC1 this week?
+ 24.8: feature freeze in 3 weeks
+ string / UI freeze 4 weeks after that
  + if you have a late feature proposal, announce that here

* Documentation (Olivier)
+ Bugzilla Documentation statistics
257(257) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 12(-2)   46(7) 107(0) 220(-5)
 commented 12(-8)   70(9) 245(-10)   837(-17)
  resolved  6(-1)   28(5)  57(3) 123(2)
+ top 10 contributors:
  Olivier Hallot made 58 changes in 1 month, and 242 changes in 1 year
  Stéphane Guillou made 31 changes in 1 month, and 237 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 106 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  Heiko Tietze made 7 changes in 1 month, and 77 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 74 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  nobu made 4 changes in 1 month, and 16 changes in 1 year
  Dieter made 3 changes in 1 month, and 8 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 39(39) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  7(3) 13(3) 18(3)   25(4)
 commented 60(-4)   206(20)   560(35)1757(-4)
   removed  0(0)  4(0)  5(0)   11(-1)
  resolved  8(0) 32(1) 80(1)  297(-11)
+ top 10 contributors:
  Heiko Tietze made 111 changes in 1 month, and 986 changes in 1 year
  Vernon, Stuart Foote made 105 changes in 1 month, and 329 changes in 
1 year
  Eyal Rozenberg made 45 changes in 1 month, and 160 changes in 1 year
  Stéphane Guillou made 40 changes in 1 month, and 612 changes in 1 year
  Dieter made 32 changes in 1 month, and 147 changes in 1 year
  Cor Nouws made 21 changes in 1 month, and 32 changes in 1 year
  Ilmari Lauhakangas made 12 changes in 1 month, and 129 changes in 1 
year
  Roman Kuznetsov made 9 changes in 1 month, and 45 changes in 1 year
  Olivier Hallot made 8 changes in 1 month, and 22 changes in 1 year
  Aron Budea made 6 changes in 1 month, and 22 changes in 1 year

* Crash Testing (Caolan)
+ 25(+1) import failure, 19(-1) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.1.173(+0)
+ 24.2.1.214477(+739)
+ 24.2.2.210399(+1469)
+ 24.2.3.21437(+950)

* Mentoring (Hossein)
  committer...   1 week  1 month 3 months 12 months
  open  89(8)   160(18) 160(-18)  160(-18)
   reviews 318(-132)   1250(44)3594(-124)   12458(-4)
merged 310(-40)1244(104)   3423(54) 12714(121)
 abandoned  15(2)61(6)  174(2)661(5)
   own commits 227(-23) 913(86)2380(77)  9274(45)
review commits  38(-13) 218(-6) 839(-32) 2994(-18)
contributor...   1 week 1 month 3 months12 months
  open  55(18) 103(26) 103(0)   103(0)
   reviews 894(-68)   3050(276)   7930(24)29574(52)
merged  15(-8)  86(-12)377(-8) 1583(-52)
 abandoned   0(-9)  33(-16)279(-9)  699(-5)
   own commits  14(-11) 97(-8) 429(-20)1114(-12)
review commits   0(0)0(0)0(0) 0(0)
+ easyHack statistics:
   needsDevEval 8(8)   needsUXEval 1(1)   cleanup_comments 326(326)
   total 409(409)   assigned 26(26)   open 349(349)
+ top 10 contributors:
  Jakub Kościelak made 5 patches in 1 month, and 5 patches in 1 year
made 4 patches in 1 month, and 7 patches in 1 year
  Kira Tubo made 4 patches in 1 month, and 14 patches in 1 year
  Armin Le Grand (allotropia) made 4 patches in 1 month, and 86 patches 
in 1 year
  

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-15 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/calcmove.cxx  |   19 +++
 sw/qa/core/layout/data/ignore-top-margin-table.docx |binary
 sw/source/core/layout/calcmove.cxx  |6 +++---
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 07c93a65d2c8579adb100b7ae0c312e1872a1f37
Author: Miklos Vajna 
AuthorDate: Tue May 14 13:49:51 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed May 15 13:45:49 2024 +0200

tdf#160952 sw: ignore top margin only at page top, not e.g. table top

The bugdoc has a table at the top of the 2nd page and we ignored the top
margin inside the table cell (for the first paragraph), while this
doesn't happen in Word.

As mentioned at

<https://gerrit.libreoffice.org/c/core/+/167221/3#message-c03abf8e8e3cd20d49006058e6b3eb130585ff8f>,
the old code assumed "top of the page" for all frames not having a
previous frame, while that code was only tested with text frames
directly in the body frame of a page frame.

Fix the problem by limiting this "collapse upper spacing" behavior to
frames directly in body frames. This keeps the old bugdoc working, but
is meant to restore the old, wanted behavior in other cases like e.g. in
table cells.

If later it's discovered that upper spacing collapsing is wanted in
other contexts, those are best added on a case by case basis.

(cherry picked from commit 6025ac371bd5cd07c0af550d78db323ad394173b)

Change-Id: Ieb93facd8b2e7f6412fd20873c10ce6c8b775619
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167690
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
index 3e4deec52ae8..a44dc1256b83 100644
--- a/sw/qa/core/layout/calcmove.cxx
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -39,6 +39,25 @@ CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMargin)
 // i.e. the top margin in the first para of a non-first page wasn't 
ignored, like in Word.
 CPPUNIT_ASSERT_EQUAL(static_cast(0), nParaTopMargin);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginTable)
+{
+// Given a DOCX (>= Word 2013) file, with 2 pages:
+// When loading that document:
+createSwDoc("ignore-top-margin-table.docx");
+
+// Then make sure that the paragraph on the 2nd page in B1 has a top 
margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, 
"/root/page[2]/body/tab/row/cell[2]/txt/infos/prtBounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2000
+// - Actual  : 0
+// i.e. the top margin in B1's first paragraph was ignored, but not in 
Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(2000), nParaTopMargin);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin-table.docx 
b/sw/qa/core/layout/data/ignore-top-margin-table.docx
new file mode 100644
index ..c82f6d63c13f
Binary files /dev/null and 
b/sw/qa/core/layout/data/ignore-top-margin-table.docx differ
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 081472b98ee3..63c774c25cd6 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1092,9 +1092,9 @@ bool SwFrame::IsCollapseUpper() const
 return false;
 }
 
-// Word >= 2013 style: when we're at the top of the page, but not on the 
first page, then ignore
-// the upper margin for paragraphs.
-if (GetPrev())
+// Word >= 2013 style: when we're at the top of the page's body, but not 
on the first page, then
+// ignore the upper margin for paragraphs.
+if (GetPrev() || !GetUpper() || !GetUpper()->IsBodyFrame())
 {
 return false;
 }


core.git: sw/qa sw/source

2024-05-15 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/calcmove.cxx  |   19 +++
 sw/qa/core/layout/data/ignore-top-margin-table.docx |binary
 sw/source/core/layout/calcmove.cxx  |6 +++---
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 6025ac371bd5cd07c0af550d78db323ad394173b
Author: Miklos Vajna 
AuthorDate: Tue May 14 13:49:51 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 15 13:08:02 2024 +0200

tdf#160952 sw: ignore top margin only at page top, not e.g. table top

The bugdoc has a table at the top of the 2nd page and we ignored the top
margin inside the table cell (for the first paragraph), while this
doesn't happen in Word.

As mentioned at

<https://gerrit.libreoffice.org/c/core/+/167221/3#message-c03abf8e8e3cd20d49006058e6b3eb130585ff8f>,
the old code assumed "top of the page" for all frames not having a
previous frame, while that code was only tested with text frames
directly in the body frame of a page frame.

Fix the problem by limiting this "collapse upper spacing" behavior to
frames directly in body frames. This keeps the old bugdoc working, but
is meant to restore the old, wanted behavior in other cases like e.g. in
table cells.

If later it's discovered that upper spacing collapsing is wanted in
other contexts, those are best added on a case by case basis.

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

diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
index 3e4deec52ae8..a44dc1256b83 100644
--- a/sw/qa/core/layout/calcmove.cxx
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -39,6 +39,25 @@ CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMargin)
 // i.e. the top margin in the first para of a non-first page wasn't 
ignored, like in Word.
 CPPUNIT_ASSERT_EQUAL(static_cast(0), nParaTopMargin);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginTable)
+{
+// Given a DOCX (>= Word 2013) file, with 2 pages:
+// When loading that document:
+createSwDoc("ignore-top-margin-table.docx");
+
+// Then make sure that the paragraph on the 2nd page in B1 has a top 
margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, 
"/root/page[2]/body/tab/row/cell[2]/txt/infos/prtBounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2000
+// - Actual  : 0
+// i.e. the top margin in B1's first paragraph was ignored, but not in 
Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(2000), nParaTopMargin);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin-table.docx 
b/sw/qa/core/layout/data/ignore-top-margin-table.docx
new file mode 100644
index ..c82f6d63c13f
Binary files /dev/null and 
b/sw/qa/core/layout/data/ignore-top-margin-table.docx differ
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 50dd45579e4b..ea27716aaeed 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1092,9 +1092,9 @@ bool SwFrame::IsCollapseUpper() const
 return false;
 }
 
-// Word >= 2013 style: when we're at the top of the page, but not on the 
first page, then ignore
-// the upper margin for paragraphs.
-if (GetPrev())
+// Word >= 2013 style: when we're at the top of the page's body, but not 
on the first page, then
+// ignore the upper margin for paragraphs.
+if (GetPrev() || !GetUpper() || !GetUpper()->IsBodyFrame())
 {
 return false;
 }


core.git: sw/qa sw/source

2024-05-14 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-and-footnote.doc |binary
 sw/qa/core/layout/ftnfrm.cxx   |   21 +++
 sw/source/core/layout/flowfrm.cxx  |   37 -
 sw/source/core/layout/ftnfrm.cxx   |   45 ++---
 sw/source/core/text/txtftn.cxx |   10 ---
 5 files changed, 83 insertions(+), 30 deletions(-)

New commits:
commit 6885dcd7ec7b82a946d8344bfc27a3e88eecc44a
Author: Miklos Vajna 
AuthorDate: Tue May 14 08:28:33 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 14 12:08:31 2024 +0200

tdf#160984 sw continuous endnotes: switch to a section-based layout

The original layout added in commit
4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add
ContinuousEndnotes layout compat option, 2019-09-30) puts endnotes to
the footnote container on the last page, which fixes the page count but
the endnote position is wrong: should be after the body text, not at the
bottom of the page.

Now that we can have an endnote section (with one or more section frames
at a layout level), we have a container that can span over multiple
pages, is at the end of the document and is inline.

Fix the bad position by:

1) Reverting the layout changes from the old approach, which gives us a
   bad position for the endnote.

2) Creating an endnote section frame on demand in
   SwFootnoteBossFrame::AppendFootnote().

3) Moving part of the endnote to a next page works out of the box, but
   moving part of the endnote to a previous page needs explicit handling
   in SwFlowFrame::MoveBwd(), similar to how SwFrame::GetPrevSctLeaf()
   does this in the simple section case. This needs explicit handling,
   because the body frame of the endnote section is empty, all content goes
   to its endnote container.

Note that this just reimplements the compat flag, but its enablement
(only for DOC import, only for <= 2 endnotes) stays unchanged for now.

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

diff --git a/sw/qa/core/layout/data/inline-endnote-and-footnote.doc 
b/sw/qa/core/layout/data/inline-endnote-and-footnote.doc
new file mode 100644
index ..39c5636e1e12
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-and-footnote.doc differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 4c874202da3f..71fd3fd67150 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -63,4 +63,25 @@ CPPUNIT_TEST_FIXTURE(Test, testFlySplitFootnoteLayout)
 CPPUNIT_ASSERT(pPage->FindFootnoteCont());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnote)
+{
+// Given a DOC file with an endnote and then a footnote:
+createSwDoc("inline-endnote-and-footnote.doc");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the footnote is below the endnote:
+// Without the accompanying fix in place, this test would have failed with:
+// - xpath should match exactly 1 node
+// i.e. the endnote was also in the footnote container, not at the end of 
the body text.
+sal_Int32 nEndnoteTop
+= 
parseDump("/root/page/body/section/column/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr)
+  .toInt32();
+sal_Int32 nFootnoteTop
+= parseDump("/root/page/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+// Endnote at the end of body text, footnote at page bottom.
+CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 37fd20b323d7..1cb5cf7bf47a 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2257,18 +2257,47 @@ bool SwFlowFrame::MoveBwd( bool  )
 const bool bEndnote = pFootnote->GetAttr()->GetFootnote().IsEndNote();
 const IDocumentSettingAccess& rSettings
 = pFootnote->GetAttrSet()->GetDoc()->getIDocumentSettingAccess();
-if( bEndnote && pFootnote->IsInSct() )
+bool bContEndnotes = 
rSettings.get(DocumentSettingId::CONTINUOUS_ENDNOTES);
+if( bEndnote && pFootnote->IsInSct() && !bContEndnotes)
 {
 SwSectionFrame* pSect = pFootnote->FindSctFrame();
 if( pSect->IsEndnAtEnd() )
 // Endnotes at the end of the section.
 pRef = pSect->FindLastContent( SwFindMode::LastCnt );
 }
-else if (bEndnote && 
rSettings.get(DocumentSettingId::CONTINUOUS_ENDNOTES))
+else if (

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

2024-05-14 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_core_layout.mk  |1 
 sw/qa/core/layout/calcmove.cxx|   44 ++
 sw/qa/core/layout/data/ignore-top-margin.docx |binary
 sw/source/core/inc/frame.hxx  |3 +
 sw/source/core/layout/calcmove.cxx|   32 ++
 sw/source/core/layout/flowfrm.cxx |5 ++
 6 files changed, 85 insertions(+)

New commits:
commit abd90828cf101581a07b9d1c371a8c3156521e9f
Author: Miklos Vajna 
AuthorDate: Tue May 7 08:13:37 2024 +0200
Commit: Michael Stahl 
CommitDate: Tue May 14 11:15:21 2024 +0200

tdf#160952 sw: ignore top margin of para on non-first pages with newer DOCX

The 2nd page of the bugdoc has a single paragraph, with a non-zero top
margin. This is ignored in Word, but wasn't ignored in Writer.

Experimenting with the document, it looks like old Word files also don't
ignore this top margin: it started when the compat mode is upgraded
(from binary DOC or Word 2010) to Word 2023 or newer. Also the top
margin is only ignored for the first paragraph on the page, and only in
case it's not on the first page.

Fix the problem by introducing a new SwFrame::IsCollapseUpper() function
to decide if the upper margin should be collapsed or not, and then by
using it in SwFlowFrame::CalcUpperSpace() at one place where we read the
top margin from the doc model. Take advantage of the fact that we have
related, existing compat flags that tell us if we're in "Word >= 2013"
compat mode: see e.g. GetFlyAnchorBottom(), which explains
DocumentSettingId::TAB_OVER_MARGIN is a good indicator that this is a
"Word <= 2010" document. Also, DocumentSettingId::TAB_OVER_SPACING is an
indicator that this is a Word document, so we want the "TabOverSpacing
&& !TabOverMargin" case.

This doesn't change all reads of the upper spacing of a text node, but
is enough to avoid the unwanted top spacing, as demonstrated by the
bugdoc.

Change-Id: Ibdebdf5f0555256a0b6ed85d07079f14ef69a576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167252
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 6200d89b905d51776ff4f3c8a84f338655ffaa7f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167221
Reviewed-by: Michael Stahl 

diff --git a/sw/CppunitTest_sw_core_layout.mk b/sw/CppunitTest_sw_core_layout.mk
index 5eb874400d53..d64a43f7d3fb 100644
--- a/sw/CppunitTest_sw_core_layout.mk
+++ b/sw/CppunitTest_sw_core_layout.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_core_layout))
 $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_layout))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_core_layout, \
+sw/qa/core/layout/calcmove \
 sw/qa/core/layout/fly \
 sw/qa/core/layout/flycnt \
 sw/qa/core/layout/frmtool \
diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
new file mode 100644
index ..3e4deec52ae8
--- /dev/null
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+
+namespace
+{
+/// Covers sw/source/core/layout/calcmove.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/core/layout/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMargin)
+{
+// Given a DOCX (>= Word 2013) file, with 2 pages:
+// When loading that document:
+createSwDoc("ignore-top-margin.docx");
+
+// Then make sure that the paragraph on the 2nd page has no top margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, "/root/page[2]/body/txt/infos/prtBounds"_ostr, 
"top"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 0
+// - Actual  : 2400
+// i.e. the top margin in the first para of a non-first page wasn't 
ignored, like in Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nParaTopMargin);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin.docx 
b/sw/qa/core/layout/data/ignore-top-margin.docx
new file mode 100644
index ..d05a1358db1e
Binary files /dev/null and b/sw/qa/core/layout/data/ignore-top-margin.docx 
differ
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 604488a18c9f..a86358508182 100644
--- a/sw/source/core/inc/fra

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

2024-05-14 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/layout/layout3.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 48ee8fb96540e68a17599b5db505f9b056dc09f3
Author: Miklos Vajna 
AuthorDate: Mon May 13 08:37:22 2024 +0200
Commit: Caolán McNamara 
CommitDate: Tue May 14 10:25:05 2024 +0200

tdf#160984 sw continuous endnotes: fix CppunitTest_sw_layoutwriter3

These are similar to commit ab3416cad1dd4e706432f9b1a3592cec823c76b0
(tdf#160984 sw continuous endnotes: fix
testContinuousEndnotesMoveBackwards, 2024-05-10).

I've manually verified that the use-case still works as intended, so fix
the failing tests by relaxing the assert a bit: now we accept endnotes
directly under the page frame or under the column frame as well.

This way these tests won't break when we switch to section-based
continuous endnotes.

(cherry picked from commit 9c7acbc937b3b341c10187b837e09cc20399f04e)

Change-Id: Ib98d6277534cc2e934595f19927836744eec64d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167624
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 98c77b18ecdf..d553162f1636 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -1315,7 +1315,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf124601)
 // i.e. there was a separate endnote page, even when the 
ContinuousEndnotes compat option was
 // on.
 assertXPath(pXmlDoc, "/root/page"_ostr, 2);
-assertXPath(pXmlDoc, "/root/page[2]/ftncont"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page[2]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf124601b)
@@ -1425,7 +1425,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testContinuousEndnotesInsertPageAtStart)
 // - Expected: 1
 // - Actual  : 0
 // i.e. the footnote container remained on page 2.
-assertXPath(pXmlDoc, "/root/page[3]/ftncont"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page[3]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testContinuousEndnotesDeletePageAtStart)
@@ -1452,7 +1452,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testContinuousEndnotesDeletePageAtStart)
 // - Actual  : 2
 // i.e. the endnote remained on an (otherwise) empty 2nd page.
 assertXPath(pXmlDoc, "/root/page"_ostr, 1);
-assertXPath(pXmlDoc, "/root/page[1]/ftncont"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page[1]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399)


core.git: sw/qa

2024-05-13 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/layout/layout3.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9c7acbc937b3b341c10187b837e09cc20399f04e
Author: Miklos Vajna 
AuthorDate: Mon May 13 08:37:22 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 13 12:15:08 2024 +0200

tdf#160984 sw continuous endnotes: fix CppunitTest_sw_layoutwriter3

These are similar to commit ab3416cad1dd4e706432f9b1a3592cec823c76b0
(tdf#160984 sw continuous endnotes: fix
testContinuousEndnotesMoveBackwards, 2024-05-10).

I've manually verified that the use-case still works as intended, so fix
the failing tests by relaxing the assert a bit: now we accept endnotes
directly under the page frame or under the column frame as well.

This way these tests won't break when we switch to section-based
continuous endnotes.

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

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index e907f6bc8ebf..329c81847313 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -1444,7 +1444,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf124601)
 // i.e. there was a separate endnote page, even when the 
ContinuousEndnotes compat option was
 // on.
 assertXPath(pXmlDoc, "/root/page"_ostr, 2);
-assertXPath(pXmlDoc, "/root/page[2]/ftncont"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page[2]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf124601b)
@@ -1554,7 +1554,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testContinuousEndnotesInsertPageAtStart)
 // - Expected: 1
 // - Actual  : 0
 // i.e. the footnote container remained on page 2.
-assertXPath(pXmlDoc, "/root/page[3]/ftncont"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page[3]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testContinuousEndnotesDeletePageAtStart)
@@ -1581,7 +1581,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
testContinuousEndnotesDeletePageAtStart)
 // - Actual  : 2
 // i.e. the endnote remained on an (otherwise) empty 2nd page.
 assertXPath(pXmlDoc, "/root/page"_ostr, 1);
-assertXPath(pXmlDoc, "/root/page[1]/ftncont"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page[1]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399)


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

2024-05-13 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/layout.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b6f42a6006dd0b0e4234ed5e0f536b7f4d8a
Author: Miklos Vajna 
AuthorDate: Fri May 10 08:07:41 2024 +0200
Commit: Caolán McNamara 
CommitDate: Mon May 13 12:06:55 2024 +0200

tdf#160984 sw continuous endnotes: fix testContinuousEndnotesMoveBackwards

Once continuous endnotes are in a section, this failed, even if the
generated layout is an improvement.

The layout will put the endnotes to a section, which will be directly
after the end of the body text, which is closer to what Word does, but
makes the test fail, since the foot/endnote container is no longer
directly under the page frame (the new tree is page -> body -> section
-> column -> ftncont).

Fix the problem by relaxing the assert to only check which pages have
footnote containers, which passes with and without the move to
section-based continuous endnotes, but still fails if endnotes go to
their own page, which was the original problem to be tested (endnotes
remained on page 3 and didn't move backwards).

The assert for the number of pages can remain unchanged.

(cherry picked from commit ab3416cad1dd4e706432f9b1a3592cec823c76b0)

Change-Id: I9a46803463c82dac317c303721de30fae48c6924
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167579
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 5971e870304d..9cae825b38b4 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -179,9 +179,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testContinuousEndnotesMoveBackwards)
 // - Expected: 0
 // - Actual  : 1
 // i.e. there were unexpected endnotes on page 1.
-assertXPath(pLayout, "/root/page[1]/ftncont"_ostr, 0);
+assertXPath(pLayout, "/root/page[1]//ftncont"_ostr, 0);
 // All endnotes are in a container on page 2.
-assertXPath(pLayout, "/root/page[2]/ftncont"_ostr, 1);
+assertXPath(pLayout, "/root/page[2]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph)


core.git: include/svx svx/source

2024-05-13 Thread Miklos Vajna (via logerrit)
 include/svx/svdundo.hxx   |   10 +++
 svx/source/svdraw/svdundo.cxx |   56 +-
 2 files changed, 33 insertions(+), 33 deletions(-)

New commits:
commit 74bd51629eed7eb34aef9acbb93c110525f8ef7d
Author: Miklos Vajna 
AuthorDate: Mon May 13 08:33:27 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 13 10:32:50 2024 +0200

svx: prefix members of SdrUndoAttrObj

See tdf#94879 for motivation.

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

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 824f36f06efc..5af5c584eda1 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -155,17 +155,17 @@ class SVXCORE_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj
 // FIXME: Or should we better remember the StyleSheetNames?
 rtl::Reference< SfxStyleSheet > mxUndoStyleSheet;
 rtl::Reference< SfxStyleSheet > mxRedoStyleSheet;
-bool bStyleSheet;
-bool bHaveToTakeRedoSet;
+bool m_bStyleSheet;
+bool m_bHaveToTakeRedoSet;
 
 // When assigning TextItems to a drawing object with text:
-std::optional pTextUndo;
+std::optional m_pTextUndo;
 // #i8508#
 // The text rescue mechanism needs also to be implemented for redo actions.
-std::optional pTextRedo;
+std::optional m_pTextRedo;
 
 // If we have a group object:
-std::unique_ptr pUndoGroup;
+std::unique_ptr m_pUndoGroup;
 
 protected:
 // Helper to ensure StyleSheet is in pool (provided by SdrModel from 
SdrObject)
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 18b248ba5960..1b52ee945957 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -250,9 +250,9 @@ void 
SdrUndoAttrObj::ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rSt
 
 SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool 
bSaveText)
 : SdrUndoObj(rNewObj)
-, bHaveToTakeRedoSet(true)
+, m_bHaveToTakeRedoSet(true)
 {
-bStyleSheet = bStyleSheet1;
+m_bStyleSheet = bStyleSheet1;
 
 SdrObjList* pOL = rNewObj.GetSubList();
 bool bIsGroup(pOL!=nullptr && pOL->GetObjCount());
@@ -261,11 +261,11 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool 
bStyleSheet1, bool bSave
 if(bIsGroup)
 {
 // it's a group object!
-pUndoGroup.reset(new SdrUndoGroup(mxObj->getSdrModelFromSdrObject()));
+m_pUndoGroup.reset(new 
SdrUndoGroup(mxObj->getSdrModelFromSdrObject()));
 
 for (const rtl::Reference& pObj : *pOL)
 {
-pUndoGroup->AddAction(
+m_pUndoGroup->AddAction(
 std::make_unique(*pObj, bStyleSheet1));
 }
 }
@@ -275,14 +275,14 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool 
bStyleSheet1, bool bSave
 
 moUndoSet.emplace( mxObj->GetMergedItemSet() );
 
-if(bStyleSheet)
+if(m_bStyleSheet)
 mxUndoStyleSheet = mxObj->GetStyleSheet();
 
 if(bSaveText)
 {
 auto p = mxObj->GetOutlinerParaObject();
 if(p)
-pTextUndo = *p;
+m_pTextUndo = *p;
 }
 }
 
@@ -290,9 +290,9 @@ SdrUndoAttrObj::~SdrUndoAttrObj()
 {
 moUndoSet.reset();
 moRedoSet.reset();
-pUndoGroup.reset();
-pTextUndo.reset();
-pTextRedo.reset();
+m_pUndoGroup.reset();
+m_pTextUndo.reset();
+m_pTextRedo.reset();
 }
 
 void SdrUndoAttrObj::Undo()
@@ -303,27 +303,27 @@ void SdrUndoAttrObj::Undo()
 // Trigger PageChangeCall
 ImpShowPageOfThisObject();
 
-if(!pUndoGroup || bIs3DScene)
+if(!m_pUndoGroup || bIs3DScene)
 {
-if(bHaveToTakeRedoSet)
+if(m_bHaveToTakeRedoSet)
 {
-bHaveToTakeRedoSet = false;
+m_bHaveToTakeRedoSet = false;
 
 moRedoSet.emplace( mxObj->GetMergedItemSet() );
 
-if(bStyleSheet)
+if(m_bStyleSheet)
 mxRedoStyleSheet = mxObj->GetStyleSheet();
 
-if(pTextUndo)
+if(m_pTextUndo)
 {
 // #i8508#
 auto p = mxObj->GetOutlinerParaObject();
 if(p)
-pTextRedo = *p;
+m_pTextRedo = *p;
 }
 }
 
-if(bStyleSheet)
+if(m_bStyleSheet)
 {
 mxRedoStyleSheet = mxObj->GetStyleSheet();
 SfxStyleSheet* pSheet = mxUndoStyleSheet.get();
@@ -392,15 +392,15 @@ void SdrUndoAttrObj::Undo()
 
 mxObj->GetProperties().BroadcastItemChange(aItemChange);
 
-if(pTextUndo)
+if(m_pTextUndo)
 {
-mxObj->SetOutlinerParaObject(*pTextUndo);
+mxObj->SetOutlinerParaObject(*m_pTextUndo);
 }
 }
 
-if(pUndoGroup)

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

2024-05-10 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/pagefrm.hxx|1 +
 sw/source/core/inc/sectfrm.hxx|4 
 sw/source/core/layout/findfrm.cxx |   23 +++
 sw/source/core/layout/sectfrm.cxx |1 +
 4 files changed, 29 insertions(+)

New commits:
commit e747e6df648a7ff076663ab376a4dbbc041b5180
Author: Miklos Vajna 
AuthorDate: Thu May 9 08:20:21 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri May 10 16:03:56 2024 +0200

tdf#160984 sw continuous endnotes: add a way to find the endnote section 
start

Existing code with endnotes on separate page at the end of the document
works by searching for a current or next page that is an endnote page in
SwFootnoteBossFrame::AppendFootnote(), and in case none is found, then
an endnote page is created.

Add similar infrastructure for the inline endnotes case: here we want to
find the first page that has an endnotes section, which also requires
being able to tell if a section is an endnotes one.

The newly introduced SwPageFrame::GetEndNoteSection() is not yet used in
SwFootnoteBossFrame::AppendFootnote(), though.

(cherry picked from commit 8bae684c93bd23bbe98707ba9cf75d1a39427131)

Change-Id: Ib08267f9bf6c7b06576624e3fa8e90e8b8b1b232
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167478
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 54458032f188..054495eeea80 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -204,6 +204,7 @@ public:
 bool IsEndNotePage() const  { return m_bEndNotePage; }
 void SetFootnotePage( bool b )   { m_bFootnotePage = 
b; }
 void SetEndNotePage( bool b )   { m_bEndNotePage = b; }
+SwSectionFrame* GetEndNoteSection();
 
 sal_uInt16 GetPhyPageNum() const{ return m_nPhyPageNum;}
 void SetPhyPageNum( sal_uInt16 nNum )   { m_nPhyPageNum = nNum;}
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 3debf367f05a..ac57bd815d5f 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -52,6 +52,8 @@ class SW_DLLPUBLIC SwSectionFrame final: public 
SwLayoutFrame, public SwFlowFram
 SwSection* m_pSection;
 bool m_bFootnoteAtEnd; // footnotes at the end of section
 bool m_bEndnAtEnd; // endnotes at the end of section
+/// If this is a section for endnotes, then the SwSection is not backed by 
an SwSectionNode.
+bool m_bEndNoteSection = false;
 bool m_bContentLock; // content locked
 bool m_bOwnFootnoteNum; // special numbering of footnotes
 bool m_bFootnoteLock; // ftn, don't leave this section bwd
@@ -171,6 +173,8 @@ public:
 
 void SetFootnoteLock( bool bNew ) { m_bFootnoteLock = bNew; }
 bool IsFootnoteLock() const { return m_bFootnoteLock; }
+void SetEndNoteSection(bool bEndNoteSection) { m_bEndNoteSection = 
bEndNoteSection; }
+bool IsEndNoteSection() const { return m_bEndNoteSection; }
 };
 
 inline const SwSectionFrame *SwSectionFrame::GetFollow() const
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 0dd64c6aecff..378e451b9f89 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -65,6 +65,29 @@ SwContentFrame *SwPageFrame::FindLastBodyContent()
 return pRet;
 }
 
+SwSectionFrame* SwPageFrame::GetEndNoteSection()
+{
+SwLayoutFrame* pBody = FindBodyCont();
+if (!pBody)
+{
+return nullptr;
+}
+
+SwFrame* pLast = pBody->GetLastLower();
+if (!pLast || !pLast->IsSctFrame())
+{
+return nullptr;
+}
+
+auto pLastSection = static_cast(pLast);
+if (!pLastSection->IsEndNoteSection())
+{
+return nullptr;
+}
+
+return pLastSection;
+}
+
 /**
  * Checks if the frame contains one or more ContentFrame's anywhere in his
  * subsidiary structure; if so the first found ContentFrame is returned.
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 3967a1f56442..78278da9cb38 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -94,6 +94,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame , bool 
bMaster ) :
 m_bOwnFootnoteNum( false ),
 m_bFootnoteLock( false )
 {
+m_bEndNoteSection = rSect.m_bEndNoteSection;
 StartListening(rSect.GetFormat()->GetNotifier());
 
 mnFrameType = SwFrameType::Section;


core.git: sw/qa

2024-05-10 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/layout.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ab3416cad1dd4e706432f9b1a3592cec823c76b0
Author: Miklos Vajna 
AuthorDate: Fri May 10 08:07:41 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 10 09:05:24 2024 +0200

tdf#160984 sw continuous endnotes: fix testContinuousEndnotesMoveBackwards

Once continuous endnotes are in a section, this failed, even if the
generated layout is an improvement.

The layout will put the endnotes to a section, which will be directly
after the end of the body text, which is closer to what Word does, but
makes the test fail, since the foot/endnote container is no longer
directly under the page frame (the new tree is page -> body -> section
-> column -> ftncont).

Fix the problem by relaxing the assert to only check which pages have
footnote containers, which passes with and without the move to
section-based continuous endnotes, but still fails if endnotes go to
their own page, which was the original problem to be tested (endnotes
remained on page 3 and didn't move backwards).

The assert for the number of pages can remain unchanged.

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

diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 5971e870304d..9cae825b38b4 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -179,9 +179,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testContinuousEndnotesMoveBackwards)
 // - Expected: 0
 // - Actual  : 1
 // i.e. there were unexpected endnotes on page 1.
-assertXPath(pLayout, "/root/page[1]/ftncont"_ostr, 0);
+assertXPath(pLayout, "/root/page[1]//ftncont"_ostr, 0);
 // All endnotes are in a container on page 2.
-assertXPath(pLayout, "/root/page[2]/ftncont"_ostr, 1);
+assertXPath(pLayout, "/root/page[2]//ftncont"_ostr, 1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph)


core.git: Branch 'distro/collabora/co-24.04' - sw/inc sw/source

2024-05-09 Thread Miklos Vajna (via logerrit)
 sw/inc/ftninfo.hxx|5 +
 sw/source/core/doc/docftn.cxx |   19 +++
 sw/source/core/doc/docnew.cxx |1 +
 3 files changed, 25 insertions(+)

New commits:
commit 3ac458599fd3dd532c9b4cc02ffa446d1a0e3dc2
Author: Miklos Vajna 
AuthorDate: Wed May 8 08:59:47 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 9 17:12:24 2024 +0200

tdf#160984 sw continuous endnotes: introduce an endnote section

Word lays out endnotes at the end of the document inline after body
text, Writer puts them on one or more separate endnote pages.

There was already an attempt in the past to resolve this difference, see
commit 4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add
ContinuousEndnotes layout compat option, 2019-09-30). The approach back
then was to map such endnotes to footnotes, so the extra, unwanted page
doesn't appear. This turned out to be not working too well, the compat
option is only enabled for DOC, and even there commit
dc11f5b151e1a2ea2623fc8cf806a400763955d9 (tdf#143445 DOC import: limit
the usage of the CONTINUOUS_ENDNOTES compat flag, 2023-05-23) limited
the usage of the compat flag to 1 or 2 endnotes only.

Coming back to this, try a new approach: create a section that more or
less exists only at a layout level and put endnotes into that section.
This allows reusing all the complex logic on how to lay out endnotes
inline, on one or more pages. The plan is that this new approach is more
robust, can replace the old continuous endnotes layout code and then can
be enabled for DOCX as well.

This commit just introduces the backing section format and SwSection for
that special "endnotes section" (it's special because SwSection is
usually owned by an SwSectionNode, but here there is no doc model node
for the SwSection), SwFootnoteBossFrame::AppendFootnote() doesn't try to
use the new SwEndNoteInfo::GetSwSection() yet.

(cherry picked from commit 90f19126fa405a0632eae4ee8525b66bbce12625)

Change-Id: Ib32f04ceb6f46c682a5d36bdcea206d2c4017227
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167387
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx
index 17742687c944..c5490ed885d0 100644
--- a/sw/inc/ftninfo.hxx
+++ b/sw/inc/ftninfo.hxx
@@ -28,12 +28,14 @@ class SwTextFormatColl;
 class SwPageDesc;
 class SwCharFormat;
 class SwDoc;
+class SwSection;
 
 class SW_DLLPUBLIC SwEndNoteInfo : public SwClient
 {
 mutable sw::WriterMultiListener m_aDepends;
 mutable SwTextFormatColl* m_pTextFormatColl;
 mutable SwPageDesc* m_pPageDesc;
+mutable std::unique_ptr m_pSwSection;
 mutable SwCharFormat* m_pCharFormat;
 mutable SwCharFormat* m_pAnchorFormat;
 OUString m_sPrefix;
@@ -51,6 +53,9 @@ public:
 bool KnowsPageDesc() const;
 bool DependsOn(const SwPageDesc*) const;
 
+SwSection* GetSwSection(SwDoc& rDoc) const;
+void ResetSwSection();
+
 void SetFootnoteTextColl(SwTextFormatColl& rColl);
 SwTextFormatColl* GetFootnoteTextColl() const { return m_pTextFormatColl; 
} // can be 0.
 
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 16f6694c94c5..f211dcdcc9f4 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -35,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
 {
@@ -130,6 +132,23 @@ void SwEndNoteInfo::ChgPageDesc(SwPageDesc* pDesc)
 m_aDepends.StartListening(m_pPageDesc);
 }
 
+SwSection* SwEndNoteInfo::GetSwSection(SwDoc& rDoc) const
+{
+if (!m_pSwSection)
+{
+SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
+pFormat->SetFormatName(UNO_NAME_ENDNOTE);
+pFormat->SetFormatAttr(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+m_pSwSection.reset(new SwSection(SectionType::Content, 
pFormat->GetName(), *pFormat));
+}
+return m_pSwSection.get();
+}
+
+void SwEndNoteInfo::ResetSwSection()
+{
+m_pSwSection.reset();
+}
+
 void SwEndNoteInfo::SetFootnoteTextColl(SwTextFormatColl& rFormat)
 {
 m_aDepends.EndListening(m_pTextFormatColl);
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index d6e885e8219a..bb0cd32d2c19 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -503,6 +503,7 @@ SwDoc::~SwDoc()
 // do not have any dependencies anymore.
 m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
 rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
+mpEndNoteInfo->ResetSwSection();
 
 // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no 
clients
 for (const auto& pType : *mpTOXTypes)


ESC meeting minutes: 2024-05-09

2024-05-09 Thread Miklos Vajna

* Present:
+ Cloph, Gabriel, Heiko, Hossein, Ilmari, Jonathan, Olivier, Xisco, 
sockseight, Caolan, Stephane, Miklos

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 release: this week, tomorrow
+ 24.2: 24.2.4 RC1 in 1 week
+ 24.8: first alpha this week, from master, tomorrow
  + week 23 is the feature freeze, 4 weeks
+ string / UI freeze 4 weeks after that
  + if you have a late feature proposal, announce that here
+ MAR-based updater will be enabled by default on Windows, but not Linux 
(Hossein)
  + rpm/deb update is handled by distro packages
  + for the ones taking binaries from TDF
  + TDF to provide rpm/deb repos?
  + the files are hosted already
  + just the repo defs are missing
  + suggesting to provide these repos
  + proposal is to povide repos and ignore MAR on Linux for now
  + interested in doing the scripting work? (Miklos)
+ the important part is the description / dependencies (Hossein)
+ willing to help
  + linux downloads are 2% of TDF downloads (Cloph)
+ so not a huge amount, but not objecting
+ only the the ones which are covered by rpm/deb binaries
  + what is the lag between Ubuntu-provided packages / TDF releases? 
(Olivier)
+ the package from Ubuntu follows TDF quickly
+ similar with Debian, thanks to Rene (Cloph)
  + with actively supported versions
+ see LibreOffice 7.3.7 for Ubuntu 22.04 
https://packages.ubuntu.com/jammy/libreoffice (Hossein)

* Documentation (Olivier)
+ Helpcontents2
   + Updates and fixes (A Gelmini. S. Horacek, fitoshido)
   + Changes in makefiles (cloph)
   + Updates in doc properties (Dublin Core) by Dione Maddern
+ Core
   + Extended tips for sparklines
+ Guides
   + important fix by M. Stahl will trigger format review
  + in all guides,
  + starting after LO 24.2.4
  + tdf#159366
+ bugs with >20 comments
  + hard to follow, to understand what is the actual request
  + sometimes asking: if this feature is still used
  + thanks to the precise bugreports
+ Bugzilla Documentation statistics
263(263) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 14(5)39(2) 107(7) 225(4)
 commented 20(10)   61(0) 255(5) 854(6)
  resolved  7(2)23(5)  54(6) 121(4)
+ top 10 contributors:
  Olivier Hallot made 42 changes in 1 month, and 239 changes in 1 year
  Stéphane Guillou made 28 changes in 1 month, and 253 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 107 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  Kaganski, Mike made 8 changes in 1 month, and 74 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Heiko Tietze made 4 changes in 1 month, and 76 changes in 1 year
  nobu made 4 changes in 1 month, and 16 changes in 1 year
  Kira Tubo made 2 changes in 1 month, and 2 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  4(-1)10(1) 15(-1)  21(-3)
 commented 64(48)   186(30)   525(-6)1761(-60)
   removed  0(-2) 4(-1) 5(0)   12(-1)
  resolved  8(2) 31(1) 79(-2) 308(-7)
+ top 10 contributors:
  Heiko Tietze made 110 changes in 1 month, and 1031 changes in 1 year
  Vernon, Stuart Foote made 108 changes in 1 month, and 317 changes in 
1 year
  Stéphane Guillou made 51 changes in 1 month, and 621 changes in 1 year
  Cor Nouws made 21 changes in 1 month, and 33 changes in 1 year
  Dieter made 18 changes in 1 month, and 139 changes in 1 year
  Ilmari Lauhakangas made 16 changes in 1 month, and 131 changes in 1 
year
  Eyal Rozenberg made 10 changes in 1 month, and 125 changes in 1 year
  Ady made 6 changes in 1 month, and 122 changes in 1 year
  jan d made 5 changes in 1 month, and 5 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year
+ [Bug 161002] Missing item "Insert/Filed/More Fields.." in LibreOffice Draw
+ [Bug 160986] show 'X %' instead of 'X%'
+ [Bug 153309] Prevent direct formatting on writer by a password.
 -> + [Bug 98902] Right clicking on selected text unselects it if the cursor is 
on
   a misspelled word
+ [Bug 160955] When selecting an alternative link target for an OLE object, 
button
  says 

ESC meeting minutes: 2024-05-09

2024-05-09 Thread Miklos Vajna

* Present:
+ Cloph, Gabriel, Heiko, Hossein, Ilmari, Jonathan, Olivier, Xisco, 
sockseight, Caolan, Stephane, Miklos

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 release: this week, tomorrow
+ 24.2: 24.2.4 RC1 in 1 week
+ 24.8: first alpha this week, from master, tomorrow
  + week 23 is the feature freeze, 4 weeks
+ string / UI freeze 4 weeks after that
  + if you have a late feature proposal, announce that here
+ MAR-based updater will be enabled by default on Windows, but not Linux 
(Hossein)
  + rpm/deb update is handled by distro packages
  + for the ones taking binaries from TDF
  + TDF to provide rpm/deb repos?
  + the files are hosted already
  + just the repo defs are missing
  + suggesting to provide these repos
  + proposal is to povide repos and ignore MAR on Linux for now
  + interested in doing the scripting work? (Miklos)
+ the important part is the description / dependencies (Hossein)
+ willing to help
  + linux downloads are 2% of TDF downloads (Cloph)
+ so not a huge amount, but not objecting
+ only the the ones which are covered by rpm/deb binaries
  + what is the lag between Ubuntu-provided packages / TDF releases? 
(Olivier)
+ the package from Ubuntu follows TDF quickly
+ similar with Debian, thanks to Rene (Cloph)
  + with actively supported versions
+ see LibreOffice 7.3.7 for Ubuntu 22.04 
https://packages.ubuntu.com/jammy/libreoffice (Hossein)

* Documentation (Olivier)
+ Helpcontents2
   + Updates and fixes (A Gelmini. S. Horacek, fitoshido)
   + Changes in makefiles (cloph)
   + Updates in doc properties (Dublin Core) by Dione Maddern
+ Core
   + Extended tips for sparklines
+ Guides
   + important fix by M. Stahl will trigger format review
  + in all guides,
  + starting after LO 24.2.4
  + tdf#159366
+ bugs with >20 comments
  + hard to follow, to understand what is the actual request
  + sometimes asking: if this feature is still used
  + thanks to the precise bugreports
+ Bugzilla Documentation statistics
263(263) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 14(5)39(2) 107(7) 225(4)
 commented 20(10)   61(0) 255(5) 854(6)
  resolved  7(2)23(5)  54(6) 121(4)
+ top 10 contributors:
  Olivier Hallot made 42 changes in 1 month, and 239 changes in 1 year
  Stéphane Guillou made 28 changes in 1 month, and 253 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 107 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  Kaganski, Mike made 8 changes in 1 month, and 74 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Heiko Tietze made 4 changes in 1 month, and 76 changes in 1 year
  nobu made 4 changes in 1 month, and 16 changes in 1 year
  Kira Tubo made 2 changes in 1 month, and 2 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  4(-1)10(1) 15(-1)  21(-3)
 commented 64(48)   186(30)   525(-6)1761(-60)
   removed  0(-2) 4(-1) 5(0)   12(-1)
  resolved  8(2) 31(1) 79(-2) 308(-7)
+ top 10 contributors:
  Heiko Tietze made 110 changes in 1 month, and 1031 changes in 1 year
  Vernon, Stuart Foote made 108 changes in 1 month, and 317 changes in 
1 year
  Stéphane Guillou made 51 changes in 1 month, and 621 changes in 1 year
  Cor Nouws made 21 changes in 1 month, and 33 changes in 1 year
  Dieter made 18 changes in 1 month, and 139 changes in 1 year
  Ilmari Lauhakangas made 16 changes in 1 month, and 131 changes in 1 
year
  Eyal Rozenberg made 10 changes in 1 month, and 125 changes in 1 year
  Ady made 6 changes in 1 month, and 122 changes in 1 year
  jan d made 5 changes in 1 month, and 5 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year
+ [Bug 161002] Missing item "Insert/Filed/More Fields.." in LibreOffice Draw
+ [Bug 160986] show 'X %' instead of 'X%'
+ [Bug 153309] Prevent direct formatting on writer by a password.
 -> + [Bug 98902] Right clicking on selected text unselects it if the cursor is 
on
   a misspelled word
+ [Bug 160955] When selecting an alternative link target for an OLE object, 
button
  says 

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

2024-05-09 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/shells/drwbassh.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 0f7127aa6019363d15a167ab492ba06e0347174a
Author: Miklos Vajna 
AuthorDate: Thu May 9 13:09:43 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 9 14:59:53 2024 +0200

sw: fix -Wshadow warnings


/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx: In 
lambda function:

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:656:38:
 error: declaration of ‘aTitle’ shadows a previous local [-Werror=shadow]
  656 | OUString aTitle;
  |  ^~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:643:26:
 note: shadowed declaration is here
  643 | OUString aTitle(pSelected->GetTitle());
  |  ^~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:657:38:
 error: declaration of ‘aDescription’ shadows a previous local [-Werror=shadow]
  657 | OUString aDescription;
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:644:26:
 note: shadowed declaration is here
  644 | OUString 
aDescription(pSelected->GetDescription());
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:658:34:
 error: declaration of ‘isDecorative’ shadows a previous local [-Werror=shadow]
  658 | bool isDecorative;
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:645:22:
 note: shadowed declaration is here
  645 | bool 
isDecorative(pSelected->IsDecorative());
  |  ^~~~
cc1plus: all warnings being treated as errors

Change-Id: I9f62f028d29a4014628435163f8ff9174251bfb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167382
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index ebd1eb3ce705..c98e97eb7aba 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -653,17 +653,17 @@ void SwDrawBaseShell::Execute(SfxRequest const )
 {
 if (nResult == RET_OK)
 {
-OUString aTitle;
-OUString aDescription;
-bool isDecorative;
+OUString aNewTitle;
+OUString aNewDescription;
+bool newIsDecorative;
 
-pDlg->GetTitle(aTitle);
-pDlg->GetDescription(aDescription);
-pDlg->IsDecorative(isDecorative);
+pDlg->GetTitle(aNewTitle);
+pDlg->GetDescription(aNewDescription);
+pDlg->IsDecorative(newIsDecorative);
 
-pSelected->SetTitle(aTitle);
-pSelected->SetDescription(aDescription);
-pSelected->SetDecorative(isDecorative);
+pSelected->SetTitle(aNewTitle);
+pSelected->SetDescription(aNewDescription);
+pSelected->SetDecorative(newIsDecorative);
 
 pSh->SetModified();
 }


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

2024-05-09 Thread Miklos Vajna (via logerrit)
 sd/source/ui/view/drviews2.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 943913f74c26210ebf3ed04f36412e3c45b76f0e
Author: Miklos Vajna 
AuthorDate: Thu May 9 11:52:13 2024 +0200
Commit: Szymon Kłos 
CommitDate: Thu May 9 12:06:48 2024 +0200

sd: fix -Wshadow warnings


/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx: In 
lambda function:

/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx:2713:38: 
error: declaration of ‘aTitle’ shadows a previous local [-Werror=shadow]
 2713 | OUString aTitle;
  |  ^~

/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx:2700:26: 
note: shadowed declaration is here
 2700 | OUString aTitle(pSelected->GetTitle());
  |  ^~

/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx:2714:38: 
error: declaration of ‘aDescription’ shadows a previous local [-Werror=shadow]
 2714 | OUString aDescription;
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx:2701:26: 
note: shadowed declaration is here
 2701 | OUString 
aDescription(pSelected->GetDescription());
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx:2715:34: 
error: declaration of ‘isDecorative’ shadows a previous local [-Werror=shadow]
 2715 | bool isDecorative;
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sd/source/ui/view/drviews2.cxx:2702:22: 
note: shadowed declaration is here
 2702 | bool 
isDecorative(pSelected->IsDecorative());
  |  ^~~~
cc1plus: all warnings being treated as errors

Change-Id: I036105d084010c66b8aab75befdef590408b25ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167381
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index a7ed100977bf..d149c9633d7f 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2710,17 +2710,17 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 {
 if (nResult == RET_OK)
 {
-OUString aTitle;
-OUString aDescription;
-bool isDecorative;
+OUString aNewTitle;
+OUString aNewDescription;
+bool newIsDecorative;
 
-pDlg->GetTitle(aTitle);
-pDlg->GetDescription(aDescription);
-pDlg->IsDecorative(isDecorative);
+pDlg->GetTitle(aNewTitle);
+pDlg->GetDescription(aNewDescription);
+pDlg->IsDecorative(newIsDecorative);
 
-pSelected->SetTitle(aTitle);
-pSelected->SetDescription(aDescription);
-pSelected->SetDecorative(isDecorative);
+pSelected->SetTitle(aNewTitle);
+pSelected->SetDescription(aNewDescription);
+pSelected->SetDecorative(newIsDecorative);
 }
 pDlg->disposeOnce();
 }


core.git: sw/source

2024-05-09 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/pagefrm.hxx|1 +
 sw/source/core/inc/sectfrm.hxx|4 
 sw/source/core/layout/findfrm.cxx |   23 +++
 sw/source/core/layout/sectfrm.cxx |1 +
 4 files changed, 29 insertions(+)

New commits:
commit 8bae684c93bd23bbe98707ba9cf75d1a39427131
Author: Miklos Vajna 
AuthorDate: Thu May 9 08:20:21 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 9 09:35:03 2024 +0200

tdf#160984 sw continuous endnotes: add a way to find the endnote section 
start

Existing code with endnotes on separate page at the end of the document
works by searching for a current or next page that is an endnote page in
SwFootnoteBossFrame::AppendFootnote(), and in case none is found, then
an endnote page is created.

Add similar infrastructure for the inline endnotes case: here we want to
find the first page that has an endnotes section, which also requires
being able to tell if a section is an endnotes one.

The newly introduced SwPageFrame::GetEndNoteSection() is not yet used in
SwFootnoteBossFrame::AppendFootnote(), though.

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

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 23d77b1c8f74..be55221b2bef 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -204,6 +204,7 @@ public:
 bool IsEndNotePage() const  { return m_bEndNotePage; }
 void SetFootnotePage( bool b )   { m_bFootnotePage = 
b; }
 void SetEndNotePage( bool b )   { m_bEndNotePage = b; }
+SwSectionFrame* GetEndNoteSection();
 
 sal_uInt16 GetPhyPageNum() const{ return m_nPhyPageNum;}
 void SetPhyPageNum( sal_uInt16 nNum )   { m_nPhyPageNum = nNum;}
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 9dbf9f4df9cc..12646d08ebad 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -52,6 +52,8 @@ class SAL_DLLPUBLIC_RTTI SwSectionFrame final: public 
SwLayoutFrame, public SwFl
 SwSection* m_pSection;
 bool m_bFootnoteAtEnd; // footnotes at the end of section
 bool m_bEndnAtEnd; // endnotes at the end of section
+/// If this is a section for endnotes, then the SwSection is not backed by 
an SwSectionNode.
+bool m_bEndNoteSection = false;
 bool m_bContentLock; // content locked
 bool m_bOwnFootnoteNum; // special numbering of footnotes
 bool m_bFootnoteLock; // ftn, don't leave this section bwd
@@ -171,6 +173,8 @@ public:
 
 void SetFootnoteLock( bool bNew ) { m_bFootnoteLock = bNew; }
 bool IsFootnoteLock() const { return m_bFootnoteLock; }
+void SetEndNoteSection(bool bEndNoteSection) { m_bEndNoteSection = 
bEndNoteSection; }
+bool IsEndNoteSection() const { return m_bEndNoteSection; }
 };
 
 inline const SwSectionFrame *SwSectionFrame::GetFollow() const
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index a86a7afefc87..60ca1fe7d326 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -65,6 +65,29 @@ SwContentFrame *SwPageFrame::FindLastBodyContent()
 return pRet;
 }
 
+SwSectionFrame* SwPageFrame::GetEndNoteSection()
+{
+SwLayoutFrame* pBody = FindBodyCont();
+if (!pBody)
+{
+return nullptr;
+}
+
+SwFrame* pLast = pBody->GetLastLower();
+if (!pLast || !pLast->IsSctFrame())
+{
+return nullptr;
+}
+
+auto pLastSection = static_cast(pLast);
+if (!pLastSection->IsEndNoteSection())
+{
+return nullptr;
+}
+
+return pLastSection;
+}
+
 /**
  * Checks if the frame contains one or more ContentFrame's anywhere in his
  * subsidiary structure; if so the first found ContentFrame is returned.
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 3967a1f56442..78278da9cb38 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -94,6 +94,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame , bool 
bMaster ) :
 m_bOwnFootnoteNum( false ),
 m_bFootnoteLock( false )
 {
+m_bEndNoteSection = rSect.m_bEndNoteSection;
 StartListening(rSect.GetFormat()->GetNotifier());
 
 mnFrameType = SwFrameType::Section;


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-09 Thread Miklos Vajna (via logerrit)
 sw/qa/core/txtnode/data/plain-content-control-copy.docx |binary
 sw/qa/core/txtnode/txtnode.cxx  |   23 
 sw/source/core/txtnode/thints.cxx   |4 ++
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 47c917bcdbffd6423f50a3d970ed45ce06b9061e
Author: Miklos Vajna 
AuthorDate: Tue Apr 30 08:44:59 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 9 09:33:22 2024 +0200

tdf#159683 sw content controls, plain text: fix crash with the clipboard doc

Regression from commit c804c5354855188b5a37219cfe11dc079dc235f4 (sw
content control: fix lost properties on copy, 2023-03-10), select
a plain text content control, copy it to the clipboard, quit: assertion
fails during shutdown because the doc's "placeholder text" char style is
still referenced by a client.

What happens here is that the SwContentControl copy ctor copies the
plain text flag, and that flag is only read in SwTextNode::InsertHint(),
so that causes the problem. Note how that code is inconsistent: we avoid
the creation of dummy characters in the copy case, but we still try to
adjust the start/end of the content control attribute in the copy case,
which makes not much sense.

Fix the problem by not adjusting the content control attribute
boundaries in the copy case, since the original intention was to do
thees corrections only at a UI level, during interactive edit.

It's not clear why this inconsistency had an influence on the clients of
the char style, though.

Change-Id: I86b0516464f24fc453dcd97588dafb8afd010a9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166882
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 06aeb9c61d50bba7edafe17f9d3513af26b0782f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167311
Reviewed-by: Xisco Fauli 
(cherry picked from commit 32616609c788aa1cf0837af0f387390a23de1766)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167375
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/core/txtnode/data/plain-content-control-copy.docx 
b/sw/qa/core/txtnode/data/plain-content-control-copy.docx
new file mode 100644
index ..80fecae26d5b
Binary files /dev/null and 
b/sw/qa/core/txtnode/data/plain-content-control-copy.docx differ
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index c2df8a407e69..be4d97190251 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -539,6 +539,29 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSplitFlyAnchorSplit)
 CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Fly"), aPortionType);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPlainContentControlCopy)
+{
+// Given a document with a plain text content control, all text selected 
and copied to the
+// clipboard:
+createSwDoc("plain-content-control-copy.docx");
+SwDocShell* pDocShell = getSwDocShell();
+SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+pWrtShell->SelAll();
+{
+rtl::Reference xTransfer = new 
SwTransferable(*pWrtShell);
+xTransfer->Copy();
+}
+
+// When closing that document, then make sure we don't crash on shutdown:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xFrame(xModel->getCurrentController()->getFrame(),
+uno::UNO_QUERY);
+// Without the accompanying fix in place, this resulted in an assertion 
failure, a char style
+// still had clients by the time it was deleted.
+xFrame->close(false);
+mxComponent.clear();
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index cf5e1ff1cccf..c499294f4f26 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1700,7 +1700,9 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 // for all of its content.
 auto* pTextContentControl = static_txtattr_cast(
 GetTextAttrAt(pAttr->GetStart(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent));
-if (pTextContentControl)
+// If the caller is SwTextNode::CopyText, we just copy an existing 
attribute, no need to
+// correct it.
+if (pTextContentControl && !(nMode & SetAttrMode::NOTXTATRCHR))
 {
 auto& rFormatContentControl
 = 
static_cast(pTextContentControl->GetAttr());


core.git: Changes to 'refs/tags/cp-24.04.2-1'

2024-05-08 Thread Miklos Vajna (via logerrit)
Tag 'cp-24.04.2-1' created by Aron Budea  at 
2024-05-08 15:21 +

cp-24.04.2-1

Changes since cp-24.04.1-4-81:
---
 0 files changed
---


ESC meeting agenda: 2024-05-09 16:00 CEST

2024-05-08 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 release: this week?
+ 24.2: 24.2.4 RC1 in 1 week?
+ 24.8: first alpha this week?

* Documentation (Olivier)
+ Bugzilla Documentation statistics
263(263) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 14(5)39(2) 107(7) 225(4)
 commented 20(10)   61(0) 255(5) 854(6)
  resolved  7(2)23(5)  54(6) 121(4)
+ top 10 contributors:
  Olivier Hallot made 42 changes in 1 month, and 239 changes in 1 year
  Stéphane Guillou made 28 changes in 1 month, and 253 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 107 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  Kaganski, Mike made 8 changes in 1 month, and 74 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Heiko Tietze made 4 changes in 1 month, and 76 changes in 1 year
  nobu made 4 changes in 1 month, and 16 changes in 1 year
  Kira Tubo made 2 changes in 1 month, and 2 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  4(-1)10(1) 15(-1)  21(-3)
 commented 64(48)   186(30)   525(-6)1761(-60)
   removed  0(-2) 4(-1) 5(0)   12(-1)
  resolved  8(2) 31(1) 79(-2) 308(-7)
+ top 10 contributors:
  Heiko Tietze made 110 changes in 1 month, and 1031 changes in 1 year
  Vernon, Stuart Foote made 108 changes in 1 month, and 317 changes in 
1 year
  Stéphane Guillou made 51 changes in 1 month, and 621 changes in 1 year
  Cor Nouws made 21 changes in 1 month, and 33 changes in 1 year
  Dieter made 18 changes in 1 month, and 139 changes in 1 year
  Ilmari Lauhakangas made 16 changes in 1 month, and 131 changes in 1 
year
  Eyal Rozenberg made 10 changes in 1 month, and 125 changes in 1 year
  Ady made 6 changes in 1 month, and 122 changes in 1 year
  jan d made 5 changes in 1 month, and 5 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year

* Crash Testing (Caolan)
+ 24(-39) import failure, 20(-39) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.1.173(+3)
+ 24.2.1.213738(+798)
+ 24.2.2.28930(+1873)
+ 24.2.3.2487(+0)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months12 months
  open  81(-11)142(-21)178(-17) 178(-17)
   reviews 450(100)   1206(56)3718(76)12462(22)
merged 350(51)1140(127)   3369(127)   12593(81)
 abandoned  13(4)   55(-2) 172(-2)  656(-1)
   own commits 250(27) 827(103)   2303(119)9229(1)
review commits  51(3)  224(-8) 871(14) 3012(-51)
contributor...   1 week 1 month 3 months12 months
  open  37(4)   77(7)  103(8)   103(8)
   reviews 962(132)   2774(178)   7906(220)   29522(6)
merged  23(3)   98(-20)385(5)  1635(-61)
 abandoned   9(-4)  49(-5) 288(-10) 704(-3)
   own commits  25(0)  105(-8) 449(10) 1126(-7)
review commits   0(0)0(0)0(0) 0(0)
+ easyHack statistics:
   needsDevEval 8(8)   needsUXEval 1(1)   cleanup_comments 326(326)
   total 408(408)   assigned 26(26)   open 348(348)
+ top 10 contributors:
  Armin Le Grand (allotropia) made 7 patches in 1 month, and 87 patches 
in 1 year
  Ritobroto Mukherjee made 5 patches in 1 month, and 15 patches in 1 
year
made 4 patches in 1 month, and 7 patches in 1 year
  Kira Tubo made 4 patches in 1 month, and 14 patches in 1 year
  Jakub Kościelak made 4 patches in 1 month, and 4 patches in 1 year
  colton Garrett made 4 patches in 1 month, and 4 patches in 1 year
  Stéphane Guillou made 3 patches in 1 month, and 7 patches in 1 year
  Stéphane Guillou made 3 patches in 1 month, and 58 patches in 1 year
 

ESC meeting agenda: 2024-05-09 16:00 CEST

2024-05-08 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 release: this week?
+ 24.2: 24.2.4 RC1 in 1 week?
+ 24.8: first alpha this week?

* Documentation (Olivier)
+ Bugzilla Documentation statistics
263(263) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 14(5)39(2) 107(7) 225(4)
 commented 20(10)   61(0) 255(5) 854(6)
  resolved  7(2)23(5)  54(6) 121(4)
+ top 10 contributors:
  Olivier Hallot made 42 changes in 1 month, and 239 changes in 1 year
  Stéphane Guillou made 28 changes in 1 month, and 253 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 107 changes in 1 
year
  Ilmari Lauhakangas made 10 changes in 1 month, and 73 changes in 1 
year
  Kaganski, Mike made 8 changes in 1 month, and 74 changes in 1 year
  Nabet, Julien made 6 changes in 1 month, and 59 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Heiko Tietze made 4 changes in 1 month, and 76 changes in 1 year
  nobu made 4 changes in 1 month, and 16 changes in 1 year
  Kira Tubo made 2 changes in 1 month, and 2 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
240(240) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
 added  4(-1)10(1) 15(-1)  21(-3)
 commented 64(48)   186(30)   525(-6)1761(-60)
   removed  0(-2) 4(-1) 5(0)   12(-1)
  resolved  8(2) 31(1) 79(-2) 308(-7)
+ top 10 contributors:
  Heiko Tietze made 110 changes in 1 month, and 1031 changes in 1 year
  Vernon, Stuart Foote made 108 changes in 1 month, and 317 changes in 
1 year
  Stéphane Guillou made 51 changes in 1 month, and 621 changes in 1 year
  Cor Nouws made 21 changes in 1 month, and 33 changes in 1 year
  Dieter made 18 changes in 1 month, and 139 changes in 1 year
  Ilmari Lauhakangas made 16 changes in 1 month, and 131 changes in 1 
year
  Eyal Rozenberg made 10 changes in 1 month, and 125 changes in 1 year
  Ady made 6 changes in 1 month, and 122 changes in 1 year
  jan d made 5 changes in 1 month, and 5 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year

* Crash Testing (Caolan)
+ 24(-39) import failure, 20(-39) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.1.173(+3)
+ 24.2.1.213738(+798)
+ 24.2.2.28930(+1873)
+ 24.2.3.2487(+0)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months12 months
  open  81(-11)142(-21)178(-17) 178(-17)
   reviews 450(100)   1206(56)3718(76)12462(22)
merged 350(51)1140(127)   3369(127)   12593(81)
 abandoned  13(4)   55(-2) 172(-2)  656(-1)
   own commits 250(27) 827(103)   2303(119)9229(1)
review commits  51(3)  224(-8) 871(14) 3012(-51)
contributor...   1 week 1 month 3 months12 months
  open  37(4)   77(7)  103(8)   103(8)
   reviews 962(132)   2774(178)   7906(220)   29522(6)
merged  23(3)   98(-20)385(5)  1635(-61)
 abandoned   9(-4)  49(-5) 288(-10) 704(-3)
   own commits  25(0)  105(-8) 449(10) 1126(-7)
review commits   0(0)0(0)0(0) 0(0)
+ easyHack statistics:
   needsDevEval 8(8)   needsUXEval 1(1)   cleanup_comments 326(326)
   total 408(408)   assigned 26(26)   open 348(348)
+ top 10 contributors:
  Armin Le Grand (allotropia) made 7 patches in 1 month, and 87 patches 
in 1 year
  Ritobroto Mukherjee made 5 patches in 1 month, and 15 patches in 1 
year
made 4 patches in 1 month, and 7 patches in 1 year
  Kira Tubo made 4 patches in 1 month, and 14 patches in 1 year
  Jakub Kościelak made 4 patches in 1 month, and 4 patches in 1 year
  colton Garrett made 4 patches in 1 month, and 4 patches in 1 year
  Stéphane Guillou made 3 patches in 1 month, and 7 patches in 1 year
  Stéphane Guillou made 3 patches in 1 month, and 58 patches in 1 year
 

core.git: Branch 'distro/collabora/co-24.04' - sw/CppunitTest_sw_core_layout.mk sw/qa sw/source

2024-05-08 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_core_layout.mk  |1 
 sw/qa/core/layout/calcmove.cxx|   44 ++
 sw/qa/core/layout/data/ignore-top-margin.docx |binary
 sw/source/core/inc/frame.hxx  |3 +
 sw/source/core/layout/calcmove.cxx|   32 ++
 sw/source/core/layout/flowfrm.cxx |5 ++
 6 files changed, 85 insertions(+)

New commits:
commit 4fe480d314ceb100f4679626fee3d60dd82a6bc6
Author: Miklos Vajna 
AuthorDate: Tue May 7 08:13:37 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed May 8 15:12:18 2024 +0200

tdf#160952 sw: ignore top margin of para on non-first pages with newer DOCX

The 2nd page of the bugdoc has a single paragraph, with a non-zero top
margin. This is ignored in Word, but wasn't ignored in Writer.

Experimenting with the document, it looks like old Word files also don't
ignore this top margin: it started when the compat mode is upgraded
(from binary DOC or Word 2010) to Word 2013 or newer. Also the top
margin is only ignored for the first paragraph on the page, and only in
case it's not on the first page.

Fix the problem by introducing a new SwFrame::IsCollapseUpper() function
to decide if the upper margin should be collapsed or not, and then by
using it in SwFlowFrame::CalcUpperSpace() at one place where we read the
top margin from the doc model. Take advantage of the fact that we have
related, existing compat flags that tell us if we're in "Word >= 2013"
compat mode: see e.g. GetFlyAnchorBottom(), which explains
DocumentSettingId::TAB_OVER_MARGIN is a good indicator that this is a
"Word <= 2010" document. Also, DocumentSettingId::TAB_OVER_SPACING is an
indicator that this is a Word document, so we want the "TabOverSpacing
&& !TabOverMargin" case.

This doesn't change all reads of the upper spacing of a text node, but
is enough to avoid the unwanted top spacing, as demonstrated by the
bugdoc.

(cherry picked from commit 6200d89b905d51776ff4f3c8a84f338655ffaa7f)

Change-Id: Ibdebdf5f0555256a0b6ed85d07079f14ef69a576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167306
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/CppunitTest_sw_core_layout.mk b/sw/CppunitTest_sw_core_layout.mk
index 5eb874400d53..d64a43f7d3fb 100644
--- a/sw/CppunitTest_sw_core_layout.mk
+++ b/sw/CppunitTest_sw_core_layout.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_core_layout))
 $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_layout))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_core_layout, \
+sw/qa/core/layout/calcmove \
 sw/qa/core/layout/fly \
 sw/qa/core/layout/flycnt \
 sw/qa/core/layout/frmtool \
diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
new file mode 100644
index ..3e4deec52ae8
--- /dev/null
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+
+namespace
+{
+/// Covers sw/source/core/layout/calcmove.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/core/layout/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMargin)
+{
+// Given a DOCX (>= Word 2013) file, with 2 pages:
+// When loading that document:
+createSwDoc("ignore-top-margin.docx");
+
+// Then make sure that the paragraph on the 2nd page has no top margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, "/root/page[2]/body/txt/infos/prtBounds"_ostr, 
"top"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 0
+// - Actual  : 2400
+// i.e. the top margin in the first para of a non-first page wasn't 
ignored, like in Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nParaTopMargin);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin.docx 
b/sw/qa/core/layout/data/ignore-top-margin.docx
new file mode 100644
index ..d05a1358db1e
Binary files /dev/null and b/sw/qa/core/layout/data/ignore-top-margin.docx 
differ
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 604488a18c9f..a86358508182 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -948,6 +948,9 @@ 

core.git: sw/inc sw/source

2024-05-08 Thread Miklos Vajna (via logerrit)
 sw/inc/ftninfo.hxx|5 +
 sw/source/core/doc/docftn.cxx |   19 +++
 sw/source/core/doc/docnew.cxx |1 +
 3 files changed, 25 insertions(+)

New commits:
commit 90f19126fa405a0632eae4ee8525b66bbce12625
Author: Miklos Vajna 
AuthorDate: Wed May 8 08:59:47 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 8 12:49:04 2024 +0200

tdf#160984 sw continuous endnotes: introduce an endnote section

Word lays out endnotes at the end of the document inline after body
text, Writer puts them on one or more separate endnote pages.

There was already an attempt in the past to resolve this difference, see
commit 4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add
ContinuousEndnotes layout compat option, 2019-09-30). The approach back
then was to map such endnotes to footnotes, so the extra, unwanted page
doesn't appear. This turned out to be not working too well, the compat
option is only enabled for DOC, and even there commit
dc11f5b151e1a2ea2623fc8cf806a400763955d9 (tdf#143445 DOC import: limit
the usage of the CONTINUOUS_ENDNOTES compat flag, 2023-05-23) limited
the usage of the compat flag to 1 or 2 endnotes only.

Coming back to this, try a new approach: create a section that more or
less exists only at a layout level and put endnotes into that section.
This allows reusing all the complex logic on how to lay out endnotes
inline, on one or more pages. The plan is that this new approach is more
robust, can replace the old continuous endnotes layout code and then can
be enabled for DOCX as well.

This commit just introduces the backing section format and SwSection for
that special "endnotes section" (it's special because SwSection is
usually owned by an SwSectionNode, but here there is no doc model node
for the SwSection), SwFootnoteBossFrame::AppendFootnote() doesn't try to
use the new SwEndNoteInfo::GetSwSection() yet.

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

diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx
index 17742687c944..c5490ed885d0 100644
--- a/sw/inc/ftninfo.hxx
+++ b/sw/inc/ftninfo.hxx
@@ -28,12 +28,14 @@ class SwTextFormatColl;
 class SwPageDesc;
 class SwCharFormat;
 class SwDoc;
+class SwSection;
 
 class SW_DLLPUBLIC SwEndNoteInfo : public SwClient
 {
 mutable sw::WriterMultiListener m_aDepends;
 mutable SwTextFormatColl* m_pTextFormatColl;
 mutable SwPageDesc* m_pPageDesc;
+mutable std::unique_ptr m_pSwSection;
 mutable SwCharFormat* m_pCharFormat;
 mutable SwCharFormat* m_pAnchorFormat;
 OUString m_sPrefix;
@@ -51,6 +53,9 @@ public:
 bool KnowsPageDesc() const;
 bool DependsOn(const SwPageDesc*) const;
 
+SwSection* GetSwSection(SwDoc& rDoc) const;
+void ResetSwSection();
+
 void SetFootnoteTextColl(SwTextFormatColl& rColl);
 SwTextFormatColl* GetFootnoteTextColl() const { return m_pTextFormatColl; 
} // can be 0.
 
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 16f6694c94c5..f211dcdcc9f4 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -35,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
 {
@@ -130,6 +132,23 @@ void SwEndNoteInfo::ChgPageDesc(SwPageDesc* pDesc)
 m_aDepends.StartListening(m_pPageDesc);
 }
 
+SwSection* SwEndNoteInfo::GetSwSection(SwDoc& rDoc) const
+{
+if (!m_pSwSection)
+{
+SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
+pFormat->SetFormatName(UNO_NAME_ENDNOTE);
+pFormat->SetFormatAttr(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+m_pSwSection.reset(new SwSection(SectionType::Content, 
pFormat->GetName(), *pFormat));
+}
+return m_pSwSection.get();
+}
+
+void SwEndNoteInfo::ResetSwSection()
+{
+m_pSwSection.reset();
+}
+
 void SwEndNoteInfo::SetFootnoteTextColl(SwTextFormatColl& rFormat)
 {
 m_aDepends.EndListening(m_pTextFormatColl);
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index a56e7343e8f1..daef5f64be75 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -505,6 +505,7 @@ SwDoc::~SwDoc()
 // do not have any dependencies anymore.
 m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
 rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
+mpEndNoteInfo->ResetSwSection();
 
 // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no 
clients
 for (const auto& pType : *mpTOXTypes)


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

2024-05-08 Thread Miklos Vajna (via logerrit)
 sw/qa/core/txtnode/data/plain-content-control-copy.docx |binary
 sw/qa/core/txtnode/txtnode.cxx  |   23 
 sw/source/core/txtnode/thints.cxx   |4 ++
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 32616609c788aa1cf0837af0f387390a23de1766
Author: Miklos Vajna 
AuthorDate: Tue Apr 30 08:44:59 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 8 10:57:56 2024 +0200

tdf#159683 sw content controls, plain text: fix crash with the clipboard doc

Regression from commit c804c5354855188b5a37219cfe11dc079dc235f4 (sw
content control: fix lost properties on copy, 2023-03-10), select
a plain text content control, copy it to the clipboard, quit: assertion
fails during shutdown because the doc's "placeholder text" char style is
still referenced by a client.

What happens here is that the SwContentControl copy ctor copies the
plain text flag, and that flag is only read in SwTextNode::InsertHint(),
so that causes the problem. Note how that code is inconsistent: we avoid
the creation of dummy characters in the copy case, but we still try to
adjust the start/end of the content control attribute in the copy case,
which makes not much sense.

Fix the problem by not adjusting the content control attribute
boundaries in the copy case, since the original intention was to do
thees corrections only at a UI level, during interactive edit.

It's not clear why this inconsistency had an influence on the clients of
the char style, though.

Change-Id: I86b0516464f24fc453dcd97588dafb8afd010a9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166882
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 06aeb9c61d50bba7edafe17f9d3513af26b0782f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167311
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/txtnode/data/plain-content-control-copy.docx 
b/sw/qa/core/txtnode/data/plain-content-control-copy.docx
new file mode 100644
index ..80fecae26d5b
Binary files /dev/null and 
b/sw/qa/core/txtnode/data/plain-content-control-copy.docx differ
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index c2df8a407e69..be4d97190251 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -539,6 +539,29 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSplitFlyAnchorSplit)
 CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Fly"), aPortionType);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPlainContentControlCopy)
+{
+// Given a document with a plain text content control, all text selected 
and copied to the
+// clipboard:
+createSwDoc("plain-content-control-copy.docx");
+SwDocShell* pDocShell = getSwDocShell();
+SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+pWrtShell->SelAll();
+{
+rtl::Reference xTransfer = new 
SwTransferable(*pWrtShell);
+xTransfer->Copy();
+}
+
+// When closing that document, then make sure we don't crash on shutdown:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xFrame(xModel->getCurrentController()->getFrame(),
+uno::UNO_QUERY);
+// Without the accompanying fix in place, this resulted in an assertion 
failure, a char style
+// still had clients by the time it was deleted.
+xFrame->close(false);
+mxComponent.clear();
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index cf5e1ff1cccf..c499294f4f26 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1700,7 +1700,9 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 // for all of its content.
 auto* pTextContentControl = static_txtattr_cast(
 GetTextAttrAt(pAttr->GetStart(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent));
-if (pTextContentControl)
+// If the caller is SwTextNode::CopyText, we just copy an existing 
attribute, no need to
+// correct it.
+if (pTextContentControl && !(nMode & SetAttrMode::NOTXTATRCHR))
 {
 auto& rFormatContentControl
 = 
static_cast(pTextContentControl->GetAttr());


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

2024-05-08 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx |binary
 sw/qa/extras/ww8export/ww8export4.cxx   |   24 
 sw/source/filter/ww8/wrtw8esh.cxx   |6 +++
 3 files changed, 30 insertions(+)

New commits:
commit fe9395164bc4130c83ab75e0c471516f9da61bee
Author: Miklos Vajna 
AuthorDate: Fri May 3 13:54:02 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 8 09:34:09 2024 +0200

Related: tdf#160833 teach DOC export about DoNotMirrorRtlDrawObjs

See

<https://gerrit.libreoffice.org/c/core/+/167033/1#message-e1df9bf60b7b8b2acdf0c062484ddc572939a3d9>,
no need to undo the import-time mapping in case we know that the
mirroring is avoided at a layout level.

Change-Id: Idbdc10ad327540dc5045e9b19dd42160b5139470
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167049
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 9d95eb980ef12678f6fb978badcbe1cacbe0c4dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167084
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx 
b/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx
new file mode 100644
index ..3b291901f72d
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index d31bf17a31f6..3fb0ae7b03a4 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -252,6 +252,30 @@ CPPUNIT_TEST_FIXTURE(Test, testLegalNumbering)
 verify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testDOCExportDoNotMirrorRtlDrawObjs)
+{
+// Given a document with a shape, anchored in an RTL paragraph, loaded 
from DOCX:
+createSwDoc("draw-obj-rtl-no-mirror-vml.docx");
+
+// When saving that to DOC:
+saveAndReload(mpFilter);
+
+// Then make sure the shape is on the right margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nPageRight = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+sal_Int32 nBodyRight = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+sal_Int32 nShapeLeft
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds"_ostr, 
"left"_ostr).toInt32();
+CPPUNIT_ASSERT_GREATER(nBodyRight, nShapeLeft);
+sal_Int32 nShapeRight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds"_ostr, 
"right"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected less than: 12523
+// - Actual  : 12536
+// i.e. the shape was outside of the page right margin area, due to an 
unwanted mapping.
+CPPUNIT_ASSERT_LESS(nPageRight, nShapeRight);
+}
+
 DECLARE_WW8EXPORT_TEST(testNonInlinePageBreakFirstLine, 
"nonInlinePageBreakFirstLine.doc")
 {
 SwDoc* pDoc = getSwDoc();
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 19ac50ccf5c9..272e3bd27735 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -577,6 +577,12 @@ void WW8Export::MiserableRTLFrameFormatHack(SwTwips 
, SwTwips ,
 if (SvxFrameDirection::Horizontal_RL_TB != 
m_rDoc.GetTextDirection(rFrameFormat.GetPosition()))
 return;
 
+if 
(m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS))
+{
+// Swap is handled at a layout-level, no need to compensate for it at 
export time.
+return;
+}
+
 SwTwips nWidth = rRight - rLeft;
 SwTwips nPageLeft, nPageRight;
 SwTwips nPageSize = CurrentPageWidth(nPageLeft, nPageRight);


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

2024-05-08 Thread Miklos Vajna (via logerrit)
 cui/source/inc/swpossizetabpage.hxx  |1 +
 cui/source/tabpages/swpossizetabpage.cxx |   27 +--
 sw/source/uibase/shells/drwbassh.cxx |   10 ++
 3 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit e74f2f3f259125434f7fb9f8d7c338123a0137ed
Author: Miklos Vajna 
AuthorDate: Fri May 3 08:08:29 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 8 09:33:44 2024 +0200

tdf#160833 sw DoNotMirrorRtlDrawObjs: add UI in cui/

The UI code at lcl_ChangeResIdToVerticalOrRTL() was aware that
SwAnchoredObjectPosition::CalcRelPosX() mirrors the position when the
anchor paragraph is RTL, so swapped the "from left" label to a "from
right" label.

Don't do this when the compat option is enabled, so not only we render
correctly but the UI now correctly explains why we came up with the
correct position.

Change-Id: I479ed1f085b249d10be47b66d7a656dc1bd4f936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167031
    Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 0f410680461d7ba5f70dd65b2a8263dec15ac357)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167083
Reviewed-by: Xisco Fauli 

diff --git a/cui/source/inc/swpossizetabpage.hxx 
b/cui/source/inc/swpossizetabpage.hxx
index eb73196986bf..ede7fd4231ae 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -52,6 +52,7 @@ class SvxSwPosSizeTabPage : public SfxTabPage
 boolm_bPositioningDisabled;
 boolm_bIsMultiSelection;
 boolm_bIsInRightToLeft;
+bool m_bDoNotMirrorRtlDrawObjs = false;
 TriStatem_nProtectSizeState;
 
 SwFrameExample m_aExampleWN;
diff --git a/cui/source/tabpages/swpossizetabpage.cxx 
b/cui/source/tabpages/swpossizetabpage.cxx
index 060f7b44ce9f..8de586a74df5 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::text;
 
@@ -431,14 +432,16 @@ static std::size_t lcl_GetFrmMapCount(const FrmMap* pMap)
 }
 
 static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(
-SvxSwFramePosString::StringId eStringId, bool bVertical, bool bRTL)
+SvxSwFramePosString::StringId eStringId, bool bVertical, bool 
bRTL, bool bDontMirrorRTL)
 {
 //special handling of STR_FROMLEFT
 if(SvxSwFramePosString::FROMLEFT == eStringId)
 {
+bool bMirrorRtlDrawObjs = !bDontMirrorRTL;
+bool bSwapLR = bRTL && bMirrorRtlDrawObjs;
 eStringId = bVertical ?
 bRTL ? SvxSwFramePosString::FROMBOTTOM : 
SvxSwFramePosString::FROMTOP :
-bRTL ? SvxSwFramePosString::FROMRIGHT : 
SvxSwFramePosString::FROMLEFT;
+bSwapLR ? SvxSwFramePosString::FROMRIGHT : 
SvxSwFramePosString::FROMLEFT;
 return eStringId;
 }
 if(bVertical)
@@ -728,7 +731,8 @@ WhichRangesContainer SvxSwPosSizeTabPage::GetRanges()
 SID_ATTR_TRANSFORM_AUTOWIDTH, SID_ATTR_TRANSFORM_VERT_ORIENT,
 SID_HTML_MODE, SID_HTML_MODE,
 SID_SW_FOLLOW_TEXT_FLOW, SID_SW_FOLLOW_TEXT_FLOW,
-SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION
+SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION,
+SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG
 >);
 return ranges;
 }
@@ -967,6 +971,17 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet)
 }
 m_xFollowCB->save_state();
 
+const SfxGrabBagItem* pGrabBag = GetItem(*rSet, SID_ATTR_CHAR_GRABBAG);
+if (pGrabBag)
+{
+const std::map& rMap = pGrabBag->GetGrabBag();
+auto it = rMap.find("DoNotMirrorRtlDrawObjs");
+if (it != rMap.end())
+{
+it->second >>= m_bDoNotMirrorRtlDrawObjs;
+}
+}
+
 if(m_bHtmlMode)
 {
 m_xHoriMirrorCB->hide();
@@ -1651,7 +1666,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, 
sal_uInt16 nMapPos, sal_
 {
 SvxSwFramePosString::StringId sStrId1 = 
aAsCharRelationMap[nRelPos].eStrId;
 
-sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, 
m_bIsVerticalFrame, m_bIsInRightToLeft);
+sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, 
m_bIsVerticalFrame, m_bIsInRightToLeft, m_bDoNotMirrorRtlDrawObjs);
 OUString sEntry = 
SvxSwFramePosString::GetString(sStrId1);
 
rLB.append(weld::toId([nRelPos]), sEntry);
 if (pMap[_nMapPos].nAlign == nAlign)
@@ -1706,7 +1721,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, 
sal_uInt16 nMapPos, sal_
 if (aRelationMap[nRelPos].nLBRelation == 
static_cast(nBit))
 {
   

core.git: sw/qa

2024-05-08 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfexport/rtfexport6.cxx | 1115 ++
 1 file changed, 722 insertions(+), 393 deletions(-)

New commits:
commit af3d52e444595a4a3b50528c0f02fa798e7a2b08
Author: Miklos Vajna 
AuthorDate: Wed May 8 08:11:07 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 8 09:07:54 2024 +0200

CppunitTest_sw_rtfexport6: avoid DECLARE_RTFEXPORT_TEST

No need to go via Writer-specific macros here.

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

diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx 
b/sw/qa/extras/rtfexport/rtfexport6.cxx
index e943de10622b..f206c1ddadfb 100644
--- a/sw/qa/extras/rtfexport/rtfexport6.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport6.cxx
@@ -47,25 +47,43 @@ public:
 }
 };
 
-DECLARE_RTFEXPORT_TEST(testFdo85889pc, "fdo85889-pc.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo85889pc)
 {
-uno::Reference xTextRange = getRun(getParagraph(1), 1);
+auto verify = [this]() {
+uno::Reference xTextRange = getRun(getParagraph(1), 
1);
 
-CPPUNIT_ASSERT_EQUAL(u"\u00B1\u2265\u2264"_ustr, xTextRange->getString());
+CPPUNIT_ASSERT_EQUAL(u"\u00B1\u2265\u2264"_ustr, 
xTextRange->getString());
+};
+createSwDoc("fdo85889-pc.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo85889pca, "fdo85889-pca.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo85889pca)
 {
-uno::Reference xTextRange = getRun(getParagraph(1), 1);
+auto verify = [this]() {
+uno::Reference xTextRange = getRun(getParagraph(1), 
1);
 
-CPPUNIT_ASSERT_EQUAL(u"\u00B1\u2017\u00BE"_ustr, xTextRange->getString());
+CPPUNIT_ASSERT_EQUAL(u"\u00B1\u2017\u00BE"_ustr, 
xTextRange->getString());
+};
+createSwDoc("fdo85889-pca.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo85889mac, "fdo85889-mac.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo85889mac)
 {
-uno::Reference xTextRange = getRun(getParagraph(1), 1);
+auto verify = [this]() {
+uno::Reference xTextRange = getRun(getParagraph(1), 
1);
 
-CPPUNIT_ASSERT_EQUAL(u"\u00D2\u00DA\u00DB"_ustr, xTextRange->getString());
+CPPUNIT_ASSERT_EQUAL(u"\u00D2\u00DA\u00DB"_ustr, 
xTextRange->getString());
+};
+createSwDoc("fdo85889-mac.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testFdo72031)
@@ -86,63 +104,111 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo72031)
 verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo86750, "fdo86750.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo86750)
 {
-// This was 'HYPERLINK#anchor', the URL of the hyperlink had the field 
type as a prefix, leading to broken links.
-CPPUNIT_ASSERT_EQUAL(OUString("#anchor"),
- getProperty(getRun(getParagraph(1), 1), 
"HyperLinkURL"));
+auto verify = [this]() {
+// This was 'HYPERLINK#anchor', the URL of the hyperlink had the field 
type as a prefix, leading to broken links.
+CPPUNIT_ASSERT_EQUAL(OUString("#anchor"),
+ getProperty(getRun(getParagraph(1), 1), 
"HyperLinkURL"));
+};
+createSwDoc("fdo86750.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf88811, "tdf88811.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf88811)
 {
-// The problem was that shapes anchored to the paragraph that is moved 
into a textframe were lost, so this was 2.
-CPPUNIT_ASSERT_EQUAL(4, getShapes());
+auto verify = [this]() {
+// The problem was that shapes anchored to the paragraph that is moved 
into a textframe were lost, so this was 2.
+CPPUNIT_ASSERT_EQUAL(4, getShapes());
+};
+createSwDoc("tdf88811.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo49893_2, "fdo49893-2.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo49893_2)
 {
-// Ensure that header text exists on each page (especially on second page)
-CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), 
parseDump("/root/page[1]/header/txt/text()"_ostr));
-CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), 
parseDump("/root/page[2]/header/txt/text()"_ostr));
-CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), 
parseDump("/root/page[3]/header/txt/text()"_ostr));
-CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), 
parseDump("/root/page[4]/header/txt/text()"_ostr));
-CPPUNIT_ASSERT_EQUAL(OUString("HEADER"), 
parseDump("/root/page[5]/header/txt/text()"_ostr));
-CPPUNIT_ASSERT_

core.git: sw/CppunitTest_sw_core_layout.mk sw/qa sw/source

2024-05-07 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_core_layout.mk  |1 
 sw/qa/core/layout/calcmove.cxx|   44 ++
 sw/qa/core/layout/data/ignore-top-margin.docx |binary
 sw/source/core/inc/frame.hxx  |3 +
 sw/source/core/layout/calcmove.cxx|   32 ++
 sw/source/core/layout/flowfrm.cxx |5 ++
 6 files changed, 85 insertions(+)

New commits:
commit 6200d89b905d51776ff4f3c8a84f338655ffaa7f
Author: Miklos Vajna 
AuthorDate: Tue May 7 08:13:37 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 7 09:18:06 2024 +0200

tdf#160952 sw: ignore top margin of para on non-first pages with newer DOCX

The 2nd page of the bugdoc has a single paragraph, with a non-zero top
margin. This is ignored in Word, but wasn't ignored in Writer.

Experimenting with the document, it looks like old Word files also don't
ignore this top margin: it started when the compat mode is upgraded
(from binary DOC or Word 2010) to Word 2023 or newer. Also the top
margin is only ignored for the first paragraph on the page, and only in
case it's not on the first page.

Fix the problem by introducing a new SwFrame::IsCollapseUpper() function
to decide if the upper margin should be collapsed or not, and then by
using it in SwFlowFrame::CalcUpperSpace() at one place where we read the
top margin from the doc model. Take advantage of the fact that we have
related, existing compat flags that tell us if we're in "Word >= 2013"
compat mode: see e.g. GetFlyAnchorBottom(), which explains
DocumentSettingId::TAB_OVER_MARGIN is a good indicator that this is a
"Word <= 2010" document. Also, DocumentSettingId::TAB_OVER_SPACING is an
indicator that this is a Word document, so we want the "TabOverSpacing
&& !TabOverMargin" case.

This doesn't change all reads of the upper spacing of a text node, but
is enough to avoid the unwanted top spacing, as demonstrated by the
bugdoc.

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

diff --git a/sw/CppunitTest_sw_core_layout.mk b/sw/CppunitTest_sw_core_layout.mk
index 5eb874400d53..d64a43f7d3fb 100644
--- a/sw/CppunitTest_sw_core_layout.mk
+++ b/sw/CppunitTest_sw_core_layout.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_core_layout))
 $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_layout))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_core_layout, \
+sw/qa/core/layout/calcmove \
 sw/qa/core/layout/fly \
 sw/qa/core/layout/flycnt \
 sw/qa/core/layout/frmtool \
diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
new file mode 100644
index ..3e4deec52ae8
--- /dev/null
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+
+namespace
+{
+/// Covers sw/source/core/layout/calcmove.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/core/layout/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMargin)
+{
+// Given a DOCX (>= Word 2013) file, with 2 pages:
+// When loading that document:
+createSwDoc("ignore-top-margin.docx");
+
+// Then make sure that the paragraph on the 2nd page has no top margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, "/root/page[2]/body/txt/infos/prtBounds"_ostr, 
"top"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 0
+// - Actual  : 2400
+// i.e. the top margin in the first para of a non-first page wasn't 
ignored, like in Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nParaTopMargin);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/data/ignore-top-margin.docx 
b/sw/qa/core/layout/data/ignore-top-margin.docx
new file mode 100644
index ..d05a1358db1e
Binary files /dev/null and b/sw/qa/core/layout/data/ignore-top-margin.docx 
differ
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index eac4adff7ce6..f0b7439bd283 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -951,6 +951,9 @@ public:
 virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const;
 void dumpChildrenAsXml(xmlTextWr

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

2024-05-06 Thread Miklos Vajna (via logerrit)
 sc/source/ui/docshell/docsh6.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 6360a8e721555bf9deb6ee38829a22abe39863ab
Author: Miklos Vajna 
AuthorDate: Fri Mar 1 08:34:00 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue May 7 07:55:05 2024 +0200

sc lok: make the formula separator warning dialog async

I'm not sure what exactly changed here, but recently online.git
unit-wopi-languages started to fail for me. First it was an assertion
failure:

/home/vmiklos/git/libreoffice/core/vcl/source/window/window.cxx:3186: void 
vcl::Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier*, bool): 
Assertion `pNotifier' failed.

Once ScDocShell::CheckConfigOptions() is changed to pass in the view
shell explicitly, the next error is:

kit-26201-26149 2024-02-28 10:41:31.659255 +0100 [ kitbroker_002 ] ERR  
non-async dialog triggered

So convert it to async, similar to the chart2/ hunk of commit
4b33e878a446b0bcdb1d5f882a05a256967eea54 (Make format condition, chart
delete and pivot table error async, 2024-01-10).

Change-Id: I159278b24db0acd5fddb6f4d29dae9a35321e614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164178
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167235
Tested-by: Jenkins CollaboraOffice 
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index caefdfc0fed3..344b52953faf 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -499,10 +499,10 @@ void ScDocShell::CheckConfigOptions()
 ScTabViewShell* pViewShell = GetBestViewShell();
 if (pViewShell)
 {
-std::unique_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),
+std::shared_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),
   
VclMessageType::Info, VclButtonsType::Ok,
-  
ScResId(STR_OPTIONS_WARN_SEPARATORS)));
-xInfoBox->run();
+  
ScResId(STR_OPTIONS_WARN_SEPARATORS), pViewShell));
+xInfoBox->runAsync(xInfoBox, [] (int) {});
 }
 
 // For now, this is the only option setting that could launch info


core.git: Branch 'distro/collabora/co-24.04' - cui/source sw/source

2024-05-06 Thread Miklos Vajna (via logerrit)
 cui/source/inc/swpossizetabpage.hxx  |1 +
 cui/source/tabpages/swpossizetabpage.cxx |   27 +--
 sw/source/uibase/shells/drwbassh.cxx |   10 ++
 3 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit 2b1a9d721f0664d31dfe06bad30d4a74d44262ce
Author: Miklos Vajna 
AuthorDate: Fri May 3 08:08:29 2024 +0200
Commit: Caolán McNamara 
CommitDate: Mon May 6 20:01:34 2024 +0200

tdf#160833 sw DoNotMirrorRtlDrawObjs: add UI in cui/

The UI code at lcl_ChangeResIdToVerticalOrRTL() was aware that
SwAnchoredObjectPosition::CalcRelPosX() mirrors the position when the
anchor paragraph is RTL, so swapped the "from left" label to a "from
right" label.

Don't do this when the compat option is enabled, so not only we render
correctly but the UI now correctly explains why we came up with the
correct position.

(cherry picked from commit 0f410680461d7ba5f70dd65b2a8263dec15ac357)

Change-Id: I479ed1f085b249d10be47b66d7a656dc1bd4f936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167183
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/cui/source/inc/swpossizetabpage.hxx 
b/cui/source/inc/swpossizetabpage.hxx
index eb73196986bf..ede7fd4231ae 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -52,6 +52,7 @@ class SvxSwPosSizeTabPage : public SfxTabPage
 boolm_bPositioningDisabled;
 boolm_bIsMultiSelection;
 boolm_bIsInRightToLeft;
+bool m_bDoNotMirrorRtlDrawObjs = false;
 TriStatem_nProtectSizeState;
 
 SwFrameExample m_aExampleWN;
diff --git a/cui/source/tabpages/swpossizetabpage.cxx 
b/cui/source/tabpages/swpossizetabpage.cxx
index 060f7b44ce9f..8de586a74df5 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::text;
 
@@ -431,14 +432,16 @@ static std::size_t lcl_GetFrmMapCount(const FrmMap* pMap)
 }
 
 static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(
-SvxSwFramePosString::StringId eStringId, bool bVertical, bool bRTL)
+SvxSwFramePosString::StringId eStringId, bool bVertical, bool 
bRTL, bool bDontMirrorRTL)
 {
 //special handling of STR_FROMLEFT
 if(SvxSwFramePosString::FROMLEFT == eStringId)
 {
+bool bMirrorRtlDrawObjs = !bDontMirrorRTL;
+bool bSwapLR = bRTL && bMirrorRtlDrawObjs;
 eStringId = bVertical ?
 bRTL ? SvxSwFramePosString::FROMBOTTOM : 
SvxSwFramePosString::FROMTOP :
-bRTL ? SvxSwFramePosString::FROMRIGHT : 
SvxSwFramePosString::FROMLEFT;
+bSwapLR ? SvxSwFramePosString::FROMRIGHT : 
SvxSwFramePosString::FROMLEFT;
 return eStringId;
 }
 if(bVertical)
@@ -728,7 +731,8 @@ WhichRangesContainer SvxSwPosSizeTabPage::GetRanges()
 SID_ATTR_TRANSFORM_AUTOWIDTH, SID_ATTR_TRANSFORM_VERT_ORIENT,
 SID_HTML_MODE, SID_HTML_MODE,
 SID_SW_FOLLOW_TEXT_FLOW, SID_SW_FOLLOW_TEXT_FLOW,
-SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION
+SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION,
+SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG
 >);
 return ranges;
 }
@@ -967,6 +971,17 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet)
 }
 m_xFollowCB->save_state();
 
+const SfxGrabBagItem* pGrabBag = GetItem(*rSet, SID_ATTR_CHAR_GRABBAG);
+if (pGrabBag)
+{
+const std::map& rMap = pGrabBag->GetGrabBag();
+auto it = rMap.find("DoNotMirrorRtlDrawObjs");
+if (it != rMap.end())
+{
+it->second >>= m_bDoNotMirrorRtlDrawObjs;
+}
+}
+
 if(m_bHtmlMode)
 {
 m_xHoriMirrorCB->hide();
@@ -1651,7 +1666,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, 
sal_uInt16 nMapPos, sal_
 {
 SvxSwFramePosString::StringId sStrId1 = 
aAsCharRelationMap[nRelPos].eStrId;
 
-sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, 
m_bIsVerticalFrame, m_bIsInRightToLeft);
+sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, 
m_bIsVerticalFrame, m_bIsInRightToLeft, m_bDoNotMirrorRtlDrawObjs);
 OUString sEntry = 
SvxSwFramePosString::GetString(sStrId1);
 
rLB.append(weld::toId([nRelPos]), sEntry);
 if (pMap[_nMapPos].nAlign == nAlign)
@@ -1706,7 +1721,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, 
sal_uInt16 nMapPos, sal_
 if (aRelationMap[nRelPos].nLBRelation == 
static_cast(nBit))
 {
 SvxSwFramePosString::StringId 

core.git: officecfg/registry sw/inc sw/source

2024-05-06 Thread Miklos Vajna (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |6 +
 sw/inc/strings.hrc|1 
 sw/inc/viewsh.hxx |2 +
 sw/source/core/doc/DocumentSettingManager.cxx |1 
 sw/source/core/view/viewsh.cxx|   11 
++
 sw/source/ui/config/optcomp.cxx   |6 +
 6 files changed, 27 insertions(+)

New commits:
commit 2f79dc2bc2ddf4006646f235f228b61e3f9ffde0
Author: Miklos Vajna 
AuthorDate: Mon May 6 08:36:18 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 6 10:36:33 2024 +0200

Related: tdf#160833 sw DoNotMirrorRtlDrawObjs: add enable/disable option UI

Doing this via a macro was possible already, but that didn't invalidate
the object positions on the layout, so required a document reload, which
was ugly.

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

diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index 085a380cbd41..9bc722106070 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -152,6 +152,12 @@
 
 false
   
+  
+
+  Do not mirror drawing objects anchored in paragraphs with an 
RTL writing direction
+
+false
+  
 
   
   
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index a0d04e35ba29..6a36f4740926 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1492,6 +1492,7 @@
 #define STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER 
NC_("STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER", "Do not add an extra space after 
number in footnotes / endnotes with hanging first line")
 #define STR_COMPAT_OPT_TABSRELATIVETOINDENT 
NC_("STR_COMPAT_OPT_TABSRELATIVETOINDENT", "Set tabstops relative to indent of 
paragraph")
 #define STR_COMPAT_OPT_TABOVERMARGIN
NC_("STR_COMPAT_OPT_TABOVERMARGIN", "Allow tabs to extend beyond the right 
margin")
+#define STR_COMPAT_OPT_DO_NOT_MIRROR_RTL_DRAW_OBJS 
NC_("DO_NOT_MIRROR_RTL_DRAW_OBJS", "Do not mirror drawing objects anchored in 
paragraphs with an RTL writing direction")
 
 #define STR_TABLE_PANEL_ALIGN_AUTO  
NC_("sidebartableedit|alignautolabel", "Automatic")
 #define STR_TABLE_PANEL_ALIGN_LEFT  
NC_("sidebartableedit|alignleftlabel", "Left")
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 9417702f5b86..18d33266b627 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -451,6 +451,8 @@ public:
 
 SW_DLLPUBLIC void SetTabOverMargin(bool bNew);
 
+SW_DLLPUBLIC void SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs);
+
 // DOCUMENT COMPATIBILITY FLAGS END
 
 // Calls Idle-formatter of Layout.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 55b625932efb..501344ca8108 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -139,6 +139,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbNoGapAfterNoteNumber  = 
aOptions.get(u"NoGapAfterNoteNumber"_ustr);
 mbTabRelativeToIndent   = 
aOptions.get(u"TabsRelativeToIndent"_ustr);
 mbTabOverMargin = 
aOptions.get(u"TabOverMargin"_ustr);
+mbDoNotMirrorRtlDrawObjs= 
aOptions.get(u"DoNotMirrorRtlDrawObjs"_ustr);
 }
 else
 {
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 5ec658a9cd14..f20eb694e8f4 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1083,6 +1083,17 @@ void SwViewShell::SetTabOverMargin(bool bNew)
 }
 }
 
+void SwViewShell::SetDoNotMirrorRtlDrawObjs(bool bDoNotMirrorRtlDrawObjs)
+{
+IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess();
+if (rIDSA.get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS) != 
bDoNotMirrorRtlDrawObjs)
+{
+SwWait aWait(*GetDoc()->GetDocShell(), true);
+rIDSA.set(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS, 
bDoNotMirrorRtlDrawObjs);
+lcl_InvalidateAllObjPos(*this);
+}
+}
+
 void SwViewShell::Reformat()
 {
 SwWait aWait( *GetDoc()->GetDocShell(), true );
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index 9ed4c850bd4d..9d60a786ce8b 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -62,6 +62,7 @@ constexpr std:

core.git: Branch 'libreoffice-24-2' - 2 commits - sw/CppunitTest_sw_writerfilter_filter.mk sw/Module_sw.mk sw/qa sw/source writerfilter/source

2024-05-06 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_writerfilter_filter.mk|   59 
++
 sw/Module_sw.mk |1 
 sw/qa/core/objectpositioning/objectpositioning.cxx  |   48 

 sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx |   57 
+
 sw/qa/writerfilter/cppunittests/filter/data/draw-obj-rtl-no-mirror.docx |binary
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |5 
 writerfilter/source/filter/WriterFilter.cxx |1 
 7 files changed, 170 insertions(+), 1 deletion(-)

New commits:
commit 7d75210808f8d8be7ee226031ae27b724cfcfbcc
Author: Miklos Vajna 
AuthorDate: Thu May 2 08:42:25 2024 +0200
Commit: Xisco Fauli 
CommitDate: Mon May 6 10:24:00 2024 +0200

tdf#160833 DOCX import: use the DoNotMirrorRtlDrawObjs compat flag

The bugdoc has a shape which should be on the right page margin, but it
was on the left page margin.

Use the new compat flag to have a layout that matches Word.

This way we don't need to unmap the tweaked position at export time (a
limitation that the DOC filter has).

Change-Id: I38dfae370f275d9f0897198e7b0569f2d91dd352
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166993
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167044

diff --git a/sw/CppunitTest_sw_writerfilter_filter.mk 
b/sw/CppunitTest_sw_writerfilter_filter.mk
new file mode 100644
index ..ad61c66f1ed4
--- /dev/null
+++ b/sw/CppunitTest_sw_writerfilter_filter.mk
@@ -0,0 +1,59 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# 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/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_writerfilter_filter,\
+   boost_headers \
+   libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_writerfilter_filter, \
+sw/qa/writerfilter/cppunittests/filter/WriterFilter \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_writerfilter_filter, \
+basegfx \
+comphelper \
+cppu \
+cppuhelper \
+oox \
+sal \
+subsequenttest \
+test \
+unotest \
+utl \
+tl \
+vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sw_writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_writerfilter_filter))
+$(eval $(call gb_CppunitTest_use_vcl,sw_writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_writerfilter_filter,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_writerfilter_filter,\
+   officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_writerfilter_filter))
+
+# we need to explicitly depend on library sw_writerfilter because it is not 
implied
+# by a link relation
+$(call gb_CppunitTest_get_target,sw_writerfilter_filter) : $(call 
gb_Library_get_target,sw_writerfilter)
+
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(eval $(call 
gb_CppunitTest_set_non_application_font_use,sw_writerfilter_filter,abort))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 7d5679e52f3c..7556ecf33778 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -168,6 +168,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
 CppunitTest_sw_a11y \
 CppunitTest_sw_core_theme \
 CppunitTest_sw_pdf_test \
+CppunitTest_sw_writerfilter_filter \
 ))
 
 ifneq ($(DISABLE_GUI),TRUE)
diff --git a/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx 
b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
new file mode 100644
index ..10b8cab57a45
--- /dev/null
+++ b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for sw/source/writerfilter/filter/WriterFilter.cxx.
+class Test : public UnoApiXmlTest
+{
+public:
+Test()
+: UnoApiXmlTest("/sw/qa/writerfilter/cppunittests/filter/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FI

core.git: include/svx reportdesign/source svx/source

2024-05-06 Thread Miklos Vajna (via logerrit)
 include/svx/svdundo.hxx  |2 +-
 reportdesign/source/core/sdr/UndoActions.cxx |   12 ++--
 reportdesign/source/ui/misc/RptUndo.cxx  |2 +-
 svx/source/form/fmundo.cxx   |8 
 svx/source/svdraw/svdundo.cxx|   24 
 5 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 9683305264568d77a1d912f4b0d2e063455feeae
Author: Miklos Vajna 
AuthorDate: Mon May 6 08:19:53 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 6 10:00:58 2024 +0200

svx: prefix members of SdrUndoAction

See tdf#94879 for motivation.

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

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 80c7ae4560b3..824f36f06efc 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -60,7 +60,7 @@ namespace svx { namespace diagram {
 class SVXCORE_DLLPUBLIC SdrUndoAction : public SfxUndoAction
 {
 protected:
-SdrModel& rMod;
+SdrModel& m_rMod;
 ViewShellId m_nViewShellId;
 
 protected:
diff --git a/reportdesign/source/core/sdr/UndoActions.cxx 
b/reportdesign/source/core/sdr/UndoActions.cxx
index 5aaa412cf1ff..e078ffa2c931 100644
--- a/reportdesign/source/core/sdr/UndoActions.cxx
+++ b/reportdesign/source/core/sdr/UndoActions.cxx
@@ -113,7 +113,7 @@ OUndoContainerAction::~OUndoContainerAction()
 if ( !xChild.is() || xChild->getParent().is() )
 return;
 
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 rEnv.RemoveElement( m_xOwnElement );
 
 // -> dispose it
@@ -141,7 +141,7 @@ void OUndoContainerAction::implReInsert( )
 
 void OUndoContainerAction::implReRemove( )
 {
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 try
 {
 OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
@@ -234,7 +234,7 @@ OUndoGroupSectionAction::OUndoGroupSectionAction(
 
 void OUndoGroupSectionAction::implReInsert( )
 {
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 try
 {
 OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
@@ -251,7 +251,7 @@ void OUndoGroupSectionAction::implReInsert( )
 
 void OUndoGroupSectionAction::implReRemove( )
 {
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 try
 {
 OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
@@ -278,7 +278,7 @@ OUndoReportSectionAction::OUndoReportSectionAction(
 
 void OUndoReportSectionAction::implReInsert( )
 {
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 try
 {
 OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
@@ -301,7 +301,7 @@ void OUndoReportSectionAction::implReInsert( )
 
 void OUndoReportSectionAction::implReRemove( )
 {
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 try
 {
 OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
diff --git a/reportdesign/source/ui/misc/RptUndo.cxx 
b/reportdesign/source/ui/misc/RptUndo.cxx
index 7a835237722a..bff3c4518b1a 100644
--- a/reportdesign/source/ui/misc/RptUndo.cxx
+++ b/reportdesign/source/ui/misc/RptUndo.cxx
@@ -125,7 +125,7 @@ OSectionUndo::~OSectionUndo()
 if ( m_bInserted )
 return;
 
-OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod 
).GetUndoEnv();
+OXUndoEnvironment& rEnv = static_cast< OReportModel& >( m_rMod 
).GetUndoEnv();
 for (uno::Reference& xShape : m_aControls)
 {
 rEnv.RemoveElement(xShape);
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 9bbe99a81d6e..956d4a06e43e 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -964,7 +964,7 @@ FmUndoPropertyAction::FmUndoPropertyAction(FmFormModel& 
rNewMod, const PropertyC
 
 void FmUndoPropertyAction::Undo()
 {
-FmXUndoEnvironment& rEnv = static_cast(rMod).GetUndoEnv();
+FmXUndoEnvironment& rEnv = static_cast(m_rMod).GetUndoEnv();
 
 if (!xObj.is() || rEnv.IsLocked())
 return;
@@ -984,7 +984,7 @@ void FmUndoPropertyAction::Undo()
 

Re: Which GUI toolkit should I learn so that I can "Hack the UI"

2024-05-06 Thread Miklos Vajna
Hi,

On Fri, May 03, 2024 at 10:45:01PM +0530, Printf Debugging 
 wrote:
> **Opinions invited**: I want to work on the UI, beyond small issues, like
> creating custom widgets, notebookbar, tabbed UI etc. I feel that I need to
> know a GUI toolkit well, like gtk or qt for that. So some days ago, I
> started playing around with GTK. My question is that which toolkit will be
> more useful? I picked GTK because we use .ui files for the UI, and being
> good at GTK will somehow help when working on LO UI, but again I don't know,
> that's just an idea.

gtk is probably a good idea, given that these days much of the UI is
welded and the LO weld API is designed after gtk.

Regards,

Miklos


core.git: sw/qa sw/source

2024-05-03 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx |binary
 sw/qa/extras/ww8export/ww8export4.cxx   |   24 
 sw/source/filter/ww8/wrtw8esh.cxx   |6 +++
 3 files changed, 30 insertions(+)

New commits:
commit 9d95eb980ef12678f6fb978badcbe1cacbe0c4dc
Author: Miklos Vajna 
AuthorDate: Fri May 3 13:54:02 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 3 16:28:04 2024 +0200

Related: tdf#160833 teach DOC export about DoNotMirrorRtlDrawObjs

See

<https://gerrit.libreoffice.org/c/core/+/167033/1#message-e1df9bf60b7b8b2acdf0c062484ddc572939a3d9>,
no need to undo the import-time mapping in case we know that the
mirroring is avoided at a layout level.

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

diff --git a/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx 
b/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx
new file mode 100644
index ..3b291901f72d
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index d3bc9c4071d9..6caffceffa00 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -267,6 +267,30 @@ CPPUNIT_TEST_FIXTURE(Test, testLegalNumbering)
 verify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testDOCExportDoNotMirrorRtlDrawObjs)
+{
+// Given a document with a shape, anchored in an RTL paragraph, loaded 
from DOCX:
+createSwDoc("draw-obj-rtl-no-mirror-vml.docx");
+
+// When saving that to DOC:
+saveAndReload(mpFilter);
+
+// Then make sure the shape is on the right margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nPageRight = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+sal_Int32 nBodyRight = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+sal_Int32 nShapeLeft
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds"_ostr, 
"left"_ostr).toInt32();
+CPPUNIT_ASSERT_GREATER(nBodyRight, nShapeLeft);
+sal_Int32 nShapeRight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds"_ostr, 
"right"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected less than: 12523
+// - Actual  : 12536
+// i.e. the shape was outside of the page right margin area, due to an 
unwanted mapping.
+CPPUNIT_ASSERT_LESS(nPageRight, nShapeRight);
+}
+
 DECLARE_WW8EXPORT_TEST(testNonInlinePageBreakFirstLine, 
"nonInlinePageBreakFirstLine.doc")
 {
 SwDoc* pDoc = getSwDoc();
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index c13d06106286..21afd78cce1d 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -576,6 +576,12 @@ void WW8Export::MiserableRTLFrameFormatHack(SwTwips 
, SwTwips ,
 if (SvxFrameDirection::Horizontal_RL_TB != 
m_rDoc.GetTextDirection(rFrameFormat.GetPosition()))
 return;
 
+if 
(m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS))
+{
+// Swap is handled at a layout-level, no need to compensate for it at 
export time.
+return;
+}
+
 SwTwips nWidth = rRight - rLeft;
 SwTwips nPageLeft, nPageRight;
 SwTwips nPageSize = CurrentPageWidth(nPageLeft, nPageRight);


core.git: Branch 'distro/collabora/co-24.04' - writerfilter/CppunitTest_writerfilter_filter.mk writerfilter/Module_writerfilter.mk writerfilter/qa writerfilter/source

2024-05-03 Thread Miklos Vajna (via logerrit)
 writerfilter/CppunitTest_writerfilter_filter.mk  |   55 
+
 writerfilter/Module_writerfilter.mk  |1 
 writerfilter/qa/cppunittests/filter/WriterFilter.cxx |   57 
++
 writerfilter/qa/cppunittests/filter/data/draw-obj-rtl-no-mirror.docx |binary
 writerfilter/source/filter/WriterFilter.cxx  |1 
 5 files changed, 114 insertions(+)

New commits:
commit ffcd1d52574e19ce45b47758d3ed445d2a9da943
Author: Miklos Vajna 
AuthorDate: Thu May 2 08:42:25 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri May 3 15:17:14 2024 +0200

tdf#160833 DOCX import: use the DoNotMirrorRtlDrawObjs compat flag

The bugdoc has a shape which should be on the right page margin, but it
was on the left page margin.

Use the new compat flag to have a layout that matches Word.

This way we don't need to unmap the tweaked position at export time (a
limitation that the DOC filter has).

(cherry picked from commit 01dcc9a652ecfc65fb674b492afa6f58b0a846db)

Conflicts:
sw/Module_sw.mk

Change-Id: I38dfae370f275d9f0897198e7b0569f2d91dd352
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167033
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/CppunitTest_writerfilter_filter.mk 
b/writerfilter/CppunitTest_writerfilter_filter.mk
new file mode 100644
index ..8b719bba5713
--- /dev/null
+++ b/writerfilter/CppunitTest_writerfilter_filter.mk
@@ -0,0 +1,55 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# 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/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_externals,writerfilter_filter,\
+   boost_headers \
+   libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_filter, \
+writerfilter/qa/cppunittests/filter/WriterFilter \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,writerfilter_filter, \
+basegfx \
+comphelper \
+cppu \
+cppuhelper \
+oox \
+sal \
+subsequenttest \
+test \
+unotest \
+utl \
+tl \
+vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_ure,writerfilter_filter))
+$(eval $(call gb_CppunitTest_use_vcl,writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_rdb,writerfilter_filter,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,writerfilter_filter,\
+   officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,writerfilter_filter))
+
+# we need to explicitly depend on library writerfilter because it is not 
implied
+# by a link relation
+$(call gb_CppunitTest_get_target,writerfilter_filter) : $(call 
gb_Library_get_target,writerfilter)
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerfilter/Module_writerfilter.mk 
b/writerfilter/Module_writerfilter.mk
index 587bf4fa4dfc..08710edb23e6 100644
--- a/writerfilter/Module_writerfilter.mk
+++ b/writerfilter/Module_writerfilter.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,writerfilter,\
 CppunitTest_writerfilter_dmapper \
 CppunitTest_writerfilter_ooxml \
 CppunitTest_writerfilter_rtftok \
+CppunitTest_writerfilter_filter \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/writerfilter/qa/cppunittests/filter/WriterFilter.cxx 
b/writerfilter/qa/cppunittests/filter/WriterFilter.cxx
new file mode 100644
index ..ae741085277c
--- /dev/null
+++ b/writerfilter/qa/cppunittests/filter/WriterFilter.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for writerfilter/source/filter/WriterFilter.cxx.
+class Test : public UnoApiXmlTest
+{
+public:
+Test()
+: UnoApiXmlTest("/writerfilter/qa/cppunittests/filter/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjs)
+{
+// Given a document with a shape, anchored in an RTL paragraph:
+// When loading that document:
+loadFromFile(u"draw-obj-rtl-no-mirror.docx");
+
+// Then

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-03 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx |binary
 sw/qa/extras/ww8export/ww8export4.cxx   |   24 
 sw/source/filter/ww8/wrtw8esh.cxx   |6 +++
 3 files changed, 30 insertions(+)

New commits:
commit 3e9ff13bb78c56b5ddc6316b0b73c8a21ea7c0b0
Author: Miklos Vajna 
AuthorDate: Fri May 3 12:00:59 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri May 3 15:16:56 2024 +0200

Related: tdf#160833 teach DOC export about DoNotMirrorRtlDrawObjs

See

<https://gerrit.libreoffice.org/c/core/+/167033/1#message-e1df9bf60b7b8b2acdf0c062484ddc572939a3d9>,
no need to undo the import-time mapping in case we know that the
mirroring is avoided at a layout level.

Change-Id: Idbdc10ad327540dc5045e9b19dd42160b5139470
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167048
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx 
b/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx
new file mode 100644
index ..3b291901f72d
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/draw-obj-rtl-no-mirror-vml.docx differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index e297ac949afe..b25d3b4a7701 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -262,6 +262,30 @@ CPPUNIT_TEST_FIXTURE(Test, testLegalNumbering)
 verify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testDOCExportDoNotMirrorRtlDrawObjs)
+{
+// Given a document with a shape, anchored in an RTL paragraph, loaded 
from DOCX:
+createSwDoc("draw-obj-rtl-no-mirror-vml.docx");
+
+// When saving that to DOC:
+saveAndReload(mpFilter);
+
+// Then make sure the shape is on the right margin:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nPageRight = getXPath(pXmlDoc, "//page/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+sal_Int32 nBodyRight = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+sal_Int32 nShapeLeft
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds"_ostr, 
"left"_ostr).toInt32();
+CPPUNIT_ASSERT_GREATER(nBodyRight, nShapeLeft);
+sal_Int32 nShapeRight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds"_ostr, 
"right"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected less than: 12523
+// - Actual  : 12536
+// i.e. the shape was outside of the page right margin area, due to an 
unwanted mapping.
+CPPUNIT_ASSERT_LESS(nPageRight, nShapeRight);
+}
+
 DECLARE_WW8EXPORT_TEST(testNonInlinePageBreakFirstLine, 
"nonInlinePageBreakFirstLine.doc")
 {
 SwDoc* pDoc = getSwDoc();
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index f9e1082f9276..3e7087221db0 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -577,6 +577,12 @@ void WW8Export::MiserableRTLFrameFormatHack(SwTwips 
, SwTwips ,
 if (SvxFrameDirection::Horizontal_RL_TB != 
m_rDoc.GetTextDirection(rFrameFormat.GetPosition()))
 return;
 
+if 
(m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS))
+{
+// Swap is handled at a layout-level, no need to compensate for it at 
export time.
+return;
+}
+
 SwTwips nWidth = rRight - rLeft;
 SwTwips nPageLeft, nPageRight;
 SwTwips nPageSize = CurrentPageWidth(nPageLeft, nPageRight);


core.git: cui/source sw/source

2024-05-03 Thread Miklos Vajna (via logerrit)
 cui/source/inc/swpossizetabpage.hxx  |1 +
 cui/source/tabpages/swpossizetabpage.cxx |   27 +--
 sw/source/uibase/shells/drwbassh.cxx |   10 ++
 3 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit 0f410680461d7ba5f70dd65b2a8263dec15ac357
Author: Miklos Vajna 
AuthorDate: Fri May 3 08:08:29 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 3 13:51:08 2024 +0200

tdf#160833 sw DoNotMirrorRtlDrawObjs: add UI in cui/

The UI code at lcl_ChangeResIdToVerticalOrRTL() was aware that
SwAnchoredObjectPosition::CalcRelPosX() mirrors the position when the
anchor paragraph is RTL, so swapped the "from left" label to a "from
right" label.

Don't do this when the compat option is enabled, so not only we render
correctly but the UI now correctly explains why we came up with the
correct position.

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

diff --git a/cui/source/inc/swpossizetabpage.hxx 
b/cui/source/inc/swpossizetabpage.hxx
index 2e5a15fbebbb..037cede29326 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -53,6 +53,7 @@ class SvxSwPosSizeTabPage : public SfxTabPage
 boolm_bPositioningDisabled;
 boolm_bIsMultiSelection;
 boolm_bIsInRightToLeft;
+bool m_bDoNotMirrorRtlDrawObjs = false;
 TriStatem_nProtectSizeState;
 
 SwFrameExample m_aExampleWN;
diff --git a/cui/source/tabpages/swpossizetabpage.cxx 
b/cui/source/tabpages/swpossizetabpage.cxx
index 1a0d14759eac..752af91a1a62 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -433,14 +434,16 @@ static std::size_t lcl_GetFrmMapCount(const FrmMap* pMap)
 }
 
 static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(
-SvxSwFramePosString::StringId eStringId, bool bVertical, bool bRTL)
+SvxSwFramePosString::StringId eStringId, bool bVertical, bool 
bRTL, bool bDontMirrorRTL)
 {
 //special handling of STR_FROMLEFT
 if(SvxSwFramePosString::FROMLEFT == eStringId)
 {
+bool bMirrorRtlDrawObjs = !bDontMirrorRTL;
+bool bSwapLR = bRTL && bMirrorRtlDrawObjs;
 eStringId = bVertical ?
 bRTL ? SvxSwFramePosString::FROMBOTTOM : 
SvxSwFramePosString::FROMTOP :
-bRTL ? SvxSwFramePosString::FROMRIGHT : 
SvxSwFramePosString::FROMLEFT;
+bSwapLR ? SvxSwFramePosString::FROMRIGHT : 
SvxSwFramePosString::FROMLEFT;
 return eStringId;
 }
 if(bVertical)
@@ -749,7 +752,8 @@ WhichRangesContainer SvxSwPosSizeTabPage::GetRanges()
 SID_ATTR_TRANSFORM_AUTOWIDTH, SID_ATTR_TRANSFORM_VERT_ORIENT,
 SID_HTML_MODE, SID_HTML_MODE,
 SID_SW_FOLLOW_TEXT_FLOW, SID_SW_FOLLOW_TEXT_FLOW,
-SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION
+SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION,
+SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG
 >);
 return ranges;
 }
@@ -988,6 +992,17 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet)
 }
 m_xFollowCB->save_state();
 
+const SfxGrabBagItem* pGrabBag = GetItem(*rSet, SID_ATTR_CHAR_GRABBAG);
+if (pGrabBag)
+{
+const std::map& rMap = pGrabBag->GetGrabBag();
+auto it = rMap.find("DoNotMirrorRtlDrawObjs");
+if (it != rMap.end())
+{
+it->second >>= m_bDoNotMirrorRtlDrawObjs;
+}
+}
+
 if(m_bHtmlMode)
 {
 m_xHoriMirrorCB->hide();
@@ -1677,7 +1692,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, 
sal_uInt16 nMapPos, sal_
 {
 SvxSwFramePosString::StringId sStrId1 = 
aAsCharRelationMap[nRelPos].eStrId;
 
-sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, 
m_bIsVerticalFrame, m_bIsInRightToLeft);
+sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, 
m_bIsVerticalFrame, m_bIsInRightToLeft, m_bDoNotMirrorRtlDrawObjs);
 OUString sEntry = 
SvxSwFramePosString::GetString(sStrId1);
 
rLB.append(weld::toId([nRelPos]), sEntry);
 if (pMap[_nMapPos].nAlign == nAlign)
@@ -1732,7 +1747,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, 
sal_uInt16 nMapPos, sal_
 if (aRelationMap[nRelPos].nLBRelation == 
static_cast(nBit))
 {
 SvxSwFramePosString::StringId sStrId1 = 
m_xHoriMirrorCB->get_active() ? aRelationMap[nRelPos].eMirrorStrId : 
aRelationMap[nRelPos].eStrId;
-  

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

2024-05-03 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/uibase/uno/uno.cxx  |   24 
 sw/source/core/doc/DocumentSettingManager.cxx |   10 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/filter/xml/xmlexp.cxx   |1 +
 sw/source/filter/xml/xmlimp.cxx   |   10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 7 files changed, 65 insertions(+)

New commits:
commit 799767d5670efc7f996892de5dd7d1afdb4a6cce
Author: Miklos Vajna 
AuthorDate: Mon Apr 29 10:39:43 2024 +0200
Commit: Xisco Fauli 
CommitDate: Fri May 3 11:55:12 2024 +0200

tdf#160833 sw: add a DoNotMirrorRtlDrawObjs compat flag

The DOCX bugdoc has a circle shape anchored inside an RTL paragraph:
this shows up on the right hand side in Word, but on the left hand side
in Writer.

What happens is that Writer implicitly mirrors draw objects anchored in
RTL paragraphs, while Word doesn't do this.

Start fixing the problem by adding a new layout compatibility flag that
can be used by the DOCX import in the future, to leave the behavior
unchanged for new & existing ODT documents.

An alternative would be to do something similar to the DOC import's
SwWW8ImplReader::MiserableRTLGraphicsHack(), but 1) we don't have the
page margins by the time we import the shape and 2) as its name says, it
doesn't feel like a clean solution, it's better to handle this
difference at a layout level.

Change-Id: I2ec067d86c7fbdbe57e4cd9547015fe25a9a56b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166820
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit c675eaf923cf579670b8ba2f7794b47be7fad39e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166845
Reviewed-by: Xisco Fauli 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 0dd9467bdf13..264860b854c4 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -99,6 +99,7 @@ enum class DocumentSettingId
 // tdf#119908 new paragraph justification
 JUSTIFY_LINES_WITH_SHRINKING,
 APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
+DO_NOT_MIRROR_RTL_DRAW_OBJS,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index d38d0bbfc967..3e6d9c93d51c 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -560,6 +560,30 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testAllowTextAfterFloatingTableBreak)
 CPPUNIT_ASSERT(bAllowTextAfterFloatingTableBreak);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotMirrorRtlDrawObjs)
+{
+// Given an empty document:
+createSwDoc();
+
+// When checking the state of the DoNotMirrorRtlDrawObjs compat flag:
+uno::Reference xDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xSettings(
+xDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+bool bDoNotMirrorRtlDrawObjs{};
+// Without the accompanying fix in place, this test would have failed with:
+// An uncaught exception of type 
com.sun.star.beans.UnknownPropertyException
+// i.e. the compat flag was not recognized.
+xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= 
bDoNotMirrorRtlDrawObjs;
+// Then make sure it's false by default:
+CPPUNIT_ASSERT(!bDoNotMirrorRtlDrawObjs);
+
+// And when setting DoNotMirrorRtlDrawObjs=true:
+xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true));
+// Then make sure it gets enabled:
+xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= 
bDoNotMirrorRtlDrawObjs;
+CPPUNIT_ASSERT(bDoNotMirrorRtlDrawObjs);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 661c001e98c2..14cfa5fd3c24 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -256,6 +256,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 return mbDoNotBreakWrappedTables;
 case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
 return mbAllowTextAfterFloatingTableBreak;
+case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
+return mbDoNotMirrorRtlDrawObjs;
 case DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING:
 return mbJustifyLinesWithShrinking;
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
@@ -450,6 +452,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbApplyTextAttrToEm

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

2024-05-03 Thread Miklos Vajna (via logerrit)
 sc/source/core/data/column3.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 1f49854c0d18000f52d3ad4525bb52b2f35cc064
Author: Miklos Vajna 
AuthorDate: Wed Apr 24 09:37:35 2024 +0200
Commit: Michael Stahl 
CommitDate: Fri May 3 11:42:03 2024 +0200

sc: fix crash in ScColumn::SetEditText()

Crashreport:

> SIG   Fatal signal received: SIGSEGV code: 128 for address: 0x0
> program/libsclo.so
>   ScColumn::SetEditText(int, std::unique_ptr >)
>   sc/source/core/data/column3.cxx:2362
> program/libsclo.so
>   ScTable::SetEditText(short, int, std::unique_ptr >)
>   
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395
> program/libsclo.so
>   ScDocument::SetEditText(ScAddress const&, 
std::unique_ptr >)
>   
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395
> program/libsclo.so
>   ScDocFunc::SetEditCell(ScAddress const&, EditTextObject const&, 
bool)
>   
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395
> program/libsclo.so
>   (anonymous 
namespace)::finalizeFormulaProcessing(std::shared_ptr<(anonymous 
namespace)::FormulaProcessingContext>)
>   sc/source/ui/view/viewfunc.cxx:565

Change-Id: I331ca8784702fdcb0ebad6a0a73390dbe2615ece
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166612
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit e3ce4aad47c052dcd67107f7c91336f4ecc949be)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166526
Reviewed-by: Xisco Fauli 
(cherry picked from commit 58b85fc5e4ebe6c8a77e2b1935c23bf0ebebad0a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166848
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f0f4cc83263b..5a1582e560d7 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2358,6 +2358,11 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const 
OUString& rString,
 
 void ScColumn::SetEditText( SCROW nRow, std::unique_ptr 
pEditText )
 {
+if (!pEditText)
+{
+return;
+}
+
 pEditText->NormalizeString(GetDoc().GetSharedStringPool());
 std::vector aNewSharedRows;
 sc::CellStoreType::iterator it = GetPositionToInsert(nRow, aNewSharedRows, 
false);


ESC meeting minutes: 2024-05-02

2024-05-02 Thread Miklos Vajna

* Present:
+ Cloph, Hossein, Olivier, Caolan, Heiko, Ilmari, Jonathan, Michael W, 
Eike, Regina, Stephan, Xisco, Thorsten, Stephane, Michael S, Miklos

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 RC2 this week
  + last release in this line? (Xisco)
  + last planned, yes (Cloph)
+ 24.2: 24.2.4 RC1 in 2 weeks
+ 24.8: first alpha in 1 week

* Documentation (Olivier)
+ Sometimes missing features to be documented
  + good if Olivier is aware
+ Highlight of the cell background during editing e.g.
  + so translators would discover these features as well.
+ Helpcontent2
+ Updates and fixes (ohallot, stragu)
+ Page for SEQUENCE Calc function (ohallot)
+ Guides
+ Stalled.
+ Bugzilla Documentation statistics
264(264) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 10(-9)   38(2) 101(3) 223(1)
 commented 18(0)63(3) 251(13)850(-2)
  resolved  6(-3)   19(3)  49(3) 119(2)
+ top 10 contributors:
  Olivier Hallot made 33 changes in 1 month, and 256 changes in 1 year
  Stéphane Guillou made 29 changes in 1 month, and 255 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 105 changes in 1 
year
  Dione Maddern made 10 changes in 1 month, and 31 changes in 1 year
  MeBugzilla made 7 changes in 1 month, and 7 changes in 1 year
  Nabet, Julien made 7 changes in 1 month, and 53 changes in 1 year
  nobu made 7 changes in 1 month, and 16 changes in 1 year
  Ilmari Lauhakangas made 6 changes in 1 month, and 71 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Kaganski, Mike made 4 changes in 1 month, and 68 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
242(242) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  5(2)   8(-3) 15(-3)  24(-2)
 commented 38(-11)   173(-18)   559(6) 1842(-60)
   removed  3(3)   5(3)   5(3)   14(3)
  resolved  7(-2) 30(-1) 87(-1) 315(0)
+ top 10 contributors:
  Heiko Tietze made 107 changes in 1 month, and 1078 changes in 1 year
  Vernon, Stuart Foote made 105 changes in 1 month, and 306 changes in 
1 year
  Stéphane Guillou made 57 changes in 1 month, and 643 changes in 1 year
  Ilmari Lauhakangas made 19 changes in 1 month, and 142 changes in 1 
year
  Dieter made 15 changes in 1 month, and 136 changes in 1 year
  Eyal Rozenberg made 9 changes in 1 month, and 133 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 96 changes in 1 year
  Petros Christopoulos made 7 changes in 1 month, and 7 changes in 1 
year
  m.a.riosv made 6 changes in 1 month, and 49 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year
+ [Bug 160657] Improve how Writer Navigator Headings are displayed when
   alphabetically sorted
+ [Bug 160694] Add .uno:VRuler button to NB Tabbed/Tabbed Compact cutomize
   View list
+ [Bug 160873] Usability: "OLE Object" probably not familiar language
   (Menu: Insert/OLE Object)
+ [Bug 160219] Add confirmation dialog to "Delete all comments"
   (.uno:DeleteAllNotes) in Calc
 -> + [Bug 160465] Ctrl+Shift+F6 is marked reserved, but doesn't do anything
  + ReservedKeys in svapp.cxx not working for triple-state
 -> + [Bug 95274] Wrong editing languages offered
  + gaelic or welsh not correctly reported per libexttextcat, unclear
and input is highly welcome

* Crash Testing (Caolan)
+ 63(+39) import failure, 59(+40) export failures
  + down from a higher, unreported numbers
  + it's an improvement, in fact.
+ 21 coverity issues
+ 5 ossfuzz issues

* Crash Reporting (Xisco)
+ 7.6.5.29807(+812)
+ 7.6.6.32944(+1016)
+ 24.2.1.212822(+961)
+ 24.2.2.26745(+2138)
+ let's wait until next week to see the results from the new release

* Mentoring (Hossein)
  + Reviewd submissions from newcomers
  + Added a new draft blog post for fixing crashes:
Crash fixes, part 4: Assertion failure
(Previous parts were around segfaults, aborts, and how to fix and test them)
https://dev.blog.documentfoundation.org/?p=929=1&_ppp=63e6295aab
  committer...   1 week 1 month 3 months 12 months
  open 104(22) 169(38) 201(42)   201(42)
   reviews 356(26)1152(-40)   3648(-116)   12418(-90)
merged 288(75) 981(47)3241(-10)12462(-29)
 abandoned   

ESC meeting minutes: 2024-05-02

2024-05-02 Thread Miklos Vajna

* Present:
+ Cloph, Hossein, Olivier, Caolan, Heiko, Ilmari, Jonathan, Michael W, 
Eike, Regina, Stephan, Xisco, Thorsten, Stephane, Michael S, Miklos

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 RC2 this week
  + last release in this line? (Xisco)
  + last planned, yes (Cloph)
+ 24.2: 24.2.4 RC1 in 2 weeks
+ 24.8: first alpha in 1 week

* Documentation (Olivier)
+ Sometimes missing features to be documented
  + good if Olivier is aware
+ Highlight of the cell background during editing e.g.
  + so translators would discover these features as well.
+ Helpcontent2
+ Updates and fixes (ohallot, stragu)
+ Page for SEQUENCE Calc function (ohallot)
+ Guides
+ Stalled.
+ Bugzilla Documentation statistics
264(264) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 10(-9)   38(2) 101(3) 223(1)
 commented 18(0)63(3) 251(13)850(-2)
  resolved  6(-3)   19(3)  49(3) 119(2)
+ top 10 contributors:
  Olivier Hallot made 33 changes in 1 month, and 256 changes in 1 year
  Stéphane Guillou made 29 changes in 1 month, and 255 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 105 changes in 1 
year
  Dione Maddern made 10 changes in 1 month, and 31 changes in 1 year
  MeBugzilla made 7 changes in 1 month, and 7 changes in 1 year
  Nabet, Julien made 7 changes in 1 month, and 53 changes in 1 year
  nobu made 7 changes in 1 month, and 16 changes in 1 year
  Ilmari Lauhakangas made 6 changes in 1 month, and 71 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Kaganski, Mike made 4 changes in 1 month, and 68 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
242(242) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  5(2)   8(-3) 15(-3)  24(-2)
 commented 38(-11)   173(-18)   559(6) 1842(-60)
   removed  3(3)   5(3)   5(3)   14(3)
  resolved  7(-2) 30(-1) 87(-1) 315(0)
+ top 10 contributors:
  Heiko Tietze made 107 changes in 1 month, and 1078 changes in 1 year
  Vernon, Stuart Foote made 105 changes in 1 month, and 306 changes in 
1 year
  Stéphane Guillou made 57 changes in 1 month, and 643 changes in 1 year
  Ilmari Lauhakangas made 19 changes in 1 month, and 142 changes in 1 
year
  Dieter made 15 changes in 1 month, and 136 changes in 1 year
  Eyal Rozenberg made 9 changes in 1 month, and 133 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 96 changes in 1 year
  Petros Christopoulos made 7 changes in 1 month, and 7 changes in 1 
year
  m.a.riosv made 6 changes in 1 month, and 49 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year
+ [Bug 160657] Improve how Writer Navigator Headings are displayed when
   alphabetically sorted
+ [Bug 160694] Add .uno:VRuler button to NB Tabbed/Tabbed Compact cutomize
   View list
+ [Bug 160873] Usability: "OLE Object" probably not familiar language
   (Menu: Insert/OLE Object)
+ [Bug 160219] Add confirmation dialog to "Delete all comments"
   (.uno:DeleteAllNotes) in Calc
 -> + [Bug 160465] Ctrl+Shift+F6 is marked reserved, but doesn't do anything
  + ReservedKeys in svapp.cxx not working for triple-state
 -> + [Bug 95274] Wrong editing languages offered
  + gaelic or welsh not correctly reported per libexttextcat, unclear
and input is highly welcome

* Crash Testing (Caolan)
+ 63(+39) import failure, 59(+40) export failures
  + down from a higher, unreported numbers
  + it's an improvement, in fact.
+ 21 coverity issues
+ 5 ossfuzz issues

* Crash Reporting (Xisco)
+ 7.6.5.29807(+812)
+ 7.6.6.32944(+1016)
+ 24.2.1.212822(+961)
+ 24.2.2.26745(+2138)
+ let's wait until next week to see the results from the new release

* Mentoring (Hossein)
  + Reviewd submissions from newcomers
  + Added a new draft blog post for fixing crashes:
Crash fixes, part 4: Assertion failure
(Previous parts were around segfaults, aborts, and how to fix and test them)
https://dev.blog.documentfoundation.org/?p=929=1&_ppp=63e6295aab
  committer...   1 week 1 month 3 months 12 months
  open 104(22) 169(38) 201(42)   201(42)
   reviews 356(26)1152(-40)   3648(-116)   12418(-90)
merged 288(75) 981(47)3241(-10)12462(-29)
 abandoned   

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-05-02 Thread Miklos Vajna (via logerrit)
 sw/qa/core/objectpositioning/objectpositioning.cxx  |   48 
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |5 +
 2 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit 7f790600a530f7ca7c1e7de0abc0a5bf2f6b3023
Author: Miklos Vajna 
AuthorDate: Tue Apr 30 08:22:03 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 2 14:26:20 2024 +0200

tdf#160833 sw DoNotMirrorRtlDrawObjs: add layout

In case this flag is active (intended for DOCX files), then don't
automatically mirror the position of drawing objects, just because they
are anchored in an RTL text node.

(cherry picked from commit 016b2f2f9194a4a1997d0e7bb51bbd1b10bc27ec)

Change-Id: Ie743d94ecb511d7de89e8e1e8303896370ce58c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167013
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index bf560cbdaf90..a1805bf4508e 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -24,6 +24,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 namespace
 {
@@ -404,6 +408,50 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableOverlapCell)
 CPPUNIT_ASSERT(pPage1);
 CPPUNIT_ASSERT(!pPage1->GetNext());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjsLayout)
+{
+// Given a document with an RTL paragraph, Word-style compat flag is 
enabled:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+auto& rIDSA = pDoc->getIDocumentSettingAccess();
+rIDSA.set(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS, true);
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwView& rView = pWrtShell->GetView();
+SfxItemSetFixed aSet(rView.GetPool());
+SvxFrameDirectionItem aDirection(SvxFrameDirection::Horizontal_RL_TB, 
RES_FRAMEDIR);
+aSet.Put(aDirection);
+pWrtShell->SetAttrSet(aSet, SetAttrMode::DEFAULT, nullptr, 
/*bParagraphSetting=*/true);
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPageFrame = pLayout->Lower()->DynCastPageFrame();
+SwFrame* pBodyFrame = pPageFrame->GetLower();
+
+// When inserting a graphic on the middle of the right margin:
+SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items);
+SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR);
+aFrameSet.Put(aAnchor);
+// Default margin is 1440, this is 1440/2.
+SwFormatFrameSize aSize(SwFrameSize::Fixed, 720, 720);
+aFrameSet.Put(aSize);
+// This is 1440/4.
+SwFormatHoriOrient aOrient(pBodyFrame->getFrameArea().Right() + 360);
+aFrameSet.Put(aOrient);
+Graphic aGrf;
+pWrtShell->SwFEShell::Insert(OUString(), OUString(), , );
+
+// Then make sure that the image is on the right margin:
+SwTwips nBodyRight = pBodyFrame->getFrameArea().Right();
+CPPUNIT_ASSERT(pPageFrame->GetSortedObjs());
+const SwSortedObjs& rPageObjs = *pPageFrame->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+const SwAnchoredObject* pAnchored = rPageObjs[0];
+Point aAnchoredCenter = 
pAnchored->GetDrawObj()->GetLastBoundRect().Center();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 11389
+// - Actual  : 643
+// i.e. the graphic was on the left margin, not on the right margin.
+CPPUNIT_ASSERT_GREATER(nBodyRight, aAnchoredCenter.getX());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index ab35ae7af738..4af3af542b27 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -852,7 +852,10 @@ SwTwips SwAnchoredObjectPosition::CalcRelPosX(
 if ( _rHoriOrient.GetHoriOrient() == text::HoriOrientation::NONE )
 {
 // 'manual' horizontal position
-const bool bR2L = rAnchorFrame.IsRightToLeft();
+const IDocumentSettingAccess& rIDSA = 
mpFrameFormat->getIDocumentSettingAccess();
+// If compat flag is active, then disable automatic mirroring for RTL.
+bool bMirrorRtlDrawObjs = 
!rIDSA.get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS);
+const bool bR2L = rAnchorFrame.IsRightToLeft() && bMirrorRtlDrawObjs;
 if( IsAnchoredToChar() && text::RelOrientation::CHAR == eRelOrient )
 {
 if( bR2L )


core.git: sw/CppunitTest_sw_writerfilter_filter.mk sw/Module_sw.mk sw/qa sw/source

2024-05-02 Thread Miklos Vajna (via logerrit)
 sw/CppunitTest_sw_writerfilter_filter.mk|   59 
++
 sw/Module_sw.mk |1 
 sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx |   57 
+
 sw/qa/writerfilter/cppunittests/filter/data/draw-obj-rtl-no-mirror.docx |binary
 sw/source/writerfilter/filter/WriterFilter.cxx  |1 
 5 files changed, 118 insertions(+)

New commits:
commit 01dcc9a652ecfc65fb674b492afa6f58b0a846db
Author: Miklos Vajna 
AuthorDate: Thu May 2 08:42:25 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 2 12:08:31 2024 +0200

tdf#160833 DOCX import: use the DoNotMirrorRtlDrawObjs compat flag

The bugdoc has a shape which should be on the right page margin, but it
was on the left page margin.

Use the new compat flag to have a layout that matches Word.

This way we don't need to unmap the tweaked position at export time (a
limitation that the DOC filter has).

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

diff --git a/sw/CppunitTest_sw_writerfilter_filter.mk 
b/sw/CppunitTest_sw_writerfilter_filter.mk
new file mode 100644
index ..ad61c66f1ed4
--- /dev/null
+++ b/sw/CppunitTest_sw_writerfilter_filter.mk
@@ -0,0 +1,59 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# 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/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_writerfilter_filter,\
+   boost_headers \
+   libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_writerfilter_filter, \
+sw/qa/writerfilter/cppunittests/filter/WriterFilter \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_writerfilter_filter, \
+basegfx \
+comphelper \
+cppu \
+cppuhelper \
+oox \
+sal \
+subsequenttest \
+test \
+unotest \
+utl \
+tl \
+vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sw_writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_writerfilter_filter))
+$(eval $(call gb_CppunitTest_use_vcl,sw_writerfilter_filter))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_writerfilter_filter,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_writerfilter_filter,\
+   officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_writerfilter_filter))
+
+# we need to explicitly depend on library sw_writerfilter because it is not 
implied
+# by a link relation
+$(call gb_CppunitTest_get_target,sw_writerfilter_filter) : $(call 
gb_Library_get_target,sw_writerfilter)
+
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(eval $(call 
gb_CppunitTest_set_non_application_font_use,sw_writerfilter_filter,abort))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 3fcd0f85ed56..fc2afe9fb7d9 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -175,6 +175,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
 CppunitTest_sw_writerfilter_dmapper \
 CppunitTest_sw_writerfilter_ooxml \
 CppunitTest_sw_writerfilter_rtftok \
+CppunitTest_sw_writerfilter_filter \
 ))
 
 ifneq ($(DISABLE_GUI),TRUE)
diff --git a/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx 
b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
new file mode 100644
index ..10b8cab57a45
--- /dev/null
+++ b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for sw/source/writerfilter/filter/WriterFilter.cxx.
+class Test : public UnoApiXmlTest
+{
+public:
+Test()
+: UnoApiXmlTest("/sw/qa/writerfilter/cppunittests/filter/data/")
+{
+}
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjs)
+{
+// Given a document with a shape, anchored in an RTL paragraph:
+// When loading that document:
+loadFromFile(u"draw-obj-rtl-no-mirror.docx");
+
+// Then make sure the shape is on the ri

core.git: sw/qa

2024-05-02 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfexport/rtfexport5.cxx | 1509 +-
 1 file changed, 948 insertions(+), 561 deletions(-)

New commits:
commit ceaba8bf5903b454ff717d788d2298edbf92bac2
Author: Miklos Vajna 
AuthorDate: Thu May 2 08:19:38 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 2 11:43:30 2024 +0200

CppunitTest_sw_rtfexport5: avoid DECLARE_RTFEXPORT_TEST

No need to go via Writer-specific macros here.

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

diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx 
b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 18ff21848af8..8b897485e92b 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -40,115 +40,188 @@ public:
 }
 };
 
-DECLARE_RTFEXPORT_TEST(testFdo63023, "fdo63023.rtf")
-{
-uno::Reference xHeaderText = 
getProperty>(
-getStyles("PageStyles")->getByName("Standard"), "HeaderText");
-// Back color was black (0) in the header, due to missing color table in 
the substream.
-CPPUNIT_ASSERT_EQUAL(
-Color(0x99),
-getProperty(getRun(getParagraphOfText(1, xHeaderText), 1), 
"CharBackColor"));
+CPPUNIT_TEST_FIXTURE(Test, testFdo63023)
+{
+auto verify = [this]() {
+uno::Reference xHeaderText = 
getProperty>(
+getStyles("PageStyles")->getByName("Standard"), "HeaderText");
+// Back color was black (0) in the header, due to missing color table 
in the substream.
+CPPUNIT_ASSERT_EQUAL(
+Color(0x99),
+getProperty(getRun(getParagraphOfText(1, xHeaderText), 1), 
"CharBackColor"));
+};
+createSwDoc("fdo63023.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo42109, "fdo42109.rtf")
-{
-uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
-uno::UNO_QUERY);
-uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
-uno::Reference xCell(xTable->getCellByName("B1"), 
uno::UNO_QUERY);
-// Make sure the page number is imported as a field in the B1 cell.
-CPPUNIT_ASSERT_EQUAL(OUString("TextField"),
- getProperty(getRun(getParagraphOfText(1, 
xCell->getText()), 1),
-   "TextPortionType"));
+CPPUNIT_TEST_FIXTURE(Test, testFdo42109)
+{
+auto verify = [this]() {
+uno::Reference 
xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("B1"), 
uno::UNO_QUERY);
+// Make sure the page number is imported as a field in the B1 cell.
+CPPUNIT_ASSERT_EQUAL(
+OUString("TextField"),
+getProperty(getRun(getParagraphOfText(1, 
xCell->getText()), 1),
+  "TextPortionType"));
+};
+createSwDoc("fdo42109.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo62977, "fdo62977.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo62977)
 {
-// The middle character was imported as '?' instead of the proper unicode 
value.
-getRun(getParagraph(1), 1, u"\u5E74\uFF14\u6708"_ustr);
+auto verify = [this]() {
+// The middle character was imported as '?' instead of the proper 
unicode value.
+getRun(getParagraph(1), 1, u"\u5E74\uFF14\u6708"_ustr);
+};
+createSwDoc("fdo62977.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testN818997, "n818997.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testN818997)
 {
-// \page was ignored between two \shp tokens.
-CPPUNIT_ASSERT_EQUAL(2, getPages());
+auto verify = [this]() {
+// \page was ignored between two \shp tokens.
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+};
+createSwDoc("n818997.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testN818997B, "n818997B.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testN818997B)
 {
-// \page was ignored between two \shp tokens - this time not 
IsFirstParagraphInSection.
-CPPUNIT_ASSERT_EQUAL(2, getPages());
+auto verify = [this]() {
+// \page was ignored between two \shp tokens - this time not 
IsFirstParagraphInS

ESC meeting agenda: 2024-05-02 16:00 CEST

2024-04-30 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 RC2 this week?
+ 24.2: 24.2.4 RC1 in 2 weeks?

* Documentation (Olivier)
+ Bugzilla Documentation statistics
264(264) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 10(-9)   38(2) 101(3) 223(1)
 commented 18(0)63(3) 251(13)850(-2)
  resolved  6(-3)   19(3)  49(3) 119(2)
+ top 10 contributors:
  Olivier Hallot made 33 changes in 1 month, and 256 changes in 1 year
  Stéphane Guillou made 29 changes in 1 month, and 255 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 105 changes in 1 
year
  Dione Maddern made 10 changes in 1 month, and 31 changes in 1 year
  MeBugzilla made 7 changes in 1 month, and 7 changes in 1 year
  Nabet, Julien made 7 changes in 1 month, and 53 changes in 1 year
  nobu made 7 changes in 1 month, and 16 changes in 1 year
  Ilmari Lauhakangas made 6 changes in 1 month, and 71 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Kaganski, Mike made 4 changes in 1 month, and 68 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
242(242) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  5(2)   8(-3) 15(-3)  24(-2)
 commented 38(-11)   173(-18)   559(6) 1842(-60)
   removed  3(3)   5(3)   5(3)   14(3)
  resolved  7(-2) 30(-1) 87(-1) 315(0)
+ top 10 contributors:
  Heiko Tietze made 107 changes in 1 month, and 1078 changes in 1 year
  Vernon, Stuart Foote made 105 changes in 1 month, and 306 changes in 
1 year
  Stéphane Guillou made 57 changes in 1 month, and 643 changes in 1 year
  Ilmari Lauhakangas made 19 changes in 1 month, and 142 changes in 1 
year
  Dieter made 15 changes in 1 month, and 136 changes in 1 year
  Eyal Rozenberg made 9 changes in 1 month, and 133 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 96 changes in 1 year
  Petros Christopoulos made 7 changes in 1 month, and 7 changes in 1 
year
  m.a.riosv made 6 changes in 1 month, and 49 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year

* Crash Testing (Caolan)
+ 63(+39) import failure, 59(+40) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.0.316665(+670)
+ 24.2.1.170(+5)
+ 24.2.1.212822(+961)
+ 24.2.2.26745(+2138)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months 12 months
  open 104(22) 169(38) 201(42)   201(42)
   reviews 356(26)1152(-40)   3648(-116)   12418(-90)
merged 288(75) 981(47)3241(-10)12462(-29)
 abandoned  10(-12) 57(3)  174(1)657(-9)
   own commits 194(22) 694(22)2169(2)   9190(-9)
review commits  47(-16)224(-35)856(-15) 3056(-11)
contributor...   1 week 1 month 3 months   12 months
  open  35(-6)  71(-19) 95(-5)  95(-5)
   reviews 792(86)2546(0) 7698(32)   29426(-22)
merged  17(-10)114(-27)378(24)1693(17)
 abandoned  13(2)   54(3)  298(1)  707(15)
   own commits  22(-8) 106(-43)436(-3)1127(6)
review commits   0(0)0(0)0(0)0(0)
+ easyHack statistics:
   needsDevEval 8(8)   needsUXEval 1(1)   cleanup_comments 331(331)
   total 411(411)   assigned 28(28)   open 349(349)
+ top 10 contributors:
  Armin Le Grand (allotropia) made 8 patches in 1 month, and 89 patches 
in 1 year
  Ritobroto Mukherjee made 7 patches in 1 month, and 14 patches in 1 
year
  Rafał Dobrakowski made 5 patches in 1 month, and 16 patches in 1 year
made 5 patches in 1 month, and 5 patches in 1 year
  Juan José González made 4 patches in 1 month, and 11 patches in 1 year
  Kira Tubo made 4 patches in 1 month, and 14 patches in 1 year
  Dione Maddern made 4 patches in 1 month, and 34 patches in 1 year
  colton Garrett made 4 patches in 1 month, and 4 patches in 1 year

ESC meeting agenda: 2024-05-02 16:00 CEST

2024-04-30 Thread Miklos Vajna

Hi,

The prototype agenda is below. Extra items are appreciated either in
this document or as a reply to this mail:

https://pad.documentfoundation.org/p/esc

You can join using Jitsi here:

https://jitsi.documentfoundation.org/esc

Regards,

Miklos

---

* Present:
+

* Completed Action Items:

* Pending Action Items:

* Release Engineering update (Cloph)
+ 7.6: 7.6.7 RC2 this week?
+ 24.2: 24.2.4 RC1 in 2 weeks?

* Documentation (Olivier)
+ Bugzilla Documentation statistics
264(264) bugs open
+ Updates:
BZ changes   1 week   1 month   3 months   12 months
   created 10(-9)   38(2) 101(3) 223(1)
 commented 18(0)63(3) 251(13)850(-2)
  resolved  6(-3)   19(3)  49(3) 119(2)
+ top 10 contributors:
  Olivier Hallot made 33 changes in 1 month, and 256 changes in 1 year
  Stéphane Guillou made 29 changes in 1 month, and 255 changes in 1 year
  Vernon, Stuart Foote made 22 changes in 1 month, and 105 changes in 1 
year
  Dione Maddern made 10 changes in 1 month, and 31 changes in 1 year
  MeBugzilla made 7 changes in 1 month, and 7 changes in 1 year
  Nabet, Julien made 7 changes in 1 month, and 53 changes in 1 year
  nobu made 7 changes in 1 month, and 16 changes in 1 year
  Ilmari Lauhakangas made 6 changes in 1 month, and 71 changes in 1 year
  Cor Nouws made 5 changes in 1 month, and 8 changes in 1 year
  Kaganski, Mike made 4 changes in 1 month, and 68 changes in 1 year

* UX Update (Heiko)
+ Bugzilla (topicUI) statistics
242(242) (topicUI) bugs open, 35(35) (needsUXEval) needs to be 
evaluated by the UXteam
+ Updates:
BZ changes   1 week1 month3 months   12 months
 added  5(2)   8(-3) 15(-3)  24(-2)
 commented 38(-11)   173(-18)   559(6) 1842(-60)
   removed  3(3)   5(3)   5(3)   14(3)
  resolved  7(-2) 30(-1) 87(-1) 315(0)
+ top 10 contributors:
  Heiko Tietze made 107 changes in 1 month, and 1078 changes in 1 year
  Vernon, Stuart Foote made 105 changes in 1 month, and 306 changes in 
1 year
  Stéphane Guillou made 57 changes in 1 month, and 643 changes in 1 year
  Ilmari Lauhakangas made 19 changes in 1 month, and 142 changes in 1 
year
  Dieter made 15 changes in 1 month, and 136 changes in 1 year
  Eyal Rozenberg made 9 changes in 1 month, and 133 changes in 1 year
  Kaganski, Mike made 7 changes in 1 month, and 96 changes in 1 year
  Petros Christopoulos made 7 changes in 1 month, and 7 changes in 1 
year
  m.a.riosv made 6 changes in 1 month, and 49 changes in 1 year
  *UNKNOWN* made 5 changes in 1 month, and 5 changes in 1 year

* Crash Testing (Caolan)
+ 63(+39) import failure, 59(+40) export failures
+ ??? coverity issues
+ Google / ossfuzz: ?? fuzzers active now

* Crash Reporting (Xisco)
+ 24.2.0.316665(+670)
+ 24.2.1.170(+5)
+ 24.2.1.212822(+961)
+ 24.2.2.26745(+2138)

* Mentoring (Hossein)
  committer...   1 week 1 month 3 months 12 months
  open 104(22) 169(38) 201(42)   201(42)
   reviews 356(26)1152(-40)   3648(-116)   12418(-90)
merged 288(75) 981(47)3241(-10)12462(-29)
 abandoned  10(-12) 57(3)  174(1)657(-9)
   own commits 194(22) 694(22)2169(2)   9190(-9)
review commits  47(-16)224(-35)856(-15) 3056(-11)
contributor...   1 week 1 month 3 months   12 months
  open  35(-6)  71(-19) 95(-5)  95(-5)
   reviews 792(86)2546(0) 7698(32)   29426(-22)
merged  17(-10)114(-27)378(24)1693(17)
 abandoned  13(2)   54(3)  298(1)  707(15)
   own commits  22(-8) 106(-43)436(-3)1127(6)
review commits   0(0)0(0)0(0)0(0)
+ easyHack statistics:
   needsDevEval 8(8)   needsUXEval 1(1)   cleanup_comments 331(331)
   total 411(411)   assigned 28(28)   open 349(349)
+ top 10 contributors:
  Armin Le Grand (allotropia) made 8 patches in 1 month, and 89 patches 
in 1 year
  Ritobroto Mukherjee made 7 patches in 1 month, and 14 patches in 1 
year
  Rafał Dobrakowski made 5 patches in 1 month, and 16 patches in 1 year
made 5 patches in 1 month, and 5 patches in 1 year
  Juan José González made 4 patches in 1 month, and 11 patches in 1 year
  Kira Tubo made 4 patches in 1 month, and 14 patches in 1 year
  Dione Maddern made 4 patches in 1 month, and 34 patches in 1 year
  colton Garrett made 4 patches in 1 month, and 4 patches in 1 year

core.git: Branch 'distro/collabora/co-24.04' - sw/inc sw/qa sw/source

2024-04-30 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/uibase/uno/uno.cxx  |   24 
 sw/source/core/doc/DocumentSettingManager.cxx |   10 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/filter/xml/xmlexp.cxx   |1 +
 sw/source/filter/xml/xmlimp.cxx   |   10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 7 files changed, 65 insertions(+)

New commits:
commit 99417eb50996e50c99d9557444ad5ce321901ef4
Author: Miklos Vajna 
AuthorDate: Mon Apr 29 10:39:43 2024 +0200
Commit: Caolán McNamara 
CommitDate: Tue Apr 30 11:51:09 2024 +0200

tdf#160833 sw: add a DoNotMirrorRtlDrawObjs compat flag

The DOCX bugdoc has a circle shape anchored inside an RTL paragraph:
this shows up on the right hand side in Word, but on the left hand side
in Writer.

What happens is that Writer implicitly mirrors draw objects anchored in
RTL paragraphs, while Word doesn't do this.

Start fixing the problem by adding a new layout compatibility flag that
can be used by the DOCX import in the future, to leave the behavior
unchanged for new & existing ODT documents.

An alternative would be to do something similar to the DOC import's
SwWW8ImplReader::MiserableRTLGraphicsHack(), but 1) we don't have the
page margins by the time we import the shape and 2) as its name says, it
doesn't feel like a clean solution, it's better to handle this
difference at a layout level.

(cherry picked from commit c675eaf923cf579670b8ba2f7794b47be7fad39e)

Change-Id: I2ec067d86c7fbdbe57e4cd9547015fe25a9a56b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166917
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 0dd9467bdf13..264860b854c4 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -99,6 +99,7 @@ enum class DocumentSettingId
 // tdf#119908 new paragraph justification
 JUSTIFY_LINES_WITH_SHRINKING,
 APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
+DO_NOT_MIRROR_RTL_DRAW_OBJS,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index d38d0bbfc967..3e6d9c93d51c 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -560,6 +560,30 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testAllowTextAfterFloatingTableBreak)
 CPPUNIT_ASSERT(bAllowTextAfterFloatingTableBreak);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotMirrorRtlDrawObjs)
+{
+// Given an empty document:
+createSwDoc();
+
+// When checking the state of the DoNotMirrorRtlDrawObjs compat flag:
+uno::Reference xDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xSettings(
+xDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+bool bDoNotMirrorRtlDrawObjs{};
+// Without the accompanying fix in place, this test would have failed with:
+// An uncaught exception of type 
com.sun.star.beans.UnknownPropertyException
+// i.e. the compat flag was not recognized.
+xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= 
bDoNotMirrorRtlDrawObjs;
+// Then make sure it's false by default:
+CPPUNIT_ASSERT(!bDoNotMirrorRtlDrawObjs);
+
+// And when setting DoNotMirrorRtlDrawObjs=true:
+xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true));
+// Then make sure it gets enabled:
+xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= 
bDoNotMirrorRtlDrawObjs;
+CPPUNIT_ASSERT(bDoNotMirrorRtlDrawObjs);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 661c001e98c2..14cfa5fd3c24 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -256,6 +256,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 return mbDoNotBreakWrappedTables;
 case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
 return mbAllowTextAfterFloatingTableBreak;
+case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
+return mbDoNotMirrorRtlDrawObjs;
 case DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING:
 return mbJustifyLinesWithShrinking;
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
@@ -450,6 +452,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbApplyTextAttrToEmptyLineAtEndOfPara

core.git: sw/qa sw/source

2024-04-30 Thread Miklos Vajna (via logerrit)
 sw/qa/core/txtnode/data/plain-content-control-copy.docx |binary
 sw/qa/core/txtnode/txtnode.cxx  |   23 
 sw/source/core/txtnode/thints.cxx   |4 ++
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 06aeb9c61d50bba7edafe17f9d3513af26b0782f
Author: Miklos Vajna 
AuthorDate: Tue Apr 30 08:44:59 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue Apr 30 10:12:13 2024 +0200

tdf#159683 sw content controls, plain text: fix crash with the clipboard doc

Regression from commit c804c5354855188b5a37219cfe11dc079dc235f4 (sw
content control: fix lost properties on copy, 2023-03-10), select
a plain text content control, copy it to the clipboard, quit: assertion
fails during shutdown because the doc's "placeholder text" char style is
still referenced by a client.

What happens here is that the SwContentControl copy ctor copies the
plain text flag, and that flag is only read in SwTextNode::InsertHint(),
so that causes the problem. Note how that code is inconsistent: we avoid
the creation of dummy characters in the copy case, but we still try to
adjust the start/end of the content control attribute in the copy case,
which makes not much sense.

Fix the problem by not adjusting the content control attribute
boundaries in the copy case, since the original intention was to do
thees corrections only at a UI level, during interactive edit.

It's not clear why this inconsistency had an influence on the clients of
the char style, though.

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

diff --git a/sw/qa/core/txtnode/data/plain-content-control-copy.docx 
b/sw/qa/core/txtnode/data/plain-content-control-copy.docx
new file mode 100644
index ..80fecae26d5b
Binary files /dev/null and 
b/sw/qa/core/txtnode/data/plain-content-control-copy.docx differ
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index dec97c2ab910..b2bc0cec8b22 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -539,6 +539,29 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSplitFlyAnchorSplit)
 CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Fly"), aPortionType);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPlainContentControlCopy)
+{
+// Given a document with a plain text content control, all text selected 
and copied to the
+// clipboard:
+createSwDoc("plain-content-control-copy.docx");
+SwDocShell* pDocShell = getSwDocShell();
+SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+pWrtShell->SelAll();
+{
+rtl::Reference xTransfer = new 
SwTransferable(*pWrtShell);
+xTransfer->Copy();
+}
+
+// When closing that document, then make sure we don't crash on shutdown:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xFrame(xModel->getCurrentController()->getFrame(),
+uno::UNO_QUERY);
+// Without the accompanying fix in place, this resulted in an assertion 
failure, a char style
+// still had clients by the time it was deleted.
+xFrame->close(false);
+mxComponent.clear();
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 60161c3b8f89..c684b005504f 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1698,7 +1698,9 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 // for all of its content.
 auto* pTextContentControl = static_txtattr_cast(
 GetTextAttrAt(pAttr->GetStart(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent));
-if (pTextContentControl)
+// If the caller is SwTextNode::CopyText, we just copy an existing 
attribute, no need to
+// correct it.
+if (pTextContentControl && !(nMode & SetAttrMode::NOTXTATRCHR))
 {
 auto& rFormatContentControl
 = 
static_cast(pTextContentControl->GetAttr());


core.git: sw/qa sw/source

2024-04-30 Thread Miklos Vajna (via logerrit)
 sw/qa/core/objectpositioning/objectpositioning.cxx  |   48 
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |5 +
 2 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit 016b2f2f9194a4a1997d0e7bb51bbd1b10bc27ec
Author: Miklos Vajna 
AuthorDate: Tue Apr 30 08:22:03 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue Apr 30 09:45:40 2024 +0200

tdf#160833 sw DoNotMirrorRtlDrawObjs: add layout

In case this flag is active (intended for DOCX files), then don't
automatically mirror the position of drawing objects, just because they
are anchored in an RTL text node.

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

diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index 717d63ded052..60a14c90547a 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -24,6 +24,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -418,6 +422,50 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableOverlapCell)
 CPPUNIT_ASSERT(pPage1);
 CPPUNIT_ASSERT(!pPage1->GetNext());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjsLayout)
+{
+// Given a document with an RTL paragraph, Word-style compat flag is 
enabled:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+auto& rIDSA = pDoc->getIDocumentSettingAccess();
+rIDSA.set(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS, true);
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwView& rView = pWrtShell->GetView();
+SfxItemSetFixed aSet(rView.GetPool());
+SvxFrameDirectionItem aDirection(SvxFrameDirection::Horizontal_RL_TB, 
RES_FRAMEDIR);
+aSet.Put(aDirection);
+pWrtShell->SetAttrSet(aSet, SetAttrMode::DEFAULT, nullptr, 
/*bParagraphSetting=*/true);
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPageFrame = pLayout->Lower()->DynCastPageFrame();
+SwFrame* pBodyFrame = pPageFrame->GetLower();
+
+// When inserting a graphic on the middle of the right margin:
+SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items);
+SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR);
+aFrameSet.Put(aAnchor);
+// Default margin is 1440, this is 1440/2.
+SwFormatFrameSize aSize(SwFrameSize::Fixed, 720, 720);
+aFrameSet.Put(aSize);
+// This is 1440/4.
+SwFormatHoriOrient aOrient(pBodyFrame->getFrameArea().Right() + 360);
+aFrameSet.Put(aOrient);
+Graphic aGrf;
+pWrtShell->SwFEShell::Insert(OUString(), OUString(), , );
+
+// Then make sure that the image is on the right margin:
+SwTwips nBodyRight = pBodyFrame->getFrameArea().Right();
+CPPUNIT_ASSERT(pPageFrame->GetSortedObjs());
+const SwSortedObjs& rPageObjs = *pPageFrame->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+const SwAnchoredObject* pAnchored = rPageObjs[0];
+Point aAnchoredCenter = 
pAnchored->GetDrawObj()->GetLastBoundRect().Center();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 11389
+// - Actual  : 643
+// i.e. the graphic was on the left margin, not on the right margin.
+CPPUNIT_ASSERT_GREATER(nBodyRight, aAnchoredCenter.getX());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index ab35ae7af738..4af3af542b27 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -852,7 +852,10 @@ SwTwips SwAnchoredObjectPosition::CalcRelPosX(
 if ( _rHoriOrient.GetHoriOrient() == text::HoriOrientation::NONE )
 {
 // 'manual' horizontal position
-const bool bR2L = rAnchorFrame.IsRightToLeft();
+const IDocumentSettingAccess& rIDSA = 
mpFrameFormat->getIDocumentSettingAccess();
+// If compat flag is active, then disable automatic mirroring for RTL.
+bool bMirrorRtlDrawObjs = 
!rIDSA.get(DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS);
+const bool bR2L = rAnchorFrame.IsRightToLeft() && bMirrorRtlDrawObjs;
 if( IsAnchoredToChar() && text::RelOrientation::CHAR == eRelOrient )
 {
 if( bR2L )


  1   2   3   4   5   6   7   8   9   10   >