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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Sat Jul 12 17:04:58 PDT 2014


 sw/source/core/doc/docbm.cxx |  292 ++++++++++++++++++++++++++-----------------
 1 file changed, 183 insertions(+), 109 deletions(-)

New commits:
commit 6708edc8952108f4bfb3bbac3e3e50afa64e1539
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Jul 13 01:13:16 2014 +0200

    typo
    
    Change-Id: Ia400c34f91f190453aa9cf87480d4559d8818a58

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 1e896b7..68a3574 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -2055,7 +2055,7 @@ void CntntIdxStoreImpl::RestoreUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32
         sal_uInt16 nCnt = 0;
         BOOST_FOREACH(const SwUnoCrsr* pUnoCrsr, pDoc->GetUnoCrsrTbl())
         {
-            SAL_INFO("sw.core", "::Looking for Index " << aEntry.m_nIdx << " now at PaM Index" << nCnt << ": " << pUnoCrsr);
+            SAL_INFO("sw.core", "Looking for Index " << aEntry.m_nIdx << " now at PaM Index" << nCnt << ": " << pUnoCrsr);
             SwPosition* pPos = NULL;
             FOREACHPAM_START( const_cast<SwUnoCrsr*>(pUnoCrsr) )
                 if( aEntry.m_nIdx == nCnt )
commit 8018d8d7e3b120c973a27bb4cd74df81ad5f8463
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Jul 13 01:07:40 2014 +0200

    now use the refactored UnoCrsr implementation ...
    
    ... now that we verified it to work as the old version used to do.
    
    Change-Id: I7980f263b35a6504337d2836ae2d4b9f29b19942

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 226da0e..1e896b7 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1134,8 +1134,6 @@ namespace
     //          0x2001 = frame anchored at character, which should be moved
     //          0x0800 = Crsr from the CrsrShell Mark
     //          0x0801 = Crsr from the CrsrShell Point
-    //          0x0400 = UnoCrsr Mark
-    //          0x0401 = UnoCrsr Point
 
     class _SwSaveTypeCountContent
     {
@@ -1246,7 +1244,7 @@ namespace
             rSave.DecType();
         }
     }
-#if OSL_DEBUG_LEVEL > 0
+#if 0
     static void DumpSaves(std::vector<sal_uLong> &rSaveArr)
     {
         sal_uInt16 n = 0;
@@ -1591,29 +1589,6 @@ void _SaveCntntIdx(SwDoc* pDoc,
             FOREACHSHELL_END( pShell )
         }
     }
-    // 6. UnoCrsr
-    {
-        aSave.SetTypeAndCount( 0x400, 0 );
-        const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
-        for (SwUnoCrsrTbl::const_iterator it = rTbl.begin();
-                it != rTbl.end(); ++it)
-        {
-            FOREACHPAM_START( *it )
-                lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, false );
-                aSave.IncCount();
-            FOREACHPAM_END()
-
-            SwUnoTableCrsr* pUnoTblCrsr =
-                dynamic_cast<SwUnoTableCrsr*>(*it);
-            if( pUnoTblCrsr )
-            {
-                FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
-                    lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, false );
-                    aSave.IncCount();
-                FOREACHPAM_END()
-            }
-        }
-    }
 }
 
 void _RestoreCntntIdx(SwDoc* pDoc,
@@ -1703,49 +1678,6 @@ void _RestoreCntntIdx(SwDoc* pDoc,
                     }
             }
             break;
-
-        case 0x0400:
-        case 0x0401:
-            {
-                sal_uInt16 nCnt = 0;
-                const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
-                for (SwUnoCrsrTbl::const_iterator it = rTbl.begin();
-                        it != rTbl.end(); ++it)
-                {
-                    FOREACHPAM_START( *it )
-                        if( aSave.GetCount() == nCnt )
-                        {
-                            SAL_INFO("sw.core", "Found PaM " << PCURCRSR << " for Index " << aSave.GetCount());
-                            pPos = &PCURCRSR->GetBound( 0x0400 ==
-                                                    aSave.GetType() );
-                            break;
-                        }
-                        else
-                            SAL_INFO("sw.core", "Skipped PaM " << PCURCRSR << " for Index " << aSave.GetCount());
-                        ++nCnt;
-                    FOREACHPAM_END()
-                    if( pPos )
-                        break;
-
-                    SwUnoTableCrsr* pUnoTblCrsr =
-                        dynamic_cast<SwUnoTableCrsr*>(*it);
-                    if ( pUnoTblCrsr )
-                    {
-                        FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
-                            if( aSave.GetCount() == nCnt )
-                            {
-                                pPos = &PCURCRSR->GetBound( 0x0400 ==
-                                                    aSave.GetType() );
-                                break;
-                            }
-                            ++nCnt;
-                        FOREACHPAM_END()
-                    }
-                    if ( pPos )
-                        break;
-                }
-            }
-            break;
         }
 
         if( pPos )
@@ -1845,46 +1777,6 @@ void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
                     }
                 }
                 break;
-
-            case 0x0400:
-            case 0x0401:
-                {
-                    sal_uInt16 nCnt = 0;
-                    const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
-                    for (SwUnoCrsrTbl::const_iterator it = rTbl.begin();
-                            it != rTbl.end(); ++it)
-                    {
-                        FOREACHPAM_START( *it )
-                            if( aSave.GetCount() == nCnt )
-                            {
-                                pPos = &PCURCRSR->GetBound( 0x0400 ==
-                                                    aSave.GetType() );
-                                break;
-                            }
-                            ++nCnt;
-                        FOREACHPAM_END()
-                        if( pPos )
-                            break;
-
-                        SwUnoTableCrsr* pUnoTblCrsr =
-                            dynamic_cast<SwUnoTableCrsr*>(*it);
-                        if ( pUnoTblCrsr )
-                        {
-                            FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
-                                if( aSave.GetCount() == nCnt )
-                                {
-                                    pPos = &PCURCRSR->GetBound( 0x0400 ==
-                                                    aSave.GetType() );
-                                    break;
-                                }
-                                ++nCnt;
-                            FOREACHPAM_END()
-                        }
-                        if ( pPos )
-                            break;
-                    }
-                }
-                break;
             }
 
             if( pPos )
@@ -1995,7 +1887,7 @@ namespace
             rMarkEntries.push_back(aEntry);
         }
     }
-#if OSL_DEBUG_LEVEL > 0
+#if 0
     static void DumpEntries(std::vector<MarkEntry>* pEntries)
     {
         BOOST_FOREACH(MarkEntry& aEntry, *pEntries)
@@ -2194,19 +2086,8 @@ void CntntIdxStoreImpl::RestoreUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32
             if( pPos )
             {
                 SAL_INFO("sw.info", "Would be setting " << pPos << " on Node " << nNode << " for Index " << aEntry.m_nIdx);
-                //pPos->nNode = *pCNd;
-                //pPos->nContent.Assign( pCNd, aEntry.m_nCntnt + nOffset );
-                assert(&pPos->nNode.GetNode() == pCNd);
-#if OSL_DEBUG_LEVEL > 0
-                if(pPos->nNode.GetIndex() != pCNd->GetIndex())
-                {
-                    DumpSaves(m_aSaveArr);
-                    DumpEntries(&m_aUnoCrsrEntries);
-                    SAL_INFO("sw.core", aEntry.m_nIdx << ": Node expected to set to " << pCNd->GetIndex() << " but actually should be " << pPos->nNode.GetIndex() );
-                }
-#endif
-                SAL_INFO_IF(pPos->nContent != aEntry.m_nCntnt + nOffset ,"sw.core", "On Node" << pCNd->GetIndex() << "Content expected to set to " << aEntry.m_nCntnt << "(" << nOffset << ")" << " but actually should be " << pPos->nContent.GetIndex() );
-                assert(pPos->nContent == aEntry.m_nCntnt + nOffset);
+                pPos->nNode = *pCNd;
+                pPos->nContent.Assign( pCNd, aEntry.m_nCntnt + nOffset );
                 break;
             }
         }
@@ -2247,10 +2128,8 @@ void CntntIdxStoreImpl::RestoreUnoCrsrsLen (SwNode& rNd, sal_uLong nLen, sal_Int
                 }
                 if( pPos )
                 {
-                    //pPos->nNode = rNd;
-                    //pPos->nContent.Assign( pCNd, std::min( aEntry.m_nCntnt, static_cast<sal_Int32>(nLen) ) );
-                    assert(&pPos->nNode.GetNode() == pCNd);
-                    assert(pPos->nContent == std::min( aEntry.m_nCntnt, static_cast<sal_Int32>(nLen) ) );
+                    pPos->nNode = rNd;
+                    pPos->nContent.Assign( pCNd, std::min( aEntry.m_nCntnt, static_cast<sal_Int32>(nLen) ) );
                     break;
                 }
             }
commit 242aabcfb54a504aa5f45367172fa1c589782816
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Jul 13 00:54:14 2014 +0200

    refactor UnoCrsr moves
    
    Change-Id: I6ea54941dfba3b755fa9f7ac6a769ccfab8a782e

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index dd2b393..226da0e 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1914,36 +1914,41 @@ namespace
     };
     struct CntntIdxStoreImpl : sw::mark::CntntIdxStore
     {
-        std::vector<sal_uLong> m_aSaveArr;
         std::vector<MarkEntry> m_aBkmkEntries;
         std::vector<MarkEntry> m_aRedlineEntries;
+        std::vector<MarkEntry> m_aUnoCrsrEntries;
+        std::vector<sal_uLong> m_aSaveArr;
         virtual void Clear() SAL_OVERRIDE
         {
             m_aBkmkEntries.clear();
             m_aRedlineEntries.clear();
+            m_aUnoCrsrEntries.clear();
             m_aSaveArr.clear();
         }
         virtual bool Empty() SAL_OVERRIDE
         {
-            return m_aBkmkEntries.empty() && m_aRedlineEntries.empty() && m_aSaveArr.empty();
+            return m_aBkmkEntries.empty() && m_aRedlineEntries.empty() && m_aUnoCrsrEntries.empty() && m_aSaveArr.empty();
         }
         virtual void Save(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, sal_uInt8 nSaveFly=0) SAL_OVERRIDE
         {
             SaveBkmks(pDoc, nNode, nCntnt);
             SaveRedlines(pDoc, nNode, nCntnt);
+            SaveUnoCrsrs(pDoc, nNode, nCntnt);
             return _SaveCntntIdx(pDoc, nNode, nCntnt, m_aSaveArr, nSaveFly);
         }
         virtual void Restore(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false) SAL_OVERRIDE
         {
             RestoreBkmks(pDoc, nNode, nOffset);
             RestoreRedlines(pDoc, nNode, nOffset);
-            return _RestoreCntntIdx(pDoc, m_aSaveArr, nNode, nOffset, bAuto);
+            _RestoreCntntIdx(pDoc, m_aSaveArr, nNode, nOffset, bAuto);
+            RestoreUnoCrsrs(pDoc, nNode, nOffset);
         }
         virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen) SAL_OVERRIDE
         {
             RestoreBkmksLen(rNd, nLen, nCorrLen);
             RestoreRedlinesLen(rNd, nLen, nCorrLen);
-            return _RestoreCntntIdx(m_aSaveArr, rNd, nLen, nCorrLen);
+            _RestoreCntntIdx(m_aSaveArr, rNd, nLen, nCorrLen);
+            RestoreUnoCrsrsLen(rNd, nLen, nCorrLen);
         }
         virtual ~CntntIdxStoreImpl(){};
         private:
@@ -1953,11 +1958,50 @@ namespace
             inline void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
             inline void RestoreRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset);
             inline void RestoreRedlinesLen(SwNode& rNd, sal_uLong nLen, sal_Int32 nCorrLen);
+            inline void SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
+            inline void RestoreUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset);
+            inline void RestoreUnoCrsrsLen(SwNode& rNd, sal_uLong nLen, sal_Int32 nCorrLen);
             inline const SwPosition& GetRightMarkPos(::sw::mark::IMark* pMark, bool bOther)
                 { return bOther ? pMark->GetOtherMarkPos() : pMark->GetMarkPos(); };
             inline void SetRightMarkPos(MarkBase* pMark, bool bOther, const SwPosition* const pPos)
                 { bOther ? pMark->SetOtherMarkPos(*pPos) : pMark->SetMarkPos(*pPos); };
     };
+    static void lcl_ChkPaM( std::vector<MarkEntry>& rMarkEntries, sal_uLong nNode, sal_Int32 nCntnt,
+                    const SwPaM& rPam, const long int nIdx,
+                    bool bChkSelDirection )
+    {
+        // Respect direction of selection
+        bool bBound1IsStart = !bChkSelDirection ||
+                            ( *rPam.GetPoint() < *rPam.GetMark()
+                                ? rPam.GetPoint() == &rPam.GetBound()
+                                : rPam.GetMark() == &rPam.GetBound());
+
+        const SwPosition* pPos = &rPam.GetBound( true );
+        if( pPos->nNode.GetIndex() == nNode &&
+            ( bBound1IsStart ? pPos->nContent.GetIndex() < nCntnt
+                                : pPos->nContent.GetIndex() <= nCntnt ))
+        {
+            const MarkEntry aEntry = { nIdx, false, pPos->nContent.GetIndex() };
+            rMarkEntries.push_back(aEntry);
+        }
+
+        pPos = &rPam.GetBound( false );
+        if( pPos->nNode.GetIndex() == nNode &&
+            ( (bBound1IsStart && bChkSelDirection)
+                        ? pPos->nContent.GetIndex() <= nCntnt
+                        : pPos->nContent.GetIndex() < nCntnt ))
+        {
+            const MarkEntry aEntry = { nIdx, true, pPos->nContent.GetIndex() };
+            rMarkEntries.push_back(aEntry);
+        }
+    }
+#if OSL_DEBUG_LEVEL > 0
+    static void DumpEntries(std::vector<MarkEntry>* pEntries)
+    {
+        BOOST_FOREACH(MarkEntry& aEntry, *pEntries)
+            aEntry.Dump();
+    }
+#endif
 }
 
 void CntntIdxStoreImpl::SaveBkmks(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
@@ -2093,6 +2137,126 @@ void CntntIdxStoreImpl::RestoreRedlinesLen (SwNode& rNd, sal_uLong nLen, sal_Int
         }
     }
 }
+void CntntIdxStoreImpl::SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
+{
+    long int nIdx = 0;
+    BOOST_FOREACH(const SwUnoCrsr* pUnoCrsr, pDoc->GetUnoCrsrTbl())
+    {
+        FOREACHPAM_START( const_cast<SwUnoCrsr*>(pUnoCrsr) )
+            lcl_ChkPaM( m_aUnoCrsrEntries, nNode, nCntnt, *PCURCRSR, nIdx++, false );
+        FOREACHPAM_END()
+        const SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<const SwUnoTableCrsr*>(pUnoCrsr);
+        if( pUnoTblCrsr )
+        {
+            FOREACHPAM_START( &(const_cast<SwUnoTableCrsr*>(pUnoTblCrsr))->GetSelRing() )
+                lcl_ChkPaM( m_aUnoCrsrEntries, nNode, nCntnt, *PCURCRSR, nIdx++, false );
+            FOREACHPAM_END()
+        }
+    }
+}
+
+void CntntIdxStoreImpl::RestoreUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset)
+{
+    SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
+    BOOST_FOREACH(const MarkEntry& aEntry, m_aUnoCrsrEntries)
+    {
+        sal_uInt16 nCnt = 0;
+        BOOST_FOREACH(const SwUnoCrsr* pUnoCrsr, pDoc->GetUnoCrsrTbl())
+        {
+            SAL_INFO("sw.core", "::Looking for Index " << aEntry.m_nIdx << " now at PaM Index" << nCnt << ": " << pUnoCrsr);
+            SwPosition* pPos = NULL;
+            FOREACHPAM_START( const_cast<SwUnoCrsr*>(pUnoCrsr) )
+                if( aEntry.m_nIdx == nCnt )
+                {
+                    SAL_INFO("sw.core", "Found PaM " << PCURCRSR << " for Index " << aEntry.m_nIdx);
+                    pPos = &PCURCRSR->GetBound( !aEntry.m_bOther );
+                    break;
+                }
+                else
+                    SAL_INFO("sw.core", "Skipping PaM " << PCURCRSR << " for Index " << aEntry.m_nIdx);
+                ++nCnt;
+            FOREACHPAM_END()
+            const SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<const SwUnoTableCrsr*>(pUnoCrsr);
+            if( !pPos && pUnoTblCrsr )
+            {
+                FOREACHPAM_START( &(const_cast<SwUnoTableCrsr*>(pUnoTblCrsr))->GetSelRing() )
+                    if( aEntry.m_nIdx == nCnt )
+                    {
+                        SAL_INFO("sw.core", "Found Table PaM " << PCURCRSR << " for Index " << aEntry.m_nIdx);
+                        pPos = &PCURCRSR->GetBound( !aEntry.m_bOther );
+                        break;
+                    }
+                    else
+                        SAL_INFO("sw.info", "Skipping Table PaM " << PCURCRSR << " for Index " << aEntry.m_nIdx);
+                    ++nCnt;
+                FOREACHPAM_END()
+            }
+            if( pPos )
+            {
+                SAL_INFO("sw.info", "Would be setting " << pPos << " on Node " << nNode << " for Index " << aEntry.m_nIdx);
+                //pPos->nNode = *pCNd;
+                //pPos->nContent.Assign( pCNd, aEntry.m_nCntnt + nOffset );
+                assert(&pPos->nNode.GetNode() == pCNd);
+#if OSL_DEBUG_LEVEL > 0
+                if(pPos->nNode.GetIndex() != pCNd->GetIndex())
+                {
+                    DumpSaves(m_aSaveArr);
+                    DumpEntries(&m_aUnoCrsrEntries);
+                    SAL_INFO("sw.core", aEntry.m_nIdx << ": Node expected to set to " << pCNd->GetIndex() << " but actually should be " << pPos->nNode.GetIndex() );
+                }
+#endif
+                SAL_INFO_IF(pPos->nContent != aEntry.m_nCntnt + nOffset ,"sw.core", "On Node" << pCNd->GetIndex() << "Content expected to set to " << aEntry.m_nCntnt << "(" << nOffset << ")" << " but actually should be " << pPos->nContent.GetIndex() );
+                assert(pPos->nContent == aEntry.m_nCntnt + nOffset);
+                break;
+            }
+        }
+    }
+}
+
+void CntntIdxStoreImpl::RestoreUnoCrsrsLen (SwNode& rNd, sal_uLong nLen, sal_Int32 nCorrLen)
+{
+    const SwDoc* pDoc = rNd.GetDoc();
+    SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
+    BOOST_FOREACH(const MarkEntry& aEntry, m_aUnoCrsrEntries)
+    {
+        if( aEntry.m_nCntnt < nCorrLen )
+        {
+            sal_uInt16 nCnt = 0;
+            BOOST_FOREACH(const SwUnoCrsr* pUnoCrsr, pDoc->GetUnoCrsrTbl())
+            {
+                SwPosition* pPos = NULL;
+                FOREACHPAM_START( const_cast<SwUnoCrsr*>(pUnoCrsr) )
+                    if( aEntry.m_nIdx == nCnt )
+                    {
+                        pPos = &PCURCRSR->GetBound( !aEntry.m_bOther );
+                        break;
+                    }
+                    ++nCnt;
+                FOREACHPAM_END()
+                const SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<const SwUnoTableCrsr*>(pUnoCrsr);
+                if( !pPos && pUnoTblCrsr )
+                {
+                    FOREACHPAM_START( &(const_cast<SwUnoTableCrsr*>(pUnoTblCrsr))->GetSelRing() )
+                        if( aEntry.m_nIdx == nCnt )
+                        {
+                            pPos = &PCURCRSR->GetBound( !aEntry.m_bOther );
+                            break;
+                        }
+                        ++nCnt;
+                    FOREACHPAM_END()
+                }
+                if( pPos )
+                {
+                    //pPos->nNode = rNd;
+                    //pPos->nContent.Assign( pCNd, std::min( aEntry.m_nCntnt, static_cast<sal_Int32>(nLen) ) );
+                    assert(&pPos->nNode.GetNode() == pCNd);
+                    assert(pPos->nContent == std::min( aEntry.m_nCntnt, static_cast<sal_Int32>(nLen) ) );
+                    break;
+                }
+            }
+        }
+    }
+}
 
 namespace sw { namespace mark {
     boost::shared_ptr<CntntIdxStore> CntntIdxStore::Create()
commit f9149846ff84db2716c44ea7fa5e9f1d95657556
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jul 12 23:41:52 2014 +0200

    more debug info for mark moves
    
    Change-Id: I13d7e5289f0143b9b8f040897db9c82fa4dcc3bb

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 1f190d7..dd2b393 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1173,6 +1173,13 @@ namespace
 
         void SetContent( sal_Int32 n )     { nContent = n; }
         sal_Int32 GetContent() const       { return nContent; }
+#if OSL_DEBUG_LEVEL > 0
+        void Dump()
+        {
+            SAL_INFO("sw.core", "Count: " << GetCount() << "\tType: " << GetType() << "\tContent: " << GetContent());
+        }
+#endif
+
     };
 
     // #i59534: If a paragraph will be splitted we have to restore some redline positions
@@ -1239,6 +1246,17 @@ namespace
             rSave.DecType();
         }
     }
+#if OSL_DEBUG_LEVEL > 0
+    static void DumpSaves(std::vector<sal_uLong> &rSaveArr)
+    {
+        sal_uInt16 n = 0;
+        while( n < rSaveArr.size() )
+        {
+            _SwSaveTypeCountContent aSave( rSaveArr, n );
+            aSave.Dump();
+        }
+    }
+#endif
 }
 
 // IDocumentMarkAccess for SwDoc
@@ -1697,10 +1715,13 @@ void _RestoreCntntIdx(SwDoc* pDoc,
                     FOREACHPAM_START( *it )
                         if( aSave.GetCount() == nCnt )
                         {
+                            SAL_INFO("sw.core", "Found PaM " << PCURCRSR << " for Index " << aSave.GetCount());
                             pPos = &PCURCRSR->GetBound( 0x0400 ==
                                                     aSave.GetType() );
                             break;
                         }
+                        else
+                            SAL_INFO("sw.core", "Skipped PaM " << PCURCRSR << " for Index " << aSave.GetCount());
                         ++nCnt;
                     FOREACHPAM_END()
                     if( pPos )
@@ -1729,6 +1750,10 @@ void _RestoreCntntIdx(SwDoc* pDoc,
 
         if( pPos )
         {
+#if OSL_DEBUG_LEVEL > 0
+            aSave.Dump();
+#endif
+            SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.GetCount() << " on Node " << nNode << " from " << pPos->nContent.GetIndex() << " to " << (aSave.GetContent() + nOffset));
             pPos->nNode = *pCNd;
             pPos->nContent.Assign( pCNd, aSave.GetContent() + nOffset );
         }
@@ -1880,6 +1905,12 @@ namespace
         long int m_nIdx;
         bool m_bOther;
         sal_Int32 m_nCntnt;
+#if OSL_DEBUG_LEVEL > 0
+        void Dump()
+        {
+            SAL_INFO("sw.core", "Index: " << m_nIdx << "\tOther: " << m_bOther << "\tContent: " << m_nCntnt);
+        }
+#endif
     };
     struct CntntIdxStoreImpl : sw::mark::CntntIdxStore
     {


More information about the Libreoffice-commits mailing list