diff options
author | sb <sb@openoffice.org> | 2010-10-06 17:43:02 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-10-06 17:43:02 +0200 |
commit | 6ececd40c1473033bcdb4071eb5542c4346181ea (patch) | |
tree | 20454ccdbdb80916f4143f97f254c29a87ecf9b8 /desktop/test | |
parent | sb131: merged in DEV300_m89 (diff) | |
download | core-6ececd40c1473033bcdb4071eb5542c4346181ea.tar.gz core-6ececd40c1473033bcdb4071eb5542c4346181ea.zip |
sb131: #i114962# first step of passive extension component registration (no live deployment yet)
Diffstat (limited to 'desktop/test')
-rw-r--r-- | desktop/test/deployment/boxt/boxt.cxx | 11 | ||||
-rw-r--r-- | desktop/test/deployment/boxt/makefile.mk | 2 | ||||
-rw-r--r-- | desktop/test/deployment/passive/Addons.xcu | 67 | ||||
-rw-r--r-- | desktop/test/deployment/passive/ProtocolHandler.xcu | 48 | ||||
-rw-r--r-- | desktop/test/deployment/passive/Service.java | 130 | ||||
-rw-r--r-- | desktop/test/deployment/passive/description.xml | 37 | ||||
-rw-r--r-- | desktop/test/deployment/passive/makefile.mk | 119 | ||||
-rw-r--r-- | desktop/test/deployment/passive/manifest.mf | 3 | ||||
-rw-r--r-- | desktop/test/deployment/passive/manifest.xml | 40 | ||||
-rw-r--r-- | desktop/test/deployment/passive/passive_java.component | 34 | ||||
-rw-r--r-- | desktop/test/deployment/passive/passive_native.component | 34 | ||||
-rw-r--r-- | desktop/test/deployment/passive/passive_native.cxx | 253 | ||||
-rw-r--r-- | desktop/test/deployment/passive/passive_python.component | 34 | ||||
-rw-r--r-- | desktop/test/deployment/passive/passive_python.py | 74 |
14 files changed, 874 insertions, 12 deletions
diff --git a/desktop/test/deployment/boxt/boxt.cxx b/desktop/test/deployment/boxt/boxt.cxx index dc82c0c004d6..51c223dedcd4 100644 --- a/desktop/test/deployment/boxt/boxt.cxx +++ b/desktop/test/deployment/boxt/boxt.cxx @@ -187,17 +187,6 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL dummy( return css::uno::Reference< css::uno::XInterface >(); } -rtl::OUString SAL_CALL getImplementationName() { - return rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.test.deployment.boxt")); -} - -css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() { - rtl::OUString name( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.test.deployment.boxt")); - return css::uno::Sequence< rtl::OUString >(&name, 1); -} - css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL createFactory( cppu::ComponentFactoryFunc, rtl::OUString const &, diff --git a/desktop/test/deployment/boxt/makefile.mk b/desktop/test/deployment/boxt/makefile.mk index 11d736448d44..88e72aef4ab8 100644 --- a/desktop/test/deployment/boxt/makefile.mk +++ b/desktop/test/deployment/boxt/makefile.mk @@ -46,7 +46,7 @@ SHL1OBJS = $(SLO)/boxt.obj SHL1RPATH = BOXT SHL1STDLIBS = \ $(CPPUHELPERLIB) $(CPPULIB) $(MSFILTERLIB) $(SALLIB) $(TOOLSLIB) $(VCLLIB) -SHL1VERSIONMAP = $(SOLARENV)/src/component.map +SHL1VERSIONMAP = $(SOLARENV)/src/reg-component.map DEF1NAME = $(SHL1TARGET) .INCLUDE: target.mk diff --git a/desktop/test/deployment/passive/Addons.xcu b/desktop/test/deployment/passive/Addons.xcu new file mode 100644 index 000000000000..61578d7426e9 --- /dev/null +++ b/desktop/test/deployment/passive/Addons.xcu @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="Addons"> + <node o:name="AddonUI"> + <node o:name="OfficeMenuBar"> + <node o:name="org.openoffice.test.desktop.deployment.passive" + o:op="replace"> + <prop o:name="Title" xml:lang="en-US"> + <value>passive</value> + </prop> + <node o:name="Submenu"> + <node o:name="1" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_native:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>native</value> + </prop> + </node> + <node o:name="2" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_java:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>java</value> + </prop> + </node> + <node o:name="3" o:op="replace"> + <prop o:name="URL"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_python:</value> + </prop> + <prop o:name="Title" xml:lang="en-US"> + <value>python</value> + </prop> + </node> + </node> + </node> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/passive/ProtocolHandler.xcu b/desktop/test/deployment/passive/ProtocolHandler.xcu new file mode 100644 index 000000000000..bc0355be41df --- /dev/null +++ b/desktop/test/deployment/passive/ProtocolHandler.xcu @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<o:component-data xmlns:o="http://openoffice.org/2001/registry" + o:package="org.openoffice.Office" o:name="ProtocolHandler"> + <node o:name="HandlerSet"> + <node o:name="com.sun.star.test.deployment.passive_native" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_native:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.passive_java" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_java:*</value> + </prop> + </node> + <node o:name="com.sun.star.test.deployment.passive_python" o:op="replace"> + <prop o:name="Protocols"> + <value>vnd.org.openoffice.test.desktop.deployment.passive_python:*</value> + </prop> + </node> + </node> +</o:component-data> diff --git a/desktop/test/deployment/passive/Service.java b/desktop/test/deployment/passive/Service.java new file mode 100644 index 000000000000..d4f2d52f1da0 --- /dev/null +++ b/desktop/test/deployment/passive/Service.java @@ -0,0 +1,130 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +package com.sun.star.comp.test.deployment.passive_java; + +import com.sun.star.awt.MessageBoxButtons; +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.XDispatchProvider; +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.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +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 Service extends WeakBase + implements XServiceInfo, XDispatchProvider, XDispatch +{ + public Service(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 this; + } + + 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; + } + + 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())), + new Rectangle(), "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( + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + return implementation.equals(implementationName) + ? Factory.createComponentFactory(Service.class, serviceNames) + : null; + } + + private final XComponentContext context; + + private static final String implementationName = + "com.sun.star.comp.test.deployment.passive_java"; + + private static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.passive_java" }; +} diff --git a/desktop/test/deployment/passive/description.xml b/desktop/test/deployment/passive/description.xml new file mode 100644 index 000000000000..26972733fa15 --- /dev/null +++ b/desktop/test/deployment/passive/description.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<d:description xmlns:d="http://openoffice.org/extensions/description/2006"> + <d:identifier + value="org.openoffice/framework/desktop/test/deployment/passive"/> + <d:version value="1"/> + <d:platform value="@PLATFORM@"/> + <d:dependencies> + <d:OpenOffice.org-minimal-version d:name="OpenOffice.org 3.4" value="3.4"/> + </d:dependencies> +</d:description> diff --git a/desktop/test/deployment/passive/makefile.mk b/desktop/test/deployment/passive/makefile.mk new file mode 100644 index 000000000000..deadd782dd60 --- /dev/null +++ b/desktop/test/deployment/passive/makefile.mk @@ -0,0 +1,119 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = ../../.. +PRJNAME = desktop +TARGET = test_deployment_passive + +ENABLE_EXCEPTIONS = TRUE + +PACKAGE = com/sun/star/comp/test/deployment/passive_java +JAVAFILES = Service.java +JARFILES = juh.jar ridl.jar unoil.jar + +my_components = passive_native passive_java passive_python + +.INCLUDE: settings.mk + +DLLPRE = + +SLOFILES = $(SHL1OBJS) + +SHL1TARGET = passive_native.uno +SHL1OBJS = $(SLO)/passive_native.obj +SHL1RPATH = OXT +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) +SHL1VERSIONMAP = $(SOLARENV)/src/component.map +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk + +ALLTAR : $(MISC)/passive.oxt + +$(MISC)/passive.oxt : manifest.xml description.xml Addons.xcu \ + ProtocolHandler.xcu $(MISC)/$(TARGET)/uno.components $(SHL1TARGETN) \ + $(MISC)/$(TARGET)/passive_java.jar passive_python.py + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/passive.oxt-zip + $(MKDIR) $(MISC)/$(TARGET)/passive.oxt-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/passive.oxt-zip/META-INF + $(COPY) manifest.xml $(MISC)/$(TARGET)/passive.oxt-zip/META-INF/ + $(SED) -e 's|@PLATFORM@|$(RTL_OS:l)_$(RTL_ARCH:l)|g' < description.xml \ + > $(MISC)/$(TARGET)/passive.oxt-zip/description.xml + $(COPY) Addons.xcu ProtocolHandler.xcu $(MISC)/$(TARGET)/uno.components \ + $(SHL1TARGETN) $(MISC)/$(TARGET)/passive_java.jar passive_python.py \ + $(MISC)/$(TARGET)/passive.oxt-zip/ + cd $(MISC)/$(TARGET)/passive.oxt-zip && zip ../../passive.oxt \ + META-INF/manifest.xml description.xml Addons.xcu ProtocolHandler.xcu \ + uno.components $(SHL1TARGETN:f) passive_java.jar passive_python.py + +$(MISC)/$(TARGET)/uno.components : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/uno.components.input \ + $(my_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/uno.components.input + +$(MISC)/$(TARGET)/uno.components.input : + $(MKDIRHIER) $(@:d) + echo \ + '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \ + > $@ + +$(MISC)/$(TARGET)/passive_native.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_native.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_native.component + +$(MISC)/$(TARGET)/passive_java.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_java.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)passive_java.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_java.component + +$(MISC)/$(TARGET)/passive_python.component : \ + $(SOLARENV)/bin/createcomponent.xslt passive_python.component + $(MKDIRHIER) $(@:d) + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_EXTENSION)passive_python.py' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt passive_python.component + +$(MISC)/$(TARGET)/passive_java.jar : manifest.mf $(JAVATARGET) + $(MKDIRHIER) $(@:d) + $(RM) $@ + $(RM) -r $(MISC)/$(TARGET)/passive_java.jar-zip + $(MKDIR) $(MISC)/$(TARGET)/passive_java.jar-zip + $(MKDIRHIER) $(MISC)/$(TARGET)/passive_java.jar-zip/META-INF \ + $(MISC)/$(TARGET)/passive_java.jar-zip/$(PACKAGE) + $(COPY) manifest.mf $(MISC)/$(TARGET)/passive_java.jar-zip/META-INF/ + $(COPY) $(foreach,i,$(JAVAFILES:b) $(CLASSDIR)/$(PACKAGE)/$i.class) \ + $(MISC)/$(TARGET)/passive_java.jar-zip/$(PACKAGE)/ + cd $(MISC)/$(TARGET)/passive_java.jar-zip && zip ../passive_java.jar \ + META-INF/manifest.mf $(foreach,i,$(JAVAFILES:b) $(PACKAGE)/$i.class) diff --git a/desktop/test/deployment/passive/manifest.mf b/desktop/test/deployment/passive/manifest.mf new file mode 100644 index 000000000000..5ad70357a1d2 --- /dev/null +++ b/desktop/test/deployment/passive/manifest.mf @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.passive_java.Service +UNO-Type-Path: diff --git a/desktop/test/deployment/passive/manifest.xml b/desktop/test/deployment/passive/manifest.xml new file mode 100644 index 000000000000..eb7588e15511 --- /dev/null +++ b/desktop/test/deployment/passive/manifest.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<m:manifest xmlns:m="http://openoffice.org/2001/manifest"> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="Addons.xcu"/> + <m:file-entry m:media-type="application/vnd.sun.star.configuration-data" + m:full-path="ProtocolHandler.xcu"/> + <m:file-entry + m:media-type="application/vnd.sun.star.uno-components" + m:full-path="uno.components"/> +<!-- <m:file-entry + m:media-type="application/vnd.sun.star.uno-component;type=Python" + m:full-path="passive_python.py"/> --> +</m:manifest> diff --git a/desktop/test/deployment/passive/passive_java.component b/desktop/test/deployment/passive/passive_java.component new file mode 100644 index 000000000000..dfc55a5b8c36 --- /dev/null +++ b/desktop/test/deployment/passive/passive_java.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_java"> + <service name="com.sun.star.test.deployment.passive_java"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_native.component b/desktop/test/deployment/passive/passive_native.component new file mode 100644 index 000000000000..7b0c314628a6 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_native"> + <service name="com.sun.star.test.deployment.passive_native"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx new file mode 100644 index 000000000000..3c29174ffcb0 --- /dev/null +++ b/desktop/test/deployment/passive/passive_native.cxx @@ -0,0 +1,253 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_desktop.hxx" +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/awt/MessageBoxButtons.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/XMessageBox.hpp" +#include "com/sun/star/awt/XMessageBoxFactory.hpp" +#include "com/sun/star/awt/XWindowPeer.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/frame/DispatchDescriptor.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatch.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/frame/XStatusListener.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XSingleComponentFactory.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/util/URL.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase3.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/diagnose.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +namespace { + +namespace css = com::sun::star; + +namespace service { + +rtl::OUString getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.test.deployment.passive_native")); +} + +css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.test.deployment.passive_native")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +} + +class Service: + public cppu::WeakImplHelper3< + css::lang::XServiceInfo, css::frame::XDispatchProvider, + css::frame::XDispatch >, + private boost::noncopyable +{ +public: + Service(css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { OSL_ASSERT(context.is()); } + +private: + virtual ~Service() {} + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return service::getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return service::getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) + throw (css::uno::RuntimeException) + { return this; } + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) + throw (css::uno::RuntimeException) + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Service::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) + throw (css::uno::RuntimeException) +{ + 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; +} + +void Service::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) + throw (css::uno::RuntimeException) +{ + css::uno::Reference< css::lang::XMultiComponentFactory > smgr( + context_->getServiceManager(), css::uno::UNO_SET_THROW); + css::uno::Reference< css::awt::XMessageBox > box( + css::uno::Reference< css::awt::XMessageBoxFactory >( + smgr->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.awt.Toolkit")), context_), + css::uno::UNO_QUERY_THROW)->createMessageBox( + css::uno::Reference< css::awt::XWindowPeer >( + css::uno::Reference< css::frame::XFrame >( + css::uno::Reference< css::frame::XDesktop >( + smgr->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop")), + context_), + css::uno::UNO_QUERY_THROW)->getCurrentFrame(), + css::uno::UNO_SET_THROW)->getComponentWindow(), + css::uno::UNO_QUERY_THROW), + css::awt::Rectangle(), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("infobox")), + css::awt::MessageBoxButtons::BUTTONS_OK, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("passive")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("native"))), + css::uno::UNO_SET_THROW); + box->execute(); + css::uno::Reference< css::lang::XComponent >( + box, css::uno::UNO_QUERY_THROW)->dispose(); +} + +class Factory: + public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, + private boost::noncopyable +{ +public: + Factory() {} + +private: + virtual ~Factory() {} + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL + createInstanceWithContext( + css::uno::Reference< css::uno::XComponentContext > const & Context) + throw (css::uno::Exception, css::uno::RuntimeException) + { return static_cast< cppu::OWeakObject * >(new Service(Context)); } + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL + createInstanceWithArgumentsAndContext( + css::uno::Sequence< css::uno::Any > const &, + css::uno::Reference< css::uno::XComponentContext > const & Context) + throw (css::uno::Exception, css::uno::RuntimeException) + { return createInstanceWithContext(Context); } +}; + +css::uno::Reference< css::uno::XInterface > SAL_CALL dummy( + css::uno::Reference< css::uno::XComponentContext > const &) + SAL_THROW((css::uno::Exception)) +{ + OSL_ASSERT(false); + return css::uno::Reference< css::uno::XInterface >(); +} + +css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL +createFactory( + cppu::ComponentFactoryFunc, rtl::OUString const &, + css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) + SAL_THROW(()) +{ + return new Factory; +} + +static cppu::ImplementationEntry const services[] = { + { &dummy, &service::getImplementationName, + &service::getSupportedServiceNames, &createFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" void SAL_CALL component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} diff --git a/desktop/test/deployment/passive/passive_python.component b/desktop/test/deployment/passive/passive_python.component new file mode 100644 index 000000000000..3a0bea4b5296 --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Python" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.test.deployment.passive_python"> + <service name="com.sun.star.test.deployment.passive_python"/> + </implementation> +</component> diff --git a/desktop/test/deployment/passive/passive_python.py b/desktop/test/deployment/passive/passive_python.py new file mode 100644 index 000000000000..183cbdc899c3 --- /dev/null +++ b/desktop/test/deployment/passive/passive_python.py @@ -0,0 +1,74 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo + +implementationName = "com.sun.star.comp.test.deployment.passive_python" +serviceNames = ("com.sun.star.test.deployment.passive_python",) + +class Service(unohelper.Base, XServiceInfo, XDispatchProvider, XDispatch): + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return implementationName + + def supportsService(self, ServiceName): + return ServiceName in serviceNames + + def getSupportedServiceNames(self): + return serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self + + 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(), \ + Rectangle(), "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( \ + Service, implementationName, serviceNames,) |