LCOV - code coverage report
Current view: top level - svx/source/accessibility - AccessibleTextEventQueue.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 3 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11