LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/wrtsh - move.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 75 341 22.0 %
Date: 2013-07-09 Functions: 18 47 38.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sfx2/bindings.hxx>
      21             : #include <wrtsh.hxx>
      22             : #include <view.hxx>
      23             : #include <viewopt.hxx>
      24             : #include <crsskip.hxx>
      25             : 
      26             : /**
      27             :    Always:
      28             :     -   Reset of the cursor stack
      29             :     -   retrigger timer
      30             :     -   if applicable: GCAttr
      31             : 
      32             :     on selection
      33             :     -   SttSelect()
      34             : 
      35             :     else
      36             :     -   EndSelect()
      37             :  */
      38             : 
      39             : const long nReadOnlyScrollOfst = 10;
      40             : 
      41             : class ShellMoveCrsr
      42             : {
      43             :     SwWrtShell* pSh;
      44             :     bool bAct;
      45             : public:
      46          52 :     inline ShellMoveCrsr( SwWrtShell* pWrtSh, sal_Bool bSel )
      47             :     {
      48          52 :         bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrmType(0,sal_False) & FRMTYPE_FLY_ANY);
      49          52 :         ( pSh = pWrtSh )->MoveCrsr( sal_Bool(bSel) );
      50          52 :         pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK);
      51          52 :     }
      52          52 :     inline ~ShellMoveCrsr()
      53             :     {
      54          52 :         if( bAct )
      55             :         {
      56             :             // The action is used for scrolling in "single paragraph"
      57             :             // frames with fixed height.
      58           0 :             pSh->StartAllAction();
      59           0 :             pSh->EndAllAction();
      60             :         }
      61          52 :     }
      62             : };
      63             : 
      64          52 : void SwWrtShell::MoveCrsr( sal_Bool bWithSelect )
      65             : {
      66          52 :     ResetCursorStack();
      67          52 :     if ( IsGCAttr() )
      68             :     {
      69           0 :         GCAttr();
      70           0 :         ClearGCAttr();
      71             :     }
      72          52 :     if ( bWithSelect )
      73          21 :         SttSelect();
      74             :     else
      75             :     {
      76          31 :         EndSelect();
      77          31 :         (this->*fnKillSel)( 0, sal_False );
      78             :     }
      79          52 : }
      80             : 
      81           0 : sal_Bool SwWrtShell::SimpleMove( FNSimpleMove FnSimpleMove, sal_Bool bSelect )
      82             : {
      83             :     sal_Bool nRet;
      84           0 :     if( bSelect )
      85             :     {
      86           0 :         SttCrsrMove();
      87           0 :         MoveCrsr( sal_True );
      88           0 :         nRet = (this->*FnSimpleMove)();
      89           0 :         EndCrsrMove();
      90             :     }
      91           0 :     else if( 0 != ( nRet = (this->*FnSimpleMove)() ) )
      92           0 :         MoveCrsr( sal_False );
      93           0 :     return nRet;
      94             : }
      95             : 
      96           6 : sal_Bool SwWrtShell::Left( sal_uInt16 nMode, sal_Bool bSelect,
      97             :                             sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual )
      98             : {
      99           6 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly()  && !GetViewOptions()->IsSelectionInReadonly())
     100             :     {
     101           0 :         Point aTmp( VisArea().Pos() );
     102           0 :         aTmp.X() -= VisArea().Width() * nReadOnlyScrollOfst / 100;
     103           0 :         rView.SetVisArea( aTmp );
     104           0 :         return sal_True;
     105             :     }
     106             :     else
     107             :     {
     108           6 :         ShellMoveCrsr aTmp( this, bSelect );
     109           6 :         return SwCrsrShell::Left( nCount, nMode, bVisual );
     110             :     }
     111             : }
     112             : 
     113          11 : sal_Bool SwWrtShell::Right( sal_uInt16 nMode, sal_Bool bSelect,
     114             :                             sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual )
     115             : {
     116          11 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly() )
     117             :     {
     118           0 :         Point aTmp( VisArea().Pos() );
     119           0 :         aTmp.X() += VisArea().Width() * nReadOnlyScrollOfst / 100;
     120           0 :         aTmp.X() = rView.SetHScrollMax( aTmp.X() );
     121           0 :         rView.SetVisArea( aTmp );
     122           0 :         return sal_True;
     123             :     }
     124             :     else
     125             :     {
     126          11 :         ShellMoveCrsr aTmp( this, bSelect );
     127          11 :         return SwCrsrShell::Right( nCount, nMode, bVisual );
     128             :     }
     129             : }
     130             : 
     131           0 : sal_Bool SwWrtShell::Up( sal_Bool bSelect, sal_uInt16 nCount, sal_Bool bBasicCall )
     132             : {
     133           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly()  && !GetViewOptions()->IsSelectionInReadonly())
     134             :     {
     135           0 :         Point aTmp( VisArea().Pos() );
     136           0 :         aTmp.Y() -= VisArea().Height() * nReadOnlyScrollOfst / 100;
     137           0 :         rView.SetVisArea( aTmp );
     138           0 :         return sal_True;
     139             :     }
     140             :     else
     141             :     {
     142           0 :         ShellMoveCrsr aTmp( this, bSelect );
     143           0 :         return SwCrsrShell::Up( nCount );
     144             :     }
     145             : }
     146             : 
     147           0 : sal_Bool SwWrtShell::Down( sal_Bool bSelect, sal_uInt16 nCount, sal_Bool bBasicCall )
     148             : {
     149           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
     150             :     {
     151           0 :         Point aTmp( VisArea().Pos() );
     152           0 :         aTmp.Y() += VisArea().Height() * nReadOnlyScrollOfst / 100;
     153           0 :         aTmp.Y() = rView.SetVScrollMax( aTmp.Y() );
     154           0 :         rView.SetVisArea( aTmp );
     155           0 :         return sal_True;
     156             :     }
     157             :     else
     158             :     {
     159           0 :         ShellMoveCrsr aTmp( this, bSelect );
     160           0 :         return SwCrsrShell::Down( nCount );
     161             :     }
     162             : }
     163             : 
     164           0 : sal_Bool SwWrtShell::LeftMargin( sal_Bool bSelect, sal_Bool bBasicCall )
     165             : {
     166           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
     167             :     {
     168           0 :         Point aTmp( VisArea().Pos() );
     169           0 :         aTmp.X() = DOCUMENTBORDER;
     170           0 :         rView.SetVisArea( aTmp );
     171           0 :         return sal_True;
     172             :     }
     173             :     else
     174             :     {
     175           0 :         ShellMoveCrsr aTmp( this, bSelect );
     176           0 :         return SwCrsrShell::LeftMargin();
     177             :     }
     178             : }
     179             : 
     180           0 : sal_Bool SwWrtShell::RightMargin( sal_Bool bSelect, sal_Bool bBasicCall  )
     181             : {
     182           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
     183             :     {
     184           0 :         Point aTmp( VisArea().Pos() );
     185           0 :         aTmp.X() = GetDocSize().Width() - VisArea().Width() + DOCUMENTBORDER;
     186           0 :         if( DOCUMENTBORDER > aTmp.X() )
     187           0 :             aTmp.X() = DOCUMENTBORDER;
     188           0 :         rView.SetVisArea( aTmp );
     189           0 :         return sal_True;
     190             :     }
     191             :     else
     192             :     {
     193           0 :         ShellMoveCrsr aTmp( this, bSelect );
     194           0 :         return SwCrsrShell::RightMargin(bBasicCall);
     195             :     }
     196             : }
     197             : 
     198           8 : sal_Bool SwWrtShell::GoStart( sal_Bool bKeepArea, sal_Bool *pMoveTable,
     199             :                             sal_Bool bSelect, sal_Bool bDontMoveRegion )
     200             : {
     201           8 :     if ( IsCrsrInTbl() )
     202             :     {
     203           0 :         const sal_Bool bBoxSelection = HasBoxSelection();
     204           0 :         if( !bBlockMode )
     205             :         {
     206           0 :             if ( !bSelect )
     207           0 :                 EnterStdMode();
     208             :             else
     209           0 :                 SttSelect();
     210             :         }
     211             :             // Table cell ?
     212           0 :         if ( !bBoxSelection && (MoveSection( fnSectionCurr, fnSectionStart)
     213           0 :                 || bDontMoveRegion))
     214             :         {
     215           0 :             if ( pMoveTable )
     216           0 :                 *pMoveTable = sal_False;
     217           0 :             return sal_True;
     218             :         }
     219           0 :         if( MoveTable( fnTableCurr, fnTableStart ) || bDontMoveRegion )
     220             :         {
     221           0 :             if ( pMoveTable )
     222           0 :                 *pMoveTable = sal_True;
     223           0 :             return sal_True;
     224             :         }
     225           0 :         else if( bBoxSelection && pMoveTable )
     226             :         {
     227             :             // JP 09.01.96: We have a box selection (or a empty cell)
     228             :             //              and we want select (pMoveTable will be
     229             :             //              set in SelAll). Then the table must not
     230             :             //              be left, otherwise there is no selection
     231             :             //              of the entire table possible!
     232           0 :             *pMoveTable = sal_True;
     233           0 :             return sal_True;
     234             :         }
     235             :     }
     236             : 
     237           8 :     if( !bBlockMode )
     238             :     {
     239           8 :         if ( !bSelect )
     240           8 :             EnterStdMode();
     241             :         else
     242           0 :             SttSelect();
     243             :     }
     244           8 :     const sal_uInt16 nFrmType = GetFrmType(0,sal_False);
     245           8 :     if ( FRMTYPE_FLY_ANY & nFrmType )
     246             :     {
     247           0 :         if( MoveSection( fnSectionCurr, fnSectionStart ) )
     248           0 :             return sal_True;
     249           0 :         else if ( FRMTYPE_FLY_FREE & nFrmType || bDontMoveRegion )
     250           0 :             return sal_False;
     251             :     }
     252           8 :     if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
     253             :     {
     254           0 :         if ( MoveSection( fnSectionCurr, fnSectionStart ) )
     255           0 :             return sal_True;
     256           0 :         else if ( bKeepArea )
     257           0 :             return sal_True;
     258             :     }
     259             :     // Regions ???
     260          16 :     return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionStart ) ||
     261          16 :            SwCrsrShell::SttEndDoc(sal_True);
     262             : }
     263             : 
     264           8 : sal_Bool SwWrtShell::GoEnd(sal_Bool bKeepArea, sal_Bool *pMoveTable)
     265             : {
     266           8 :     if ( pMoveTable && *pMoveTable )
     267           0 :         return MoveTable( fnTableCurr, fnTableEnd );
     268             : 
     269           8 :     if ( IsCrsrInTbl() )
     270             :     {
     271           0 :         if ( MoveSection( fnSectionCurr, fnSectionEnd ) ||
     272           0 :              MoveTable( fnTableCurr, fnTableEnd ) )
     273           0 :             return sal_True;
     274             :     }
     275             :     else
     276             :     {
     277           8 :         const sal_uInt16 nFrmType = GetFrmType(0,sal_False);
     278           8 :         if ( FRMTYPE_FLY_ANY & nFrmType )
     279             :         {
     280           0 :             if ( MoveSection( fnSectionCurr, fnSectionEnd ) )
     281           0 :                 return sal_True;
     282           0 :             else if ( FRMTYPE_FLY_FREE & nFrmType )
     283           0 :                 return sal_False;
     284             :         }
     285           8 :         if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
     286             :         {
     287           0 :             if ( MoveSection( fnSectionCurr, fnSectionEnd) )
     288           0 :                 return sal_True;
     289           0 :             else if ( bKeepArea )
     290           0 :                 return sal_True;
     291             :         }
     292             :     }
     293             :     // Regions ???
     294          16 :     return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionEnd ) ||
     295          16 :            SwCrsrShell::SttEndDoc(sal_False);
     296             : }
     297             : 
     298           8 : sal_Bool SwWrtShell::SttDoc( sal_Bool bSelect )
     299             : {
     300           8 :     ShellMoveCrsr aTmp( this, bSelect );
     301           8 :     return GoStart(sal_False, 0, bSelect );
     302             : }
     303             : 
     304           8 : sal_Bool SwWrtShell::EndDoc( sal_Bool bSelect)
     305             : {
     306           8 :     ShellMoveCrsr aTmp( this, bSelect );
     307           8 :     return GoEnd();
     308             : }
     309             : 
     310           1 : sal_Bool SwWrtShell::SttNxtPg( sal_Bool bSelect )
     311             : {
     312           1 :     ShellMoveCrsr aTmp( this, bSelect );
     313           1 :     return MovePage( fnPageNext, fnPageStart );
     314             : }
     315             : 
     316           0 : sal_Bool SwWrtShell::SttPrvPg( sal_Bool bSelect )
     317             : {
     318           0 :     ShellMoveCrsr aTmp( this, bSelect );
     319           0 :     return MovePage( fnPagePrev, fnPageStart );
     320             : }
     321             : 
     322           0 : sal_Bool SwWrtShell::EndNxtPg( sal_Bool bSelect )
     323             : {
     324           0 :     ShellMoveCrsr aTmp( this, bSelect );
     325           0 :     return MovePage( fnPageNext, fnPageEnd );
     326             : }
     327             : 
     328           1 : sal_Bool SwWrtShell::EndPrvPg( sal_Bool bSelect )
     329             : {
     330           1 :     ShellMoveCrsr aTmp( this, bSelect );
     331           1 :     return MovePage( fnPagePrev, fnPageEnd );
     332             : }
     333             : 
     334          15 : sal_Bool SwWrtShell::SttPg( sal_Bool bSelect )
     335             : {
     336          15 :     ShellMoveCrsr aTmp( this, bSelect );
     337          15 :     return MovePage( fnPageCurr, fnPageStart );
     338             : }
     339             : 
     340           1 : sal_Bool SwWrtShell::EndPg( sal_Bool bSelect )
     341             : {
     342           1 :     ShellMoveCrsr aTmp( this, bSelect );
     343           1 :     return MovePage( fnPageCurr, fnPageEnd );
     344             : }
     345             : 
     346           0 : sal_Bool SwWrtShell::SttPara( sal_Bool bSelect )
     347             : {
     348           0 :     ShellMoveCrsr aTmp( this, bSelect );
     349           0 :     return MovePara( fnParaCurr, fnParaStart );
     350             : }
     351             : 
     352           0 : sal_Bool SwWrtShell::EndPara( sal_Bool bSelect )
     353             : {
     354           0 :     ShellMoveCrsr aTmp( this, bSelect );
     355           0 :     return MovePara(fnParaCurr,fnParaEnd);
     356             : }
     357             : 
     358             : // Column-by-jumping.
     359             : // SSelection with or without
     360             : // returns success or failure
     361             : 
     362           0 : sal_Bool SwWrtShell::StartOfColumn( sal_Bool bSelect )
     363             : {
     364           0 :     ShellMoveCrsr aTmp( this, bSelect);
     365           0 :     return MoveColumn(fnColumnCurr, fnColumnStart);
     366             : }
     367             : 
     368           0 : sal_Bool SwWrtShell::EndOfColumn( sal_Bool bSelect )
     369             : {
     370           0 :     ShellMoveCrsr aTmp( this, bSelect);
     371           0 :     return MoveColumn(fnColumnCurr, fnColumnEnd);
     372             : }
     373             : 
     374           0 : sal_Bool SwWrtShell::StartOfNextColumn( sal_Bool bSelect )
     375             : {
     376           0 :     ShellMoveCrsr aTmp( this, bSelect);
     377           0 :     return MoveColumn( fnColumnNext, fnColumnStart);
     378             : }
     379             : 
     380           0 : sal_Bool SwWrtShell::EndOfNextColumn( sal_Bool bSelect )
     381             : {
     382           0 :     ShellMoveCrsr aTmp( this, bSelect);
     383           0 :     return MoveColumn(fnColumnNext, fnColumnEnd);
     384             : }
     385             : 
     386           0 : sal_Bool SwWrtShell::StartOfPrevColumn( sal_Bool bSelect )
     387             : {
     388           0 :     ShellMoveCrsr aTmp( this, bSelect);
     389           0 :     return MoveColumn(fnColumnPrev, fnColumnStart);
     390             : }
     391             : 
     392           0 : sal_Bool SwWrtShell::EndOfPrevColumn( sal_Bool bSelect )
     393             : {
     394           0 :     ShellMoveCrsr aTmp( this, bSelect);
     395           0 :     return MoveColumn(fnColumnPrev, fnColumnEnd);
     396             : }
     397             : 
     398           0 : sal_Bool SwWrtShell::PushCrsr(SwTwips lOffset, sal_Bool bSelect)
     399             : {
     400           0 :     sal_Bool bDiff = sal_False;
     401           0 :     SwRect aOldRect( GetCharRect() ), aTmpArea( VisArea() );
     402             : 
     403             :     // bDestOnStack indicates if I could not set the coursor at the current
     404             :     // position, because in this region is no content.
     405           0 :     if( !bDestOnStack )
     406             :     {
     407           0 :         Point aPt( aOldRect.Center() );
     408             : 
     409           0 :         if( !IsCrsrVisible() )
     410             :             // set CrsrPos to top-/bottom left pos. So the pagescroll is not
     411             :             // be dependent on the current cursor, but on the visarea.
     412           0 :             aPt.Y() = aTmpArea.Top() + aTmpArea.Height() / 2;
     413             : 
     414           0 :         aPt.Y() += lOffset;
     415           0 :         aDest = GetCntntPos(aPt,lOffset > 0);
     416           0 :         aDest.X() = aPt.X();
     417           0 :         bDestOnStack = true;
     418             :     }
     419             : 
     420             :     // If we had a frame selection, it must be removed after the fnSetCrsr
     421             :     // and we have to remember the position on the stack to return to it later.
     422           0 :     sal_Bool bIsFrmSel = sal_False;
     423             : 
     424           0 :     bool bIsObjSel = false;
     425             : 
     426             :     //Target position is now within the viewable region -->
     427             :     //Place the cursor at the target position; remember that no target
     428             :     //position is longer on the stack.
     429             :     //The new visible region is to be determined beforehand.
     430           0 :     aTmpArea.Pos().Y() += lOffset;
     431           0 :     if( aTmpArea.IsInside(aDest) )
     432             :     {
     433           0 :         if( bSelect )
     434           0 :             SttSelect();
     435             :         else
     436           0 :             EndSelect();
     437             : 
     438           0 :         bIsFrmSel = IsFrmSelected();
     439           0 :         bIsObjSel = 0 != IsObjSelected();
     440             : 
     441             :         // unselect frame
     442           0 :         if( bIsFrmSel || bIsObjSel )
     443             :         {
     444           0 :             UnSelectFrm();
     445           0 :             LeaveSelFrmMode();
     446           0 :             if ( bIsObjSel )
     447             :             {
     448           0 :                 GetView().SetDrawFuncPtr( NULL );
     449           0 :                 GetView().LeaveDrawCreate();
     450             :             }
     451             : 
     452           0 :             CallChgLnk();
     453             :         }
     454             : 
     455           0 :         (this->*fnSetCrsr)( &aDest, sal_True );
     456             : 
     457           0 :         bDiff = aOldRect != GetCharRect();
     458             : 
     459           0 :         if( bIsFrmSel )
     460             :         {
     461             :             // In frames take only the upper corner
     462             :             // so that it can be re-selected.
     463           0 :             aOldRect.SSize( 5, 5 );
     464             :         }
     465             : 
     466             :             // reset Dest. SPoint Flags
     467           0 :         bDestOnStack = false;
     468             :     }
     469             : 
     470             :     // Position into the stack; bDiff indicates if there is a
     471             :     // difference between the old and the new cursor position.
     472             :     pCrsrStack = new CrsrStack( bDiff, bIsFrmSel, aOldRect.Center(),
     473           0 :                                 lOffset, pCrsrStack );
     474           0 :     return !bDestOnStack && bDiff;
     475             : }
     476             : 
     477             : 
     478             : 
     479         792 : sal_Bool SwWrtShell::PopCrsr(sal_Bool bUpdate, sal_Bool bSelect)
     480             : {
     481         792 :     if( 0 == pCrsrStack)
     482         792 :         return sal_False;
     483             : 
     484           0 :     const sal_Bool bValidPos = pCrsrStack->bValidCurPos;
     485           0 :     if( bUpdate && bValidPos )
     486             :     {
     487             :             // If a predecessor is on the stack,
     488             :             // use the flag for a valid position.
     489           0 :         SwRect aTmpArea(VisArea());
     490           0 :         aTmpArea.Pos().Y() -= pCrsrStack->lOffset;
     491           0 :         if( aTmpArea.IsInside( pCrsrStack->aDocPos ) )
     492             :         {
     493           0 :             if( bSelect )
     494           0 :                 SttSelect();
     495             :             else
     496           0 :                 EndSelect();
     497             : 
     498           0 :             (this->*fnSetCrsr)(&pCrsrStack->aDocPos, !pCrsrStack->bIsFrmSel);
     499           0 :             if( pCrsrStack->bIsFrmSel && IsObjSelectable(pCrsrStack->aDocPos))
     500             :             {
     501           0 :                 HideCrsr();
     502           0 :                 SelectObj( pCrsrStack->aDocPos );
     503           0 :                 EnterSelFrmMode( &pCrsrStack->aDocPos );
     504             :             }
     505             :         }
     506             :             // If a discrepancy between the visible range and the
     507             :             // remembered cursor position occurs, all of the remembered
     508             :             // positions are thrown away.
     509             :         else
     510             :         {
     511           0 :             _ResetCursorStack();
     512           0 :             return sal_False;
     513             :         }
     514             :     }
     515           0 :     CrsrStack *pTmp = pCrsrStack;
     516           0 :     pCrsrStack = pCrsrStack->pNext;
     517           0 :     delete pTmp;
     518           0 :     if( 0 == pCrsrStack )
     519             :     {
     520           0 :         ePageMove = MV_NO;
     521           0 :         bDestOnStack = false;
     522             :     }
     523           0 :     return bValidPos;
     524             : }
     525             : 
     526             : // Reset of all pushed cursor positions; these will
     527             : // not be displayed ( --> No Start-/EndAction!!)
     528             : 
     529           0 : void SwWrtShell::_ResetCursorStack()
     530             : {
     531           0 :     CrsrStack *pTmp = pCrsrStack;
     532           0 :     while(pCrsrStack)
     533             :     {
     534           0 :         pTmp = pCrsrStack->pNext;
     535           0 :         delete pCrsrStack;
     536           0 :         pCrsrStack = pTmp;
     537             :     }
     538           0 :     ePageMove = MV_NO;
     539           0 :     bDestOnStack = false;
     540           0 : }
     541             : /**
     542             :     if no stack exists --> cancel selection
     543             :     if stack && change of direction
     544             :         --> pop cursor and return
     545             :     else
     546             :         --> push cursor
     547             :             transpose cursor
     548             : */
     549             : 
     550             : 
     551             : 
     552           0 : sal_Bool SwWrtShell::PageCrsr(SwTwips lOffset, sal_Bool bSelect)
     553             : {
     554             :     // Do nothing if an offset of 0 was indicated
     555           0 :     if(!lOffset) return sal_False;
     556             :         // Was once used to force a reformat of the layout.
     557             :         // This has not work that way, because the cursor was not set
     558             :         // because this does not happen within a
     559             :         // Start-/EndActionParentheses.
     560             :         // Because only ViewShell::EndAction() is called at the end,
     561             :         // no updating of the display of the cursor position takes place.
     562             :         // The CrsrShell-Actionparentheses cannot be used, because it
     563             :         // always leads to displaying the cursor, thus also,
     564             :         // if after the scroll scrolled in a region without a valid postition.
     565             :         // ViewShell::StartAction();
     566           0 :     PageMove eDir = lOffset > 0? MV_PAGE_DOWN: MV_PAGE_UP;
     567             :         // Change of direction and stack present
     568           0 :     if( eDir != ePageMove && ePageMove != MV_NO && PopCrsr( sal_True, bSelect ))
     569           0 :         return sal_True;
     570             : 
     571           0 :     const sal_Bool bRet = PushCrsr(lOffset, bSelect);
     572           0 :     ePageMove = eDir;
     573           0 :     return bRet;
     574             : }
     575             : 
     576           1 : sal_Bool SwWrtShell::GotoPage(sal_uInt16 nPage, sal_Bool bRecord)
     577             : {
     578           1 :     ShellMoveCrsr aTmp( this, sal_False);
     579           1 :     if( SwCrsrShell::GotoPage(nPage) && bRecord)
     580             :     {
     581           1 :         if(IsSelFrmMode())
     582             :         {
     583           0 :             UnSelectFrm();
     584           0 :             LeaveSelFrmMode();
     585             :         }
     586           1 :         return sal_True;
     587             :     }
     588           0 :     return sal_False;
     589             : }
     590             : 
     591           0 : sal_Bool SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart )
     592             : {
     593           0 :     ShellMoveCrsr aTmp( this, bSelect );
     594           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     595           0 :     bool bRet = SwCrsrShell::GotoMark( pMark, bStart );
     596           0 :     if (bRet)
     597           0 :         aNavigationMgr.addEntry(aPos);
     598           0 :     return bRet;
     599             : }
     600             : 
     601           0 : sal_Bool SwWrtShell::GotoFly( const String& rName, FlyCntType eType, sal_Bool bSelFrame )
     602             : {
     603           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     604           0 :     bool bRet = SwFEShell::GotoFly(rName, eType, bSelFrame);
     605           0 :     if (bRet)
     606           0 :         aNavigationMgr.addEntry(aPos);
     607           0 :     return bRet;
     608             : }
     609             : 
     610           0 : bool SwWrtShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
     611             : {
     612           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     613           0 :     bool bRet = SwCrsrShell::GotoINetAttr(rAttr);
     614           0 :     if (bRet)
     615           0 :         aNavigationMgr.addEntry(aPos);
     616           0 :     return bRet;
     617             : }
     618             : 
     619           0 : void SwWrtShell::GotoOutline( sal_uInt16 nIdx )
     620             : {
     621           0 :     addCurrentPosition();
     622           0 :     SwCrsrShell::GotoOutline (nIdx);
     623           0 : }
     624             : 
     625           0 : bool SwWrtShell::GotoOutline( const String& rName )
     626             : {
     627           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     628           0 :     bool bRet = SwCrsrShell::GotoOutline (rName);
     629           0 :     if (bRet)
     630           0 :         aNavigationMgr.addEntry(aPos);
     631           0 :     return bRet;
     632             : }
     633             : 
     634           0 : bool SwWrtShell::GotoRegion( const String& rName )
     635             : {
     636           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     637           0 :     bool bRet = SwCrsrShell::GotoRegion (rName);
     638           0 :     if (bRet)
     639           0 :         aNavigationMgr.addEntry(aPos);
     640           0 :     return bRet;
     641             :  }
     642             : 
     643           0 : sal_Bool SwWrtShell::GotoRefMark( const String& rRefMark, sal_uInt16 nSubType,
     644             :                                     sal_uInt16 nSeqNo )
     645             : {
     646           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     647           0 :     bool bRet = SwCrsrShell::GotoRefMark(rRefMark, nSubType, nSeqNo);
     648           0 :     if (bRet)
     649           0 :         aNavigationMgr.addEntry(aPos);
     650           0 :     return bRet;
     651             : }
     652             : 
     653           0 : sal_Bool SwWrtShell::GotoNextTOXBase( const String* pName )
     654             : {
     655           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     656           0 :     bool bRet = SwCrsrShell::GotoNextTOXBase(pName);
     657           0 :     if (bRet)
     658           0 :         aNavigationMgr.addEntry(aPos);
     659           0 :     return bRet;
     660             : }
     661             : 
     662           9 : bool SwWrtShell::GotoTable( const String& rName )
     663             : {
     664           9 :    SwPosition aPos = *GetCrsr()->GetPoint();
     665           9 :     bool bRet = SwCrsrShell::GotoTable(rName);
     666           9 :     if (bRet)
     667           9 :         aNavigationMgr.addEntry(aPos);
     668           9 :     return bRet;
     669             : }
     670             : 
     671           0 : sal_Bool SwWrtShell::GotoFld( const SwFmtFld& rFld ) {
     672           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     673           0 :     bool bRet = SwCrsrShell::GotoFld(rFld);
     674           0 :     if (bRet)
     675           0 :         aNavigationMgr.addEntry(aPos);
     676           0 :     return bRet;
     677             : }
     678             : 
     679           0 : const SwRedline* SwWrtShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect ) {
     680           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     681           0 :     const SwRedline *pRedline = SwCrsrShell::GotoRedline(nArrPos, bSelect);
     682           0 :     if (pRedline)
     683           0 :         aNavigationMgr.addEntry(aPos);
     684           0 :     return pRedline;
     685             : }
     686             : 
     687           0 : sal_Bool SwWrtShell::SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr )
     688             : {
     689             :     sal_Bool bRet;
     690             :     {
     691           0 :         SwMvContext aMvContext(this);
     692           0 :         SttSelect();
     693           0 :         bRet = SwCrsrShell::SelectTxtAttr( nWhich, sal_False, pAttr );
     694             :     }
     695           0 :     EndSelect();
     696           0 :     return bRet;
     697          99 : }
     698             : 
     699             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10