From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- odk/examples/java/PropertySet/Makefile | 135 +++++++++++ odk/examples/java/PropertySet/PropTest.components | 8 + odk/examples/java/PropertySet/PropTest.java | 262 ++++++++++++++++++++++ odk/examples/java/PropertySet/PropertySet.odt | Bin 0 -> 8391 bytes 4 files changed, 405 insertions(+) create mode 100644 odk/examples/java/PropertySet/Makefile create mode 100644 odk/examples/java/PropertySet/PropTest.components create mode 100644 odk/examples/java/PropertySet/PropTest.java create mode 100644 odk/examples/java/PropertySet/PropertySet.odt (limited to 'odk/examples/java/PropertySet') diff --git a/odk/examples/java/PropertySet/Makefile b/odk/examples/java/PropertySet/Makefile new file mode 100644 index 000000000..2ab04e13e --- /dev/null +++ b/odk/examples/java/PropertySet/Makefile @@ -0,0 +1,135 @@ +#************************************************************************* +# +# The Contents of this file are made available subject to the terms of +# the BSD license. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of Sun Microsystems, Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#************************************************************************** + +# Builds the Java PropertySet component example of the SDK. + +PRJ=../../.. +SETTINGS=$(PRJ)/settings + +include $(SETTINGS)/settings.mk +include $(SETTINGS)/std.mk + +# Define non-platform/compiler specific settings +COMP_NAME=PropTest +COMP_CLASS_OUT=$(OUT_CLASS)/$(COMP_NAME) +COMP_GEN_OUT=$(OUT_MISC)/$(COMP_NAME) +COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME=$(COMP_NAME).uno.jar +COMP_JAR=$(COMP_CLASS_OUT)/$(COMP_JAR_NAME) +COMP_JAR_MANIFEST=$(COMP_CLASS_OUT)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml +COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components + +COMP_JAVAFILES = PropTest.java + +COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES)) + +$(COMP_NAME)_CLASSFILES = $(COMP_NAME).class + +SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ + $(PATH_SEPARATOR)$(COMP_CLASS_OUT)) + + +# Targets +.PHONY: ALL +ALL : JavaPropertySetExample + +include $(SETTINGS)/stdtarget.mk + +$(COMP_CLASS_OUT)/%.Manifest : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo RegistrationClassName: $(basename $(basename $(@F)))> $@ + +$(COMP_CLASSFILES) : $(COMP_JAVAFILES) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $(COMP_JAVAFILES) + +# rule for component jar file +$(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $( $@ + @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@ + @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ + @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ + +# rule for component package file +$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_ZIP) $@ $(COMP_NAME).components + cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $( $(subst /,$(PS),$@) +else + @echo -------------------------------------------------------------------------------- + @echo If you want to install your component automatically, please set the environment + @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only + @echo possible if no office instance is running. + @echo -------------------------------------------------------------------------------- +endif + +JavaPropertySetExample : $(COMP_REGISTERFLAG) + @echo -------------------------------------------------------------------------------- + @echo The PropTest was installed if SDK_AUTO_DEPLOYMENT = YES. + @echo Load the "$(QM)PropertySet.odt$(QM)" document to see how this component works. You can + @echo use this component inside your office installation, see the example description. + @echo - + @echo $(MAKE) PropertySet.odt.load + @echo -------------------------------------------------------------------------------- + +PropertySet.odt.load : $(COMP_REGISTERFLAG) + "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) + +.PHONY: clean +clean : + -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_CLASS_OUT)) + -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_GEN_OUT)) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) diff --git a/odk/examples/java/PropertySet/PropTest.components b/odk/examples/java/PropertySet/PropTest.components new file mode 100644 index 000000000..320e3511c --- /dev/null +++ b/odk/examples/java/PropertySet/PropTest.components @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/odk/examples/java/PropertySet/PropTest.java b/odk/examples/java/PropertySet/PropTest.java new file mode 100644 index 000000000..c77a905e8 --- /dev/null +++ b/odk/examples/java/PropertySet/PropTest.java @@ -0,0 +1,262 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +/* +This example shows a UNO component that inherits com.sun.star.lib.uno.helper.PropertySet in +order to provide implementations of these interfaces: + + com.sun.star.beans.XPropertySet + com.sun.star.beans.XMultiPropertySet + com.sun.star.beans.XFastPropertySet + com.sun.star.lang.XComponent + com.sun.star.uno.XWeak + com.sun.star.lang.XTypeProvider +*/ +import com.sun.star.lib.uno.helper.PropertySet; +import com.sun.star.comp.loader.FactoryHelper; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.uno.Any; +import com.sun.star.uno.Type; +import com.sun.star.uno.XInterface; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.beans.PropertyAttribute; + +/** + This component contains the following properties: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * +
Property Name Type Name PropertyAttribute
boolABOOLEAN - + *
charACHAR -
byteABYTE -
shortASHORT -
intALONG -
longAHYPER -
floatAFLOAT -
doubleADOUBLE -
stringASTRING -
objectAANY -
anyAANY -
typeATYPE -
xinterfaceAINTERFACE -
xtypeproviderAINTERFACE -
arBoolA[]boolean -
arCharA[]char -
arByteA[]byte -
arShortA[]short -
arIntA[]long -
arLongA[]hyper -
arFloatA[]float -
arDoubleA[]double -
arStringA[]string -
arObjectA[]any -
arXinterfaceA[]com.sun.star.uno.XInterface -
ar2BoolA[][]boolean -
boolClassAboolean -
charClassAchar -
byteClassAbyte -
shortClassAshort -
intClassAlong -
longClassAhyper -
floatClassAfloat -
doubleClassAdouble -
roIntAlongREADONLY
roIntClassAlongREADONLY
roObjectAanyREADONLY
roAnyAanyREADONLY
bcBoolAbooleanBOUND,CONSTRAINED
bcBoolClassAbooleanBOUND,CONSTRAINED
bcObjectAanyBOUND,CONSTRAINED
bcAnyAanyBOUND,CONSTRAINED
mvIntAlongMAYBEVOID
mvObjectAanyMAYBEVOID
mvAnyAanyMAYBEVOID
mvXinterfaceAanyMAYBEVOID
+*/ + +public class PropTest extends PropertySet implements XServiceInfo +{ + + public boolean boolA; + public char charA; + public byte byteA; + public short shortA; + public int intA; + public long longA; + public float floatA; + public double doubleA; + public String stringA; // MAYBEVOID + public Object objectA; // MAYBEVOID + public Any anyA; // MAYBEVOID + public Type typeA;// MAYBEVOID + public XInterface xinterfaceA;// MAYBEVOID + public XTypeProvider xtypeproviderA;// MAYBEVOID + public boolean[] arBoolA; // MAYBEVOID + public char[] arCharA; // MAYBEVOID + public byte[] arByteA; // MAYBEVOID + public short[] arShortA; // MAYBEVOID + public int[] arIntA; // MAYBEVOID + public long[] arLongA; // MAYBEVOID + public float[] arFloatA; // MAYBEVOID + public double[] arDoubleA; // MAYBEVOID + public String[] arStringA; // MAYBEVOID + public Object[] arObjectA; // MAYBEVOID + public Any[] arAnyA; // MAYBEVOID + public XInterface[] arXinterfaceA; // MAYBEVOID + public boolean[][] ar2BoolA; // MAYBEVOID + public Boolean boolClassA; // MAYBEVOID + public Character charClassA; // MAYBEVOID + public Byte byteClassA; // MAYBEVOID + public Short shortClassA; // MAYBEVOID + public Integer intClassA; // MAYBEVOID + public Long longClassA; // MAYBEVOID + public Float floatClassA; // MAYBEVOID + public Double doubleClassA; // MAYBEVOID + + // readonly + public int roIntA= 100; + public Integer roIntClassA= Integer.valueOf(100); + public Object roObjectA= Integer.valueOf(101); + public Any roAnyA= new Any( new Type(int.class), Integer.valueOf(102)); + + // BOUND & CONSTRAINED + public boolean bcBoolA; + public Boolean bcBoolClassA; // MAYBEVOID + public Object bcObjectA; // MAYBEVOID + public Any bcAnyA; // MAYBEVOID + + // MAYBEVOID + public Integer mvIntA; + public Object mvObjectA; + public Any mvAnyA; + public XInterface mvXinterfaceA; + + public static final String __serviceName="PropTest"; + + public PropTest() { + registerProperty("boolA", (short) 0); + registerProperty("charA", (short) 0); + registerProperty("byteA", (short) 0); + registerProperty("shortA", (short) 0); + registerProperty("intA", (short) 0); + registerProperty("longA", (short) 0); + registerProperty("floatA", (short) 0); + registerProperty("doubleA", (short) 0); + registerProperty("stringA", PropertyAttribute.MAYBEVOID); + registerProperty("objectA", PropertyAttribute.MAYBEVOID); + registerProperty("anyA", PropertyAttribute.MAYBEVOID); + registerProperty("typeA", PropertyAttribute.MAYBEVOID); + registerProperty("xinterfaceA", PropertyAttribute.MAYBEVOID); + registerProperty("xtypeproviderA", PropertyAttribute.MAYBEVOID); + registerProperty("arBoolA", PropertyAttribute.MAYBEVOID); + registerProperty("arCharA", PropertyAttribute.MAYBEVOID); + registerProperty("arByteA", PropertyAttribute.MAYBEVOID); + registerProperty("arShortA", PropertyAttribute.MAYBEVOID); + registerProperty("arIntA", PropertyAttribute.MAYBEVOID); + registerProperty("arLongA", PropertyAttribute.MAYBEVOID); + registerProperty("arFloatA", PropertyAttribute.MAYBEVOID); + registerProperty("arDoubleA", PropertyAttribute.MAYBEVOID); + registerProperty("arStringA", PropertyAttribute.MAYBEVOID); + registerProperty("arObjectA", PropertyAttribute.MAYBEVOID); + registerProperty("arAnyA", PropertyAttribute.MAYBEVOID); + registerProperty("arXinterfaceA", PropertyAttribute.MAYBEVOID); + registerProperty("ar2BoolA", PropertyAttribute.MAYBEVOID); + registerProperty("boolClassA", PropertyAttribute.MAYBEVOID); + registerProperty("charClassA", PropertyAttribute.MAYBEVOID); + registerProperty("byteClassA", PropertyAttribute.MAYBEVOID); + registerProperty("shortClassA", PropertyAttribute.MAYBEVOID); + registerProperty("intClassA", PropertyAttribute.MAYBEVOID); + registerProperty("longClassA", PropertyAttribute.MAYBEVOID); + registerProperty("floatClassA", PropertyAttribute.MAYBEVOID); + registerProperty("doubleClassA", PropertyAttribute.MAYBEVOID); + registerProperty("roIntA", PropertyAttribute.READONLY); + registerProperty("roIntClassA", PropertyAttribute.READONLY); + registerProperty("roObjectA", PropertyAttribute.READONLY); + registerProperty("roAnyA", PropertyAttribute.READONLY); + registerProperty("bcBoolA",(short) ( PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED)); + registerProperty("bcBoolClassA", (short) (PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED | PropertyAttribute.MAYBEVOID)); + registerProperty("bcObjectA", (short) (PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED | PropertyAttribute.MAYBEVOID)); + registerProperty("bcAnyA", (short) (PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED |PropertyAttribute.MAYBEVOID)); + registerProperty("mvIntA", PropertyAttribute.MAYBEVOID); + registerProperty("mvObjectA", PropertyAttribute.MAYBEVOID); + registerProperty("mvAnyA", PropertyAttribute.MAYBEVOID); + registerProperty("mvXinterfaceA", PropertyAttribute.MAYBEVOID); + } + + + // XServiceName + public String getImplementationName( ) + { + return getClass().getName(); + } + + // XServiceName + public boolean supportsService( /*IN*/String name ) + { + if (name.equals(__serviceName)) + return true; + return false; + } + + //XServiceName + public String[] getSupportedServiceNames( ) + { + String[] retValue= new String[]{__serviceName}; + return retValue; + } + + public static XSingleServiceFactory __getServiceFactory(String implName, + XMultiServiceFactory multiFactory, + XRegistryKey regKey) + { + XSingleServiceFactory xSingleServiceFactory = null; + + if (implName.equals( PropTest.class.getName()) ) + xSingleServiceFactory = FactoryHelper.getServiceFactory( PropTest.class, + PropTest.__serviceName, + multiFactory, + regKey); + + return xSingleServiceFactory; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/odk/examples/java/PropertySet/PropertySet.odt b/odk/examples/java/PropertySet/PropertySet.odt new file mode 100644 index 000000000..31d326e41 Binary files /dev/null and b/odk/examples/java/PropertySet/PropertySet.odt differ -- cgit v1.2.3