tdf#164183 Add hyperlink entries to context menu of tables
[LibreOffice.git] / vcl / source / uitest / uno / uitest_uno.cxx
bloba96371daba38108d1f78ba2ffe48aedf3d944534
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 <comphelper/compbase.hxx>
11 #include <cppuhelper/supportsservice.hxx>
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>
16 #include <memory>
18 #include <vcl/uitest/uitest.hxx>
19 #include <vcl/svapp.hxx>
20 #include <vcl/window.hxx>
22 #include "uiobject_uno.hxx"
24 namespace
26 typedef ::comphelper::WeakComponentImplHelper <
27 css::ui::test::XUITest, css::lang::XServiceInfo
28 > UITestBase;
30 class UITestUnoObj : public UITestBase
32 public:
34 UITestUnoObj();
36 sal_Bool SAL_CALL executeCommand(const OUString& rCommand) override;
38 sal_Bool SAL_CALL executeCommandWithParameters(const OUString& rCommand,
39 const css::uno::Sequence< css::beans::PropertyValue >& rArgs) override;
41 sal_Bool SAL_CALL executeDialog(const OUString& rCommand) override;
43 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getTopFocusWindow() override;
45 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getFloatWindow() override;
47 OUString SAL_CALL getImplementationName() override;
49 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
51 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
56 UITestUnoObj::UITestUnoObj()
60 sal_Bool SAL_CALL UITestUnoObj::executeCommand(const OUString& rCommand)
62 SolarMutexGuard aGuard;
63 return UITest::executeCommand(rCommand);
66 sal_Bool SAL_CALL UITestUnoObj::executeCommandWithParameters(const OUString& rCommand,
67 const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
69 SolarMutexGuard aGuard;
70 return UITest::executeCommandWithParameters(rCommand,rArgs);
73 sal_Bool SAL_CALL UITestUnoObj::executeDialog(const OUString& rCommand)
75 SolarMutexGuard aGuard;
76 return UITest::executeDialog(rCommand);
79 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getTopFocusWindow()
81 SolarMutexGuard aGuard;
82 std::unique_ptr<UIObject> pObj = UITest::getFocusTopWindow();
83 if (!pObj)
84 throw css::uno::RuntimeException(u"UITest::getFocusTopWindow did not find a window"_ustr);
85 return new UIObjectUnoObj(std::move(pObj));
88 css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getFloatWindow()
90 SolarMutexGuard aGuard;
91 std::unique_ptr<UIObject> pObj = UITest::getFloatWindow();
92 if (!pObj)
93 throw css::uno::RuntimeException(u"UITest::getFloatWindow did not find a window"_ustr);
94 return new UIObjectUnoObj(std::move(pObj));
97 OUString SAL_CALL UITestUnoObj::getImplementationName()
99 return u"org.libreoffice.uitest.UITest"_ustr;
102 sal_Bool UITestUnoObj::supportsService(OUString const & ServiceName)
104 return cppu::supportsService(this, ServiceName);
107 css::uno::Sequence<OUString> UITestUnoObj::getSupportedServiceNames()
109 return { u"com.sun.star.ui.test.UITest"_ustr };
112 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
113 UITest_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
115 return cppu::acquire(new UITestUnoObj());
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */