tdf#161412 - UI: fix warning in PDF password dialog didn't disappear
[LibreOffice.git] / test / source / a11y / eventposter.cxx
blob39e178e22756091581c288d5d3d28349b4fa4d40
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
8 */
10 #include <test/a11y/eventposter.hxx>
12 #include <com/sun/star/accessibility/XAccessible.hpp>
13 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
14 #include <com/sun/star/uno/Reference.hxx>
16 #include <sfx2/lokhelper.hxx>
17 #include <test/a11y/AccessibilityTools.hxx>
18 #include <toolkit/awt/vclxwindow.hxx>
20 void test::EventPosterHelper::postKeyEventAsync(int nType, int nCharCode, int nKeyCode) const
22 SfxLokHelper::postKeyEventAsync(mxWindow, nType, nCharCode, nKeyCode);
25 void test::EventPosterHelper::postExtTextEventAsync(int nType, const OUString& rText) const
27 SfxLokHelper::postExtTextEventAsync(mxWindow, nType, rText);
30 void test::AccessibleEventPosterHelper::setWindow(
31 css::uno::Reference<css::accessibility::XAccessible> xAcc)
33 while (auto xParent = xAcc->getAccessibleContext()->getAccessibleParent())
34 xAcc = xParent;
35 auto vclXWindow = dynamic_cast<VCLXWindow*>(xAcc.get());
36 if (!vclXWindow)
38 std::cerr << "WARNING: AccessibleEventPosterHelper::setWindow() called on "
39 "unsupported object "
40 << AccessibilityTools::debugString(xAcc) << ". Event delivery will not work."
41 << std::endl;
43 mxWindow = vclXWindow ? vclXWindow->GetWindow() : nullptr;
46 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */