Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _BLINK_HXX
21 : #define _BLINK_HXX
22 :
23 : class SwLinePortion;
24 : class SwRootFrm;
25 : class SwTxtFrm;
26 :
27 : #include <vcl/timer.hxx>
28 : #include <tools/gen.hxx>
29 : #include <boost/ptr_container/ptr_set.hpp>
30 :
31 : class SwBlinkPortion
32 : {
33 : Point aPos;
34 : const SwLinePortion *pPor;
35 : const SwRootFrm *pFrm;
36 : sal_uInt16 nDir;
37 :
38 : public:
39 0 : SwBlinkPortion( const SwLinePortion* pPortion, sal_uInt16 nDirection )
40 0 : { pPor = pPortion; nDir = nDirection; }
41 0 : SwBlinkPortion( const SwBlinkPortion* pBlink, const SwLinePortion* pPort )
42 0 : { pPor = pPort; pFrm = pBlink->pFrm; aPos = pBlink->aPos; nDir = pBlink->nDir; }
43 0 : void SetPos( const Point& aNew ){ aPos = aNew; }
44 0 : const Point& GetPos() const{ return aPos; }
45 0 : void SetRootFrm( const SwRootFrm* pNew ){ pFrm = pNew; }
46 0 : const SwRootFrm* GetRootFrm() const{ return pFrm; }
47 0 : const SwLinePortion *GetPortion() const{ return pPor; }
48 0 : sal_uInt16 GetDirection() const { return nDir; }
49 0 : sal_Bool operator<( const SwBlinkPortion& rBlinkPortion ) const
50 0 : { return (long)pPor < (long)rBlinkPortion.pPor; }
51 : sal_Bool operator==( const SwBlinkPortion& rBlinkPortion ) const
52 : { return (long)pPor == (long)rBlinkPortion.pPor; }
53 : };
54 :
55 0 : class SwBlinkList : public boost::ptr_set<SwBlinkPortion> {};
56 :
57 : class SwBlink
58 : {
59 : SwBlinkList aList;
60 : AutoTimer aTimer;
61 : sal_Bool bVisible;
62 :
63 : public:
64 : SwBlink();
65 : ~SwBlink();
66 :
67 : DECL_LINK( Blinker, void * );
68 :
69 : void Insert( const Point& rPoint, const SwLinePortion* pPor,
70 : const SwTxtFrm *pTxtFrm, sal_uInt16 nDir );
71 : void Replace( const SwLinePortion* pOld, const SwLinePortion* pNew );
72 : void Delete( const SwLinePortion* pPor );
73 : void FrmDelete( const SwRootFrm* pRoot );
74 0 : inline sal_Bool IsVisible() const { return bVisible ; }
75 : };
76 :
77 : // Blink-Manager, global variable, see Blink.Cxx
78 : extern SwBlink *pBlink;
79 :
80 :
81 : #endif
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|