LibreOffice Module test (master) 1
eventposter.cxx
Go to the documentation of this file.
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.
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
11
12#include <com/sun/star/accessibility/XAccessible.hpp>
13#include <com/sun/star/accessibility/XAccessibleContext.hpp>
14#include <com/sun/star/uno/Reference.hxx>
15
16#include <sfx2/lokhelper.hxx>
19
20void test::EventPosterHelper::postKeyEventAsync(int nType, int nCharCode, int nKeyCode) const
21{
22 SfxLokHelper::postKeyEventAsync(mxWindow, nType, nCharCode, nKeyCode);
23}
24
25void test::EventPosterHelper::postExtTextEventAsync(int nType, const OUString& rText) const
26{
28}
29
31 css::uno::Reference<css::accessibility::XAccessible> xAcc)
32{
33 while (auto xParent = xAcc->getAccessibleContext()->getAccessibleParent())
34 xAcc = xParent;
35 auto vclXWindow = dynamic_cast<VCLXWindow*>(xAcc.get());
36 if (!vclXWindow)
37 {
38 std::cerr << "WARNING: AccessibleEventPosterHelper::setWindow() called on "
39 "unsupported object "
40 << AccessibilityTools::debugString(xAcc) << ". Event delivery will not work."
41 << std::endl;
42 }
43 mxWindow = vclXWindow ? vclXWindow->GetWindow() : nullptr;
44}
45
46/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
static std::string debugString(const css::uno::Reference< T > &x)
static void postKeyEventAsync(const VclPtr< vcl::Window > &xWindow, int nType, int nCharCode, int nKeyCode, int nRepeat=0)
static void postExtTextEventAsync(const VclPtr< vcl::Window > &xWindow, int nType, const OUString &rText)
void setWindow(css::uno::Reference< css::accessibility::XAccessible > xAcc)
Sets the window on which post events based on an accessible object inside it.
Definition: eventposter.cxx:30
VclPtr< vcl::Window > mxWindow
Definition: eventposter.hxx:69
virtual void postExtTextEventAsync(int nType, const OUString &rText) const override
Definition: eventposter.cxx:25
virtual void postKeyEventAsync(int nType, int nCharCode, int nKeyCode) const override
Definition: eventposter.cxx:20
QPRO_FUNC_TYPE nType