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 INCLUDED_SW_SOURCE_CORE_INC_BLINK_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_BLINK_HXX
22 :
23 : class SwLinePortion;
24 : class SwRootFrm;
25 : class SwTextFrm;
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 548 : SwBlinkPortion(const SwLinePortion* pPortion, sal_uInt16 nDirection)
40 : : pPor(pPortion)
41 : , pFrm(NULL)
42 548 : , nDir(nDirection)
43 : {
44 548 : }
45 0 : SwBlinkPortion(const SwBlinkPortion* pBlink, const SwLinePortion* pPort)
46 : : aPos(pBlink->aPos)
47 : , pPor(pPort)
48 : , pFrm(pBlink->pFrm)
49 0 : , nDir(pBlink->nDir)
50 : {
51 0 : }
52 58 : void SetPos( const Point& aNew ){ aPos = aNew; }
53 0 : const Point& GetPos() const{ return aPos; }
54 54 : void SetRootFrm( const SwRootFrm* pNew ){ pFrm = pNew; }
55 0 : const SwRootFrm* GetRootFrm() const{ return pFrm; }
56 0 : const SwLinePortion *GetPortion() const{ return pPor; }
57 0 : sal_uInt16 GetDirection() const { return nDir; }
58 369 : bool operator<( const SwBlinkPortion& rBlinkPortion ) const
59 369 : { return reinterpret_cast<sal_IntPtr>(pPor) < reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
60 : bool operator==( const SwBlinkPortion& rBlinkPortion ) const
61 : { return reinterpret_cast<sal_IntPtr>(pPor) == reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
62 : };
63 :
64 2 : class SwBlinkList : public boost::ptr_set<SwBlinkPortion> {};
65 :
66 : class SwBlink
67 : {
68 : SwBlinkList aList;
69 : AutoTimer aTimer;
70 : bool bVisible;
71 :
72 : public:
73 : SwBlink();
74 : ~SwBlink();
75 :
76 : DECL_LINK_TYPED( Blinker, Timer *, void );
77 :
78 : void Insert( const Point& rPoint, const SwLinePortion* pPor,
79 : const SwTextFrm *pTextFrm, 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 58 : bool IsVisible() const { return bVisible ; }
84 : };
85 :
86 : // Blink-Manager, global variable, see Blink.Cxx
87 : extern SwBlink *pBlink;
88 :
89 : #endif
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|