include/xmloff/xmluconv.hxx                                                |   
 3 
 sw/inc/IDocumentSettingAccess.hxx                                          |   
 1 
 sw/qa/filter/ww8/ww8.cxx                                                   |   
22 ++++
 sw/qa/uibase/uno/uno.cxx                                                   |   
24 +++++
 sw/source/core/doc/DocumentSettingManager.cxx                              |   
13 ++
 sw/source/core/inc/DocumentSettingManager.hxx                              |   
 1 
 sw/source/core/layout/fly.cxx                                              |   
 6 +
 sw/source/filter/ww8/docxexport.cxx                                        |   
13 ++
 sw/source/filter/xml/xmlexp.cxx                                            |   
 5 -
 sw/source/filter/xml/xmlimp.cxx                                            |   
10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx                               |   
18 +++
 writerfilter/CppunitTest_writerfilter_dmapper.mk                           |   
 1 
 writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx                     |   
46 ++++++++++
 writerfilter/qa/cppunittests/dmapper/data/do-not-break-wrapped-tables.docx 
|binary
 writerfilter/source/dmapper/SettingsTable.cxx                              |   
10 ++
 xmloff/source/core/xmluconv.cxx                                            |   
25 ++++-
 16 files changed, 187 insertions(+), 11 deletions(-)

New commits:
commit 6ffce19cff873a3d90bb02b4a702cd06498fabb5
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu May 25 08:18:02 2023 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed May 31 13:48:05 2023 +0200

    sw floattable: handle <w:doNotBreakWrappedTables> in the DOCX filter
    
    <w:doNotBreakWrappedTables> primarily appears in documents imported from
    RTF, unless \nobrkwrptbl is specified there (which, confusingly, means
    to do split floating tables).
    
    (cherry picked from commit f5dc52dc9a068fec3323c3089929a81675b0d1ba)
    
    Conflicts:
            sw/qa/filter/ww8/ww8.cxx
    
    Change-Id: I1891b89787719805e6c87045dee3c63c68ed2940
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152296
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 0c29e3fbd10f..fd7b07ff59bf 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -24,6 +24,7 @@
 #include <IDocumentLayoutAccess.hxx>
 #include <rootfrm.hxx>
 #include <pagefrm.hxx>
+#include <IDocumentSettingAccess.hxx>
 
 namespace
 {
@@ -280,6 +281,27 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapThroughLayoutInCell)
     // i.e. layoutInCell was disabled, leading to bad layout in Word.
     assertXPath(pXmlDoc, "//wp:anchor", "layoutInCell", "1");
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables)
+{
+    // Given a document with the DO_NOT_BREAK_WRAPPED_TABLES compat mode 
enabled:
+    createSwDoc();
+    SwDoc* pDoc = getSwDoc();
+    IDocumentSettingAccess& rIDSA = pDoc->getIDocumentSettingAccess();
+    rIDSA.set(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES, true);
+
+    // When saving to docx:
+    save("Office Open XML Text");
+
+    // Then make sure the compat flag is serialized:
+    xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1
+    // - Actual  : 0
+    // - XPath '/w:settings/w:compat/w:doNotBreakWrappedTables' number of 
nodes is incorrect
+    // i.e. <w:doNotBreakWrappedTables> was not written.
+    assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotBreakWrappedTables", 1);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 838d49a9b84d..b9c75140b7f6 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1001,7 +1001,8 @@ static auto
 WriteCompat(SwDoc const& rDoc, ::sax_fastparser::FSHelperPtr const& rpFS,
         sal_Int32 & rTargetCompatibilityMode) -> void
 {
-    if 
(!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING))
+    const IDocumentSettingAccess& rIDSA = rDoc.getIDocumentSettingAccess();
+    if (!rIDSA.get(DocumentSettingId::ADD_EXT_LEADING))
     {
         rpFS->singleElementNS(XML_w, XML_noLeading);
         if (rTargetCompatibilityMode > 14)
@@ -1010,13 +1011,19 @@ WriteCompat(SwDoc const& rDoc, 
::sax_fastparser::FSHelperPtr const& rpFS,
         }
     }
     // Do not justify lines with manual break
-    if 
(rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK))
+    if (rIDSA.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK))
     {
         rpFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn);
     }
     // tdf#146515 export "Use printer metrics for document formatting"
-    if 
(!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE))
+    if (!rIDSA.get(DocumentSettingId::USE_VIRTUAL_DEVICE))
         rpFS->singleElementNS(XML_w, XML_usePrinterMetrics);
+
+    if (rIDSA.get(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES))
+    {
+        // Map the DoNotBreakWrappedTables compat flag to 
<w:doNotBreakWrappedTables>.
+        rpFS->singleElementNS(XML_w, XML_doNotBreakWrappedTables);
+    }
 }
 
 void DocxExport::WriteSettings()
diff --git a/writerfilter/CppunitTest_writerfilter_dmapper.mk 
b/writerfilter/CppunitTest_writerfilter_dmapper.mk
index 6dcfa52d6184..209a8e0d6bb8 100644
--- a/writerfilter/CppunitTest_writerfilter_dmapper.mk
+++ b/writerfilter/CppunitTest_writerfilter_dmapper.mk
@@ -24,6 +24,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,writerfilter_dmapper, \
     writerfilter/qa/cppunittests/dmapper/TextEffectsHandler \
     writerfilter/qa/cppunittests/dmapper/PropertyMap \
     writerfilter/qa/cppunittests/dmapper/SdtHelper \
+    writerfilter/qa/cppunittests/dmapper/SettingsTable \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,writerfilter_dmapper, \
diff --git a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx 
b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
new file mode 100644
index 000000000000..8b36a6170bb0
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace com::sun::star;
+
+namespace
+{
+/// Tests for writerfilter/source/dmapper/SettingsTable.cxx.
+class Test : public UnoApiTest
+{
+public:
+    Test()
+        : UnoApiTest("/writerfilter/qa/cppunittests/dmapper/data/")
+    {
+    }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables)
+{
+    // Given a document with <w:doNotBreakWrappedTables>:
+    // When importing that document:
+    loadFromURL(u"do-not-break-wrapped-tables.docx");
+
+    // Then make sure that the matching compat flag is set:
+    uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xSettings(
+        xDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+    bool bDoNotBreakWrappedTables{};
+    xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= 
bDoNotBreakWrappedTables;
+    // Without the accompanying fix in place, this test would have failed, the 
compat flag was not
+    // set.
+    CPPUNIT_ASSERT(bDoNotBreakWrappedTables);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 
a/writerfilter/qa/cppunittests/dmapper/data/do-not-break-wrapped-tables.docx 
b/writerfilter/qa/cppunittests/dmapper/data/do-not-break-wrapped-tables.docx
new file mode 100644
index 000000000000..088c056f3511
Binary files /dev/null and 
b/writerfilter/qa/cppunittests/dmapper/data/do-not-break-wrapped-tables.docx 
differ
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index d24dae617c01..6ebdccddbfe7 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -108,6 +108,7 @@ struct SettingsTable_Impl
     std::shared_ptr<DocumentProtection> m_pDocumentProtection;
     std::shared_ptr<WriteProtection> m_pWriteProtection;
     bool m_bGutterAtTop = false;
+    bool m_bDoNotBreakWrappedTables = false;
 
     SettingsTable_Impl() :
       m_nDefaultTabStop( 720 ) //default is 1/2 in
@@ -396,6 +397,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
     case NS_ooxml::LN_CT_Settings_gutterAtTop:
         m_pImpl->m_bGutterAtTop = nIntValue != 0;
         break;
+    case NS_ooxml::LN_CT_Compat_doNotBreakWrappedTables:
+        m_pImpl->m_bDoNotBreakWrappedTables = true;
+        break;
     default:
     {
 #ifdef DBG_UTIL
@@ -628,6 +632,12 @@ void 
SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x
         }
     }
 
+    if (m_pImpl->m_bDoNotBreakWrappedTables)
+    {
+        // Map <w:doNotBreakWrappedTables> to the DoNotBreakWrappedTables 
compat flag.
+        xDocumentSettings->setPropertyValue("DoNotBreakWrappedTables", 
uno::Any(true));
+    }
+
     // Auto hyphenation: turns on hyphenation by default, 
<w:suppressAutoHyphens/> may still disable it at a paragraph level.
     // Situation is similar for RTF_WIDOWCTRL, which turns on widow / orphan 
control by default.
     if (!(m_pImpl->m_bAutoHyphenation || m_pImpl->m_bNoHyphenateCaps || 
m_pImpl->m_bWidowControl))
commit 53b99e785cf5506fdbdd3d896154a2b1ad6e9aac
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed May 24 11:00:11 2023 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed May 31 13:47:58 2023 +0200

    sw floattable: add a DoNotBreakWrappedTables compat flag
    
    RTF doesn't break floating table across pages, and there is a matching
    DOCX compat flag to handle such documents.
    
    We can ignore floating table info on the model as a workaround, but that
    would mean the info is lost on save, so that's not ideal.
    
    Instead add a new compat flag that disables fly split at a layout level,
    which allows both not splitting tables & retaining the model-level info.
    This commit does the doc model, UNO API, layout & ODT filter, the Word
    filters are not yet updated.
    
    This compat flag is probably quite rare, so introduce a mechanism to
    only write the compat flag when it's true: this way the majority of the
    documents don't need to say anything about it and we can assume "false"
    for them. Also fix two missing xmlTextWriterEndElement() calls in the
    xml dumper.
    
    (cherry picked from commit 08fa2903df1a7cf9a1647fcf967e4c8b57dad793)
    
    Change-Id: I32321ec204d7bfe011fcf024b97c906da0db8aae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152260
    Tested-by: Miklos Vajna <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
index 9af40034400a..c9e1bea3c9ec 100644
--- a/include/xmloff/xmluconv.hxx
+++ b/include/xmloff/xmluconv.hxx
@@ -288,7 +288,8 @@ public:
                                   sal_Int16 nType );
 
     static void 
convertPropertySet(css::uno::Sequence<css::beans::PropertyValue>& rProps,
-                        const css::uno::Reference<css::beans::XPropertySet>& 
aProperties);
+                        const css::uno::Reference<css::beans::XPropertySet>& 
aProperties,
+                        const std::initializer_list<std::u16string_view>* 
pOmitFalseValues = nullptr);
     static void 
convertPropertySet(css::uno::Reference<css::beans::XPropertySet> const & 
rProperties,
                         const css::uno::Sequence<css::beans::PropertyValue>& 
aProps);
 
diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index e891a2b8c058..04f286efe1f9 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -93,6 +93,7 @@ enum class DocumentSettingId
     // tdf#129448: Auto first-line indent should not be effected by line space
     AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
     HYPHENATE_URLS, ///< tdf#152952
+    DO_NOT_BREAK_WRAPPED_TABLES,
     // COMPATIBILITY FLAGS END
     BROWSE_MODE,
     HTML_MODE,
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index d6625b3c4dc7..50d1582133b9 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -510,6 +510,30 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetField)
                          aBookmark.get<std::string>("name"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotBreakWrappedTables)
+{
+    // Given an empty document:
+    createSwDoc();
+
+    // When checking the state of the DoNotBreakWrappedTables compat flag:
+    uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xSettings(
+        xDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+    bool bDoNotBreakWrappedTables{};
+    // Without the accompanying fix in place, this test would have failed with:
+    // An uncaught exception of type 
com.sun.star.beans.UnknownPropertyException
+    // i.e. the compat flag was not recognized.
+    xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= 
bDoNotBreakWrappedTables;
+    // Then make sure it's false by default:
+    CPPUNIT_ASSERT(!bDoNotBreakWrappedTables);
+
+    // And when setting DoNotBreakWrappedTables=true:
+    xSettings->setPropertyValue("DoNotBreakWrappedTables", uno::Any(true));
+    // Then make sure it gets enabled:
+    xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= 
bDoNotBreakWrappedTables;
+    CPPUNIT_ASSERT(bDoNotBreakWrappedTables);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index da04446c1271..8a75b9f31eff 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -248,6 +248,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
         case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
             return mbAutoFirstLineIndentDisregardLineSpace;
         case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs;
+        case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
+            return mbDoNotBreakWrappedTables;
         case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return 
mbWrapAsCharFlysLikeInOOXML;
         case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
         case DocumentSettingId::DROP_CAP_PUNCTUATION: return 
mbDropCapPunctuation;
@@ -433,6 +435,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
             mbHyphenateURLs = value;
             break;
 
+        case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
+            mbDoNotBreakWrappedTables = value;
+            break;
+
         case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML:
             mbWrapAsCharFlysLikeInOOXML = value;
             break;
@@ -1039,10 +1045,17 @@ void 
sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
     (void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("mbFootnoteInColumnToPageEnd"));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
                                 
BAD_CAST(OString::boolean(mbFootnoteInColumnToPageEnd).getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
 
     (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbHyphenateURLs"));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
                                 
BAD_CAST(OString::boolean(mbHyphenateURLs).getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+
+    (void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("mbDoNotBreakWrappedTables"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+                                
BAD_CAST(OString::boolean(mbDoNotBreakWrappedTables).getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
 
     (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mnImagePreferredDPI"));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 
b/sw/source/core/inc/DocumentSettingManager.hxx
index 07a12e3f1a6b..31dcf2f20360 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -175,6 +175,7 @@ class DocumentSettingManager final :
     sal_Int32 mnImagePreferredDPI;
     bool mbAutoFirstLineIndentDisregardLineSpace;
     bool mbHyphenateURLs = false;
+    bool mbDoNotBreakWrappedTables = false;
     // If this is on as_char flys wrapping will be handled the same like in 
Word
     bool mbWrapAsCharFlysLikeInOOXML;
     bool mbNoNumberingShowFollowBy;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 054e86525180..20b02ed05e86 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -661,6 +661,12 @@ bool SwFlyFrame::IsFlySplitAllowed() const
         return false;
     }
 
+    const IDocumentSettingAccess& rIDSA = 
GetFormat()->getIDocumentSettingAccess();
+    if (rIDSA.get(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES))
+    {
+        return false;
+    }
+
     if (FindFooterOrHeader())
     {
         // Adding a new page would not increase the header/footer area.
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 65df1c99e243..6d9f16f35218 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -394,7 +394,10 @@ void SwXMLExport::GetConfigurationSettings( Sequence < 
PropertyValue >& rProps)
     if (!xProps.is())
         return;
 
-    SvXMLUnitConverter::convertPropertySet( rProps, xProps );
+    static const std::initializer_list<std::u16string_view> vOmitFalseValues = 
{
+        u"DoNotBreakWrappedTables",
+    };
+    SvXMLUnitConverter::convertPropertySet( rProps, xProps, &vOmitFalseValues 
);
 
     // tdf#144532 if NoEmbDataSet was set, to indicate not to write an embedded
     // database for the case of a temporary mail merge preview document, then
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 5ef66a1bf36f..58916ccd3b08 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1308,6 +1308,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence 
< PropertyValue > & aC
     bool bCollapseEmptyCellPara = false;
     bool bAutoFirstLineIndentDisregardLineSpace = false;
     bool bHyphenateURLs = false;
+    bool bDoNotBreakWrappedTables = false;
     bool bDropCapPunctuation = false;
 
     const PropertyValue* currentDatabaseDataSource = nullptr;
@@ -1406,6 +1407,10 @@ void SwXMLImport::SetConfigurationSettings(const 
Sequence < PropertyValue > & aC
                 {
                     bHyphenateURLs = true;
                 }
+                else if (rValue.Name == "DoNotBreakWrappedTables")
+                {
+                    rValue.Value >>= bDoNotBreakWrappedTables;
+                }
                 else if ( rValue.Name == "DropCapPunctuation" )
                     bDropCapPunctuation = true;
             }
@@ -1575,6 +1580,11 @@ void SwXMLImport::SetConfigurationSettings(const 
Sequence < PropertyValue > & aC
         xProps->setPropertyValue("HyphenateURLs", Any(true));
     }
 
+    if (bDoNotBreakWrappedTables)
+    {
+        xProps->setPropertyValue("DoNotBreakWrappedTables", Any(true));
+    }
+
     // LO 7.4 and previous versions had different drop cap punctuation: very 
long dashes.
     // In order to keep backwards compatibility, DropCapPunctuation option is 
written to .odt
     // files, and the default for new documents is 'true'. Files without this 
option
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx 
b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 9ce8dda4d5fd..316914d4cf14 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -153,6 +153,7 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_IMAGE_PREFERRED_DPI,
     HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
     HANDLE_HYPHENATE_URLS,
+    HANDLE_DO_NOT_BREAK_WRAPPED_TABLES,
     HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS,
     HANDLE_NO_NUMBERING_SHOW_FOLLOWBY,
     HANDLE_DROP_CAP_PUNCTUATION
@@ -255,6 +256,7 @@ static rtl::Reference<MasterPropertySetInfo> 
lcl_createSettingsInfo()
         { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, 
cppu::UnoType<sal_Int32>::get(), 0 },
         { OUString("AutoFirstLineIndentDisregardLineSpace"), 
HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 
0 },
         { OUString("HyphenateURLs"), HANDLE_HYPHENATE_URLS, 
cppu::UnoType<bool>::get(), 0 },
+        { OUString("DoNotBreakWrappedTables"), 
HANDLE_DO_NOT_BREAK_WRAPPED_TABLES, cppu::UnoType<bool>::get(), 0 },
         { OUString("WordLikeWrapForAsCharFlys"), 
HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, cppu::UnoType<bool>::get(), 0 },
         { OUString("NoNumberingShowFollowBy"), 
HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, cppu::UnoType<bool>::get(), 0 },
         { OUString("DropCapPunctuation"), HANDLE_DROP_CAP_PUNCTUATION, 
cppu::UnoType<bool>::get(), 0 },
@@ -1068,6 +1070,16 @@ void SwXDocumentSettings::_setSingleValue( const 
comphelper::PropertyInfo & rInf
             }
         }
         break;
+        case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES:
+        {
+            bool bTmp;
+            if (rValue >>= bTmp)
+            {
+                mpDoc->getIDocumentSettingAccess().set(
+                    DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES, bTmp);
+            }
+        }
+        break;
         case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS:
         {
             bool bTmp;
@@ -1620,6 +1632,12 @@ void SwXDocumentSettings::_getSingleValue( const 
comphelper::PropertyInfo & rInf
                 DocumentSettingId::HYPHENATE_URLS);
         }
         break;
+        case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES:
+        {
+            rValue <<= mpDoc->getIDocumentSettingAccess().get(
+                DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES);
+        }
+        break;
         case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS:
         {
             rValue <<= mpDoc->getIDocumentSettingAccess().get(
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 96bc2f0e4031..8a8f16343d23 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -49,6 +49,7 @@
 #include <basegfx/vector/b3dvector.hxx>
 
 #include <sax/tools/converter.hxx>
+#include <comphelper/sequence.hxx>
 
 
 using namespace com::sun::star;
@@ -778,7 +779,8 @@ void SvXMLUnitConverter::convertNumLetterSync( 
OUStringBuffer& rBuffer,
 }
 
 void 
SvXMLUnitConverter::convertPropertySet(uno::Sequence<beans::PropertyValue>& 
rProps,
-                    const uno::Reference<beans::XPropertySet>& aProperties)
+                    const uno::Reference<beans::XPropertySet>& aProperties,
+                    const std::initializer_list<std::u16string_view>* 
pOmitFalseValues)
 {
     uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = 
aProperties->getPropertySetInfo();
     if (!xPropertySetInfo.is())
@@ -787,14 +789,25 @@ void 
SvXMLUnitConverter::convertPropertySet(uno::Sequence<beans::PropertyValue>&
     const uno::Sequence< beans::Property > aProps = 
xPropertySetInfo->getProperties();
     if (aProps.hasElements())
     {
-        rProps.realloc(aProps.getLength());
-        beans::PropertyValue* pProps = rProps.getArray();
+        std::vector<beans::PropertyValue> aPropsVec;
         for (const auto& rProp : aProps)
         {
-            pProps->Name = rProp.Name;
-            pProps->Value = aProperties->getPropertyValue(rProp.Name);
-            ++pProps;
+            uno::Any aPropertyValue = 
aProperties->getPropertyValue(rProp.Name);
+            if (pOmitFalseValues && aPropertyValue.has<bool>() && 
!aPropertyValue.get<bool>())
+            {
+                const std::initializer_list<std::u16string_view>& 
rOmitFalseValues = *pOmitFalseValues;
+                if (std::find(rOmitFalseValues.begin(), 
rOmitFalseValues.end(), rProp.Name) != rOmitFalseValues.end())
+                {
+                    continue;
+                }
+            }
+
+            beans::PropertyValue aValue;
+            aValue.Name = rProp.Name;
+            aValue.Value = aPropertyValue;
+            aPropsVec.push_back(aValue);
         }
+        rProps = comphelper::containerToSequence(aPropsVec);
     }
 }
 

Reply via email to