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