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

Generated by: LCOV version 1.10