LCOV - code coverage report
Current view: top level - sw/inc - viscrs.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 15 80.0 %
Date: 2014-11-03 Functions: 11 14 78.6 %
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_VISCRS_HXX
      20             : #define INCLUDED_SW_INC_VISCRS_HXX
      21             : 
      22             : #include <config_features.h>
      23             : 
      24             : #include <vcl/cursor.hxx>
      25             : #include "swcrsr.hxx"
      26             : #include "swrect.hxx"
      27             : #include "swregion.hxx"
      28             : 
      29             : class SwCrsrShell;
      30             : class SwShellCrsr;
      31             : class SwTxtInputFld;
      32             : 
      33             : // From here classes/methods for non-text cursor.
      34             : 
      35             : class SwVisCrsr
      36             : {
      37             :     friend void _InitCore();
      38             :     friend void _FinitCore();
      39             : 
      40             :     bool m_bIsVisible;
      41             :     bool m_bIsDragCrsr;
      42             : 
      43             :     vcl::Cursor m_aTxtCrsr;
      44             :     const SwCrsrShell* m_pCrsrShell;
      45             : 
      46             :     void _SetPosAndShow();
      47             : 
      48             : public:
      49             :     SwVisCrsr( const SwCrsrShell * pCShell );
      50             :     ~SwVisCrsr();
      51             : 
      52             :     void Show();
      53             :     void Hide();
      54             : 
      55       42493 :     bool IsVisible() const { return m_bIsVisible; }
      56           0 :     void SetDragCrsr( bool bFlag = true ) { m_bIsDragCrsr = bFlag; }
      57             : };
      58             : 
      59             : // From here classes/methods for selections.
      60             : 
      61             : namespace sdr { namespace overlay { class OverlayObject; }}
      62             : namespace sw { namespace overlay { class OverlayRangesOutline; }}
      63             : 
      64             : class SwSelPaintRects : public SwRects
      65             : {
      66             :     friend void _InitCore();
      67             :     friend void _FinitCore();
      68             : 
      69             :     static long nPixPtX, nPixPtY;
      70             :     static MapMode *pMapMode;
      71             : 
      72             :     const SwCrsrShell* pCShell;
      73             : 
      74             :     virtual void Paint( const Rectangle& rRect );
      75             : 
      76             : #if HAVE_FEATURE_DESKTOP
      77             :     sdr::overlay::OverlayObject*    mpCursorOverlay;
      78             : 
      79             :     // access to mpCursorOverlay for swapContent
      80           0 :     sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; }
      81           0 :     void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; }
      82             : #endif
      83             : 
      84             :     bool mbShowTxtInputFldOverlay;
      85             :     sw::overlay::OverlayRangesOutline* mpTxtInputFldOverlay;
      86             : 
      87             :     void HighlightInputFld();
      88             : 
      89             : public:
      90             :     SwSelPaintRects( const SwCrsrShell& rCSh );
      91             :     virtual ~SwSelPaintRects();
      92             : 
      93             :     virtual void FillRects() = 0;
      94             : 
      95             :     // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To
      96             :     // make a complete swap access to mpCursorOverlay is needed there
      97             :     void swapContent(SwSelPaintRects& rSwap);
      98             : 
      99             :     void Show();
     100             :     void Hide();
     101             :     void Invalidate( const SwRect& rRect );
     102             : 
     103        3621 :     inline void SetShowTxtInputFldOverlay( const bool bShow )
     104             :     {
     105        3621 :         mbShowTxtInputFldOverlay = bShow;
     106        3621 :     }
     107             : 
     108      315206 :     const SwCrsrShell* GetShell() const { return pCShell; }
     109             :     // check current MapMode of the shell and set possibly the static members.
     110             :     // Optional set the parameters pX, pY
     111             :     static void Get1PixelInLogic( const SwViewShell& rSh,
     112             :                                     long* pX = 0, long* pY = 0 );
     113             : };
     114             : 
     115             : class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects
     116             : {
     117             :     // Document positions of start/end characters of a SSelection.
     118             :     Point aMkPt, aPtPt;
     119             :     const SwPosition* pPt;      // For assignment of GetPoint() to aPtPt.
     120             : 
     121             :     using SwCursor::UpDown;
     122             : 
     123             : public:
     124             :     SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos );
     125             :     SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos,
     126             :                     const Point& rPtPos, SwPaM* pRing = 0 );
     127             :     SwShellCrsr( SwShellCrsr& );
     128             :     virtual ~SwShellCrsr();
     129             : 
     130             :     virtual void FillRects() SAL_OVERRIDE;   // For Table- und normal cursors.
     131             : 
     132             :     void Show();            // Update and display all selections.
     133             :     void Hide();            // Hide all selections.
     134             :     void Invalidate( const SwRect& rRect );
     135             : 
     136          46 :     const Point& GetPtPos() const   { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
     137      427446 :           Point& GetPtPos()         { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
     138          18 :     const Point& GetMkPos() const   { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
     139          52 :           Point& GetMkPos()         { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
     140             :     const Point& GetSttPos() const  { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
     141        1632 :           Point& GetSttPos()        { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
     142             :     const Point& GetEndPos() const  { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
     143        1502 :           Point& GetEndPos()        { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
     144             : 
     145             :     virtual void SetMark() SAL_OVERRIDE;
     146             : 
     147             :     virtual SwCursor* Create( SwPaM* pRing = 0 ) const SAL_OVERRIDE;
     148             : 
     149             :     virtual short MaxReplaceArived() SAL_OVERRIDE; //returns RET_YES/RET_CANCEL/RET_NO
     150             :     virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 ) SAL_OVERRIDE;
     151             : 
     152             :     bool UpDown( bool bUp, sal_uInt16 nCnt = 1 );
     153             : 
     154             :     // true: Cursor can be set to this position.
     155             :     virtual bool IsAtValidPos( bool bPoint = true ) const SAL_OVERRIDE;
     156             : 
     157             :     virtual bool IsReadOnlyAvailable() const SAL_OVERRIDE;
     158             : 
     159       13170 :     DECL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr )
     160             : };
     161             : 
     162             : class SwShellTableCrsr : public virtual SwShellCrsr, public virtual SwTableCursor
     163             : {
     164             :     // The Selection has the same order as the table boxes, i.e.
     165             :     // if something is deleted from the one array at a certain position
     166             :     // it has to be deleted from the other one as well!!
     167             : 
     168             : public:
     169             :     SwShellTableCrsr( const SwCrsrShell& rCrsrSh, const SwPosition& rPos );
     170             :     SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
     171             :                     const SwPosition &rMkPos, const Point& rMkPt,
     172             :                     const SwPosition &rPtPos, const Point& rPtPt );
     173             :     virtual ~SwShellTableCrsr();
     174             : 
     175             :     virtual void FillRects() SAL_OVERRIDE;   // For table and normal cursor.
     176             : 
     177             :     // Check if SPoint is within table SSelection.
     178             :     bool IsInside( const Point& rPt ) const;
     179             : 
     180             :     virtual void SetMark() SAL_OVERRIDE;
     181             :     virtual SwCursor* Create( SwPaM* pRing = 0 ) const SAL_OVERRIDE;
     182             : 
     183             :     virtual short MaxReplaceArived() SAL_OVERRIDE; //returns RET_YES/RET_CANCEL/RET_NO
     184             :     virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 ) SAL_OVERRIDE;
     185             : 
     186             :     // true: Cursor can be set to this position.
     187             :     virtual bool IsAtValidPos( bool bPoint = true ) const SAL_OVERRIDE;
     188             : 
     189             : };
     190             : 
     191             : #endif // INCLUDED_SW_INC_VISCRS_HXX
     192             : 
     193             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10