[Libreoffice-commits] .: 4 commits - sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 20 05:19:54 PST 2012


 sw/inc/undobj.hxx                 |   12 +++---
 sw/source/core/inc/UndoInsert.hxx |    3 +
 sw/source/core/undo/undobj.cxx    |   69 ++++----------------------------------
 sw/source/core/undo/unins.cxx     |   36 +++++++------------
 sw/source/core/undo/untblk.cxx    |   39 +++++++--------------
 5 files changed, 46 insertions(+), 113 deletions(-)

New commits:
commit 357bb0d5afc44f74eafca4c9c28619226f5610f8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 20 13:52:42 2012 +0100

    SwUndoSaveCntnt: remove index parameter from Move{From,To}UndoNds
    
    There are now no callers that need it, and it is alwyas 0 anyway.
    
    Change-Id: Iddee488084e644ac82e9dbf9f251d5ef4bd7c59d

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 5148327..7f4a05f 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -147,14 +147,14 @@ protected:
     SwHistory* pHistory;
 
     // Needed for deletion of content. For Redo content is moved into the
-    // UndoNodesArray. These methods insert a separator for the attributes
-    // at the end of a TextNode. So the attributes do not get expanded.
+    // UndoNodesArray. These methods always create a new node to insert
+    // content. So the attributes do not get expanded.
     // MoveTo:      moves from the NodesArray into the UndoNodesArray.
     // MoveFrom:    moves from the UndoNodesArray into the NodesArray.
     void MoveToUndoNds( SwPaM& rPam,
-                        SwNodeIndex* pNodeIdx = 0, SwIndex* pCntIdx = 0,
+                        SwNodeIndex* pNodeIdx = 0,
                         sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
-    void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, xub_StrLen nCntntIdx,
+    void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
                           SwPosition& rInsPos,
                           sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
 
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index ab3035c..d6fb9fd 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -313,15 +313,15 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt()
 }
 
 // This is needed when deleting content. For REDO all contents will be moved
-// into the UndoNodesArray. These methods add a seperator for the attributes to
-// the end of TextNodes. As a result, the attributes will not be expanded.
+// into the UndoNodesArray. These methods always create a new node to insert
+// content. As a result, the attributes will not be expanded.
 // - MoveTo   moves from NodesArray into UndoNodesArray
 // - MoveFrom moves from UndoNodesArray into NodesArray
 //
 // If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly. In that case the whole
 // section should be moved.
 void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
-                    SwIndex* pCntIdx, sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
+                    sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
 {
     SwDoc& rDoc = *rPaM.GetDoc();
     ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
@@ -337,7 +337,6 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
 
     // keep as sal_uInt16; the indices shift!
     sal_uLong nTmpMvNode = aPos.nNode.GetIndex();
-    xub_StrLen nTmpMvCntnt = aPos.nContent.GetIndex();
 
     if( pCpyNd || pEndNdIdx )
     {
@@ -359,19 +358,10 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
     aPos.nNode = nTmpMvNode;
     if( pNodeIdx )
         *pNodeIdx = aPos.nNode;
-
-    if( pCntIdx )
-    {
-        SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
-        if( pCNd )
-            pCntIdx->Assign( pCNd, nTmpMvCntnt );
-        else
-            pCntIdx->Assign( 0, 0 );
-    }
 }
 
 void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
-                            xub_StrLen nCntIdx, SwPosition& rInsPos,
+                            SwPosition& rInsPos,
                             sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
 {
     // here comes the recovery
@@ -398,7 +388,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
 
         aPaM.SetMark();
         aPaM.GetPoint()->nNode = nNodeIdx;
-        aPaM.GetPoint()->nContent.Assign( aPaM.GetCntntNode(), nCntIdx );
+        aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 0);
 
         _SaveRedlEndPosForRestore aRedlRest( rInsPos.nNode, rInsPos.nContent.GetIndex() );
 
@@ -427,7 +417,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
 
     }
     else {
-        OSL_FAIL( "What happened now?" );
+        assert(false); // wtf?
     }
 }
 
@@ -848,7 +838,7 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
     // Keep positions as SwIndex so that this section can be deleted in DTOR
     sal_uLong nEnd;
     pMvStt = new SwNodeIndex( rRange.aStart );
-    MoveToUndoNds( aPam, pMvStt, 0, &nEnd, 0 );
+    MoveToUndoNds(aPam, pMvStt, &nEnd, 0);
     nMvLen = nEnd - pMvStt->GetIndex() + 1;
 }
 
@@ -877,7 +867,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
     {
         SwPosition aInsPos( rInsPos );
         sal_uLong nEnd = pMvStt->GetIndex() + nMvLen - 1;
-        MoveFromUndoNds( *pDoc, pMvStt->GetIndex(), 0, aInsPos, &nEnd, 0 );
+        MoveFromUndoNds(*pDoc, pMvStt->GetIndex(), aInsPos, &nEnd, 0);
 
         // destroy indices again, content was deleted from UndoNodes array
         DELETEZ( pMvStt );
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 4b8ce61..0dbb1be 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -258,7 +258,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
             {
                 m_pUndoNodeIndex.reset(
                         new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
-                MoveToUndoNds(aPaM, m_pUndoNodeIndex.get(), 0);
+                MoveToUndoNds(aPaM, m_pUndoNodeIndex.get());
             }
             nNode = aPaM.GetPoint()->nNode.GetIndex();
             nCntnt = aPaM.GetPoint()->nContent.GetIndex();
@@ -328,7 +328,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
                 // re-insert content again (first detach m_pUndoNodeIndex!)
                 sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
                 m_pUndoNodeIndex.reset();
-                MoveFromUndoNds(*pTmpDoc, nMvNd, 0, *pPam->GetMark());
+                MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark());
             }
             nNode = pPam->GetMark()->nNode.GetIndex();
             nCntnt = pPam->GetMark()->nContent.GetIndex();
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 407edba..b2857c9 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -180,7 +180,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
         {
             m_pUndoNodeIndex.reset(
                     new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
-            MoveToUndoNds( *pPam, m_pUndoNodeIndex.get(), 0 );
+            MoveToUndoNds(*pPam, m_pUndoNodeIndex.get());
 
             if( !bSttWasTxtNd )
                 pPam->Move( fnMoveBackward, fnGoCntnt );
@@ -266,7 +266,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
         // re-insert content again (first detach m_pUndoNodeIndex!)
         sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
         m_pUndoNodeIndex.reset();
-        MoveFromUndoNds( *pDoc, nMvNd, 0, *pPam->GetMark() );
+        MoveFromUndoNds(*pDoc, nMvNd, *pPam->GetMark());
         if( bSttWasTxtNd )
             MovePtForward( *pPam, bMvBkwrd );
         pPam->Exchange();
commit cdceee72ae4f1642d50b6df9e0afc2fd365bc7d6
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 20 13:32:21 2012 +0100

    SwUndoInsert: replace SwPosition with SwNodeIndex here too
    
    See previous SwUndoInserts commit.
    
    Change-Id: I8d255e85a72bb93be280f87bab096d69f1e9f573

diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx
index d665025..d24359b 100644
--- a/sw/source/core/inc/UndoInsert.hxx
+++ b/sw/source/core/inc/UndoInsert.hxx
@@ -32,7 +32,8 @@ class SwUndoFmtAttr;
 
 class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt
 {
-    SwPosition *pPos;                   // Inhalt fuers Redo
+    /// start of Content in UndoNodes for Redo
+    ::boost::scoped_ptr<SwNodeIndex> m_pUndoNodeIndex;
     String *pTxt, *pUndoTxt;
     SwRedlineData* pRedlData;
     sal_uLong nNode;
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index d1cef84..4b8ce61 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -102,7 +102,7 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, xub_StrLen nCnt,
             xub_StrLen nL,
             const IDocumentContentOperations::InsertFlags nInsertFlags,
             sal_Bool bWDelim )
-    : SwUndo(UNDO_TYPING), pPos( 0 ), pTxt( 0 ), pRedlData( 0 ),
+    : SwUndo(UNDO_TYPING), pTxt( 0 ), pRedlData( 0 ),
         nNode( rNd.GetIndex() ), nCntnt(nCnt), nLen(nL),
         bIsWordDelim( bWDelim ), bIsAppend( sal_False )
     , m_nInsertFlags(nInsertFlags)
@@ -112,7 +112,7 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, xub_StrLen nCnt,
 
 // #111827#
 SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd )
-    : SwUndo(UNDO_SPLITNODE), pPos( 0 ), pTxt( 0 ),
+    : SwUndo(UNDO_SPLITNODE), pTxt( 0 ),
         pRedlData( 0 ), nNode( rNd.GetIndex() ), nCntnt(0), nLen(1),
         bIsWordDelim( sal_False ), bIsAppend( sal_True )
     , m_nInsertFlags(IDocumentContentOperations::INS_EMPTYEXPAND)
@@ -184,21 +184,13 @@ sal_Bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
 
 SwUndoInsert::~SwUndoInsert()
 {
-    if( pPos )      // delete the section from UndoNodes array
+    if (m_pUndoNodeIndex) // delete the section from UndoNodes array
     {
         // Insert saves the content in IconSection
-        SwNodes& rUNds = pPos->nNode.GetNode().GetNodes();
-        if( pPos->nContent.GetIndex() )         // do not delete the whole node
-        {
-            SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
-            OSL_ENSURE( pTxtNd, "no TextNode to delete from" );
-            pTxtNd->EraseText( pPos->nContent );
-            pPos->nNode++;
-        }
-        pPos->nContent.Assign( 0, 0 );
-        rUNds.Delete( pPos->nNode, rUNds.GetEndOfExtras().GetIndex() -
-                                    pPos->nNode.GetIndex() );
-        delete pPos;
+        SwNodes& rUNds = m_pUndoNodeIndex->GetNodes();
+        rUNds.Delete(*m_pUndoNodeIndex,
+            rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex());
+        m_pUndoNodeIndex.reset();
     }
     else if( pTxt )     // the inserted text
         delete pTxt;
@@ -264,8 +256,9 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
 
             if( !pTxt )
             {
-                pPos = new SwPosition( *aPaM.GetPoint() );
-                MoveToUndoNds( aPaM, &pPos->nNode, &pPos->nContent );
+                m_pUndoNodeIndex.reset(
+                        new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
+                MoveToUndoNds(aPaM, m_pUndoNodeIndex.get(), 0);
             }
             nNode = aPaM.GetPoint()->nNode.GetIndex();
             nCntnt = aPaM.GetPoint()->nContent.GetIndex();
@@ -332,11 +325,10 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
             }
             else
             {
-                // re-insert content (log out pPos before!)
-                sal_uLong nMvNd = pPos->nNode.GetIndex();
-                xub_StrLen nMvCnt = pPos->nContent.GetIndex();
-                DELETEZ( pPos );
-                MoveFromUndoNds( *pTmpDoc, nMvNd, nMvCnt, *pPam->GetMark() );
+                // re-insert content again (first detach m_pUndoNodeIndex!)
+                sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
+                m_pUndoNodeIndex.reset();
+                MoveFromUndoNds(*pTmpDoc, nMvNd, 0, *pPam->GetMark());
             }
             nNode = pPam->GetMark()->nNode.GetIndex();
             nCntnt = pPam->GetMark()->nContent.GetIndex();
commit 72e3dd4d8ab6fe4368972a761c70185d1742855d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 19 23:53:11 2012 +0100

    SwUndoInserts should not use a SwPosition:
    
    There is a problem here; to see it paste something 3 times, then undo
    twice and close the document, there is a SwIndexReg assertion because
    the SwPosition in the one SwUndoInserts points to a node in the Undo
    nodes array that is removed by the dtor of the other SwUndoInserts.
    
    This is because the Undo objects are destroyed from the outermost Redo
    backwards, which is usually a good idea but does not work for
    SwUndoInserts, which (as they currently are) must be destroyed in the
    other order.
    
    But with the previous change to only store whole paragraphs in
    SwUndoSaveCntnt it is possible to replace the SwPosition here with
    a SwNodeIndex, which points directly to the SwTxtNode and thus does
    not care if the position of that node changes due to whatever order
    other SwUndoInserts are removed.
    
    Change-Id: I4f0cf308d26f6b2e5aaa8997951c03ae7b2f0951

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 4fbd74a..5148327 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -21,6 +21,7 @@
 
 #include <vector>
 
+#include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 
 #include <svl/undo.hxx>
@@ -230,7 +231,8 @@ class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveCntnt
     sal_Bool bSttWasTxtNd;
 protected:
     sal_uLong nNdDiff;
-    SwPosition *pPos;                   // Content for Redo.
+    /// start of Content in UndoNodes for Redo
+    ::boost::scoped_ptr<SwNodeIndex> m_pUndoNodeIndex;
     sal_uInt16 nSetPos;                 // Start in the history list.
 
     SwUndoInserts( SwUndoId nUndoId, const SwPaM& );
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 4845717..407edba 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -34,7 +34,7 @@
 SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
     : SwUndo( nUndoId ), SwUndRng( rPam ),
     pTxtFmtColl( 0 ), pLastNdColl(0), pFrmFmts( 0 ), pRedlData( 0 ),
-    bSttWasTxtNd( sal_True ), nNdDiff( 0 ), pPos( 0 ), nSetPos( 0 )
+    bSttWasTxtNd( sal_True ), nNdDiff( 0 ), nSetPos( 0 )
 {
     pHistory = new SwHistory;
     SwDoc* pDoc = (SwDoc*)rPam.GetDoc();
@@ -131,24 +131,13 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, sal_Bool bScanFlys,
 
 SwUndoInserts::~SwUndoInserts()
 {
-    if( pPos ) // delete also the section from UndoNodes array
+    if (m_pUndoNodeIndex) // delete also the section from UndoNodes array
     {
         // Insert saves content in IconSection
-        SwNodes& rUNds = pPos->nNode.GetNodes();
-        if( pPos->nContent.GetIndex() ) // do not delete complete Node
-        {
-            SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
-            OSL_ENSURE( pTxtNd, "no TextNode to delete from" );
-            if( pTxtNd ) // robust
-            {
-                pTxtNd->EraseText( pPos->nContent );
-            }
-            pPos->nNode++;
-        }
-        pPos->nContent.Assign( 0, 0 );
-        rUNds.Delete( pPos->nNode, rUNds.GetEndOfExtras().GetIndex() -
-                                    pPos->nNode.GetIndex() );
-        delete pPos;
+        SwNodes& rUNds = m_pUndoNodeIndex->GetNodes();
+        rUNds.Delete(*m_pUndoNodeIndex,
+            rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex());
+        m_pUndoNodeIndex.reset();
     }
     delete pFrmFmts;
     delete pRedlData;
@@ -189,8 +178,9 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
 
         if( *pPam->GetPoint() != *pPam->GetMark() )
         {
-            pPos = new SwPosition( *pPam->GetPoint() );
-            MoveToUndoNds( *pPam, &pPos->nNode, &pPos->nContent );
+            m_pUndoNodeIndex.reset(
+                    new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
+            MoveToUndoNds( *pPam, m_pUndoNodeIndex.get(), 0 );
 
             if( !bSttWasTxtNd )
                 pPam->Move( fnMoveBackward, fnGoCntnt );
@@ -269,15 +259,14 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
     pHistory->SetTmpEnd( nSetPos );
 
     // retrieve start position for rollback
-    if( ( nSttNode != nEndNode || nSttCntnt != nEndCntnt ) && pPos )
+    if( ( nSttNode != nEndNode || nSttCntnt != nEndCntnt ) && m_pUndoNodeIndex)
     {
         sal_Bool bMvBkwrd = MovePtBackward( *pPam );
 
-        // re-insert content again (first detach pPos!)
-        sal_uLong nMvNd = pPos->nNode.GetIndex();
-        xub_StrLen nMvCnt = pPos->nContent.GetIndex();
-        DELETEZ( pPos );
-        MoveFromUndoNds( *pDoc, nMvNd, nMvCnt, *pPam->GetMark() );
+        // re-insert content again (first detach m_pUndoNodeIndex!)
+        sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
+        m_pUndoNodeIndex.reset();
+        MoveFromUndoNds( *pDoc, nMvNd, 0, *pPam->GetMark() );
         if( bSttWasTxtNd )
             MovePtForward( *pPam, bMvBkwrd );
         pPam->Exchange();
commit 91a90acc033cfadb0cc7bf271fa9ea92c4c52e88
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 20 13:20:47 2012 +0100

    SwUndoSaveCntnt: simplify Move{From,To}UndoNds
    
    If we always create a new text node in MoveToUndoNds, there is no need
    for this silly and fragile adding of a "space" at the end, and clients
    can rely on having a unique start node for their content.
    
    Change-Id: I60937f33bac8ae2f9732eebfe6e8083b6bb2f210

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 73e1d83..ab3035c 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -332,22 +332,9 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
     SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes();
     SwPosition aPos( pEndNdIdx ? rNds.GetEndOfPostIts()
                                : rNds.GetEndOfExtras() );
-    aPos.nNode--;
 
     const SwPosition* pStt = rPaM.Start(), *pEnd = rPaM.End();
 
-    if( pCpyNd || pEndNdIdx || !aPos.nNode.GetNode().GetCntntNode() ||
-        (!pStt->nContent.GetIndex() && (pStt->nNode != pEnd->nNode ||
-                (!pStt->nNode.GetNode().GetCntntNode() ||
-                    pStt->nNode.GetNode().GetCntntNode()->Len() ==
-                        pEnd->nContent.GetIndex() ) ) ) )
-    {
-        aPos.nNode++;
-        aPos.nContent = 0;
-    }
-    else
-        aPos.nNode.GetNode().GetCntntNode()->MakeEndIndex( &aPos.nContent );
-
     // keep as sal_uInt16; the indices shift!
     sal_uLong nTmpMvNode = aPos.nNode.GetIndex();
     xub_StrLen nTmpMvCntnt = aPos.nContent.GetIndex();
@@ -362,29 +349,6 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
     else
     {
         rDoc.GetNodes().MoveRange( rPaM, aPos, rNds );
-
-        SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
-        if( pTxtNd )        // add a seperator for the attributes
-        {
-            // But since all attributes will be touched at an insert (meaning
-            // deleted from the array and re-added again), attributes might
-            // disappear (e.g. "no bold" for 10-20,  "bold" for 12-15 -> when
-            // inserting/deleting, the "bold" will be deleted, which is not
-            // wanted here!)! Thus do not touch the hints but manipulate the
-            // string directly.
-            String& rStr = (String&)pTxtNd->GetTxt();
-            // For safety reasons better only if positioned at the end
-            if( rStr.Len() == aPos.nContent.GetIndex() )
-            {
-                rStr.Insert( ' ' );
-                ++aPos.nContent;
-            }
-            else
-            {
-                pTxtNd->InsertText( rtl::OUString(' '), aPos.nContent,
-                        IDocumentContentOperations::INS_NOHINTEXPAND );
-            }
-        }
     }
     if( pEndNdIdx )
         *pEndNdIdx = aPos.nNode.GetIndex();
@@ -427,15 +391,10 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
     }
 
     SwTxtNode* pTxtNd = aPaM.GetNode()->GetTxtNode();
-    if( !pEndNdIdx && pTxtNd )  // delete the seperator again
+    if (!pEndNdIdx && pTxtNd)
     {
         if( pEndCntIdx )
             aPaM.GetPoint()->nContent.Assign( pTxtNd, *pEndCntIdx );
-        if( pTxtNd->GetTxt().Len() )
-        {
-            GoInCntnt( aPaM, fnMoveBackward );
-            pTxtNd->EraseText( aPaM.GetPoint()->nContent, 1 );
-        }
 
         aPaM.SetMark();
         aPaM.GetPoint()->nNode = nNodeIdx;


More information about the Libreoffice-commits mailing list