summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-07-06 14:07:45 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-23 11:42:56 +0200
commite4a5d83949d5a3c071735196213d143e338a36b1 (patch)
tree772100cda806e01263979fa8becf4ab0f3036a56 /sw
parent68a53c5023cb72f4cb512bbe87e973bb730f2bb8 (diff)
i#61225 sw: fix layout loop with growable single-column sections
Commit 6ade80cf142664e78954c7544534e9436ceb90c7 (tdf#108524 sw: allow move of frame inside section without columns, 2017-06-16) relaxed lcl_IsInSectionDirectly() used in SwFrame::IsMoveable() to allow move for all section frame contents if it has a single column. That looked safe, as the multiple column case was already allowed. There is one situation where this still causes a problem: when the section has a single column and the section frame is growable -- as in that case we should grow the section frame, not move the contents. So go back to unconditionally allowing multi-column section contents and allow single-column section contents only in case the section frame is now growable. With this, ooo61225-1.sxw from the crashtesting corpus can be opened again without a layout loop. Reviewed-on: https://gerrit.libreoffice.org/39653 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 972fbddf80510f7daaf2128dbfda01c0e7535020) Conflicts: sw/qa/extras/odfimport/odfimport.cxx Change-Id: Ib2d3702a33da8e62b9bbf468d558ae16db8aa94b
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/odfimport/data/i61225.sxwbin0 -> 53844 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx8
-rw-r--r--sw/source/core/layout/findfrm.cxx9
3 files changed, 15 insertions, 2 deletions
diff --git a/sw/qa/extras/odfimport/data/i61225.sxw b/sw/qa/extras/odfimport/data/i61225.sxw
new file mode 100644
index 000000000000..4f43541995c3
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/i61225.sxw
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 92069c00808c..f8dc61d68d81 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -646,5 +646,13 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(getShape(1), "BackColor"));
}
+DECLARE_ODFIMPORT_TEST(testI61225, "i61225.sxw")
+{
+ // Part of ooo61225-1.sxw from crashtesting.
+
+ // This never returned.
+ calcLayout();
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index fb5854a80c9c..3ad50a012d13 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1257,10 +1257,15 @@ void SwFrame::InvalidateNextPrtArea()
/// but not if it sits in a table which itself sits in a section.
static bool lcl_IsInSectionDirectly( const SwFrame *pUp )
{
+ bool bSeenColumn = false;
+
while( pUp )
{
- if( pUp->IsSctFrame() )
- return true;
+ if( pUp->IsColumnFrame() )
+ bSeenColumn = true;
+ else if( pUp->IsSctFrame() )
+ // Allow move of frame in case our only column is not growable.
+ return bSeenColumn || !static_cast<const SwSectionFrame*>(pUp)->Growable();
else if( pUp->IsTabFrame() )
return false;
pUp = pUp->GetUpper();