Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / accessibility / AccessibleTextEventQueue.hxx
blob74cf7e09d06fcf588281423e72dab7dc6afaa6ca
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SOURCE_ACCESSIBILITY_ACCESSIBLETEXTEVENTQUEUE_HXX
21 #define INCLUDED_SVX_SOURCE_ACCESSIBILITY_ACCESSIBLETEXTEVENTQUEUE_HXX
23 #include <memory>
24 #include <list>
25 #include <algorithm>
26 #include <tools/rtti.hxx>
28 class SfxHint;
29 class SdrHint;
30 class TextHint;
31 class SvxViewHint;
32 class SvxEditSourceHint;
34 namespace accessibility
36 /** This class handles the notification events for the
37 AccessibleTextHelper class.
39 For various reasons, we cannot process EditEngine events as
40 they arrive, but have to queue and handle them in a batch.
42 class AccessibleTextEventQueue
44 public:
45 typedef ::std::list< SfxHint* > EventQueue;
47 AccessibleTextEventQueue();
48 ~AccessibleTextEventQueue();
50 /// Append event to end of queue
51 void Append( const SdrHint& rHint );
52 /// Append event to end of queue
53 void Append( const TextHint& rHint );
54 /// Append event to end of queue
55 void Append( const SvxViewHint& rHint );
56 /// Append event to end of queue
57 void Append( const SvxEditSourceHint& rHint );
59 /** Pop first queue element
61 return first queue element, ownership transfers to caller
63 ::std::auto_ptr< SfxHint > PopFront();
65 /** Apply functor to every queue member
67 @param rFunctor
68 Functor to apply. Functor receives queue element as
69 parameter: void func( const SfxHint* );
71 template < typename Functor > void ForEach( Functor& rFunctor ) const
73 // #109864# Make sure results are put back into rFunctor
74 rFunctor = ::std::for_each( maEventQueue.begin(), maEventQueue.end(), rFunctor );
77 /// Query whether queue is empty
78 bool IsEmpty() const;
80 /// Clear event queue
81 void Clear();
83 private:
84 EventQueue maEventQueue;
87 } // end of namespace accessibility
89 #endif // INCLUDED_SVX_SOURCE_ACCESSIBILITY_ACCESSIBLETEXTEVENTQUEUE_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */