update dev300-m57
[ooovba.git] / sw / inc / viscrs.hxx
blob34c11f239347a030dac44fd809b3dc1d8f3be2c7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viscrs.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _VISCRS_HXX
31 #define _VISCRS_HXX
33 #include <vcl/cursor.hxx>
34 #include "swcrsr.hxx"
35 #include "swrect.hxx"
36 #include "swregion.hxx"
38 class SwCrsrShell;
39 class SwShellCrsr;
41 // -------- Ab hier Klassen / Methoden fuer den nicht Text-Cursor ------
43 class SwVisCrsr
44 #ifdef SW_CRSR_TIMER
45 : private Timer
46 #endif
48 friend void _InitCore();
49 friend void _FinitCore();
51 BOOL bIsVisible : 1;
52 BOOL bIsDragCrsr : 1;
54 #ifdef SW_CRSR_TIMER
55 BOOL bTimerOn : 1;
56 #endif
58 Cursor aTxtCrsr;
59 const SwCrsrShell* pCrsrShell;
61 #ifdef SW_CRSR_TIMER
62 virtual void Timeout();
63 #endif
64 void _SetPosAndShow();
66 public:
67 SwVisCrsr( const SwCrsrShell * pCShell );
68 ~SwVisCrsr();
70 void Show();
71 void Hide();
73 BOOL IsVisible() const { return bIsVisible; }
74 void SetDragCrsr( BOOL bFlag = TRUE ) { bIsDragCrsr = bFlag; }
76 #ifdef SW_CRSR_TIMER
77 BOOL ChgTimerFlag( BOOL bTimerOn = TRUE );
78 #endif
82 // ------ Ab hier Klassen / Methoden fuer die Selectionen -------
84 // #i75172# predefines
85 namespace sdr { namespace overlay { class OverlayObject; }}
87 class SwSelPaintRects : public SwRects
89 friend void _InitCore();
90 friend void _FinitCore();
92 static long nPixPtX, nPixPtY;
93 static MapMode *pMapMode;
95 // die Shell
96 const SwCrsrShell* pCShell;
98 void Paint( const SwRect& rRect );
100 virtual void Paint( const Rectangle& rRect );
101 virtual void FillRects() = 0;
103 // #i75172#
104 sdr::overlay::OverlayObject* mpCursorOverlay;
106 // #i75172# access to mpCursorOverlay for swapContent
107 sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; }
108 void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; }
110 public:
111 SwSelPaintRects( const SwCrsrShell& rCSh );
112 virtual ~SwSelPaintRects();
114 // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To
115 // make a complete swap access to mpCursorOverlay is needed there
116 void swapContent(SwSelPaintRects& rSwap);
118 void Show();
119 void Hide();
120 void Invalidate( const SwRect& rRect );
122 const SwCrsrShell* GetShell() const { return pCShell; }
123 // check current MapMode of the shell and set possibly the static members.
124 // Optional set the parameters pX, pY
125 static void Get1PixelInLogic( const ViewShell& rSh,
126 long* pX = 0, long* pY = 0 );
130 class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects
132 // Dokument-Positionen der Start/End-Charakter einer SSelection
133 Point aMkPt, aPtPt;
134 const SwPosition* pPt; // fuer Zuordung vom GetPoint() zum aPtPt
136 virtual void FillRects(); // fuer Table- und normalen Crsr
138 using SwCursor::UpDown;
140 public:
141 SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos );
142 SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos,
143 const Point& rPtPos, SwPaM* pRing = 0 );
144 SwShellCrsr( SwShellCrsr& );
145 virtual ~SwShellCrsr();
147 void Show(); // Update und zeige alle Selektionen an
148 void Hide(); // verstecke alle Selektionen
149 void Invalidate( const SwRect& rRect );
151 const Point& GetPtPos() const { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
152 Point& GetPtPos() { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
153 const Point& GetMkPos() const { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
154 Point& GetMkPos() { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
155 const Point& GetSttPos() const { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
156 Point& GetSttPos() { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
157 const Point& GetEndPos() const { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
158 Point& GetEndPos() { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
160 virtual void SetMark();
162 virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
164 virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
165 virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
167 BOOL UpDown( BOOL bUp, USHORT nCnt = 1 );
169 // TRUE: an die Position kann der Cursor gesetzt werden
170 virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const;
172 #ifndef PRODUCT
173 // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
174 // am sichtbaren Cursor
175 virtual BOOL IsSelOvr( int eFlags =
176 ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
177 nsSwCursorSelOverFlags::SELOVER_TOGGLE |
178 nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
179 #endif
181 virtual bool IsReadOnlyAvailable() const;
183 DECL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr )
188 class SwShellTableCrsr : public virtual SwShellCrsr, public virtual SwTableCursor
190 // die Selection hat die gleiche Reihenfolge wie die
191 // TabellenBoxen. D.h., wird aus dem einen Array an einer Position
192 // etwas geloescht, dann muss es auch im anderen erfolgen!!
195 public:
196 SwShellTableCrsr( const SwCrsrShell& rCrsrSh, const SwPosition& rPos );
197 SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
198 const SwPosition &rMkPos, const Point& rMkPt,
199 const SwPosition &rPtPos, const Point& rPtPt );
200 virtual ~SwShellTableCrsr();
202 virtual void FillRects(); // fuer Table- und normalen Crsr
204 // Pruefe, ob sich der SPoint innerhalb der Tabellen-SSelection befindet
205 BOOL IsInside( const Point& rPt ) const;
207 virtual void SetMark();
208 virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
210 virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
211 virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
213 // TRUE: an die Position kann der Cursor gesetzt werden
214 virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const;
216 #ifndef PRODUCT
217 // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
218 // am sichtbaren Cursor
219 virtual BOOL IsSelOvr( int eFlags =
220 ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
221 nsSwCursorSelOverFlags::SELOVER_TOGGLE |
222 nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
223 #endif
228 #endif // _VISCRS_HXX