1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
30 class SvxViewChangedHint
;
31 class SvxEditSourceHint
;
33 namespace accessibility
35 /** This class handles the notification events for the
36 AccessibleTextHelper class.
38 For various reasons, we cannot process EditEngine events as
39 they arrive, but have to queue and handle them in a batch.
41 class AccessibleTextEventQueue
44 typedef ::std::deque
< SfxHint
* > EventQueue
;
46 AccessibleTextEventQueue();
47 ~AccessibleTextEventQueue();
49 /// Append event to end of queue
50 void Append( const SdrHint
& rHint
);
51 /// Append event to end of queue
52 void Append( const TextHint
& rHint
);
53 /// Append event to end of queue
54 void Append( const SvxViewChangedHint
& rHint
);
55 /// Append event to end of queue
56 void Append( const SvxEditSourceHint
& rHint
);
58 /** Pop first queue element
60 return first queue element, ownership transfers to caller
62 ::std::unique_ptr
< SfxHint
> PopFront();
64 /** Apply functor to every queue member
67 Functor to apply. Functor receives queue element as
68 parameter: void func( const SfxHint* );
70 template < typename Functor
> void ForEach( Functor
& rFunctor
) const
72 // #109864# Make sure results are put back into rFunctor
73 rFunctor
= ::std::for_each( maEventQueue
.begin(), maEventQueue
.end(), rFunctor
);
76 /// Query whether queue is empty
83 EventQueue maEventQueue
;
86 } // end of namespace accessibility
88 #endif // INCLUDED_SVX_SOURCE_ACCESSIBILITY_ACCESSIBLETEXTEVENTQUEUE_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */