[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sw/inc sw/source

Oliver-Rainer Wittmann orw at apache.org
Tue Mar 4 06:07:53 PST 2014


 sw/inc/IDocumentMarkAccess.hxx           |    2 
 sw/inc/ndtxt.hxx                         |    2 
 sw/source/core/bastyp/index.cxx          |   12 +++--
 sw/source/core/crsr/bookmrk.cxx          |   62 +++++++++++++++++++---------
 sw/source/core/crsr/crossrefbookmark.cxx |    2 
 sw/source/core/doc/docbm.cxx             |   68 ++++++++++++++++++++++++-------
 sw/source/core/inc/MarkManager.hxx       |    2 
 sw/source/core/inc/bookmrk.hxx           |   11 +++--
 sw/source/core/inc/crossrefbookmark.hxx  |    6 +-
 sw/source/core/txtnode/ndtxt.cxx         |    6 ++
 sw/source/core/undo/undobj.cxx           |   31 +++++++++-----
 11 files changed, 145 insertions(+), 59 deletions(-)

New commits:
commit aa46680dd96539848bf8bef0293e2a614172515d
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Tue Mar 4 14:02:37 2014 +0000

    123480: correct the previous made refactoring (revision 1572577)

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index fd6e376..a9a0251 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -54,7 +54,8 @@ public:
         SwComparePosition eCmpPos,
         const SwPosition& rSttPos,
         const SwPosition& rEndPos,
-        SwRedline& rRedl );
+        SwRedline& rRedl,
+        sal_Bool bCopyNext );
 
     ~SwRedlineSaveData();
 
@@ -1000,9 +1001,10 @@ SwRedlineSaveData::SwRedlineSaveData(
     SwComparePosition eCmpPos,
     const SwPosition& rSttPos,
     const SwPosition& rEndPos,
-    SwRedline& rRedl )
+    SwRedline& rRedl,
+    sal_Bool bCopyNext )
     : SwUndRng( rRedl )
-    , SwRedlineData( rRedl.GetRedlineData(), sal_True )
+    , SwRedlineData( rRedl.GetRedlineData(), bCopyNext )
 {
     ASSERT( POS_OUTSIDE == eCmpPos || !rRedl.GetContentIdx(), "Redline mit Content" );
 
@@ -1012,6 +1014,7 @@ SwRedlineSaveData::SwRedlineSaveData(
         nEndNode = rEndPos.nNode.GetIndex();
         nEndCntnt = rEndPos.nContent.GetIndex();
         break;
+
     case POS_OVERLAP_BEHIND:        // Pos1 ueberlappt Pos2 am Ende
         nSttNode = rSttPos.nNode.GetIndex();
         nSttCntnt = rSttPos.nContent.GetIndex();
@@ -1083,6 +1086,7 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam )
     rDoc.SetRedlineMode_intern( eOld );
 }
 
+
 sal_Bool SwUndo::FillSaveData(
     const SwPaM& rRange,
     SwRedlineSaveDatas& rSData,
@@ -1103,6 +1107,7 @@ sal_Bool SwUndo::FillSaveData(
     for ( ; n < rTbl.Count(); ++n )
     {
         SwRedline* pRedl = rTbl[n];
+
         const SwComparePosition eCmpPos =
             ComparePosition( *pStt, *pEnd, *pRedl->Start(), *pRedl->End() );
         if ( eCmpPos != POS_BEFORE
@@ -1110,22 +1115,26 @@ sal_Bool SwUndo::FillSaveData(
              && eCmpPos != POS_COLLIDE_END
              && eCmpPos != POS_COLLIDE_START )
         {
-            pNewData = new SwRedlineSaveData( eCmpPos, *pStt, *pEnd, *pRedl );
+            pNewData = new SwRedlineSaveData( eCmpPos, *pStt, *pEnd, *pRedl, bCopyNext );
             rSData.Insert( pNewData, rSData.Count() );
         }
     }
-
     if ( rSData.Count() && bDelRange )
+    {
         rRange.GetDoc()->DeleteRedline( rRange, false, USHRT_MAX );
+    }
     return 0 != rSData.Count();
 }
 
+
 sal_Bool SwUndo::FillSaveDataForFmt(
     const SwPaM& rRange,
     SwRedlineSaveDatas& rSData )
 {
     if ( rSData.Count() )
+    {
         rSData.DeleteAndDestroy( 0, rSData.Count() );
+    }
 
     SwRedlineSaveData* pNewData;
     const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
@@ -1137,12 +1146,13 @@ sal_Bool SwUndo::FillSaveDataForFmt(
         SwRedline* pRedl = rTbl[n];
         if ( nsRedlineType_t::REDLINE_FORMAT == pRedl->GetType() )
         {
-            const SwPosition *pRStt = pRedl->Start(), *pREnd = pRedl->End();
-
-            SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
-            if ( POS_BEFORE != eCmpPos && POS_BEHIND != eCmpPos && POS_COLLIDE_END != eCmpPos && POS_COLLIDE_START != eCmpPos )
+            const SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRedl->Start(), *pRedl->End() );
+            if ( eCmpPos != POS_BEFORE
+                 && eCmpPos != POS_BEHIND
+                 && eCmpPos != POS_COLLIDE_END
+                 && eCmpPos != POS_COLLIDE_START )
             {
-                pNewData = new SwRedlineSaveData( eCmpPos, *pStt, *pEnd, *pRedl );
+                pNewData = new SwRedlineSaveData( eCmpPos, *pStt, *pEnd, *pRedl, sal_True );
                 rSData.Insert( pNewData, rSData.Count() );
             }
 
@@ -1151,6 +1161,7 @@ sal_Bool SwUndo::FillSaveDataForFmt(
     return 0 != rSData.Count();
 }
 
+
 void SwUndo::SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData )
 {
     RedlineMode_t eOld = rDoc.GetRedlineMode();
commit 770c0e6b910129710b4be5cb9e9bae39bfa6bd5a
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Tue Mar 4 12:35:01 2014 +0000

    124338: assure sorted mark containers when updating <SwIndex> instances due to inserted characters

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 7cde48a..0057999 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -193,6 +193,8 @@ class IDocumentMarkAccess
         */
         virtual void clearAllMarks() =0;
 
+        virtual void assureSortedMarkContainers() const = 0;
+
         /** returns a STL-like random access iterator to the begin of the sequence of marks.
         */
         virtual const_iterator_t getAllMarksBegin() const =0;
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 4a60daa..7cfcc56 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -794,9 +794,7 @@ public:
     bool IsNotifiable() const;
 
     void SetListRestart( bool bRestart );
-    // --> OD 2005-11-02 #i51089 - TUNING#
     bool IsListRestart() const;
-    // <--
 
     void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum );
     bool HasAttrListRestartValue() const;
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 63cc8be..7e658b9 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -357,15 +357,17 @@ SwIndexReg::~SwIndexReg()
 }
 
 
-
-void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
-    const bool bNeg, const bool /* argument is only used in derived class*/ )
+void SwIndexReg::Update(
+    SwIndex const & rIdx,
+    const xub_StrLen nDiff,
+    const bool bNeg,
+    const bool /* argument is only used in derived class*/ )
 {
     SwIndex* pStt = const_cast<SwIndex*>(&rIdx);
-    xub_StrLen nNewVal = rIdx.nIndex;
+    const xub_StrLen nNewVal = rIdx.nIndex;
     if( bNeg )
     {
-        xub_StrLen nLast = rIdx.GetIndex() + nDiff;
+        const xub_StrLen nLast = rIdx.GetIndex() + nDiff;
         while( pStt && pStt->nIndex == nNewVal )
         {
             pStt->nIndex = nNewVal;
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 55a483c..42669ca 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -74,25 +74,29 @@ namespace
         const sal_Unicode aStartMark,
         const sal_Unicode aEndMark)
     {
-        SwPosition& rStart = pField->GetMarkStart();
-        SwPosition& rEnd = pField->GetMarkEnd();
-        SwTxtNode const*const pStartTxtNode =
-            rStart.nNode.GetNode().GetTxtNode();
-        SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
-        const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
-        const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1);
-        SwPaM aStartPaM(rStart);
-        SwPaM aEndPaM(rEnd);
         io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
+
+        SwPosition rStart = pField->GetMarkStart();
+        SwTxtNode const*const pStartTxtNode = rStart.nNode.GetNode().GetTxtNode();
+        const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
         if(ch_start != aStartMark)
         {
+            SwPaM aStartPaM(rStart);
             io_pDoc->InsertString(aStartPaM, aStartMark);
             rStart.nContent--;
+            pField->SetMarkStartPos( rStart );
         }
+
+        const SwPosition& rEnd = pField->GetMarkEnd();
+        SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
+        const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1);
         if ( aEndMark && ( ch_end != aEndMark ) && ( rStart != rEnd ) )
         {
+            SwPaM aEndPaM(rEnd);
             io_pDoc->InsertString(aEndPaM, aEndMark);
         }
+
+
         io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
     };
 
@@ -101,29 +105,31 @@ namespace
         const sal_Unicode aStartMark,
         const sal_Unicode aEndMark)
     {
-        SwPosition& rStart = pField->GetMarkStart();
-        SwPosition& rEnd = pField->GetMarkEnd();
+        io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
+
+        const SwPosition& rStart = pField->GetMarkStart();
         SwTxtNode const*const pStartTxtNode = rStart.nNode.GetNode().GetTxtNode();
-        SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
         const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
-        xub_StrLen nEndPos = ( rEnd == rStart ||  rEnd.nContent.GetIndex() == 0 ) ?
-            rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
-        const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos );
-        SwPaM aStartPaM(rStart);
-        SwPaM aEndPaM(rEnd);
-        io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
         if( ch_start == aStartMark )
         {
             SwPaM aStart(rStart, rStart);
             aStart.End()->nContent++;
             io_pDoc->DeleteRange(aStart);
         }
+
+        const SwPosition& rEnd = pField->GetMarkEnd();
+        SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
+        const xub_StrLen nEndPos = ( rEnd == rStart ||  rEnd.nContent.GetIndex() == 0 )
+                                   ? rEnd.nContent.GetIndex()
+                                   : rEnd.nContent.GetIndex() - 1;
+        const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos );
         if ( ch_end == aEndMark )
         {
             SwPaM aEnd(rEnd, rEnd);
             aEnd.Start()->nContent--;
             io_pDoc->DeleteRange(aEnd);
         }
+
         io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
     };
 }
@@ -315,6 +321,22 @@ namespace sw { namespace mark
             SetOtherMarkPos(GetMarkPos());
     }
 
+    void Fieldmark::SetMarkStartPos( const SwPosition& rNewStartPos )
+    {
+        if ( GetMarkPos( ) <= GetOtherMarkPos( ) )
+            return SetMarkPos( rNewStartPos );
+        else
+            return SetOtherMarkPos( rNewStartPos );
+    }
+
+    void Fieldmark::SetMarkEndPos( const SwPosition& rNewEndPos )
+    {
+        if ( GetMarkPos( ) <= GetOtherMarkPos( ) )
+            return SetOtherMarkPos( rNewEndPos );
+        else
+            return SetMarkPos( rNewEndPos );
+    }
+
     rtl::OUString Fieldmark::ToString( ) const
     {
         rtl::OUStringBuffer buf;
@@ -363,7 +385,9 @@ namespace sw { namespace mark
 
         // For some reason the end mark is moved from 1 by the Insert: we don't
         // want this for checkboxes
-        this->GetMarkEnd( ).nContent--;
+        SwPosition aNewEndPos = this->GetMarkEnd();
+        aNewEndPos.nContent--;
+        SetMarkEndPos( aNewEndPos );
     }
     void CheckboxFieldmark::SetChecked(bool checked)
     {
diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx
index f0be082..0951f9b 100644
--- a/sw/source/core/crsr/crossrefbookmark.cxx
+++ b/sw/source/core/crsr/crossrefbookmark.cxx
@@ -58,7 +58,7 @@ namespace sw { namespace mark
         MarkBase::SetMarkPos(rNewPos);
     }
 
-    SwPosition& CrossRefBookmark::GetOtherMarkPos() const
+    const SwPosition& CrossRefBookmark::GetOtherMarkPos() const
     {
         OSL_PRECOND(false,
             "<SwCrossRefBookmark::GetOtherMarkPos(..)>"
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 8201088..792e2c5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -820,28 +820,41 @@ namespace sw { namespace mark
             case IDocumentMarkAccess::BOOKMARK:
             case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
             case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
-                // if(dynamic_cast<IBookmark*>)
                 {
                     IDocumentMarkAccess::iterator_t ppBookmark = lcl_FindMark(m_vBookmarks, *ppMark);
-                    OSL_ENSURE(ppBookmark != m_vBookmarks.end(),
-                        "<MarkManager::deleteMark(..)>"
-                        " - Bookmark not found.");
-                    m_vBookmarks.erase(ppBookmark);
+                    if ( ppBookmark != m_vBookmarks.end() )
+                    {
+                        m_vBookmarks.erase(ppBookmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Bookmark not found in Bookmark container.");
+                    }
 
                     ppBookmark = lcl_FindMark(m_vCommonMarks, *ppMark);
-                    m_vCommonMarks.erase(ppBookmark);
+                    if ( ppBookmark != m_vCommonMarks.end() )
+                    {
+                        m_vCommonMarks.erase(ppBookmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Bookmark not found in common mark container.");
+                    }
                 }
                 break;
 
             case IDocumentMarkAccess::TEXT_FIELDMARK:
             case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
-                // if(dynamic_cast<IFieldmark*>
                 {
                     IDocumentMarkAccess::iterator_t ppFieldmark = lcl_FindMark(m_vFieldmarks, *ppMark);
-                    OSL_ENSURE(ppFieldmark != m_vFieldmarks.end(),
-                        "<MarkManager::deleteMark(..)>"
-                        " - Bookmark not found.");
-                    m_vFieldmarks.erase(ppFieldmark);
+                    if ( ppFieldmark != m_vFieldmarks.end() )
+                    {
+                        m_vFieldmarks.erase(ppFieldmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Fieldmark not found in Fieldmark container.");
+                    }
 
                     sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
                     if ( pTextFieldmark )
@@ -850,15 +863,28 @@ namespace sw { namespace mark
                     }
 
                     ppFieldmark = lcl_FindMark(m_vCommonMarks, *ppMark);
-                    m_vCommonMarks.erase(ppFieldmark);
+                    if ( ppFieldmark != m_vCommonMarks.end() )
+                    {
+                        m_vCommonMarks.erase(ppFieldmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Fieldmark not found in common mark container.");
+                    }
                 }
                 break;
 
             case IDocumentMarkAccess::ANNOTATIONMARK:
                 {
                     IDocumentMarkAccess::iterator_t ppAnnotationMark = lcl_FindMark(m_vAnnotationMarks, *ppMark);
-                    OSL_ENSURE( ppAnnotationMark != m_vAnnotationMarks.end(), "<MarkManager::deleteMark(..)> - Annotation Mark not found." );
-                    m_vAnnotationMarks.erase(ppAnnotationMark);
+                    if ( ppAnnotationMark != m_vAnnotationMarks.end() )
+                    {
+                        m_vAnnotationMarks.erase(ppAnnotationMark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Annotation Mark not found in Annotation Mark container.");
+                    }
                 }
                 break;
 
@@ -867,7 +893,14 @@ namespace sw { namespace mark
             case IDocumentMarkAccess::UNO_BOOKMARK:
                 {
                     IDocumentMarkAccess::iterator_t ppOtherMark = lcl_FindMark(m_vCommonMarks, *ppMark);
-                    m_vCommonMarks.erase(ppOtherMark);
+                    if ( ppOtherMark != m_vCommonMarks.end() )
+                    {
+                        m_vCommonMarks.erase(ppOtherMark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Navigator Reminder, DDE Mark or Uno Makr not found in common mark container.");
+                    }
                 }
                 break;
         }
@@ -1032,6 +1065,11 @@ namespace sw { namespace mark
         return sTmp;
     }
 
+    void MarkManager::assureSortedMarkContainers() const
+    {
+        const_cast< MarkManager* >(this)->sortMarks();
+    }
+
     void MarkManager::sortSubsetMarks()
     {
         sort(m_vCommonMarks.begin(), m_vCommonMarks.end(), &lcl_MarkOrderingByStart);
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 9004df1..086ab32 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -95,6 +95,8 @@ namespace sw { namespace mark
             virtual sal_Int32 getAnnotationMarksCount() const;
             virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const;
 
+            virtual void assureSortedMarkContainers() const;
+
         private:
             // make names
             ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const;
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 7c52909..86c3c60 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -49,17 +49,17 @@ namespace sw { namespace mark
     {
         public:
             //getters
-            virtual SwPosition& GetMarkPos() const
+            virtual const SwPosition& GetMarkPos() const
                 { return *m_pPos1; }
             virtual const ::rtl::OUString& GetName() const
                 { return m_aName; }
             virtual bool IsCoveringPosition(const SwPosition& rPos) const;
-            virtual SwPosition& GetOtherMarkPos() const
+            virtual const SwPosition& GetOtherMarkPos() const
             {
                 OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." );
                 return *m_pPos2;
             }
-            virtual SwPosition& GetMarkStart() const
+            virtual const SwPosition& GetMarkStart() const
             {
                 if( !IsExpanded() ) return GetMarkPos( );
                 if ( GetMarkPos( ) < GetOtherMarkPos( ) )
@@ -67,7 +67,7 @@ namespace sw { namespace mark
                 else
                     return GetOtherMarkPos( );
             }
-            virtual SwPosition& GetMarkEnd() const
+            virtual const SwPosition& GetMarkEnd() const
             {
                 if( !IsExpanded() ) return GetMarkPos();
                 if ( GetMarkPos( ) > GetOtherMarkPos( ) )
@@ -228,6 +228,9 @@ namespace sw { namespace mark
             virtual void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext)
                 { m_aFieldHelptext = aFieldHelptext; }
 
+            void SetMarkStartPos( const SwPosition& rNewStartPos );
+            void SetMarkEndPos( const SwPosition& rNewEndPos );
+
             virtual void Invalidate();
             virtual rtl::OUString ToString() const;
         private:
diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx
index d2b9966..b1c80cc 100644
--- a/sw/source/core/inc/crossrefbookmark.hxx
+++ b/sw/source/core/inc/crossrefbookmark.hxx
@@ -41,10 +41,10 @@ namespace sw { namespace mark
                 const ::rtl::OUString& rPrefix);
 
             // getters
-            virtual SwPosition& GetOtherMarkPos() const;
-            virtual SwPosition& GetMarkStart() const
+            virtual const SwPosition& GetOtherMarkPos() const;
+            virtual const SwPosition& GetMarkStart() const
                 { return *m_pPos1; }
-            virtual SwPosition& GetMarkEnd() const
+            virtual const SwPosition& GetMarkEnd() const
                 { return *m_pPos1; }
             virtual bool IsExpanded() const
                 { return false; }
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 518117d..13f3213 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1028,6 +1028,7 @@ void SwTxtNode::Update(
         }
     }
 
+    bool bSortMarks = false;
     SwIndexReg aTmpIdxReg;
     if ( !bNegative && !bDelete )
     {
@@ -1086,6 +1087,7 @@ void SwTxtNode::Update(
                     rPos.GetIndex() == rIdx.GetIndex() )
                 {
                     rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
+                    bSortMarks = true;
                 }
             }
         }
@@ -1104,6 +1106,10 @@ void SwTxtNode::Update(
     }
 
     aTmpIdxReg.MoveTo( *this );
+    if ( bSortMarks )
+    {
+        getIDocumentMarkAccess()->assureSortedMarkContainers();
+    }
 }
 
 void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl,


More information about the Libreoffice-commits mailing list