dev/null |binary sw/inc/IDocumentSettingAccess.hxx | 1 sw/qa/extras/odfexport/odfexport.cxx | 6 --- sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap_c12.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 9 +++++ sw/source/core/doc/DocumentSettingManager.cxx | 13 -------- sw/source/core/inc/DocumentSettingManager.hxx | 1 sw/source/core/text/txtfly.cxx | 8 +++-- sw/source/filter/xml/xmlimp.cxx | 6 --- sw/source/uibase/uno/SwXDocumentSettings.cxx | 17 ----------- 10 files changed, 16 insertions(+), 45 deletions(-)
New commits: commit 57320af60d97f2918b5d1e73575b23682e0a0637 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Thu Aug 13 19:05:35 2020 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Aug 31 16:00:46 2020 +0200 tdf#104596 sw layout: wrap in header only if bLayoutInCell This patch depends on tdf#77794's 7.1 commit 7cc353df4f0993228984fcda3efb2c9181dddafb. For more details about the issue in general, see the verbose comments in this bug's previous 7.1 commit e4635544b816d1ca27bd1ebba60f51444b0a898e. This patch is related to CompatibilityMode < 15. Unfortunately, the previous patch didn't work with older Word 2010 versions of the file, which _shouldn't_ wrap non-LayoutInCell table-anchored flies. Unfortunately, now that different behaviour is necessary for different Word compat levels, it no longer allows a nice way for Writer to handle this natively. So since it would be very unlikely for a user to create a document like this (since the necessary "keep inside text boundaries" is off by default in Writer, but is forced on by definition in Word 2013+), I'm removing the compatibility flag I added in 7.1, and its related unit test. [To do this natively would probably require enabling the IsFollowingTextFlow property by default in SW. That sounds very dangerous since this property is not restricted to IsInTable layout situations. This property has been around since at least LO 3.5.] Change-Id: I70da016cb68f515924ed6c17085bf73a9e1c5492 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100684 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 2f514bdcc62d..2ae267d08fe0 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -49,7 +49,6 @@ enum class DocumentSettingId ADD_PARA_SPACING_TO_TABLE_CELLS, USE_FORMER_OBJECT_POS, USE_FORMER_TEXT_WRAPPING, - ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE, // change LO to match MS allowing wrapping around fly-frames anchored in tables in header & footnote CONSIDER_WRAP_ON_OBJECT_POSITION, IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, diff --git a/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt b/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt deleted file mode 100644 index 19d0e85c42b7..000000000000 Binary files a/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt and /dev/null differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 715d9ad68d35..cb131ece62de 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -466,12 +466,6 @@ DECLARE_ODFEXPORT_TEST(testredlineTextFrame, "redlineTextFrame.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } -DECLARE_ODFEXPORT_TEST(testTdf104596_breakingExample, "tdf104596_breakingExample.odt") -{ - //wrapping should be ignored on in-table flies for pre-LO7.1 documents. ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Fits on one page", 1, getPages() ); -} - DECLARE_ODFEXPORT_TEST(testTdf131621, "tdf131621.ott") { CPPUNIT_ASSERT_EQUAL(12, getShapes()); diff --git a/sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap_c12.docx b/sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap_c12.docx new file mode 100644 index 000000000000..00c1353d984d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135595_HFtableWrap_c12.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 01f0726f5296..e68dde7499e7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -111,6 +111,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135595_HFtableWrap, "tdf135595_HFtableWrap.odt") CPPUNIT_ASSERT_MESSAGE("Image must be contained inside the table cell", nRowHeight > 2000); } +DECLARE_OOXMLEXPORT_TEST(testTdf135595_HFtableWrap_c12, "tdf135595_HFtableWrap_c12.docx") +{ + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // tdf#104596: ignore wrap exception apparently does not apply if it is not "layout in table cell". + // Should be only one page. Row height should be two lines at 722, not wrapped to three lines at 998. + sal_Int32 nRowHeight = getXPath(pXmlDoc, "//header/tab/row/infos/bounds", "height").toInt32(); + CPPUNIT_ASSERT_MESSAGE("Text must not wrap around header image", nRowHeight < 800); +} + DECLARE_OOXMLIMPORT_TEST(testTdf123622, "tdf123622.docx") { uno::Reference<beans::XPropertySet> XPropsRight(getShape(1),uno::UNO_QUERY); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 843b6067f3c6..6c3ee2e54150 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -98,8 +98,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbProtectBookmarks(false), mbProtectFields(false), mbHeaderSpacingBelowLastPara(false), - mbFrameAutowidthWithMorePara(false), - mbAllowWrapWhenAnchoredInTable(true) //tdf#104596 + mbFrameAutowidthWithMorePara(false) // COMPATIBILITY FLAGS END { @@ -229,7 +228,6 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::PROTECT_FIELDS: return mbProtectFields; case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return mbHeaderSpacingBelowLastPara; case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA: return mbFrameAutowidthWithMorePara; - case DocumentSettingId::ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE: return mbAllowWrapWhenAnchoredInTable; default: OSL_FAIL("Invalid setting id"); } @@ -481,9 +479,6 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA: mbFrameAutowidthWithMorePara = value; break; - case DocumentSettingId::ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE: - mbAllowWrapWhenAnchoredInTable = value; - break; default: OSL_FAIL("Invalid setting id"); } @@ -657,7 +652,6 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti // No mbProtectFields: this is false by default everywhere mbHeaderSpacingBelowLastPara = rSource.mbHeaderSpacingBelowLastPara; mbFrameAutowidthWithMorePara = rSource.mbFrameAutowidthWithMorePara; - mbAllowWrapWhenAnchoredInTable = rSource.mbAllowWrapWhenAnchoredInTable; } sal_uInt32 sw::DocumentSettingManager::Getn32DummyCompatibilityOptions1() const @@ -963,11 +957,6 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const BAD_CAST(OString::boolean(mbFrameAutowidthWithMorePara).getStr())); xmlTextWriterEndElement(pWriter); - xmlTextWriterStartElement(pWriter, BAD_CAST("mbAllowWrapWhenAnchoredInTable")); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), - BAD_CAST(OString::boolean(mbAllowWrapWhenAnchoredInTable).getStr())); - xmlTextWriterEndElement(pWriter); - xmlTextWriterEndElement(pWriter); } diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index c8caa5081980..867e55f628f7 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -167,7 +167,6 @@ class DocumentSettingManager : bool mbProtectFields; bool mbHeaderSpacingBelowLastPara; bool mbFrameAutowidthWithMorePara; //tdf#124423 - bool mbAllowWrapWhenAnchoredInTable; public: diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index bb85fb4e085c..8556869c8726 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -43,6 +43,7 @@ #include <fmtsrnd.hxx> #include <fmtanchr.hxx> #include <frmfmt.hxx> +#include <fmtfollowtextflow.hxx> #include <pagedesc.hxx> #include <sortedobjs.hxx> #include <IDocumentDrawModelAccess.hxx> @@ -839,8 +840,9 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() const bool bFooterHeader = nullptr != m_pCurrFrame->FindFooterOrHeader(); const IDocumentSettingAccess* pIDSA = &m_pCurrFrame->GetDoc().getIDocumentSettingAccess(); // #i40155# - check, if frame is marked not to wrap + const bool bAllowCompatWrap = m_pCurrFrame->IsInTab() && (bFooterHeader || m_pCurrFrame->IsInFootnote()); const bool bWrapAllowed = ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) || - (pIDSA->get(DocumentSettingId::ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE) && m_pCurrFrame->IsInTab()) || + bAllowCompatWrap || (!m_pCurrFrame->IsInFootnote() && !bFooterHeader)); m_bOn = false; @@ -887,7 +889,9 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() !rIDDMA.IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) || !pAnchoredObj->ConsiderForTextWrap() || ( mbIgnoreObjsInHeaderFooter && !bFooterHeader && - pAnchoredObj->GetAnchorFrame()->FindFooterOrHeader() ) ) + pAnchoredObj->GetAnchorFrame()->FindFooterOrHeader() ) || + ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() ) + ) { continue; } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 3dd6ab11be76..c03a46d20545 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1358,7 +1358,6 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bPropLineSpacingShrinksFirstLine = false; bool bSubtractFlysAnchoredAtFlys = false; bool bCollapseEmptyCellPara = false; - bool bIsSetAllowWrapWhenAnchoredInTable = false; const PropertyValue* currentDatabaseDataSource = nullptr; const PropertyValue* currentDatabaseCommand = nullptr; @@ -1455,8 +1454,6 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bSubtractFlysAnchoredAtFlys = true; else if (rValue.Name == "CollapseEmptyCellPara") bCollapseEmptyCellPara = true; - else if ( rValue.Name == "AllowWrapWhenAnchoredInTable" ) - bIsSetAllowWrapWhenAnchoredInTable = true; } catch( Exception& ) { @@ -1627,9 +1624,6 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if (!bCollapseEmptyCellPara) xProps->setPropertyValue("CollapseEmptyCellPara", makeAny(false)); - if (!bIsSetAllowWrapWhenAnchoredInTable) - xProps->setPropertyValue("AllowWrapWhenAnchoredInTable", makeAny(false)); - SwDoc *pDoc = getDoc(); SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( false ); if( pPrinter ) diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 3d103db1347c..9af674558e86 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -145,7 +145,6 @@ enum SwDocumentSettingsPropertyHandles HANDLE_PROTECT_FIELDS, HANDLE_HEADER_SPACING_BELOW_LAST_PARA, HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, - HANDLE_ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE, }; } @@ -238,7 +237,6 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 }, { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 }, { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 }, - { OUString("AllowWrapWhenAnchoredInTable"), HANDLE_ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE, cppu::UnoType<bool>::get(), 0 }, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -994,15 +992,6 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; - case HANDLE_ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE: - { - bool bTmp; - if (rValue >>= bTmp) - { - mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE, bTmp); - } - } - break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } @@ -1494,12 +1483,6 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA); } break; - case HANDLE_ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE: - { - rValue <<= mpDoc->getIDocumentSettingAccess().get( - DocumentSettingId::ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE); - } - break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits