[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Justin Luth justin_luth at sil.org
Tue Aug 30 12:22:46 UTC 2016


 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx                |    8 ++++++++
 sw/source/filter/ww8/ww8par2.cxx                         |    4 ++++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   13 +++++++++++++
 writerfilter/source/dmapper/PropertyIds.cxx              |    1 +
 writerfilter/source/dmapper/PropertyIds.hxx              |    1 +
 5 files changed, 27 insertions(+)

New commits:
commit c06d77c5eb57c1a7f5692028b6b04132593f9156
Author: Justin Luth <justin_luth at sil.org>
Date:   Wed Aug 24 15:17:43 2016 +0300

    tdf#101589 MS import: set 1-row table to don't split if row is set
    
    Since .doc and .docx don't have an option to "don't split table",
    we emulated that.  For this IMPORT case when there is only one row,
    consider the entire table to be unsplitable is the row is unsplitable.
    
    This will give the expected results if the user starts adding more rows
    to the table.
    
    Change-Id: I8a2d817ff714ba0df65b5a5e263b27df4264e848
    Reviewed-on: https://gerrit.libreoffice.org/28357
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 72c7e8e..4646876 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -936,6 +936,14 @@ DECLARE_OOXMLEXPORT_TEST(testDontSplitTable, "tdf101589_dontSplitTable.odt")
 {
     //single row tables need to prevent split by setting row to no split
     CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[2]/body/tab[1]/row[1]/cell[1]/txt[1]") );
+
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable (xTables->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split"));
+
+    uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTableRows->getByIndex(0), "IsSplitAllowed"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx")
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 87e4d8a..cc60100 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3186,6 +3186,10 @@ void WW8TabDesc::AdjustNewBand()
     bool bSetCantSplit = pActBand->bCantSplit;
     pTabLine->GetFrameFormat()->SetFormatAttr(SwFormatRowSplit(!bSetCantSplit));
 
+    //  if table is only a single row, and row is set as don't split, set the same value for the whole table.
+    if( bSetCantSplit && pTabLines->size() == 1 )
+        pTable->GetFrameFormat()->SetFormatAttr(SwFormatLayoutSplit( !bSetCantSplit ));
+
     short i;    // SW-Index
     short j;    // WW-Index
     short nW;   // Width
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 1769982..99087d5 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -576,6 +576,19 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
         //fill default value - if not available
         m_aTableProperties->Insert( PROP_HEADER_ROW_COUNT, uno::makeAny( (sal_Int32)0), false);
 
+        // if table is only a single row, and row is set as don't split, set the same value for the whole table.
+        if( m_aRowProperties.size() == 1 && m_aRowProperties[0].get() )
+        {
+            boost::optional<PropertyMap::Property> oSplitAllowed = m_aRowProperties[0]->getProperty(PROP_IS_SPLIT_ALLOWED);
+            if( oSplitAllowed )
+            {
+                bool bRowCanSplit = true;
+                oSplitAllowed->second >>= bRowCanSplit;
+                if( !bRowCanSplit )
+                    m_aTableProperties->Insert( PROP_SPLIT, uno::makeAny(bRowCanSplit) );
+            }
+        }
+
         rInfo.aTableProperties = m_aTableProperties->GetPropertyValues();
 
 #ifdef DEBUG_WRITERFILTER
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 426987f..eec6ba2 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -238,6 +238,7 @@ OUString getPropertyName( PropertyIds eId )
         case PROP_CREATE_FROM_OUTLINE    :    sName = "CreateFromOutline"; break;
         case PROP_CREATE_FROM_MARKS      :    sName = "CreateFromMarks"; break;
         case PROP_STANDARD               :    sName = "Standard"; break;
+        case PROP_SPLIT                  :    sName = "Split"; break;
         case PROP_IS_SPLIT_ALLOWED       :    sName = "IsSplitAllowed"; break;
         case META_PROP_VERTICAL_BORDER   :    sName = "VerticalBorder"; break;
         case META_PROP_HORIZONTAL_BORDER :    sName = "HorizontalBorder"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index cf3abe8..52a24f1 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -260,6 +260,7 @@ enum PropertyIds
         ,PROP_SIZE_PROTECTED
         ,PROP_SIZE_TYPE
         ,PROP_SOURCE_NAME
+        ,PROP_SPLIT
         ,PROP_STANDARD
         ,PROP_START_AT
         ,PROP_START_WITH


More information about the Libreoffice-commits mailing list