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