1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleTextEventQueue.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_TEXT_CHANGED_QUEUE_HXX
32 #define _SVX_TEXT_CHANGED_QUEUE_HXX
37 #include <tools/solar.h>
38 #include <tools/rtti.hxx>
45 class SvxEditSourceHint
;
47 namespace accessibility
49 /** This class handles the notification events for the
50 AccessibleTextHelper class.
52 For various reasons, we cannot process EditEngine events as
53 they arrive, but have to queue and handle them in a batch.
55 class AccessibleTextEventQueue
58 typedef ::std::list
< SfxHint
* > EventQueue
;
60 AccessibleTextEventQueue();
61 ~AccessibleTextEventQueue();
63 /// Append event to end of queue
64 void Append( const SfxHint
& rHint
);
65 /// Append event to end of queue
66 void Append( const SdrHint
& rHint
);
67 /// Append event to end of queue
68 void Append( const SfxSimpleHint
& rHint
);
69 /// Append event to end of queue
70 void Append( const TextHint
& rHint
);
71 /// Append event to end of queue
72 void Append( const SvxViewHint
& rHint
);
73 /// Append event to end of queue
74 void Append( const SvxEditSourceHint
& rHint
);
76 /** Pop first queue element
78 return first queue element, ownership transfers to caller
80 ::std::auto_ptr
< SfxHint
> PopFront();
82 /** Apply functor to every queue member
85 Functor to apply. Functor receives queue element as
86 parameter: void func( const SfxHint* );
88 template < typename Functor
> void ForEach( Functor
& rFunctor
) const
90 // #109864# Make sure results are put back into rFunctor
91 rFunctor
= ::std::for_each( maEventQueue
.begin(), maEventQueue
.end(), rFunctor
);
94 /// Query whether queue is empty
101 EventQueue maEventQueue
;
104 } // end of namespace accessibility
106 #endif /* _SVX_TEXT_CHANGED_QUEUE_HXX */