LibreOffice Module vcl (master) 1
uitest_uno.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
12#include <com/sun/star/lang/XServiceInfo.hpp>
13#include <com/sun/star/uno/XComponentContext.hpp>
14#include <com/sun/star/ui/test/XUITest.hpp>
15
16#include <memory>
17
18#include <vcl/uitest/uitest.hxx>
19#include <vcl/svapp.hxx>
20#include <vcl/window.hxx>
21
22#include "uiobject_uno.hxx"
23
24namespace
25{
27 css::ui::test::XUITest, css::lang::XServiceInfo
28 > UITestBase;
29
30class UITestUnoObj : public UITestBase
31{
32public:
33
34 UITestUnoObj();
35
36 sal_Bool SAL_CALL executeCommand(const OUString& rCommand) override;
37
38 sal_Bool SAL_CALL executeCommandWithParameters(const OUString& rCommand,
39 const css::uno::Sequence< css::beans::PropertyValue >& rArgs) override;
40
41 sal_Bool SAL_CALL executeDialog(const OUString& rCommand) override;
42
43 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getTopFocusWindow() override;
44
45 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getFloatWindow() override;
46
47 OUString SAL_CALL getImplementationName() override;
48
49 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
50
51 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
52};
53
54}
55
56UITestUnoObj::UITestUnoObj()
57{
58}
59
60sal_Bool SAL_CALL UITestUnoObj::executeCommand(const OUString& rCommand)
61{
62 SolarMutexGuard aGuard;
63 return UITest::executeCommand(rCommand);
64}
65
66sal_Bool SAL_CALL UITestUnoObj::executeCommandWithParameters(const OUString& rCommand,
67 const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
68{
69 SolarMutexGuard aGuard;
70 return UITest::executeCommandWithParameters(rCommand,rArgs);
71}
72
73sal_Bool SAL_CALL UITestUnoObj::executeDialog(const OUString& rCommand)
74{
75 SolarMutexGuard aGuard;
76 return UITest::executeDialog(rCommand);
77}
78
79css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getTopFocusWindow()
80{
81 SolarMutexGuard aGuard;
82 std::unique_ptr<UIObject> pObj = UITest::getFocusTopWindow();
83 return new UIObjectUnoObj(std::move(pObj));
84}
85
86css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getFloatWindow()
87{
88 SolarMutexGuard aGuard;
89 std::unique_ptr<UIObject> pObj = UITest::getFloatWindow();
90 return new UIObjectUnoObj(std::move(pObj));
91}
92
93OUString SAL_CALL UITestUnoObj::getImplementationName()
94{
95 return "org.libreoffice.uitest.UITest";
96}
97
98sal_Bool UITestUnoObj::supportsService(OUString const & ServiceName)
99{
100 return cppu::supportsService(this, ServiceName);
101}
102
103css::uno::Sequence<OUString> UITestUnoObj::getSupportedServiceNames()
104{
105 return { "com.sun.star.ui.test.UITest" };
106}
107
108extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
109UITest_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
110{
111 return cppu::acquire(new UITestUnoObj());
112}
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< UIObject > getFocusTopWindow()
Definition: uitest.cxx:55
bool executeCommand(const OUString &rCommand)
Definition: uitest.cxx:22
std::unique_ptr< UIObject > getFloatWindow()
Definition: uitest.cxx:68
bool executeDialog(const OUString &rCommand)
Definition: uitest.cxx:47
bool executeCommandWithParameters(const OUString &rCommand, const css::uno::Sequence< css::beans::PropertyValue > &rArgs)
Definition: uitest.cxx:30
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * UITest_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: uitest_uno.cxx:109