LCOV - code coverage report
Current view: top level - sw/source/ui/wrtsh - move.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 76 338 22.5 %
Date: 2012-08-25 Functions: 16 45 35.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 66 560 11.8 %

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

Generated by: LCOV version 1.10