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 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 : : pPor(pPortion)
41 : , pFrm(NULL)
42 0 : , nDir(nDirection)
43 : {
44 0 : }
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 0 : void SetPos( const Point& aNew ){ aPos = aNew; }
53 0 : const Point& GetPos() const{ return aPos; }
54 0 : 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 0 : bool operator<( const SwBlinkPortion& rBlinkPortion ) const
59 0 : { return (sal_IntPtr)pPor < (sal_IntPtr)rBlinkPortion.pPor; }
60 : bool operator==( const SwBlinkPortion& rBlinkPortion ) const
61 : { return (sal_IntPtr)pPor == (sal_IntPtr)rBlinkPortion.pPor; }
62 : };
63 :
64 0 : 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( 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 0 : 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: */
|