diff options
-rw-r--r-- | sw/CppunitTest_sw_odfimport.mk | 3 | ||||
-rw-r--r-- | sw/qa/extras/odfimport/data/bnc800714.fodt | 35 | ||||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/text/frmform.cxx | 7 |
4 files changed, 55 insertions, 1 deletions
diff --git a/sw/CppunitTest_sw_odfimport.mk b/sw/CppunitTest_sw_odfimport.mk index a37b4380fa25..41357beec095 100644 --- a/sw/CppunitTest_sw_odfimport.mk +++ b/sw/CppunitTest_sw_odfimport.mk @@ -56,6 +56,9 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfimport,\ configmgr/source/configmgr \ embeddedobj/util/embobj \ filter/source/config/cache/filterconfig1 \ + filter/source/odfflatxml/odfflatxml \ + filter/source/xmlfilterdetect/xmlfd \ + filter/source/xmlfilteradaptor/xmlfa \ framework/util/fwk \ i18npool/util/i18npool \ lingucomponent/source/languageguessing/guesslang \ diff --git a/sw/qa/extras/odfimport/data/bnc800714.fodt b/sw/qa/extras/odfimport/data/bnc800714.fodt new file mode 100644 index 000000000000..a759b7c843a1 --- /dev/null +++ b/sw/qa/extras/odfimport/data/bnc800714.fodt @@ -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> diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index e7fa8fbe4743..f1651bdcb6e7 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -13,6 +13,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> @@ -462,6 +463,16 @@ DECLARE_ODFIMPORT_TEST(testSpellmenuRedline, "spellmenu-redline.odt") CPPUNIT_ASSERT_EQUAL(sal_uInt16(FN_REDLINE_PREV_CHANGE), aPopup.GetItemId(aPopup.GetItemCount() - 1)); } +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(); diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 6b0eed62c6c6..c4a9033b6e79 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -999,10 +999,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()->Count() == 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; |