LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/wrtsh - move.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 339 8.0 %
Date: 2012-12-17 Functions: 6 45 13.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             : /*  Immer:
      27             :     -   Zuruecksetzen des Cursorstacks
      28             :     -   Timer nachtriggern
      29             :     -   gfs. GCAttr
      30             : 
      31             :     bei Selektion
      32             :     -   SttSelect()
      33             : 
      34             :     sonst
      35             :     -   EndSelect()
      36             :  */
      37             : 
      38             : const long nReadOnlyScrollOfst = 10;
      39             : 
      40             : class ShellMoveCrsr
      41             : {
      42             :     SwWrtShell* pSh;
      43             :     sal_Bool bAct;
      44             : public:
      45          14 :     inline ShellMoveCrsr( SwWrtShell* pWrtSh, sal_Bool bSel )
      46             :     {
      47          14 :         bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrmType(0,sal_False) & FRMTYPE_FLY_ANY);
      48          14 :         ( pSh = pWrtSh )->MoveCrsr( sal_Bool(bSel) );
      49          14 :         pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK);
      50          14 :     }
      51          14 :     inline ~ShellMoveCrsr()
      52             :     {
      53          14 :         if( bAct )
      54             :         {
      55             :             //Die Action wird fuer das Scrollen in "einabsaetzigen" Rahmen mit
      56             :             //fester Hoehe gebraucht.
      57           0 :             pSh->StartAllAction();
      58           0 :             pSh->EndAllAction();
      59             :         }
      60          14 :     }
      61             : };
      62             : 
      63          14 : void SwWrtShell::MoveCrsr( sal_Bool bWithSelect )
      64             : {
      65          14 :     ResetCursorStack();
      66          14 :     if ( IsGCAttr() )
      67             :     {
      68           0 :         GCAttr();
      69           0 :         ClearGCAttr();
      70             :     }
      71          14 :     if ( bWithSelect )
      72           0 :         SttSelect();
      73             :     else
      74             :     {
      75          14 :         EndSelect();
      76          14 :         (this->*fnKillSel)( 0, sal_False );
      77             :     }
      78          14 : }
      79             : 
      80           0 : sal_Bool SwWrtShell::SimpleMove( FNSimpleMove FnSimpleMove, sal_Bool bSelect )
      81             : {
      82             :     sal_Bool nRet;
      83           0 :     if( bSelect )
      84             :     {
      85           0 :         SttCrsrMove();
      86           0 :         MoveCrsr( sal_True );
      87           0 :         nRet = (this->*FnSimpleMove)();
      88           0 :         EndCrsrMove();
      89             :     }
      90           0 :     else if( 0 != ( nRet = (this->*FnSimpleMove)() ) )
      91           0 :         MoveCrsr( sal_False );
      92           0 :     return nRet;
      93             : }
      94             : 
      95             : 
      96           0 : sal_Bool SwWrtShell::Left( sal_uInt16 nMode, sal_Bool bSelect,
      97             :                             sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual )
      98             : {
      99           0 :     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           0 :         ShellMoveCrsr aTmp( this, bSelect );
     109           0 :         return SwCrsrShell::Left( nCount, nMode, bVisual );
     110             :     }
     111             : }
     112             : 
     113             : 
     114             : 
     115           0 : sal_Bool SwWrtShell::Right( sal_uInt16 nMode, sal_Bool bSelect,
     116             :                             sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual )
     117             : {
     118           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly() )
     119             :     {
     120           0 :         Point aTmp( VisArea().Pos() );
     121           0 :         aTmp.X() += VisArea().Width() * nReadOnlyScrollOfst / 100;
     122           0 :         aTmp.X() = rView.SetHScrollMax( aTmp.X() );
     123           0 :         rView.SetVisArea( aTmp );
     124           0 :         return sal_True;
     125             :     }
     126             :     else
     127             :     {
     128           0 :         ShellMoveCrsr aTmp( this, bSelect );
     129           0 :         return SwCrsrShell::Right( nCount, nMode, bVisual );
     130             :     }
     131             : }
     132             : 
     133             : 
     134             : 
     135           0 : sal_Bool SwWrtShell::Up( sal_Bool bSelect, sal_uInt16 nCount, sal_Bool bBasicCall )
     136             : {
     137           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly()  && !GetViewOptions()->IsSelectionInReadonly())
     138             :     {
     139           0 :         Point aTmp( VisArea().Pos() );
     140           0 :         aTmp.Y() -= VisArea().Height() * nReadOnlyScrollOfst / 100;
     141           0 :         rView.SetVisArea( aTmp );
     142           0 :         return sal_True;
     143             :     }
     144             :     else
     145             :     {
     146           0 :         ShellMoveCrsr aTmp( this, bSelect );
     147           0 :         return SwCrsrShell::Up( nCount );
     148             :     }
     149             : }
     150             : 
     151             : 
     152             : 
     153           0 : sal_Bool SwWrtShell::Down( sal_Bool bSelect, sal_uInt16 nCount, sal_Bool bBasicCall )
     154             : {
     155           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
     156             :     {
     157           0 :         Point aTmp( VisArea().Pos() );
     158           0 :         aTmp.Y() += VisArea().Height() * nReadOnlyScrollOfst / 100;
     159           0 :         aTmp.Y() = rView.SetVScrollMax( aTmp.Y() );
     160           0 :         rView.SetVisArea( aTmp );
     161           0 :         return sal_True;
     162             :     }
     163             :     else
     164             :     {
     165           0 :         ShellMoveCrsr aTmp( this, bSelect );
     166           0 :         return SwCrsrShell::Down( nCount );
     167             :     }
     168             : }
     169             : 
     170             : 
     171             : 
     172           0 : sal_Bool SwWrtShell::LeftMargin( sal_Bool bSelect, sal_Bool bBasicCall )
     173             : {
     174           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
     175             :     {
     176           0 :         Point aTmp( VisArea().Pos() );
     177           0 :         aTmp.X() = DOCUMENTBORDER;
     178           0 :         rView.SetVisArea( aTmp );
     179           0 :         return sal_True;
     180             :     }
     181             :     else
     182             :     {
     183           0 :         ShellMoveCrsr aTmp( this, bSelect );
     184           0 :         return SwCrsrShell::LeftMargin();
     185             :     }
     186             : }
     187             : 
     188             : 
     189             : 
     190           0 : sal_Bool SwWrtShell::RightMargin( sal_Bool bSelect, sal_Bool bBasicCall  )
     191             : {
     192           0 :     if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
     193             :     {
     194           0 :         Point aTmp( VisArea().Pos() );
     195           0 :         aTmp.X() = GetDocSize().Width() - VisArea().Width() + DOCUMENTBORDER;
     196           0 :         if( DOCUMENTBORDER > aTmp.X() )
     197           0 :             aTmp.X() = DOCUMENTBORDER;
     198           0 :         rView.SetVisArea( aTmp );
     199           0 :         return sal_True;
     200             :     }
     201             :     else
     202             :     {
     203           0 :         ShellMoveCrsr aTmp( this, bSelect );
     204           0 :         return SwCrsrShell::RightMargin(bBasicCall);
     205             :     }
     206             : }
     207             : 
     208             : 
     209             : 
     210           0 : sal_Bool SwWrtShell::GoStart( sal_Bool bKeepArea, sal_Bool *pMoveTable,
     211             :                             sal_Bool bSelect, sal_Bool bDontMoveRegion )
     212             : {
     213           0 :     if ( IsCrsrInTbl() )
     214             :     {
     215           0 :         const sal_Bool bBoxSelection = HasBoxSelection();
     216           0 :         if( !bBlockMode )
     217             :         {
     218           0 :             if ( !bSelect )
     219           0 :                 EnterStdMode();
     220             :             else
     221           0 :                 SttSelect();
     222             :         }
     223             :             // Tabellenzelle?
     224           0 :         if ( !bBoxSelection && (MoveSection( fnSectionCurr, fnSectionStart)
     225             :                 || bDontMoveRegion))
     226             :         {
     227           0 :             if ( pMoveTable )
     228           0 :                 *pMoveTable = sal_False;
     229           0 :             return sal_True;
     230             :         }
     231           0 :         if( MoveTable( fnTableCurr, fnTableStart ) || bDontMoveRegion )
     232             :         {
     233           0 :             if ( pMoveTable )
     234           0 :                 *pMoveTable = sal_True;
     235           0 :             return sal_True;
     236             :         }
     237           0 :         else if( bBoxSelection && pMoveTable )
     238             :         {
     239             :             // JP 09.01.96: wir haben eine Boxselektion (oder leere Zelle)
     240             :             //              und wollen selektieren (pMoveTable wird im
     241             :             //              SelAll gesetzt). Dann darf die Tabelle nicht
     242             :             //              verlassen werden; sonst ist keine Selektion der
     243             :             //              gesamten Tabelle moeglich!
     244           0 :             *pMoveTable = sal_True;
     245           0 :             return sal_True;
     246             :         }
     247             :     }
     248             : 
     249           0 :     if( !bBlockMode )
     250             :     {
     251           0 :         if ( !bSelect )
     252           0 :             EnterStdMode();
     253             :         else
     254           0 :             SttSelect();
     255             :     }
     256           0 :     const sal_uInt16 nFrmType = GetFrmType(0,sal_False);
     257           0 :     if ( FRMTYPE_FLY_ANY & nFrmType )
     258             :     {
     259           0 :         if( MoveSection( fnSectionCurr, fnSectionStart ) )
     260           0 :             return sal_True;
     261           0 :         else if ( FRMTYPE_FLY_FREE & nFrmType || bDontMoveRegion )
     262           0 :             return sal_False;
     263             :     }
     264           0 :     if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
     265             :     {
     266           0 :         if ( MoveSection( fnSectionCurr, fnSectionStart ) )
     267           0 :             return sal_True;
     268           0 :         else if ( bKeepArea )
     269           0 :             return sal_True;
     270             :     }
     271             :     // Bereiche ???
     272           0 :     return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionStart ) ||
     273           0 :            SwCrsrShell::SttEndDoc(sal_True);
     274             : }
     275             : 
     276             : 
     277             : 
     278           0 : sal_Bool SwWrtShell::GoEnd(sal_Bool bKeepArea, sal_Bool *pMoveTable)
     279             : {
     280           0 :     if ( pMoveTable && *pMoveTable )
     281           0 :         return MoveTable( fnTableCurr, fnTableEnd );
     282             : 
     283           0 :     if ( IsCrsrInTbl() )
     284             :     {
     285           0 :         if ( MoveSection( fnSectionCurr, fnSectionEnd ) ||
     286           0 :              MoveTable( fnTableCurr, fnTableEnd ) )
     287           0 :             return sal_True;
     288             :     }
     289             :     else
     290             :     {
     291           0 :         const sal_uInt16 nFrmType = GetFrmType(0,sal_False);
     292           0 :         if ( FRMTYPE_FLY_ANY & nFrmType )
     293             :         {
     294           0 :             if ( MoveSection( fnSectionCurr, fnSectionEnd ) )
     295           0 :                 return sal_True;
     296           0 :             else if ( FRMTYPE_FLY_FREE & nFrmType )
     297           0 :                 return sal_False;
     298             :         }
     299           0 :         if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
     300             :         {
     301           0 :             if ( MoveSection( fnSectionCurr, fnSectionEnd) )
     302           0 :                 return sal_True;
     303           0 :             else if ( bKeepArea )
     304           0 :                 return sal_True;
     305             :         }
     306             :     }
     307             :     // Bereiche ???
     308           0 :     return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionEnd ) ||
     309           0 :            SwCrsrShell::SttEndDoc(sal_False);
     310             : }
     311             : 
     312             : 
     313             : 
     314           0 : sal_Bool SwWrtShell::SttDoc( sal_Bool bSelect )
     315             : {
     316           0 :     ShellMoveCrsr aTmp( this, bSelect );
     317           0 :     return GoStart(sal_False, 0, bSelect );
     318             : }
     319             : 
     320             : 
     321             : 
     322           0 : sal_Bool SwWrtShell::EndDoc( sal_Bool bSelect)
     323             : {
     324           0 :     ShellMoveCrsr aTmp( this, bSelect );
     325           0 :     return GoEnd();
     326             : }
     327             : 
     328             : 
     329           0 : sal_Bool SwWrtShell::SttNxtPg( sal_Bool bSelect )
     330             : {
     331           0 :     ShellMoveCrsr aTmp( this, bSelect );
     332           0 :     return MovePage( fnPageNext, fnPageStart );
     333             : }
     334             : 
     335             : 
     336             : 
     337           0 : sal_Bool SwWrtShell::SttPrvPg( sal_Bool bSelect )
     338             : {
     339           0 :     ShellMoveCrsr aTmp( this, bSelect );
     340           0 :     return MovePage( fnPagePrev, fnPageStart );
     341             : }
     342             : 
     343             : 
     344             : 
     345           0 : sal_Bool SwWrtShell::EndNxtPg( sal_Bool bSelect )
     346             : {
     347           0 :     ShellMoveCrsr aTmp( this, bSelect );
     348           0 :     return MovePage( fnPageNext, fnPageEnd );
     349             : }
     350             : 
     351             : 
     352             : 
     353           0 : sal_Bool SwWrtShell::EndPrvPg( sal_Bool bSelect )
     354             : {
     355           0 :     ShellMoveCrsr aTmp( this, bSelect );
     356           0 :     return MovePage( fnPagePrev, fnPageEnd );
     357             : }
     358             : 
     359             : 
     360             : 
     361          14 : sal_Bool SwWrtShell::SttPg( sal_Bool bSelect )
     362             : {
     363          14 :     ShellMoveCrsr aTmp( this, bSelect );
     364          14 :     return MovePage( fnPageCurr, fnPageStart );
     365             : }
     366             : 
     367             : 
     368             : 
     369           0 : sal_Bool SwWrtShell::EndPg( sal_Bool bSelect )
     370             : {
     371           0 :     ShellMoveCrsr aTmp( this, bSelect );
     372           0 :     return MovePage( fnPageCurr, fnPageEnd );
     373             : }
     374             : 
     375             : 
     376             : 
     377           0 : sal_Bool SwWrtShell::SttPara( sal_Bool bSelect )
     378             : {
     379           0 :     ShellMoveCrsr aTmp( this, bSelect );
     380           0 :     return MovePara( fnParaCurr, fnParaStart );
     381             : }
     382             : 
     383             : 
     384             : 
     385           0 : sal_Bool SwWrtShell::EndPara( sal_Bool bSelect )
     386             : {
     387           0 :     ShellMoveCrsr aTmp( this, bSelect );
     388           0 :     return MovePara(fnParaCurr,fnParaEnd);
     389             : }
     390             : 
     391             : 
     392             : /*------------------------------------------------------------------------
     393             :  Beschreibung:  Spaltenweises Springen
     394             :  Parameter:     mit oder ohne SSelection
     395             :  Return:        Erfolg oder Misserfolg
     396             : ------------------------------------------------------------------------*/
     397             : 
     398             : 
     399             : 
     400           0 : sal_Bool SwWrtShell::StartOfColumn( sal_Bool bSelect )
     401             : {
     402           0 :     ShellMoveCrsr aTmp( this, bSelect);
     403           0 :     return MoveColumn(fnColumnCurr, fnColumnStart);
     404             : }
     405             : 
     406             : 
     407             : 
     408           0 : sal_Bool SwWrtShell::EndOfColumn( sal_Bool bSelect )
     409             : {
     410           0 :     ShellMoveCrsr aTmp( this, bSelect);
     411           0 :     return MoveColumn(fnColumnCurr, fnColumnEnd);
     412             : }
     413             : 
     414             : 
     415             : 
     416           0 : sal_Bool SwWrtShell::StartOfNextColumn( sal_Bool bSelect )
     417             : {
     418           0 :     ShellMoveCrsr aTmp( this, bSelect);
     419           0 :     return MoveColumn( fnColumnNext, fnColumnStart);
     420             : }
     421             : 
     422             : 
     423             : 
     424           0 : sal_Bool SwWrtShell::EndOfNextColumn( sal_Bool bSelect )
     425             : {
     426           0 :     ShellMoveCrsr aTmp( this, bSelect);
     427           0 :     return MoveColumn(fnColumnNext, fnColumnEnd);
     428             : }
     429             : 
     430             : 
     431             : 
     432           0 : sal_Bool SwWrtShell::StartOfPrevColumn( sal_Bool bSelect )
     433             : {
     434           0 :     ShellMoveCrsr aTmp( this, bSelect);
     435           0 :     return MoveColumn(fnColumnPrev, fnColumnStart);
     436             : }
     437             : 
     438             : 
     439             : 
     440           0 : sal_Bool SwWrtShell::EndOfPrevColumn( sal_Bool bSelect )
     441             : {
     442           0 :     ShellMoveCrsr aTmp( this, bSelect);
     443           0 :     return MoveColumn(fnColumnPrev, fnColumnEnd);
     444             : }
     445             : 
     446             : 
     447             : 
     448           0 : sal_Bool SwWrtShell::PushCrsr(SwTwips lOffset, sal_Bool bSelect)
     449             : {
     450           0 :     sal_Bool bDiff = sal_False;
     451           0 :     SwRect aOldRect( GetCharRect() ), aTmpArea( VisArea() );
     452             : 
     453             :     //bDestOnStack besagt, ob ich den Cursor nicht an die aktuelle Position
     454             :     //setzen konnte, da in diesem Bereich kein Inhalt vorhanden ist.
     455           0 :     if( !bDestOnStack )
     456             :     {
     457           0 :         Point aPt( aOldRect.Center() );
     458             : 
     459           0 :         if( !IsCrsrVisible() )
     460             :             // set CrsrPos to top-/bottom left pos. So the pagescroll is not
     461             :             // be dependent on the current cursor, but on the visarea.
     462           0 :             aPt.Y() = aTmpArea.Top() + aTmpArea.Height() / 2;
     463             : 
     464           0 :         aPt.Y() += lOffset;
     465           0 :         aDest = GetCntntPos(aPt,lOffset > 0);
     466           0 :         aDest.X() = aPt.X();
     467           0 :         bDestOnStack = sal_True;
     468             :     }
     469             : 
     470             :     //falls wir eine Rahmenselektion hatten, muss diese nach dem
     471             :     //fnSetCrsr entfernt werden und damit wir da wieder hinkommen
     472             :     //auf dem Stack gemerkt werden.
     473           0 :     sal_Bool bIsFrmSel = sal_False;
     474             : 
     475           0 :     sal_Bool bIsObjSel = sal_False;
     476             : 
     477             :     //Zielposition liegt jetzt innerhalb des sichtbaren Bereiches -->
     478             :     //Cursor an die Zielposition setzen; merken, dass keine Ziel-
     479             :     //position mehr auf dem Stack steht.
     480             :     //Der neue sichtbare Bereich wird zuvor ermittelt.
     481           0 :     aTmpArea.Pos().Y() += lOffset;
     482           0 :     if( aTmpArea.IsInside(aDest) )
     483             :     {
     484           0 :         if( bSelect )
     485           0 :             SttSelect();
     486             :         else
     487           0 :             EndSelect();
     488             : 
     489           0 :         bIsFrmSel = IsFrmSelected();
     490           0 :         bIsObjSel = 0 != IsObjSelected();
     491             : 
     492             :         // Rahmenselektion aufheben
     493           0 :         if( bIsFrmSel || bIsObjSel )
     494             :         {
     495           0 :             UnSelectFrm();
     496           0 :             LeaveSelFrmMode();
     497           0 :             if ( bIsObjSel )
     498             :             {
     499           0 :                 GetView().SetDrawFuncPtr( NULL );
     500           0 :                 GetView().LeaveDrawCreate();
     501             :             }
     502             : 
     503           0 :             CallChgLnk();
     504             :         }
     505             : 
     506           0 :         (this->*fnSetCrsr)( &aDest, sal_True );
     507             : 
     508           0 :         bDiff = aOldRect != GetCharRect();
     509             : 
     510           0 :         if( bIsFrmSel )
     511             :         {
     512             :             // bei Frames immer nur die obere Ecke nehmen, damit dieser
     513             :             // wieder selektiert werden kann
     514           0 :             aOldRect.SSize( 5, 5 );
     515             :         }
     516             : 
     517             :             // Zuruecksetzen des Dest. SPoint Flags
     518           0 :         bDestOnStack = sal_False;
     519             :     }
     520             : 
     521             :     // Position auf den Stack; bDiff besagt, ob ein Unterschied zwischen
     522             :     // der alten und der neuen Cursorposition besteht.
     523             :     pCrsrStack = new CrsrStack( bDiff, bIsFrmSel, aOldRect.Center(),
     524           0 :                                 lOffset, pCrsrStack );
     525           0 :     return !bDestOnStack && bDiff;
     526             : }
     527             : 
     528             : 
     529             : 
     530          72 : sal_Bool SwWrtShell::PopCrsr(sal_Bool bUpdate, sal_Bool bSelect)
     531             : {
     532          72 :     if( 0 == pCrsrStack)
     533          72 :         return sal_False;
     534             : 
     535           0 :     const sal_Bool bValidPos = pCrsrStack->bValidCurPos;
     536           0 :     if( bUpdate && bValidPos )
     537             :     {
     538             :             // falls ein Vorgaenger auf dem Stack steht, dessen Flag fuer eine
     539             :             // gueltige Position verwenden.
     540           0 :         SwRect aTmpArea(VisArea());
     541           0 :         aTmpArea.Pos().Y() -= pCrsrStack->lOffset;
     542           0 :         if( aTmpArea.IsInside( pCrsrStack->aDocPos ) )
     543             :         {
     544           0 :             if( bSelect )
     545           0 :                 SttSelect();
     546             :             else
     547           0 :                 EndSelect();
     548             : 
     549           0 :             (this->*fnSetCrsr)(&pCrsrStack->aDocPos, !pCrsrStack->bIsFrmSel);
     550           0 :             if( pCrsrStack->bIsFrmSel && IsObjSelectable(pCrsrStack->aDocPos))
     551             :             {
     552           0 :                 HideCrsr();
     553           0 :                 SelectObj( pCrsrStack->aDocPos );
     554           0 :                 EnterSelFrmMode( &pCrsrStack->aDocPos );
     555             :             }
     556             :         }
     557             :             // Falls eine Verschiebung zwischen dem sichtbaren Bereich
     558             :             // und der gemerkten Cursorpositionen auftritt, werden
     559             :             // alle gemerkten Positionen weggeschmissen
     560             :         else
     561             :         {
     562           0 :             _ResetCursorStack();
     563           0 :             return sal_False;
     564             :         }
     565             :     }
     566           0 :     CrsrStack *pTmp = pCrsrStack;
     567           0 :     pCrsrStack = pCrsrStack->pNext;
     568           0 :     delete pTmp;
     569           0 :     if( 0 == pCrsrStack )
     570             :     {
     571           0 :         ePageMove = MV_NO;
     572           0 :         bDestOnStack = sal_False;
     573             :     }
     574           0 :     return bValidPos;
     575             : }
     576             : 
     577             : /*
     578             :  * Zuruecksetzen aller gepushten Cursorpositionen; dieser werden nicht
     579             :  * zur Anzeige gebracht ( --> Kein Start-/EndAction!!)
     580             :  */
     581             : 
     582             : 
     583             : 
     584           0 : void SwWrtShell::_ResetCursorStack()
     585             : {
     586           0 :     CrsrStack *pTmp = pCrsrStack;
     587           0 :     while(pCrsrStack)
     588             :     {
     589           0 :         pTmp = pCrsrStack->pNext;
     590           0 :         delete pCrsrStack;
     591           0 :         pCrsrStack = pTmp;
     592             :     }
     593           0 :     ePageMove = MV_NO;
     594           0 :     bDestOnStack = sal_False;
     595           0 : }
     596             : /**************
     597             : 
     598             :     falls kein Stack existiert --> Selektionen aufheben
     599             :     falls Stack && Richtungswechsel
     600             :         --> Cursor poppen und return
     601             :     sonst
     602             :         --> Cursor pushen
     603             :              Cursor umsetzen
     604             : 
     605             : ***************/
     606             : 
     607             : 
     608             : 
     609           0 : sal_Bool SwWrtShell::PageCrsr(SwTwips lOffset, sal_Bool bSelect)
     610             : {
     611             :     // nichts tun, wenn ein Offset von 0 angegeben wurde
     612           0 :     if(!lOffset) return sal_False;
     613             :         // Diente mal dazu, eine Neuformatierung fuer das Layout
     614             :         // zu erzwingen.
     615             :         // Hat so nicht funktioniert, da der Cursor nicht gesetzt
     616             :         // wurde, da dies innerhalb einer Start- / EndActionklammerung
     617             :         // nicht geschieht.
     618             :         // Da am Ende nur ViewShell::EndAction() gerufen wird,
     619             :         // findet auch hier keine Aktualisierung der Anzeige
     620             :         // der Cursorposition statt.
     621             :         // Die CrsrShell- Actionklammerung kann nicht verwendet werden,
     622             :         // da sie immer zu einer Anzeige des Cursors fuehrt, also auch,
     623             :         // wenn nach dem Blaettern in einen Bereich ohne gueltige Position
     624             :         // geblaettert wurde.
     625             :         //  ViewShell::StartAction();
     626           0 :     PageMove eDir = lOffset > 0? MV_PAGE_DOWN: MV_PAGE_UP;
     627             :         // Richtungswechsel und Stack vorhanden
     628           0 :     if( eDir != ePageMove && ePageMove != MV_NO && PopCrsr( sal_True, bSelect ))
     629           0 :         return sal_True;
     630             : 
     631           0 :     const sal_Bool bRet = PushCrsr(lOffset, bSelect);
     632           0 :     ePageMove = eDir;
     633           0 :     return bRet;
     634             : }
     635             : 
     636             : 
     637             : 
     638           0 : sal_Bool SwWrtShell::GotoPage(sal_uInt16 nPage, sal_Bool bRecord)
     639             : {
     640           0 :     ShellMoveCrsr aTmp( this, sal_False);
     641           0 :     if( SwCrsrShell::GotoPage(nPage) && bRecord)
     642             :     {
     643           0 :         if(IsSelFrmMode())
     644             :         {
     645           0 :             UnSelectFrm();
     646           0 :             LeaveSelFrmMode();
     647             :         }
     648           0 :         return sal_True;
     649             :     }
     650           0 :     return sal_False;
     651             : }
     652             : 
     653             : 
     654             : 
     655           0 : sal_Bool SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart )
     656             : {
     657           0 :     ShellMoveCrsr aTmp( this, bSelect );
     658           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     659           0 :     bool bRet = SwCrsrShell::GotoMark( pMark, bStart );
     660           0 :     if (bRet)
     661           0 :         aNavigationMgr.addEntry(aPos);
     662           0 :     return bRet;
     663             : }
     664             : 
     665           0 : sal_Bool SwWrtShell::GotoFly( const String& rName, FlyCntType eType, sal_Bool bSelFrame )
     666             : {
     667           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     668           0 :     bool bRet = SwFEShell::GotoFly(rName, eType, bSelFrame);
     669           0 :     if (bRet)
     670           0 :         aNavigationMgr.addEntry(aPos);
     671           0 :     return bRet;
     672             : }
     673             : 
     674           0 : bool SwWrtShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
     675             : {
     676           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     677           0 :     bool bRet = SwCrsrShell::GotoINetAttr(rAttr);
     678           0 :     if (bRet)
     679           0 :         aNavigationMgr.addEntry(aPos);
     680           0 :     return bRet;
     681             : }
     682             : 
     683           0 : void SwWrtShell::GotoOutline( sal_uInt16 nIdx )
     684             : {
     685           0 :     addCurrentPosition();
     686           0 :     SwCrsrShell::GotoOutline (nIdx);
     687           0 : }
     688             : 
     689           0 : bool SwWrtShell::GotoOutline( const String& rName )
     690             : {
     691           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     692           0 :     bool bRet = SwCrsrShell::GotoOutline (rName);
     693           0 :     if (bRet)
     694           0 :         aNavigationMgr.addEntry(aPos);
     695           0 :     return bRet;
     696             : }
     697             : 
     698           0 : bool SwWrtShell::GotoRegion( const String& rName )
     699             : {
     700           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     701           0 :     bool bRet = SwCrsrShell::GotoRegion (rName);
     702           0 :     if (bRet)
     703           0 :         aNavigationMgr.addEntry(aPos);
     704           0 :     return bRet;
     705             :  }
     706             : 
     707           0 : sal_Bool SwWrtShell::GotoRefMark( const String& rRefMark, sal_uInt16 nSubType,
     708             :                                     sal_uInt16 nSeqNo )
     709             : {
     710           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     711           0 :     bool bRet = SwCrsrShell::GotoRefMark(rRefMark, nSubType, nSeqNo);
     712           0 :     if (bRet)
     713           0 :         aNavigationMgr.addEntry(aPos);
     714           0 :     return bRet;
     715             : }
     716             : 
     717           0 : sal_Bool SwWrtShell::GotoNextTOXBase( const String* pName )
     718             : {
     719           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     720           0 :     bool bRet = SwCrsrShell::GotoNextTOXBase(pName);
     721           0 :     if (bRet)
     722           0 :         aNavigationMgr.addEntry(aPos);
     723           0 :     return bRet;
     724             : }
     725             : 
     726          16 : bool SwWrtShell::GotoTable( const String& rName )
     727             : {
     728          16 :    SwPosition aPos = *GetCrsr()->GetPoint();
     729          16 :     bool bRet = SwCrsrShell::GotoTable(rName);
     730          16 :     if (bRet)
     731          16 :         aNavigationMgr.addEntry(aPos);
     732          16 :     return bRet;
     733             : }
     734             : 
     735           0 : sal_Bool SwWrtShell::GotoFld( const SwFmtFld& rFld ) {
     736           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     737           0 :     bool bRet = SwCrsrShell::GotoFld(rFld);
     738           0 :     if (bRet)
     739           0 :         aNavigationMgr.addEntry(aPos);
     740           0 :     return bRet;
     741             : }
     742             : 
     743           0 : const SwRedline* SwWrtShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect ) {
     744           0 :     SwPosition aPos = *GetCrsr()->GetPoint();
     745           0 :     const SwRedline *pRedline = SwCrsrShell::GotoRedline(nArrPos, bSelect);
     746           0 :     if (pRedline)
     747           0 :         aNavigationMgr.addEntry(aPos);
     748           0 :     return pRedline;
     749             : }
     750             : 
     751             : 
     752             : 
     753           0 : sal_Bool SwWrtShell::SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr )
     754             : {
     755             :     sal_Bool bRet;
     756             :     {
     757           0 :         SwMvContext aMvContext(this);
     758           0 :         SttSelect();
     759           0 :         bRet = SwCrsrShell::SelectTxtAttr( nWhich, sal_False, pAttr );
     760             :     }
     761           0 :     EndSelect();
     762           0 :     return bRet;
     763             : }
     764             : 
     765             : 
     766             : 
     767             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10