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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 31 08:35:45 PDT 2012


 sw/qa/extras/ooxmlimport/data/n785767.docx               |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                 |   14 ++++++++++++++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   14 ++++++++++++--
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |    2 ++
 4 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 819b0cb95b38c4c49d34011da68c747e2152059b
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Oct 31 16:32:07 2012 +0100

    NS_ooxml::LN_CT_TrPrBase_gridBefore/After testcase
    
    Change-Id: Id488ffa6a6b01937fe32e4c80af45c40ebf673ec

diff --git a/sw/qa/extras/ooxmlimport/data/n785767.docx b/sw/qa/extras/ooxmlimport/data/n785767.docx
new file mode 100755
index 0000000..db35676
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n785767.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d0cbc71..d19760f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
 #include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
 #include <com/sun/star/text/WrapTextMode.hpp>
@@ -105,6 +106,7 @@ public:
     void testN782345();
     void testN783638();
     void testFdo52208();
+    void testN785767();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -163,6 +165,7 @@ void Test::run()
         {"n782345.docx", &Test::testN782345},
         {"n783638.docx", &Test::testN783638},
         {"fdo52208.docx", &Test::testFdo52208},
+        {"n785767.docx", &Test::testN785767},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1003,6 +1006,17 @@ void Test::testFdo52208()
     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
 }
 
+void Test::testN785767()
+{
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
+    // Check the A1 and B1 cells, the width of both of them was the default value (10000 / 9, as there were 9 cells in the row).
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(36), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(978), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 2caa5ab919fc86fc41fddf0a33f9239ad37b00b3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Oct 31 14:41:14 2012 +0100

    n#785767 import NS_ooxml::LN_CT_TrPrBase_gridBefore
    
    Change-Id: Id7f1471b49af52e6f6b0515ccd1fe8e12c50d9b5

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index bab4bd5..d3752c7 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -44,6 +44,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool bImplicitMe
     m_nRow(0),
     m_nCell(),
     m_nGridSpan(1),
+    m_nGridBefore(0),
     m_nGridAfter(0),
     m_nCellBorderIndex(0),
     m_nHeaderRepeat(0),
@@ -310,6 +311,9 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                     }
                 }
                 break;
+            case NS_ooxml::LN_CT_TrPrBase_gridBefore:
+                m_nGridBefore = nIntValue;
+                break;
             case NS_ooxml::LN_CT_TrPrBase_gridAfter:
                 m_nGridAfter = nIntValue;
                 break;
@@ -456,12 +460,12 @@ void DomainMapperTableManager::endOfRowAction()
     double nFullWidth = m_nTableWidth;
     //the positions have to be distibuted in a range of 10000
     const double nFullWidthRelative = 10000.;
-    if( pTableGrid->size() == ( nGrids + m_nGridAfter ) && m_nCell.back( ) > 0 )
+    if( pTableGrid->size() == ( m_nGridBefore + nGrids + m_nGridAfter ) && m_nCell.back( ) > 0 )
     {
         uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 );
         text::TableColumnSeparator* pSeparators = aSeparators.getArray();
         sal_Int16 nLastRelPos = 0;
-        sal_uInt32 nBorderGridIndex = 0;
+        sal_uInt32 nBorderGridIndex = m_nGridBefore;
 
         ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
         for( sal_uInt32 nBorder = 0; nBorder < m_nCell.back( ) - 1; ++nBorder )
@@ -525,7 +529,7 @@ void DomainMapperTableManager::endOfRowAction()
     m_nCellBorderIndex = 0;
     pCurrentSpans->clear();
 
-    m_nGridAfter = 0;
+    m_nGridBefore = m_nGridAfter = 0;
 
 #ifdef DEBUG_DOMAINMAPPER
     dmapper_logger->endElement();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index 84ca620..7f3215c 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -37,6 +37,7 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
     sal_uInt32      m_nRow;
     ::std::vector< sal_uInt32 > m_nCell;
     sal_uInt32      m_nGridSpan;
+    sal_uInt32      m_nGridBefore; ///< number of grid columns in the parent table's table grid which must be skipped before the contents of this table row are added to the parent table
     sal_uInt32      m_nGridAfter; ///< number of grid columns in the parent table's table grid which shall be left after the last cell in the table row
     sal_uInt32      m_nCellBorderIndex; //borders are provided for all cells and need counting
     sal_Int32       m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
commit 7799ceab2639f1e3bcd35c6cf7e7b064bb1b6e9a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Oct 31 11:35:40 2012 +0100

    n#785767 import NS_ooxml::LN_CT_TrPrBase_gridAfter
    
    Change-Id: I4cb64ae2b2f2dbf643e38c5208eb759f265acafd

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 0416b1d..bab4bd5 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -44,6 +44,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool bImplicitMe
     m_nRow(0),
     m_nCell(),
     m_nGridSpan(1),
+    m_nGridAfter(0),
     m_nCellBorderIndex(0),
     m_nHeaderRepeat(0),
     m_nTableWidth(0),
@@ -309,6 +310,9 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                     }
                 }
                 break;
+            case NS_ooxml::LN_CT_TrPrBase_gridAfter:
+                m_nGridAfter = nIntValue;
+                break;
             default:
                 bRet = false;
 
@@ -452,7 +456,7 @@ void DomainMapperTableManager::endOfRowAction()
     double nFullWidth = m_nTableWidth;
     //the positions have to be distibuted in a range of 10000
     const double nFullWidthRelative = 10000.;
-    if( pTableGrid->size() == nGrids && m_nCell.back( ) > 0 )
+    if( pTableGrid->size() == ( nGrids + m_nGridAfter ) && m_nCell.back( ) > 0 )
     {
         uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 );
         text::TableColumnSeparator* pSeparators = aSeparators.getArray();
@@ -521,6 +525,8 @@ void DomainMapperTableManager::endOfRowAction()
     m_nCellBorderIndex = 0;
     pCurrentSpans->clear();
 
+    m_nGridAfter = 0;
+
 #ifdef DEBUG_DOMAINMAPPER
     dmapper_logger->endElement();
 #endif
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index daba8ce..84ca620 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -37,6 +37,7 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
     sal_uInt32      m_nRow;
     ::std::vector< sal_uInt32 > m_nCell;
     sal_uInt32      m_nGridSpan;
+    sal_uInt32      m_nGridAfter; ///< number of grid columns in the parent table's table grid which shall be left after the last cell in the table row
     sal_uInt32      m_nCellBorderIndex; //borders are provided for all cells and need counting
     sal_Int32       m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
     sal_Int32       m_nTableWidth; //might be set directly or has to be calculated from the column positions


More information about the Libreoffice-commits mailing list