bump product version to 6.4.0.3
[LibreOffice.git] / vcl / source / uitest / uno / uitest_uno.cxx
blob8ae3b7e284a1f4cd8de8c2a23dcbb4eb1e5b9ffc
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/.
8 */
10 #include <cppuhelper/compbase.hxx>
11 #include <cppuhelper/basemutex.hxx>
12 #include <cppuhelper/supportsservice.hxx>
13 #include <com/sun/star/lang/XServiceInfo.hpp>
14 #include <com/sun/star/uno/XComponentContext.hpp>
15 #include <com/sun/star/ui/test/XUITest.hpp>
17 #include <memory>
19 #include <vcl/uitest/uitest.hxx>
20 #include <vcl/svapp.hxx>
22 #include "uiobject_uno.hxx"
24 namespace
26 typedef ::cppu::WeakComponentImplHelper <
27 css::ui::test::XUITest, css::lang::XServiceInfo
28 > UITestBase;
31 class UITestUnoObj : public cppu::BaseMutex,
32 public UITestBase
34 private:
35 std::unique_ptr<UITest> mpUITest;
37 public:
39 UITestUnoObj();
41 sal_Bool SAL_CALL executeCommand(const OUString& rCommand) override;
43 sal_Bool SAL_CALL executeCommandWithParameters(const OUString& rCommand,
44 const css::uno::Sequence< css::beans::PropertyValue >& rArgs) override;
46 sal_Bool SAL_CALL executeDialog(const OUString& rCommand) override;
48 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getTopFocusWindow() override;
50 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getFloatWindow() override;
52 OUString SAL_CALL getImplementationName() override;
54 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
56 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
59 UITestUnoObj::UITestUnoObj():
60 UITestBase(m_aMutex),
61 mpUITest(new UITest)
65 sal_Bool SAL_CALL UITestUnoObj::executeCommand(const OUString& rCommand)
67 SolarMutexGuard aGuard;
68 return UITest::executeCommand(rCommand);
71 sal_Bool SAL_CALL UITestUnoObj::executeCommandWithParameters(const OUString& rCommand,
72 const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
74 SolarMutexGuard aGuard;
75 return UITest::executeCommandWithParameters(rCommand,rArgs);
78 sal_Bool SAL_CALL UITestUnoObj::executeDialog(const OUString& rCommand)
80 SolarMutexGuard aGuard;
81 return UITest::executeDialog(rCommand);
84 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getTopFocusWindow()
86 SolarMutexGuard aGuard;
87 std::unique_ptr<UIObject> pObj = UITest::getFocusTopWindow();
88 return new UIObjectUnoObj(std::move(pObj));
91 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getFloatWindow()
93 SolarMutexGuard aGuard;
94 std::unique_ptr<UIObject> pObj = UITest::getFloatWindow();
95 return new UIObjectUnoObj(std::move(pObj));
98 OUString SAL_CALL UITestUnoObj::getImplementationName()
100 return "org.libreoffice.uitest.UITest";
103 sal_Bool UITestUnoObj::supportsService(OUString const & ServiceName)
105 return cppu::supportsService(this, ServiceName);
108 css::uno::Sequence<OUString> UITestUnoObj::getSupportedServiceNames()
110 return { "com.sun.star.ui.test.UITest" };
113 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
114 UITest_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
116 return cppu::acquire(new UITestUnoObj());
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */