1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viscrs.hxx,v $
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 ************************************************************************/
32 #ifndef _CURSOR_HXX //autogen
33 #include <vcl/cursor.hxx>
37 #include "swregion.hxx"
42 // -------- Ab hier Klassen / Methoden fuer den nicht Text-Cursor ------
49 friend void _InitCore();
50 friend void _FinitCore();
60 const SwCrsrShell
* pCrsrShell
;
63 virtual void Timeout();
65 void _SetPosAndShow();
68 SwVisCrsr( const SwCrsrShell
* pCShell
);
74 BOOL
IsVisible() const { return bIsVisible
; }
75 void SetDragCrsr( BOOL bFlag
= TRUE
) { bIsDragCrsr
= bFlag
; }
78 BOOL
ChgTimerFlag( BOOL bTimerOn
= TRUE
);
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
;
97 const SwCrsrShell
* pCShell
;
99 void Paint( const SwRect
& rRect
);
101 virtual void Paint( const Rectangle
& rRect
);
102 virtual void FillRects() = 0;
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
; }
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
);
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
135 const SwPosition
* pPt
; // fuer Zuordung vom GetPoint() zum aPtPt
137 virtual void FillRects(); // fuer Table- und normalen Crsr
139 using SwCursor::UpDown
;
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;
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
));
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!!
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;
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
));
232 #endif // _VISCRS_HXX