[Libreoffice-commits] core.git: include/xmloff sw/inc sw/qa sw/source xmloff/source

2023-05-24 Thread Miklos Vajna (via logerrit)
 include/xmloff/xmluconv.hxx   |3 ++-
 sw/inc/IDocumentSettingAccess.hxx |1 +
 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/xml/xmlexp.cxx   |5 -
 sw/source/filter/xml/xmlimp.cxx   |   10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 xmloff/source/core/xmluconv.cxx   |   25 +++--
 10 files changed, 98 insertions(+), 8 deletions(-)

New commits:
commit 08fa2903df1a7cf9a1647fcf967e4c8b57dad793
Author: Miklos Vajna 
AuthorDate: Wed May 24 11:00:11 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 24 12:38:09 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.

Change-Id: I32321ec204d7bfe011fcf024b97c906da0db8aae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152190
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

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& rProps,
-const css::uno::Reference& 
aProperties);
+const css::uno::Reference& 
aProperties,
+const std::initializer_list* 
pOmitFalseValues = nullptr);
 static void 
convertPropertySet(css::uno::Reference const & 
rProperties,
 const css::uno::Sequence& 
aProps);
 
diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index c05e5d54df4b..f8d9bfa2ab59 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -92,6 +92,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 6ad35e07466a..dd74cd716ea3 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("name"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotBreakWrappedTables)
+{
+// Given an empty document:
+createSwDoc();
+
+// When checking the state of the DoNotBreakWrappedTables compat flag:
+uno::Reference xDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 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 412d1a56b686..7eb4f9de5f20 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -252,6 +252,8 

[Libreoffice-commits] core.git: include/xmloff sw/inc sw/qa sw/source xmloff/source

2016-06-20 Thread Jakub Trzebiatowski
 include/xmloff/table/XMLTableExport.hxx |1 
 include/xmloff/xmltoken.hxx |8 +
 sw/inc/unostyle.hxx |7 +
 sw/qa/python/check_styles.py|2 
 sw/source/core/doc/tblafmt.cxx  |   45 +++--
 sw/source/core/unocore/unomap.cxx   |   14 ++-
 sw/source/core/unocore/unostyle.cxx |   40 
 sw/source/filter/xml/xmlfmte.cxx|1 
 xmloff/source/core/xmltoken.cxx |8 +
 xmloff/source/style/prhdlfac.cxx|   21 
 xmloff/source/table/XMLTableExport.cxx  |  146 +---
 xmloff/source/text/txtprhdl.cxx |   19 
 12 files changed, 270 insertions(+), 42 deletions(-)

New commits:
commit 309bc35559cb823415139044272b10feccdb6ae7
Author: Jakub Trzebiatowski 
Date:   Sat Jun 11 15:17:48 2016 +0200

GSoC Table Styles, Export Cell Styles

Exporting cell-styles
Exporting table-template
To be able to map SwTableAutoFormat to table-template 1:1
extended table-template by the following elements:
loext:first-row-even-column
loext:last-row-even-column
loext:first-row-end-column
loext:first-row-start-column
loext:last-row-end-column
loext:last-row-start-column

Added attributes describing box format to SwXTextCellStyle

Change-Id: I2967ba461dfc6f030c1e5cdbba62e2673d3b232b
Reviewed-on: https://gerrit.libreoffice.org/26185
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/include/xmloff/table/XMLTableExport.hxx 
b/include/xmloff/table/XMLTableExport.hxx
index 73ad0e3..c91c734 100644
--- a/include/xmloff/table/XMLTableExport.hxx
+++ b/include/xmloff/table/XMLTableExport.hxx
@@ -83,6 +83,7 @@ private:
 std::map< const css::uno::Reference< css::table::XColumnRowRange >, 
std::shared_ptr< XMLTableInfo > >
 maTableInfoMap;
 boolmbExportTables;
+boolmbWriter;
 
 protected:
 SvXMLExport& GetExport() { return mrExport; }
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index aaabbba..5b0902d 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3067,6 +3067,14 @@ namespace xmloff { namespace token {
 XML_ODD_ROWS,
 XML_EVEN_COLUMNS,
 XML_ODD_COLUMNS,
+// table styles
+XML_FIRST_ROW_EVEN_COLUMN,
+XML_LAST_ROW_EVEN_COLUMN,
+XML_FIRST_ROW_END_COLUMN,
+XML_FIRST_ROW_START_COLUMN,
+XML_LAST_ROW_END_COLUMN,
+XML_LAST_ROW_START_COLUMN,
+
 XML_HORIZONTAL_ON_ODD,
 // Password error from 1.4 to 2.0 Beta (#i45874#)
 XML_RESTART_NUMBERING,
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index cbb04f5..07311e8 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -272,6 +272,13 @@ class SwXTextTableStyle : public cppu::WeakImplHelper
 ODD_COLUMNS_STYLE,
 BODY_STYLE,
 BACKGROUND_STYLE,
+// loext namespace
+FIRST_ROW_START_COLUMN_STYLE,
+FIRST_ROW_END_COLUMN_STYLE,
+LAST_ROW_START_COLUMN_STYLE,
+LAST_ROW_END_COLUMN_STYLE,
+FIRST_ROW_EVEN_COLUMN_STYLE,
+LAST_ROW_EVEN_COLUMN_STYLE,
 STYLE_COUNT
 };
 
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index 7a3e80e..144082a 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -206,7 +206,7 @@ class CheckStyle(unittest.TestCase):
 def test_CellFamily(self):
 xDoc = CheckStyle._uno.openEmptyWriterDoc()
 xCellStyles = xDoc.StyleFamilies["CellStyles"]
-vEmptyDocStyles = ['Default Style.1', 'Default Style.2', 'Default 
Style.3', 'Default Style.4', 'Default Style.5', 'Default Style.6', 'Default 
Style.7', 'Default Style.8', 'Default Style.9', 'Default Style.10']
+vEmptyDocStyles = ['Default Style.1', 'Default Style.2', 'Default 
Style.3', 'Default Style.4', 'Default Style.5', 'Default Style.6', 'Default 
Style.7', 'Default Style.8', 'Default Style.9', 'Default Style.10', 'Default 
Style.11', 'Default Style.12', 'Default Style.13', 'Default Style.14', 'Default 
Style.15', 'Default Style.16']
 self.__test_StyleFamily(xCellStyles, vEmptyDocStyles, 
"SwXTextCellStyle")
 self.__test_StyleFamilyIndex(xCellStyles, vEmptyDocStyles, 
"SwXTextCellStyle")
 self.__test_StyleFamilyInsert(xDoc, xCellStyles, vEmptyDocStyles, 
"com.sun.star.style.CellStyle", "com.sun.star.style.CharacterStyle")
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index d5b623d..481f65f 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -1073,22 +1073,47 @@ OUString 
SwTableAutoFormat::GetTableTemplateCellSubName(const SwBoxAutoFormat& r
 return OUString();
 

[Libreoffice-commits] core.git: include/xmloff sw/inc sw/qa sw/source xmloff/source

2016-01-08 Thread Michael Stahl
 include/xmloff/txtimp.hxx   |3 +
 sw/inc/IDocumentMarkAccess.hxx  |2 
 sw/qa/extras/odfexport/odfexport.cxx|4 -
 sw/source/core/doc/docbm.cxx|6 --
 sw/source/core/inc/MarkManager.hxx  |2 
 sw/source/core/unocore/unobkm.cxx   |9 ---
 xmloff/source/core/xmlimp.cxx   |2 
 xmloff/source/text/XMLTextMarkImportContext.cxx |   46 +-
 xmloff/source/text/XMLTextMarkImportContext.hxx |7 ++
 xmloff/source/text/txtimp.cxx   |   60 
 xmloff/source/text/txtparai.cxx |   38 ---
 11 files changed, 150 insertions(+), 29 deletions(-)

New commits:
commit 774fb6d2e7cf36b677e66c54278225b1256bd40f
Author: Michael Stahl 
Date:   Fri Jan 8 16:02:43 2016 +0100

tdf#96480: ODF import: eliminate duplicate cross reference heading bookmarks

7c3c3006deaaaf1bb3f2f4eeeaf11da3bcebe53c is apparently worse than it
appeared at first glance since there are numerous assumptions about
bookmarks, such as that if they were inserted successfully they may be
copied successfully, which isn't the case for duplicate cross reference
bookmarks.

So fix this differently, by eliminating the duplicates and mapping all
reference fields to refer to the surviving bookmark.

It was not possible to do this in SwXBookmark by checking the makeMark()
return as that would raise interesting problems such as it's currently
guaranteed to have 1:1 SwXBoomarks to core Marks so we can't just
connect 2 SwXBookmarks to the same core Mark, and we also can't leave
the SwXBookmark unconnected after attach.

Another alternative would be to temporarily allow inserting the
duplicate bookmarks and then eliminate them after the import, but what
is implemented now is to check from xmloff for duplicates, which is
reasonably simple.

Change-Id: I7ee4854d1c9d8bf74201089cbb7287b1bd8ee3b9

diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 6d9239f..d91e3d0 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -713,6 +713,9 @@ public:
 
 void SetCellParaStyleDefault(OUString const& rNewValue);
 OUString const& GetCellParaStyleDefault();
+
+void AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo);
+void MapCrossRefHeadingFieldsHorribly();
 };
 
 #endif
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index d071f41..a0bdeb6 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -77,7 +77,7 @@ class IDocumentMarkAccess
 */
 virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
 const OUString& rProposedName,
-MarkType eMark, bool = false) = 0;
+MarkType eMark) = 0;
 
 virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
 const OUString& rName,
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index addf9c5..04d1d3c 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -421,9 +421,7 @@ 
DECLARE_ODFEXPORT_TEST(testDuplicateCrossRefHeadingBookmark, "CrossRefHeadingBoo
 uno::Reference xBookmark1(
 xBookmarks->getByName("__RefHeading__8284_1826734303"), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT(xBookmark1.is());
-uno::Reference xBookmark2(
-xBookmarks->getByName("__RefHeading__1673_25705824"), uno::UNO_QUERY);
-CPPUNIT_ASSERT(xBookmark2.is());
+CPPUNIT_ASSERT_THROW(xBookmarks->getByName("__RefHeading__1673_25705824"), 
container::NoSuchElementException);
 
 uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Reference(xTextFieldsSupplier->getTextFields(), 
uno::UNO_QUERY)->refresh();
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 6efca0e..90f466f 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -349,8 +349,7 @@ namespace sw { namespace mark
 
 ::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM,
 const OUString& rName,
-const IDocumentMarkAccess::MarkType eType,
-bool const isHorribleHackIgnoreDuplicates)
+const IDocumentMarkAccess::MarkType eType)
 {
 #if 0
 {
@@ -373,8 +372,7 @@ namespace sw { namespace mark
 " - more than USHRT_MAX marks are not supported correctly");
 // There should only be one CrossRefBookmark per Textnode per Type
 if ((eType == MarkType::CROSSREF_NUMITEM_BOOKMARK || eType == 
MarkType::CROSSREF_HEADING_BOOKMARK)
-&& (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.Start(), eType) != 
m_vBookmarks.end())
-&& !isHorribleHackIgnoreDuplicates)
+&& (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.Start(), eType) !=