bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / accessibility / AccessibleTextEventQueue.cxx
bloba39123c45eca869225e9e1f77c92409d4a7a9ea2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <memory>
21 #include "AccessibleTextEventQueue.hxx"
23 #include <editeng/unoedhlp.hxx>
24 #include <svx/svdmodel.hxx>
25 #include <svx/svdpntv.hxx>
27 namespace accessibility
31 // EventQueue implementation
34 AccessibleTextEventQueue::AccessibleTextEventQueue()
38 AccessibleTextEventQueue::~AccessibleTextEventQueue()
40 Clear();
43 void AccessibleTextEventQueue::Append( const SdrHint& rHint )
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 ) );
54 void AccessibleTextEventQueue::Append( const TextHint& rHint )
56 maEventQueue.push_back( new TextHint( rHint ) );
59 void AccessibleTextEventQueue::Append( const SvxViewChangedHint& rHint )
61 maEventQueue.push_back( new SvxViewChangedHint( rHint ) );
64 void AccessibleTextEventQueue::Append( const SvxEditSourceHint& rHint )
66 maEventQueue.push_back( new SvxEditSourceHint( rHint ) );
69 ::std::unique_ptr< SfxHint > AccessibleTextEventQueue::PopFront()
71 ::std::unique_ptr< SfxHint > aRes( *(maEventQueue.begin()) );
72 maEventQueue.pop_front();
73 return aRes;
76 bool AccessibleTextEventQueue::IsEmpty() const
78 return maEventQueue.empty();
81 void AccessibleTextEventQueue::Clear()
83 // clear queue
84 for( auto p : maEventQueue)
85 delete p;
86 maEventQueue.clear();
89 } // end of namespace accessibility
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */