LCOV - code coverage report
Current view: top level - sw/source/core/crsr - crstrvl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 84 1226 6.9 %
Date: 2014-11-03 Functions: 11 49 22.4 %
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 <hintids.hxx>
      21             : #include <comphelper/string.hxx>
      22             : #include <svl/itemiter.hxx>
      23             : #include <editeng/lrspitem.hxx>
      24             : #include <editeng/adjustitem.hxx>
      25             : #include <editeng/formatbreakitem.hxx>
      26             : #include <svx/svdobj.hxx>
      27             : #include <crsrsh.hxx>
      28             : #include <doc.hxx>
      29             : #include <IDocumentUndoRedo.hxx>
      30             : #include <IDocumentRedlineAccess.hxx>
      31             : #include <IDocumentFieldsAccess.hxx>
      32             : #include <IDocumentLayoutAccess.hxx>
      33             : #include <pagefrm.hxx>
      34             : #include <cntfrm.hxx>
      35             : #include <rootfrm.hxx>
      36             : #include <pam.hxx>
      37             : #include <ndtxt.hxx>
      38             : #include <fldbas.hxx>
      39             : #include <swtable.hxx>
      40             : #include <docary.hxx>
      41             : #include <txtfld.hxx>
      42             : #include <fmtfld.hxx>
      43             : #include <txtftn.hxx>
      44             : #include <txtinet.hxx>
      45             : #include <fmtinfmt.hxx>
      46             : #include <txttxmrk.hxx>
      47             : #include <frmfmt.hxx>
      48             : #include <flyfrm.hxx>
      49             : #include <viscrs.hxx>
      50             : #include <callnk.hxx>
      51             : #include <doctxm.hxx>
      52             : #include <docfld.hxx>
      53             : #include <expfld.hxx>
      54             : #include <reffld.hxx>
      55             : #include <flddat.hxx>
      56             : #include <cellatr.hxx>
      57             : #include <swundo.hxx>
      58             : #include <redline.hxx>
      59             : #include <fmtcntnt.hxx>
      60             : #include <fmthdft.hxx>
      61             : #include <pagedesc.hxx>
      62             : #include <fesh.hxx>
      63             : #include <charfmt.hxx>
      64             : #include <fmturl.hxx>
      65             : #include "txtfrm.hxx"
      66             : #include <wrong.hxx>
      67             : #include <switerator.hxx>
      68             : #include <vcl/window.hxx>
      69             : #include <docufld.hxx>
      70             : 
      71             : using namespace ::com::sun::star;
      72             : 
      73           0 : void SwCrsrShell::MoveCrsrToNum()
      74             : {
      75           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
      76           0 :     SwCrsrSaveState aSaveState( *m_pCurCrsr );
      77           0 :     if( ActionPend() )
      78           0 :         return;
      79           0 :     SET_CURR_SHELL( this );
      80             :     // try to set cursor onto this position, at half of the char-
      81             :     // SRectangle's height
      82           0 :     Point aPt( m_pCurCrsr->GetPtPos() );
      83           0 :     SwCntntFrm * pFrm = m_pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
      84           0 :                                                 m_pCurCrsr->GetPoint() );
      85           0 :     pFrm->GetCharRect( m_aCharRect, *m_pCurCrsr->GetPoint() );
      86           0 :     pFrm->Calc();
      87           0 :     if( pFrm->IsVertical() )
      88             :     {
      89           0 :         aPt.setX(m_aCharRect.Center().getX());
      90           0 :         aPt.setY(pFrm->Frm().Top() + GetUpDownX());
      91             :     }
      92             :     else
      93             :     {
      94           0 :         aPt.setY(m_aCharRect.Center().getY());
      95           0 :         aPt.setX(pFrm->Frm().Left() + GetUpDownX());
      96             :     }
      97           0 :     pFrm->GetCrsrOfst( m_pCurCrsr->GetPoint(), aPt );
      98           0 :     if ( !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
      99           0 :                                 nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
     100             :     {
     101             :         UpdateCrsr(SwCrsrShell::UPDOWN |
     102             :                 SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
     103           0 :                 SwCrsrShell::READONLY );
     104           0 :     }
     105             : }
     106             : 
     107             : /// go to next/previous point on the same level
     108           0 : bool SwCrsrShell::GotoNextNum()
     109             : {
     110           0 :     if (!GetDoc()->GotoNextNum( *m_pCurCrsr->GetPoint() ))
     111           0 :         return false;
     112           0 :     MoveCrsrToNum();
     113           0 :     return true;
     114             : }
     115             : 
     116           0 : bool SwCrsrShell::GotoPrevNum()
     117             : {
     118           0 :     if (!GetDoc()->GotoPrevNum( *m_pCurCrsr->GetPoint() ))
     119           0 :         return false;
     120           0 :     MoveCrsrToNum();
     121           0 :     return true;
     122             : }
     123             : 
     124             : /// jump from content to header
     125           0 : bool SwCrsrShell::GotoHeaderTxt()
     126             : {
     127           0 :     const SwFrm* pFrm = GetCurrFrm()->FindPageFrm();
     128           0 :     while( pFrm && !pFrm->IsHeaderFrm() )
     129           0 :         pFrm = pFrm->GetLower();
     130             :     // found header, search 1. content frame
     131           0 :     while( pFrm && !pFrm->IsCntntFrm() )
     132           0 :         pFrm = pFrm->GetLower();
     133             : 
     134           0 :     if( pFrm )
     135             :     {
     136           0 :         SET_CURR_SHELL( this );
     137             :         // get header frame
     138           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     139           0 :         SwCursor *pTmpCrsr = getShellCrsr( true );
     140           0 :         SwCrsrSaveState aSaveState( *pTmpCrsr );
     141           0 :         pFrm->Calc();
     142           0 :         Point aPt( pFrm->Frm().Pos() + pFrm->Prt().Pos() );
     143           0 :         pFrm->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
     144           0 :         if( !pTmpCrsr->IsSelOvr() )
     145           0 :             UpdateCrsr();
     146             :         else
     147           0 :             pFrm = 0;
     148             :     }
     149           0 :     return 0 != pFrm;
     150             : }
     151             : 
     152             : /// jump from content to footer
     153           0 : bool SwCrsrShell::GotoFooterTxt()
     154             : {
     155           0 :     const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm();
     156           0 :     if( pFrm )
     157             :     {
     158           0 :         const SwFrm* pLower = pFrm->GetLastLower();
     159             : 
     160           0 :         while( pLower && !pLower->IsFooterFrm() )
     161           0 :             pLower = pLower->GetLower();
     162             :         // found footer, search 1. content frame
     163           0 :         while( pLower && !pLower->IsCntntFrm() )
     164           0 :             pLower = pLower->GetLower();
     165             : 
     166           0 :         if( pLower )
     167             :         {
     168           0 :             SwCursor *pTmpCrsr = getShellCrsr( true );
     169           0 :             SET_CURR_SHELL( this );
     170             :             // get position in footer
     171           0 :             SwCallLink aLk( *this ); // watch Crsr-Moves
     172           0 :             SwCrsrSaveState aSaveState( *pTmpCrsr );
     173           0 :             pLower->Calc();
     174           0 :             Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() );
     175           0 :             pLower->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
     176           0 :             if( !pTmpCrsr->IsSelOvr() )
     177           0 :                 UpdateCrsr();
     178             :             else
     179           0 :                 pFrm = 0;
     180             :         }
     181             :         else
     182           0 :             pFrm = 0;
     183             :     }
     184             :     else
     185           0 :         pFrm = 0;
     186           0 :     return 0 != pFrm;
     187             : }
     188             : 
     189           0 : bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, bool bInHeader )
     190             : {
     191           0 :     bool bRet = false;
     192           0 :     SwDoc *pMyDoc = GetDoc();
     193             : 
     194           0 :     SET_CURR_SHELL( this );
     195             : 
     196           0 :     if( USHRT_MAX == nDescNo )
     197             :     {
     198             :         // take the current one
     199           0 :         const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm();
     200           0 :         if( pPage )
     201           0 :             for( sal_uInt16 i = 0; i < pMyDoc->GetPageDescCnt(); ++i )
     202           0 :                 if( pPage->GetPageDesc() == &pMyDoc->GetPageDesc( i ) )
     203             :                 {
     204           0 :                     nDescNo = i;
     205           0 :                     break;
     206             :                 }
     207             :     }
     208             : 
     209           0 :     if( USHRT_MAX != nDescNo && nDescNo < pMyDoc->GetPageDescCnt() )
     210             :     {
     211             :         // check if the attribute exists
     212             :         const SwPageDesc& rDesc = const_cast<const SwDoc *>(pMyDoc)
     213           0 :             ->GetPageDesc( nDescNo );
     214           0 :         const SwFmtCntnt* pCnt = 0;
     215           0 :         if( bInHeader )
     216             :         {
     217             :             // mirrored pages? ignore for now
     218           0 :             const SwFmtHeader& rHd = rDesc.GetMaster().GetHeader();
     219           0 :             if( rHd.GetHeaderFmt() )
     220           0 :                 pCnt = &rHd.GetHeaderFmt()->GetCntnt();
     221             :         }
     222             :         else
     223             :         {
     224           0 :             const SwFmtFooter& rFt = rDesc.GetMaster().GetFooter();
     225           0 :             if( rFt.GetFooterFmt() )
     226           0 :                 pCnt = &rFt.GetFooterFmt()->GetCntnt();
     227             :         }
     228             : 
     229           0 :         if( pCnt && pCnt->GetCntntIdx() )
     230             :         {
     231           0 :             SwNodeIndex aIdx( *pCnt->GetCntntIdx(), 1 );
     232           0 :             SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
     233           0 :             if( !pCNd )
     234           0 :                 pCNd = pMyDoc->GetNodes().GoNext( &aIdx );
     235             : 
     236           0 :             Point aPt( m_pCurCrsr->GetPtPos() );
     237             : 
     238           0 :             if( pCNd && 0 != pCNd->getLayoutFrm( GetLayout(), &aPt, 0, false ) )
     239             :             {
     240             :                 // then we can set the cursor in here
     241           0 :                 SwCallLink aLk( *this ); // watch Crsr-Moves
     242           0 :                 SwCrsrSaveState aSaveState( *m_pCurCrsr );
     243             : 
     244           0 :                 ClearMark();
     245             : 
     246           0 :                 SwPosition& rPos = *m_pCurCrsr->GetPoint();
     247           0 :                 rPos.nNode = *pCNd;
     248           0 :                 rPos.nContent.Assign( pCNd, 0 );
     249             : 
     250           0 :                 bRet = !m_pCurCrsr->IsSelOvr();
     251           0 :                 if( bRet )
     252             :                     UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
     253           0 :                                 SwCrsrShell::READONLY );
     254           0 :             }
     255             :         }
     256             :     }
     257           0 :     return bRet;
     258             : }
     259             : 
     260             : /// jump to the next index
     261           0 : bool SwCrsrShell::GotoNextTOXBase( const OUString* pName )
     262             : {
     263           0 :     bool bRet = false;
     264             : 
     265           0 :     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     266           0 :     SwCntntNode* pFnd = 0;
     267           0 :     for( sal_uInt16 n = rFmts.size(); n; )
     268             :     {
     269           0 :         const SwSection* pSect = rFmts[ --n ]->GetSection();
     270           0 :         if (TOX_CONTENT_SECTION == pSect->GetType())
     271             :         {
     272             :             SwSectionNode const*const pSectNd(
     273           0 :                     pSect->GetFmt()->GetSectionNode());
     274           0 :             if (   pSectNd
     275           0 :                 && m_pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex()
     276           0 :                 && (!pFnd  || pFnd->GetIndex() > pSectNd->GetIndex())
     277           0 :                 && (!pName || *pName ==
     278           0 :                     static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()))
     279             :             {
     280           0 :                 SwNodeIndex aIdx(*pSectNd, 1);
     281           0 :                 SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
     282           0 :                 if (!pCNd)
     283           0 :                     pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
     284           0 :                 if (pCNd &&
     285           0 :                     pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex())
     286             :                 {
     287             :                     SwCntntFrm const*const pCFrm(
     288           0 :                             pCNd->getLayoutFrm(GetLayout()));
     289           0 :                     if (pCFrm &&
     290           0 :                         (IsReadOnlyAvailable() || !pCFrm->IsProtected()))
     291             :                     {
     292           0 :                         pFnd = pCNd;
     293             :                     }
     294           0 :                 }
     295             :             }
     296             :         }
     297             :     }
     298           0 :     if( pFnd )
     299             :     {
     300           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     301           0 :         SwCrsrSaveState aSaveState( *m_pCurCrsr );
     302           0 :         m_pCurCrsr->GetPoint()->nNode = *pFnd;
     303           0 :         m_pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
     304           0 :         bRet = !m_pCurCrsr->IsSelOvr();
     305           0 :         if( bRet )
     306           0 :             UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     307             :     }
     308           0 :     return bRet;
     309             : }
     310             : 
     311             : /// jump to previous index
     312           0 : bool SwCrsrShell::GotoPrevTOXBase( const OUString* pName )
     313             : {
     314           0 :     bool bRet = false;
     315             : 
     316           0 :     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     317           0 :     SwCntntNode* pFnd = 0;
     318           0 :     for( sal_uInt16 n = rFmts.size(); n; )
     319             :     {
     320           0 :         const SwSection* pSect = rFmts[ --n ]->GetSection();
     321           0 :         if (TOX_CONTENT_SECTION == pSect->GetType())
     322             :         {
     323             :             SwSectionNode const*const pSectNd(
     324           0 :                     pSect->GetFmt()->GetSectionNode());
     325           0 :             if (   pSectNd
     326           0 :                 && m_pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex()
     327           0 :                 && (!pFnd  || pFnd->GetIndex() < pSectNd->GetIndex())
     328           0 :                 && (!pName || *pName ==
     329           0 :                     static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()))
     330             :             {
     331           0 :                 SwNodeIndex aIdx(*pSectNd, 1);
     332           0 :                 SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
     333           0 :                 if (!pCNd)
     334           0 :                     pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
     335           0 :                 if (pCNd &&
     336           0 :                     pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex())
     337             :                 {
     338             :                     SwCntntFrm const*const pCFrm(
     339           0 :                             pCNd->getLayoutFrm(GetLayout()));
     340           0 :                     if (pCFrm &&
     341           0 :                         (IsReadOnlyAvailable() || !pCFrm->IsProtected()))
     342             :                     {
     343           0 :                         pFnd = pCNd;
     344             :                     }
     345           0 :                 }
     346             :             }
     347             :         }
     348             :     }
     349             : 
     350           0 :     if( pFnd )
     351             :     {
     352           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     353           0 :         SwCrsrSaveState aSaveState( *m_pCurCrsr );
     354           0 :         m_pCurCrsr->GetPoint()->nNode = *pFnd;
     355           0 :         m_pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
     356           0 :         bRet = !m_pCurCrsr->IsSelOvr();
     357           0 :         if( bRet )
     358           0 :             UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     359             :     }
     360           0 :     return bRet;
     361             : }
     362             : 
     363             : /// jump to index of TOXMark
     364           0 : bool SwCrsrShell::GotoTOXMarkBase()
     365             : {
     366           0 :     bool bRet = false;
     367             : 
     368           0 :     SwTOXMarks aMarks;
     369           0 :     sal_uInt16 nCnt = GetDoc()->GetCurTOXMark( *m_pCurCrsr->GetPoint(), aMarks );
     370           0 :     if( nCnt )
     371             :     {
     372             :         // Take the 1. and get the index type. Search in its dependency list
     373             :         // for the actual index
     374           0 :         const SwTOXType* pType = aMarks[0]->GetTOXType();
     375           0 :         SwIterator<SwTOXBase,SwTOXType> aIter( *pType );
     376             :         const SwSectionNode* pSectNd;
     377             :         const SwSectionFmt* pSectFmt;
     378             : 
     379           0 :         for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() )
     380             :         {
     381           0 :             if( pTOX->ISA( SwTOXBaseSection ) &&
     382           0 :                 0 != ( pSectFmt = ((SwTOXBaseSection*)pTOX)->GetFmt() ) &&
     383             :                 0 != ( pSectNd = pSectFmt->GetSectionNode() ))
     384             :             {
     385           0 :                 SwNodeIndex aIdx( *pSectNd, 1 );
     386           0 :                 SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
     387           0 :                 if( !pCNd )
     388           0 :                     pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
     389             :                 const SwCntntFrm* pCFrm;
     390           0 :                 if( pCNd &&
     391           0 :                     pCNd->EndOfSectionIndex() < pSectNd->EndOfSectionIndex() &&
     392           0 :                     0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
     393           0 :                     ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
     394             :                 {
     395           0 :                     SwCallLink aLk( *this ); // watch Crsr-Moves
     396           0 :                     SwCrsrSaveState aSaveState( *m_pCurCrsr );
     397           0 :                     m_pCurCrsr->GetPoint()->nNode = *pCNd;
     398           0 :                     m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
     399           0 :                     bRet = !m_pCurCrsr->IsInProtectTable() &&
     400           0 :                             !m_pCurCrsr->IsSelOvr();
     401           0 :                     if( bRet )
     402           0 :                         UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     403           0 :                     break;
     404           0 :                 }
     405             :             }
     406           0 :     }
     407             :     }
     408           0 :     return bRet;
     409             : }
     410             : 
     411             : /// Jump to next/previous table formula
     412             : /// Optionally it is possible to also jump to broken formulas
     413           0 : bool SwCrsrShell::GotoNxtPrvTblFormula( bool bNext, bool bOnlyErrors )
     414             : {
     415           0 :     if( IsTableMode() )
     416           0 :         return false;
     417             : 
     418           0 :     bool bFnd = false;
     419           0 :     SwPosition& rPos = *m_pCurCrsr->GetPoint();
     420             : 
     421           0 :     Point aPt;
     422           0 :     SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
     423           0 :     if( !bNext )
     424           0 :         aFndPos.nNode = 0;
     425           0 :     _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
     426             : 
     427             :     {
     428           0 :         const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
     429           0 :         if( pSttNd )
     430             :         {
     431           0 :             const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
     432           0 :                                         GetTblBox( pSttNd->GetIndex() );
     433           0 :             if( pTBox )
     434           0 :                 aCurGEF = _SetGetExpFld( *pTBox );
     435             :         }
     436             :     }
     437             : 
     438           0 :     if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
     439             :         // also at collection use only the first frame
     440           0 :         aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(),
     441           0 :                                 &aPt, &rPos, false ) );
     442             :     {
     443             :         const SfxPoolItem* pItem;
     444             :         const SwTableBox* pTBox;
     445           0 :         sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
     446             : 
     447           0 :         for( n = 0; n < nMaxItems; ++n )
     448           0 :             if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
     449           0 :                                         RES_BOXATR_FORMULA, n ) ) &&
     450           0 :                 0 != (pTBox = ((SwTblBoxFormula*)pItem)->GetTableBox() ) &&
     451           0 :                 pTBox->GetSttNd() &&
     452           0 :                 pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
     453           0 :                 ( !bOnlyErrors ||
     454           0 :                   !((SwTblBoxFormula*)pItem)->HasValidBoxes() ) )
     455             :             {
     456             :                 const SwCntntFrm* pCFrm;
     457           0 :                 SwNodeIndex aIdx( *pTBox->GetSttNd() );
     458           0 :                 const SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
     459           0 :                 if( pCNd && 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, false ) ) &&
     460           0 :                     (IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
     461             :                 {
     462           0 :                     _SetGetExpFld aCmp( *pTBox );
     463           0 :                     aCmp.SetBodyPos( *pCFrm );
     464             : 
     465           0 :                     if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
     466           0 :                               : ( aCmp < aCurGEF && aFndGEF < aCmp ))
     467             :                     {
     468           0 :                         aFndGEF = aCmp;
     469           0 :                         bFnd = true;
     470             :                     }
     471           0 :                 }
     472             :             }
     473             :     }
     474             : 
     475           0 :     if( bFnd )
     476             :     {
     477           0 :         SET_CURR_SHELL( this );
     478           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     479           0 :         SwCrsrSaveState aSaveState( *m_pCurCrsr );
     480             : 
     481           0 :         aFndGEF.GetPosOfContent( rPos );
     482           0 :         m_pCurCrsr->DeleteMark();
     483             : 
     484           0 :         bFnd = !m_pCurCrsr->IsSelOvr();
     485           0 :         if( bFnd )
     486             :             UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
     487           0 :                         SwCrsrShell::READONLY );
     488             :     }
     489           0 :     return bFnd;
     490             : }
     491             : 
     492             : /// jump to next/previous index marker
     493           0 : bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext )
     494             : {
     495           0 :     if( IsTableMode() )
     496           0 :         return false;
     497             : 
     498           0 :     bool bFnd = false;
     499           0 :     SwPosition& rPos = *m_pCurCrsr->GetPoint();
     500             : 
     501           0 :     Point aPt;
     502           0 :     SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
     503           0 :     if( !bNext )
     504           0 :         aFndPos.nNode = 0;
     505           0 :     _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
     506             : 
     507           0 :     if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
     508             :         // also at collection use only the first frame
     509           0 :         aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
     510           0 :                         GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, false ) );
     511             : 
     512             :     {
     513             :         const SfxPoolItem* pItem;
     514             :         const SwCntntFrm* pCFrm;
     515             :         const SwTxtNode* pTxtNd;
     516             :         const SwTxtTOXMark* pTxtTOX;
     517           0 :         sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
     518             : 
     519           0 :         for( n = 0; n < nMaxItems; ++n )
     520           0 :             if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
     521           0 :                                         RES_TXTATR_TOXMARK, n ) ) &&
     522           0 :                 0 != (pTxtTOX = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) &&
     523           0 :                 ( pTxtNd = &pTxtTOX->GetTxtNode())->GetNodes().IsDocNodes() &&
     524           0 :                 0 != ( pCFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, 0, false )) &&
     525           0 :                 ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
     526             :             {
     527           0 :                 SwNodeIndex aNdIndex( *pTxtNd ); // UNIX needs this object
     528           0 :                 _SetGetExpFld aCmp( aNdIndex, *pTxtTOX, 0 );
     529           0 :                 aCmp.SetBodyPos( *pCFrm );
     530             : 
     531           0 :                 if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
     532           0 :                           : ( aCmp < aCurGEF && aFndGEF < aCmp ))
     533             :                 {
     534           0 :                     aFndGEF = aCmp;
     535           0 :                     bFnd = true;
     536           0 :                 }
     537             :             }
     538             :     }
     539             : 
     540           0 :     if( bFnd )
     541             :     {
     542           0 :         SET_CURR_SHELL( this );
     543           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     544           0 :         SwCrsrSaveState aSaveState( *m_pCurCrsr );
     545             : 
     546           0 :         aFndGEF.GetPosOfContent( rPos );
     547             : 
     548           0 :         bFnd = !m_pCurCrsr->IsSelOvr();
     549           0 :         if( bFnd )
     550             :             UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
     551           0 :                         SwCrsrShell::READONLY );
     552             :     }
     553           0 :     return bFnd;
     554             : }
     555             : 
     556             : /// traveling between marks
     557           0 : const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart,
     558             :                                             SwTOXSearch eDir )
     559             : {
     560           0 :     SET_CURR_SHELL( this );
     561           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
     562           0 :     SwCrsrSaveState aSaveState( *m_pCurCrsr );
     563             : 
     564             :     const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
     565           0 :                                                     IsReadOnlyAvailable() );
     566             :     // set position
     567           0 :     SwPosition& rPos = *GetCrsr()->GetPoint();
     568           0 :     rPos.nNode = rNewMark.GetTxtTOXMark()->GetTxtNode();
     569           0 :     rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
     570           0 :                          rNewMark.GetTxtTOXMark()->GetStart() );
     571             : 
     572           0 :     if( !m_pCurCrsr->IsSelOvr() )
     573             :         UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
     574           0 :                     SwCrsrShell::READONLY );
     575             : 
     576           0 :     return rNewMark;
     577             : }
     578             : 
     579             : /// jump to next/previous field type
     580           0 : void lcl_MakeFldLst(
     581             :     _SetGetExpFlds& rLst,
     582             :     const SwFieldType& rFldType,
     583             :     const bool bInReadOnly,
     584             :     const bool bChkInpFlag = false )
     585             : {
     586             :     // always search the 1. frame
     587           0 :     Point aPt;
     588           0 :     SwTxtFld* pTxtFld = NULL;
     589           0 :     SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
     590           0 :     for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
     591             :     {
     592           0 :         pTxtFld = pFmtFld->GetTxtFld();
     593           0 :         if ( pTxtFld != NULL
     594           0 :              && ( !bChkInpFlag
     595           0 :                   || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField())->GetInputFlag() ) )
     596             :         {
     597           0 :             const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
     598             :             const SwCntntFrm* pCFrm =
     599           0 :                 rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false );
     600           0 :             if ( pCFrm != NULL
     601           0 :                  && ( bInReadOnly || !pCFrm->IsProtected() ) )
     602             :             {
     603           0 :                 _SetGetExpFld* pNew = new _SetGetExpFld( SwNodeIndex( rTxtNode ), pTxtFld );
     604           0 :                 pNew->SetBodyPos( *pCFrm );
     605           0 :                 rLst.insert( pNew );
     606             :             }
     607             :         }
     608           0 :     }
     609           0 : }
     610             : 
     611             : static _SetGetExpFlds::const_iterator
     612           0 : lcl_FindField(bool & o_rFound, _SetGetExpFlds const& rSrtLst,
     613             :         SwRootFrm *const pLayout, SwTxtNode *const pTxtNode,
     614             :         SwTxtFld *const pTxtFld, SwPosition const& rPos,
     615             :         sal_Int32 const nContentOffset)
     616             : {
     617           0 :     boost::scoped_ptr<_SetGetExpFld> pSrch;
     618           0 :     boost::scoped_ptr<SwIndex> pIndex;
     619           0 :     if (-1 == nContentOffset)
     620             :     {
     621           0 :         pSrch.reset(new _SetGetExpFld(rPos.nNode, pTxtFld, &rPos.nContent));
     622             :     }
     623             :     else
     624             :     {
     625           0 :         pIndex.reset(new SwIndex(rPos.nNode.GetNode().GetCntntNode(), nContentOffset));
     626           0 :         pSrch.reset(new _SetGetExpFld(rPos.nNode, pTxtFld, pIndex.get()));
     627             :     }
     628             : 
     629           0 :     if (rPos.nNode.GetIndex() < pTxtNode->GetNodes().GetEndOfExtras().GetIndex())
     630             :     {
     631             :         // also at collection use only the first frame
     632           0 :         Point aPt;
     633           0 :         pSrch->SetBodyPos(*pTxtNode->getLayoutFrm(pLayout, &aPt, &rPos, false));
     634             :     }
     635             : 
     636           0 :     _SetGetExpFlds::const_iterator it = rSrtLst.lower_bound(pSrch.get());
     637             : 
     638           0 :     o_rFound = (it == rSrtLst.end()) ? false : (**it == *pSrch);
     639           0 :     return it;
     640             : }
     641             : 
     642           0 : bool SwCrsrShell::MoveFldType(
     643             :     const SwFieldType* pFldType,
     644             :     const bool bNext,
     645             :     const sal_uInt16 nResType,
     646             :     const bool bAddSetExpressionFldsToInputFlds )
     647             : {
     648             :     // sorted list of all fields
     649           0 :     _SetGetExpFlds aSrtLst;
     650             : 
     651           0 :     if ( pFldType )
     652             :     {
     653           0 :         if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
     654             :         {
     655           0 :             return false;
     656             :         }
     657             : 
     658             :         // found Modify object, add all fields to array
     659           0 :         ::lcl_MakeFldLst( aSrtLst, *pFldType, IsReadOnlyAvailable() );
     660             : 
     661           0 :         if( RES_INPUTFLD == pFldType->Which() && bAddSetExpressionFldsToInputFlds )
     662             :         {
     663             :             // there are hidden input fields in the set exp. fields
     664           0 :             const SwFldTypes& rFldTypes = *mpDoc->getIDocumentFieldsAccess().GetFldTypes();
     665           0 :             const size_t nSize = rFldTypes.size();
     666           0 :             for( size_t i=0; i < nSize; ++i )
     667             :             {
     668           0 :                 pFldType = rFldTypes[ i ];
     669           0 :                 if ( RES_SETEXPFLD == pFldType->Which() )
     670             :                 {
     671           0 :                     ::lcl_MakeFldLst( aSrtLst, *pFldType, IsReadOnlyAvailable(), true );
     672             :                 }
     673             :             }
     674             :         }
     675             :     }
     676             :     else
     677             :     {
     678           0 :         const SwFldTypes& rFldTypes = *mpDoc->getIDocumentFieldsAccess().GetFldTypes();
     679           0 :         const size_t nSize = rFldTypes.size();
     680           0 :         for( size_t i=0; i < nSize; ++i )
     681             :         {
     682           0 :             pFldType = rFldTypes[ i ];
     683           0 :             if( nResType == pFldType->Which() )
     684             :             {
     685           0 :                 ::lcl_MakeFldLst( aSrtLst, *pFldType, IsReadOnlyAvailable() );
     686             :             }
     687             :         }
     688             :     }
     689             : 
     690             :     // found no fields?
     691           0 :     if( aSrtLst.empty() )
     692           0 :         return false;
     693             : 
     694           0 :     _SetGetExpFlds::const_iterator it;
     695           0 :     SwCursor* pCrsr = getShellCrsr( true );
     696             :     {
     697             :         // (1998): Always use field for search so that the right one is found as
     698             :         // well some are in frames that are anchored to a paragraph that has a
     699             :         // field
     700           0 :         const SwPosition& rPos = *pCrsr->GetPoint();
     701             : 
     702           0 :         SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
     703             :         OSL_ENSURE( pTNd, "No CntntNode" );
     704             : 
     705           0 :         SwTxtFld * pTxtFld = pTNd->GetFldTxtAttrAt( rPos.nContent.GetIndex(), true );
     706           0 :         const bool bDelFld = ( pTxtFld == NULL );
     707           0 :         sal_Int32 nContentOffset = -1;
     708             : 
     709           0 :         if( bDelFld )
     710             :         {
     711             :             // create dummy for the search
     712             :             SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
     713           0 :                 (SwDateTimeFieldType*)mpDoc->getIDocumentFieldsAccess().GetSysFldType( RES_DATETIMEFLD ) ) );
     714             : 
     715           0 :             pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(),
     716           0 :                         mpDoc->IsClipBoard() );
     717           0 :             pTxtFld->ChgTxtNode( pTNd );
     718             :         }
     719             :         else
     720             :         {
     721             :             // the cursor might be anywhere inside the input field,
     722             :             // but we will be searching for the field start
     723           0 :             if (pTxtFld->Which() == RES_TXTATR_INPUTFIELD
     724           0 :                     && rPos.nContent.GetIndex() != pTxtFld->GetStart())
     725           0 :                 nContentOffset = pTxtFld->GetStart();
     726             :         }
     727             :         bool isSrch;
     728             :         it = lcl_FindField(isSrch, aSrtLst,
     729           0 :                 GetLayout(), pTNd, pTxtFld, rPos, nContentOffset);
     730             : 
     731           0 :         if( bDelFld )
     732             :         {
     733           0 :             delete (SwFmtFld*)&pTxtFld->GetAttr();
     734           0 :             delete pTxtFld;
     735             :         }
     736             : 
     737           0 :         if( it != aSrtLst.end() && isSrch ) // found
     738             :         {
     739           0 :             if( bNext )
     740             :             {
     741           0 :                 if( ++it == aSrtLst.end() )
     742           0 :                     return false; // already at the end
     743             :             }
     744             :             else
     745             :             {
     746           0 :                 if( it == aSrtLst.begin() )
     747           0 :                     return false; // no more steps backward possible
     748           0 :                 --it;
     749             :             }
     750             :         }
     751             :         else // not found
     752             :         {
     753           0 :             if( bNext )
     754             :             {
     755           0 :                 if( it == aSrtLst.end() )
     756           0 :                     return false;
     757             :             }
     758             :             else
     759             :             {
     760           0 :                 if( it == aSrtLst.begin() )
     761           0 :                     return false; // no more steps backward possible
     762           0 :                 --it;
     763             :             }
     764             :         }
     765             :     }
     766           0 :     const _SetGetExpFld& rFnd = **it;
     767             : 
     768           0 :     SET_CURR_SHELL( this );
     769           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
     770           0 :     SwCrsrSaveState aSaveState( *pCrsr );
     771             : 
     772           0 :     rFnd.GetPosOfContent( *pCrsr->GetPoint() );
     773             :     bool bRet = !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
     774           0 :                                      nsSwCursorSelOverFlags::SELOVER_TOGGLE );
     775           0 :     if( bRet )
     776           0 :         UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     777           0 :     return bRet;
     778             : }
     779             : 
     780           0 : bool SwCrsrShell::GotoFld( const SwFmtFld& rFld )
     781             : {
     782           0 :     bool bRet = false;
     783           0 :     if( rFld.GetTxtFld() )
     784             :     {
     785           0 :         SET_CURR_SHELL( this );
     786           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     787             : 
     788           0 :         SwCursor* pCrsr = getShellCrsr( true );
     789           0 :         SwCrsrSaveState aSaveState( *pCrsr );
     790             : 
     791           0 :         SwTxtNode* pTNd = (SwTxtNode*)rFld.GetTxtFld()->GetpTxtNode();
     792           0 :         pCrsr->GetPoint()->nNode = *pTNd;
     793           0 :         pCrsr->GetPoint()->nContent.Assign( pTNd, rFld.GetTxtFld()->GetStart() );
     794             : 
     795           0 :         bRet = !pCrsr->IsSelOvr();
     796           0 :         if( bRet )
     797           0 :             UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     798             :     }
     799           0 :     return bRet;
     800             : }
     801             : 
     802      163311 : SwTxtFld * SwCrsrShell::GetTxtFldAtPos(
     803             :     const SwPosition* pPos,
     804             :     const bool bIncludeInputFldAtStart ) const
     805             : {
     806      163311 :     SwTxtFld* pTxtFld = NULL;
     807             : 
     808      163311 :     SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
     809      163311 :     if ( pNode != NULL )
     810             :     {
     811      163311 :         pTxtFld = pNode->GetFldTxtAttrAt( pPos->nContent.GetIndex(), bIncludeInputFldAtStart );
     812             :     }
     813             : 
     814      163311 :     return pTxtFld;
     815             : }
     816             : 
     817        7684 : SwField* SwCrsrShell::GetFieldAtCrsr(
     818             :     const SwPaM* pCrsr,
     819             :     const bool bIncludeInputFldAtStart ) const
     820             : {
     821        7684 :     SwField* pFieldAtCrsr = NULL;
     822             : 
     823        7684 :     SwTxtFld* pTxtFld = GetTxtFldAtPos( pCrsr->Start(), bIncludeInputFldAtStart );
     824        7684 :     if ( pTxtFld != NULL
     825        7684 :         && pCrsr->Start()->nNode == pCrsr->End()->nNode )
     826             :     {
     827             :         const sal_Int32 nTxtFldLength =
     828           0 :             pTxtFld->End() != NULL
     829           0 :             ? *(pTxtFld->End()) - pTxtFld->GetStart()
     830           0 :             : 1;
     831           0 :         if ( ( pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex() ) <= nTxtFldLength )
     832             :         {
     833           0 :             pFieldAtCrsr = (SwField*)pTxtFld->GetFmtFld().GetField();
     834             :         }
     835             :     }
     836             : 
     837        7684 :     return pFieldAtCrsr;
     838             : }
     839             : 
     840         937 : SwField* SwCrsrShell::GetCurFld( const bool bIncludeInputFldAtStart ) const
     841             : {
     842         937 :     SwPaM* pCrsr = GetCrsr();
     843         937 :     if ( pCrsr->GetNext() != pCrsr )
     844             :     {
     845             :         // multi selection not handled.
     846           2 :         return NULL;
     847             :     }
     848             : 
     849         935 :     SwField* pCurFld = GetFieldAtCrsr( pCrsr, bIncludeInputFldAtStart );;
     850         935 :     if ( pCurFld != NULL
     851         935 :          && RES_TABLEFLD == pCurFld->GetTyp()->Which() )
     852             :     {
     853             :         // TabellenFormel ? wandel internen in externen Namen um
     854           0 :         const SwTableNode* pTblNd = IsCrsrInTbl();
     855           0 :         ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
     856             :     }
     857             : 
     858         935 :     return pCurFld;
     859             : }
     860             : 
     861        6671 : bool SwCrsrShell::CrsrInsideInputFld() const
     862             : {
     863        6671 :     bool bCrsrInsideInputFld = false;
     864             : 
     865        6671 :     const SwPaM* pCrsr = GetCrsr();
     866        6671 :     const SwPaM* pFirst = pCrsr;
     867        6749 :     do
     868             :     {
     869        6749 :         bCrsrInsideInputFld = dynamic_cast<const SwInputField*>(GetFieldAtCrsr( pCrsr, false )) != NULL;
     870             : 
     871        6749 :         pCrsr = static_cast<SwPaM*>(pCrsr->GetNext());
     872        6749 :     } while ( !bCrsrInsideInputFld
     873        6749 :               && pCrsr != pFirst );
     874             : 
     875        6671 :     return bCrsrInsideInputFld;
     876             : }
     877             : 
     878           6 : bool SwCrsrShell::PosInsideInputFld( const SwPosition& rPos ) const
     879             : {
     880           6 :     return dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, false )) != NULL;
     881             : }
     882             : 
     883           0 : bool SwCrsrShell::DocPtInsideInputFld( const Point& rDocPt ) const
     884             : {
     885           0 :     SwPosition aPos( *(GetCrsr()->Start()) );
     886           0 :     Point aDocPt( rDocPt );
     887           0 :     if ( GetLayout()->GetCrsrOfst( &aPos, aDocPt ) )
     888             :     {
     889           0 :         return PosInsideInputFld( aPos );
     890             :     }
     891           0 :     return false;
     892             : }
     893             : 
     894           0 : sal_Int32 SwCrsrShell::StartOfInputFldAtPos( const SwPosition& rPos ) const
     895             : {
     896           0 :     const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
     897           0 :     if ( pTxtInputFld == NULL )
     898             :     {
     899             :         OSL_ENSURE( false, "<SwEditShell::StartOfInputFldAtPos(..)> - no Input Field at given position" );
     900           0 :         return 0;
     901             :     }
     902           0 :     return pTxtInputFld->GetStart();
     903             : }
     904             : 
     905           8 : sal_Int32 SwCrsrShell::EndOfInputFldAtPos( const SwPosition& rPos ) const
     906             : {
     907           8 :     const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
     908           8 :     if ( pTxtInputFld == NULL )
     909             :     {
     910             :         OSL_ENSURE( false, "<SwEditShell::EndOfInputFldAtPos(..)> - no Input Field at given position" );
     911           0 :         return 0;
     912             :     }
     913           8 :     return *(pTxtInputFld->End());
     914             : }
     915             : 
     916           0 : void SwCrsrShell::GotoOutline( sal_uInt16 nIdx )
     917             : {
     918           0 :     SwCursor* pCrsr = getShellCrsr( true );
     919             : 
     920           0 :     SET_CURR_SHELL( this );
     921           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
     922           0 :     SwCrsrSaveState aSaveState( *pCrsr );
     923             : 
     924           0 :     const SwNodes& rNds = GetDoc()->GetNodes();
     925           0 :     SwTxtNode* pTxtNd = (SwTxtNode*)rNds.GetOutLineNds()[ nIdx ]->GetTxtNode();
     926           0 :     pCrsr->GetPoint()->nNode = *pTxtNd;
     927           0 :     pCrsr->GetPoint()->nContent.Assign( pTxtNd, 0 );
     928             : 
     929           0 :     if( !pCrsr->IsSelOvr() )
     930           0 :         UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     931           0 : }
     932             : 
     933           0 : bool SwCrsrShell::GotoOutline( const OUString& rName )
     934             : {
     935           0 :     SwCursor* pCrsr = getShellCrsr( true );
     936             : 
     937           0 :     SET_CURR_SHELL( this );
     938           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
     939           0 :     SwCrsrSaveState aSaveState( *pCrsr );
     940             : 
     941           0 :     bool bRet = false;
     942           0 :     if( mpDoc->GotoOutline( *pCrsr->GetPoint(), rName ) && !pCrsr->IsSelOvr() )
     943             :     {
     944           0 :         UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     945           0 :         bRet = true;
     946             :     }
     947           0 :     return bRet;
     948             : }
     949             : 
     950             : /// jump to next node with outline num.
     951           0 : bool SwCrsrShell::GotoNextOutline()
     952             : {
     953           0 :     SwCursor* pCrsr = getShellCrsr( true );
     954           0 :     const SwNodes& rNds = GetDoc()->GetNodes();
     955             : 
     956           0 :     SwNode* pNd = &(pCrsr->GetNode());
     957             :     sal_uInt16 nPos;
     958           0 :     if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
     959           0 :         ++nPos;
     960             : 
     961           0 :     if( nPos == rNds.GetOutLineNds().size() )
     962           0 :         return false;
     963             : 
     964           0 :     pNd = rNds.GetOutLineNds()[ nPos ];
     965             : 
     966           0 :     SET_CURR_SHELL( this );
     967           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
     968           0 :     SwCrsrSaveState aSaveState( *pCrsr );
     969           0 :     pCrsr->GetPoint()->nNode = *pNd;
     970           0 :     pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
     971             : 
     972           0 :     bool bRet = !pCrsr->IsSelOvr();
     973           0 :     if( bRet )
     974           0 :         UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
     975           0 :     return bRet;
     976             : }
     977             : 
     978             : /// jump to previous node with outline num.
     979           0 : bool SwCrsrShell::GotoPrevOutline()
     980             : {
     981           0 :     SwCursor* pCrsr = getShellCrsr( true );
     982           0 :     const SwNodes& rNds = GetDoc()->GetNodes();
     983             : 
     984           0 :     SwNode* pNd = &(pCrsr->GetNode());
     985             :     sal_uInt16 nPos;
     986           0 :     rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
     987             : 
     988           0 :     bool bRet = false;
     989           0 :     if( nPos )
     990             :     {
     991           0 :         --nPos; // before
     992             : 
     993           0 :         pNd = rNds.GetOutLineNds()[ nPos ];
     994           0 :         if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() )
     995           0 :             return false;
     996             : 
     997           0 :         SET_CURR_SHELL( this );
     998           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
     999           0 :         SwCrsrSaveState aSaveState( *pCrsr );
    1000           0 :         pCrsr->GetPoint()->nNode = *pNd;
    1001           0 :         pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
    1002             : 
    1003           0 :         bRet = !pCrsr->IsSelOvr();
    1004           0 :         if( bRet )
    1005           0 :             UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
    1006             :     }
    1007           0 :     return bRet;
    1008             : }
    1009             : 
    1010             : /// search "outline position" before previous outline node at given level
    1011           0 : sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel )
    1012             : {
    1013           0 :     SwPaM* pCrsr = getShellCrsr( true );
    1014           0 :     const SwNodes& rNds = GetDoc()->GetNodes();
    1015             : 
    1016           0 :     SwNode* pNd = &(pCrsr->GetNode());
    1017             :     sal_uInt16 nPos;
    1018           0 :     if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
    1019           0 :         nPos++; // is at correct position; take next for while
    1020             : 
    1021           0 :     while( nPos-- ) // check the one in front of the current
    1022             :     {
    1023           0 :         pNd = rNds.GetOutLineNds()[ nPos ];
    1024             : 
    1025           0 :         if( ((SwTxtNode*)pNd)->GetAttrOutlineLevel()-1 <= nLevel )
    1026           0 :             return nPos;
    1027             : 
    1028             :     }
    1029           0 :     return USHRT_MAX; // no more left
    1030             : }
    1031             : 
    1032           0 : bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
    1033             :                                   bool bWithChildren )
    1034             : {
    1035           0 :     const SwNodes& rNds = GetDoc()->GetNodes();
    1036           0 :     const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
    1037           0 :     if( rOutlNds.empty() )
    1038           0 :         return false;
    1039             : 
    1040           0 :     SET_CURR_SHELL( this );
    1041           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
    1042             : 
    1043           0 :     if( nSttPos > nEndPos ) // parameters switched?
    1044             :     {
    1045             :         OSL_ENSURE( false, "Start > End for array access" );
    1046           0 :         sal_uInt16 nTmp = nSttPos;
    1047           0 :         nSttPos = nEndPos;
    1048           0 :         nEndPos = nTmp;
    1049             :     }
    1050             : 
    1051           0 :     SwNode* pSttNd = rOutlNds[ nSttPos ];
    1052           0 :     SwNode* pEndNd = rOutlNds[ nEndPos ];
    1053             : 
    1054           0 :     if( bWithChildren )
    1055             :     {
    1056           0 :         const int nLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;
    1057           0 :         for( ++nEndPos; nEndPos < rOutlNds.size(); ++nEndPos )
    1058             :         {
    1059           0 :             pEndNd = rOutlNds[ nEndPos ];
    1060           0 :             const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;
    1061           0 :             if( nNxtLevel <= nLevel )
    1062           0 :                 break; // EndPos is now on the next one
    1063             :         }
    1064             :     }
    1065             :     // if without children then set onto next one
    1066           0 :     else if( ++nEndPos < rOutlNds.size() )
    1067           0 :         pEndNd = rOutlNds[ nEndPos ];
    1068             : 
    1069           0 :     if( nEndPos == rOutlNds.size() ) // no end found
    1070           0 :         pEndNd = &rNds.GetEndOfContent();
    1071             : 
    1072           0 :     KillPams();
    1073             : 
    1074           0 :     SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1075             : 
    1076             :     // set end to the end of the previous content node
    1077           0 :     m_pCurCrsr->GetPoint()->nNode = *pSttNd;
    1078           0 :     m_pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetCntntNode(), 0 );
    1079           0 :     m_pCurCrsr->SetMark();
    1080           0 :     m_pCurCrsr->GetPoint()->nNode = *pEndNd;
    1081           0 :     m_pCurCrsr->Move( fnMoveBackward, fnGoNode ); // end of predecessor
    1082             : 
    1083             :     // and everything is already selected
    1084           0 :     bool bRet = !m_pCurCrsr->IsSelOvr();
    1085           0 :     if( bRet )
    1086           0 :         UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
    1087           0 :     return bRet;
    1088             : }
    1089             : 
    1090             : /// jump to reference marker
    1091           0 : bool SwCrsrShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
    1092             :                                     sal_uInt16 nSeqNo )
    1093             : {
    1094           0 :     SET_CURR_SHELL( this );
    1095           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
    1096           0 :     SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1097             : 
    1098           0 :     sal_Int32 nPos = -1;
    1099             :     SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
    1100           0 :                                                     nSubType, nSeqNo, &nPos );
    1101           0 :     if( pTxtNd && pTxtNd->GetNodes().IsDocNodes() )
    1102             :     {
    1103           0 :         m_pCurCrsr->GetPoint()->nNode = *pTxtNd;
    1104           0 :         m_pCurCrsr->GetPoint()->nContent.Assign( pTxtNd, nPos );
    1105             : 
    1106           0 :         if( !m_pCurCrsr->IsSelOvr() )
    1107             :         {
    1108           0 :             UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
    1109           0 :             return true;
    1110             :         }
    1111             :     }
    1112           0 :     return false;
    1113             : }
    1114             : 
    1115        3638 : bool SwCrsrShell::IsPageAtPos( const Point &rPt ) const
    1116             : {
    1117        3638 :     if( GetLayout() )
    1118        3638 :         return 0 != GetLayout()->GetPageAtPos( rPt );
    1119           0 :     return false;
    1120             : }
    1121             : 
    1122           6 : bool SwCrsrShell::GetContentAtPos( const Point& rPt,
    1123             :                                    SwContentAtPos& rCntntAtPos,
    1124             :                                    bool bSetCrsr,
    1125             :                                    SwRect* pFldRect )
    1126             : {
    1127           6 :     SET_CURR_SHELL( this );
    1128           6 :     bool bRet = false;
    1129             : 
    1130           6 :     if( !IsTableMode() )
    1131             :     {
    1132           6 :         Point aPt( rPt );
    1133           6 :         SwPosition aPos( *m_pCurCrsr->GetPoint() );
    1134             : 
    1135             :         SwTxtNode* pTxtNd;
    1136           6 :         SwCntntFrm *pFrm(0);
    1137             :         SwTxtAttr* pTxtAttr;
    1138           6 :         SwCrsrMoveState aTmpState;
    1139           6 :         aTmpState.bFieldInfo = true;
    1140           6 :         aTmpState.bExactOnly = !( SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos );
    1141           6 :         aTmpState.bCntntCheck = (SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos) ?  sal_True : sal_False;
    1142           6 :         aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
    1143             : 
    1144           6 :         SwSpecialPos aSpecialPos;
    1145           6 :         aTmpState.pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos ) ?
    1146           6 :                                 &aSpecialPos : 0;
    1147             : 
    1148           6 :         const bool bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
    1149           6 :         pTxtNd = aPos.nNode.GetNode().GetTxtNode();
    1150             : 
    1151           6 :         const SwNodes& rNds = GetDoc()->GetNodes();
    1152           6 :         if( pTxtNd
    1153           6 :             && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
    1154           6 :             && !rNds.GetOutLineNds().empty() )
    1155             :         {
    1156           0 :             const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
    1157           0 :             if( pONd )
    1158             :             {
    1159           0 :                 rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
    1160           0 :                 rCntntAtPos.sStr = pONd->GetExpandTxt( 0, -1, true, true );
    1161           0 :                 bRet = true;
    1162             :             }
    1163             :         }
    1164           6 :         else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos
    1165           0 :                   && bCrsrFoundExact )
    1166             :         {
    1167           0 :             bRet = true;
    1168             :         }
    1169           6 :         else if( pTxtNd
    1170           6 :                  && SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
    1171             :         {
    1172           0 :             bRet = aTmpState.bInNumPortion;
    1173           0 :             rCntntAtPos.aFnd.pNode = pTxtNd;
    1174             : 
    1175           0 :             Size aSizeLogic(aTmpState.nInNumPostionOffset, 0);
    1176           0 :             Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
    1177           0 :             rCntntAtPos.nDist = aSizePixel.Width();
    1178             :         }
    1179           6 :         else if( bCrsrFoundExact && pTxtNd )
    1180             :         {
    1181           2 :             if( !aTmpState.bPosCorr )
    1182             :             {
    1183           0 :                 if ( !bRet
    1184           0 :                      && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
    1185           0 :                      && !aTmpState.bFtnNoInfo )
    1186             :                 {
    1187           0 :                     const SwWrongList* pSmartTagList = pTxtNd->GetSmartTags();
    1188           0 :                     sal_Int32 nCurrent = aPos.nContent.GetIndex();
    1189           0 :                     const sal_Int32 nBegin = nCurrent;
    1190           0 :                     sal_Int32 nLen = 1;
    1191             : 
    1192           0 :                     if ( pSmartTagList && pSmartTagList->InWrongWord( nCurrent, nLen ) && !pTxtNd->IsSymbol(nBegin) )
    1193             :                     {
    1194           0 :                         const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
    1195           0 :                         const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
    1196           0 :                         if ( pSubList )
    1197             :                         {
    1198           0 :                             nCurrent = aTmpState.pSpecialPos->nCharOfst;
    1199             : 
    1200           0 :                             if ( pSubList->InWrongWord( nCurrent, nLen ) )
    1201           0 :                                 bRet = true;
    1202             :                         }
    1203             :                         else
    1204           0 :                             bRet = true;
    1205             : 
    1206           0 :                         if( bRet && bSetCrsr )
    1207             :                         {
    1208           0 :                             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1209           0 :                             SwCallLink aLk( *this ); // watch Crsr-Moves
    1210           0 :                             m_pCurCrsr->DeleteMark();
    1211           0 :                             *m_pCurCrsr->GetPoint() = aPos;
    1212           0 :                             if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
    1213           0 :                                 bRet = false;
    1214             :                             else
    1215           0 :                                 UpdateCrsr();
    1216             :                         }
    1217           0 :                         if( bRet )
    1218             :                         {
    1219           0 :                             rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_SMARTTAG;
    1220             : 
    1221           0 :                             if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
    1222           0 :                                 pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
    1223             :                         }
    1224             :                     }
    1225             :                 }
    1226             : 
    1227           0 :                 if ( !bRet
    1228           0 :                      && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD ) & rCntntAtPos.eCntntAtPos
    1229           0 :                      && !aTmpState.bFtnNoInfo )
    1230             :                 {
    1231           0 :                     pTxtAttr = pTxtNd->GetFldTxtAttrAt( aPos.nContent.GetIndex() );
    1232             :                     const SwField* pFld = pTxtAttr != NULL
    1233           0 :                                           ? pTxtAttr->GetFmtFld().GetField()
    1234           0 :                                           : 0;
    1235           0 :                     if ( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos
    1236           0 :                          && pFld && !pFld->HasClickHdl() )
    1237             :                     {
    1238           0 :                         pFld = 0;
    1239             :                     }
    1240             : 
    1241           0 :                     if ( pFld )
    1242             :                     {
    1243           0 :                         if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
    1244           0 :                             pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
    1245             : 
    1246           0 :                         if( bSetCrsr )
    1247             :                         {
    1248           0 :                             SwCallLink aLk( *this ); // watch Crsr-Moves
    1249           0 :                             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1250           0 :                             m_pCurCrsr->DeleteMark();
    1251           0 :                             *m_pCurCrsr->GetPoint() = aPos;
    1252           0 :                             if( m_pCurCrsr->IsSelOvr() )
    1253             :                             {
    1254             :                                 // allow click fields in protected sections
    1255             :                                 // only placeholder is not possible
    1256           0 :                                 if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
    1257           0 :                                     || RES_JUMPEDITFLD == pFld->Which() )
    1258           0 :                                     pFld = 0;
    1259             :                             }
    1260             :                             else
    1261           0 :                                 UpdateCrsr();
    1262             :                         }
    1263           0 :                         else if( RES_TABLEFLD == pFld->Which() &&
    1264           0 :                             ((SwTblField*)pFld)->IsIntrnlName() )
    1265             :                         {
    1266             :                             // create from internal (for CORE) the external
    1267             :                             // (for UI) formula
    1268           0 :                             const SwTableNode* pTblNd = pTxtNd->FindTableNode();
    1269           0 :                             if( pTblNd )        // steht in einer Tabelle
    1270           0 :                                 ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
    1271             :                         }
    1272             :                     }
    1273             : 
    1274           0 :                     if( pFld )
    1275             :                     {
    1276           0 :                         rCntntAtPos.aFnd.pFld = pFld;
    1277           0 :                         rCntntAtPos.pFndTxtAttr = pTxtAttr;
    1278           0 :                         rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
    1279           0 :                         bRet = true;
    1280             :                     }
    1281             :                 }
    1282             : 
    1283           0 :                 if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
    1284             :                 {
    1285           0 :                     IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
    1286           0 :                     sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
    1287           0 :                     if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
    1288           0 :                         rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
    1289           0 :                         rCntntAtPos.aFnd.pFldmark = pFldBookmark;
    1290           0 :                         bRet=true;
    1291             :                     }
    1292             :                 }
    1293             : 
    1294           0 :                 if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
    1295             :                 {
    1296           0 :                     if( aTmpState.bFtnNoInfo )
    1297             :                     {
    1298             :                         // over the footnote's char
    1299           0 :                         bRet = true;
    1300           0 :                         if( bSetCrsr )
    1301             :                         {
    1302           0 :                             *m_pCurCrsr->GetPoint() = aPos;
    1303           0 :                             if( !GotoFtnAnchor() )
    1304           0 :                                 bRet = false;
    1305             :                         }
    1306           0 :                         if( bRet )
    1307           0 :                             rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
    1308             :                     }
    1309           0 :                     else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
    1310           0 :                         aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
    1311             :                     {
    1312           0 :                         bRet = true;
    1313           0 :                         if( bSetCrsr )
    1314             :                         {
    1315           0 :                             SwCallLink aLk( *this ); // watch Crsr-Moves
    1316           0 :                             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1317           0 :                             m_pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
    1318           0 :                             SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
    1319           0 :                                 &m_pCurCrsr->GetPoint()->nNode,
    1320           0 :                                 true, !IsReadOnlyAvailable() );
    1321             : 
    1322           0 :                             if( pCNd )
    1323             :                             {
    1324           0 :                                 m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
    1325           0 :                                 if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
    1326           0 :                                     nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
    1327           0 :                                     bRet = false;
    1328             :                                 else
    1329           0 :                                     UpdateCrsr();
    1330             :                             }
    1331             :                             else
    1332           0 :                                 bRet = false;
    1333             :                         }
    1334             : 
    1335           0 :                         if( bRet )
    1336             :                         {
    1337           0 :                             rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
    1338           0 :                             rCntntAtPos.pFndTxtAttr = pTxtAttr;
    1339           0 :                             rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
    1340             : 
    1341           0 :                             if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
    1342           0 :                                 pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
    1343             :                         }
    1344             :                     }
    1345             :                 }
    1346             : 
    1347           0 :                 if( !bRet
    1348           0 :                     && ( SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK ) & rCntntAtPos.eCntntAtPos
    1349           0 :                     && !aTmpState.bFtnNoInfo )
    1350             :                 {
    1351           0 :                     pTxtAttr = 0;
    1352           0 :                     if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
    1353             :                     {
    1354             :                         ::std::vector<SwTxtAttr *> const marks(
    1355             :                             pTxtNd->GetTxtAttrsAt(
    1356           0 :                                aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
    1357           0 :                         if (marks.size())
    1358             :                         {   // hmm... can only return 1 here
    1359           0 :                             pTxtAttr = *marks.begin();
    1360           0 :                         }
    1361             :                     }
    1362             : 
    1363           0 :                     if( !pTxtAttr &&
    1364           0 :                         SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
    1365             :                     {
    1366             :                         ::std::vector<SwTxtAttr *> const marks(
    1367             :                             pTxtNd->GetTxtAttrsAt(
    1368           0 :                                aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
    1369           0 :                         if (marks.size())
    1370             :                         {   // hmm... can only return 1 here
    1371           0 :                             pTxtAttr = *marks.begin();
    1372           0 :                         }
    1373             :                     }
    1374             : 
    1375           0 :                     if( pTxtAttr )
    1376             :                     {
    1377           0 :                         bRet = true;
    1378           0 :                         if( bSetCrsr )
    1379             :                         {
    1380           0 :                             SwCallLink aLk( *this ); // watch Crsr-Moves
    1381           0 :                             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1382           0 :                             m_pCurCrsr->DeleteMark();
    1383           0 :                             *m_pCurCrsr->GetPoint() = aPos;
    1384           0 :                             if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
    1385           0 :                                 bRet = false;
    1386             :                             else
    1387           0 :                                 UpdateCrsr();
    1388             :                         }
    1389             : 
    1390           0 :                         if( bRet )
    1391             :                         {
    1392           0 :                             const sal_Int32* pEnd = pTxtAttr->GetEnd();
    1393           0 :                             if( pEnd )
    1394           0 :                                 rCntntAtPos.sStr =
    1395           0 :                                     pTxtNd->GetExpandTxt( pTxtAttr->GetStart(), *pEnd - pTxtAttr->GetStart() );
    1396           0 :                             else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
    1397           0 :                                 rCntntAtPos.sStr =
    1398           0 :                                     pTxtAttr->GetTOXMark().GetAlternativeText();
    1399             : 
    1400             :                             rCntntAtPos.eCntntAtPos =
    1401           0 :                                 RES_TXTATR_TOXMARK == pTxtAttr->Which()
    1402             :                                 ? SwContentAtPos::SW_TOXMARK
    1403           0 :                                 : SwContentAtPos::SW_REFMARK;
    1404           0 :                             rCntntAtPos.pFndTxtAttr = pTxtAttr;
    1405           0 :                             rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
    1406             : 
    1407           0 :                             if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
    1408           0 :                                 pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
    1409             :                         }
    1410             :                     }
    1411             :                 }
    1412             : 
    1413           0 :                 if ( !bRet
    1414           0 :                      && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
    1415           0 :                      && !aTmpState.bFtnNoInfo )
    1416             :                 {
    1417             :                     pTxtAttr = pTxtNd->GetTxtAttrAt(
    1418           0 :                             aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
    1419             :                     // "detect" only INetAttrs with URLs
    1420           0 :                     if( pTxtAttr && !pTxtAttr->GetINetFmt().GetValue().isEmpty() )
    1421             :                     {
    1422           0 :                         bRet = true;
    1423           0 :                         if( bSetCrsr )
    1424             :                         {
    1425           0 :                             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1426           0 :                             SwCallLink aLk( *this ); // watch Crsr-Moves
    1427           0 :                             m_pCurCrsr->DeleteMark();
    1428           0 :                             *m_pCurCrsr->GetPoint() = aPos;
    1429           0 :                             if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
    1430           0 :                                 nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
    1431           0 :                                 bRet = false;
    1432             :                             else
    1433           0 :                                 UpdateCrsr();
    1434             :                         }
    1435           0 :                         if( bRet )
    1436             :                         {
    1437           0 :                             rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
    1438           0 :                                 pTxtAttr->GetStart(),
    1439           0 :                                 *pTxtAttr->GetEnd() - pTxtAttr->GetStart() );
    1440             : 
    1441           0 :                             rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
    1442           0 :                             rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
    1443           0 :                             rCntntAtPos.pFndTxtAttr = pTxtAttr;
    1444             : 
    1445           0 :                             if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
    1446           0 :                                 pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
    1447             :                         }
    1448             :                     }
    1449             :                 }
    1450             : 
    1451           0 :                 if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
    1452             :                 {
    1453           0 :                     const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, NULL);
    1454           0 :                     if( pRedl )
    1455             :                     {
    1456           0 :                         rCntntAtPos.aFnd.pRedl = pRedl;
    1457           0 :                         rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
    1458           0 :                         rCntntAtPos.pFndTxtAttr = 0;
    1459           0 :                         bRet = true;
    1460             : 
    1461           0 :                         if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
    1462           0 :                             pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
    1463             :                     }
    1464             :                 }
    1465             :             }
    1466             : 
    1467           2 :             if( !bRet
    1468           2 :                  && ( SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
    1469             : #ifdef DBG_UTIL
    1470             :                       || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
    1471             : #endif
    1472             :                 ) )
    1473             :             {
    1474             :                 const SwTableNode* pTblNd;
    1475             :                 const SwTableBox* pBox;
    1476           0 :                 const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
    1477             :                 const SfxPoolItem* pItem;
    1478           0 :                 if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
    1479           0 :                     0 != ( pBox = pTblNd->GetTable().GetTblBox(
    1480           0 :                     pSttNd->GetIndex() )) &&
    1481             : #ifdef DBG_UTIL
    1482             :                     ( SfxItemState::SET == pBox->GetFrmFmt()->GetItemState(
    1483             :                     RES_BOXATR_FORMULA, false, &pItem ) ||
    1484             :                     SfxItemState::SET == pBox->GetFrmFmt()->GetItemState(
    1485             :                     RES_BOXATR_VALUE, false, &pItem ))
    1486             : #else
    1487           0 :                     SfxItemState::SET == pBox->GetFrmFmt()->GetItemState(
    1488           0 :                     RES_BOXATR_FORMULA, false, &pItem )
    1489             : #endif
    1490             :                     )
    1491             :                 {
    1492           0 :                     SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt );
    1493           0 :                     if( pF )
    1494             :                     {
    1495             :                         // then the CellFrame
    1496           0 :                         pFrm = (SwCntntFrm*)pF;
    1497           0 :                         while( pF && !pF->IsCellFrm() )
    1498           0 :                             pF = pF->GetUpper();
    1499             :                     }
    1500             : 
    1501           0 :                     if( aTmpState.bPosCorr )
    1502             :                     {
    1503           0 :                         if( pF && !pF->Frm().IsInside( aPt ))
    1504           0 :                             pF = 0;
    1505             :                     }
    1506           0 :                     else if( !pF )
    1507           0 :                         pF = pFrm;
    1508             : 
    1509           0 :                     if( pF ) // only then it is valid
    1510             :                     {
    1511             :                         // create from internal (for CORE) the external
    1512             :                         // (for UI) formula
    1513           0 :                         rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
    1514             : #ifdef DBG_UTIL
    1515             :                         if( RES_BOXATR_VALUE == pItem->Which() )
    1516             :                             rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
    1517             :                         else
    1518             : #endif
    1519           0 :                             ((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
    1520             : 
    1521           0 :                         bRet = true;
    1522           0 :                         if( bSetCrsr )
    1523             :                         {
    1524           0 :                             SwCallLink aLk( *this ); // watch Crsr-Moves
    1525           0 :                             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1526           0 :                             *m_pCurCrsr->GetPoint() = aPos;
    1527           0 :                             if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
    1528           0 :                                 nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
    1529           0 :                                 bRet = false;
    1530             :                             else
    1531           0 :                                 UpdateCrsr();
    1532             :                         }
    1533             : 
    1534           0 :                         if( bRet )
    1535             :                         {
    1536           0 :                             if( pFldRect )
    1537             :                             {
    1538           0 :                                 *pFldRect = pF->Prt();
    1539           0 :                                 *pFldRect += pF->Frm().Pos();
    1540             :                             }
    1541           0 :                             rCntntAtPos.pFndTxtAttr = 0;
    1542           0 :                             rCntntAtPos.aFnd.pAttr = pItem;
    1543             :                         }
    1544             :                     }
    1545             :                 }
    1546             :             }
    1547             : 
    1548             : #ifdef DBG_UTIL
    1549             :             if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
    1550             :             {
    1551             :                 const sal_Int32 n = aPos.nContent.GetIndex();
    1552             :                 SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
    1553             :                     POOLATTR_END - 1 );
    1554             :                 if( pTxtNd->GetpSwpHints() )
    1555             :                 {
    1556             :                     for( size_t i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
    1557             :                     {
    1558             :                         const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
    1559             :                         const sal_Int32 nAttrStart = pHt->GetStart();
    1560             :                         if( nAttrStart > n ) // over the section
    1561             :                             break;
    1562             : 
    1563             :                         if( 0 != pHt->End() && (
    1564             :                             ( nAttrStart < n &&
    1565             :                             ( pHt->DontExpand() ? n < *pHt->End()
    1566             :                             : n <= *pHt->End() )) ||
    1567             :                             ( n == nAttrStart &&
    1568             :                             ( nAttrStart == *pHt->End() || !n ))) )
    1569             :                         {
    1570             :                             aSet.Put( pHt->GetAttr() );
    1571             :                         }
    1572             :                     }
    1573             :                     if( pTxtNd->HasSwAttrSet() &&
    1574             :                         pTxtNd->GetpSwAttrSet()->Count() )
    1575             :                     {
    1576             :                         SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
    1577             :                         // remove all from format set that are also in TextSet
    1578             :                         aFmtSet.Differentiate( aSet );
    1579             :                         // now merge all together
    1580             :                         aSet.Put( aFmtSet );
    1581             :                     }
    1582             :                 }
    1583             :                 else
    1584             :                     pTxtNd->SwCntntNode::GetAttr( aSet );
    1585             : 
    1586             :                 rCntntAtPos.sStr = "Pos: (";
    1587             :                 rCntntAtPos.sStr += OUString::number( aPos.nNode.GetIndex());
    1588             :                 rCntntAtPos.sStr += ":";
    1589             :                 rCntntAtPos.sStr += OUString::number( aPos.nContent.GetIndex());
    1590             :                 rCntntAtPos.sStr += ")";
    1591             :                 rCntntAtPos.sStr += "\nAbs.Vorl.: "; // translation *might be* "paragraph template"
    1592             :                 rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
    1593             :                 if( pTxtNd->GetCondFmtColl() )
    1594             :                 {
    1595             :                      // translation *might be* "conditional template"
    1596             :                     rCntntAtPos.sStr += "\nBed.Vorl.: " + pTxtNd->GetCondFmtColl()->GetName();
    1597             :                 }
    1598             : 
    1599             :                 if( aSet.Count() )
    1600             :                 {
    1601             :                     OUString sAttrs;
    1602             :                     SfxItemIter aIter( aSet );
    1603             :                     const SfxPoolItem* pItem = aIter.FirstItem();
    1604             :                     while( true )
    1605             :                     {
    1606             :                         if( !IsInvalidItem( pItem ))
    1607             :                         {
    1608             :                             OUString aStr;
    1609             :                             GetDoc()->GetAttrPool().GetPresentation( *pItem,
    1610             :                                 SFX_MAPUNIT_CM, aStr );
    1611             :                             if (!sAttrs.isEmpty())
    1612             :                                 sAttrs += ", ";
    1613             :                             sAttrs += aStr;
    1614             :                         }
    1615             :                         if( aIter.IsAtEnd() )
    1616             :                             break;
    1617             :                         pItem = aIter.NextItem();
    1618             :                     }
    1619             :                     if (!sAttrs.isEmpty())
    1620             :                     {
    1621             :                         if( !rCntntAtPos.sStr.isEmpty() )
    1622             :                             rCntntAtPos.sStr += "\n";
    1623             :                         rCntntAtPos.sStr += "Attr: " + sAttrs;
    1624             :                     }
    1625             :                 }
    1626             :                 bRet = true;
    1627             :                 rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
    1628             :             }
    1629             : #endif
    1630           6 :         }
    1631             :     }
    1632             : 
    1633           6 :     if( !bRet )
    1634             :     {
    1635           6 :         rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
    1636           6 :         rCntntAtPos.aFnd.pFld = 0;
    1637             :     }
    1638           6 :     return bRet;
    1639             : }
    1640             : 
    1641             : // #i90516#
    1642       24734 : const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
    1643             : {
    1644       24734 :     const SwPostItField* pPostItFld = 0;
    1645             : 
    1646       24734 :     if ( !IsTableMode() )
    1647             :     {
    1648       24710 :         const SwPosition* pCursorPos = _GetCrsr()->GetPoint();
    1649       24710 :         const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
    1650       24710 :         if ( pTxtNd )
    1651             :         {
    1652       24710 :             SwTxtAttr* pTxtAttr = pTxtNd->GetFldTxtAttrAt( pCursorPos->nContent.GetIndex() );
    1653       24710 :             const SwField* pFld = pTxtAttr != NULL ? pTxtAttr->GetFmtFld().GetField() : 0;
    1654       24710 :             if ( pFld && pFld->Which()== RES_POSTITFLD )
    1655             :             {
    1656          18 :                 pPostItFld = static_cast<const SwPostItField*>(pFld);
    1657             :             }
    1658             :         }
    1659             :     }
    1660             : 
    1661       24734 :     return pPostItFld;
    1662             : }
    1663             : 
    1664             : /// is the node in a protected section?
    1665           0 : bool SwContentAtPos::IsInProtectSect() const
    1666             : {
    1667           0 :     const SwTxtNode* pNd = 0;
    1668           0 :     if( pFndTxtAttr )
    1669             :     {
    1670           0 :         switch( eCntntAtPos )
    1671             :         {
    1672             :         case SW_FIELD:
    1673             :         case SW_CLICKFIELD:
    1674           0 :             pNd = static_txtattr_cast<SwTxtFld const*>(pFndTxtAttr)->GetpTxtNode();
    1675           0 :             break;
    1676             : 
    1677             :         case SW_FTN:
    1678           0 :             pNd = &((SwTxtFtn*)pFndTxtAttr)->GetTxtNode();
    1679           0 :             break;
    1680             : 
    1681             :         case SW_INETATTR:
    1682           0 :             pNd = static_txtattr_cast<SwTxtINetFmt const*>(pFndTxtAttr)->GetpTxtNode();
    1683           0 :             break;
    1684             : 
    1685             :         default:
    1686           0 :             break;
    1687             :         }
    1688             :     }
    1689             : 
    1690             :     const SwCntntFrm* pFrm;
    1691           0 :     return pNd && ( pNd->IsInProtectSect() ||
    1692           0 :                     ( 0 != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false)) &&
    1693           0 :                         pFrm->IsProtected() ));
    1694             : }
    1695             : 
    1696           0 : bool SwContentAtPos::IsInRTLText()const
    1697             : {
    1698           0 :     bool bRet = false;
    1699           0 :     const SwTxtNode* pNd = 0;
    1700           0 :     if (pFndTxtAttr && (eCntntAtPos == SW_FTN))
    1701             :     {
    1702           0 :         const SwTxtFtn* pTxtFtn = static_cast<const SwTxtFtn*>(pFndTxtAttr);
    1703           0 :         if(pTxtFtn->GetStartNode())
    1704             :         {
    1705           0 :             SwStartNode* pSttNd = pTxtFtn->GetStartNode()->GetNode().GetStartNode();
    1706           0 :             SwPaM aTemp( *pSttNd );
    1707           0 :             aTemp.Move(fnMoveForward, fnGoNode);
    1708           0 :             SwCntntNode* pCntntNode = aTemp.GetCntntNode();
    1709           0 :             if(pCntntNode && pCntntNode->IsTxtNode())
    1710           0 :                 pNd = static_cast<SwTxtNode*>(pCntntNode);
    1711             :         }
    1712             :     }
    1713           0 :     if(pNd)
    1714             :     {
    1715           0 :         SwIterator<SwTxtFrm,SwTxtNode> aIter(*pNd);
    1716           0 :         SwTxtFrm* pTmpFrm = aIter.First();
    1717           0 :         while( pTmpFrm )
    1718             :         {
    1719           0 :                 if ( !pTmpFrm->IsFollow())
    1720             :                 {
    1721           0 :                     bRet = pTmpFrm->IsRightToLeft();
    1722           0 :                     break;
    1723             :                 }
    1724           0 :             pTmpFrm = aIter.Next();
    1725           0 :         }
    1726             :     }
    1727           0 :     return bRet;
    1728             : }
    1729             : 
    1730           0 : bool SwCrsrShell::SelectTxt( const sal_Int32 nStart,
    1731             :                                  const sal_Int32 nEnd )
    1732             : {
    1733           0 :     SET_CURR_SHELL( this );
    1734           0 :     bool bRet = false;
    1735             : 
    1736           0 :     SwCallLink aLk( *this );
    1737           0 :     SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1738             : 
    1739           0 :     SwPosition& rPos = *m_pCurCrsr->GetPoint();
    1740           0 :     m_pCurCrsr->DeleteMark();
    1741           0 :     rPos.nContent = nStart;
    1742           0 :     m_pCurCrsr->SetMark();
    1743           0 :     rPos.nContent = nEnd;
    1744             : 
    1745           0 :     if( !m_pCurCrsr->IsSelOvr() )
    1746             :     {
    1747           0 :         UpdateCrsr();
    1748           0 :         bRet = true;
    1749             :     }
    1750             : 
    1751           0 :     return bRet;
    1752             : }
    1753             : 
    1754           0 : bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich,
    1755             :                                      bool bExpand,
    1756             :                                      const SwTxtAttr* pTxtAttr )
    1757             : {
    1758           0 :     SET_CURR_SHELL( this );
    1759           0 :     bool bRet = false;
    1760             : 
    1761           0 :     if( !IsTableMode() )
    1762             :     {
    1763           0 :         if( !pTxtAttr )
    1764             :         {
    1765           0 :             SwPosition& rPos = *m_pCurCrsr->GetPoint();
    1766           0 :             SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
    1767             :             pTxtAttr = (pTxtNd)
    1768             :                 ? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
    1769             :                         static_cast<RES_TXTATR>(nWhich),
    1770           0 :                         (bExpand) ? SwTxtNode::EXPAND : SwTxtNode::DEFAULT)
    1771           0 :                 : 0;
    1772             :         }
    1773             : 
    1774           0 :         if( pTxtAttr )
    1775             :         {
    1776           0 :             const sal_Int32* pEnd = pTxtAttr->End();
    1777           0 :             bRet = SelectTxt( pTxtAttr->GetStart(), ( pEnd ? *pEnd : pTxtAttr->GetStart() + 1 ) );
    1778             :         }
    1779             :     }
    1780           0 :     return bRet;
    1781             : }
    1782             : 
    1783           0 : bool SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
    1784             : {
    1785           0 :     bool bRet = false;
    1786           0 :     if( rAttr.GetpTxtNode() )
    1787             :     {
    1788           0 :         SwCursor* pCrsr = getShellCrsr( true );
    1789             : 
    1790           0 :         SET_CURR_SHELL( this );
    1791           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
    1792           0 :         SwCrsrSaveState aSaveState( *pCrsr );
    1793             : 
    1794           0 :         pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode();
    1795           0 :         pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)rAttr.GetpTxtNode(),
    1796           0 :                                             rAttr.GetStart() );
    1797           0 :         bRet = !pCrsr->IsSelOvr();
    1798           0 :         if( bRet )
    1799           0 :             UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
    1800             :     }
    1801           0 :     return bRet;
    1802             : }
    1803             : 
    1804           0 : const SwFmtINetFmt* SwCrsrShell::FindINetAttr( const OUString& rName ) const
    1805             : {
    1806           0 :     return mpDoc->FindINetAttr( rName );
    1807             : }
    1808             : 
    1809           0 : bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
    1810             :                                 SwRect& rRect, sal_Int16& rOrient )
    1811             : {
    1812             : 
    1813           0 :     SET_CURR_SHELL( this );
    1814           0 :     bool bRet = false;
    1815             : 
    1816           0 :     if (!IsTableMode() && !HasSelection()
    1817           0 :         && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
    1818             :     {
    1819           0 :         Point aPt( rPt );
    1820           0 :         SwPosition aPos( *m_pCurCrsr->GetPoint() );
    1821             : 
    1822           0 :         SwFillCrsrPos aFPos( eFillMode );
    1823           0 :         SwCrsrMoveState aTmpState( &aFPos );
    1824             : 
    1825           0 :         if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) &&
    1826           0 :             !aPos.nNode.GetNode().IsProtect())
    1827             :         {
    1828             :             // start position in protected section?
    1829           0 :             rRect = aFPos.aCrsr;
    1830           0 :             rOrient = aFPos.eOrient;
    1831           0 :             bRet = true;
    1832           0 :         }
    1833             :     }
    1834           0 :     return bRet;
    1835             : }
    1836             : 
    1837           0 : bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
    1838             : {
    1839           0 :     SET_CURR_SHELL( this );
    1840           0 :     bool bRet = false;
    1841             : 
    1842           0 :     if (!IsTableMode() && !HasSelection()
    1843           0 :         && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
    1844             :     {
    1845           0 :         Point aPt( rPt );
    1846           0 :         SwPosition aPos( *m_pCurCrsr->GetPoint() );
    1847             : 
    1848           0 :         SwFillCrsrPos aFPos( eFillMode );
    1849           0 :         SwCrsrMoveState aTmpState( &aFPos );
    1850             : 
    1851           0 :         if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) )
    1852             :         {
    1853           0 :             SwCallLink aLk( *this ); // watch Crsr-Moves
    1854           0 :             StartAction();
    1855             : 
    1856           0 :             SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
    1857           0 :             SwUndoId nUndoId = UNDO_INS_FROM_SHADOWCRSR;
    1858             :             // If only the paragraph attributes "Adjust" or "LRSpace" are set,
    1859             :             // then the following should not delete those again.
    1860           0 :             if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
    1861           0 :                 ( FILL_INDENT == aFPos.eMode ||
    1862           0 :                   ( text::HoriOrientation::NONE != aFPos.eOrient &&
    1863           0 :                     0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
    1864           0 :                 pCNd && pCNd->Len() )
    1865           0 :                 nUndoId = UNDO_EMPTY;
    1866             : 
    1867           0 :             GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, NULL );
    1868             : 
    1869           0 :             SwTxtFmtColl* pNextFmt = 0;
    1870           0 :             SwTxtNode* pTNd = pCNd ? pCNd->GetTxtNode() : NULL;
    1871           0 :             if( pTNd )
    1872           0 :                 pNextFmt = &pTNd->GetTxtColl()->GetNextTxtFmtColl();
    1873             : 
    1874           0 :             const SwSectionNode* pSectNd = pCNd ? pCNd->FindSectionNode() : NULL;
    1875           0 :             if( pSectNd && aFPos.nParaCnt )
    1876             :             {
    1877           0 :                 SwNodeIndex aEnd( aPos.nNode, 1 );
    1878           0 :                 while( aEnd.GetNode().IsEndNode() &&
    1879           0 :                         (const SwNode*)&aEnd.GetNode() !=
    1880           0 :                         pSectNd->EndOfSectionNode() )
    1881           0 :                     ++aEnd;
    1882             : 
    1883           0 :                 if( aEnd.GetNode().IsEndNode() &&
    1884           0 :                     pCNd->Len() == aPos.nContent.GetIndex() )
    1885           0 :                     aPos.nNode = *pSectNd->EndOfSectionNode();
    1886             :             }
    1887             : 
    1888           0 :             for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
    1889             :             {
    1890           0 :                 GetDoc()->getIDocumentContentOperations().AppendTxtNode( aPos );
    1891           0 :                 if( !n && pNextFmt )
    1892             :                 {
    1893           0 :                     *m_pCurCrsr->GetPoint() = aPos;
    1894           0 :                     GetDoc()->SetTxtFmtColl( *m_pCurCrsr, pNextFmt, false );
    1895             :                 }
    1896           0 :                 if( n < aFPos.nColumnCnt )
    1897             :                 {
    1898           0 :                     *m_pCurCrsr->GetPoint() = aPos;
    1899           0 :                     GetDoc()->getIDocumentContentOperations().InsertPoolItem( *m_pCurCrsr,
    1900           0 :                             SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
    1901             :                 }
    1902             :             }
    1903             : 
    1904           0 :             *m_pCurCrsr->GetPoint() = aPos;
    1905           0 :             switch( aFPos.eMode )
    1906             :             {
    1907             :             case FILL_INDENT:
    1908           0 :                 if( 0 != (pCNd = aPos.nNode.GetNode().GetCntntNode() ))
    1909             :                 {
    1910           0 :                     SfxItemSet aSet( GetDoc()->GetAttrPool(),
    1911             :                                     RES_LR_SPACE, RES_LR_SPACE,
    1912             :                                     RES_PARATR_ADJUST, RES_PARATR_ADJUST,
    1913           0 :                                     0 );
    1914             :                     SvxLRSpaceItem aLR( (SvxLRSpaceItem&)
    1915           0 :                                         pCNd->GetAttr( RES_LR_SPACE ) );
    1916           0 :                     aLR.SetTxtLeft( aFPos.nTabCnt );
    1917           0 :                     aLR.SetTxtFirstLineOfst( 0 );
    1918           0 :                     aSet.Put( aLR );
    1919             : 
    1920             :                     const SvxAdjustItem& rAdj = (SvxAdjustItem&)pCNd->
    1921           0 :                                         GetAttr( RES_PARATR_ADJUST );
    1922           0 :                     if( SVX_ADJUST_LEFT != rAdj.GetAdjust() )
    1923           0 :                         aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
    1924             : 
    1925           0 :                     GetDoc()->getIDocumentContentOperations().InsertItemSet( *m_pCurCrsr, aSet, 0 );
    1926             :                 }
    1927             :                 else {
    1928             :                     OSL_ENSURE( false, "No CntntNode" );
    1929             :                 }
    1930           0 :                 break;
    1931             : 
    1932             :             case FILL_TAB:
    1933             :             case FILL_SPACE:
    1934             :                 {
    1935           0 :                     OUStringBuffer sInsert;
    1936           0 :                     if (aFPos.nTabCnt)
    1937           0 :                         comphelper::string::padToLength(sInsert, aFPos.nTabCnt, '\t');
    1938           0 :                     if (aFPos.nSpaceCnt)
    1939           0 :                         comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceCnt, ' ');
    1940           0 :                     if (!sInsert.isEmpty())
    1941           0 :                         GetDoc()->getIDocumentContentOperations().InsertString( *m_pCurCrsr, sInsert.makeStringAndClear());
    1942             :                 }
    1943             :                 // no break - still need to set orientation
    1944             :             case FILL_MARGIN:
    1945           0 :                 if( text::HoriOrientation::NONE != aFPos.eOrient )
    1946             :                 {
    1947           0 :                     SvxAdjustItem aAdj( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
    1948           0 :                     switch( aFPos.eOrient )
    1949             :                     {
    1950             :                     case text::HoriOrientation::CENTER:
    1951           0 :                         aAdj.SetAdjust( SVX_ADJUST_CENTER );
    1952           0 :                         break;
    1953             :                     case text::HoriOrientation::RIGHT:
    1954           0 :                         aAdj.SetAdjust( SVX_ADJUST_RIGHT );
    1955           0 :                         break;
    1956             :                     default:
    1957           0 :                         break;
    1958             :                     }
    1959           0 :                     GetDoc()->getIDocumentContentOperations().InsertPoolItem( *m_pCurCrsr, aAdj, 0 );
    1960             :                 }
    1961           0 :                 break;
    1962             :             }
    1963             : 
    1964           0 :             GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, NULL );
    1965           0 :             EndAction();
    1966             : 
    1967           0 :             bRet = true;
    1968           0 :         }
    1969             :     }
    1970           0 :     return bRet;
    1971             : }
    1972             : 
    1973           0 : const SwRangeRedline* SwCrsrShell::SelNextRedline()
    1974             : {
    1975           0 :     const SwRangeRedline* pFnd = 0;
    1976           0 :     if( !IsTableMode() )
    1977             :     {
    1978           0 :         SET_CURR_SHELL( this );
    1979           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
    1980           0 :         SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1981             : 
    1982           0 :         pFnd = GetDoc()->getIDocumentRedlineAccess().SelNextRedline( *m_pCurCrsr );
    1983           0 :         if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
    1984           0 :             UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
    1985             :         else
    1986           0 :             pFnd = 0;
    1987             :     }
    1988           0 :     return pFnd;
    1989             : }
    1990             : 
    1991           0 : const SwRangeRedline* SwCrsrShell::SelPrevRedline()
    1992             : {
    1993           0 :     const SwRangeRedline* pFnd = 0;
    1994           0 :     if( !IsTableMode() )
    1995             :     {
    1996           0 :         SET_CURR_SHELL( this );
    1997           0 :         SwCallLink aLk( *this ); // watch Crsr-Moves
    1998           0 :         SwCrsrSaveState aSaveState( *m_pCurCrsr );
    1999             : 
    2000           0 :         pFnd = GetDoc()->getIDocumentRedlineAccess().SelPrevRedline( *m_pCurCrsr );
    2001           0 :         if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
    2002           0 :             UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
    2003             :         else
    2004           0 :             pFnd = 0;
    2005             :     }
    2006           0 :     return pFnd;
    2007             : }
    2008             : 
    2009           0 : const SwRangeRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, bool bSelect )
    2010             : {
    2011           0 :     const SwRangeRedline* pFnd = 0;
    2012           0 :     SwCallLink aLk( *this ); // watch Crsr-Moves
    2013           0 :     SwCrsrSaveState aSaveState( *m_pCurCrsr );
    2014             : 
    2015           0 :     pFnd = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl()[ nArrPos ];
    2016           0 :     if( pFnd )
    2017             :     {
    2018           0 :         *m_pCurCrsr->GetPoint() = *pFnd->Start();
    2019             : 
    2020             :         SwCntntNode* pCNd;
    2021           0 :         SwNodeIndex* pIdx = &m_pCurCrsr->GetPoint()->nNode;
    2022           0 :         if( !pIdx->GetNode().IsCntntNode() &&
    2023           0 :             0 != ( pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
    2024           0 :                                     true, IsReadOnlyAvailable() )) )
    2025             :         {
    2026           0 :             if( *pIdx <= pFnd->End()->nNode )
    2027           0 :                 m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
    2028             :             else
    2029           0 :                 pFnd = 0;
    2030             :         }
    2031             : 
    2032           0 :         if( pFnd && bSelect )
    2033             :         {
    2034           0 :             m_pCurCrsr->SetMark();
    2035           0 :             if( nsRedlineType_t::REDLINE_FMTCOLL == pFnd->GetType() )
    2036             :             {
    2037           0 :                 pCNd = pIdx->GetNode().GetCntntNode();
    2038           0 :                 m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
    2039           0 :                 m_pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 );
    2040             :             }
    2041             :             else
    2042           0 :                 *m_pCurCrsr->GetPoint() = *pFnd->End();
    2043             : 
    2044           0 :             pIdx = &m_pCurCrsr->GetPoint()->nNode;
    2045           0 :             if( !pIdx->GetNode().IsCntntNode() &&
    2046           0 :                 0 != ( pCNd = GetDoc()->GetNodes().GoPrevSection( pIdx,
    2047           0 :                                             true, IsReadOnlyAvailable() )) )
    2048             :             {
    2049           0 :                 if( *pIdx >= m_pCurCrsr->GetMark()->nNode )
    2050           0 :                     m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
    2051             :                 else
    2052           0 :                     pFnd = 0;
    2053             :             }
    2054             :         }
    2055             : 
    2056           0 :         if( !pFnd )
    2057             :         {
    2058           0 :             m_pCurCrsr->DeleteMark();
    2059           0 :             m_pCurCrsr->RestoreSavePos();
    2060             :         }
    2061           0 :         else if( bSelect && *m_pCurCrsr->GetMark() == *m_pCurCrsr->GetPoint() )
    2062           0 :             m_pCurCrsr->DeleteMark();
    2063             : 
    2064           0 :         if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
    2065             :             UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE
    2066           0 :                         | SwCrsrShell::READONLY );
    2067             :         else
    2068             :         {
    2069           0 :             pFnd = 0;
    2070           0 :             if( bSelect )
    2071           0 :                 m_pCurCrsr->DeleteMark();
    2072             :         }
    2073             :     }
    2074           0 :     return pFnd;
    2075             : }
    2076             : 
    2077           0 : const SwRangeRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect )
    2078             : {
    2079           0 :     const SwRangeRedline* pFnd = 0;
    2080           0 :     if( !IsTableMode() )
    2081             :     {
    2082           0 :         SET_CURR_SHELL( this );
    2083             : 
    2084           0 :         const SwRedlineTbl& rTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
    2085           0 :         const SwRangeRedline* pTmp = rTbl[ nArrPos ];
    2086           0 :         sal_uInt16 nSeqNo = pTmp->GetSeqNo();
    2087           0 :         if( nSeqNo && bSelect )
    2088             :         {
    2089           0 :             bool bCheck = false;
    2090           0 :             int nLoopCnt = 2;
    2091           0 :             sal_uInt16 nArrSavPos = nArrPos;
    2092             : 
    2093           0 :             do {
    2094           0 :                 pTmp = _GotoRedline( nArrPos, true );
    2095             : 
    2096           0 :                 if( !pFnd )
    2097           0 :                     pFnd = pTmp;
    2098             : 
    2099           0 :                 if( pTmp && bCheck )
    2100             :                 {
    2101             :                     // Check for overlaps. These can happen when FmtColl-
    2102             :                     // Redlines were streched over a whole paragraph
    2103           0 :                     SwPaM* pCur = m_pCurCrsr;
    2104           0 :                     SwPaM* pNextPam = (SwPaM*)pCur->GetNext();
    2105           0 :                     SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
    2106           0 :                     while( pCur != pNextPam )
    2107             :                     {
    2108           0 :                         const SwPosition *pNStt = pNextPam->Start(),
    2109           0 :                                          *pNEnd = pNextPam->End();
    2110             : 
    2111           0 :                         bool bDel = true;
    2112           0 :                         switch( ::ComparePosition( *pCStt, *pCEnd,
    2113           0 :                                                    *pNStt, *pNEnd ))
    2114             :                         {
    2115             :                         case POS_INSIDE:         // Pos1 is completely in Pos2
    2116           0 :                             if( !pCur->HasMark() )
    2117             :                             {
    2118           0 :                                 pCur->SetMark();
    2119           0 :                                 *pCur->GetMark() = *pNStt;
    2120             :                             }
    2121             :                             else
    2122           0 :                                 *pCStt = *pNStt;
    2123           0 :                             *pCEnd = *pNEnd;
    2124           0 :                             break;
    2125             : 
    2126             :                         case POS_OUTSIDE:        // Pos2 is completely in Pos1
    2127             :                         case POS_EQUAL:          // Pos1 has same size as Pos2
    2128           0 :                             break;
    2129             : 
    2130             :                         case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 at beginning
    2131           0 :                             if( !pCur->HasMark() )
    2132           0 :                                 pCur->SetMark();
    2133           0 :                             *pCEnd = *pNEnd;
    2134           0 :                             break;
    2135             :                         case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at end
    2136           0 :                             if( !pCur->HasMark() )
    2137             :                             {
    2138           0 :                                 pCur->SetMark();
    2139           0 :                                 *pCur->GetMark() = *pNStt;
    2140             :                             }
    2141             :                             else
    2142           0 :                                 *pCStt = *pNStt;
    2143           0 :                             break;
    2144             : 
    2145             :                         default:
    2146           0 :                             bDel = false;
    2147             :                         }
    2148             : 
    2149           0 :                         if( bDel )
    2150             :                         {
    2151             :                             // not needed anymore
    2152           0 :                             SwPaM* pPrevPam = (SwPaM*)pNextPam->GetPrev();
    2153           0 :                             delete pNextPam;
    2154           0 :                             pNextPam = pPrevPam;
    2155             :                         }
    2156           0 :                         pNextPam = (SwPaM*)pNextPam->GetNext();
    2157             :                     }
    2158             :                 }
    2159             : 
    2160             :                 sal_uInt16 nFndPos = 2 == nLoopCnt
    2161           0 :                                     ? rTbl.FindNextOfSeqNo( nArrPos )
    2162           0 :                                     : rTbl.FindPrevOfSeqNo( nArrPos );
    2163           0 :                 if( USHRT_MAX != nFndPos ||
    2164           0 :                     ( 0 != ( --nLoopCnt ) && USHRT_MAX != (
    2165           0 :                             nFndPos = rTbl.FindPrevOfSeqNo( nArrSavPos ))) )
    2166             :                 {
    2167           0 :                     if( pTmp )
    2168             :                     {
    2169             :                         // create new cursor
    2170           0 :                         CreateCrsr();
    2171           0 :                         bCheck = true;
    2172             :                     }
    2173           0 :                     nArrPos = nFndPos;
    2174             :                 }
    2175             :                 else
    2176           0 :                     nLoopCnt = 0;
    2177             : 
    2178           0 :             } while( nLoopCnt );
    2179             :         }
    2180             :         else
    2181           0 :             pFnd = _GotoRedline( nArrPos, bSelect );
    2182             :     }
    2183           0 :     return pFnd;
    2184             : }
    2185             : 
    2186           0 : bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext )
    2187             : {
    2188           0 :     SwNodes& rNds = GetDoc()->GetNodes();
    2189           0 :     const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
    2190           0 :     const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
    2191           0 :     sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
    2192           0 :     Point aPt;
    2193             : 
    2194           0 :     _SetGetExpFld aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
    2195           0 :     _SetGetExpFld aCurPos( bNext ? *m_pCurCrsr->End() : *m_pCurCrsr->Start() );
    2196           0 :     if( aCurPos.GetNode() < nBodySttNdIdx )
    2197             :     {
    2198           0 :         const SwCntntNode* pCNd = aCurPos.GetNodeFromCntnt()->GetCntntNode();
    2199             :         SwCntntFrm* pFrm;
    2200           0 :         if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt )) )
    2201           0 :             aCurPos.SetBodyPos( *pFrm );
    2202             :     }
    2203             : 
    2204             :     // check first all the hyperlink fields
    2205             :     {
    2206             :         const SwTxtNode* pTxtNd;
    2207           0 :         const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
    2208           0 :         for( sal_uInt16 n = pFmts->size(); 1 < n; )
    2209             :         {
    2210           0 :             SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
    2211             : 
    2212           0 :             for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
    2213           0 :                 if( 0 != ( pTxtNd = pFnd->GetpTxtNode()) &&
    2214           0 :                     pTxtNd->GetNodes().IsDocNodes() )
    2215             :                 {
    2216           0 :                     SwTxtINetFmt& rAttr = *pFnd;
    2217           0 :                     SwPosition aTmpPos( *pTxtNd );
    2218           0 :                     _SetGetExpFld aPos( aTmpPos.nNode, rAttr );
    2219             :                     SwCntntFrm* pFrm;
    2220           0 :                     if( pTxtNd->GetIndex() < nBodySttNdIdx &&
    2221           0 :                         0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt )) )
    2222           0 :                         aPos.SetBodyPos( *pFrm );
    2223             : 
    2224           0 :                     if( bNext
    2225           0 :                         ? ( aPos < aCmpPos && aCurPos < aPos )
    2226           0 :                         : ( aCmpPos < aPos && aPos < aCurPos ))
    2227             :                     {
    2228           0 :                         OUString sTxt( pTxtNd->GetExpandTxt( rAttr.GetStart(),
    2229           0 :                                         *rAttr.GetEnd() - rAttr.GetStart() ) );
    2230             : 
    2231           0 :                         sTxt = comphelper::string::remove(sTxt, 0x0a);
    2232           0 :                         sTxt = comphelper::string::strip(sTxt, ' ');
    2233             : 
    2234           0 :                         if( !sTxt.isEmpty() )
    2235           0 :                             aCmpPos = aPos;
    2236           0 :                     }
    2237             :                 }
    2238           0 :         }
    2239             :     }
    2240             : 
    2241             :     // then check all the Flys with a URL or imapge map
    2242             :     {
    2243           0 :         const SwFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts();
    2244           0 :         for( sal_uInt16 n = 0, nEnd = pFmts->size(); n < nEnd; ++n )
    2245             :         {
    2246           0 :             SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)(*pFmts)[ n ];
    2247           0 :             const SwFmtURL& rURLItem = pFmt->GetURL();
    2248           0 :             if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() )
    2249             :             {
    2250           0 :                 SwFlyFrm* pFly = pFmt->GetFrm( &aPt, false );
    2251           0 :                 SwPosition aTmpPos( *pBodySttNd );
    2252           0 :                 if( pFly &&
    2253           0 :                     GetBodyTxtNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
    2254             :                 {
    2255           0 :                     _SetGetExpFld aPos( *pFmt, &aTmpPos );
    2256             : 
    2257           0 :                     if( bNext
    2258           0 :                             ? ( aPos < aCmpPos && aCurPos < aPos )
    2259           0 :                             : ( aCmpPos < aPos && aPos < aCurPos ))
    2260           0 :                         aCmpPos = aPos;
    2261           0 :                 }
    2262             :             }
    2263             :         }
    2264             :     }
    2265             : 
    2266             :     // found any URL ?
    2267           0 :     bool bRet = false;
    2268           0 :     const SwTxtINetFmt* pFndAttr = aCmpPos.GetINetFmt();
    2269           0 :     const SwFlyFrmFmt* pFndFmt = aCmpPos.GetFlyFmt();
    2270           0 :     if( pFndAttr || pFndFmt )
    2271             :     {
    2272           0 :         SET_CURR_SHELL( this );
    2273           0 :         SwCallLink aLk( *this );
    2274             : 
    2275             :         // found a text attribute ?
    2276           0 :         if( pFndAttr )
    2277             :         {
    2278           0 :             SwCrsrSaveState aSaveState( *m_pCurCrsr );
    2279             : 
    2280           0 :             aCmpPos.GetPosOfContent( *m_pCurCrsr->GetPoint() );
    2281           0 :             m_pCurCrsr->DeleteMark();
    2282           0 :             m_pCurCrsr->SetMark();
    2283           0 :             m_pCurCrsr->GetPoint()->nContent = *pFndAttr->End();
    2284             : 
    2285           0 :             if( !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
    2286             :             {
    2287             :                 UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|
    2288           0 :                                     SwCrsrShell::READONLY );
    2289           0 :                 bRet = true;
    2290           0 :             }
    2291             :         }
    2292             :         // found a draw object ?
    2293           0 :         else if( RES_DRAWFRMFMT == pFndFmt->Which() )
    2294             :         {
    2295           0 :             const SdrObject* pSObj = pFndFmt->FindSdrObject();
    2296           0 :             if (pSObj)
    2297             :             {
    2298           0 :                 ((SwFEShell*)this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
    2299           0 :                 MakeSelVisible();
    2300           0 :                 bRet = true;
    2301             :             }
    2302             :         }
    2303             :         else // then is it a fly
    2304             :         {
    2305           0 :             SwFlyFrm* pFly = pFndFmt->GetFrm(&aPt, false );
    2306           0 :             if( pFly )
    2307             :             {
    2308           0 :                 ((SwFEShell*)this)->SelectFlyFrm( *pFly, true );
    2309           0 :                 MakeSelVisible();
    2310           0 :                 bRet = true;
    2311             :             }
    2312           0 :         }
    2313             :     }
    2314           0 :     return bRet;
    2315         270 : }
    2316             : 
    2317             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10