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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Feb 21 09:52:12 UTC 2019


 sw/qa/extras/rtfexport/data/tdf122424.rtf        |   22 ----------------------
 sw/qa/extras/rtfexport/rtfexport3.cxx            |   10 ----------
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx |   10 ----------
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |   21 +++------------------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx   |    4 ----
 5 files changed, 3 insertions(+), 64 deletions(-)

New commits:
commit 4d32ad37b86200fe207dd1eda2bed11109b08d00
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Feb 20 12:32:21 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Feb 21 10:51:45 2019 +0100

    tdf#123434 FILEOPEN: RTF: missing content in cells
    
    Revert "tdf#122424 RTF import: ignore table row text outside the cells"
    
    This reverts commit dc8fa612054363e1a871b0e413a59889fbdb156a.
    
    Change-Id: Id68dc7ae55df013de64fb2d4955a412e4c046781
    Reviewed-on: https://gerrit.libreoffice.org/68086
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/rtfexport/data/tdf122424.rtf b/sw/qa/extras/rtfexport/data/tdf122424.rtf
deleted file mode 100644
index 6baf526dd473..000000000000
--- a/sw/qa/extras/rtfexport/data/tdf122424.rtf
+++ /dev/null
@@ -1,22 +0,0 @@
-{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff0\deff0
-\colsx708
-\cellx885
-\cellx10260
-\pard cell1
-\cell
-\pard cell2
-\cell
-X\trowd
-\cellx885
-\cellx10260\row
-\trowd
-\cellx885
-\cellx5036
-\pard cell3
-\cell
-\pard cell4
-\cell
-\trowd
-\cellx885
-\cellx5036\row
-}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 6f7dec91570a..487a2530ea0c 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -220,16 +220,6 @@ DECLARE_RTFEXPORT_TEST(testTdf66543, "tdf66543.rtf")
                          getProperty<sal_Int32>(getParagraph(1), "ParaLineNumberStartValue"));
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf122424_textOutsideCellInATableRow, "tdf122424.rtf")
-{
-    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<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(OUString("cell3"), xCell->getString());
-}
-
 DECLARE_RTFEXPORT_TEST(testUlw, "ulw.rtf")
 {
     // Test underlying in individual words mode.
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 248b0a709bd0..e3b212a1dfdd 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -176,16 +176,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         case RTF_NESTCELL:
         {
             if (nKeyword == RTF_CELL)
-            {
                 m_bAfterCellBeforeRow = true;
-                if (m_nCellsInRow != -1)
-                    m_nCellsInRow++;
-            }
-            else
-            {
-                // in the case of nested tables, disable ignoring row text outside of cell content
-                m_nCellsInRow = -1;
-            }
 
             checkFirstRun();
             if (m_bNeedPap)
@@ -241,7 +232,6 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         case RTF_ROW:
         {
             m_bAfterCellBeforeRow = false;
-            m_nActualCellInRow = 0;
             if (m_aStates.top().nTableRowWidthAfter > 0)
             {
                 // Add fake cellx / cell, RTF equivalent of
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9e2d9fea060b..2d2d63ca5a4e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -301,8 +301,6 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
     , m_hasRFooter(false)
     , m_hasFFooter(false)
     , m_bAfterCellBeforeRow(false)
-    , m_nCellsInRow(0)
-    , m_nActualCellInRow(0)
 {
     OSL_ASSERT(xInputStream.is());
     m_pInStream = utl::UcbStreamHelper::CreateStream(xInputStream, true);
@@ -1481,12 +1479,6 @@ void RTFDocumentImpl::text(OUString& rString)
 
     RTFBuffer_t* pCurrentBuffer = m_aStates.top().pCurrentBuffer;
 
-    if (m_nActualCellInRow > 0)
-    {
-        m_nActualCellInRow = 0;
-        m_nCellsInRow = 0;
-    }
-
     if (!pCurrentBuffer && m_aStates.top().eDestination != Destination::FOOTNOTE)
         Mapper().startCharacterGroup();
     else if (pCurrentBuffer)
@@ -1628,7 +1620,6 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms,
         }
         else if (std::get<0>(aTuple) == BUFFER_CELLEND)
         {
-            m_nActualCellInRow++;
             assert(pSprms && pAttributes);
             auto pValue = new RTFValue(1);
             pSprms->set(NS_ooxml::LN_tblCell, pValue);
@@ -1647,15 +1638,9 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms,
         }
         else if (std::get<0>(aTuple) == BUFFER_UTEXT)
         {
-            // ignore text outside the cell content in table rows
-            // except in the case of nested tables
-            if (m_nActualCellInRow == 0 || m_nActualCellInRow < m_nCellsInRow
-                || m_nCellsInRow == -1)
-            {
-                OUString const aString(std::get<1>(aTuple)->getString());
-                Mapper().utext(reinterpret_cast<sal_uInt8 const*>(aString.getStr()),
-                               aString.getLength());
-            }
+            OUString const aString(std::get<1>(aTuple)->getString());
+            Mapper().utext(reinterpret_cast<sal_uInt8 const*>(aString.getStr()),
+                           aString.getLength());
         }
         else if (std::get<0>(aTuple) == BUFFER_ENDRUN)
             Mapper().endCharacterGroup();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 25928dfd073e..cb957ef975b8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -811,10 +811,6 @@ private:
 
     /// Are we after a \cell, but before a \row?
     bool m_bAfterCellBeforeRow;
-    /// cells in row, to ignore extra text content of the row
-    int m_nCellsInRow;
-    /// actual cell in row
-    int m_nActualCellInRow;
 };
 } // namespace rtftok
 } // namespace writerfilter


More information about the Libreoffice-commits mailing list