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 _SVX_TEXT_CHANGED_QUEUE_HXX
30 : : #define _SVX_TEXT_CHANGED_QUEUE_HXX
31 : :
32 : : #include <memory>
33 : : #include <list>
34 : : #include <algorithm>
35 : : #include <tools/solar.h>
36 : : #include <tools/rtti.hxx>
37 : :
38 : : class SfxHint;
39 : : class SdrHint;
40 : : class TextHint;
41 : : class SvxViewHint;
42 : : class SvxEditSourceHint;
43 : :
44 : : namespace accessibility
45 : : {
46 : : /** This class handles the notification events for the
47 : : AccessibleTextHelper class.
48 : :
49 : : For various reasons, we cannot process EditEngine events as
50 : : they arrive, but have to queue and handle them in a batch.
51 : : */
52 : : class AccessibleTextEventQueue
53 : : {
54 : : public:
55 : : typedef ::std::list< SfxHint* > EventQueue;
56 : :
57 : : AccessibleTextEventQueue();
58 : : ~AccessibleTextEventQueue();
59 : :
60 : : /// Append event to end of queue
61 : : void Append( const SdrHint& rHint );
62 : : /// Append event to end of queue
63 : : void Append( const TextHint& rHint );
64 : : /// Append event to end of queue
65 : : void Append( const SvxViewHint& rHint );
66 : : /// Append event to end of queue
67 : : void Append( const SvxEditSourceHint& rHint );
68 : :
69 : : /** Pop first queue element
70 : :
71 : : return first queue element, ownership transfers to caller
72 : : */
73 : : ::std::auto_ptr< SfxHint > PopFront();
74 : :
75 : : /** Apply functor to every queue member
76 : :
77 : : @param rFunctor
78 : : Functor to apply. Functor receives queue element as
79 : : parameter: void func( const SfxHint* );
80 : : */
81 : 9 : template < typename Functor > void ForEach( Functor& rFunctor ) const
82 : : {
83 : : // #109864# Make sure results are put back into rFunctor
84 : 9 : rFunctor = ::std::for_each( maEventQueue.begin(), maEventQueue.end(), rFunctor );
85 : 9 : }
86 : :
87 : : /// Query whether queue is empty
88 : : bool IsEmpty() const;
89 : :
90 : : /// Clear event queue
91 : : void Clear();
92 : :
93 : : private:
94 : : EventQueue maEventQueue;
95 : : };
96 : :
97 : : } // end of namespace accessibility
98 : :
99 : : #endif /* _SVX_TEXT_CHANGED_QUEUE_HXX */
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|