summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-09-21 18:33:43 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-10-04 17:56:01 +0200
commitd69b8f711f06d24994b43161fe034d742b31788a (patch)
tree21a1838e9ce10964b1370b10c7e441ddeceaa2d3
parenttdf#149106 Remove RenamePrgFolder and RemovePrgFolder custom msi actions (diff)
downloadcore-d69b8f711f06d24994b43161fe034d742b31788a.tar.gz
core-d69b8f711f06d24994b43161fe034d742b31788a.zip
tdf#150616 sw: fix bad 0 height of SwTextFrame in table cell
The bugdoc has a text frame 42 immediately following a section which contains a nested table, both inside a table cell 29. The problem is that with soffice --convert-to pdf, the height of frame 42 ends up as 0, after a single layout action; this does not happen when loading it from UI. When the frame 42 is formatted, it calculates the needed height, and grows, but in SwTextFrame::AdjustFrame() it doesn't fit into its upper cell frame with a negative nRstHeight at this point, and the text frame is reduced to height 0. The odd code in SwContentFrame::MakeAll() exists unchanged since CVS initial import and is poorly motivated. It is highly suspicious that it simply grows the upper frame, without invalidating the size of the current one (which was already shrunk), and/or clearing the m_bUndersized flag. If this code is removed, on formatting the next frame 43, it goes up and formats the cell frame, which grows and at the same time importantly invalidates the text frame 42, so it will be formatted again and full height. At the point when the frame 42 was formatted, its upper cell frame was size-invalid, so it looks like that will be formatted eventually in any case and then invalidate 42. (regression from commit e7874c936dd1ff9b3423eb7477cbee2494535176 but unclear why) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140355 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 3acd80a030707b3c4795c0f828f953ac0ae24d97) Change-Id: I1ac0999a8fda39f7717bc183a10e3b513fbb8911
-rw-r--r--sw/qa/extras/layout/data/in_056132_mod.odtbin0 -> 13647 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx49
-rw-r--r--sw/source/core/layout/calcmove.cxx7
3 files changed, 49 insertions, 7 deletions
diff --git a/sw/qa/extras/layout/data/in_056132_mod.odt b/sw/qa/extras/layout/data/in_056132_mod.odt
new file mode 100644
index 000000000000..548401063bdd
--- /dev/null
+++ b/sw/qa/extras/layout/data/in_056132_mod.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index de540b8e4834..9747090b6581 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3189,6 +3189,55 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression)
aTempFile.EnableKillingFile();
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150616)
+{
+ discardDumpedLayout();
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ OUString const pName("in_056132_mod.odt");
+
+ 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 << ":\n";
+
+ // 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();
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // this one was 0 height
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/LineBreak", "Line",
+ "Important information here!");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "height",
+ "253");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "top",
+ "7925");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/LineBreak", "Line",
+ "xxx 111 ");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "height",
+ "697");
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "top",
+ "8178");
+
+ aTempFile.EnableKillingFile();
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell)
{
SwDoc* pDoc = createDoc("btlr-cell.odt");
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index cb956d8f916c..f8856c9734ce 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1730,13 +1730,6 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
// an unsolvable problem: We ignore it with all our power.
if ( !bMoveable || IsUndersized() )
{
- if( !bMoveable && IsInTab() )
- {
- long nDiff = -aRectFnSet.BottomDist( getFrameArea(), aRectFnSet.GetPrtBottom(*GetUpper()) );
- long nReal = GetUpper()->Grow( nDiff );
- if( nReal )
- continue;
- }
break;
}