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