LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - crsrsh.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 84 28.6 %
Date: 2012-12-27 Functions: 17 59 28.8 %
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             : #ifndef SW_CRSRSH_HXX
      20             : #define SW_CRSRSH_HXX
      21             : 
      22             : #include <com/sun/star/i18n/WordType.hpp>
      23             : 
      24             : #include <tools/string.hxx>
      25             : #include <tools/link.hxx>
      26             : #include <tools/rtti.hxx>
      27             : 
      28             : #include <IShellCursorSupplier.hxx>
      29             : #include "swdllapi.h"
      30             : #include <swtypes.hxx>          // for SWPOSDOC
      31             : #include <viewsh.hxx>           // for ViewShell
      32             : #include <calbck.hxx>           // for SwClient
      33             : #include <cshtyp.hxx>           // for CursorShell types
      34             : #include <crstate.hxx>          // for CursorMove-States
      35             : #include <toxe.hxx>             // SwTOXSearchDir
      36             : #include <tblsel.hxx>           // SwTblSearchType
      37             : #include <viscrs.hxx>
      38             : #include <node.hxx>
      39             : #include <tblsel.hxx>
      40             : #include <IDocumentMarkAccess.hxx>
      41             : 
      42             : class KeyCode;
      43             : class SfxItemSet;
      44             : class SfxPoolItem;
      45             : class SwCntntFrm;
      46             : class SwCrsrShell;
      47             : class SwCursor;
      48             : class SwField;
      49             : class SwFieldType;
      50             : class SwFmt;
      51             : class SwFmtFld;
      52             : class SwNodeIndex;
      53             : class SwPaM;
      54             : class SwShellCrsr;
      55             : class SwShellTableCrsr;
      56             : class SwTableNode;
      57             : class SwTxtFmtColl;
      58             : class SwVisCrsr;
      59             : class SwTxtINetFmt;
      60             : class SwFmtINetFmt;
      61             : class SwTxtAttr;
      62             : class SwTableBox;
      63             : class SwTOXMark;
      64             : class SwRedline;
      65             : class IBlockCursor;
      66             : class SwCntntNode;
      67             : 
      68             : class SwPostItField;
      69             : 
      70             : struct SwPosition;
      71             : 
      72             : namespace com { namespace sun { namespace star { namespace util {
      73             :     struct SearchOptions;
      74             : } } } }
      75             : 
      76             : namespace com { namespace sun { namespace star { namespace text {
      77             :     class XTextRange;
      78             : }}}}
      79             : 
      80             : namespace com { namespace sun { namespace star { namespace container {
      81             :     class XStringKeyMap;
      82             : }}}}
      83             : 
      84             : // enum and struct to get informations via the Doc-Position
      85             : 
      86           0 : struct SwContentAtPos
      87             : {
      88             :     enum IsAttrAtPos
      89             :     {
      90             :         SW_NOTHING          = 0x0000,
      91             :         SW_FIELD            = 0x0001,
      92             :         SW_CLICKFIELD       = 0x0002,
      93             :         SW_FTN              = 0x0004,
      94             :         SW_INETATTR         = 0x0008,
      95             :         SW_TABLEBOXFML      = 0x0010,
      96             :         SW_REDLINE          = 0x0020,
      97             :         SW_OUTLINE          = 0x0040,
      98             :         SW_TOXMARK          = 0x0080,
      99             :         SW_REFMARK          = 0x0100,
     100             :         SW_NUMLABEL         = 0x0200,
     101             :         SW_CONTENT_CHECK    = 0x0400,
     102             :         SW_SMARTTAG         = 0x0800,
     103             :         SW_FORMCTRL         = 0x1000
     104             : #ifdef DBG_UTIL
     105             :         ,SW_CURR_ATTRS      = 0x4000        ///< only for debugging
     106             :         ,SW_TABLEBOXVALUE   = 0x8000        ///< only for debugging
     107             : #endif
     108             :     } eCntntAtPos;
     109             : 
     110             :     union {
     111             :         const SwField* pFld;
     112             :         const SfxPoolItem* pAttr;
     113             :         const SwRedline* pRedl;
     114             :         SwCntntNode * pNode;
     115             :         const sw::mark::IFieldmark* pFldmark;
     116             :     } aFnd;
     117             : 
     118             :     int nDist;
     119             : 
     120             :     String sStr;
     121             :     const SwTxtAttr* pFndTxtAttr;
     122             : 
     123           0 :     SwContentAtPos( int eGetAtPos = 0xffff )
     124           0 :         : eCntntAtPos( (IsAttrAtPos)eGetAtPos )
     125             :     {
     126           0 :         aFnd.pFld = 0;
     127           0 :         pFndTxtAttr = 0;
     128           0 :         nDist = 0; // #i23726#
     129           0 :     }
     130             : 
     131             :     bool IsInProtectSect() const;
     132             :     bool     IsInRTLText()const;
     133             : };
     134             : 
     135             : // return values of SetCrsr (can be combined via ||)
     136             : const int CRSR_POSOLD = 0x01,   // cursor stays at old position
     137             :           CRSR_POSCHG = 0x02;   // position changed by the layout
     138             : 
     139             : /// Helperfunction to resolve backward references in regular expressions
     140             : String *ReplaceBackReferences( const com::sun::star::util::SearchOptions& rSearchOpt, SwPaM* pPam );
     141             : 
     142             : class SW_DLLPUBLIC SwCrsrShell
     143             :     : public ViewShell
     144             :     , public SwModify
     145             :     , public ::sw::IShellCursorSupplier
     146             : {
     147             :     friend class SwCallLink;
     148             :     friend class SwVisCrsr;
     149             :     friend class SwSelPaintRects;
     150             : 
     151             :     // requires the Crsr as InternalCrsr
     152             :     friend sal_Bool GetAutoSumSel( const SwCrsrShell&, SwCellFrms& );
     153             : 
     154             : public:
     155             : 
     156             :     /** for calling UpdateCrsr */
     157             :     enum CrsrFlag {
     158             :         UPDOWN      = (1 << 0),     ///< keep Up/Down on columns
     159             :         SCROLLWIN   = (1 << 1),     ///< scroll window
     160             :         CHKRANGE    = (1 << 2),     ///< check overlapping PaMs
     161             :         NOCALRECT   = (1 << 3),     ///< don't recalculate CharRect
     162             :         READONLY    = (1 << 4)      ///< make visible in spite of Readonly
     163             :     };
     164             : 
     165             : private:
     166             : 
     167             :     SwRect  aCharRect;          ///< Char-SRectangle on which the cursor is located
     168             :     Point   aCrsrHeight;        ///< height & offset from visible Cursor
     169             :     Point   aOldRBPos;          ///< Right/Bottom of last VisArea
     170             :                                 // (used in Invalidate by Cursor)
     171             : 
     172             :     Link aFlyMacroLnk;          /**< Link will be called, if the Crsr is set
     173             :                                    into a fly. A macro can be then becalled */
     174             :     Link aChgLnk;               /**< link will be called by every attribut/
     175             :                                    format changes at cursor position.*/
     176             :     Link aGrfArrivedLnk;        ///< Link calls to UI if a graphic is arrived
     177             : 
     178             :     SwShellCrsr* pCurCrsr;      ///< current cursor
     179             :     SwShellCrsr* pCrsrStk;      ///< stack for the cursor
     180             :     SwVisCrsr *pVisCrsr;        ///< the visible cursor
     181             : 
     182             :     IBlockCursor *pBlockCrsr;   ///< interface of cursor for block (=rectangular) selection
     183             : 
     184             :     SwShellTableCrsr* pTblCrsr; /**< table Crsr; only in tables when the
     185             :                                    selection lays over 2 columns */
     186             : 
     187             :     SwNodeIndex* pBoxIdx;       ///< for recognizing of the changed
     188             :     SwTableBox* pBoxPtr;        ///< table row
     189             : 
     190             :     long nUpDownX;              /**< try to move the cursor on up/down always
     191             :                                    in the same column */
     192             :     long nLeftFrmPos;
     193             :     sal_uLong nAktNode;             // save CursorPos at Start-Action
     194             :     xub_StrLen nAktCntnt;
     195             :     sal_uInt16 nAktNdTyp;
     196             :     bool bAktSelection;
     197             : 
     198             :     /*
     199             :      * Via the Method SttCrsrMove and EndCrsrMove this counter gets
     200             :      * incremented/decremented. As long as the counter is inequal to 0, the
     201             :      * current Cursor gets no update. This way, "complicated" cursor movements
     202             :      * (via Find()) can be realised.
     203             :      */
     204             :     sal_uInt16 nCrsrMove;
     205             :     sal_uInt16 nBasicActionCnt;     ///< Actions which are parenthesized by Basic
     206             :     CrsrMoveState eMvState;     ///< Status for Crsr-Travelling - GetCrsrOfst
     207             : 
     208             :     String sMarkedListId;
     209             :     int nMarkedListLevel;
     210             : 
     211             :     sal_Bool bHasFocus : 1;         ///< Shell is "active" in a window
     212             :     sal_Bool bSVCrsrVis : 1;        ///< SV-Cursor visible/invisible
     213             :     sal_Bool bChgCallFlag : 1;      ///< attribute change inside Start- and EndAction
     214             :     sal_Bool bVisPortChgd : 1;      ///< in VisPortChg-Call
     215             :                                 // (used in Invalidate by the Cursor)
     216             : 
     217             :     sal_Bool bCallChgLnk : 1;       ///< flag for derived classes
     218             :                                 // TRUE -> call ChgLnk
     219             :                                 // access only via SwChgLinkFlag
     220             :     sal_Bool bAllProtect : 1;       ///< Flag for areas
     221             :                                 // TRUE -> everything protected / hidden
     222             :     sal_Bool bInCMvVisportChgd : 1; ///< Flag for CrsrMoves
     223             :                                 // TRUE -> view was moved
     224             :     sal_Bool bGCAttr : 1;           // TRUE -> non expanded attributes exist.
     225             :     sal_Bool bIgnoreReadonly : 1;   // TRUE -> make the cursor visible on next
     226             :                                 // EndAction in spite of Readonly
     227             :     sal_Bool bSelTblCells : 1;      // TRUE -> select cells over the InputWin
     228             :     sal_Bool bAutoUpdateCells : 1;  // TRUE -> autoformat cells
     229             :     sal_Bool bBasicHideCrsr : 1;    // TRUE -> HideCrsr from Basic
     230             :     sal_Bool bSetCrsrInReadOnly : 1;// TRUE -> Cursor is allowed in ReadOnly-Areas
     231             :     sal_Bool bOverwriteCrsr : 1;    // sal_True -> show Overwrite Crsr
     232             : 
     233             :     bool mbMacroExecAllowed : 1;
     234             : 
     235             :     SW_DLLPRIVATE void UpdateCrsr( sal_uInt16 eFlags
     236             :                             =SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE,
     237             :                      sal_Bool bIdleEnd = sal_False );
     238             : 
     239             :     SW_DLLPRIVATE void _ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing );
     240             : 
     241             :     /** Mark a certain list level of a certain list
     242             : 
     243             :         levels of a certain lists are marked now
     244             : 
     245             :         @param sListId    list Id of the list whose level is marked
     246             :         @param nLevel     to be marked list level
     247             : 
     248             :         An empty sListId denotes that no level of a list is marked.
     249             :      */
     250             :     SW_DLLPRIVATE void MarkListLevel( const String& sListId,
     251             :                                       const int nLevel );
     252             : 
     253             :     // private method(s) accessed from public inline method(s) must be exported.
     254             :                   sal_Bool LeftRight( sal_Bool, sal_uInt16, sal_uInt16, sal_Bool );
     255             :     SW_DLLPRIVATE sal_Bool UpDown( sal_Bool, sal_uInt16 );
     256             :     SW_DLLPRIVATE sal_Bool LRMargin( sal_Bool, sal_Bool bAPI = sal_False );
     257             :     SW_DLLPRIVATE sal_Bool IsAtLRMargin( sal_Bool, sal_Bool bAPI = sal_False ) const;
     258             : 
     259             :     SW_DLLPRIVATE short GetTextDirection( const Point* pPt = 0 ) const;
     260             : 
     261             : typedef sal_Bool (SwCursor:: *FNCrsr)();
     262             :     SW_DLLPRIVATE sal_Bool CallCrsrFN( FNCrsr );
     263             : 
     264             :     SW_DLLPRIVATE const SwRedline* _GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect );
     265             : 
     266             : protected:
     267             : 
     268             :     inline SwMoveFnCollection* MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const;
     269             : 
     270             :     /*
     271             :      * Compare-Methode for the StackCursor and the current Cursor.
     272             :      * The Methods return -1, 0, 1 for lower, equal, greater. The enum
     273             :      * CrsrCompareType says which position is compared.
     274             :      */
     275             :     enum CrsrCompareType {
     276             :         StackPtStackMk,
     277             :         StackPtCurrPt,
     278             :         StackPtCurrMk,
     279             :         StackMkCurrPt,
     280             :         StackMkCurrMk,
     281             :         CurrPtCurrMk
     282             :     };
     283             :     int CompareCursor( CrsrCompareType eType ) const;
     284             : 
     285             :     // set all PaMs in OldNode to NewPos + Offset
     286             :     void PaMCorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos,
     287             :                     const xub_StrLen nOffset = 0 );
     288             : 
     289             :     bool _SelTblRowOrCol( bool bRow, bool bRowSimple = false );
     290             : 
     291             :     bool SetInFrontOfLabel( bool bNew );
     292             : 
     293             :     void RefreshBlockCursor();
     294             : 
     295             :     /** Updates the marked list level according to the cursor.
     296             :     */
     297             :     SW_DLLPRIVATE void UpdateMarkedListLevel();
     298             : 
     299             : protected:
     300             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
     301             : 
     302             : public:
     303             :     TYPEINFO();
     304             :     SwCrsrShell( SwDoc& rDoc, Window *pWin, const SwViewOption *pOpt = 0 );
     305             :     // disguised copy constructor
     306             :     SwCrsrShell( SwCrsrShell& rShell, Window *pWin );
     307             :     virtual ~SwCrsrShell();
     308             : 
     309             :     // create new cursor and append the old one
     310             :     virtual SwPaM & CreateNewShellCursor();
     311             :     virtual SwPaM & GetCurrentShellCursor();
     312             : 
     313             :     SwPaM * CreateCrsr();
     314             :     ///< delete the current cursor and make the following into the current
     315             :     bool DestroyCrsr();
     316             :     ///< transform TableCursor to normal cursor, nullify Tablemode
     317             :     void TblCrsrToCursor();
     318             :     ///< enter block mode, change normal cursor into block cursor
     319             :     void CrsrToBlockCrsr();
     320             :     ///< leave block mode, change block cursor into normal cursor
     321             :     void BlockCrsrToCrsr();
     322             : 
     323             :     // SelAll() selects the document body content
     324             :     // if ExtendedSelect() is called afterwards, the whole nodes array is selected
     325             :     // only for usage in special cases allowed!
     326             :     void ExtendedSelectAll();
     327             : 
     328             :     SwPaM* GetCrsr( sal_Bool bMakeTblCrsr = sal_True ) const;
     329             :     inline SwCursor* GetSwCrsr( sal_Bool bMakeTblCrsr = sal_True ) const;
     330             :     // return only the current cursor
     331           0 :           SwShellCrsr* _GetCrsr()                       { return pCurCrsr; }
     332        1909 :     const SwShellCrsr* _GetCrsr() const                 { return pCurCrsr; }
     333             : 
     334             :     // show passed cursor - for UNO
     335             :     void    SetSelection(const SwPaM& rCrsr);
     336             : 
     337             :     // remove all cursors from ContentNodes and set to 0
     338             :     void ParkCrsr( const SwNodeIndex &rIdx );
     339             : 
     340             :     // return the current cursor stack
     341             :     // (required in EditShell when deleting contents)
     342             :     inline SwPaM* GetStkCrsr() const;
     343             : 
     344             :     // start parenthesing, hide SV-Cursor and selected areas
     345             :     void StartAction();
     346             :     // end parenthesing, show SV-Cursor and selected areas
     347             :     void EndAction( const sal_Bool bIdleEnd = sal_False );
     348             : 
     349             :     // basic cursor travelling
     350           0 :     long GetUpDownX() const             { return nUpDownX; }
     351             : 
     352           0 :     sal_Bool Left( sal_uInt16 nCnt, sal_uInt16 nMode, sal_Bool bAllowVisual = sal_False )
     353           0 :         { return LeftRight( sal_True, nCnt, nMode, bAllowVisual ); }
     354           0 :     sal_Bool Right( sal_uInt16 nCnt, sal_uInt16 nMode, sal_Bool bAllowVisual = sal_False )
     355           0 :         { return LeftRight( sal_False, nCnt, nMode, bAllowVisual ); }
     356           0 :     sal_Bool Up( sal_uInt16 nCnt = 1 )      { return UpDown( sal_True, nCnt ); }
     357           0 :     sal_Bool Down( sal_uInt16 nCnt = 1 )    { return UpDown( sal_False, nCnt ); }
     358           0 :     sal_Bool LeftMargin()               { return LRMargin( sal_True ); }
     359           0 :     sal_Bool RightMargin(sal_Bool bAPI = sal_False) { return LRMargin( sal_False, bAPI ); }
     360             :     sal_Bool SttEndDoc( sal_Bool bStt );
     361             : 
     362             :     sal_Bool MovePage( SwWhichPage, SwPosPage );
     363             :     sal_Bool MovePara( SwWhichPara, SwPosPara );
     364             :     sal_Bool MoveSection( SwWhichSection, SwPosSection );
     365             :     sal_Bool MoveTable( SwWhichTable, SwPosTable );
     366             :     sal_Bool MoveColumn( SwWhichColumn, SwPosColumn );
     367             :     sal_Bool MoveRegion( SwWhichRegion, SwPosRegion );
     368             : 
     369             :     sal_uLong Find( const com::sun::star::util::SearchOptions& rSearchOpt,
     370             :                 sal_Bool bSearchInNotes,
     371             :                 SwDocPositions eStart, SwDocPositions eEnde,
     372             :                 sal_Bool& bCancel,
     373             :                 FindRanges eRng, int bReplace = sal_False );
     374             : 
     375             :     sal_uLong Find( const SwTxtFmtColl& rFmtColl,
     376             :                 SwDocPositions eStart, SwDocPositions eEnde,
     377             :                 sal_Bool& bCancel,
     378             :                 FindRanges eRng, const SwTxtFmtColl* pReplFmt = 0 );
     379             : 
     380             :     sal_uLong Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
     381             :                 SwDocPositions eStart, SwDocPositions eEnde,
     382             :                 sal_Bool& bCancel,
     383             :                 FindRanges eRng,
     384             :                 const com::sun::star::util::SearchOptions* pSearchOpt = 0,
     385             :                 const SfxItemSet* rReplSet = 0 );
     386             : 
     387             :     //  Position the Cursor
     388             :     //  return values:
     389             :     //      CRSR_POSCHG: when cursor was corrected from SPoint by the layout
     390             :     //      CRSR_POSOLD: when the cursor was not changed
     391             :     int SetCrsr( const Point &rPt, sal_Bool bOnlyText = sal_False, bool bBlock = true );
     392             : 
     393             :     /*
     394             :      * Notification that the visible area was changed. aVisArea is reset, then
     395             :      * scrolling is done. The passed Rectangle lays on pixel borders to avoid
     396             :      * pixel errors.
     397             :      */
     398             :     virtual void VisPortChgd( const SwRect & );
     399             : 
     400             :     /*
     401             :      * virtual paint method to make selection visible again after Paint
     402             :      */
     403             :     void Paint( const Rectangle & rRect );
     404             : 
     405             :     // Areas
     406             :     inline void SetMark();
     407             :     inline sal_Bool HasMark();
     408             : 
     409             :     void ClearMark();
     410             : 
     411             :     /**
     412             :        Ensure point and mark of the current PaM are in a specific order.
     413             : 
     414             :        @param bPointFirst TRUE: If the point is behind the mark then
     415             :        swap the PaM. FALSE: If the mark is behind the point then swap
     416             :        the PaM.
     417             :     */
     418             :     void NormalizePam(sal_Bool bPointFirst = sal_True);
     419             : 
     420             :     void SwapPam();
     421             :     sal_Bool ChgCurrPam( const Point & rPt,
     422             :                      sal_Bool bTstOnly = sal_True,      // test only, don't set
     423             :                      sal_Bool bTstHit  = sal_False );   // only exact matches
     424             :     void KillPams();
     425             : 
     426             :     // story a copy of the cursor in the stack
     427             :     void Push();
     428             :     /*
     429             :      * Delete a cursor (controlled by bOldCrsr)
     430             :      *      - from stack or (bOldCrsr = TRUE)
     431             :      *      - delete the current one and replace it with the cursor from the
     432             :      *      stack
     433             :      * Return: whether there was one left one the stack
     434             :      */
     435             :     sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
     436             :     /*
     437             :      * Combine 2 Cursors.
     438             :      * Delete the topmost from the stack and move its Mark into the current.
     439             :      */
     440             :     void Combine();
     441             : 
     442             : #ifdef DBG_UTIL
     443             :     void SttCrsrMove();
     444             :     void EndCrsrMove( const sal_Bool bIdleEnd = sal_False );
     445             : #else
     446           0 :     void SttCrsrMove() { ++nCrsrMove; StartAction(); }
     447           0 :     void EndCrsrMove( const sal_Bool bIdleEnd = sal_False )
     448           0 :             { EndAction( bIdleEnd ); --nCrsrMove; }
     449             : #endif
     450             : 
     451             :     /*
     452             :      * When the focus is lost the selected ranges are not displayed anymore.
     453             :      * On the other hand, on receiving the focus all selected ranges are displayed again
     454             :      * (ranges must be recalculated!).
     455             :      */
     456           0 :     sal_Bool HasShFcs() const { return bHasFocus; }
     457             :     void ShLooseFcs();
     458             :     void ShGetFcs( sal_Bool bUpdate = sal_True );
     459             : 
     460             :     // Methods for displaying or hiding the visible text cursor.
     461             :     void ShowCrsr();
     462             :     void HideCrsr();
     463             :     // Methods for displaying or hiding the selected ranges with visible cursor.
     464             :     void ShowCrsrs( sal_Bool bCrsrVis );
     465             :     void HideCrsrs();
     466             : 
     467        5780 :     sal_Bool IsOverwriteCrsr() const { return bOverwriteCrsr; }
     468           0 :     void SetOverwriteCrsr( sal_Bool bFlag ) { bOverwriteCrsr = bFlag; }
     469             : 
     470             :     // Return current frame in which the cursor is placed.
     471             :     SwCntntFrm *GetCurrFrm( const sal_Bool bCalcFrm = sal_True ) const;
     472             : 
     473             :     //TRUE if cursor is hidden because of readonly.
     474             :     //FALSE if it is working despite readonly.
     475             :     sal_Bool IsCrsrReadonly() const;
     476             : 
     477             :     // Cursor is placed in something that is protected or selection contains
     478             :     // something that is protected.
     479             :     sal_Bool HasReadonlySel() const;
     480             : 
     481             :     // Can the cursor be set to read only ranges?
     482        5828 :     sal_Bool IsReadOnlyAvailable() const { return bSetCrsrInReadOnly; }
     483             :     void SetReadOnlyAvailable( sal_Bool bFlag );
     484             :     sal_Bool IsOverReadOnlyPos( const Point& rPt ) const;
     485             : 
     486             :     // Methods for aFlyMacroLnk.
     487         236 :     void        SetFlyMacroLnk( const Link& rLnk ) { aFlyMacroLnk = rLnk; }
     488           0 :     const Link& GetFlyMacroLnk() const             { return aFlyMacroLnk; }
     489             : 
     490             :     // Methods returning/altering link for changes of attributes/formates.
     491         236 :     void        SetChgLnk( const Link &rLnk ) { aChgLnk = rLnk; }
     492           7 :     const Link& GetChgLnk() const             { return aChgLnk; }
     493             : 
     494             :     // Methods returning/altering ling for "graphic completely loaded".
     495         561 :     void        SetGrfArrivedLnk( const Link &rLnk ) { aGrfArrivedLnk = rLnk; }
     496         131 :     const Link& GetGrfArrivedLnk() const             { return aGrfArrivedLnk; }
     497             : 
     498             :     //Call ChgLink. When within an action calling will be delayed.
     499             :     void CallChgLnk();
     500             : 
     501             :     // Check if the current cursor contains a selection, i.e.
     502             :     // if Mark is set and SPoint and Mark are different.
     503             :     sal_Bool HasSelection() const;
     504             : 
     505             :     // Check if a selection exists, i.e. if the current cursor comprises a selection.
     506             :     inline sal_Bool IsSelection() const;
     507             :     // returns if multiple cursors are available
     508             :     inline sal_Bool IsMultiSelection() const;
     509             : 
     510             :     // Check if a complete paragraph was selected.
     511             :     sal_Bool IsSelFullPara() const;
     512             : 
     513             :     // Check if selection is within one paragraph.
     514             : 
     515             :     //Should WaitPtr be activated for Clipboard.
     516             :     bool ShouldWait() const;
     517             : 
     518             :     // Check if selection is within one paragraph.
     519             :     inline sal_Bool IsSelOnePara() const;
     520             : 
     521             :     /*
     522             :      * Returns SRectangle, at which the cursor is located.
     523             :      */
     524        1111 :     const SwRect &GetCharRect() const { return aCharRect; }
     525             :     /*
     526             :      * Returns if cursor is wholly or partly within visible range.
     527             :      */
     528           0 :     sal_Bool IsCrsrVisible() const { return VisArea().IsOver( GetCharRect() ); }
     529             : 
     530             :     // Return current page number:
     531             :     // TRUE:  in which cursor is located.
     532             :     // FALSE: which is visible at the upper margin.
     533             :     void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
     534             :                      sal_Bool bAtCrsrPos = sal_True, const sal_Bool bCalcFrm = sal_True );
     535             :     // Determine how "empty pages" are handled
     536             :     // (used in PhyPage).
     537             :     sal_uInt16 GetNextPrevPageNum( sal_Bool bNext = sal_True );
     538             : 
     539             :     // Move cursor at the bginning of page "nPage".
     540             :     sal_Bool GotoPage( sal_uInt16 nPage );
     541             : 
     542             :     sal_uInt16 GetPageCnt();
     543             : 
     544             :     sal_Bool GoNextCrsr();
     545             : 
     546             :     sal_Bool GoPrevCrsr();
     547             : 
     548             :     // at CurCrsr.SPoint
     549             :     ::sw::mark::IMark* SetBookmark(
     550             :         const KeyCode&,
     551             :         const ::rtl::OUString& rName,
     552             :         const ::rtl::OUString& rShortName,
     553             :         IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::BOOKMARK);
     554             :     bool GotoMark( const ::sw::mark::IMark* const pMark );    // sets CurCrsr.SPoint
     555             :     bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart );
     556             :     bool GoNextBookmark(); // true, if there was one
     557             :     bool GoPrevBookmark();
     558             : 
     559             :     bool IsFormProtected();
     560             :     ::sw::mark::IFieldmark* GetCurrentFieldmark();
     561             :     ::sw::mark::IFieldmark* GetFieldmarkAfter();
     562             :     ::sw::mark::IFieldmark* GetFieldmarkBefore();
     563             :     bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark );
     564             : 
     565             :     // update Cursr, i.e. reset it into content should only be called when the
     566             :     // cursor was set to a random position e.g. when deleting frames
     567             :     void UpdateCrsrPos();
     568             : 
     569             :     // get the selected text at the current cursor. it will be filled with
     570             :     // fields etc.
     571             :     String GetSelTxt() const;
     572             :     // return only the text starting from the current cursor position (to the
     573             :     // end of the node)
     574             :     String GetText() const;
     575             : 
     576             :     // Check of SPoint or Mark of current cursor are placed within a table.
     577             :     inline const SwTableNode* IsCrsrInTbl( sal_Bool bIsPtInTbl = sal_True ) const;
     578             : 
     579             :     inline Point& GetCrsrDocPos( sal_Bool bPoint = sal_True ) const;
     580             :     inline sal_Bool IsCrsrPtAtEnd() const;
     581             : 
     582             :     inline const  SwPaM* GetTblCrs() const;
     583             :     inline        SwPaM* GetTblCrs();
     584             : 
     585             :     bool IsTblComplexForChart();
     586             :     // get current table selection as text
     587             :     String GetBoxNms() const;
     588             : 
     589             :     // set Crsr to the next/previous cell
     590             :     sal_Bool GoNextCell( sal_Bool bAppendLine = sal_True );
     591             :     sal_Bool GoPrevCell();
     592             :     // go to this box (if available and inside of table)
     593             :     bool GotoTable( const String& rName );
     594             : 
     595             :     // select a table row, column or box (based on the current cursor)
     596           0 :     sal_Bool SelTblRow() { return _SelTblRowOrCol( true  ); }
     597           0 :     sal_Bool SelTblCol() { return _SelTblRowOrCol( false ); }
     598             :     sal_Bool SelTblBox();
     599             : 
     600             :     sal_Bool SelTbl();
     601             : 
     602             :     bool GotoNextNum();
     603             :     bool GotoPrevNum();
     604             : 
     605             :     bool GotoOutline( const String& rName );
     606             :     // to the next/previous or the given OutlineNode
     607             :     void GotoOutline( sal_uInt16 nIdx );
     608             :     // find the "outline position" in the nodes array of the current chapter
     609             :     sal_uInt16 GetOutlinePos( sal_uInt8 nLevel = UCHAR_MAX );
     610             :     // select the given range of OutlineNodes. Optionally including the children
     611             :     // the sal_uInt16s are the positions in OutlineNodes-Array (EditShell)
     612             :     sal_Bool MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
     613             :                         sal_Bool bWithChildren = sal_False );
     614             : 
     615             :     sal_Bool GotoNextOutline();
     616             :     sal_Bool GotoPrevOutline();
     617             : 
     618             :     /** Delivers the current shell cursor
     619             : 
     620             :         Some operations have to run on the current cursor ring,
     621             :         some on the pTblCrsr (if exist) or the current cursor ring and
     622             :         some on the pTblCrsr or pBlockCrsr or the current cursor ring.
     623             :         This small function checks the existence and delivers the wished cursor.
     624             : 
     625             :         @param bBlock [bool]
     626             :         if the block cursor is of interest or not
     627             : 
     628             :         @return pTblCrsr if exist,
     629             :         pBlockCrsr if exist and of interest (param bBlock)
     630             :         otherwise pCurCrsr
     631             :     */
     632             :     SwShellCrsr* getShellCrsr( bool bBlock );
     633        1119 :     const SwShellCrsr* getShellCrsr( bool bBlock ) const
     634        1119 :         { return (const_cast<SwCrsrShell*>(this))->getShellCrsr( bBlock ); }
     635             : 
     636           0 :     bool IsBlockMode() const { return 0 != pBlockCrsr; }
     637             :     const IBlockCursor* GetBlockCrsr() const { return pBlockCrsr; }
     638             :     IBlockCursor* GetBlockCrsr() { return pBlockCrsr; }
     639             : 
     640             :     // is the Crsr in a table and is the selection over 2 columns
     641        7401 :     sal_Bool IsTableMode() const { return 0 != pTblCrsr; }
     642             : 
     643           0 :     const SwShellTableCrsr* GetTableCrsr() const { return pTblCrsr; }
     644           0 :     SwShellTableCrsr* GetTableCrsr() { return pTblCrsr; }
     645             :     size_t UpdateTblSelBoxes();
     646             : 
     647             :     sal_Bool GotoFtnTxt();      ///< jump from content to footnote
     648             :     sal_Bool GotoFtnAnchor();   ///< jump from footnote to anchor
     649             :     sal_Bool GotoPrevFtnAnchor();
     650             :     sal_Bool GotoNextFtnAnchor();
     651             : 
     652             :     sal_Bool GotoFlyAnchor();       ///< jump from the frame to the anchor
     653             :     sal_Bool GotoHeaderTxt();       ///< jump from the content to the header
     654             :     sal_Bool GotoFooterTxt();       ///< jump from the content to the footer
     655             :     // jump to the header/footer of the given or current PageDesc
     656             :     sal_Bool SetCrsrInHdFt( sal_uInt16 nDescNo = USHRT_MAX,
     657             :                             sal_Bool bInHeader = sal_True );
     658             :     // is point of cursor in header/footer. pbInHeader return sal_True if it is
     659             :     // in a headerframe otherwise in a footerframe
     660             :     bool IsInHeaderFooter( sal_Bool* pbInHeader = 0 ) const;
     661             : 
     662             :     sal_Bool GotoNextTOXBase( const String* = 0 );
     663             :     sal_Bool GotoPrevTOXBase( const String* = 0 );
     664             :     sal_Bool GotoTOXMarkBase();
     665             :     // jump to the next or previous index entry
     666             :     sal_Bool GotoNxtPrvTOXMark( sal_Bool bNext = sal_True );
     667             :     // jump to the next/previous index mark of this type
     668             :     const SwTOXMark& GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir );
     669             : 
     670             :     // jump to the next or previous table formula
     671             :     // optionally only to broken formulas
     672             :     sal_Bool GotoNxtPrvTblFormula( sal_Bool bNext = sal_True,
     673             :                                     sal_Bool bOnlyErrors = sal_False );
     674             :     // jump to the next / previous hyperlink - inside text and also
     675             :     // on graphics
     676             :     sal_Bool SelectNxtPrvHyperlink( sal_Bool bNext = sal_True );
     677             : 
     678             :     sal_Bool GotoRefMark( const String& rRefMark, sal_uInt16 nSubType = 0,
     679             :                             sal_uInt16 nSeqNo = 0 );
     680             : 
     681             :     // get the nth character from the start or end of the  current selection
     682             :     sal_Unicode GetChar( sal_Bool bEnd = sal_True, long nOffset = 0 );
     683             :     sal_Bool ExtendSelection( sal_Bool bEnd = sal_True, xub_StrLen nCount = 1 );
     684             : 
     685             :     // Place only the visible cursor at the given position in the document.
     686             :     // Return FALSE if SPoint was corrected by layout.
     687             :     // (This is needed for displaying the Drag&Drop/Copy-Cursor.)
     688             :     sal_Bool SetVisCrsr( const Point &rPt );
     689             :     inline void UnSetVisCrsr();
     690             : 
     691             :     // jump to the next or previous field of the corresponding type
     692             :     sal_Bool MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
     693             :                                             sal_uInt16 nSubType = USHRT_MAX,
     694             :                                             sal_uInt16 nResType = USHRT_MAX );
     695             :     sal_Bool GotoFld( const SwFmtFld& rFld );
     696             : 
     697             :     // Return number of cursors in ring (The flag indicates whether
     698             :     // only cursors containing selections are requested).
     699             :     sal_uInt16 GetCrsrCnt( sal_Bool bAll = sal_True ) const;
     700             : 
     701             :     // Char Travelling - methods (in crstrvl1.cxx)
     702             :     sal_Bool GoStartWord();
     703             :     sal_Bool GoEndWord();
     704             :     sal_Bool GoNextWord();
     705             :     sal_Bool GoPrevWord();
     706             :     sal_Bool GoNextSentence();
     707             :     sal_Bool GoStartSentence();
     708             :     sal_Bool GoEndSentence();
     709             :     sal_Bool SelectWord( const Point* pPt = 0 );
     710             :     sal_Bool ExpandToSentenceBorders();
     711             : 
     712             :     // get position from current cursor
     713             :     sal_Bool IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES )const;
     714             :     sal_Bool IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
     715             :     sal_Bool IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const;
     716             :     sal_Bool IsStartSentence() const;
     717             :     sal_Bool IsEndSentence() const;
     718             :     bool IsSttPara() const;
     719             :     bool IsEndPara() const;
     720             :     sal_Bool IsStartOfDoc() const;
     721             :     sal_Bool IsEndOfDoc() const;
     722             :     bool IsInFrontOfLabel() const;
     723           0 :     sal_Bool IsAtLeftMargin()   const       { return IsAtLRMargin( sal_True ); }
     724           0 :     sal_Bool IsAtRightMargin(sal_Bool bAPI = sal_False) const   { return IsAtLRMargin( sal_False, bAPI ); }
     725             : 
     726             :     // delete all created cursors, set the table cursor and the last cursor to
     727             :     // its TextNode (or StartNode?)
     728             :     // They all get created on the next ::GetCrsr again
     729             :     // Used for Drag&Drop/Clipboard-Paste in tables
     730             :     sal_Bool ParkTblCrsr();
     731             : 
     732             :     // Non expanded attributes?
     733           7 :     sal_Bool IsGCAttr() const { return bGCAttr; }
     734           0 :     void ClearGCAttr() { bGCAttr = sal_False; }
     735           0 :     void    UpdateAttr() {  bGCAttr = sal_True; }
     736             : 
     737             :     // is the whole document protected/hidden (for UI...)
     738           0 :     sal_Bool IsAllProtect() const { return bAllProtect; }
     739             : 
     740        1152 :     sal_Bool BasicActionPend() const    { return nBasicActionCnt != nStartAction; }
     741             : 
     742             :     bool GotoRegion( const String& rName );
     743             : 
     744             :     // show the current selection
     745             :     virtual void MakeSelVisible();
     746             : 
     747             :     // set the cursor to a NOT protected/hidden node
     748             :     sal_Bool FindValidCntntNode( sal_Bool bOnlyText = sal_False );
     749             : 
     750             :     sal_Bool GetContentAtPos( const Point& rPt,
     751             :                             SwContentAtPos& rCntntAtPos,
     752             :                             sal_Bool bSetCrsr = sal_False,
     753             :                             SwRect* pFldRect = 0 );
     754             : 
     755             :     const SwPostItField* GetPostItFieldAtCursor() const;
     756             : 
     757             :     // get smart tags at point position
     758             :     void GetSmartTagTerm( const Point& rPt,
     759             :                           SwRect& rSelectRect,
     760             :                           ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes,
     761             :                           ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
     762             :                           ::com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rRange );
     763             : 
     764             :     // get smart tags at current cursor position
     765             :     void GetSmartTagTerm( ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes,
     766             :                           ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
     767             :                           ::com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rRange ) const;
     768             : 
     769             :     sal_Bool IsPageAtPos( const Point &rPt ) const;
     770             : 
     771             :     sal_Bool SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand, const SwTxtAttr* pAttr = 0 );
     772             :     bool GotoINetAttr( const SwTxtINetFmt& rAttr );
     773             :     const SwFmtINetFmt* FindINetAttr( const String& rName ) const;
     774             : 
     775             :     sal_Bool CheckTblBoxCntnt( const SwPosition* pPos = 0 );
     776             :     void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
     777             :     void ClearTblBoxCntnt();
     778             :     sal_Bool EndAllTblBoxEdit();
     779             : 
     780           0 :     void SetSelTblCells( sal_Bool bFlag )           { bSelTblCells = bFlag; }
     781           0 :     sal_Bool IsSelTblCells() const                  { return bSelTblCells; }
     782             : 
     783           0 :     sal_Bool IsAutoUpdateCells() const              { return bAutoUpdateCells; }
     784           0 :     void SetAutoUpdateCells( sal_Bool bFlag )       { bAutoUpdateCells = bFlag; }
     785             : 
     786             :     sal_Bool GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
     787             :                             SwRect& rRect, short& rOrient );
     788             :     sal_Bool SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode );
     789             : 
     790             :     const SwRedline* SelNextRedline();
     791             :     const SwRedline* SelPrevRedline();
     792             :     const SwRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False );
     793             : 
     794             :     // is cursor or the point in/over a vertical formatted text?
     795             :     bool IsInVerticalText( const Point* pPt = 0 ) const;
     796             :     // is cursor or the point in/over a right to left formatted text?
     797             :     sal_Bool IsInRightToLeftText( const Point* pPt = 0 ) const;
     798             : 
     799             :     // If the current cursor position is inside a hidden range, the hidden range
     800             :     // is selected and true is returned:
     801             :     bool SelectHiddenRange();
     802             : 
     803             :     // remove all invalid cursors
     804             :     void ClearUpCrsrs();
     805             : 
     806         242 :     inline void SetMacroExecAllowed( const bool _bMacroExecAllowed )
     807             :     {
     808         242 :         mbMacroExecAllowed = _bMacroExecAllowed;
     809         242 :     }
     810         121 :     inline bool IsMacroExecAllowed()
     811             :     {
     812         121 :         return mbMacroExecAllowed;
     813             :     }
     814             : 
     815             :     /**
     816             :        Returns textual description of the current selection.
     817             : 
     818             :        - If the current selection is a multi-selection the result is
     819             :          STR_MULTISEL.
     820             :        - Else the result is the text of the selection.
     821             : 
     822             :        @return the textual description of the current selection
     823             :      */
     824             :     String GetCrsrDescr() const;
     825             : 
     826             :     SwRect GetRectOfCurrentChar();
     827             : };
     828             : 
     829             : // Cursor Inlines:
     830           0 : inline SwMoveFnCollection* SwCrsrShell::MakeFindRange(
     831             :             sal_uInt16 nStt, sal_uInt16 nEnd, SwPaM* pPam ) const
     832             : {
     833           0 :     return pCurCrsr->MakeFindRange( (SwDocPositions)nStt, (SwDocPositions)nEnd, pPam );
     834             : }
     835             : 
     836           0 : inline SwCursor* SwCrsrShell::GetSwCrsr( sal_Bool bMakeTblCrsr ) const
     837             : {
     838           0 :     return (SwCursor*)GetCrsr( bMakeTblCrsr );
     839             : }
     840             : 
     841           0 : inline SwPaM* SwCrsrShell::GetStkCrsr() const { return pCrsrStk; }
     842             : 
     843           0 : inline void SwCrsrShell::SetMark() { pCurCrsr->SetMark(); }
     844             : 
     845           0 : inline sal_Bool SwCrsrShell::HasMark() { return( pCurCrsr->HasMark() ); }
     846             : 
     847        1587 : inline sal_Bool SwCrsrShell::IsSelection() const
     848             : {
     849        3174 :     return IsTableMode() || pCurCrsr->HasMark() ||
     850        3174 :             pCurCrsr->GetNext() != pCurCrsr;
     851             : }
     852           0 : inline sal_Bool SwCrsrShell::IsMultiSelection() const
     853             : {
     854           0 :     return pCurCrsr->GetNext() != pCurCrsr;
     855             : }
     856             : 
     857           0 : inline sal_Bool SwCrsrShell::IsSelOnePara() const
     858             : {
     859           0 :     return pCurCrsr == pCurCrsr->GetNext() &&
     860           0 :            pCurCrsr->GetPoint()->nNode == pCurCrsr->GetMark()->nNode;
     861             : }
     862             : 
     863        1657 : inline const SwTableNode* SwCrsrShell::IsCrsrInTbl( sal_Bool bIsPtInTbl ) const
     864             : {
     865        1657 :     return pCurCrsr->GetNode( bIsPtInTbl )->FindTableNode();
     866             : }
     867             : 
     868           0 : inline sal_Bool SwCrsrShell::IsCrsrPtAtEnd() const
     869             : {
     870           0 :     return pCurCrsr->End() == pCurCrsr->GetPoint();
     871             : }
     872             : 
     873           0 : inline Point& SwCrsrShell::GetCrsrDocPos( sal_Bool bPoint ) const
     874             : {
     875           0 :     return bPoint ? pCurCrsr->GetPtPos() : pCurCrsr->GetMkPos();
     876             : }
     877             : 
     878             : inline const SwPaM* SwCrsrShell::GetTblCrs() const
     879             : {
     880             :     return pTblCrsr;
     881             : }
     882             : 
     883           0 : inline SwPaM* SwCrsrShell::GetTblCrs()
     884             : {
     885           0 :     return pTblCrsr;
     886             : }
     887             : 
     888           0 : inline void SwCrsrShell::UnSetVisCrsr()
     889             : {
     890           0 :     pVisCrsr->Hide();
     891           0 :     pVisCrsr->SetDragCrsr( false );
     892           0 : }
     893             : 
     894             : #endif  // _CRSRSH_HXX
     895             : 
     896             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10