bnc#800714 SwTxtFrm::FormatAdjust: still call SplitFrm if we have columns
Regression from c5a8a2c3cb
(sw34bf05:
i#84870 - method <SwTxtFrm::FormatAdjust(..)> - do not split text frame
which only contains on as-character anchored object, 2011-03-11), the
i#84870 fix was for a document which didn't have columns, and didn't
consider that this causes a layout loop in case:
1) There are two paragraphs in a section, having multiple columns.
2) The second paragraph has fo:keep-together="always".
In this case originally we tried to call SplitFrm(), realized that it
didn't help, and then gave up. But after the change, we kept trying to
satisfy the two conflicting requirements (balance content in the 3
columns vs keep the second paragraph with the first one).
Fix the problem by not calling SplitFrm() only in case we're not inside
columns.
Change-Id: I64e969ef5e8f519314f5613f8e6fae626ae085ce
This commit is contained in:
parent
72cb37b685
commit
2d35baed5e
4 changed files with 55 additions and 1 deletions
|
@ -58,6 +58,9 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfimport,\
|
|||
embeddedobj/util/embobj \
|
||||
filter/source/config/cache/filterconfig1 \
|
||||
filter/source/storagefilterdetect/storagefd \
|
||||
filter/source/odfflatxml/odfflatxml \
|
||||
filter/source/xmlfilterdetect/xmlfd \
|
||||
filter/source/xmlfilteradaptor/xmlfa \
|
||||
framework/util/fwk \
|
||||
i18npool/util/i18npool \
|
||||
lingucomponent/source/languageguessing/guesslang \
|
||||
|
|
35
sw/qa/extras/odfimport/data/bnc800714.fodt
Normal file
35
sw/qa/extras/odfimport/data/bnc800714.fodt
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||
<office:automatic-styles>
|
||||
<style:style style:name="P1" style:family="paragraph"/>
|
||||
<style:style style:name="P2" style:family="paragraph">
|
||||
<style:paragraph-properties fo:keep-with-next="always"/>
|
||||
</style:style>
|
||||
<style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame">
|
||||
<style:graphic-properties style:vertical-pos="top" style:vertical-rel="baseline"/>
|
||||
</style:style>
|
||||
<style:style style:name="Sect1" style:family="section">
|
||||
<style:section-properties text:dont-balance-text-columns="false" style:editable="false">
|
||||
<style:columns fo:column-count="3" fo:column-gap="0cm">
|
||||
<style:column style:rel-width="21845*" fo:start-indent="0cm" fo:end-indent="0cm"/>
|
||||
<style:column style:rel-width="21845*" fo:start-indent="0cm" fo:end-indent="0cm"/>
|
||||
<style:column style:rel-width="21845*" fo:start-indent="0cm" fo:end-indent="0cm"/>
|
||||
</style:columns>
|
||||
</style:section-properties>
|
||||
</style:style>
|
||||
</office:automatic-styles>
|
||||
<office:body>
|
||||
<office:text>
|
||||
<text:p text:style-name="P1">Before.</text:p>
|
||||
<text:section text:style-name="Sect1" text:name="Section1">
|
||||
<text:p text:style-name="P2"><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="as-char" svg:width="2cm" draw:z-index="0">
|
||||
<draw:text-box fo:min-height="0.439cm">
|
||||
<text:p/>
|
||||
</draw:text-box>
|
||||
</draw:frame></text:p>
|
||||
<text:p text:style-name="P1">Frame.</text:p>
|
||||
</text:section>
|
||||
<text:p text:style-name="P1">After.</text:p>
|
||||
</office:text>
|
||||
</office:body>
|
||||
</office:document>
|
|
@ -14,6 +14,7 @@
|
|||
#include <com/sun/star/style/PageStyleLayout.hpp>
|
||||
#include <com/sun/star/table/XCell.hpp>
|
||||
#include <com/sun/star/table/BorderLine.hpp>
|
||||
#include <com/sun/star/text/XTextSection.hpp>
|
||||
#include <com/sun/star/text/XTextTable.hpp>
|
||||
|
||||
#include <wrtsh.hxx>
|
||||
|
@ -521,6 +522,16 @@ DECLARE_ODFIMPORT_TEST(fdo81223, "fdo81223.odt")
|
|||
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xfeffffff), nValue);
|
||||
}
|
||||
|
||||
DECLARE_ODFIMPORT_TEST(testBnc800714, "bnc800714.fodt")
|
||||
{
|
||||
// Document's second paragraph wants to be together with the third one, but:
|
||||
// - it's in a section with multiple columns
|
||||
// - contains a single as-char anchored frame
|
||||
// This was a layout loop.
|
||||
CPPUNIT_ASSERT(getProperty< uno::Reference<text::XTextSection> >(getParagraph(2), "TextSection").is());
|
||||
CPPUNIT_ASSERT(getProperty<bool>(getParagraph(2), "ParaKeepTogether"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
|
|
@ -978,10 +978,15 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine,
|
|||
? 1 : 0;
|
||||
// --> OD #i84870#
|
||||
// no split of text frame, which only contains a as-character anchored object
|
||||
const bool bOnlyContainsAsCharAnchoredObj =
|
||||
bool bOnlyContainsAsCharAnchoredObj =
|
||||
!IsFollow() && nStrLen == 1 &&
|
||||
GetDrawObjs() && GetDrawObjs()->size() == 1 &&
|
||||
(*GetDrawObjs())[0]->GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AS_CHAR;
|
||||
|
||||
// Still try split text frame if we have columns.
|
||||
if (FindColFrm())
|
||||
bOnlyContainsAsCharAnchoredObj = false;
|
||||
|
||||
if ( nNew && bOnlyContainsAsCharAnchoredObj )
|
||||
{
|
||||
nNew = 0;
|
||||
|
|
Loading…
Reference in a new issue