xref: /aoo41x/main/sw/source/core/inc/blink.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef	_BLINK_HXX
28 #define	_BLINK_HXX
29 
30 class SwLinePortion;
31 class SwRootFrm;
32 class SwTxtFrm;
33 
34 #include <vcl/timer.hxx>
35 #include <tools/gen.hxx>
36 
37 #include <svl/svarray.hxx>
38 
39 class SwBlinkPortion
40 {
41     Point               aPos;
42 	const SwLinePortion	*pPor;
43 	const SwRootFrm		*pFrm;
44     sal_uInt16              nDir;
45 public:
46     SwBlinkPortion( const SwLinePortion* pPortion, sal_uInt16 nDirection )
47             { pPor = pPortion; nDir = nDirection; }
48 	SwBlinkPortion( const SwBlinkPortion* pBlink, const SwLinePortion* pPort )
49     {   pPor = pPort; pFrm = pBlink->pFrm; aPos = pBlink->aPos; nDir = pBlink->nDir; }
50 	void SetPos( const Point& aNew ){ aPos = aNew; }
51 	const Point& GetPos() const{ return aPos; }
52 	void SetRootFrm( const SwRootFrm* pNew ){ pFrm = pNew; }
53 	const SwRootFrm* GetRootFrm() const{ return pFrm; }
54 	const SwLinePortion *GetPortion() const{ return pPor; }
55     sal_uInt16 GetDirection() const { return nDir; }
56 	sal_Bool operator<( const SwBlinkPortion& rBlinkPortion ) const
57 	{ return (long)pPor < (long)rBlinkPortion.pPor; }
58 	sal_Bool operator==( const SwBlinkPortion& rBlinkPortion ) const
59 	{ return (long)pPor == (long)rBlinkPortion.pPor; }
60 };
61 
62 typedef SwBlinkPortion* SwBlinkPortionPtr;
63 SV_DECL_PTRARR_SORT_DEL(SwBlinkList, SwBlinkPortionPtr, 0, 10)
64 
65 class SwBlink
66 {
67 	SwBlinkList		aList;
68 	AutoTimer		aTimer;
69 	sal_Bool			bVisible;
70 public:
71 	SwBlink();
72 	~SwBlink();
73 
74 	DECL_LINK( Blinker, Timer * );
75 
76     void Insert( const Point& rPoint, const SwLinePortion* pPor,
77                  const SwTxtFrm *pTxtFrm, sal_uInt16 nDir );
78 	void Replace( const SwLinePortion* pOld, const SwLinePortion* pNew );
79 	void Delete( const SwLinePortion* pPor );
80 	void FrmDelete( const SwRootFrm* pRoot );
81 	inline sal_Bool IsVisible() const { return bVisible ; }
82 };
83 
84 // Blink-Manager, globale Variable, in Blink.Cxx angelegt
85 extern SwBlink *pBlink;
86 
87 
88 #endif
89 
90