summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-12 09:07:52 +0200
committerAndras Timar <andras.timar@collabora.com>2015-11-03 18:10:28 +0100
commitc922174b1c8864495bf8245045af901807449b86 (patch)
treee064ddddfb34d1ed67dabe75371cdedb3157c62d
parentc5907e7e12975a014bb12b138bd2420cb8ab76a9 (diff)
tdf#89165 sw: looping layout in SwHeadFootFrm::FormatSize()
FormatObjsAtFrm() returns false, indicating that the result is not perfect, and the caller hopes that formatting all children of the frame again will help. Make sure that in case that assumption turns out to be false, we at least do not loop. The loop limit is enough to make the original i#43771 bugdoc still laid out properly. (cherry picked from commit 51438e87d0e17a4cc3c991165d22c740b3ac1fc2) Change-Id: Ife9bd99a628a72edb922d04e05081971b6adf340 Reviewed-on: https://gerrit.libreoffice.org/19407 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 47e8bcd703aa74deafd2e5571205f2dc565e6cf2)
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf89165.docxbin0 -> 89495 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx5
-rw-r--r--sw/source/core/layout/hffrm.cxx12
3 files changed, 14 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf89165.docx b/sw/qa/extras/ooxmlimport/data/tdf89165.docx
new file mode 100644
index 000000000000..a060ca444e27
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf89165.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index dc460b55fd5b..1668defeff33 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2801,6 +2801,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf90153, "tdf90153.docx")
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
+DECLARE_OOXMLIMPORT_TEST(testTdf89165, "tdf89165.docx")
+{
+ // This must not hang in layout
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index e12df3e12c35..03f6ed44e91e 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -246,6 +246,7 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
pFrm->_InvalidatePos();
aOldFooterPrtPos = Frm().Pos() + Prt().Pos();
}
+ int nLoopControl = 0;
while( pFrm )
{
pFrm->Calc(getRootFrm()->GetCurrShell()->GetOut());
@@ -263,9 +264,14 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
if ( !SwObjectFormatter::FormatObjsAtFrm( *pFrm,
*(pFrm->FindPageFrm()) ) )
{
- // restart format with first content
- pFrm = Lower();
- continue;
+ if (nLoopControl++ < 20)
+ {
+ // restart format with first content
+ pFrm = Lower();
+ continue;
+ }
+ else
+ SAL_WARN("sw", "SwHeadFootFrm::FormatSize: loop detection triggered");
}
}
pFrm = pFrm->GetNext();