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

Michael Stahl mstahl at redhat.com
Wed Jun 17 09:08:47 PDT 2015


 sw/source/core/bastyp/index.cxx |    9 ++++++++-
 sw/source/core/doc/docbm.cxx    |    1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 4a273473998a47ea7d125d3d4bd7e6d8b252767a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jun 17 17:53:26 2015 +0200

    sw: tweak CrossRefBookmark hack to re-sort if applied
    
    Change-Id: I8ea68819a87abecb2a6561fbd5b695902dd4af63

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 2cf2caf..930312c 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -636,6 +636,7 @@ namespace sw { namespace mark
                 {
                     // ensure that cross ref bookmark always starts at 0
                     aNewPosRel.nContent = 0; // HACK for WW8 import
+                    isSortingNeeded = true; // and sort them to be safe...
                 }
                 aNewPosRel.nContent += pMark->GetMarkPos().nContent.GetIndex();
                 pMark->SetMarkPos(aNewPosRel);
commit e679b83c386a5a4a73836327ae9d694721652db8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jun 17 17:48:07 2015 +0200

    sw: avoid CrossRefBookmark assertion when exporting ooo83574-1.doc
    
    Follow-up to commit 27384cdf7df20d6bc46e5d028f27be41b49b0f02:
    avoid SwIndexReg::Update() correcting the index of CrossRefBookmark away
    from 0.
    
    Not sure if it wouldn't be better to remove the requirement that
    CrossRefBookmark must have index 0.  Or perhaps remove the SwIndex from
    their position completely, like AT_PARA frame anchors.  But since the
    whole bookmark stuff stupidly uses inheritance the base class has
    established a requirement that a mark has a position.  But then again
    the CrossRefBookmark already cannot have a second position, in contrast
    to all other marks.
    
    Change-Id: If42cc48724de98151b02469850805f5c77e84c6b

diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index dc5041f..edc2218 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -22,6 +22,8 @@
 #include <assert.h>
 #include <sal/log.hxx>
 
+#include <crossrefbookmark.hxx>
+
 TYPEINIT0(SwIndexReg);
 
 SwIndex::SwIndex(SwIndexReg *const pReg, sal_Int32 const nIdx)
@@ -265,7 +267,12 @@ void SwIndexReg::Update(
         pStt = rIdx.m_pNext;
         while( pStt )
         {
-            pStt->m_nIndex = pStt->m_nIndex + nDiff;
+            // HACK: avoid updating position of cross-ref bookmarks
+            if (!pStt->m_pMark || nullptr == dynamic_cast<
+                    ::sw::mark::CrossRefBookmark const*>(pStt->m_pMark))
+            {
+                pStt->m_nIndex = pStt->m_nIndex + nDiff;
+            }
             pStt = pStt->m_pNext;
         }
     }


More information about the Libreoffice-commits mailing list