[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa writerfilter/inc writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Aug 17 05:31:16 PDT 2015


 sw/qa/extras/ooxmlimport/data/tdf86374.docx            |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx               |   10 ++++++++++
 writerfilter/inc/resourcemodel/TableManager.hxx        |    2 ++
 writerfilter/source/dmapper/TablePropertiesHandler.cxx |   10 ++++++++--
 4 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 41086e24ecf5a43646aae0c5d5a66b3e3f483195
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 22 09:24:06 2015 +0200

    tdf#86374 DOCX import: fix btLr text table direction without <w:cantSplit/>
    
    Commit 0208ead70a9412ccd554fcef3e9308f8ca17037b (DOCX import: improve
    btLr table cell support, 2013-02-22) made any table row that has at
    least one btLr cell fixed height. This causes problems in case a table
    has a minimal height with lots of content, where the fixed height gives
    wrong layout, but the minimal height is correct.
    
    Fix the problem by only making the row fixed height if <w:cantSplit/> is
    set (as seen in the old bugdoc), and revert to setting the height type
    to minimal in any other case.
    
    (cherry picked from commit 233a634a112e6dae07dca5fb1296764cb0001503)
    
    Conflicts:
    	writerfilter/source/dmapper/TableManager.hxx
    
    Change-Id: Ibaf91f542e64e5caa7904df97eb6eb52618e0023
    Reviewed-on: https://gerrit.libreoffice.org/17392
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf86374.docx b/sw/qa/extras/ooxmlimport/data/tdf86374.docx
new file mode 100644
index 0000000..7fd772d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf86374.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index ced25ac..c1ef511 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2623,6 +2623,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf89702, "tdf89702.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(xStyle, "CharFontName"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf86374, "tdf86374.docx")
+{
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
+    // btLr text direction was imported as FIX, it should be MIN to have enough space for the additionally entered paragraphs.
+    CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty<sal_Int16>(xTableRows->getByIndex(0), "SizeType"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx
index c13303c..9e06575 100644
--- a/writerfilter/inc/resourcemodel/TableManager.hxx
+++ b/writerfilter/inc/resourcemodel/TableManager.hxx
@@ -315,6 +315,7 @@ protected:
         mState.resetCellProps();
     }
 
+public:
     PropertiesPointer getRowProps()
     {
         return mState.getRowProps();
@@ -330,6 +331,7 @@ protected:
         mState.resetRowProps();
     }
 
+protected:
     void setInCell(bool bInCell)
     {
         mState.setInCell(bInCell);
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index c951612..453aec9 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -103,8 +103,14 @@ namespace dmapper {
                     const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size of frames.
                     if (!pManager || !pManager->HasBtlrCell() || pMeasureHandler->getMeasureValue() > ConversionHelper::convertTwipToMM100(MINLAY))
                     {
-                        // In case a cell already wanted fixed size, we should not overwrite it here.
-                        if (!pManager || !pManager->IsRowSizeTypeInserted())
+                        bool bCantSplit = false;
+                        if (pManager && pManager->getRowProps())
+                        {
+                            boost::optional<PropertyMap::Property> oIsSplitAllowed = pManager->getRowProps()->getProperty(PROP_IS_SPLIT_ALLOWED);
+                            bCantSplit = oIsSplitAllowed && !oIsSplitAllowed->second.get<bool>();
+                        }
+                        // In case a cell already wanted fixed size and the row has <w:cantSplit/>, we should not overwrite it here.
+                        if (!pManager || !pManager->IsRowSizeTypeInserted() || !bCantSplit)
                             pPropMap->Insert( PROP_SIZE_TYPE, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ), false);
                         else
                             pPropMap->Insert( PROP_SIZE_TYPE, uno::makeAny(text::SizeType::FIX), false);


More information about the Libreoffice-commits mailing list