Coverage Report

Created: 2025-12-31 10:39

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