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

Miklos Vajna vmiklos at suse.cz
Tue Jul 9 09:48:12 PDT 2013


 sw/qa/extras/rtfimport/data/fdo66565.rtf       |   35 +++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   12 ++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    5 ++-
 3 files changed, 50 insertions(+), 2 deletions(-)

New commits:
commit 0e24e60733c8743de89abd779d77f1a8784894a6
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jul 9 11:29:33 2013 +0200

    fdo#66565 RTF import: don't produce cell widths smaller than MINLAY
    
    In case we have a table of a given width and the second (or later) row
    has fewer cells, we have to add a fake cell to such a row. However, it
    doesn't make sense to do this when the difference is only a few twips:
    we can't create such a small frame inside the cell later anyway.
    
    Regression from c3b0f13546b30e5db3aecd311c7178e4e0933208.
    
    (cherry picked from commit f6a00c88482ec30b61855cb6a95a5ad240b7a517)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Change-Id: Ibc0f02d4184b58bd423c3405e786e1ec25b9dd13
    Reviewed-on: https://gerrit.libreoffice.org/4785
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/sw/qa/extras/rtfimport/data/fdo66565.rtf b/sw/qa/extras/rtfimport/data/fdo66565.rtf
new file mode 100644
index 0000000..2169dc3
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo66565.rtf
@@ -0,0 +1,35 @@
+{\rtf1\ansi\ansicpg1251\deflang1033
+\sectd\lndscpsxn\pgwsxn16840\pghsxn11907\marglsxn1133\margrsxn850\margtsxn850\margbsxn850\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl
+{\trowd\trql\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrdb\brdrw10\clbrdrr\brdrs\brdrw10\cellx453\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx5039\clbrdrt\brdrdb\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx7420\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx8162\clbrdrt\brdrdb\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx13717\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx14227\clbrdrt\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrdb\brdrw10\cellx14850
+\intbl
+{\b\f0\fs16 A1 \cell}
+{\b\f0\fs16 B1 \cell}
+{\b\f0\fs16 C1 \cell}
+{\b\f0\fs16 D1 \cell}
+{\b\f0\fs16 E1 \cell}
+{\b\f0\fs16 F1 \cell}
+{\b\f0\fs16 G1 \cell}
+{\row}
+\trowd\trql\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrdb\brdrw10\clbrdrr\brdrs\brdrw10\cellx453\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx5039\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx5832\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx6625\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx7418\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx8160\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx9123\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx9633\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx10143\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx10653\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdr
 l\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx11163\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx11673\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx12183\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx12693\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx13203\clbrdrt\brdrs\brdrw10\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx13713\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx14223\clbrdrb\brdrdb\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrr\brdrdb\brdrw10\cellx14846
+\intbl
+{\b\f0\fs16 A2 \cell}
+{\b\f0\fs16 B2 \cell}
+{\b\f0\fs16 C2 \cell}
+{\b\f0\fs16 D2 \cell}
+{\b\f0\fs16 E2 \cell}
+{\b\f0\fs16 F2 \cell}
+{\b\f0\fs16 G2 \cell}
+{\b\f0\fs16 H2 \cell}
+{\b\f0\fs16 I2 \cell}
+{\b\f0\fs16 J2 \cell}
+{\b\f0\fs16 K2 \cell}
+{\b\f0\fs16 L2 \cell}
+{\b\f0\fs16 M2 \cell}
+{\b\f0\fs16 N2 \cell}
+{\b\f0\fs16 O2 \cell}
+{\b\f0\fs16 P2 \cell}
+{\b\f0\fs16 Q2 \cell}
+{\b\f0\fs16 R2 \cell}
+{\row}
+\pard}
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 80b52ef..fd05bdc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -143,6 +143,7 @@ public:
     void testParaBottomMargin();
     void testN823655();
     void testFdo39001();
+    void testFdo66565();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -274,6 +275,7 @@ void Test::run()
         {"para-bottom-margin.rtf", &Test::testParaBottomMargin},
         {"n823655.rtf", &Test::testN823655},
         {"fdo39001.rtf", &Test::testFdo39001},
+        {"fdo66565.rtf", &Test::testFdo66565},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1318,6 +1320,16 @@ void Test::testFdo39001()
     CPPUNIT_ASSERT_EQUAL(3, getPages());
 }
 
+void Test::testFdo66565()
+{
+    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);
+    // Cell width of A2 was 554, should be 453/14846*10000
+    uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1e0803a..4b64cc1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1809,8 +1809,9 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         case RTF_ROW:
         case RTF_NESTROW:
             {
-                // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic the WW8 import: add a fake cell.
-                if (nKeyword == RTF_ROW && m_aStates.top().nCellX < m_nCellxMax)
+                // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic WW8TabDesc::CalcDefaults(): add a fake cell.
+                const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size of frames.
+                if (nKeyword == RTF_ROW && (m_nCellxMax - m_aStates.top().nCellX) >= MINLAY)
                     dispatchValue(RTF_CELLX, m_nCellxMax);
 
                 if (m_aStates.top().nCells)


More information about the Libreoffice-commits mailing list