update ooo310-m15
[ooovba.git] / sw / inc / viscrs.hxx
blob2410d5063d1da7b37ba4f84175d5a2627414217c
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
32 #ifndef _CURSOR_HXX //autogen
33 #include <vcl/cursor.hxx>
34 #endif
35 #include "swcrsr.hxx"
36 #include "swrect.hxx"
37 #include "swregion.hxx"
39 class SwCrsrShell;
40 class SwShellCrsr;
42 // -------- Ab hier Klassen / Methoden fuer den nicht Text-Cursor ------
44 class SwVisCrsr
45 #ifdef SW_CRSR_TIMER
46 : private Timer
47 #endif
49 friend void _InitCore();
50 friend void _FinitCore();
52 BOOL bIsVisible : 1;
53 BOOL bIsDragCrsr : 1;
55 #ifdef SW_CRSR_TIMER
56 BOOL bTimerOn : 1;
57 #endif
59 Cursor aTxtCrsr;
60 const SwCrsrShell* pCrsrShell;
62 #ifdef SW_CRSR_TIMER
63 virtual void Timeout();
64 #endif
65 void _SetPosAndShow();
67 public:
68 SwVisCrsr( const SwCrsrShell * pCShell );
69 ~SwVisCrsr();
71 void Show();
72 void Hide();
74 BOOL IsVisible() const { return bIsVisible; }
75 void SetDragCrsr( BOOL bFlag = TRUE ) { bIsDragCrsr = bFlag; }
77 #ifdef SW_CRSR_TIMER
78 BOOL ChgTimerFlag( BOOL bTimerOn = TRUE );
79 #endif
83 // ------ Ab hier Klassen / Methoden fuer die Selectionen -------
85 // #i75172# predefines
86 namespace sdr { namespace overlay { class OverlayObject; }}
88 class SwSelPaintRects : public SwRects
90 friend void _InitCore();
91 friend void _FinitCore();
93 static long nPixPtX, nPixPtY;
94 static MapMode *pMapMode;
96 // die Shell
97 const SwCrsrShell* pCShell;
99 void Paint( const SwRect& rRect );
101 virtual void Paint( const Rectangle& rRect );
102 virtual void FillRects() = 0;
104 // #i75172#
105 sdr::overlay::OverlayObject* mpCursorOverlay;
107 // #i75172# access to mpCursorOverlay for swapContent
108 sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; }
109 void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; }
111 public:
112 SwSelPaintRects( const SwCrsrShell& rCSh );
113 virtual ~SwSelPaintRects();
115 // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To
116 // make a complete swap access to mpCursorOverlay is needed there
117 void swapContent(SwSelPaintRects& rSwap);
119 void Show();
120 void Hide();
121 void Invalidate( const SwRect& rRect );
123 const SwCrsrShell* GetShell() const { return pCShell; }
124 // check current MapMode of the shell and set possibly the static members.
125 // Optional set the parameters pX, pY
126 static void Get1PixelInLogic( const ViewShell& rSh,
127 long* pX = 0, long* pY = 0 );
131 class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects
133 // Dokument-Positionen der Start/End-Charakter einer SSelection
134 Point aMkPt, aPtPt;
135 const SwPosition* pPt; // fuer Zuordung vom GetPoint() zum aPtPt
137 virtual void FillRects(); // fuer Table- und normalen Crsr
139 using SwCursor::UpDown;
141 public:
142 SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos );
143 SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos,
144 const Point& rPtPos, SwPaM* pRing = 0 );
145 SwShellCrsr( SwShellCrsr& );
146 virtual ~SwShellCrsr();
148 virtual operator SwShellCrsr* ();
150 void Show(); // Update und zeige alle Selektionen an
151 void Hide(); // verstecke alle Selektionen
152 void Invalidate( const SwRect& rRect );
154 const Point& GetPtPos() const { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
155 Point& GetPtPos() { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); }
156 const Point& GetMkPos() const { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
157 Point& GetMkPos() { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); }
158 const Point& GetSttPos() const { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
159 Point& GetSttPos() { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); }
160 const Point& GetEndPos() const { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
161 Point& GetEndPos() { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); }
163 virtual void SetMark();
165 virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
167 virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
168 virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
170 BOOL UpDown( BOOL bUp, USHORT nCnt = 1 );
172 // TRUE: an die Position kann der Cursor gesetzt werden
173 virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const;
175 #ifndef PRODUCT
176 // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
177 // am sichtbaren Cursor
178 virtual BOOL IsSelOvr( int eFlags =
179 ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
180 nsSwCursorSelOverFlags::SELOVER_TOGGLE |
181 nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
182 #endif
184 DECL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr )
189 class SwShellTableCrsr : public virtual SwShellCrsr, public virtual SwTableCursor
191 // die Selection hat die gleiche Reihenfolge wie die
192 // TabellenBoxen. D.h., wird aus dem einen Array an einer Position
193 // etwas geloescht, dann muss es auch im anderen erfolgen!!
196 public:
197 SwShellTableCrsr( const SwCrsrShell& rCrsrSh, const SwPosition& rPos );
198 SwShellTableCrsr( const SwCrsrShell& rCrsrSh,
199 const SwPosition &rMkPos, const Point& rMkPt,
200 const SwPosition &rPtPos, const Point& rPtPt );
201 virtual ~SwShellTableCrsr();
203 virtual operator SwShellTableCrsr* ();
205 virtual void FillRects(); // fuer Table- und normalen Crsr
207 // Pruefe, ob sich der SPoint innerhalb der Tabellen-SSelection befindet
208 BOOL IsInside( const Point& rPt ) const;
210 virtual void SetMark();
211 virtual SwCursor* Create( SwPaM* pRing = 0 ) const;
212 virtual operator SwShellCrsr* ();
213 virtual operator SwTableCursor* ();
214 virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO
215 virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
217 // TRUE: an die Position kann der Cursor gesetzt werden
218 virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const;
220 #ifndef PRODUCT
221 // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung
222 // am sichtbaren Cursor
223 virtual BOOL IsSelOvr( int eFlags =
224 ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
225 nsSwCursorSelOverFlags::SELOVER_TOGGLE |
226 nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ));
227 #endif
232 #endif // _VISCRS_HXX