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

Michael Stahl mstahl at redhat.com
Tue May 12 04:18:36 PDT 2015


 sw/source/core/unocore/unotext.cxx |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit 2ed1c696c3a45705d1d5e5f38f8ee7aff48f0436
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 12 13:05:54 2015 +0200

    sw: remove unused pFirstPaM variable in SwXText::convertToTable()
    
    Change-Id: Ic7ddd39334c318ff2b966fe1ff04fb62aa3eed4b

diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index e07403b..488f8e9 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -112,7 +112,6 @@ public:
     void ConvertCell(
             const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
             ::std::vector<SwNodeRange> & rRowNodes,
-            ::std::unique_ptr< SwPaM > & rpFirstPaM,
             SwNodeRange *const pLastCell,
             bool & rbExcept);
 
@@ -1817,7 +1816,6 @@ static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 )
 void SwXText::Impl::ConvertCell(
     const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
     ::std::vector<SwNodeRange> & rRowNodes,
-    ::std::unique_ptr< SwPaM > & rpFirstPaM,
     SwNodeRange *const pLastCell,
     bool & rbExcept)
 {
@@ -1978,11 +1976,6 @@ void SwXText::Impl::ConvertCell(
     SwNodeRange aCellRange(aStartCellPam.Start()->nNode,
             aEndCellPam.End()->nNode);
     rRowNodes.push_back(aCellRange); // note: invalidates pLastCell!
-    if (!pLastCell)
-    {
-        assert(!rpFirstPaM);
-        rpFirstPaM.reset(new SwPaM(*aStartCellPam.Start()));
-    }
 }
 
 typedef uno::Sequence< text::TableColumnSeparator > TableColumnSeparators;
@@ -2232,7 +2225,6 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     //at first collect the text ranges as SwPaMs
     const uno::Sequence< uno::Sequence< uno::Reference< text::XTextRange > > >*
         pTableRanges = rTableRanges.getConstArray();
-    std::unique_ptr < SwPaM > pFirstPaM;
     std::vector< std::vector<SwNodeRange> > aTableNodes;
     bool bExcept = false;
     for (sal_Int32 nRow = 0; !bExcept && (nRow < rTableRanges.getLength());
@@ -2250,7 +2242,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
                     ? ((nRow == 0) ? nullptr : &*aTableNodes.rbegin()->rbegin())
                     : &*aRowNodes.rbegin());
             m_pImpl->ConvertCell(pRow[nCell],
-                aRowNodes, pFirstPaM, pLastCell, bExcept);
+                aRowNodes, pLastCell, bExcept);
         }
         aTableNodes.push_back(aRowNodes);
     }
commit c74631a0ffd32d3e0794fdd861582ca5b1d55b45
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 12 13:00:16 2015 +0200

    sw: remove redundant parameter of SwXText::Impl::ConvertCell()
    
    Change-Id: I8f435c4a8bb8e2ad118abd001df56162a3996521

diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 8b3facc..e07403b 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -110,7 +110,6 @@ public:
         throw (lang::IllegalArgumentException, uno::RuntimeException);
 
     void ConvertCell(
-            const bool bFirstCell,
             const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
             ::std::vector<SwNodeRange> & rRowNodes,
             ::std::unique_ptr< SwPaM > & rpFirstPaM,
@@ -1816,7 +1815,6 @@ static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 )
 }
 
 void SwXText::Impl::ConvertCell(
-    const bool bFirstCell,
     const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
     ::std::vector<SwNodeRange> & rRowNodes,
     ::std::unique_ptr< SwPaM > & rpFirstPaM,
@@ -1905,7 +1903,7 @@ void SwXText::Impl::ConvertCell(
         have to be aligned on paragraph borders by inserting paragraph
         breaks. Non-consecutive ranges must initiate an exception.
      */
-    if (bFirstCell)
+    if (!pLastCell) // first cell?
     {
         // align the beginning - if necessary
         if (aStartCellPam.Start()->nContent.GetIndex())
@@ -1980,8 +1978,9 @@ void SwXText::Impl::ConvertCell(
     SwNodeRange aCellRange(aStartCellPam.Start()->nNode,
             aEndCellPam.End()->nNode);
     rRowNodes.push_back(aCellRange); // note: invalidates pLastCell!
-    if (bFirstCell)
+    if (!pLastCell)
     {
+        assert(!rpFirstPaM);
         rpFirstPaM.reset(new SwPaM(*aStartCellPam.Start()));
     }
 }
@@ -2250,7 +2249,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
                 (nCell == 0)
                     ? ((nRow == 0) ? nullptr : &*aTableNodes.rbegin()->rbegin())
                     : &*aRowNodes.rbegin());
-            m_pImpl->ConvertCell((nCell == 0) && (nRow == 0), pRow[nCell],
+            m_pImpl->ConvertCell(pRow[nCell],
                 aRowNodes, pFirstPaM, pLastCell, bExcept);
         }
         aTableNodes.push_back(aRowNodes);
commit 36a7ac0de3c97168f401e84f4ce45d1e7a1776c3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 12 12:32:21 2015 +0200

    sw: assert other postcondition of SwXText::Impl::ConvertCell()
    
    Change-Id: I4fe55ac856839c04d469fa5e9b3c0fb4191e4b19

diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 0f71af2..8b3facc 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1975,6 +1975,7 @@ void SwXText::Impl::ConvertCell(
             aEndCellPam.GetNode().GetTxtNode()->Len();
     }
 
+    assert(aStartCellPam.Start()->nContent.GetIndex() == 0);
     assert(aEndCellPam.End()->nContent.GetIndex() == aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len());
     SwNodeRange aCellRange(aStartCellPam.Start()->nNode,
             aEndCellPam.End()->nNode);


More information about the Libreoffice-commits mailing list