LibreOffice Module svx (master)  1
AccessibleTextEventQueue.cxx
Go to the documentation of this file.
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>
22 
23 #include <editeng/unoedhlp.hxx>
24 #include <svx/svdmodel.hxx>
25 #include <svx/svdpntv.hxx>
26 
27 namespace accessibility
28 {
29 
30 
31  // EventQueue implementation
32 
33 
35  {
36  }
37 
39  {
40  Clear();
41  }
42 
44  {
45  // only enqueue the events we actually care about in
46  // AccessibleTextHelper_Impl::ProcessQueue(), because
47  // the cost of some events adds up.
48  auto eKind = rHint.GetKind();
49  if (eKind == SdrHintKind::BeginEdit
50  || eKind == SdrHintKind::EndEdit)
51  maEventQueue.push_back( new SdrHint( rHint ) );
52  }
53 
55  {
56  maEventQueue.push_back( new TextHint( rHint ) );
57  }
58 
60  {
61  maEventQueue.push_back( new SvxViewChangedHint( rHint ) );
62  }
63 
65  {
66  maEventQueue.push_back( new SvxEditSourceHint( rHint ) );
67  }
68 
69  ::std::unique_ptr< SfxHint > AccessibleTextEventQueue::PopFront()
70  {
71  ::std::unique_ptr< SfxHint > aRes( *(maEventQueue.begin()) );
72  maEventQueue.pop_front();
73  return aRes;
74  }
75 
77  {
78  return maEventQueue.empty();
79  }
80 
82  {
83  // clear queue
84  for( auto p : maEventQueue)
85  delete p;
86  maEventQueue.clear();
87  }
88 
89 } // end of namespace accessibility
90 
91 
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrHintKind GetKind() const
Definition: svdmodel.hxx:123
void Append(const SdrHint &rHint)
Append event to end of queue.
::std::unique_ptr< SfxHint > PopFront()
Pop first queue element.
void * p
bool IsEmpty() const
Query whether queue is empty.