Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/accessibility/AccessibleTextEventQueue.cxx
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
#include <memory>
21
#include "AccessibleTextEventQueue.hxx"
22
23
#include <editeng/unoedhlp.hxx>
24
#include <svx/svdmodel.hxx>
25
#include <svx/svdpntv.hxx>
26
27
namespace accessibility
28
{
29
// EventQueue implementation
30
31
0
AccessibleTextEventQueue::AccessibleTextEventQueue() {}
32
33
0
AccessibleTextEventQueue::~AccessibleTextEventQueue() { Clear(); }
34
35
void AccessibleTextEventQueue::Append(const SdrHint& rHint)
36
0
{
37
    // only enqueue the events we actually care about in
38
    // AccessibleTextHelper_Impl::ProcessQueue(), because
39
    // the cost of some events adds up.
40
0
    auto eKind = rHint.GetKind();
41
0
    if (eKind == SdrHintKind::BeginEdit || eKind == SdrHintKind::EndEdit)
42
0
        maEventQueue.push_back(new SdrHint(rHint));
43
0
}
44
45
void AccessibleTextEventQueue::Append(const TextHint& rHint)
46
0
{
47
0
    maEventQueue.push_back(new TextHint(rHint));
48
0
}
49
50
void AccessibleTextEventQueue::Append(const SvxViewChangedHint& rHint)
51
0
{
52
0
    maEventQueue.push_back(new SvxViewChangedHint(rHint));
53
0
}
54
55
void AccessibleTextEventQueue::Append(const SvxEditSourceHint& rHint)
56
0
{
57
0
    maEventQueue.push_back(new SvxEditSourceHint(rHint));
58
0
}
59
60
::std::unique_ptr<SfxHint> AccessibleTextEventQueue::PopFront()
61
0
{
62
0
    assert(!maEventQueue.empty());
63
0
    ::std::unique_ptr<SfxHint> aRes(*(maEventQueue.begin()));
64
0
    maEventQueue.pop_front();
65
0
    return aRes;
66
0
}
67
68
0
bool AccessibleTextEventQueue::IsEmpty() const { return maEventQueue.empty(); }
69
70
void AccessibleTextEventQueue::Clear()
71
0
{
72
    // clear queue
73
0
    for (auto p : maEventQueue)
74
0
        delete p;
75
0
    maEventQueue.clear();
76
0
}
77
78
} // end of namespace accessibility
79
80
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */