From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- desktop/test/deployment/passive/Addons.xcu | 74 ++++++ desktop/test/deployment/passive/MANIFEST.MF | 3 + .../test/deployment/passive/META-INF/manifest.xml | 32 +++ .../test/deployment/passive/ProtocolHandler.xcu | 39 ++++ .../sun/star/comp/test/deployment/Dispatch.java | 95 ++++++++ .../sun/star/comp/test/deployment/Provider.java | 74 ++++++ .../sun/star/comp/test/deployment/Services.java | 42 ++++ desktop/test/deployment/passive/description.xml | 27 +++ desktop/test/deployment/passive/help/en/help.tree | 16 ++ desktop/test/deployment/passive/help/en/main.xhp | 35 +++ .../test/deployment/passive/passive_java.component | 29 +++ .../deployment/passive/passive_native.component | 29 +++ desktop/test/deployment/passive/passive_native.cxx | 248 +++++++++++++++++++++ .../deployment/passive/passive_python.component | 29 +++ desktop/test/deployment/passive/passive_python.py | 93 ++++++++ 15 files changed, 865 insertions(+) create mode 100644 desktop/test/deployment/passive/Addons.xcu create mode 100644 desktop/test/deployment/passive/MANIFEST.MF create mode 100644 desktop/test/deployment/passive/META-INF/manifest.xml create mode 100644 desktop/test/deployment/passive/ProtocolHandler.xcu create mode 100644 desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java create mode 100644 desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Provider.java create mode 100644 desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Services.java create mode 100644 desktop/test/deployment/passive/description.xml create mode 100644 desktop/test/deployment/passive/help/en/help.tree create mode 100644 desktop/test/deployment/passive/help/en/main.xhp create mode 100644 desktop/test/deployment/passive/passive_java.component create mode 100644 desktop/test/deployment/passive/passive_native.component create mode 100644 desktop/test/deployment/passive/passive_native.cxx create mode 100644 desktop/test/deployment/passive/passive_python.component create mode 100644 desktop/test/deployment/passive/passive_python.py (limited to 'desktop/test/deployment/passive') diff --git a/desktop/test/deployment/passive/Addons.xcu b/desktop/test/deployment/passive/Addons.xcu new file mode 100644 index 000000000..3cc7c45ed --- /dev/null +++ b/desktop/test/deployment/passive/Addons.xcu @@ -0,0 +1,74 @@ + + + + + + + + + + passive + + + + + vnd.org.openoffice.test.desktop.deployment.passive_native: + + + native + + + + + vnd.org.openoffice.test.desktop.deployment.passive_java: + + + java + + + + + vnd.org.openoffice.test.desktop.deployment.passive_python: + + + python + + + + + + + + + + vnd.org.openoffice.test.desktop.deployment.passive_native: + + + native + + + + + + + + + + diff --git a/desktop/test/deployment/passive/MANIFEST.MF b/desktop/test/deployment/passive/MANIFEST.MF new file mode 100644 index 000000000..45a04bf26 --- /dev/null +++ b/desktop/test/deployment/passive/MANIFEST.MF @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.passive_java.Services +UNO-Type-Path: diff --git a/desktop/test/deployment/passive/META-INF/manifest.xml b/desktop/test/deployment/passive/META-INF/manifest.xml new file mode 100644 index 000000000..c387b4be4 --- /dev/null +++ b/desktop/test/deployment/passive/META-INF/manifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/desktop/test/deployment/passive/ProtocolHandler.xcu b/desktop/test/deployment/passive/ProtocolHandler.xcu new file mode 100644 index 000000000..f546fd119 --- /dev/null +++ b/desktop/test/deployment/passive/ProtocolHandler.xcu @@ -0,0 +1,39 @@ + + + + + + + + vnd.org.openoffice.test.desktop.deployment.passive_native:* + + + + + vnd.org.openoffice.test.desktop.deployment.passive_java:* + + + + + vnd.org.openoffice.test.desktop.deployment.passive_python:* + + + + diff --git a/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java new file mode 100644 index 000000000..74882bca5 --- /dev/null +++ b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java @@ -0,0 +1,95 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.awt.MessageBoxButtons; +import com.sun.star.awt.MessageBoxType; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XStatusListener; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch +{ + public Dispatch(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return false; //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public void dispatch(URL URL, PropertyValue[] Arguments) { + try { + XMultiComponentFactory smgr = UnoRuntime.queryInterface( + XMultiComponentFactory.class, context.getServiceManager()); + XMessageBox box = UnoRuntime.queryInterface( + XMessageBoxFactory.class, + smgr.createInstanceWithContext( + "com.sun.star.awt.Toolkit", context)). + createMessageBox( + UnoRuntime.queryInterface( + XWindowPeer.class, + (UnoRuntime.queryInterface( + XDesktop.class, + smgr.createInstanceWithContext( + "com.sun.star.frame.Desktop", context)). + getCurrentFrame().getComponentWindow())), + MessageBoxType.INFOBOX, MessageBoxButtons.BUTTONS_OK, + "passive", "java"); + box.execute(); + UnoRuntime.queryInterface(XComponent.class, box).dispose(); + } catch (com.sun.star.uno.RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException(e, + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java_singleton"; + + static final String[] serviceNames = new String[0]; +} diff --git a/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Provider.java b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Provider.java new file mode 100644 index 000000000..13d59ecf1 --- /dev/null +++ b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Provider.java @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Provider extends WeakBase + implements XServiceInfo, XDispatchProvider +{ + public Provider(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return ServiceName.equals(getSupportedServiceNames()[0]); //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public XDispatch queryDispatch( + URL URL, String TargetFrameName, int SearchFlags) + { + return UnoRuntime.queryInterface( + XDispatch.class, + context.getValueByName( + "/singletons/" + + "com.sun.star.test.deployment.passive_java_singleton")); + } + + public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { + XDispatch[] s = new XDispatch[Requests.length]; + for (int i = 0; i < s.length; ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; + } + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java"; + + static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.passive_java" }; +} diff --git a/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Services.java b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Services.java new file mode 100644 index 000000000..b14ba7102 --- /dev/null +++ b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Services.java @@ -0,0 +1,42 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; + +public final class Services { + private Services() {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + if (implementation.equals(Dispatch.implementationName)) { + return Factory.createComponentFactory( + Dispatch.class, Dispatch.implementationName, + Dispatch.serviceNames); + } else if (implementation.equals(Provider.implementationName)) { + return Factory.createComponentFactory( + Provider.class, Provider.implementationName, + Provider.serviceNames); + } else { + return null; + } + } +} diff --git a/desktop/test/deployment/passive/description.xml b/desktop/test/deployment/passive/description.xml new file mode 100644 index 000000000..b0fdea19e --- /dev/null +++ b/desktop/test/deployment/passive/description.xml @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/desktop/test/deployment/passive/help/en/help.tree b/desktop/test/deployment/passive/help/en/help.tree new file mode 100644 index 000000000..76a07991d --- /dev/null +++ b/desktop/test/deployment/passive/help/en/help.tree @@ -0,0 +1,16 @@ + + + + + The test-passive Extension + + diff --git a/desktop/test/deployment/passive/help/en/main.xhp b/desktop/test/deployment/passive/help/en/main.xhp new file mode 100644 index 000000000..ff62c6b68 --- /dev/null +++ b/desktop/test/deployment/passive/help/en/main.xhp @@ -0,0 +1,35 @@ + + + + + + The test-passive Extension + /org.openoffice%2Fframework%2Fdesktop%2Ftest%2Fdeployment%2Fpassive/main.xhp + + test-passive extension + extensions;test-passive + + + test-passive extension in Calc and Writer + + + + + + + + Show the test-passive extension's native dialog + + + The test-passive Extension + Bla bla bla. + + diff --git a/desktop/test/deployment/passive/passive_java.component b/desktop/test/deployment/passive/passive_java.component new file mode 100644 index 000000000..35ff0fcdf --- /dev/null +++ b/desktop/test/deployment/passive/passive_java.component @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/desktop/test/deployment/passive/passive_native.component b/desktop/test/deployment/passive/passive_native.component new file mode 100644 index 000000000..37d13e53d --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.component @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx new file mode 100644 index 000000000..9bfbcb7b1 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.cxx @@ -0,0 +1,248 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +class Provider: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatchProvider > +{ +public: + Provider(const Provider&) = delete; + const Provider& operator=(const Provider&) = delete; + + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + { return static_cast< cppu::OWeakObject * >(new Provider(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + +private: + explicit Provider( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { assert(context.is()); } + + virtual ~Provider() {} + + virtual rtl::OUString SAL_CALL getImplementationName() override + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) override + { return cppu::supportsService(this, ServiceName); } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() override + { return static_getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) override; + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) override; + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Provider::static_getImplementationName() { + return rtl::OUString("com.sun.star.comp.test.deployment.passive_native"); +} + +css::uno::Sequence< rtl::OUString > Provider::static_getSupportedServiceNames() +{ + rtl::OUString name("com.sun.star.test.deployment.passive_native"); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +css::uno::Reference< css::frame::XDispatch > Provider::queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) +{ + css::uno::Reference< css::frame::XDispatch > dispatch; + if (!(context_->getValueByName( + "/singletons/com.sun.star.test.deployment." + "passive_native_singleton") >>= + dispatch) || + !dispatch.is()) + { + throw css::uno::DeploymentException( + "component context fails to supply singleton" + " com.sun.star.test.deployment.passive_native_singleton of type" + " com.sun.star.frame.XDispatch", + context_); + } + return dispatch; +} + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Provider::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) +{ + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s( + Requests.getLength()); + for (sal_Int32 i = 0; i < s.getLength(); ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; +} + +class Dispatch: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatch > +{ +public: + Dispatch(const Dispatch&) = delete; + const Dispatch& operator=(const Dispatch&) = delete; + + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + { return static_cast< cppu::OWeakObject * >(new Dispatch(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames() + { return css::uno::Sequence< rtl::OUString >(); } + +private: + explicit Dispatch( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { assert(context.is()); } + + virtual ~Dispatch() {} + + virtual rtl::OUString SAL_CALL getImplementationName() override + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) override + { return cppu::supportsService(this, ServiceName); } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() override + { return static_getSupportedServiceNames(); } + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) override; + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) override + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) override + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Dispatch::static_getImplementationName() { + return rtl::OUString( + "com.sun.star.comp.test.deployment.passive_native_singleton"); +} + +void Dispatch::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) +{ + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(context_); + css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->getCurrentFrame(); + css::uno::Reference< css::awt::XWindowPeer > xWindowPeer( xFrame->getComponentWindow(), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(context_); + css::uno::Reference< css::awt::XMessageBox > box( + xToolkit->createMessageBox( + xWindowPeer, + css::awt::MessageBoxType_INFOBOX, + css::awt::MessageBoxButtons::BUTTONS_OK, "passive", "native"), + css::uno::UNO_SET_THROW); + + box->execute(); + + css::uno::Reference< css::lang::XComponent > xComponent(box, css::uno::UNO_QUERY_THROW); + xComponent->dispose(); +} + +cppu::ImplementationEntry const services[] = { + { &Provider::static_create, &Provider::static_getImplementationName, + &Provider::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, nullptr, 0 }, + { &Dispatch::static_create, &Dispatch::static_getImplementationName, + &Dispatch::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, nullptr, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } +}; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void +component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/test/deployment/passive/passive_python.component b/desktop/test/deployment/passive/passive_python.component new file mode 100644 index 000000000..6007f9fcf --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.component @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/desktop/test/deployment/passive/passive_python.py b/desktop/test/deployment/passive/passive_python.py new file mode 100644 index 000000000..f16797e50 --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.py @@ -0,0 +1,93 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.awt.MessageBoxType import INFOBOX +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo + +class Provider(unohelper.Base, XServiceInfo, XDispatchProvider): + implementationName = "com.sun.star.comp.test.deployment.passive_python" + + serviceNames = ("com.sun.star.test.deployment.passive_python",) + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self.context.getValueByName( \ + "/singletons/com.sun.star.test.deployment.passive_python_singleton") + + def queryDispatches(self, Requests): + tuple( \ + self.queryDispatch(i.FeatureURL, i.FrameName, i.SearchFlags) \ + for i in Requests) + +class Dispatch(unohelper.Base, XServiceInfo, XDispatch): + implementationName = \ + "com.sun.star.comp.test.deployment.passive_python_singleton" + + serviceNames = () + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def dispatch(self, URL, Arguments): + smgr = self.context.getServiceManager() + box = smgr.createInstanceWithContext( \ + "com.sun.star.awt.Toolkit", self.context).createMessageBox( \ + smgr.createInstanceWithContext( \ + "com.sun.star.frame.Desktop", self.context). \ + getCurrentFrame().getComponentWindow(), \ + INFOBOX, BUTTONS_OK, "passive", "python") + box.execute(); + box.dispose(); + + def addStatusListener(self, Control, URL): + pass + + def removeStatusListener(self, Control, URL): + pass + +g_ImplementationHelper = unohelper.ImplementationHelper() +g_ImplementationHelper.addImplementation( \ + Provider, Provider.implementationName, Provider.serviceNames) +g_ImplementationHelper.addImplementation( \ + Dispatch, Dispatch.implementationName, Dispatch.serviceNames) -- cgit v1.2.3