summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/qa/extras/odfexport/data/tdf104596_breakingExample.odtbin0 -> 64455 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx6
-rw-r--r--sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.docbin0 -> 29184 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx10
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx13
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx2
-rw-r--r--sw/source/core/text/txtfly.cxx3
-rw-r--r--sw/source/filter/xml/xmlimp.cxx6
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx17
10 files changed, 57 insertions, 1 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 8ff48ff467a7..cbf8dbf2ff99 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -49,6 +49,7 @@ 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
new file mode 100644
index 000000000000..19d0e85c42b7
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index ddf37f102834..c084c008d59b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -449,6 +449,12 @@ 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/ww8export/data/tdf104596_wrapInHeaderTable.doc b/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc
new file mode 100644
index 000000000000..17fba79453a9
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 2de178221c8e..13da2fec9d1b 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -53,6 +53,16 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
}
+DECLARE_WW8EXPORT_TEST(testTdf104596_wrapInHeaderTable, "tdf104596_wrapInHeaderTable.doc")
+{
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+ sal_Int32 nRowHeight = getXPath(pXmlDoc, "//header/tab/row[1]/infos/bounds", "height").toInt32();
+ // The fly is supposed to be no-wrap, so the text should come underneath it, not wrap-through,
+ // thus making the row much higher. Before, height was 706. Now it is 1067.
+ CPPUNIT_ASSERT_MESSAGE("Text must wrap under green box", nRowHeight > 1000);
+}
+
DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
{
auto xNumberingRules
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index cc092dcc2c49..73421cee6eab 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -98,7 +98,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbProtectBookmarks(false),
mbProtectFields(false),
mbHeaderSpacingBelowLastPara(false),
- mbFrameAutowidthWithMorePara(false)
+ mbFrameAutowidthWithMorePara(false),
+ mbAllowWrapWhenAnchoredInTable(true) //tdf#104596
// COMPATIBILITY FLAGS END
{
@@ -228,6 +229,7 @@ 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");
}
@@ -479,6 +481,9 @@ 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");
}
@@ -652,6 +657,7 @@ 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
@@ -957,6 +963,11 @@ 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 8b409eb6be23..c8caa5081980 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -167,6 +167,8 @@ class DocumentSettingManager :
bool mbProtectFields;
bool mbHeaderSpacingBelowLastPara;
bool mbFrameAutowidthWithMorePara; //tdf#124423
+ bool mbAllowWrapWhenAnchoredInTable;
+
public:
DocumentSettingManager(SwDoc &rDoc);
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 52979fde8c10..cbaee31900ad 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -834,10 +834,13 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
const size_t nCount = pSorted ? pSorted->size() : 0;
// --> #108724# Page header/footer content doesn't have to wrap around
// floating screen objects
+ // which was added simply to be compatible with MS Office.
+ // MSO still allows text to wrap around in-table-flies in headers/footers/footnotes
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 bWrapAllowed = ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ||
+ (pIDSA->get(DocumentSettingId::ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE) && m_pCurrFrame->IsInTab()) ||
(!m_pCurrFrame->IsInFootnote() && !bFooterHeader));
bOn = false;
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 5495d67e210c..bcec7a220d80 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1358,6 +1358,7 @@ 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;
@@ -1454,6 +1455,8 @@ 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& )
{
@@ -1624,6 +1627,9 @@ 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 9af674558e86..3d103db1347c 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -145,6 +145,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_PROTECT_FIELDS,
HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
+ HANDLE_ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE,
};
}
@@ -237,6 +238,7 @@ 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
@@ -992,6 +994,15 @@ 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));
}
@@ -1483,6 +1494,12 @@ 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));
}