xref: /aoo41x/main/vcl/source/window/cursor.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_vcl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vcl/svapp.hxx>
32*cdf0e10cSrcweir #include <vcl/timer.hxx>
33*cdf0e10cSrcweir #include <vcl/settings.hxx>
34*cdf0e10cSrcweir #include <vcl/window.hxx>
35*cdf0e10cSrcweir #include <vcl/cursor.hxx>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <window.h>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <tools/poly.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir // =======================================================================
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir struct ImplCursorData
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir 	AutoTimer		maTimer;			// Timer
47*cdf0e10cSrcweir 	Point			maPixPos;			// Pixel-Position
48*cdf0e10cSrcweir 	Point			maPixRotOff;		// Pixel-Offset-Position
49*cdf0e10cSrcweir 	Size			maPixSize;			// Pixel-Size
50*cdf0e10cSrcweir 	long			mnPixSlant; 		// Pixel-Slant
51*cdf0e10cSrcweir 	short			mnOrientation;		// Pixel-Orientation
52*cdf0e10cSrcweir 	unsigned char	mnDirection;		// indicates writing direction
53*cdf0e10cSrcweir 	sal_uInt16			mnStyle;			// Cursor-Style
54*cdf0e10cSrcweir 	sal_Bool			mbCurVisible;		// Ist Cursor aktuell sichtbar
55*cdf0e10cSrcweir 	Window* 		mpWindow;			// Zugeordnetes Windows
56*cdf0e10cSrcweir };
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir // =======================================================================
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir static void ImplCursorInvert( ImplCursorData* pData )
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir 	Window* pWindow  = pData->mpWindow;
63*cdf0e10cSrcweir 	sal_Bool	bMapMode = pWindow->IsMapModeEnabled();
64*cdf0e10cSrcweir 	pWindow->EnableMapMode( sal_False );
65*cdf0e10cSrcweir 	sal_uInt16 nInvertStyle;
66*cdf0e10cSrcweir 	if ( pData->mnStyle & CURSOR_SHADOW )
67*cdf0e10cSrcweir 		nInvertStyle = INVERT_50;
68*cdf0e10cSrcweir 	else
69*cdf0e10cSrcweir 		nInvertStyle = 0;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	Rectangle aRect( pData->maPixPos, pData->maPixSize );
72*cdf0e10cSrcweir 	if ( pData->mnDirection || pData->mnOrientation || pData->mnPixSlant )
73*cdf0e10cSrcweir 	{
74*cdf0e10cSrcweir 		Polygon aPoly( aRect );
75*cdf0e10cSrcweir         if( aPoly.GetSize() == 5 )
76*cdf0e10cSrcweir         {
77*cdf0e10cSrcweir             aPoly[1].X() += 1;  // include the right border
78*cdf0e10cSrcweir             aPoly[2].X() += 1;
79*cdf0e10cSrcweir 		    if ( pData->mnPixSlant )
80*cdf0e10cSrcweir 		    {
81*cdf0e10cSrcweir 			    Point aPoint = aPoly.GetPoint( 0 );
82*cdf0e10cSrcweir 			    aPoint.X() += pData->mnPixSlant;
83*cdf0e10cSrcweir 			    aPoly.SetPoint( aPoint, 0 );
84*cdf0e10cSrcweir 			    aPoly.SetPoint( aPoint, 4 );
85*cdf0e10cSrcweir 			    aPoint = aPoly.GetPoint( 1 );
86*cdf0e10cSrcweir 			    aPoint.X() += pData->mnPixSlant;
87*cdf0e10cSrcweir 			    aPoly.SetPoint( aPoint, 1 );
88*cdf0e10cSrcweir 		    }
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir             // apply direction flag after slant to use the correct shape
91*cdf0e10cSrcweir 		    if ( pData->mnDirection )
92*cdf0e10cSrcweir             {
93*cdf0e10cSrcweir                 Point pAry[7];
94*cdf0e10cSrcweir                 int delta = 3*aRect.getWidth()+1;
95*cdf0e10cSrcweir                 if( pData->mnDirection == CURSOR_DIRECTION_LTR )
96*cdf0e10cSrcweir                 {
97*cdf0e10cSrcweir                     // left-to-right
98*cdf0e10cSrcweir                     pAry[0] = aPoly.GetPoint( 0 );
99*cdf0e10cSrcweir                     pAry[1] = aPoly.GetPoint( 1 );
100*cdf0e10cSrcweir                     pAry[2] = pAry[1];
101*cdf0e10cSrcweir                     pAry[2].X() += delta;
102*cdf0e10cSrcweir                     pAry[3] =  pAry[1];
103*cdf0e10cSrcweir                     pAry[3].Y() += delta;
104*cdf0e10cSrcweir                     pAry[4] = aPoly.GetPoint( 2 );
105*cdf0e10cSrcweir                     pAry[5] = aPoly.GetPoint( 3 );
106*cdf0e10cSrcweir                     pAry[6] = aPoly.GetPoint( 4 );
107*cdf0e10cSrcweir                 }
108*cdf0e10cSrcweir                 else if( pData->mnDirection == CURSOR_DIRECTION_RTL )
109*cdf0e10cSrcweir                 {
110*cdf0e10cSrcweir                     // right-to-left
111*cdf0e10cSrcweir                     pAry[0] = aPoly.GetPoint( 0 );
112*cdf0e10cSrcweir                     pAry[1] = aPoly.GetPoint( 1 );
113*cdf0e10cSrcweir                     pAry[2] = aPoly.GetPoint( 2 );
114*cdf0e10cSrcweir                     pAry[3] = aPoly.GetPoint( 3 );
115*cdf0e10cSrcweir                     pAry[4] = pAry[0];
116*cdf0e10cSrcweir                     pAry[4].Y() += delta;
117*cdf0e10cSrcweir                     pAry[5] =  pAry[0];
118*cdf0e10cSrcweir                     pAry[5].X() -= delta;
119*cdf0e10cSrcweir                     pAry[6] = aPoly.GetPoint( 4 );
120*cdf0e10cSrcweir                 }
121*cdf0e10cSrcweir                 aPoly = Polygon( 7, pAry);
122*cdf0e10cSrcweir             }
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 		    if ( pData->mnOrientation )
125*cdf0e10cSrcweir 			    aPoly.Rotate( pData->maPixRotOff, pData->mnOrientation );
126*cdf0e10cSrcweir 		    pWindow->Invert( aPoly, nInvertStyle );
127*cdf0e10cSrcweir         }
128*cdf0e10cSrcweir 	}
129*cdf0e10cSrcweir 	else
130*cdf0e10cSrcweir 		pWindow->Invert( aRect, nInvertStyle );
131*cdf0e10cSrcweir 	pWindow->EnableMapMode( bMapMode );
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir // -----------------------------------------------------------------------
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir void Cursor::ImplDraw()
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir 	if ( mpData && mpData->mpWindow && !mpData->mbCurVisible )
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir 		Window* pWindow 		= mpData->mpWindow;
141*cdf0e10cSrcweir 		mpData->maPixPos		= pWindow->LogicToPixel( maPos );
142*cdf0e10cSrcweir 		mpData->maPixSize		= pWindow->LogicToPixel( maSize );
143*cdf0e10cSrcweir 		mpData->mnPixSlant		= pWindow->LogicToPixel( Size( mnSlant, 0 ) ).Width();
144*cdf0e10cSrcweir 		mpData->mnOrientation	= mnOrientation;
145*cdf0e10cSrcweir 		mpData->mnDirection	    = mnDirection;
146*cdf0e10cSrcweir 		long nOffsetY			= pWindow->LogicToPixel( Size( 0, mnOffsetY ) ).Height();
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 		// Position um den Offset korrigieren
149*cdf0e10cSrcweir 		mpData->maPixPos.Y() -= nOffsetY;
150*cdf0e10cSrcweir 		mpData->maPixRotOff = mpData->maPixPos;
151*cdf0e10cSrcweir 		mpData->maPixRotOff.Y() += nOffsetY;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 		// Wenn groesse 0 ist, nehmen wir die breite, die in den
154*cdf0e10cSrcweir 		// Settings eingestellt ist
155*cdf0e10cSrcweir 		if ( !mpData->maPixSize.Width() )
156*cdf0e10cSrcweir 			mpData->maPixSize.Width() = pWindow->GetSettings().GetStyleSettings().GetCursorSize();
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 		// Ausgabeflaeche berechnen und ausgeben
159*cdf0e10cSrcweir 		ImplCursorInvert( mpData );
160*cdf0e10cSrcweir 		mpData->mbCurVisible = sal_True;
161*cdf0e10cSrcweir 	}
162*cdf0e10cSrcweir }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir // -----------------------------------------------------------------------
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir void Cursor::ImplRestore()
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir 	if ( mpData && mpData->mbCurVisible )
169*cdf0e10cSrcweir 	{
170*cdf0e10cSrcweir 		ImplCursorInvert( mpData );
171*cdf0e10cSrcweir 		mpData->mbCurVisible = sal_False;
172*cdf0e10cSrcweir 	}
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir // -----------------------------------------------------------------------
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir void Cursor::ImplShow( bool bDrawDirect, bool bRestore )
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir 	if ( mbVisible )
180*cdf0e10cSrcweir 	{
181*cdf0e10cSrcweir 		Window* pWindow;
182*cdf0e10cSrcweir 		if ( mpWindow )
183*cdf0e10cSrcweir 			pWindow = mpWindow;
184*cdf0e10cSrcweir 		else
185*cdf0e10cSrcweir 		{
186*cdf0e10cSrcweir 			// Gibt es ein aktives Fenster und ist der Cursor in dieses Fenster
187*cdf0e10cSrcweir 			// selektiert, dann zeige den Cursor an
188*cdf0e10cSrcweir 			pWindow = Application::GetFocusWindow();
189*cdf0e10cSrcweir 			if ( !pWindow || (pWindow->mpWindowImpl->mpCursor != this) || pWindow->mpWindowImpl->mbInPaint
190*cdf0e10cSrcweir 				|| !pWindow->mpWindowImpl->mpFrameData->mbHasFocus )
191*cdf0e10cSrcweir 				pWindow = NULL;
192*cdf0e10cSrcweir 		}
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir 		if ( pWindow )
195*cdf0e10cSrcweir 		{
196*cdf0e10cSrcweir 			if ( !mpData )
197*cdf0e10cSrcweir 			{
198*cdf0e10cSrcweir 				mpData = new ImplCursorData;
199*cdf0e10cSrcweir 				mpData->mbCurVisible = sal_False;
200*cdf0e10cSrcweir 				mpData->maTimer.SetTimeoutHdl( LINK( this, Cursor, ImplTimerHdl ) );
201*cdf0e10cSrcweir 			}
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 			mpData->mpWindow	= pWindow;
204*cdf0e10cSrcweir 			mpData->mnStyle 	= mnStyle;
205*cdf0e10cSrcweir 			if ( bDrawDirect || bRestore )
206*cdf0e10cSrcweir 				ImplDraw();
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 			if ( !mpWindow && ! ( ! bDrawDirect && mpData->maTimer.IsActive()) )
209*cdf0e10cSrcweir 			{
210*cdf0e10cSrcweir 				mpData->maTimer.SetTimeout( pWindow->GetSettings().GetStyleSettings().GetCursorBlinkTime() );
211*cdf0e10cSrcweir 				if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
212*cdf0e10cSrcweir 					mpData->maTimer.Start();
213*cdf0e10cSrcweir 				else if ( !mpData->mbCurVisible )
214*cdf0e10cSrcweir 					ImplDraw();
215*cdf0e10cSrcweir 			}
216*cdf0e10cSrcweir 		}
217*cdf0e10cSrcweir 	}
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir // -----------------------------------------------------------------------
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir bool Cursor::ImplHide( bool i_bStopTimer )
223*cdf0e10cSrcweir {
224*cdf0e10cSrcweir     bool bWasCurVisible = false;
225*cdf0e10cSrcweir 	if ( mpData && mpData->mpWindow )
226*cdf0e10cSrcweir 	{
227*cdf0e10cSrcweir 	    bWasCurVisible = mpData->mbCurVisible;
228*cdf0e10cSrcweir 		if ( mpData->mbCurVisible )
229*cdf0e10cSrcweir 			ImplRestore();
230*cdf0e10cSrcweir 	}
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     if( mpData && i_bStopTimer )
233*cdf0e10cSrcweir     {
234*cdf0e10cSrcweir         mpData->maTimer.Stop();
235*cdf0e10cSrcweir         mpData->mpWindow = NULL;
236*cdf0e10cSrcweir     }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	return bWasCurVisible;
239*cdf0e10cSrcweir }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir // -----------------------------------------------------------------------
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir void Cursor::ImplNew()
244*cdf0e10cSrcweir {
245*cdf0e10cSrcweir 	if ( mbVisible && mpData && mpData->mpWindow )
246*cdf0e10cSrcweir 	{
247*cdf0e10cSrcweir 		if ( mpData->mbCurVisible )
248*cdf0e10cSrcweir 			ImplRestore();
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 		ImplDraw();
251*cdf0e10cSrcweir 		if ( !mpWindow )
252*cdf0e10cSrcweir 		{
253*cdf0e10cSrcweir 			if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
254*cdf0e10cSrcweir 				mpData->maTimer.Start();
255*cdf0e10cSrcweir 		}
256*cdf0e10cSrcweir 	}
257*cdf0e10cSrcweir }
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir // -----------------------------------------------------------------------
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir IMPL_LINK( Cursor, ImplTimerHdl, AutoTimer*, EMPTYARG )
262*cdf0e10cSrcweir {
263*cdf0e10cSrcweir 	if ( mpData->mbCurVisible )
264*cdf0e10cSrcweir 		ImplRestore();
265*cdf0e10cSrcweir 	else
266*cdf0e10cSrcweir 		ImplDraw();
267*cdf0e10cSrcweir 	return 0;
268*cdf0e10cSrcweir }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir // =======================================================================
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir Cursor::Cursor()
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir 	mpData			= NULL;
275*cdf0e10cSrcweir 	mpWindow		= NULL;
276*cdf0e10cSrcweir 	mnSlant 		= 0;
277*cdf0e10cSrcweir 	mnOffsetY		= 0;
278*cdf0e10cSrcweir 	mnOrientation	= 0;
279*cdf0e10cSrcweir 	mnDirection 	= 0;
280*cdf0e10cSrcweir 	mnStyle 		= 0;
281*cdf0e10cSrcweir 	mbVisible		= sal_False;
282*cdf0e10cSrcweir }
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir // -----------------------------------------------------------------------
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir Cursor::Cursor( const Cursor& rCursor ) :
287*cdf0e10cSrcweir 	maSize( rCursor.maSize ),
288*cdf0e10cSrcweir 	maPos( rCursor.maPos )
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir 	mpData			= NULL;
291*cdf0e10cSrcweir 	mpWindow		= NULL;
292*cdf0e10cSrcweir 	mnSlant 		= rCursor.mnSlant;
293*cdf0e10cSrcweir 	mnOrientation	= rCursor.mnOrientation;
294*cdf0e10cSrcweir 	mnDirection 	= rCursor.mnDirection;
295*cdf0e10cSrcweir 	mnStyle 		= 0;
296*cdf0e10cSrcweir 	mbVisible		= rCursor.mbVisible;
297*cdf0e10cSrcweir }
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir // -----------------------------------------------------------------------
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir Cursor::~Cursor()
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir 	if ( mpData )
304*cdf0e10cSrcweir 	{
305*cdf0e10cSrcweir 		if ( mpData->mbCurVisible )
306*cdf0e10cSrcweir 			ImplRestore();
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 		delete mpData;
309*cdf0e10cSrcweir 	}
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir // -----------------------------------------------------------------------
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir void Cursor::SetStyle( sal_uInt16 nStyle )
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir 	if ( mnStyle != nStyle )
317*cdf0e10cSrcweir 	{
318*cdf0e10cSrcweir 		mnStyle = nStyle;
319*cdf0e10cSrcweir 		ImplNew();
320*cdf0e10cSrcweir 	}
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir // -----------------------------------------------------------------------
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir void Cursor::Show()
326*cdf0e10cSrcweir {
327*cdf0e10cSrcweir 	if ( !mbVisible )
328*cdf0e10cSrcweir 	{
329*cdf0e10cSrcweir 		mbVisible = sal_True;
330*cdf0e10cSrcweir 		ImplShow();
331*cdf0e10cSrcweir 	}
332*cdf0e10cSrcweir }
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir // -----------------------------------------------------------------------
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir void Cursor::Hide()
337*cdf0e10cSrcweir {
338*cdf0e10cSrcweir 	if ( mbVisible )
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		mbVisible = sal_False;
341*cdf0e10cSrcweir 		ImplHide( true );
342*cdf0e10cSrcweir 	}
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir // -----------------------------------------------------------------------
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir void Cursor::SetWindow( Window* pWindow )
348*cdf0e10cSrcweir {
349*cdf0e10cSrcweir 	if ( mpWindow != pWindow )
350*cdf0e10cSrcweir 	{
351*cdf0e10cSrcweir 		mpWindow = pWindow;
352*cdf0e10cSrcweir 		ImplNew();
353*cdf0e10cSrcweir 	}
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir // -----------------------------------------------------------------------
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir void Cursor::SetPos( const Point& rPoint )
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir 	if ( maPos != rPoint )
361*cdf0e10cSrcweir 	{
362*cdf0e10cSrcweir 		maPos = rPoint;
363*cdf0e10cSrcweir 		ImplNew();
364*cdf0e10cSrcweir 	}
365*cdf0e10cSrcweir }
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir // -----------------------------------------------------------------------
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir void Cursor::SetOffsetY( long nNewOffsetY )
370*cdf0e10cSrcweir {
371*cdf0e10cSrcweir 	if ( mnOffsetY != nNewOffsetY )
372*cdf0e10cSrcweir 	{
373*cdf0e10cSrcweir 		mnOffsetY = nNewOffsetY;
374*cdf0e10cSrcweir 		ImplNew();
375*cdf0e10cSrcweir 	}
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir // -----------------------------------------------------------------------
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir void Cursor::SetSize( const Size& rSize )
381*cdf0e10cSrcweir {
382*cdf0e10cSrcweir 	if ( maSize != rSize )
383*cdf0e10cSrcweir 	{
384*cdf0e10cSrcweir 		maSize = rSize;
385*cdf0e10cSrcweir 		ImplNew();
386*cdf0e10cSrcweir 	}
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir // -----------------------------------------------------------------------
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir void Cursor::SetWidth( long nNewWidth )
392*cdf0e10cSrcweir {
393*cdf0e10cSrcweir 	if ( maSize.Width() != nNewWidth )
394*cdf0e10cSrcweir 	{
395*cdf0e10cSrcweir 		maSize.Width() = nNewWidth;
396*cdf0e10cSrcweir 		ImplNew();
397*cdf0e10cSrcweir 	}
398*cdf0e10cSrcweir }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir // -----------------------------------------------------------------------
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir void Cursor::SetHeight( long nNewHeight )
403*cdf0e10cSrcweir {
404*cdf0e10cSrcweir 	if ( maSize.Height() != nNewHeight )
405*cdf0e10cSrcweir 	{
406*cdf0e10cSrcweir 		maSize.Height() = nNewHeight;
407*cdf0e10cSrcweir 		ImplNew();
408*cdf0e10cSrcweir 	}
409*cdf0e10cSrcweir }
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir // -----------------------------------------------------------------------
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir void Cursor::SetSlant( long nNewSlant )
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir 	if ( mnSlant != nNewSlant )
416*cdf0e10cSrcweir 	{
417*cdf0e10cSrcweir 		mnSlant = nNewSlant;
418*cdf0e10cSrcweir 		ImplNew();
419*cdf0e10cSrcweir 	}
420*cdf0e10cSrcweir }
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir // -----------------------------------------------------------------------
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir void Cursor::SetOrientation( short nNewOrientation )
425*cdf0e10cSrcweir {
426*cdf0e10cSrcweir 	if ( mnOrientation != nNewOrientation )
427*cdf0e10cSrcweir 	{
428*cdf0e10cSrcweir 		mnOrientation = nNewOrientation;
429*cdf0e10cSrcweir 		ImplNew();
430*cdf0e10cSrcweir 	}
431*cdf0e10cSrcweir }
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir // -----------------------------------------------------------------------
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir void Cursor::SetDirection( unsigned char nNewDirection )
436*cdf0e10cSrcweir {
437*cdf0e10cSrcweir 	if ( mnDirection != nNewDirection )
438*cdf0e10cSrcweir 	{
439*cdf0e10cSrcweir 		mnDirection = nNewDirection;
440*cdf0e10cSrcweir 		ImplNew();
441*cdf0e10cSrcweir 	}
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir // -----------------------------------------------------------------------
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir Cursor& Cursor::operator=( const Cursor& rCursor )
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir 	maPos			= rCursor.maPos;
449*cdf0e10cSrcweir 	maSize			= rCursor.maSize;
450*cdf0e10cSrcweir 	mnSlant 		= rCursor.mnSlant;
451*cdf0e10cSrcweir 	mnOrientation	= rCursor.mnOrientation;
452*cdf0e10cSrcweir 	mnDirection 	= rCursor.mnDirection;
453*cdf0e10cSrcweir 	mbVisible		= rCursor.mbVisible;
454*cdf0e10cSrcweir 	ImplNew();
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 	return *this;
457*cdf0e10cSrcweir }
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir // -----------------------------------------------------------------------
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir sal_Bool Cursor::operator==( const Cursor& rCursor ) const
462*cdf0e10cSrcweir {
463*cdf0e10cSrcweir 	if ( (maPos 		== rCursor.maPos)			&&
464*cdf0e10cSrcweir 		 (maSize		== rCursor.maSize)			&&
465*cdf0e10cSrcweir 		 (mnSlant		== rCursor.mnSlant) 		&&
466*cdf0e10cSrcweir 		 (mnOrientation == rCursor.mnOrientation)	&&
467*cdf0e10cSrcweir 		 (mnDirection   == rCursor.mnDirection)	    &&
468*cdf0e10cSrcweir 		 (mbVisible 	== rCursor.mbVisible) )
469*cdf0e10cSrcweir 		return sal_True;
470*cdf0e10cSrcweir 	else
471*cdf0e10cSrcweir 		return sal_False;
472*cdf0e10cSrcweir }
473