LCOV - code coverage report
Current view: top level - sw/source/core/doc - CntntIdxStore.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 158 217 72.8 %
Date: 2014-11-03 Functions: 25 30 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <bookmrk.hxx>
      21             : #include <boost/foreach.hpp>
      22             : #include <boost/function.hpp>
      23             : #include <boost/make_shared.hpp>
      24             : #include <cntfrm.hxx>
      25             : #include <doc.hxx>
      26             : #include <IDocumentRedlineAccess.hxx>
      27             : #include <IDocumentLayoutAccess.hxx>
      28             : #include <docary.hxx>
      29             : #include <editsh.hxx>
      30             : #include <fmtanchr.hxx>
      31             : #include <frmfmt.hxx>
      32             : #include <functional>
      33             : #include <mvsave.hxx>
      34             : #include <ndtxt.hxx>
      35             : #include <node.hxx>
      36             : #include <pam.hxx>
      37             : #include <redline.hxx>
      38             : #include <rtl/ustrbuf.hxx>
      39             : #include <rtl/ustring.hxx>
      40             : #include <sal/types.h>
      41             : #include <unocrsr.hxx>
      42             : #include <edimp.hxx>
      43             : 
      44             : using namespace ::boost;
      45             : using namespace ::sw::mark;
      46             : 
      47             : namespace
      48             : {
      49             :     // #i59534: If a paragraph will be splitted we have to restore some redline positions
      50             :     // This help function checks a position compared with a node and an content index
      51             : 
      52             :     static const int BEFORE_NODE = 0;          // Position before the given node index
      53             :     static const int BEFORE_SAME_NODE = 1;     // Same node index but content index before given content index
      54             :     static const int SAME_POSITION = 2;        // Same node index and samecontent index
      55             :     static const int BEHIND_SAME_NODE = 3;     // Same node index but content index behind given content index
      56             :     static const int BEHIND_NODE = 4;          // Position behind the given node index
      57             : 
      58        5270 :     static int lcl_RelativePosition( const SwPosition& rPos, sal_uLong nNode, sal_Int32 nCntnt )
      59             :     {
      60        5270 :         sal_uLong nIndex = rPos.nNode.GetIndex();
      61        5270 :         int nReturn = BEFORE_NODE;
      62        5270 :         if( nIndex == nNode )
      63             :         {
      64          20 :             const sal_Int32 nCntIdx = rPos.nContent.GetIndex();
      65          20 :             if( nCntIdx < nCntnt )
      66           4 :                 nReturn = BEFORE_SAME_NODE;
      67          16 :             else if( nCntIdx == nCntnt )
      68          16 :                 nReturn = SAME_POSITION;
      69             :             else
      70           0 :                 nReturn = BEHIND_SAME_NODE;
      71             :         }
      72        5250 :         else if( nIndex > nNode )
      73        1316 :             nReturn = BEHIND_NODE;
      74        5270 :         return nReturn;
      75             :     }
      76             :     struct MarkEntry
      77             :     {
      78             :         long int m_nIdx;
      79             :         bool m_bOther;
      80             :         sal_Int32 m_nCntnt;
      81             : #if 0
      82             :         void Dump()
      83             :         {
      84             :             SAL_INFO("sw.core", "Index: " << m_nIdx << "\tOther: " << m_bOther << "\tContent: " << m_nCntnt);
      85             :         }
      86             : #endif
      87             :     };
      88             :     struct PaMEntry
      89             :     {
      90             :         SwPaM* m_pPaM;
      91             :         bool m_isMark;
      92             :         sal_Int32 m_nCntnt;
      93             :     };
      94             :     struct OffsetUpdater
      95             :     {
      96             :         const SwCntntNode* m_pNewCntntNode;
      97             :         const sal_Int32 m_nOffset;
      98          72 :         OffsetUpdater(SwCntntNode* pNewCntntNode, sal_Int32 nOffset)
      99          72 :             : m_pNewCntntNode(pNewCntntNode), m_nOffset(nOffset) {};
     100        5906 :         void operator()(SwPosition& rPos, sal_Int32 nCntnt) const
     101             :         {
     102        5906 :             rPos.nNode = *m_pNewCntntNode;
     103        5906 :             rPos.nContent.Assign(const_cast<SwCntntNode*>(m_pNewCntntNode), nCntnt + m_nOffset);
     104        5906 :         };
     105             :     };
     106             :     struct LimitUpdater
     107             :     {
     108             :         const SwCntntNode* m_pNewCntntNode;
     109             :         const sal_uLong m_nLen;
     110             :         const sal_Int32 m_nCorrLen;
     111           0 :         LimitUpdater(SwCntntNode* pNewCntntNode, sal_uLong nLen, sal_Int32 nCorrLen)
     112           0 :             : m_pNewCntntNode(pNewCntntNode), m_nLen(nLen), m_nCorrLen(nCorrLen) {};
     113           0 :         void operator()(SwPosition& rPos, sal_Int32 nCntnt) const
     114             :         {
     115           0 :             rPos.nNode = *m_pNewCntntNode;
     116           0 :             if( nCntnt < m_nCorrLen )
     117             :             {
     118           0 :                 rPos.nContent.Assign(const_cast<SwCntntNode*>(m_pNewCntntNode), std::min( nCntnt, static_cast<sal_Int32>(m_nLen) ) );
     119             :             }
     120             :             else
     121             :             {
     122           0 :                 rPos.nContent -= m_nCorrLen;
     123             :             }
     124           0 :         };
     125             :     };
     126        7066 :     struct CntntIdxStoreImpl : sw::mark::CntntIdxStore
     127             :     {
     128             :         std::vector<MarkEntry> m_aBkmkEntries;
     129             :         std::vector<MarkEntry> m_aRedlineEntries;
     130             :         std::vector<MarkEntry> m_aFlyEntries;
     131             :         std::vector<PaMEntry> m_aUnoCrsrEntries;
     132             :         std::vector<PaMEntry> m_aShellCrsrEntries;
     133             :         typedef boost::function<void (SwPosition& rPos, sal_Int32 nCntnt)> updater_t;
     134           0 :         virtual void Clear() SAL_OVERRIDE
     135             :         {
     136           0 :             m_aBkmkEntries.clear();
     137           0 :             m_aRedlineEntries.clear();
     138           0 :             m_aFlyEntries.clear();
     139           0 :             m_aUnoCrsrEntries.clear();
     140           0 :             m_aShellCrsrEntries.clear();
     141           0 :         }
     142        7066 :         virtual bool Empty() SAL_OVERRIDE
     143             :         {
     144        7066 :             return m_aBkmkEntries.empty() && m_aRedlineEntries.empty() && m_aFlyEntries.empty() && m_aUnoCrsrEntries.empty() && m_aShellCrsrEntries.empty();
     145             :         }
     146        7066 :         virtual void Save(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, bool bSaveFlySplit=false) SAL_OVERRIDE
     147             :         {
     148        7066 :             SaveBkmks(pDoc, nNode, nCntnt);
     149        7066 :             SaveRedlines(pDoc, nNode, nCntnt);
     150        7066 :             SaveFlys(pDoc, nNode, nCntnt, bSaveFlySplit);
     151        7066 :             SaveUnoCrsrs(pDoc, nNode, nCntnt);
     152        7066 :             SaveShellCrsrs(pDoc, nNode, nCntnt);
     153        7066 :         }
     154          72 :         virtual void Restore(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false) SAL_OVERRIDE
     155             :         {
     156          72 :             SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
     157          72 :             updater_t aUpdater = OffsetUpdater(pCNd, nOffset);
     158          72 :             RestoreBkmks(pDoc, aUpdater);
     159          72 :             RestoreRedlines(pDoc, aUpdater);
     160          72 :             RestoreFlys(pDoc, aUpdater, bAuto);
     161          72 :             RestoreUnoCrsrs(aUpdater);
     162          72 :             RestoreShellCrsrs(aUpdater);
     163          72 :         }
     164           0 :         virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen) SAL_OVERRIDE
     165             :         {
     166           0 :             SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
     167           0 :             SwDoc* pDoc = rNd.GetDoc();
     168           0 :             updater_t aUpdater = LimitUpdater(pCNd, nLen, nCorrLen);
     169           0 :             RestoreBkmks(pDoc, aUpdater);
     170           0 :             RestoreRedlines(pDoc, aUpdater);
     171           0 :             RestoreFlys(pDoc, aUpdater, false);
     172           0 :             RestoreUnoCrsrs(aUpdater);
     173           0 :             RestoreShellCrsrs(aUpdater);
     174           0 :         }
     175        7066 :         virtual ~CntntIdxStoreImpl(){};
     176             :         private:
     177             :             inline void SaveBkmks(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
     178             :             inline void RestoreBkmks(SwDoc* pDoc, updater_t& rUpdater);
     179             :             inline void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
     180             :             inline void RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater);
     181             :             inline void SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, bool bSaveFlySplit);
     182             :             inline void RestoreFlys(SwDoc* pDoc, updater_t& rUpdater, bool bAuto);
     183             :             inline void SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
     184             :             inline void RestoreUnoCrsrs(updater_t& rUpdater);
     185             :             inline void SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
     186             :             inline void RestoreShellCrsrs(updater_t& rUpdater);
     187        4354 :             inline const SwPosition& GetRightMarkPos(::sw::mark::IMark* pMark, bool bOther)
     188        4354 :                 { return bOther ? pMark->GetOtherMarkPos() : pMark->GetMarkPos(); };
     189        4354 :             inline void SetRightMarkPos(MarkBase* pMark, bool bOther, const SwPosition* const pPos)
     190        4354 :                 { bOther ? pMark->SetOtherMarkPos(*pPos) : pMark->SetMarkPos(*pPos); };
     191             :     };
     192      214734 :     static inline void lcl_ChkPaM( std::vector<PaMEntry>& rPaMEntries, const sal_uLong nNode, const sal_Int32 nCntnt, SwPaM& rPaM, const bool bPoint)
     193             :     {
     194      214734 :         const SwPosition* pPos = &rPaM.GetBound( bPoint );
     195      214734 :         if( pPos->nNode.GetIndex() == nNode && pPos->nContent.GetIndex() < nCntnt )
     196             :         {
     197        1544 :             const PaMEntry aEntry = { &rPaM, bPoint, pPos->nContent.GetIndex() };
     198        1544 :             rPaMEntries.push_back(aEntry);
     199             :         }
     200      214734 :     }
     201      107367 :     static inline void lcl_ChkPaMBoth( std::vector<PaMEntry>& rPaMEntries, const sal_uLong nNode, const sal_Int32 nCntnt, SwPaM& rPaM)
     202             :     {
     203      107367 :         lcl_ChkPaM(rPaMEntries, nNode, nCntnt, rPaM, true);
     204      107367 :         lcl_ChkPaM(rPaMEntries, nNode, nCntnt, rPaM, false);
     205      107367 :     }
     206             : 
     207             : #if 0
     208             :     static void DumpEntries(std::vector<MarkEntry>* pEntries)
     209             :     {
     210             :         BOOST_FOREACH(MarkEntry& aEntry, *pEntries)
     211             :             aEntry.Dump();
     212             :     }
     213             : #endif
     214             : }
     215             : 
     216        7066 : void CntntIdxStoreImpl::SaveBkmks(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
     217             : {
     218        7066 :     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     219        7066 :     const IDocumentMarkAccess::const_iterator_t ppBkmkEnd = pMarkAccess->getAllMarksEnd();
     220      233690 :     for(
     221        7066 :         IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getAllMarksBegin();
     222             :         ppBkmk != ppBkmkEnd;
     223             :         ++ppBkmk)
     224             :     {
     225      226624 :         const ::sw::mark::IMark* pBkmk = ppBkmk->get();
     226      226624 :         bool bMarkPosEqual = false;
     227      453248 :         if(pBkmk->GetMarkPos().nNode.GetIndex() == nNode
     228      226624 :             && pBkmk->GetMarkPos().nContent.GetIndex() <= nCntnt)
     229             :         {
     230        2219 :             if(pBkmk->GetMarkPos().nContent.GetIndex() < nCntnt)
     231             :             {
     232        2191 :                 const MarkEntry aEntry = { ppBkmk - pMarkAccess->getAllMarksBegin(), false, pBkmk->GetMarkPos().nContent.GetIndex() };
     233        2191 :                 m_aBkmkEntries.push_back(aEntry);
     234             :             }
     235             :             else // if a bookmark position is equal nCntnt, the other position
     236          28 :                 bMarkPosEqual = true; // has to decide if it is added to the array
     237             :         }
     238      453248 :         if(pBkmk->IsExpanded()
     239      202474 :             && pBkmk->GetOtherMarkPos().nNode.GetIndex() == nNode
     240      252473 :             && pBkmk->GetOtherMarkPos().nContent.GetIndex() <= nCntnt)
     241             :         {
     242        2163 :             if(bMarkPosEqual)
     243             :             { // the other position is before, the (main) position is equal
     244           0 :                 const MarkEntry aEntry = { ppBkmk - pMarkAccess->getAllMarksBegin(), false, pBkmk->GetMarkPos().nContent.GetIndex() };
     245           0 :                 m_aBkmkEntries.push_back(aEntry);
     246             :             }
     247        2163 :             const MarkEntry aEntry = { ppBkmk - pMarkAccess->getAllMarksBegin(), true, pBkmk->GetOtherMarkPos().nContent.GetIndex() };
     248        2163 :             m_aBkmkEntries.push_back(aEntry);
     249             :         }
     250             :     }
     251        7066 : }
     252             : 
     253          72 : void CntntIdxStoreImpl::RestoreBkmks(SwDoc* pDoc, updater_t& rUpdater)
     254             : {
     255          72 :     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     256        4426 :     BOOST_FOREACH(const MarkEntry& aEntry, m_aBkmkEntries)
     257             :     {
     258        4354 :         if (MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aEntry.m_nIdx].get()))
     259             :         {
     260        4354 :             SwPosition aNewPos(GetRightMarkPos(pMark, aEntry.m_bOther));
     261        4354 :             rUpdater(aNewPos, aEntry.m_nCntnt);
     262        4354 :             SetRightMarkPos(pMark, aEntry.m_bOther, &aNewPos);
     263             :         }
     264             :     }
     265          72 : }
     266             : 
     267        7066 : void CntntIdxStoreImpl::SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
     268             : {
     269        7066 :     SwRedlineTbl const & pRedlineTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
     270        7066 :     long int nIdx = 0;
     271        9710 :     BOOST_FOREACH(const SwRangeRedline* pRdl, std::make_pair(pRedlineTbl.begin(), pRedlineTbl.end()))
     272             :     {
     273        2644 :         int nPointPos = lcl_RelativePosition( *pRdl->GetPoint(), nNode, nCntnt );
     274        5270 :         int nMarkPos = pRdl->HasMark() ? lcl_RelativePosition( *pRdl->GetMark(), nNode, nCntnt ) :
     275        5270 :                                           nPointPos;
     276             :         // #i59534: We have to store the positions inside the same node before the insert position
     277             :         // and the one at the insert position if the corresponding Point/Mark position is before
     278             :         // the insert position.
     279        2644 :         if( nPointPos == BEFORE_SAME_NODE ||
     280          14 :             ( nPointPos == SAME_POSITION && nMarkPos < SAME_POSITION ) )
     281             :         {
     282           4 :             const MarkEntry aEntry = { nIdx, false, pRdl->GetPoint()->nContent.GetIndex() };
     283           4 :             m_aRedlineEntries.push_back(aEntry);
     284             :         }
     285        2648 :         if( pRdl->HasMark() && ( nMarkPos == BEFORE_SAME_NODE ||
     286           2 :             ( nMarkPos == SAME_POSITION && nPointPos < SAME_POSITION ) ) )
     287             :         {
     288           4 :             const MarkEntry aEntry = { nIdx, true, pRdl->GetMark()->nContent.GetIndex() };
     289           4 :             m_aRedlineEntries.push_back(aEntry);
     290             :         }
     291        2644 :         ++nIdx;
     292             :     }
     293        7066 : }
     294             : 
     295          72 : void CntntIdxStoreImpl::RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater)
     296             : {
     297          72 :     const SwRedlineTbl& rRedlTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
     298          80 :     BOOST_FOREACH(const MarkEntry& aEntry, m_aRedlineEntries)
     299             :     {
     300             :         SwPosition* const pPos = (SwPosition*)( aEntry.m_bOther
     301           4 :             ? rRedlTbl[ aEntry.m_nIdx ]->GetMark()
     302          12 :             : rRedlTbl[ aEntry.m_nIdx ]->GetPoint());
     303           8 :         rUpdater(*pPos, aEntry.m_nCntnt);
     304             :     }
     305          72 : }
     306             : 
     307        7066 : void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, bool bSaveFlySplit)
     308             : {
     309        7066 :     SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
     310        7066 :     if( !pNode )
     311        1036 :         return;
     312        7066 :     SwFrm* pFrm = pNode->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() );
     313        7066 :     if( pFrm )
     314             :     {
     315        1042 :         if( !pFrm->GetDrawObjs() )
     316        1036 :             return; // if we have a layout and no DrawObjs, we can skip this
     317             :     }
     318        6030 :     MarkEntry aSave = { 0, false, 0 };
     319       38218 :     BOOST_FOREACH(const SwFrmFmt* pFrmFmt, *pDoc->GetSpzFrmFmts())
     320             :     {
     321       32188 :         if ( RES_FLYFRMFMT == pFrmFmt->Which() || RES_DRAWFRMFMT == pFrmFmt->Which() )
     322             :         {
     323       32188 :             bool bSkip = false;
     324       32188 :             const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
     325       32188 :             SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
     326       32194 :             if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
     327          12 :                  ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
     328           6 :                    FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
     329             :             {
     330           0 :                 aSave.m_bOther = false;
     331           0 :                 aSave.m_nCntnt = pAPos->nContent.GetIndex();
     332           0 :                 if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
     333             :                 {
     334           0 :                     if( nCntnt <= aSave.m_nCntnt )
     335             :                     {
     336           0 :                         if( bSaveFlySplit )
     337           0 :                             aSave.m_bOther = true;
     338             :                         else
     339           0 :                             bSkip = true;
     340             :                     }
     341             :                 }
     342           0 :                 if(!bSkip)
     343           0 :                     m_aFlyEntries.push_back(aSave);
     344             :             }
     345             :         }
     346       32188 :         ++aSave.m_nIdx;
     347             :     }
     348             : }
     349             : 
     350          72 : void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t& rUpdater, bool bAuto)
     351             : {
     352          72 :     SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
     353          72 :     BOOST_FOREACH(const MarkEntry& aEntry, m_aFlyEntries)
     354             :     {
     355           0 :         if(!aEntry.m_bOther)
     356             :         {
     357           0 :             SwFrmFmt *pFrmFmt = (*pSpz)[ aEntry.m_nIdx ];
     358           0 :             const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
     359           0 :             if( rFlyAnchor.GetCntntAnchor() )
     360             :             {
     361           0 :                 SwFmtAnchor aNew( rFlyAnchor );
     362           0 :                 SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
     363           0 :                 rUpdater(aNewPos, aEntry.m_nCntnt);
     364           0 :                 if ( FLY_AT_CHAR != rFlyAnchor.GetAnchorId() )
     365             :                 {
     366           0 :                     aNewPos.nContent.Assign( 0, 0 );
     367             :                 }
     368           0 :                 aNew.SetAnchor( &aNewPos );
     369           0 :                 pFrmFmt->SetFmtAttr( aNew );
     370             :             }
     371             :         }
     372           0 :         else if( bAuto )
     373             :         {
     374           0 :             SwFrmFmt *pFrmFmt = (*pSpz)[ aEntry.m_nIdx ];
     375           0 :             SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor();
     376           0 :             pFrmFmt->NotifyClients( pAnchor, pAnchor );
     377             :         }
     378             :     }
     379          72 : }
     380             : 
     381        7066 : void CntntIdxStoreImpl::SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
     382             : {
     383      113391 :     BOOST_FOREACH(const SwUnoCrsr* pUnoCrsr, pDoc->GetUnoCrsrTbl())
     384             :     {
     385      212650 :         FOREACHPAM_START( const_cast<SwUnoCrsr*>(pUnoCrsr) )
     386      106325 :             lcl_ChkPaMBoth( m_aUnoCrsrEntries, nNode, nCntnt, *PCURCRSR );
     387      106325 :         FOREACHPAM_END()
     388      106325 :         const SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<const SwUnoTableCrsr*>(pUnoCrsr);
     389      106325 :         if( pUnoTblCrsr )
     390             :         {
     391           0 :             FOREACHPAM_START( &(const_cast<SwUnoTableCrsr*>(pUnoTblCrsr))->GetSelRing() )
     392           0 :                 lcl_ChkPaMBoth( m_aUnoCrsrEntries, nNode, nCntnt, *PCURCRSR );
     393           0 :             FOREACHPAM_END()
     394             :         }
     395             :     }
     396        7066 : }
     397             : 
     398          72 : void CntntIdxStoreImpl::RestoreUnoCrsrs(updater_t& rUpdater)
     399             : {
     400        1614 :     BOOST_FOREACH(const PaMEntry& aEntry, m_aUnoCrsrEntries)
     401             :     {
     402        1542 :         rUpdater(aEntry.m_pPaM->GetBound(!aEntry.m_isMark), aEntry.m_nCntnt);
     403             :     }
     404          72 : }
     405             : 
     406        7066 : void CntntIdxStoreImpl::SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
     407             : {
     408        7066 :     SwCrsrShell* pShell = pDoc->GetEditShell();
     409        7066 :     if( !pShell )
     410       13090 :         return;
     411        1042 :     SwViewShell *_pStartShell = pShell;
     412        1042 :     do {
     413        1042 :         if( _pStartShell->IsA( TYPE( SwCrsrShell )) )
     414             :         {
     415        1042 :             SwPaM *_pStkCrsr = ((SwCrsrShell*)_pStartShell)->GetStkCrsr();
     416        1042 :             if( _pStkCrsr )
     417           0 :                 do {
     418           0 :                     lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *_pStkCrsr);
     419           0 :                 } while ( (_pStkCrsr != 0 ) &&
     420           0 :                     ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != ((SwCrsrShell*)_pStartShell)->GetStkCrsr()) );
     421             : 
     422        2084 :             FOREACHPAM_START( ((SwCrsrShell*)_pStartShell)->_GetCrsr() )
     423        1042 :                 lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *PCURCRSR);
     424        1042 :             FOREACHPAM_END()
     425             :         }
     426        1042 :     } while((_pStartShell=(SwViewShell*)_pStartShell->GetNext())!= pShell );
     427             : }
     428             : 
     429          72 : void CntntIdxStoreImpl::RestoreShellCrsrs(updater_t& rUpdater)
     430             : {
     431          74 :     BOOST_FOREACH(const PaMEntry& aEntry, m_aShellCrsrEntries)
     432             :     {
     433           2 :         rUpdater(aEntry.m_pPaM->GetBound(aEntry.m_isMark), aEntry.m_nCntnt);
     434             :     }
     435          72 : }
     436             : 
     437             : namespace sw { namespace mark {
     438        7066 :     boost::shared_ptr<CntntIdxStore> CntntIdxStore::Create()
     439             :     {
     440        7066 :        return boost::make_shared<CntntIdxStoreImpl>();
     441             :     }
     442         270 : }}
     443             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10