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

Generated by: LCOV version 1.10