sw/CppunitTest_sw_layoutwriter2.mk               |   72 ++++++++++
 sw/Module_sw.mk                                  |    1 
 sw/qa/extras/layout/data/table_cell_overlap.fodt |  161 +++++++++++++++++++++++
 sw/qa/extras/layout/layout2.cxx                  |  102 ++++++++++++++
 sw/source/core/layout/wsfrm.cxx                  |    4 
 5 files changed, 340 insertions(+)

New commits:
commit 5230b7d11795a09460f5ded48b898fb58a30b4ea
Author:     Michael Stahl <[email protected]>
AuthorDate: Fri Feb 11 18:28:42 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Aug 13 10:53:39 2024 +0200

    sw: layout: fix overlapped table rows in --convert-to pdf
    
    If the document is loaded via UI, the first layout action is triggered
    from resizing the Window and the table is positioned properly on the
    first try.
    
    If the document is loaded via --convert-to, only getRendererCount()
    formats the content of the table, and positioning goes wrong.
    
    Somehow the 2 rows of the table in the fly end up on the same Y
    position, because when the text frame in the 1st row is formatted
    and grows from 0 to 230, the already-valid position of the cell
    frame in the 2nd row is not invalidated.
    
    This happens since the earliest version checked, OOo 3.4 beta.
    
    This fix is somewhat similar to commit
    068c133ac41c97652909b88c432e3b73010efc3e
    
    Change-Id: I3259c440265cfe40dc7731cb4830bfe2487acf38
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129851
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171811
    Tested-by: Michael Stahl <[email protected]>

diff --git a/sw/CppunitTest_sw_layoutwriter2.mk 
b/sw/CppunitTest_sw_layoutwriter2.mk
new file mode 100644
index 000000000000..1b0c98467b35
--- /dev/null
+++ b/sw/CppunitTest_sw_layoutwriter2.mk
@@ -0,0 +1,72 @@
+# -*- 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_layoutwriter2))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_layoutwriter2, \
+    sw/qa/extras/layout/layout2 \
+))
+
+# note: this links msword only for the reason to have a order dependency,
+# because "make sw.check" will not see the dependency through services.rdb
+$(eval $(call gb_CppunitTest_use_libraries,sw_layoutwriter2, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    editeng \
+    msword \
+    sal \
+    sfx \
+    svl \
+    svt \
+    svxcore \
+    sw \
+    test \
+    unotest \
+    vcl \
+    tl \
+    utl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_layoutwriter2,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_layoutwriter2,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/qa/extras/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sw_layoutwriter2))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_layoutwriter2))
+$(eval $(call gb_CppunitTest_use_vcl,sw_layoutwriter2))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_layoutwriter2,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_layoutwriter2))
+
+$(eval $(call gb_CppunitTest_use_uiconfigs,sw_layoutwriter2, \
+    modules/swriter \
+))
+
+$(call gb_CppunitTest_get_target,sw_layoutwriter2): \
+    $(call gb_Library_get_target,textconv_dict)
+
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(call gb_CppunitTest_get_target,sw_layoutwriter2): \
+    $(call gb_ExternalPackage_get_target,fonts_liberation)
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 03d46c2799fa..b6c799832513 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -77,6 +77,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_txtexport \
     CppunitTest_sw_uiwriter \
     CppunitTest_sw_layoutwriter \
+       CppunitTest_sw_layoutwriter2 \
     CppunitTest_sw_mailmerge \
     CppunitTest_sw_globalfilter \
 ))
diff --git a/sw/qa/extras/layout/data/table_cell_overlap.fodt 
b/sw/qa/extras/layout/data/table_cell_overlap.fodt
new file mode 100644
index 000000000000..e9565054de88
--- /dev/null
+++ b/sw/qa/extras/layout/data/table_cell_overlap.fodt
@@ -0,0 +1,161 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:dc="http://purl.org/dc/eleme
 nts/1.1/" xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0
 " xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2022-02-11T15:45:44.525015226</meta:creation-date><dc:date>2022-02-11T15:51:17.840027874</dc:date><meta:editing-duration>PT5M32S</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:generator>LibreOfficeDev/6.3.6.11$Linux_X86_64
 
LibreOffice_project/798c41960be08155f4f9734c6307615ab45c134e</meta:generator><meta:document-statistic
 meta:table-count="1" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="2" meta:word-count="2" 
meta:character-count="8" meta:non-whitespace-character-count="8"/></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit 
Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source 
Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" style:writing-mode="lr-tb" 
style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Boooo" style:family="paragraph" 
style:parent-style-name="Standard" style:master-page-name="">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false" fo:line-height="100%" fo:text-align="start" 
style:justify-single-word="false" style:page-number="auto">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties fo:font-size="10pt"/>
+  </style:style>
+  <style:style style:name="Frame" style:family="graphic">
+   <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" 
svg:y="0cm" fo:margin-left="0.201cm" fo:margin-right="0.201cm" 
fo:margin-top="0.201cm" fo:margin-bottom="0.201cm" style:wrap="parallel" 
style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" 
style:vertical-pos="top" style:vertical-rel="paragraph-content" 
style:horizontal-pos="center" style:horizontal-rel="paragraph-content" 
fo:padding="0.15cm" fo:border="0.06pt solid #000000"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="Table1" style:family="table">
+   <style:table-properties style:width="16.198cm" table:align="margins"/>
+  </style:style>
+  <style:style style:name="Table1.A" style:family="table-column">
+   <style:table-column-properties style:column-width="16.198cm" 
style:rel-column-width="65535*"/>
+  </style:style>
+  <style:style style:name="Table1.A1" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0cm" fo:border="none">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Boooo">
+   <style:text-properties fo:font-size="11pt" style:font-size-asian="11pt" 
style:font-size-complex="11pt"/>
+  </style:style>
+  <style:style style:name="T3" style:family="text">
+   <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" 
style:font-weight-complex="bold"/>
+  </style:style>
+  <style:style style:name="T4" style:family="text">
+   <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" 
style:font-weight-complex="bold"/>
+  </style:style>
+  <style:style style:name="T5" style:family="text">
+   <style:text-properties fo:font-size="10pt" fo:font-weight="bold" 
style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+  </style:style>
+  <style:style style:name="fr1" style:family="graphic" 
style:parent-style-name="Frame">
+   <style:graphic-properties fo:margin-left="0cm" fo:margin-right="0cm" 
fo:margin-top="0cm" fo:margin-bottom="0cm" style:protect="position" 
style:vertical-pos="from-top" style:vertical-rel="page" 
style:horizontal-pos="from-left" style:horizontal-rel="page" 
fo:background-color="#e6e6e6" style:background-transparency="0%" 
draw:fill="solid" draw:fill-color="#e6e6e6" draw:opacity="100%" 
fo:padding="0.199cm" fo:border="0.06pt solid #ffffff" style:shadow="none" 
draw:shadow-opacity="100%"/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" 
fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" 
fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:footnote-max-height="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls><draw:frame draw:style-name="fr1" draw:name="Boooo" 
text:anchor-type="page" text:anchor-page-number="1" svg:x="2.2cm" 
svg:y="11.591cm" svg:width="16.6cm" draw:z-index="0">
+    <draw:text-box fo:min-height="2.147cm">
+     <table:table table:name="Table1" table:style-name="Table1">
+      <table:table-column table:style-name="Table1.A"/>
+      <table:table-row>
+       <table:table-cell table:style-name="Table1.A1" 
office:value-type="string">
+        <text:p text:style-name="Boooo"><text:span 
text:style-name="T5">ONE</text:span><text:span 
text:style-name="T3">:</text:span></text:p>
+       </table:table-cell>
+      </table:table-row>
+      <table:table-row>
+       <table:table-cell table:style-name="Table1.A1" 
office:value-type="string">
+        <text:p text:style-name="Boooo"><text:span 
text:style-name="T5">TWO</text:span><text:span 
text:style-name="T4">:</text:span></text:p>
+       </table:table-cell>
+      </table:table-row>
+     </table:table>
+     <text:p text:style-name="P1"/>
+    </draw:text-box>
+   </draw:frame>
+   <text:p text:style-name="Standard"/>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
new file mode 100644
index 000000000000..aef7b37778e7
--- /dev/null
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -0,0 +1,102 @@
+/* -*- 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 <swmodeltestbase.hxx>
+
+//#include <com/sun/star/text/XTextFrame.hpp>
+//#include <com/sun/star/linguistic2/XHyphenator.hpp>
+
+//#include <comphelper/scopeguard.hxx>
+#include <comphelper/propertysequence.hxx>
+#include <comphelper/sequence.hxx>
+//#include <unotools/syslocaleoptions.hxx>
+//#include <editeng/unolingu.hxx>
+
+#include <unotxdoc.hxx>
+//#include <rootfrm.hxx>
+//#include <wrtsh.hxx>
+//#include <IDocumentLayoutAccess.hxx>
+//#include <IDocumentRedlineAccess.hxx>
+//#include <frameformats.hxx>
+//#include <unotextrange.hxx>
+//#include <fmtanchr.hxx>
+
+static char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/";
+
+/// Test to assert layout / rendering result of Writer.
+class SwLayoutWriter2 : public SwModelTestBase
+{
+public:
+    void testTableCellInvalidate();
+
+    CPPUNIT_TEST_SUITE(SwLayoutWriter2);
+    CPPUNIT_TEST(testTableCellInvalidate);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void SwLayoutWriter2::testTableCellInvalidate()
+{
+    discardDumpedLayout();
+    if (mxComponent.is())
+        mxComponent->dispose();
+
+    OUString const pName("table_cell_overlap.fodt");
+
+    OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + pName);
+
+    // note: must set Hidden property, so that 
SfxFrameViewWindow_Impl::Resize()
+    // does *not* forward initial VCL Window Resize and thereby triggers a
+    // layout which does not happen on soffice --convert-to pdf.
+    std::vector<beans::PropertyValue> aFilterOptions = {
+        { beans::PropertyValue("Hidden", -1, uno::Any(true), 
beans::PropertyState_DIRECT_VALUE) },
+    };
+
+    std::cout << pName << ":
";
+
+    // inline the loading because currently properties can't be passed...
+    mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument",
+                                  
comphelper::containerToSequence(aFilterOptions));
+    uno::Sequence<beans::PropertyValue> 
props(comphelper::InitPropertySequence({
+        { "FilterName", uno::Any(OUString("writer_pdf_Export")) },
+    }));
+    utl::TempFile aTempFile;
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    xStorable->storeToURL(aTempFile.GetURL(), props);
+
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    // somehow these 2 rows overlapped in the PDF unless CalcLayout() runs
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/infos/bounds", "top", "6969");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/infos/bounds", "height", "231");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/cell[1]/infos/bounds", "top",
+                "6969");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/cell[1]/infos/bounds", "height",
+                "231");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/cell[1]/txt[1]/infos/bounds",
+                "top", "6969");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/cell[1]/txt[1]/infos/bounds",
+                "height", "231");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "top", "7200");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "height", "231");
+    // this was 6969, causing the overlap
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/cell[1]/infos/bounds", "top",
+                "7200");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/cell[1]/infos/bounds", "height",
+                "231");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/cell[1]/txt[1]/infos/bounds",
+                "top", "7200");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/cell[1]/txt[1]/infos/bounds",
+                "height", "231");
+
+    aTempFile.EnableKillingFile();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter2);
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index e8b74a653468..a835ee5719e9 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2324,6 +2324,10 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool 
bTst, bool bInfo )
             if ( GetNext() )
             {
                 GetNext()->InvalidatePos_();
+                if (GetNext()->IsRowFrame())
+                {   // also invalidate first cell
+                    
static_cast<SwLayoutFrame*>(GetNext())->Lower()->InvalidatePos_();
+                }
                 if ( GetNext()->IsContentFrame() )
                     GetNext()->InvalidatePage( pPage );
             }

Reply via email to