summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/Components
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Components')
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu81
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java426
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Jobs.xcu27
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile136
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Addons.xcu220
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile148
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/ProtocolHandler.xcu11
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx250
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx125
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx131
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Addons.xcu220
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile138
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandler.xcu10
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java283
-rw-r--r--odk/examples/DevelopersGuide/Components/CppComponent/Makefile220
-rw-r--r--odk/examples/DevelopersGuide/Components/CppComponent/SimpleComponent.odtbin0 -> 8841 bytes
-rw-r--r--odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx89
-rw-r--r--odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx309
-rw-r--r--odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx225
-rw-r--r--odk/examples/DevelopersGuide/Components/CppComponent/some.idl54
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/Makefile204
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl46
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl46
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java71
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java100
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java143
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java71
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl48
-rw-r--r--odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl48
-rw-r--r--odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl50
-rw-r--r--odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java171
-rw-r--r--odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile170
-rw-r--r--odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml12
-rw-r--r--odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_de.txt1
-rw-r--r--odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_en_US.txt1
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/Makefile81
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java158
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile128
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java79
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl46
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile73
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl53
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl50
-rw-r--r--odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk27
-rw-r--r--odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java324
-rw-r--r--odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.odtbin0 -> 11902 bytes
-rw-r--r--odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile177
-rw-r--r--odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl47
-rw-r--r--odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl53
-rw-r--r--odk/examples/DevelopersGuide/Components/makefile.mk123
50 files changed, 5704 insertions, 0 deletions
diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu
new file mode 100644
index 000000000000..d3d8d7411ed2
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu
@@ -0,0 +1,81 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
+ <node oor:name="AddonUI">
+
+ <node oor:name="AddonMenu">
+
+ <node oor:name="myAsyncJobAlias" oor:op="replace">
+
+ <prop oor:name="URL" oor:type="xs:string">
+
+ <value>vnd.sun.star.job:alias=AsyncJob</value>
+
+ </prop>
+
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value>private:image/3216</value>
+
+ </prop>
+
+ <prop oor:name="Title" oor:type="xs:string">
+ <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. -->
+ <value xml:lang="x-no-translate"></value>
+ <value xml:lang="en-US">AsyncJob (ALIAS)...</value>
+ <value xml:lang="de">AsyncJob (ALIAS) ...</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+
+ <node oor:name="myAsyncJobEvent" oor:op="replace">
+
+ <prop oor:name="URL" oor:type="xs:string">
+
+ <value>vnd.sun.star.job:event=onMyOwnJobEvent</value>
+
+ </prop>
+
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value>private:image/3216</value>
+
+ </prop>
+
+ <prop oor:name="Title" oor:type="xs:string">
+ <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. -->
+ <value xml:lang="x-no-translate"></value>
+ <value xml:lang="en-US">AsyncJob (EVENT)...</value>
+ <value xml:lang="de">AsyncJob (EVENT) ...</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+
+ <node oor:name="myAsyncJobService" oor:op="replace">
+
+ <prop oor:name="URL" oor:type="xs:string">
+
+ <value>vnd.sun.star.job:service=com.sun.star.comp.framework.java.services.AsyncJob</value>
+
+ </prop>
+
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value>private:image/3216</value>
+
+ </prop>
+
+ <prop oor:name="Title" oor:type="xs:string">
+ <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. -->
+ <value xml:lang="x-no-translate"></value>
+ <value xml:lang="en-US">AsyncJob (SERVICE)...</value>
+ <value xml:lang="de">AsyncJob (SERVICE) ...</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
+
diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java
new file mode 100644
index 000000000000..14c2659e48a7
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java
@@ -0,0 +1,426 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+//_______________________________________________
+// imports
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.awt.*;
+import com.sun.star.beans.*;
+import com.sun.star.task.*;
+import com.sun.star.uno.*;
+import java.lang.*;
+import javax.swing.*;
+
+//_______________________________________________
+// implementation
+
+/** it implements a simple job component.
+ *
+ * Such jobs are executable in different ways:
+ * <ul>
+ * <li>registered for a special URL schema "vnd.sun.star.jobs:*" and used from the generic dispatch framework</li>
+ * <li>the global com.sun.star.task.JobExecutor service and registered for special events.</li>
+ * </ul>
+ */
+public class AsyncJob extends WeakBase implements XServiceInfo, XAsyncJob
+{
+ //___________________________________________
+ // const
+ public final XComponentContext m_xCmpCtx;
+
+ /** the const list of supported uno service names. */
+ public static final java.lang.String[] SERVICENAMES = {"com.sun.star.task.AsyncJob"};
+
+ /** the const uno implementation name.
+ * It must be an unique value! The best naming schema seams to use
+ * a registered domain in reverse order ...
+ */
+ public static final java.lang.String IMPLEMENTATIONNAME = "com.sun.star.comp.framework.java.services.AsyncJob";
+
+ //___________________________________________
+ // interface
+
+ /** initialize a new instance of this class with default values. */
+ public AsyncJob( XComponentContext xCompContext )
+ {
+ m_xCmpCtx = xCompContext;
+ }
+
+ //___________________________________________
+
+ /** starts execution of this job.
+ *
+ * @param lArgs
+ * list which contains:
+ * <ul>
+ * <li>generic job configuration data</li>
+ * <li>job specific configuration data</li>
+ * <li>some environment informations</li>
+ * <li>may optional arguments of a corresponding dispatch request</li>
+ * </ul>
+ *
+ * @params xListener
+ * callback to the executor of this job, which control our life time
+ *
+ * @throws com.sun.star.lang.IllegalArgumentException
+ * if given argument list seams to be wrong
+ */
+ public synchronized void executeAsync(com.sun.star.beans.NamedValue[] lArgs ,
+ com.sun.star.task.XJobListener xListener)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ // For asynchronous jobs a valid listener reference is guranteed normaly ...
+ if (xListener == null)
+ throw new com.sun.star.lang.IllegalArgumentException("invalid listener");
+
+ // extract all possible sub list of given argument list
+ com.sun.star.beans.NamedValue[] lGenericConfig = null;
+ com.sun.star.beans.NamedValue[] lJobConfig = null;
+ com.sun.star.beans.NamedValue[] lEnvironment = null;
+ com.sun.star.beans.NamedValue[] lDynamicData = null;
+
+ int c = lArgs.length;
+ for (int i=0; i<c; ++i)
+ {
+ if (lArgs[i].Name.equals("Config"))
+ lGenericConfig = (com.sun.star.beans.NamedValue[])com.sun.star.uno.AnyConverter.toArray(lArgs[i].Value);
+ else
+ if (lArgs[i].Name.equals("JobConfig"))
+ lJobConfig = (com.sun.star.beans.NamedValue[])com.sun.star.uno.AnyConverter.toArray(lArgs[i].Value);
+ else
+ if (lArgs[i].Name.equals("Environment"))
+ lEnvironment = (com.sun.star.beans.NamedValue[])com.sun.star.uno.AnyConverter.toArray(lArgs[i].Value);
+ else
+ if (lArgs[i].Name.equals("DynamicData"))
+ lDynamicData = (com.sun.star.beans.NamedValue[])com.sun.star.uno.AnyConverter.toArray(lArgs[i].Value);
+ }
+
+ // Analyze the environment info. This sub list is the only guarenteed one!
+ if (lEnvironment == null)
+ throw new com.sun.star.lang.IllegalArgumentException("no environment");
+
+ java.lang.String sEnvType = null;
+ java.lang.String sEventName = null;
+ com.sun.star.frame.XFrame xFrame = null;
+ c = lEnvironment.length;
+ for (int i=0; i<c; ++i)
+ {
+ if (lEnvironment[i].Name.equals("EnvType"))
+ sEnvType = com.sun.star.uno.AnyConverter.toString(lEnvironment[i].Value);
+ else
+ if (lEnvironment[i].Name.equals("EventName"))
+ sEventName = com.sun.star.uno.AnyConverter.toString(lEnvironment[i].Value);
+ else
+ if (lEnvironment[i].Name.equals("Frame"))
+ xFrame = (com.sun.star.frame.XFrame)com.sun.star.uno.AnyConverter.toObject(
+ new com.sun.star.uno.Type(com.sun.star.frame.XFrame.class),
+ lEnvironment[i].Value);
+ }
+
+ // Further the environment property "EnvType" is required as minimum.
+ if (
+ (sEnvType==null) ||
+ (
+ (!sEnvType.equals("EXECUTOR")) &&
+ (!sEnvType.equals("DISPATCH"))
+ )
+ )
+ {
+ java.lang.String sMessage = "\"" + sEnvType + "\" isn't a valid value for EnvType";
+ throw new com.sun.star.lang.IllegalArgumentException(sMessage);
+ }
+
+ // Analyze the set of shared config data.
+ java.lang.String sAlias = null;
+ if (lGenericConfig!=null)
+ {
+ c = lGenericConfig.length;
+ for (int i=0; i<c; ++i)
+ {
+ if (lGenericConfig[i].Name.equals("Alias"))
+ sAlias = com.sun.star.uno.AnyConverter.toString(lGenericConfig[i].Value);
+ }
+ }
+
+ // do your job ...
+ // Here we print out all found arguments.
+ java.lang.String sOut = formatOutArgs(lGenericConfig, lJobConfig, lEnvironment, lDynamicData);
+ if (xFrame != null)
+ showInfoModal(xFrame.getContainerWindow(), "Arguments of AsyncJob initialization ...", sOut);
+ else
+ showInfoNonModal("Arguments of AsyncJob initialization ...", sOut);
+
+ // use return value to start different actions
+ // But look for the right environment. Some options make no sense inside the wrong env.
+ com.sun.star.beans.NamedValue aDeactivation = null;
+ com.sun.star.beans.NamedValue aDispatchResult = null;
+ com.sun.star.beans.NamedValue aSaveRequest = null;
+
+ // SaveArguments will be made everytimes!
+ c = 1;
+
+ if (lJobConfig==null)
+ lJobConfig = new com.sun.star.beans.NamedValue[1];
+ lJobConfig[0] = new com.sun.star.beans.NamedValue();
+ lJobConfig[0].Name = "arg_1";
+ lJobConfig[0].Value = "val_1";
+
+ aSaveRequest = new com.sun.star.beans.NamedValue();
+ aSaveRequest.Name = "SaveArguments";
+ aSaveRequest.Value = lJobConfig;
+
+ // Deactivation is usefull inside EXECUTOR environment only
+ if (sEnvType.equals("EXECUTOR"))
+ {
+ ++c;
+ aDeactivation = new com.sun.star.beans.NamedValue();
+ aDeactivation.Name = "Deactivate";
+ aDeactivation.Value = java.lang.Boolean.TRUE;
+ }
+
+ // Sending of result events is usefull inside DISPATCH environment only
+ if (sEnvType.equals("DISPATCH"))
+ {
+ ++c;
+ aDispatchResult = new com.sun.star.beans.NamedValue();
+ aDispatchResult.Name = "SendDispatchResult";
+ aDispatchResult.Value = new com.sun.star.frame.DispatchResultEvent(this, com.sun.star.frame.DispatchResultState.SUCCESS, null);
+ }
+
+ // pack it together for return
+ int i=0;
+ com.sun.star.beans.NamedValue[] lReturn = new com.sun.star.beans.NamedValue[c];
+ lReturn[i++] = aSaveRequest;
+ if (aDeactivation!=null)
+ lReturn[i++] = aDeactivation;
+ if (aDispatchResult!=null)
+ lReturn[i++] = aDispatchResult;
+
+ xListener.jobFinished(this, lReturn);
+ }
+
+ //___________________________________________
+
+ /** show an info box with the UNO based toolkit.
+ *
+ * It tries to use the container window of a may well know
+ * office frame as parent. If such parent window could be located,
+ * the info box can be shown in modal mode. If a parent is missing
+ * (because this job is called inside an EXECUTOR environment, which
+ * does not set any frame context here) the info box can't be created!
+ * Because the toolkit needs parents for non top level windows ...
+ * In that case the only way is to implement this info box
+ * native or make it non modal using java dialogs inside it's own thread ...
+ * (see showInfoNonModal() too)
+ *
+ * @param xParent
+ * used as parent window of the shown info box.
+ *
+ * @param sTitle
+ * is shown as title of the info box.
+ *
+ * @param sMessage
+ * inclused the message body, which is shown as info.
+ */
+
+ private void showInfoModal( com.sun.star.awt.XWindow xParent ,
+ java.lang.String sTitle ,
+ java.lang.String sMessage )
+ {
+ try
+ {
+ // get access to the office toolkit environment
+ com.sun.star.awt.XToolkit xKit = (com.sun.star.awt.XToolkit)UnoRuntime.queryInterface(
+ com.sun.star.awt.XToolkit.class,
+ m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
+ m_xCmpCtx));
+
+ // describe the info box ini it's parameters
+ com.sun.star.awt.WindowDescriptor aDescriptor = new com.sun.star.awt.WindowDescriptor();
+ aDescriptor.WindowServiceName = "infobox";
+ aDescriptor.Bounds = new com.sun.star.awt.Rectangle(0,0,300,200);
+ aDescriptor.WindowAttributes = com.sun.star.awt.WindowAttribute.BORDER |
+ com.sun.star.awt.WindowAttribute.MOVEABLE |
+ com.sun.star.awt.WindowAttribute.CLOSEABLE;
+ aDescriptor.Type = com.sun.star.awt.WindowClass.MODALTOP;
+ aDescriptor.ParentIndex = 1;
+ aDescriptor.Parent = (com.sun.star.awt.XWindowPeer)UnoRuntime.queryInterface(
+ com.sun.star.awt.XWindowPeer.class,
+ xParent);
+
+ // create the info box window
+ com.sun.star.awt.XWindowPeer xPeer = xKit.createWindow(aDescriptor);
+ com.sun.star.awt.XMessageBox xInfoBox = (com.sun.star.awt.XMessageBox)UnoRuntime.queryInterface(
+ com.sun.star.awt.XMessageBox.class,
+ xPeer);
+ if (xInfoBox == null)
+ return;
+
+ // fill it with all given informations and show it
+ xInfoBox.setCaptionText(sTitle);
+ xInfoBox.setMessageText(sMessage);
+ xInfoBox.execute();
+ }
+ catch(java.lang.Throwable exIgnore)
+ {
+ // ignore any problem, which can occure here.
+ // It's not realy a bug for this example job, if
+ // it's message could not be printed out!
+ }
+ }
+
+ //___________________________________________
+
+ private void showInfoNonModal( java.lang.String sTitle ,
+ java.lang.String sMessage )
+ {
+ // Couldnt be implemented realy using the toolkit ...
+ // Because we need a parent anytime.
+ // And showing e.g. a java dialog can make some trouble
+ // inside office ... but we have no chance here.
+ javax.swing.JOptionPane.showMessageDialog(null, sMessage, sTitle, javax.swing.JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ //___________________________________________
+
+ /** helper to print out the given argument list.
+ *
+ * @param lGenericConfig
+ * contains all shared configuration items for a job
+ *
+ * @param lJobConfig
+ * contains all job sepcific configuration items
+ *
+ * @param lEnvironment
+ * contains some environment informations
+ *
+ * @param lDynamicData
+ * contains optional data of a might corresponding dispatch() request
+ */
+
+ private java.lang.String formatOutArgs(com.sun.star.beans.NamedValue[] lGenericConfig,
+ com.sun.star.beans.NamedValue[] lJobConfig ,
+ com.sun.star.beans.NamedValue[] lEnvironment ,
+ com.sun.star.beans.NamedValue[] lDynamicData )
+ {
+ java.lang.StringBuffer sOut = new java.lang.StringBuffer(1024);
+
+ sOut.append("list \"Config\": ");
+ if (lGenericConfig==null)
+ sOut.append("0 items\n");
+ else
+ {
+ int c = lGenericConfig.length;
+ sOut.append(c+" items\n");
+ for (int i=0; i<c; ++i)
+ sOut.append("\t["+i+"] \""+lGenericConfig[i].Name+"\" = {"+lGenericConfig[i].Value+"}\n");
+ }
+ sOut.append("list \"JobConfig\": ");
+ if (lJobConfig==null)
+ sOut.append("0 items\n");
+ else
+ {
+ int c = lJobConfig.length;
+ sOut.append(c+" items\n");
+ for (int i=0; i<c; ++i)
+ sOut.append("\t["+i+"] \""+lJobConfig[i].Name+"\" = {"+lJobConfig[i].Value+"}\n");
+ }
+ sOut.append("list \"Environment\": ");
+ if (lEnvironment==null)
+ sOut.append("0 items\n");
+ else
+ {
+ int c = lEnvironment.length;
+ sOut.append(c+" items\n");
+ for (int i=0; i<c; ++i)
+ sOut.append("\t["+i+"] \""+lEnvironment[i].Name+"\" = {"+lEnvironment[i].Value+"}\n");
+ }
+ sOut.append("list \"DynamicData\": ");
+ if (lDynamicData==null)
+ sOut.append("0 items\n");
+ else
+ {
+ int c = lDynamicData.length;
+ sOut.append(c+" items\n");
+ for (int i=0; i<c; ++i)
+ sOut.append("\t["+i+"] \""+lDynamicData[i].Name+"\" = {"+lDynamicData[i].Value+"}\n");
+ }
+
+ return sOut.toString();
+ }
+
+ public String[] getSupportedServiceNames() {
+ return SERVICENAMES;
+ }
+
+ public boolean supportsService( String sService ) {
+ int len = SERVICENAMES.length;
+
+ for( int i=0; i < len; i++) {
+ if ( sService.equals( SERVICENAMES[i] ) )
+ return true;
+ }
+
+ return false;
+ }
+
+ public String getImplementationName() {
+ return( AsyncJob.class.getName() );
+ }
+
+
+ //___________________________________________
+
+ public synchronized static com.sun.star.lang.XSingleComponentFactory __getComponentFactory(java.lang.String sImplName)
+ {
+ com.sun.star.lang.XSingleComponentFactory xFactory = null;
+ if (sImplName.equals(AsyncJob.IMPLEMENTATIONNAME))
+ xFactory = Factory.createComponentFactory(AsyncJob.class, SERVICENAMES);
+
+ return xFactory;
+ }
+
+ //___________________________________________
+
+ public synchronized static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xRegKey)
+ {
+ return Factory.writeRegistryServiceInfo(
+ AsyncJob.IMPLEMENTATIONNAME,
+ AsyncJob.SERVICENAMES,
+ xRegKey);
+ }
+}
diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Jobs.xcu b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Jobs.xcu
new file mode 100644
index 000000000000..f33c68e5a3da
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Jobs.xcu
@@ -0,0 +1,27 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="Jobs">
+ <node oor:name="AsyncJob" oor:op="replace">
+ <prop oor:name="Service" oor:type="xs:string">
+ <value>com.sun.star.comp.framework.java.services.AsyncJob</value>
+ </prop>
+ <node oor:name="Arguments">
+ <prop oor:name="arg_1" oor:type="xs:string">
+ <value>val_1</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="Events">
+ <node oor:name="onFirstVisibleTask" oor:op="modify">
+ <node oor:name="JobList">
+ <node oor:name="AsyncJob" oor:op="replace"/>
+ </node>
+ </node>
+ <node oor:name="onMyOwnJobEvent" oor:op="replace">
+ <node oor:name="JobList">
+ <node oor:name="AsyncJob" oor:op="replace"/>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile
new file mode 100644
index 000000000000..8b40d9ec87ff
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile
@@ -0,0 +1,136 @@
+#*************************************************************************
+#
+# 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 DevGuide Jobs Addon component example of the SDK.
+
+PRJ=../../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+COMPONENT_NAME=AsyncJob
+OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME)
+OUT_COMP_MISC=$(OUT_MISC)/$(COMPONENT_NAME)
+COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT)
+COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
+COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar
+COMPONENT_JAR=$(OUT_CLASS)/$(COMPONENT_JAR_NAME)
+COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest
+COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml
+REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag
+
+JAVAFILES = AsyncJob.java
+
+CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
+
+
+# Targets
+.PHONY: ALL
+ALL : DevGuideJobsAddon
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMP_CLASS)/%.Manifest :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo RegistrationClassName: $(basename $(basename $(@F)))> $@
+
+$(CLASSFILES) : $(JAVAFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES)
+
+# rule for component jar file
+$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) .
+
+# rule for component package manifest
+$(OUT_COMP_CLASS)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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.configuration-data$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)Jobs.xcu$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMPONENT_PACKAGE) : $(COMPONENT_JAR) Addons.xcu Jobs.xcu $(COMPONENT_UNOPKG_MANIFEST)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ cd $(subst /,$(PS),$(OUT_CLASS)) && $(SDK_ZIP) ../bin/$(@F) $(<F)
+ $(SDK_ZIP) -u $@ Addons.xcu Jobs.xcu
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+
+
+$(REGISTERFLAG) : $(COMPONENT_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
+ @echo flagged > $(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
+
+DevGuideJobsAddon : $(REGISTERFLAG)
+ @echo --------------------------------------------------------------------------------
+ @echo The "$(QM)AsyncJob$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo You can use this component inside your office installation, see the example
+ @echo description.
+ @echo --------------------------------------------------------------------------------
+
+%.run: $(OUT_COMP_CLASS)/%.class
+ $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(basename $@)
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR)))
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Addons.xcu b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Addons.xcu
new file mode 100644
index 000000000000..579bcd3eef58
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Addons.xcu
@@ -0,0 +1,220 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
+ <node oor:name="AddonUI">
+ <node oor:name="AddonMenu">
+ <node oor:name="org.openoffice.Office.addon.example.function" oor:op="replace">
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Add-On example</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <node oor:name="Submenu">
+ <node oor:name="m1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 1</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m2" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function2</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 2</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+ <node oor:name="OfficeMenuBar">
+ <node oor:name="org.openoffice.Office.addon.example" oor:op="replace">
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On example</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <node oor:name="Submenu">
+ <node oor:name="m1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 1</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ </node>
+ <node oor:name="m2" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>private:separator</value>
+ </prop>
+ </node>
+ <node oor:name="m3" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On sub menu</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <node oor:name="Submenu">
+ <node oor:name="submenu1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function2</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 2</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.sheet.SpreadsheetDocument</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+ <node oor:name="OfficeToolBar">
+ <node oor:name="org.openoffice.Office.addon.example" oor:op="replace">
+ <node oor:name="m1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Function 1</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ </node>
+ <node oor:name="m2" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function2</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Function 2</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="Images">
+ <node oor:name="com.sun.star.comp.framework.addon.image1" oor:op="replace">
+ <prop oor:name="URL">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmall" oor:type="xs:hexBinary">
+ <value>424df80000000000000076000000280000001000000010000000010004000000000000000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c0008080800000000000000080000080800000800000808000008000000080008000cccccccccccccccc2c266b181b666c2c5cc66b818b6665c555566b181b66655555566b818b66655555566b181b6665555a8666bbb6668a55a0a866666668a0a5000a8666668a000a6000a86668a000a556000a868a000a55556000a8a000a5555556000a000a55555555600000a55555555556000a55555555555560a55555550000</value>
+ </prop>
+ <prop oor:name="ImageBig" oor:type="xs:hexBinary">
+ <value>424d180200000000000076000000280000001a0000001a000000010004000000000000000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c000808080000000000000008000008080000080000080800000800000008000800055555555555555555555555555999990cccccccccccccccccccccccccc9055552cc2c6666b18181b6666c2cc2c99ccccc2ccc6666b81818b66668c2cc5902cc25c2586666b18181b66668ccc5590c2cc555586666b81818b6666855555995c25555586666b18181b6666855555995555555586666b81818b6666855555005555555586666b18181b666685555590555555a5866666b181b6666685a5550955555a0a8666666bbb6666668a0a559955a5a000a866666666666668a000a5995a0a00000a8666666666668a00000a90a000600000a86666666668a00000a50900005600000a866666668a00000a5599600055600000a8666668a00000a555095600555600000a86668a00000a55559955605555600000a868a00000a5555599555655555600000a8a00000a555555005555555555600000a00000a555555590555555555556000000000a555555550955555555555560000000a555555555995555555555555600000a555555555590555555555555556000a555555555550055555555555555560a555555555555905555555555555555555555555555559055550000</value>
+ </prop>
+ <prop oor:name="ImageSmallHC" oor:type="xs:hexBinary">
+ <value>424df60000000000000076000000280000001000000010000000010004000000000080000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c00080808000000000000000800000808000008000008080000080000000800080002222222222222222222996969699922252299669669995255559969696999555555996696699955555599696969995555969996669996955969699999996969566696999996966699666969996966695596669696966695555966696966695555559666966695555555596666695555555555966695555555555559695555555</value>
+ </prop>
+ <prop oor:name="ImageBigHC" oor:type="xs:hexBinary">
+ <value/>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="com.sun.star.comp.framework.addon.image2" oor:op="replace">
+ <prop oor:name="URL">
+ <value>org.openoffice.Office.addon.example:Help</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmall" oor:type="xs:hexBinary">
+ <value>424d36030000000000003600000028000000100000001000000001001800000000000003000000000000000000000000000000000000ff00ffff00ffff00ffff00fff0eeee6c5f602512133c2b2c2b1719594a4bdcd8d8ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff5443453a2525d0c5bdffffffffffffffffffe6e7e8493c3c5e514eb7b1b0ff00ffff00ffff00ffff00ffff00ff5c4a4dc0bbbcfffffffbeadee7bca8e7bcabdfb4a2f1c4b0fffffad0d0cd584a4dc5bbb8ff00ffff00ffff00ffddd9d9514449ffffffd49578b7511eb5582ed29d85ce8b6db54513ba5f32eeccb8fffffffffffbd3cfcfff00ffff00ffd9cdc5e0d9dadc9270ba4613bf511dc99076edeae7f2dcced27b54bc4811ba5724d3ad96ffffff402d30ff00ffefeae6e9e0daeabba4ba4308cb5b28cb5f2ecc7046d99979db8f66ce6635cc5d2dbf4e1ab85225ffeee5726361b1aaaad8cbc2ffffffbf4911c65b21cf6532cc5d2bcc764edbae97dfa284ce6a3bcc5b2bcc602ebb4310d28259ffffff332124d7cbc2fffffebb2600d0703bcc612ecb5b2bca7a56dfd3cdf5f4f1e1a686cd6333ce622dc95e2abe3901ffffff2b1a1dd8cdc4ffffffbe2f00d36f40cb602dcb5928c95a29ce8666e9ded7f1dcd2d77e56cd612acc6530c43a00ffffff312125d5c8beffffffcf3f00d66e3dcc632fc95d2ccb5522c44f19cf8c6becd4ccde9b81d06435d05b26c65619ffffff251317d9cdc5fefffff09361e87437da794ad29a7edfa68ad56f3bd5835bedd5cbe3b399d36939db6126e9b395ffffff3f3033f5f2f0ded6d1fff1e4f9a36ff28b52e3b39beeefedf3e5d9f2e7def4f0eaeba87ee66d2fee9e72fffffcb28d89c7c6c6ff00ffcbb6aaffffffffebdcfec08ff6b584edcebbeddaddf3dfdff5cab3f79c66fbaa7dfce8dcffffffb99e9bff00ffff00ffdccbc3e0d6cef2f2f2fffffcfff2d1fadca3f6cf91fac588fdc68bffe4c5fffefaffffffe2d4c8f2efeeff00ffff00ffff00fff0ebe6dfd0c9dbcac2f8f7f4fffffffffffffffffffdf8f2e3d9d1cfbfb4ebe3ddff00ffff00ffff00ffff00ffff00ffff00ffff00fffafaf9e1d6ced5c2b9d9c9c2d5c6beddcfc8f4f0efff00ffff00ffff00ffff00ffff00ff</value>
+ </prop>
+ <prop oor:name="ImageBig" oor:type="xs:hexBinary">
+ <value>424d560800000000000036000000280000001a0000001a00000001001800000000002008000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff524142524142524142524142524142524142524142524142ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ff524142524142bda69cd6c7bddecfc6ded7d6e7dfd6e7d7cebdbebdb59694524142524142ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ff524142fffffffffffffffffffffffffffffffffffffffffff7f7f7ffffffffffffffefefbdb6ad524142524142ff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ff524142ffffffffffffffffffefefefdedfdebdb6adc6a694d6a68cdebeade7d7ceefefeff7f7f7ffffffefe7deefe7de524142ff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffbda69cffffffffffffffffffefe7ded6a68cbd6139bd5929ce6942c6795abd5929bd5931ce8663debeadefefeffffffffff7f7efe7de524142ff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffbda69cffffffffffffe7cfc6ce7142bd5929bd5929bd6139d6c7bdffffffd69e84bd5929bd5929bd5929d69e7befefefffffffffefef524142ff00ffff00ffff00ffff00ff0000ff00ffff00ffdecfc6ffffffffffffe7cfc6c66139bd5929c66131ce6131bd7152dedfdeffffffe7c7bdce6131ce6131bd5929bd5929ce8e6befefefffffffdecfc6524142ff00ffff00ffff00ff0000ff00ffff00ffdecfc6ffffffefe7e7ce7142c66131ce6131ce6131ce6131c66131d6a68cefcfbdd68652ce6131ce6131ce6131c66131bd5929d6a68cffffffffffff524142ff00ffff00ffff00ff0000ff00ffdecfc6fff7f7ffffffdeae94bd5929ce6131ce6931ce6131ce6131ce6131ce6939d67142ce6131ce6131ce6131ce6131ce6131bd5929c66139f7dfd6ffffffdecfc6524142ff00ffff00ff0000ff00ffdecfc6fffffff7efefd6714ac66131ce6931ce6931ce6131ce6131c66939debeadffefe7de966bc66131ce6131ce6131ce6131ce6131bd5929deae94ffffffffefe7524142ff00ffff00ff0000ff00ffdecfc6ffffffefd7cece6131ce6931ce6931ce6131ce6131ce6131c66939d6d7d6ffffffdeb69cce6131ce6131ce6131ce6131ce6131bd5929ce8e63f7f7f7ffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffefc7adce6131ce6939ce6931ce6131ce6131ce6131ce6131c6a694f7f7f7fff7efd68e63ce6131ce6131ce6131ce6931ce6131d6714af7efefffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffefc7adce6131d66939ce6931ce6131ce6131ce6131ce6131c66139debeadfffffffff7efd68e63ce6131ce6931ce6931ce6131d6714af7efefffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffffcfb5d67139d67142d66939ce6131ce6131ce6131ce6131ce6131c66939d6c7bdffffffffefefd6714ace6131d66939ce6931d68652fff7f7ffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffffe7dee7794ade7142d67139ce6931ce6131ce6131ce6131ce6131ce6131ce7142f7efefffffffe7ae94ce6131d66939d66939d69673ffffffffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffffffffefa67bef8652de7142d6714adebeadefdfcede9e7bce6131ce6131ce6131f7dfd6ffffffefc7add66939de7142d66939efc7b5ffffffffefef524142ff00ffff00ff0000ff00ffdecfc6f7f7f7ffffffffdfc6f7965af78e5ade794acecfceffffffffefe7d68652ce6131d69e84ffffffffffffdeae94d67139de7142ef9663fff7f7ffffffd6c7bd524142ff00ffff00ff0000ff00ffff00ffdecfc6fffffffffffff7c7adff9e6bf7965ad69e84efefeffffffffffff7ffefdeffffffffffffefe7e7ef9663e7864aef8652f7dfceffffffffffffb59694ff00ffff00ffff00ff0000ff00ffff00ffdecfc6f7f7efffffffffffffffd7adffb684ffa673efb69cdedfdeefefefefefefefefefefe7deefae8cf7965aff9663ffcfb5ffffffffffffdecfc6b59694ff00ffff00ffff00ff0000ff00ffff00ffff00ffdecfc6ffffffffffffffffffffefd6ffdfadffc794ffc794efb69cefb69cffbe9cffb684ffae7bffb68cffe7d6fffffffffffff7efe7bdb6adff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffdecfc6fffffffffffffffffffffff7ffffe7ffffd6ffefb5ffefb5ffdfadffdfadffefd6fffff7fffffffffffffff7efdecfc6ff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffdecfc6fff7efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdecfc6decfc6ff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffdecfc6decfc6fff7effffffffffffffffffffffffffffffffffffffffff7decfc6decfc6ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffdecfc6decfc6decfc6decfc6decfc6decfc6decfc6decfc6ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000</value>
+ </prop>
+ <prop oor:name="ImageSmallHC" oor:type="xs:hexBinary">
+ <value>424d36030000000000003600000028000000100000001000000001001800000000000003000000000000000000000000000000000000ff00ffff00ffff00ffff00fff0eeee6c5f602512133c2b2c2b1719594a4bdcd8d8ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff5443453a2525d0c5bdffffffffffffffffffe6e7e8493c3c5e514eb7b1b0ff00ffff00ffff00ffff00ffff00ff5c4a4dc0bbbcffffffffffffffffffffffffffffffffffffffffffd0d0cd584a4dc5bbb8ff00ffff00ffff00ffddd9d9514449ffffffffffffffffffffffff251317251317fffffffffffffffffffffffffffffbd3cfcfff00ffff00ffd9cdc5e0d9daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff402d30ff00ffefeae6e9e0daffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffffffffff726361b1aaaad8cbc2ffffffffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffffffffffffffff332124d7cbc2fffffeffffffffffffffffffffffffffffff251317251317000000ffffffffffffffffffffffffffffff2b1a1dd8cdc4ffffffffffffffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffffffffff312125d5c8beffffffffffffffffffffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffff251317d9cdc5feffffffffffffffffffffff000000000000ffffffffffff251317251317ffffffffffffffffffffffff3f3033f5f2f0ded6d1ffffffffffffffffff000000251317251317251317251317000000ffffffffffffffffffb28d89c7c6c6ff00ffcbb6aaffffffffffffffffffffffff000000251317251317000000ffffffffffffffffffffffffb99e9bff00ffff00ffdccbc3e0d6cef2f2f2fffffffffffffffffffffffffffffffffffffffffffffefaffffffe2d4c8f2efeeff00ffff00ffff00fff0ebe6dfd0c9dbcac2f8f7f4fffffffffffffffffffdf8f2e3d9d1cfbfb4ebe3ddff00ffff00ffff00ffff00ffff00ffff00ffff00fffafaf9e1d6ced5c2b9d9c9c2d5c6beddcfc8f4f0efff00ffff00ffff00ffff00ffff00ff</value>
+ </prop>
+ <prop oor:name="ImageBigHC" oor:type="xs:hexBinary">
+ <value/>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="OfficeHelp">
+ <node oor:name="com.sun.star.comp.framework.addon" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Help</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. -->
+ <value xml:lang="x-no-translate"></value> <value xml:lang="x-no-translate"></value>
+ <value xml:lang="de">Ãœber Add-On Beispiel</value>
+ <value xml:lang="en-US">About Add-On Example</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile
new file mode 100644
index 000000000000..c5429565e406
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile
@@ -0,0 +1,148 @@
+#*************************************************************************
+#
+# 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 ProtocolHandlerAddon C++ component example of the SDK.
+
+PRJ=../../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+COMP_NAME=ProtocolHandlerAddon_cpp
+COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT)
+OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME)
+OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME)
+OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME)
+COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
+COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
+COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml
+COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map
+
+REGISTERFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_register_component.flag
+
+CXXFILES = component.cxx \
+ addon.cxx
+
+SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
+
+# Targets
+.PHONY: ALL
+ALL : \
+ Example
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
+
+$(COMP_MAPFILE) : $(SLOFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE)
+ifeq "$(OS)" "MACOSX"
+ nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE)
+endif
+
+ifeq "$(OS)" "WIN"
+$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
+ $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
+ /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \
+ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib
+ $(LINK_MANIFEST)
+else
+$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
+ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB)
+ifeq "$(OS)" "MACOSX"
+ $(INSTALL_NAME_URELIBS) $@
+endif
+endif
+
+# rule for component package manifest
+$(OUT_COMP_GEN)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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.configuration-data$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST)
+ -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM))
+ $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM))
+ cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F)
+ $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu
+ cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+
+$(REGISTERFLAG) : $(COMP_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
+ @echo flagged > $(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
+
+Example : $(REGISTERFLAG)
+ @echo --------------------------------------------------------------------------------
+ @echo The "$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo You can use this component inside your office installation, see the example
+ @echo description.
+ @echo --------------------------------------------------------------------------------
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*))
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/ProtocolHandler.xcu b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/ProtocolHandler.xcu
new file mode 100644
index 000000000000..c71e8c387306
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/ProtocolHandler.xcu
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<oor:component-data oor:name="ProtocolHandler" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="HandlerSet">
+ <node oor:name="org.openoffice.Office.addon.example" oor:op="replace">
+ <prop oor:name="Protocols" oor:type="oor:string-list">
+ <value>org.openoffice.Office.addon.example:*</value>
+ </prop>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
new file mode 100644
index 000000000000..e2ec638cbc02
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#include <addon.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XMessageBox.hpp>
+
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::awt;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::util::URL;
+
+// This is the service name an Add-On has to implement
+#define SERVICE_NAME "com.sun.star.frame.ProtocolHandler"
+
+
+/**
+ * Show a message box with the UNO based toolkit
+ */
+static void ShowMessageBox( const Reference< XToolkit >& rToolkit, const Reference< XFrame >& rFrame, const OUString& aTitle, const OUString& aMsgText )
+{
+ if ( rFrame.is() && rToolkit.is() )
+ {
+ // describe window properties.
+ WindowDescriptor aDescriptor;
+ aDescriptor.Type = WindowClass_MODALTOP;
+ aDescriptor.WindowServiceName = OUString( RTL_CONSTASCII_USTRINGPARAM( "infobox" ));
+ aDescriptor.ParentIndex = -1;
+ aDescriptor.Parent = Reference< XWindowPeer >( rFrame->getContainerWindow(), UNO_QUERY );
+ aDescriptor.Bounds = Rectangle(0,0,300,200);
+ aDescriptor.WindowAttributes = WindowAttribute::BORDER |
+WindowAttribute::MOVEABLE |
+WindowAttribute::CLOSEABLE;
+
+ Reference< XWindowPeer > xPeer = rToolkit->createWindow( aDescriptor );
+ if ( xPeer.is() )
+ {
+ Reference< XMessageBox > xMsgBox( xPeer, UNO_QUERY );
+ if ( xMsgBox.is() )
+ {
+ xMsgBox->setCaptionText( aTitle );
+ xMsgBox->setMessageText( aMsgText );
+ xMsgBox->execute();
+ }
+ }
+ }
+}
+
+/**
+ * Called by the Office framework.
+ * One-time initialization. We have to store the context information
+ * given, like the frame we are bound to, into our members.
+ */
+void SAL_CALL Addon::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException)
+{
+ Reference < XFrame > xFrame;
+ if ( aArguments.getLength() )
+ {
+ aArguments[0] >>= xFrame;
+ mxFrame = xFrame;
+ }
+
+ // Create the toolkit to have access to it later
+ mxToolkit = Reference< XToolkit >( mxMSF->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.awt.Toolkit" ))), UNO_QUERY );
+}
+
+/**
+ * Called by the Office framework.
+ * We are ask to query the given URL and return a dispatch object if the URL
+ * contains an Add-On command.
+ */
+Reference< XDispatch > SAL_CALL Addon::queryDispatch( const URL& aURL, const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags )
+ throw( RuntimeException )
+{
+ Reference < XDispatch > xRet;
+ if ( aURL.Protocol.compareToAscii("org.openoffice.Office.addon.example:") == 0 )
+ {
+ if ( aURL.Path.compareToAscii( "Function1" ) == 0 )
+ xRet = this;
+ else if ( aURL.Path.compareToAscii( "Function2" ) == 0 )
+ xRet = this;
+ else if ( aURL.Path.compareToAscii( "Help" ) == 0 )
+ xRet = this;
+ }
+
+ return xRet;
+}
+
+/**
+ * Called by the Office framework.
+ * We are ask to execute the given Add-On command URL.
+ */
+void SAL_CALL Addon::dispatch( const URL& aURL, const Sequence < PropertyValue >& lArgs ) throw (RuntimeException)
+{
+ if ( aURL.Protocol.compareToAscii("org.openoffice.Office.addon.example:") == 0 )
+ {
+ if ( aURL.Path.compareToAscii( "Function1" ) == 0 )
+ {
+ ShowMessageBox( mxToolkit, mxFrame,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "SDK Add-On example" )),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Function 1 activated" )) );
+ }
+ else if ( aURL.Path.compareToAscii( "Function2" ) == 0 )
+ {
+ ShowMessageBox( mxToolkit, mxFrame,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "SDK Add-On example" )),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Function 2 activated" )) );
+ }
+ else if ( aURL.Path.compareToAscii( "Help" ) == 0 )
+ {
+ // Show info box
+ ShowMessageBox( mxToolkit, mxFrame,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "About SDK Add-On example" )),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "This is the SDK Add-On example" )) );
+ }
+ }
+}
+
+/**
+ * Called by the Office framework.
+ * We are ask to query the given sequence of URLs and return dispatch objects if the URLs
+ * contain Add-On commands.
+ */
+Sequence < Reference< XDispatch > > SAL_CALL Addon::queryDispatches( const Sequence < DispatchDescriptor >& seqDescripts )
+ throw( RuntimeException )
+{
+ sal_Int32 nCount = seqDescripts.getLength();
+ Sequence < Reference < XDispatch > > lDispatcher( nCount );
+
+ for( sal_Int32 i=0; i<nCount; ++i )
+ lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
+
+ return lDispatcher;
+}
+
+/**
+ * Called by the Office framework.
+ * We are ask to query the given sequence of URLs and return dispatch objects if the URLs
+ * contain Add-On commands.
+ */
+void SAL_CALL Addon::addStatusListener( const Reference< XStatusListener >& xControl, const URL& aURL ) throw (RuntimeException)
+{
+}
+
+/**
+ * Called by the Office framework.
+ * We are ask to query the given sequence of URLs and return dispatch objects if the URLs
+ * contain Add-On commands.
+ */
+void SAL_CALL Addon::removeStatusListener( const Reference< XStatusListener >& xControl, const URL& aURL ) throw (RuntimeException)
+{
+}
+
+//##################################################################################################
+//#### Helper functions for the implementation of UNO component interfaces #########################
+//##################################################################################################
+
+::rtl::OUString Addon_getImplementationName()
+throw (RuntimeException)
+{
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
+}
+
+sal_Bool SAL_CALL Addon_supportsService( const ::rtl::OUString& ServiceName )
+throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+Sequence< ::rtl::OUString > SAL_CALL Addon_getSupportedServiceNames()
+throw (RuntimeException)
+{
+ Sequence < ::rtl::OUString > aRet(1);
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+
+Reference< XInterface > SAL_CALL Addon_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new Addon( rSMgr );
+}
+
+//##################################################################################################
+//#### Implementation of the recommended/mandatory interfaces of a UNO component ###################
+//##################################################################################################
+
+// XServiceInfo
+::rtl::OUString SAL_CALL Addon::getImplementationName( )
+ throw (RuntimeException)
+{
+ return Addon_getImplementationName();
+}
+
+sal_Bool SAL_CALL Addon::supportsService( const ::rtl::OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return Addon_supportsService( rServiceName );
+}
+
+Sequence< ::rtl::OUString > SAL_CALL Addon::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return Addon_getSupportedServiceNames();
+}
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx
new file mode 100644
index 000000000000..c0b8dedd385a
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _Addon_HXX
+#define _Addon_HXX
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase4.hxx>
+
+#define IMPLEMENTATION_NAME "org.openoffice.Office.addon.example"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace frame
+ {
+ class XFrame;
+ }
+ namespace awt
+ {
+ class XToolkit;
+ }
+ }
+ }
+}
+
+class Addon : public cppu::WeakImplHelper4
+<
+ com::sun::star::frame::XDispatchProvider,
+ com::sun::star::frame::XDispatch,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+>
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > mxToolkit;
+
+public:
+ Addon( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+
+ // XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
+ SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL,
+ const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > >
+ SAL_CALL queryDispatches(
+ const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
+ const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
+ const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+::rtl::OUString Addon_getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL Addon_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Addon_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL Addon_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+#endif // _Addon_HXX
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
new file mode 100644
index 000000000000..724c4996f308
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#include <stdio.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/queryinterface.hxx> // helper for queryInterface() impl
+#include <cppuhelper/factory.hxx> // helper for component factory
+// generated c++ interfaces
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+// include our specific addon header to get access to functions and definitions
+#include <addon.hxx>
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+//##################################################################################################
+//#### EXPORTED ####################################################################################
+//##################################################################################################
+
+
+/**
+ * Gives the environment this component belongs to.
+ */
+extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+/**
+ * This function creates an implementation section in the registry and another subkey
+ *
+ * for each supported service.
+ * @param pServiceManager the service manager
+ * @param pRegistryKey the registry key
+ */
+extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey)
+{
+ sal_Bool result = sal_False;
+
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLEMENTATION_NAME "/UNO/SERVICES") ) ) );
+
+ const Sequence< OUString > & rSNL =
+ Addon_getSupportedServiceNames();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ // we should not ignore exceptions
+ }
+ }
+ return result;
+}
+
+/**
+ * This function is called to get service factories for an implementation.
+ *
+ * @param pImplName name of implementation
+ * @param pServiceManager a service manager, need for component creation
+ * @param pRegistryKey the registry key for this component, need for persistent data
+ * @return a component factory
+ */
+extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ void * pRet = 0;
+
+ if (rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ),
+ Addon_createInstance,
+ Addon_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Addons.xcu b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Addons.xcu
new file mode 100644
index 000000000000..fb904e9ac452
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Addons.xcu
@@ -0,0 +1,220 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
+ <node oor:name="AddonUI">
+ <node oor:name="AddonMenu">
+ <node oor:name="org.openoffice.Office.addon.example.function" oor:op="replace">
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Add-On example</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <node oor:name="Submenu">
+ <node oor:name="m1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 1</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m2" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function2</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 2</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+ <node oor:name="OfficeMenuBar">
+ <node oor:name="org.openoffice.Office.addon.example" oor:op="replace">
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On example</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <node oor:name="Submenu">
+ <node oor:name="m1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 1</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ </node>
+ <node oor:name="m2" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>private:separator</value>
+ </prop>
+ </node>
+ <node oor:name="m3" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On sub menu</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <node oor:name="Submenu">
+ <node oor:name="submenu1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function2</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Add-On Function 2</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.sheet.SpreadsheetDocument</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+ <node oor:name="OfficeToolBar">
+ <node oor:name="org.openoffice.Office.addon.example" oor:op="replace">
+ <node oor:name="m1" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Function 1</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ </node>
+ <node oor:name="m2" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Function2</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Function 2</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="Images">
+ <node oor:name="com.sun.star.comp.framework.addon.image1" oor:op="replace">
+ <prop oor:name="URL">
+ <value>org.openoffice.Office.addon.example:Function1</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmall" oor:type="xs:hexBinary">
+ <value>424df80000000000000076000000280000001000000010000000010004000000000000000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c0008080800000000000000080000080800000800000808000008000000080008000cccccccccccccccc2c266b181b666c2c5cc66b818b6665c555566b181b66655555566b818b66655555566b181b6665555a8666bbb6668a55a0a866666668a0a5000a8666668a000a6000a86668a000a556000a868a000a55556000a8a000a5555556000a000a55555555600000a55555555556000a55555555555560a55555550000</value>
+ </prop>
+ <prop oor:name="ImageBig" oor:type="xs:hexBinary">
+ <value>424d180200000000000076000000280000001a0000001a000000010004000000000000000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c000808080000000000000008000008080000080000080800000800000008000800055555555555555555555555555999990cccccccccccccccccccccccccc9055552cc2c6666b18181b6666c2cc2c99ccccc2ccc6666b81818b66668c2cc5902cc25c2586666b18181b66668ccc5590c2cc555586666b81818b6666855555995c25555586666b18181b6666855555995555555586666b81818b6666855555005555555586666b18181b666685555590555555a5866666b181b6666685a5550955555a0a8666666bbb6666668a0a559955a5a000a866666666666668a000a5995a0a00000a8666666666668a00000a90a000600000a86666666668a00000a50900005600000a866666668a00000a5599600055600000a8666668a00000a555095600555600000a86668a00000a55559955605555600000a868a00000a5555599555655555600000a8a00000a555555005555555555600000a00000a555555590555555555556000000000a555555550955555555555560000000a555555555995555555555555600000a555555555590555555555555556000a555555555550055555555555555560a555555555555905555555555555555555555555555559055550000</value>
+ </prop>
+ <prop oor:name="ImageSmallHC" oor:type="xs:hexBinary">
+ <value>424df60000000000000076000000280000001000000010000000010004000000000080000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c00080808000000000000000800000808000008000008080000080000000800080002222222222222222222996969699922252299669669995255559969696999555555996696699955555599696969995555969996669996955969699999996969566696999996966699666969996966695596669696966695555966696966695555559666966695555555596666695555555555966695555555555559695555555</value>
+ </prop>
+ <prop oor:name="ImageBigHC" oor:type="xs:hexBinary">
+ <value/>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="com.sun.star.comp.framework.addon.image2" oor:op="replace">
+ <prop oor:name="URL">
+ <value>org.openoffice.Office.addon.example:Help</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmall" oor:type="xs:hexBinary">
+ <value>424d36030000000000003600000028000000100000001000000001001800000000000003000000000000000000000000000000000000ff00ffff00ffff00ffff00fff0eeee6c5f602512133c2b2c2b1719594a4bdcd8d8ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff5443453a2525d0c5bdffffffffffffffffffe6e7e8493c3c5e514eb7b1b0ff00ffff00ffff00ffff00ffff00ff5c4a4dc0bbbcfffffffbeadee7bca8e7bcabdfb4a2f1c4b0fffffad0d0cd584a4dc5bbb8ff00ffff00ffff00ffddd9d9514449ffffffd49578b7511eb5582ed29d85ce8b6db54513ba5f32eeccb8fffffffffffbd3cfcfff00ffff00ffd9cdc5e0d9dadc9270ba4613bf511dc99076edeae7f2dcced27b54bc4811ba5724d3ad96ffffff402d30ff00ffefeae6e9e0daeabba4ba4308cb5b28cb5f2ecc7046d99979db8f66ce6635cc5d2dbf4e1ab85225ffeee5726361b1aaaad8cbc2ffffffbf4911c65b21cf6532cc5d2bcc764edbae97dfa284ce6a3bcc5b2bcc602ebb4310d28259ffffff332124d7cbc2fffffebb2600d0703bcc612ecb5b2bca7a56dfd3cdf5f4f1e1a686cd6333ce622dc95e2abe3901ffffff2b1a1dd8cdc4ffffffbe2f00d36f40cb602dcb5928c95a29ce8666e9ded7f1dcd2d77e56cd612acc6530c43a00ffffff312125d5c8beffffffcf3f00d66e3dcc632fc95d2ccb5522c44f19cf8c6becd4ccde9b81d06435d05b26c65619ffffff251317d9cdc5fefffff09361e87437da794ad29a7edfa68ad56f3bd5835bedd5cbe3b399d36939db6126e9b395ffffff3f3033f5f2f0ded6d1fff1e4f9a36ff28b52e3b39beeefedf3e5d9f2e7def4f0eaeba87ee66d2fee9e72fffffcb28d89c7c6c6ff00ffcbb6aaffffffffebdcfec08ff6b584edcebbeddaddf3dfdff5cab3f79c66fbaa7dfce8dcffffffb99e9bff00ffff00ffdccbc3e0d6cef2f2f2fffffcfff2d1fadca3f6cf91fac588fdc68bffe4c5fffefaffffffe2d4c8f2efeeff00ffff00ffff00fff0ebe6dfd0c9dbcac2f8f7f4fffffffffffffffffffdf8f2e3d9d1cfbfb4ebe3ddff00ffff00ffff00ffff00ffff00ffff00ffff00fffafaf9e1d6ced5c2b9d9c9c2d5c6beddcfc8f4f0efff00ffff00ffff00ffff00ffff00ff</value>
+ </prop>
+ <prop oor:name="ImageBig" oor:type="xs:hexBinary">
+ <value>424d560800000000000036000000280000001a0000001a00000001001800000000002008000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff524142524142524142524142524142524142524142524142ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ff524142524142bda69cd6c7bddecfc6ded7d6e7dfd6e7d7cebdbebdb59694524142524142ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ff524142fffffffffffffffffffffffffffffffffffffffffff7f7f7ffffffffffffffefefbdb6ad524142524142ff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ff524142ffffffffffffffffffefefefdedfdebdb6adc6a694d6a68cdebeade7d7ceefefeff7f7f7ffffffefe7deefe7de524142ff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffbda69cffffffffffffffffffefe7ded6a68cbd6139bd5929ce6942c6795abd5929bd5931ce8663debeadefefeffffffffff7f7efe7de524142ff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffbda69cffffffffffffe7cfc6ce7142bd5929bd5929bd6139d6c7bdffffffd69e84bd5929bd5929bd5929d69e7befefefffffffffefef524142ff00ffff00ffff00ffff00ff0000ff00ffff00ffdecfc6ffffffffffffe7cfc6c66139bd5929c66131ce6131bd7152dedfdeffffffe7c7bdce6131ce6131bd5929bd5929ce8e6befefefffffffdecfc6524142ff00ffff00ffff00ff0000ff00ffff00ffdecfc6ffffffefe7e7ce7142c66131ce6131ce6131ce6131c66131d6a68cefcfbdd68652ce6131ce6131ce6131c66131bd5929d6a68cffffffffffff524142ff00ffff00ffff00ff0000ff00ffdecfc6fff7f7ffffffdeae94bd5929ce6131ce6931ce6131ce6131ce6131ce6939d67142ce6131ce6131ce6131ce6131ce6131bd5929c66139f7dfd6ffffffdecfc6524142ff00ffff00ff0000ff00ffdecfc6fffffff7efefd6714ac66131ce6931ce6931ce6131ce6131c66939debeadffefe7de966bc66131ce6131ce6131ce6131ce6131bd5929deae94ffffffffefe7524142ff00ffff00ff0000ff00ffdecfc6ffffffefd7cece6131ce6931ce6931ce6131ce6131ce6131c66939d6d7d6ffffffdeb69cce6131ce6131ce6131ce6131ce6131bd5929ce8e63f7f7f7ffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffefc7adce6131ce6939ce6931ce6131ce6131ce6131ce6131c6a694f7f7f7fff7efd68e63ce6131ce6131ce6131ce6931ce6131d6714af7efefffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffefc7adce6131d66939ce6931ce6131ce6131ce6131ce6131c66139debeadfffffffff7efd68e63ce6131ce6931ce6931ce6131d6714af7efefffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffffcfb5d67139d67142d66939ce6131ce6131ce6131ce6131ce6131c66939d6c7bdffffffffefefd6714ace6131d66939ce6931d68652fff7f7ffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffffe7dee7794ade7142d67139ce6931ce6131ce6131ce6131ce6131ce6131ce7142f7efefffffffe7ae94ce6131d66939d66939d69673ffffffffffff524142ff00ffff00ff0000ff00ffdecfc6ffffffffffffefa67bef8652de7142d6714adebeadefdfcede9e7bce6131ce6131ce6131f7dfd6ffffffefc7add66939de7142d66939efc7b5ffffffffefef524142ff00ffff00ff0000ff00ffdecfc6f7f7f7ffffffffdfc6f7965af78e5ade794acecfceffffffffefe7d68652ce6131d69e84ffffffffffffdeae94d67139de7142ef9663fff7f7ffffffd6c7bd524142ff00ffff00ff0000ff00ffff00ffdecfc6fffffffffffff7c7adff9e6bf7965ad69e84efefeffffffffffff7ffefdeffffffffffffefe7e7ef9663e7864aef8652f7dfceffffffffffffb59694ff00ffff00ffff00ff0000ff00ffff00ffdecfc6f7f7efffffffffffffffd7adffb684ffa673efb69cdedfdeefefefefefefefefefefe7deefae8cf7965aff9663ffcfb5ffffffffffffdecfc6b59694ff00ffff00ffff00ff0000ff00ffff00ffff00ffdecfc6ffffffffffffffffffffefd6ffdfadffc794ffc794efb69cefb69cffbe9cffb684ffae7bffb68cffe7d6fffffffffffff7efe7bdb6adff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffdecfc6fffffffffffffffffffffff7ffffe7ffffd6ffefb5ffefb5ffdfadffdfadffefd6fffff7fffffffffffffff7efdecfc6ff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffdecfc6fff7efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdecfc6decfc6ff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffdecfc6decfc6fff7effffffffffffffffffffffffffffffffffffffffff7decfc6decfc6ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffdecfc6decfc6decfc6decfc6decfc6decfc6decfc6decfc6ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff0000</value>
+ </prop>
+ <prop oor:name="ImageSmallHC" oor:type="xs:hexBinary">
+ <value>424d36030000000000003600000028000000100000001000000001001800000000000003000000000000000000000000000000000000ff00ffff00ffff00ffff00fff0eeee6c5f602512133c2b2c2b1719594a4bdcd8d8ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff5443453a2525d0c5bdffffffffffffffffffe6e7e8493c3c5e514eb7b1b0ff00ffff00ffff00ffff00ffff00ff5c4a4dc0bbbcffffffffffffffffffffffffffffffffffffffffffd0d0cd584a4dc5bbb8ff00ffff00ffff00ffddd9d9514449ffffffffffffffffffffffff251317251317fffffffffffffffffffffffffffffbd3cfcfff00ffff00ffd9cdc5e0d9daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff402d30ff00ffefeae6e9e0daffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffffffffff726361b1aaaad8cbc2ffffffffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffffffffffffffff332124d7cbc2fffffeffffffffffffffffffffffffffffff251317251317000000ffffffffffffffffffffffffffffff2b1a1dd8cdc4ffffffffffffffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffffffffff312125d5c8beffffffffffffffffffffffffffffffffffffffffffffffff251317251317ffffffffffffffffffffffff251317d9cdc5feffffffffffffffffffffff000000000000ffffffffffff251317251317ffffffffffffffffffffffff3f3033f5f2f0ded6d1ffffffffffffffffff000000251317251317251317251317000000ffffffffffffffffffb28d89c7c6c6ff00ffcbb6aaffffffffffffffffffffffff000000251317251317000000ffffffffffffffffffffffffb99e9bff00ffff00ffdccbc3e0d6cef2f2f2fffffffffffffffffffffffffffffffffffffffffffffefaffffffe2d4c8f2efeeff00ffff00ffff00fff0ebe6dfd0c9dbcac2f8f7f4fffffffffffffffffffdf8f2e3d9d1cfbfb4ebe3ddff00ffff00ffff00ffff00ffff00ffff00ffff00fffafaf9e1d6ced5c2b9d9c9c2d5c6beddcfc8f4f0efff00ffff00ffff00ffff00ffff00ff</value>
+ </prop>
+ <prop oor:name="ImageBigHC" oor:type="xs:hexBinary">
+ <value/>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="OfficeHelp">
+ <node oor:name="com.sun.star.comp.framework.addon" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>org.openoffice.Office.addon.example:Help</value>
+ </prop>
+ <prop oor:name="ImageIdentifier" oor:type="xs:string">
+ <value/>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. -->
+ <value xml:lang="x-no-translate"></value>
+ <value xml:lang="de">Ãœber Add-On Beispiel</value>
+ <value xml:lang="en-US">About Add-On Example</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile
new file mode 100644
index 000000000000..ac6a0670a05a
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile
@@ -0,0 +1,138 @@
+#*************************************************************************
+#
+# 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 ProtoclHandlerAddon Java component example of the SDK.
+
+PRJ=../../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+COMPONENT_NAME=ProtocolHandlerAddon_java
+OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME)
+OUT_COMP_MISC=$(OUT_MISC)/$(COMPONENT_NAME)
+COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT)
+COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
+COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar
+COMPONENT_JAR=$(OUT_CLASS)/$(COMPONENT_JAR_NAME)
+COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest
+COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml
+
+REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag
+
+JAVAFILES = ProtocolHandlerAddon.java
+
+CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
+
+
+# Targets
+.PHONY: ALL
+ALL : DevGuideProtocolHandlerAddon
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMP_CLASS)/%.Manifest :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo RegistrationClassName: ProtocolHandlerAddon> $@
+
+$(CLASSFILES) : $(JAVAFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES)
+
+# rule for component jar file
+$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) .
+
+# rule for component package manifest
+$(OUT_COMP_CLASS)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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.configuration-data$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMPONENT_PACKAGE) : $(COMPONENT_JAR) Addons.xcu ProtocolHandler.xcu $(COMPONENT_UNOPKG_MANIFEST)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_MISC))
+ $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_MISC))
+ cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
+ $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+
+$(REGISTERFLAG) : $(COMPONENT_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
+ @echo flagged > $(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
+
+DevGuideProtocolHandlerAddon : $(REGISTERFLAG)
+ @echo --------------------------------------------------------------------------------
+ @echo The "$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo You can use this component inside your office installation, see the example
+ @echo description.
+ @echo --------------------------------------------------------------------------------
+
+%.run: $(OUT_COMP_CLASS)/%.class
+ $SDJ_JAVA) -classpath "$(SDK_CLASSPATH)" $(basename $@)
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR)))
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandler.xcu b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandler.xcu
new file mode 100644
index 000000000000..27444dd1c5e0
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandler.xcu
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="ProtocolHandler" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="HandlerSet">
+ <node oor:name="ProtocolHandlerAddon$ProtocolHandlerAddonImpl" oor:op="replace">
+ <prop oor:name="Protocols" oor:type="oor:string-list">
+ <value>org.openoffice.Office.addon.example:*</value>
+ </prop>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
new file mode 100644
index 000000000000..ad3b0efe8747
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.Type;
+import com.sun.star.frame.XStatusListener;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.DispatchDescriptor;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.awt.XMessageBox;
+import com.sun.star.awt.WindowAttribute;
+import com.sun.star.awt.WindowClass;
+import com.sun.star.awt.WindowDescriptor;
+import com.sun.star.awt.Rectangle;
+
+public class ProtocolHandlerAddon {
+ /** This class implements the component. At least the interfaces XServiceInfo,
+ * XTypeProvider, and XInitialization should be provided by the service.
+ */
+ public static class ProtocolHandlerAddonImpl extends WeakBase implements
+ XDispatchProvider,
+ XDispatch,
+ XInitialization,
+ XServiceInfo {
+
+ /** The service name, that must be used to get an instance of this service.
+ */
+ static private final String[] m_serviceNames = { "com.sun.star.frame.ProtocolHandler" };
+
+ /** The component context, that gives access to the service manager and all registered services.
+ */
+ private XComponentContext m_xCmpCtx;
+
+ /** The toolkit, that we can create UNO dialogs.
+ */
+ private XToolkit m_xToolkit;
+
+ /** The frame where the addon depends on.
+ */
+ private XFrame m_xFrame;
+ private XStatusListener m_xStatusListener;
+
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public ProtocolHandlerAddonImpl( XComponentContext xComponentContext ) {
+ m_xCmpCtx = xComponentContext;
+ }
+
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @throws Exception Every exception will not be handled, but will be
+ * passed to the caller.
+ */
+ public void initialize( Object[] object )
+ throws com.sun.star.uno.Exception {
+
+ if ( object.length > 0 )
+ {
+ m_xFrame = ( XFrame ) UnoRuntime.queryInterface(
+ XFrame.class, object[ 0 ] );
+ }
+
+ // Create the toolkit to have access to it later
+ m_xToolkit = (XToolkit) UnoRuntime.queryInterface(
+ XToolkit.class,
+ m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
+ m_xCmpCtx));
+ }
+
+ /** This method returns an array of all supported service names.
+ * @return Array of supported service names.
+ */
+ public String[] getSupportedServiceNames() {
+ return getServiceNames();
+ }
+
+ public static String[] getServiceNames() {
+ return m_serviceNames;
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param stringService Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService( String sService ) {
+ int len = m_serviceNames.length;
+
+ for( int i=0; i < len; i++) {
+ if ( sService.equals( m_serviceNames[i] ) )
+ return true;
+ }
+
+ return false;
+ }
+
+ /** Return the class name of the component.
+ * @return Class name of the component.
+ */
+ public String getImplementationName() {
+ return ProtocolHandlerAddonImpl.class.getName();
+ }
+
+ // XDispatchProvider
+ public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL,
+ /*IN*/String sTargetFrameName,
+ /*IN*/int iSearchFlags ) {
+ XDispatch xRet = null;
+ if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) {
+ if ( aURL.Path.compareTo( "Function1" ) == 0 )
+ xRet = this;
+ if ( aURL.Path.compareTo( "Function2" ) == 0 )
+ xRet = this;
+ if ( aURL.Path.compareTo( "Help" ) == 0 )
+ xRet = this;
+ }
+ return xRet;
+ }
+
+ public XDispatch[] queryDispatches( /*IN*/DispatchDescriptor[] seqDescripts ) {
+ int nCount = seqDescripts.length;
+ XDispatch[] lDispatcher = new XDispatch[nCount];
+
+ for( int i=0; i<nCount; ++i )
+ lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL,
+ seqDescripts[i].FrameName,
+ seqDescripts[i].SearchFlags );
+
+ return lDispatcher;
+ }
+
+ // XDispatch
+ public void dispatch( /*IN*/com.sun.star.util.URL aURL,
+ /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) {
+
+ if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 )
+ {
+ if ( aURL.Path.compareTo( "Function1" ) == 0 )
+ {
+ showMessageBox("SDK DevGuide Add-On example", "Function 1 activated");
+ }
+ if ( aURL.Path.compareTo( "Function2" ) == 0 )
+ {
+ showMessageBox("SDK DevGuide Add-On example", "Function 2 activated");
+ }
+ if ( aURL.Path.compareTo( "Help" ) == 0 )
+ {
+ showMessageBox("About SDK DevGuide Add-On example", "This is the SDK Add-On example");
+ }
+ }
+ }
+
+ public void addStatusListener( /*IN*/XStatusListener xControl,
+ /*IN*/com.sun.star.util.URL aURL ) {
+ }
+
+ public void removeStatusListener( /*IN*/XStatusListener xControl,
+ /*IN*/com.sun.star.util.URL aURL ) {
+ }
+
+ public void showMessageBox(String sTitle, String sMessage) {
+ try {
+ if ( null != m_xFrame && null != m_xToolkit ) {
+
+ // describe window properties.
+ WindowDescriptor aDescriptor = new WindowDescriptor();
+ aDescriptor.Type = WindowClass.MODALTOP;
+ aDescriptor.WindowServiceName = new String( "infobox" );
+ aDescriptor.ParentIndex = -1;
+ aDescriptor.Parent = (XWindowPeer)UnoRuntime.queryInterface(
+ XWindowPeer.class, m_xFrame.getContainerWindow());
+ aDescriptor.Bounds = new Rectangle(0,0,300,200);
+ aDescriptor.WindowAttributes = WindowAttribute.BORDER |
+ WindowAttribute.MOVEABLE |
+ WindowAttribute.CLOSEABLE;
+
+ XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
+ if ( null != xPeer ) {
+ XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
+ XMessageBox.class, xPeer);
+ if ( null != xMsgBox )
+ {
+ xMsgBox.setCaptionText( sTitle );
+ xMsgBox.setMessageText( sMessage );
+ xMsgBox.execute();
+ }
+ }
+ }
+ } catch ( com.sun.star.uno.Exception e) {
+ // do your error handling
+ }
+ }
+ }
+
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the
+ * component.
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param stringImplementationName The implementation name of the component.
+ * @param xmultiservicefactory The service manager, who gives access to every
+ * known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {
+ XSingleComponentFactory xFactory = null;
+
+ if ( sImplementationName.equals( ProtocolHandlerAddonImpl.class.getName() ) )
+ xFactory = Factory.createComponentFactory(ProtocolHandlerAddonImpl.class,
+ ProtocolHandlerAddonImpl.getServiceNames());
+
+ return xFactory;
+ }
+
+ /** Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>.
+ * @return returns true if the operation succeeded
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @see com.sun.star.lib.uno.helper.Factory#
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ public static boolean __writeRegistryServiceInfo(
+ XRegistryKey xRegistryKey ) {
+ return Factory.writeRegistryServiceInfo(
+ ProtocolHandlerAddonImpl.class.getName(),
+ ProtocolHandlerAddonImpl.getServiceNames(),
+ xRegistryKey );
+ }
+}
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/Makefile b/odk/examples/DevelopersGuide/Components/CppComponent/Makefile
new file mode 100644
index 000000000000..0a4e7eee4cae
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/Makefile
@@ -0,0 +1,220 @@
+#*************************************************************************
+#
+# 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 C++ component example of the Developers Guide.
+
+PRJ=../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+SAMPLE_NAME=CppComponentSample
+SAMPLE_INC_OUT=$(OUT_INC)/$(SAMPLE_NAME)
+SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
+SAMPLE_SLO_OUT=$(OUT_SLO)/$(SAMPLE_NAME)
+SAMPLE_OBJ_OUT=$(OUT_OBJ)/$(SAMPLE_NAME)
+
+COMP_NAME=CppComponent
+COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT)
+
+APP1_NAME= TestCppComponent
+APP1_BINARY= $(OUT_BIN)/$(APP1_NAME)$(EXE_EXT)
+
+COMP_RDB_NAME = $(COMP_NAME).uno.rdb
+COMP_RDB = $(SAMPLE_GEN_OUT)/$(COMP_RDB_NAME)
+COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
+COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
+COMP_UNOPKG_MANIFEST = $(SAMPLE_GEN_OUT)/$(COMP_NAME)/META-INF/manifest.xml
+COMP_MAPFILE = $(SAMPLE_GEN_OUT)/$(COMP_NAME).uno.map
+
+COMP_REGISTERFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_register_component.flag
+COMP_TYPEFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_types.flag
+
+IDLFILES = some.idl
+
+CXXFILES = service1_impl.cxx \
+ service2_impl.cxx
+
+SLOFILES = $(patsubst %.cxx,$(SAMPLE_SLO_OUT)/%.$(OBJ_EXT),$(CXXFILES))
+
+GENURDFILES = $(patsubst %.idl,$(SAMPLE_GEN_OUT)/%.urd,$(IDLFILES))
+
+TYPELIST=-Tmy_module.XSomething \
+ -Tmy_modules.MyService1 \
+ -Tmy_module.MyService2
+
+# Targets
+.PHONY: ALL
+ALL : \
+ $(SAMPLE_NAME)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(SAMPLE_GEN_OUT)/%.urd : %.idl
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(IDLC) -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $<
+
+$(SAMPLE_GEN_OUT)/%.rdb : $(GENURDFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(REGMERGE) $@ /UCR $(GENURDFILES)
+
+$(COMP_TYPEFLAG) : $(COMP_RDB) $(SDKTYPEFLAG)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(CPPUMAKER) -Gc -BUCR -O$(SAMPLE_INC_OUT) $(TYPESLIST) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
+ echo flagged > $@
+
+$(SAMPLE_SLO_OUT)/%.$(OBJ_EXT) : %.cxx $(COMP_TYPEFLAG)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(SAMPLE_INC_OUT) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
+
+$(COMP_MAPFILE) : $(SLOFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE)
+ifeq "$(OS)" "MACOSX"
+ nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE)
+endif
+
+ifeq "$(OS)" "WIN"
+$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
+ $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
+ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \
+ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib
+ $(LINK_MANIFEST)
+else
+$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE)
+ -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
+ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB)
+ifeq "$(OS)" "MACOSX"
+ $(INSTALL_NAME_URELIBS) $@
+endif
+endif
+
+# rule for component package manifest
+$(SAMPLE_GEN_OUT)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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-typelibrary;type=RDB$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) $(COMP_RDB) $(COMP_UNOPKG_MANIFEST)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(UNOPKG_PLATFORM))
+ $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(UNOPKG_PLATFORM))
+ cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_RDB_NAME) $(UNOPKG_PLATFORM)/$(<F)
+ cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+
+
+$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
+ @echo flagged > $(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
+
+$(SAMPLE_OBJ_OUT)/$(APP1_NAME).$(OBJ_EXT) : $(APP1_NAME).cxx $(COMP_TYPEFLAG)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(SAMPLE_INC_OUT) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
+
+$(OUT_BIN)/_$(APP1_NAME)$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/$(APP1_NAME).$(OBJ_EXT)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
+ifeq "$(OS)" "WIN"
+ $(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(basename $(@F)).map \
+ $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)
+else
+ $(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
+ $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB)
+ifeq "$(OS)" "MACOSX"
+ $(INSTALL_NAME_URELIBS_BIN) $@
+endif
+endif
+
+$(OUT_BIN)/$(APP1_NAME)$(EXE_EXT) : $(OUT_BIN)/_$(APP1_NAME)$(EXE_EXT)
+ $(COPY) $(subst /,$(PS),$(BIN_DIR)/unoapploader$(EXE_EXT)) $(subst /,$(PS),$@)
+# touch the target to renew the date for correct dependencies.
+# Note: no touch under windows! The unoapploader.exe is copied always.
+ifneq "$(OS)" "WIN"
+ touch $@
+endif
+
+$(SAMPLE_NAME) : $(COMP_REGISTERFLAG) $(APP1_BINARY)
+ @echo --------------------------------------------------------------------------------
+ @echo Please use the following command to execute the example!
+ @echo -
+ @echo $(MAKE) $(APP1_NAME).run
+ @echo --------
+ @echo The simple C++ component was installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo You can use this component inside your office installation, see the example
+ @echo description. You can also load the "$(QM)SimpleComponent.odt$(QM)" document containing
+ @echo a StarBasic macro which uses this component.
+ @echo -
+ @echo $(MAKE) SimpleComponent.odt.load
+ @echo --------------------------------------------------------------------------------
+
+%.run: $(OUT_BIN)/%$(EXE_EXT)
+ $(subst /,$(PS),$(OUT_BIN))$(PS)$(basename $@)
+# cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@)
+
+SimpleComponent.odt.load : $(COMP_REGISTERFLAG)
+ "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_INC_OUT))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_SLO_OUT))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_OBJ_OUT))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/$(COMP_NAME)*))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/*$(APP1_NAME)*))
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/SimpleComponent.odt b/odk/examples/DevelopersGuide/Components/CppComponent/SimpleComponent.odt
new file mode 100644
index 000000000000..e8d7e9133284
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/SimpleComponent.odt
Binary files differ
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx
new file mode 100644
index 000000000000..93416f65c3e9
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#include <stdio.h>
+#include <sal/main.h>
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <my_module/MyService1.hpp>
+#include <my_module/MyService2.hpp>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+//namespace cssuno = ::com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::frame;
+
+SAL_IMPLEMENT_MAIN()
+{
+ try
+ {
+ // get the remote office component context
+ Reference< XComponentContext > xContext( ::cppu::bootstrap() );
+ fprintf(stdout, "\nconnected to a running office...\n");
+
+ // create a new instance of MyService1
+ Reference<my_module::XSomething> xSomething =
+ my_module::MyService1::create(xContext);
+
+ // call methodOne and print the return value on stdout
+ OUString s = xSomething->methodOne(OUString(RTL_CONSTASCII_USTRINGPARAM("Hello World!")));
+ fprintf(stdout,"\nCreate new instance of MyService1\nCall of XSomething.methOne at MyService1 = %s", OUStringToOString( s, RTL_TEXTENCODING_ASCII_US ).getStr());
+
+ // create a new instance of MyService2 with the specified string argument
+ xSomething = my_module::MyService2::create(xContext, OUString(RTL_CONSTASCII_USTRINGPARAM("Hello My World!")));
+
+ // call methodTwo and print the return value of methodTwo
+ s = xSomething->methodTwo();
+ fprintf(stdout, "\n\nCreate new instance of MyService2 with argument\nCall of XSomething.methTwo at MyService2 = %s", OUStringToOString( s, RTL_TEXTENCODING_ASCII_US ).getStr());
+
+ fprintf(stdout, "\n\nPlease press 'return' to finish the example!\n");
+ getchar();
+ }
+ catch ( ::cppu::BootstrapException & e )
+ {
+ fprintf(stderr, "\ncaught BootstrapException: %s\n",
+ OUStringToOString( e.getMessage(), RTL_TEXTENCODING_ASCII_US ).getStr());
+ return 1;
+ }
+ catch ( Exception & e )
+ {
+ fprintf(stderr, "\ncaught UNO exception: %s\n",
+ OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
new file mode 100644
index 000000000000..a3c13216066d
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
@@ -0,0 +1,309 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#include <osl/interlck.h>
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <my_module/XSomething.hpp>
+
+
+using namespace ::rtl; // for OUString
+using namespace ::com::sun::star; // for odk interfaces
+using namespace ::com::sun::star::uno; // for basic types
+
+namespace my_sc_impl
+{
+
+Sequence< OUString > SAL_CALL getSupportedServiceNames_MyService1Impl()
+{
+ Sequence< OUString > names(1);
+ names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("my_module.MyService1"));
+ return names;
+}
+
+OUString SAL_CALL getImplementationName_MyService1Impl()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.my_sc_implementation.MyService1") );
+}
+
+
+class MyService1Impl
+ : public ::my_module::XSomething
+ , public lang::XServiceInfo
+ , public lang::XTypeProvider
+{
+ oslInterlockedCount m_refcount;
+ OUString m_sData;
+ // it's good practise to store the context for further use when you use
+ // other UNO API's in your implementation
+ Reference< XComponentContext > m_xContext;
+public:
+ inline MyService1Impl(Reference< XComponentContext > const & xContext) throw ()
+ : m_refcount( 0 ),
+ m_xContext(xContext)
+ {}
+
+ virtual ~MyService1Impl() {}
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( Type const & type )
+ throw (RuntimeException);
+ virtual void SAL_CALL acquire()
+ throw ();
+ virtual void SAL_CALL release()
+ throw ();
+ // XTypeProvider
+ virtual Sequence< Type > SAL_CALL getTypes()
+ throw (RuntimeException);
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw (RuntimeException);
+ // XSomething
+ virtual OUString SAL_CALL methodOne( OUString const & str )
+ throw (RuntimeException);
+ virtual OUString SAL_CALL methodTwo( )
+ throw (RuntimeException);
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName )
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+};
+
+// XInterface implementation
+Any MyService1Impl::queryInterface( Type const & type )
+ throw (RuntimeException)
+{
+ if (type.equals(::cppu::UnoType< Reference< XInterface > >::get()))
+ {
+ // return XInterface interface
+ // (resolve ambiguity by casting to lang::XTypeProvider)
+ Reference< XInterface > x(
+ static_cast< lang::XTypeProvider * >( this ) );
+ return makeAny( x );
+ }
+ if (type.equals(::cppu::UnoType< Reference< lang::XTypeProvider > >::get()))
+ {
+ // return XInterface interface
+ Reference< XInterface > x(
+ static_cast< lang::XTypeProvider * >( this ) );
+ return makeAny( x );
+ }
+ if (type.equals(::cppu::UnoType< Reference< lang::XServiceInfo > >::get()))
+ {
+ // return XServiceInfo interface
+ Reference< lang::XServiceInfo > x(
+ static_cast< lang::XServiceInfo * >( this ) );
+ return makeAny( x );
+ }
+ if (type.equals(::cppu::UnoType< Reference< ::my_module::XSomething > >::get()))
+ {
+ // return sample interface
+ Reference< ::my_module::XSomething > x(
+ static_cast< ::my_module::XSomething * >( this ) );
+ return makeAny( x );
+ }
+ // querying for unsupported type
+ return Any();
+}
+
+void MyService1Impl::acquire()
+ throw ()
+{
+ // thread-safe incrementation of reference count
+ ::osl_incrementInterlockedCount( &m_refcount );
+}
+
+void MyService1Impl::release()
+ throw ()
+{
+ // thread-safe decrementation of reference count
+ if (0 == ::osl_decrementInterlockedCount( &m_refcount ))
+ {
+ delete this; // shutdown this object
+ }
+}
+
+// XTypeProvider implementation
+Sequence< Type > MyService1Impl::getTypes()
+ throw (RuntimeException)
+{
+ Sequence< Type > seq( 3 );
+ seq[ 0 ] = ::cppu::UnoType< Reference< lang::XTypeProvider > >::get();
+ seq[ 1 ] = ::cppu::UnoType< Reference< lang::XServiceInfo > >::get();
+ seq[ 2 ] = ::cppu::UnoType< Reference< ::my_module::XSomething > >::get();
+ return seq;
+}
+Sequence< sal_Int8 > MyService1Impl::getImplementationId()
+ throw (RuntimeException)
+{
+ static Sequence< sal_Int8 > * s_pId = 0;
+ if (! s_pId)
+ {
+ // create unique id
+ Sequence< sal_Int8 > id( 16 );
+ ::rtl_createUuid( (sal_uInt8 *)id.getArray(), 0, sal_True );
+ // guard initialization with some mutex
+ ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
+ if (! s_pId)
+ {
+ static Sequence< sal_Int8 > s_id( id );
+ s_pId = &s_id;
+ }
+ }
+ return *s_pId;
+}
+
+// XSomething implementation
+OUString MyService1Impl::methodOne( OUString const & str )
+ throw (RuntimeException)
+{
+ m_sData = str;
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "called methodOne() of MyService1 implementation: ") ) + m_sData;
+}
+
+OUString MyService1Impl::methodTwo( )
+ throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "called methodTwo() of MyService1 implementation: ") ) + m_sData;
+}
+
+// XServiceInfo implementation
+OUString MyService1Impl::getImplementationName()
+ throw (RuntimeException)
+{
+ // unique implementation name
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.my_sc_implementation.MyService1") );
+}
+sal_Bool MyService1Impl::supportsService( OUString const & serviceName )
+ throw (RuntimeException)
+{
+ // this object only supports one service, so the test is simple
+ return serviceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "my_module.MyService1") );
+}
+Sequence< OUString > MyService1Impl::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ // this object only supports one service
+ OUString serviceName( RTL_CONSTASCII_USTRINGPARAM("my_module.MyService1") );
+ return Sequence< OUString >( &serviceName, 1 );
+}
+
+Reference< XInterface > SAL_CALL create_MyService1Impl(
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( () )
+{
+ return static_cast< lang::XTypeProvider * >( new MyService1Impl( xContext) );
+}
+
+// forward decl: implemented in service2_impl.cxx
+Reference< XInterface > SAL_CALL create_MyService2Impl(
+ Reference< XComponentContext > const & ) SAL_THROW( () );
+
+}
+
+/*
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ sal_Char const ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(
+ lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry )
+{
+ if (xRegistry)
+ {
+ try
+ {
+ // implementation of MyService1A
+ Reference< registry::XRegistryKey > xKey(
+ xRegistry->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.my_sc_implementation.MyService1/UNO/SERVICES") ) ) );
+ // subkeys denote implemented services of implementation
+ xKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.MyService1") ) );
+ // implementation of MyService1B
+ xKey = xRegistry->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.my_sc_implementation.MyService2/UNO/SERVICES") ) );
+ // subkeys denote implemented services of implementation
+ xKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.MyService2") ) );
+ return sal_True; // success
+ }
+ catch (registry::InvalidRegistryException &)
+ {
+ // function fails if exception caught
+ }
+ }
+ return sal_False;
+}
+extern "C" void * SAL_CALL component_getFactory(
+ sal_Char const * implName, lang::XMultiServiceFactory * xMgr, void * )
+{
+ Reference< lang::XSingleComponentFactory > xFactory;
+ if (0 == ::rtl_str_compare( implName, "my_module.my_sc_implementation.MyService1" ))
+ {
+ // create component factory for MyService1 implementation
+ OUString serviceName( RTL_CONSTASCII_USTRINGPARAM("my_module.MyService1") );
+ xFactory = ::cppu::createSingleComponentFactory(
+ ::my_sc_impl::create_MyService1Impl,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("my_module.my_sc_implementation.MyService1") ),
+ Sequence< OUString >( &serviceName, 1 ) );
+ }
+ else if (0 == ::rtl_str_compare( implName, "my_module.my_sc_implementation.MyService2" ))
+ {
+ // create component factory for MyService12 implementation
+ OUString serviceName( RTL_CONSTASCII_USTRINGPARAM("my_module.MyService2") );
+ xFactory = ::cppu::createSingleComponentFactory(
+ ::my_sc_impl::create_MyService2Impl,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("my_module.my_sc_implementation.MyService2") ),
+ Sequence< OUString >( &serviceName, 1 ) );
+ }
+ if (xFactory.is())
+ xFactory->acquire();
+ return xFactory.get(); // return acquired interface pointer or null
+}
+*/
+
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
new file mode 100644
index 000000000000..8589f8e88ab7
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#include <cppuhelper/implbase3.hxx> // "3" implementing three interfaces
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <my_module/XSomething.hpp>
+
+
+using namespace ::rtl; // for OUString
+using namespace ::com::sun::star; // for odk interfaces
+using namespace ::com::sun::star::uno; // for basic types
+
+
+namespace my_sc_impl
+{
+
+extern Sequence< OUString > SAL_CALL getSupportedServiceNames_MyService1Impl();
+extern OUString SAL_CALL getImplementationName_MyService1Impl();
+extern Reference< XInterface > SAL_CALL create_MyService1Impl(
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( () );
+
+static Sequence< OUString > getSupportedServiceNames_MyService2Impl()
+{
+ Sequence<OUString> names(1);
+ names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("my_module.MyService2"));
+ return names;
+}
+
+static OUString getImplementationName_MyService2Impl()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.my_sc_implementation.MyService2") );
+}
+
+class MyService2Impl : public ::cppu::WeakImplHelper3<
+ ::my_module::XSomething, lang::XServiceInfo, lang::XInitialization >
+{
+ OUString m_sData;
+ // it's good practise to store the context for further use when you use
+ // other UNO API's in your implementation
+ Reference< XComponentContext > m_xContext;
+public:
+ inline MyService2Impl(Reference< XComponentContext > const & xContext) throw ()
+ : m_xContext(xContext)
+ {}
+
+ virtual ~MyService2Impl() {}
+
+ // focus on three given interfaces,
+ // no need to implement XInterface, XTypeProvider, XWeak
+
+ // XInitialization will be called upon
+ // createInstanceWithArguments[AndContext]()
+ virtual void SAL_CALL initialize( Sequence< Any > const & args )
+ throw (Exception);
+ // XSomething
+ virtual OUString SAL_CALL methodOne( OUString const & str )
+ throw (RuntimeException);
+ virtual OUString SAL_CALL methodTwo( )
+ throw (RuntimeException);
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName )
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+};
+
+// XInitialization implemention
+void MyService2Impl::initialize( Sequence< Any > const & args )
+ throw (Exception)
+{
+ if (args.getLength() != 1)
+ {
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "give a string instanciating this component!") ),
+ // resolve to XInterface reference:
+ static_cast< ::cppu::OWeakObject * >(this),
+ 0 ); // argument pos
+ }
+ if (! (args[ 0 ] >>= m_sData))
+ {
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "no string given as argument!") ),
+ // resolve to XInterface reference:
+ static_cast< ::cppu::OWeakObject * >(this),
+ 0 ); // argument pos
+ }
+}
+
+// XSomething implementation
+OUString MyService2Impl::methodOne( OUString const & str )
+ throw (RuntimeException)
+{
+ m_sData = str;
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "called methodOne() of MyService2 implementation: ") ) + m_sData;
+}
+
+OUString MyService2Impl::methodTwo( )
+ throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "called methodTwo() of MyService2 implementation: ") ) + m_sData;
+}
+
+// XServiceInfo implementation
+OUString MyService2Impl::getImplementationName()
+ throw (RuntimeException)
+{
+ // unique implementation name
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "my_module.my_sc_implementation.MyService2") );
+}
+
+sal_Bool MyService2Impl::supportsService( OUString const & serviceName )
+ throw (RuntimeException)
+{
+ // this object only supports one service, so the test is simple
+ return serviceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "my_module.MyService2") );
+}
+
+Sequence< OUString > MyService2Impl::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return getSupportedServiceNames_MyService2Impl();
+}
+
+Reference< XInterface > SAL_CALL create_MyService2Impl(
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( () )
+{
+ return static_cast< ::cppu::OWeakObject * >( new MyService2Impl( xContext ) );
+}
+
+}
+
+/* shared lib exports implemented without helpers in service_impl1.cxx */
+namespace my_sc_impl
+{
+static struct ::cppu::ImplementationEntry s_component_entries [] =
+{
+ {
+ create_MyService1Impl, getImplementationName_MyService1Impl,
+ getSupportedServiceNames_MyService1Impl,
+ ::cppu::createSingleComponentFactory,
+ 0, 0
+ },
+ {
+ create_MyService2Impl, getImplementationName_MyService2Impl,
+ getSupportedServiceNames_MyService2Impl,
+ ::cppu::createSingleComponentFactory,
+ 0, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
+}
+
+extern "C"
+{
+void SAL_CALL component_getImplementationEnvironment(
+ sal_Char const ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+sal_Bool SAL_CALL component_writeInfo(
+ lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry )
+{
+ return ::cppu::component_writeInfoHelper(
+ xMgr, xRegistry, ::my_sc_impl::s_component_entries );
+}
+
+void * SAL_CALL component_getFactory(
+ sal_Char const * implName, lang::XMultiServiceFactory * xMgr,
+ registry::XRegistryKey * xRegistry )
+{
+ return ::cppu::component_getFactoryHelper(
+ implName, xMgr, xRegistry, ::my_sc_impl::s_component_entries );
+}
+
+}
+
+
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/some.idl b/odk/examples/DevelopersGuide/Components/CppComponent/some.idl
new file mode 100644
index 000000000000..342f03560a93
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/some.idl
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+
+module my_module
+{
+
+ interface XSomething
+ {
+ string methodOne( [in] string val );
+ string methodTwo();
+ };
+
+ service MyService1 : XSomething;
+
+ service MyService2 : XSomething
+ {
+ create([in]string sArgument)
+ raises (::com::sun::star::lang::IllegalArgumentException);
+ };
+};
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile b/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile
new file mode 100644
index 000000000000..55f8cbc12425
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile
@@ -0,0 +1,204 @@
+#*************************************************************************
+#
+# 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 SpreadSheet examples of the Developers Guide.
+
+PRJ=../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+
+COMPONENT_NAME=JavaComponent
+OUT_COMP_CLASS = $(OUT_CLASS)/$(COMPONENT_NAME)
+OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME)
+COMPONENT_RDB_NAME = $(COMPONENT_NAME).uno.rdb
+COMPONENT_RDB = $(OUT_COMP_GEN)/$(COMPONENT_RDB_NAME)
+COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT)
+COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
+COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar
+COMPONENT_JAR = $(OUT_COMP_CLASS)/$(COMPONENT_JAR_NAME)
+COMPONENT_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest
+COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml
+APP1_NAME=TestJavaComponent
+APP1_JAR=$(OUT_COMP_CLASS)/$(APP1_NAME).jar
+
+REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMPONENT_NAME)_register_component.flag
+
+IDLFILES = XSomethingA.idl \
+ XSomethingB.idl \
+ SomethingA.idl \
+ SomethingB.idl
+
+# normally the idl file should be stored in a directory tree fitting the module
+# structure, for the example we know the module structure
+PACKAGE = com/sun/star/test
+
+COMPJAVAFILES = \
+ TestComponentA.java \
+ TestComponentB.java \
+ TestServiceProvider.java
+
+GENCLASSFILES = $(patsubst %.idl,$(OUT_COMP_CLASS)/$(PACKAGE)/%.class,$(IDLFILES))
+GENCLASSNAMES = $(patsubst %.idl,$(PACKAGE)/%.class,$(IDLFILES))
+GENTYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
+GENURDFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/%.urd,$(IDLFILES))
+
+COMPCLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(COMPJAVAFILES))
+
+$(COMPONENT_NAME)_CLASSFILES = $(patsubst %.java,%.class,$(COMPJAVAFILES))
+
+$(COMPONENT_NAME)_CLASSFILES += $(subst $(OUT_COMP_CLASS)/,,$(GENCLASSFILES))
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
+
+
+# Targets
+.PHONY: ALL
+ALL : \
+ JavaComponentExample
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMP_CLASS)/%.Manifest :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
+ @echo RegistrationClassName: TestServiceProvider>> $@
+
+$(OUT_COMP_GEN)/%.urd : %.idl
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(IDLC) -I. -I$(IDL_DIR) -O$(OUT_COMP_GEN) $^
+
+$(OUT_COMP_GEN)/%.rdb : $(GENURDFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(REGMERGE) $@ /UCR $(GENURDFILES)
+
+$(OUT_COMP_CLASS)/$(PACKAGE)/%.class : $(COMPONENT_RDB)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMPONENT_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
+
+$(OUT_COMP_CLASS)/%.class : %.java $(GENCLASSFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $<
+
+$(COMPCLASSFILES) : $(COMPJAVAFILES) $(GENCLASSFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(COMPJAVAFILES)
+
+# rule for client/example application manifest file
+$(OUT_COMP_CLASS)/%.mf :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo Main-Class: com.sun.star.lib.loader.Loader> $@
+ $(ECHOLINE)>> $@
+ @echo Name: com/sun/star/lib/loader/Loader.class>> $@
+ @echo Application-Class: $*>> $@
+
+# rule for client/example application jar file
+# Note that the example needs the component files as well for local usage
+$(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(APP1_NAME).class $(COMPCLASSFILES) $(GENCLASSFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ +cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(basename $(@F)).class $($(COMPONENT_NAME)_CLASSFILES)
+ +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
+
+# rule for component jar file
+$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(COMPCLASSFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
+
+# rule for component package manifest
+$(OUT_COMP_CLASS)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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-typelibrary;type=RDB$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component pacakge file
+$(COMPONENT_PACKAGE) : $(COMPONENT_RDB) $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(COPY) $(subst /,$(PS),$(COMPONENT_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS))
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(COMPONENT_RDB_NAME) $(COMPONENT_JAR_NAME)
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+ $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_COMP_CLASS)/$(COMPONENT_RDB_NAME)))
+
+$(REGISTERFLAG) : $(COMPONENT_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
+ @echo flagged > $(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
+
+JavaComponentExample : $(REGISTERFLAG) $(APP1_JAR)
+ @echo --------------------------------------------------------------------------------
+ @echo Please use one of the following commands to execute the examples!
+ @echo -
+ @echo $(MAKE) $(APP1_NAME).run
+ @echo $(MAKE) $(APP1_NAME).local
+ @echo --------
+ @echo The Java components were installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo You can use this component inside your office installation, see the
+ @echo example description.
+ @echo --------------------------------------------------------------------------------
+
+%.run: $(OUT_COMP_CLASS)/%.jar
+ $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
+
+%.local: $(OUT_COMP_CLASS)/%.jar
+ $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< local
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl
new file mode 100644
index 000000000000..a98a3047dba6
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef INCLUDED_COM_SUN_STAR_TEST_SOMETHINGA_IDL
+#define INCLUDED_COM_SUN_STAR_TEST_SOMETHINGA_IDL
+
+#include <XSomethingA.idl>
+
+module com { module sun { module star { module test {
+ service SomethingA: XSomethingA;
+}; }; }; };
+
+#endif
+
+
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl
new file mode 100644
index 000000000000..0281ba751794
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef INCLUDED_COM_SUN_STAR_TEST_SOMETHINGB_IDL
+#define INCLUDED_COM_SUN_STAR_TEST_SOMETHINGB_IDL
+
+#include <XSomethingB.idl>
+
+module com { module sun { module star { module test {
+ service SomethingB : XSomethingB;
+}; }; }; };
+
+#endif
+
+
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java
new file mode 100644
index 000000000000..540328e2bff2
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.test.XSomethingA;
+import com.sun.star.uno.Type;
+
+// TestComponentA use the implementation helper WeakBase
+public class TestComponentA extends WeakBase implements XServiceInfo, XSomethingA {
+ static final String __serviceName= "com.sun.star.test.SomethingA";
+
+ static byte[] _implementationId;
+
+ public TestComponentA() {
+ }
+
+ // XSomethingA
+ public String methodOne(String val) {
+ return val;
+ }
+
+ //XServiceInfo
+ public String getImplementationName( ) {
+ return getClass().getName();
+ }
+ // XServiceInfo
+ public boolean supportsService( /*IN*/String serviceName ) {
+ if ( serviceName.equals( __serviceName))
+ return true;
+ return false;
+ }
+ //XServiceInfo
+ public String[] getSupportedServiceNames( ) {
+ String[] retValue= new String[0];
+ retValue[0]= __serviceName;
+ return retValue;
+ }
+
+}
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java
new file mode 100644
index 000000000000..006cdceedb2c
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.test.XSomethingB;
+import com.sun.star.uno.Type;
+
+// TestComponentB implements all necessary interfaces self, this is only
+// for demonstration. More convenient is to use the impelmentation WeakBase or
+// ComponentBase, see implementation of TestComponentA.
+public class TestComponentB implements XTypeProvider, XServiceInfo, XSomethingB {
+ static final String __serviceName= "com.sun.star.test.SomethingB";
+
+ static byte[] _implementationId;
+ private XComponentContext context;
+ private Object[] args;
+
+ public TestComponentB(XComponentContext context, Object[] args) {
+ this.context= context;
+ this.args= args;
+ }
+
+ // XSomethingB
+ public String methodTwo(String val) {
+ if (args.length > 0 && args[0] instanceof String )
+ return (String) args[0];
+ return val;
+ }
+
+ //XTypeProvider
+ public com.sun.star.uno.Type[] getTypes( ) {
+ Type[] retValue= new Type[3];
+ retValue[0]= new Type( XServiceInfo.class);
+ retValue[1]= new Type( XTypeProvider.class);
+ retValue[2]= new Type( XSomethingB.class);
+ return retValue;
+ }
+ //XTypeProvider
+ synchronized public byte[] getImplementationId( ) {
+ if (_implementationId == null) {
+ _implementationId= new byte[16];
+ int hash = hashCode();
+ _implementationId[0] = (byte)(hash & 0xff);
+ _implementationId[1] = (byte)((hash >>> 8) & 0xff);
+ _implementationId[2] = (byte)((hash >>> 16) & 0xff);
+ _implementationId[3] = (byte)((hash >>>24) & 0xff);
+ }
+ return _implementationId;
+ }
+
+ //XServiceInfo
+ public String getImplementationName( ) {
+ return getClass().getName();
+ }
+
+ // XServiceInfo
+ public boolean supportsService( /*IN*/String serviceName ) {
+ if ( serviceName.equals( __serviceName))
+ return true;
+ return false;
+ }
+ //XServiceInfo
+ public String[] getSupportedServiceNames( ) {
+ String[] retValue= new String[0];
+ retValue[0]= __serviceName;
+ return retValue;
+ }
+}
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java
new file mode 100644
index 000000000000..ab07ccc4564e
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.comp.helper.Bootstrap;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.test.XSomethingB;
+import com.sun.star.test.SomethingB;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.container.XSet;
+
+// sample starbasic code, you can execute it after you have connected to the office.
+// Sub Main
+// o = createUnoService( "com.sun.star.test.SomethingB" )
+// msgbox o.methodOne( "from the office !" )
+// End Sub
+
+public class TestJavaComponent
+{
+
+ public static void insertIntoServiceManager(
+ XMultiComponentFactory serviceManager, Object singleFactory )
+ throws com.sun.star.uno.Exception
+ {
+ XSet set = (XSet ) UnoRuntime.queryInterface( XSet.class, serviceManager );
+ set.insert( singleFactory );
+ }
+
+ public static void removeFromServiceManager(
+ XMultiComponentFactory serviceManager, Object singleFactory )
+ throws com.sun.star.uno.Exception
+ {
+ XSet set = (XSet ) UnoRuntime.queryInterface( XSet.class, serviceManager );
+ set.remove( singleFactory );
+
+ }
+
+ public static void main(String[] args) throws java.lang.Exception
+ {
+ try {
+ boolean bLocal = false;
+
+ XMultiComponentFactory xUsedServiceManager = null;
+ XComponentContext xUsedComponentContext = null;
+
+ if( args.length == 1 && args[0].equals( "local" ))
+ {
+ XComponentContext xLocalComponentContext =
+ Bootstrap.createInitialComponentContext( null );
+
+ // initial serviceManager
+ XMultiComponentFactory xLocalServiceManager =
+ xLocalComponentContext.getServiceManager();
+
+ bLocal = true;
+ xUsedServiceManager = xLocalServiceManager;
+ xUsedComponentContext = xLocalComponentContext;
+
+ System.out.println( "Using local servicemanager" );
+ } else {
+ // get the remote office component context
+ xUsedComponentContext =
+ com.sun.star.comp.helper.Bootstrap.bootstrap();
+ System.out.println("Connected to a running office ...");
+
+ xUsedServiceManager = xUsedComponentContext.getServiceManager();
+ System.out.println( "Using remote servicemanager" );
+ }
+
+ if ( xUsedServiceManager == null )
+ {
+ System.out.println( "ERROR: no service manager" );
+ System.exit(0);
+ }
+
+ Object factory = new Object();
+ if ( bLocal )
+ {
+ // retrieve the factory for the component implementation
+ factory = TestServiceProvider.__getServiceFactory(
+ "TestComponentB", null, null);
+
+ // insert the factory into the local servicemanager
+ // From now on, the service can be instantiated !
+ insertIntoServiceManager( xUsedServiceManager, factory );
+ }
+
+ XSomethingB xSomethingB = SomethingB.create(xUsedComponentContext);
+
+ // and call the test method.
+ String s= xSomethingB.methodTwo("Hello World!");
+ System.out.println(s);
+
+ if ( bLocal )
+ {
+ // remove it again from the servicemanager,
+ removeFromServiceManager( xUsedServiceManager, factory );
+ }
+
+ }
+ catch ( Exception e )
+ {
+ System.out.println( "UNO Exception caught: " + e );
+ System.out.println( "Message: " + e.getMessage() );
+ e.printStackTrace(System.out);
+ }
+
+ // quit, even when a remote bridge is running
+ System.exit(0);
+ }
+}
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java
new file mode 100644
index 000000000000..dee8899510e4
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.comp.loader.FactoryHelper;
+
+public class TestServiceProvider
+{
+ public static XSingleServiceFactory __getServiceFactory(
+ String implName,
+ XMultiServiceFactory multiFactory,
+ XRegistryKey regKey) {
+ XSingleServiceFactory xSingleServiceFactory = null;
+
+ if (implName.equals( TestComponentA.class.getName()) )
+ xSingleServiceFactory = FactoryHelper.getServiceFactory(
+ TestComponentA.class, TestComponentA.__serviceName,
+ multiFactory, regKey);
+ else if (implName.equals(TestComponentB.class.getName()))
+ xSingleServiceFactory= FactoryHelper.getServiceFactory(
+ TestComponentB.class, TestComponentB.__serviceName,
+ multiFactory, regKey);
+ return xSingleServiceFactory;
+ }
+
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey){
+ boolean bregA= FactoryHelper.writeRegistryServiceInfo(
+ TestComponentA.class.getName(),
+ TestComponentA.__serviceName, regKey);
+ boolean bregB= FactoryHelper.writeRegistryServiceInfo(
+ TestComponentB.class.getName(),
+ TestComponentB.__serviceName, regKey);
+ return bregA && bregB;
+ }
+}
+
+
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl
new file mode 100644
index 000000000000..f353cd3c7d98
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGA_IDL
+#define INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGA_IDL
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com { module sun { module star { module test {
+ interface XSomethingA {
+ string methodOne([in]string value);
+ };
+}; }; }; };
+
+#endif
+
+
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl
new file mode 100644
index 000000000000..a06532c3ad48
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGB_IDL
+#define INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGB_IDL
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com { module sun { module star { module test {
+ interface XSomethingB {
+ string methodTwo([in]string value);
+ };
+}; }; }; };
+
+#endif
+
+
diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl
new file mode 100644
index 000000000000..f93cb2279358
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _org_openoffice_LicenseTest_idl_
+#define _org_openoffice_LicenseTest_idl_
+
+#include <com/sun/star/lang/XServiceInfo.idl>
+
+// org
+module org {
+ // openoffice
+ module openoffice {
+ // example service, XServiceInfo is implemented here for demonstration
+ // issues. XServiceInfo must be implemented by all components.
+ service LicenseTest: ::com::sun::star::lang::XServiceInfo;
+ };
+};
+
+#endif
diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java
new file mode 100644
index 000000000000..211638c46c58
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.Type;
+
+/** This class capsulates the class, that implements the minimal component, a
+ * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
+ * method, that writes the information into the given registry key
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ */
+public class LicenseTest {
+ /** This class implements the component. At least the interfaces XServiceInfo,
+ * XTypeProvider, and XInitialization should be provided by the service.
+ */
+ public static class _LicenseTest extends WeakBase
+ implements XServiceInfo {
+ /** The service name, that must be used to get an instance of this service.
+ */
+ static private final String __serviceName =
+ "org.openoffice.LicenseTest";
+
+ /** The initial component contextr, that gives access to
+ * the service manager, supported singletons, ...
+ * It's often later used
+ */
+ private XComponentContext m_cmpCtx;
+
+ /** The service manager, that gives access to all registered services.
+ * It's often later used
+ */
+ private XMultiComponentFactory m_xMCF;
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public _LicenseTest(XComponentContext xCompContext) {
+ try {
+ m_cmpCtx = xCompContext;
+ m_xMCF = m_cmpCtx.getServiceManager();
+ }
+ catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /** This method returns an array of all supported service names.
+ * @return Array of supported service names.
+ */
+ public String[] getSupportedServiceNames() {
+ return getServiceNames();
+ }
+
+ /** This method is a simple helper function to used in the
+ * static component initialisation functions as well as in
+ * getSupportedServiceNames.
+ */
+ public static String[] getServiceNames() {
+ String[] sSupportedServiceNames = { __serviceName };
+ return sSupportedServiceNames;
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param sServiceName Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService( String sServiceName ) {
+ return sServiceName.equals( __serviceName );
+ }
+
+ /** Return the class name of the component.
+ * @return Class name of the component.
+ */
+ public String getImplementationName() {
+ return _LicenseTest.class.getName();
+ }
+ }
+
+
+ /**
+ * Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns a <code>XSingleComponentFactory</code> for creating
+ * the component
+ * @param sImplName the name of the implementation for which a
+ * service is desired
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static XSingleComponentFactory __getComponentFactory(String sImplName)
+ {
+ XSingleComponentFactory xFactory = null;
+
+ if ( sImplName.equals( _LicenseTest.class.getName() ) )
+ xFactory = Factory.createComponentFactory(_LicenseTest.class,
+ _LicenseTest.getServiceNames());
+
+ return xFactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns true if the operation succeeded
+ * @param regKey the registryKey
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ return Factory.writeRegistryServiceInfo(_LicenseTest.class.getName(),
+ _LicenseTest.getServiceNames(),
+ regKey);
+ }
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @throws Exception Every exception will not be handled, but will be
+ * passed to the caller.
+ */
+ public void initialize( Object[] object )
+ throws com.sun.star.uno.Exception {
+ /* The component describes what arguments its expected and in which
+ * order!At this point you can read the objects and can intialize
+ * your component using these objects.
+ */
+ }
+
+}
diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile b/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile
new file mode 100644
index 000000000000..976de2d07b40
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile
@@ -0,0 +1,170 @@
+#*************************************************************************
+#
+# 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 License Test component example of the SDK.
+
+PRJ=../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+
+# we use the sample directory name dor separating this example
+# from others in the output directory
+SAMPLE_NAME=LicenseTest
+SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
+SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
+
+COMP_NAME=LicenseTest
+COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME)
+COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
+COMP_RDB_NAME=$(COMP_NAME).uno.rdb
+COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_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=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME)
+COMP_JAR_MANIFEST=$(COMP_GEN_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_LOCAL_FILES = description.xml registration/license_de.txt registration/license_en_US.txt
+
+IDLFILES = LicenseTest.idl
+
+# normally the idl file should be stored in a directory tree fitting the module structure,
+# for the example we know the module structure
+PACKAGE = org/openoffice
+
+COMP_JAVAFILES = LicenseTest.java
+COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
+
+GEN_CLASSFILES = $(patsubst %.idl,$(SAMPLE_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES))
+GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
+GEN_URDFILES = $(patsubst %.idl,$(SAMPLE_GEN_OUT)/%.urd,$(IDLFILES))
+
+# the generated types are necessary for the component and the application jar
+GEN_CLASSFILENAMES = $(subst $(SAMPLE_CLASS_OUT)/,,$(GEN_CLASSFILES))
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
+ $(PATH_SEPARATOR)$(COMP_CLASS_OUT)\
+ $(PATH_SEPARATOR)$(APP1_CLASS_OUT))
+
+
+# Targets
+.PHONY: ALL
+ALL : JavaLicenseTestExample
+
+include $(SETTINGS)/stdtarget.mk
+
+$(COMP_GEN_OUT)/%.Manifest :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
+ @echo RegistrationClassName: $(basename $*)>> $@
+
+$(SAMPLE_GEN_OUT)/%.urd : %.idl
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(IDLC) -C -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $<
+
+$(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(REGMERGE) $@ /UCR $(GEN_URDFILES)
+
+$(GEN_CLASSFILES) : $(COMP_RDB)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(SAMPLE_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
+
+# component as well as application are dependent from the generated types
+# rule for component class files
+$(COMP_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $<
+
+# rule for component jar file
+$(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) .
+ +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES)
+
+# rule for component package manifest
+$(COMP_GEN_OUT)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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-typelibrary;type=RDB$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_LOCAL_FILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME)
+ cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
+ cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+ $(SDK_ZIP) -u $@ $(COMP_LOCAL_FILES)
+
+$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
+ @echo flagged > $(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
+
+JavaLicenseTestExample : $(COMP_REGISTERFLAG)
+ @echo --------------------------------------------------------------------------------
+ @echo The $(COMP_NAME) component was installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo This extension demonstrates the $(QM)Simple License$(QM) feature.
+ @echo --------------------------------------------------------------------------------
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml b/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml
new file mode 100644
index 000000000000..aa465ab8d288
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description xmlns="http://openoffice.org/extensions/description/2006"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <registration>
+ <simple-license accept-by="admin" default-license-id="de">
+ <license-text xlink:href="registration/license_de.txt" lang="de" license-id="de" />
+ <license-text xlink:href="registration/license_en_US.txt" lang="en-US" />
+ </simple-license>
+ </registration>
+</description>
+
diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_de.txt b/odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_de.txt
new file mode 100644
index 000000000000..6deedf8b44d4
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_de.txt
@@ -0,0 +1 @@
+Eine ganz kurze Lizenz. \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_en_US.txt b/odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_en_US.txt
new file mode 100644
index 000000000000..127a4569b377
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/registration/license_en_US.txt
@@ -0,0 +1 @@
+A very short license. \ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/Makefile b/odk/examples/DevelopersGuide/Components/Thumbs/Makefile
new file mode 100644
index 000000000000..6dffc4cbad7a
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/Makefile
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# 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 Comonent Thumbs of the Developers Guide.
+
+PRJ=../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+include thumbs.mk
+
+SUBDIRS= org/openoffice/test org/openoffice/comp/test
+
+# Targets
+.PHONY: ALL
+ALL : \
+ $(SUBDIRS) \
+ ComponentsThumbsExample
+
+include $(SETTINGS)/stdtarget.mk
+
+.PHONY : $(SUBDIRS)
+$(SUBDIRS) :
+ $(MAKE) -C $@
+
+org/openoffice/comp/test : org/openoffice/test
+
+ComponentsThumbsExample : $(COMPONENT_PACKAGE)
+ @echo --------------------------------------------------------------------------------
+ @echo Please use one of the following command to execute the example!
+ @echo -
+ @echo $(MAKE) $(APP1_NAME).run
+ @echo --------
+ @echo The ImageShrink Java component was installed if SDK_AUTO_DEPLOYMENT = YES.
+ @echo You can use this component inside your office installation, see the example
+ @echo description.
+ @echo --------------------------------------------------------------------------------
+
+%.run: $(OUT_COMP_CLASS)/%.jar
+ $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
+
+.PHONY: clean
+clean :
+ $(MAKE) -C org/openoffice/test clean
+ $(MAKE) -C org/openoffice/comp/test clean
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java
new file mode 100644
index 000000000000..7fe4307d8a80
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+package org.openoffice.comp.test;
+
+
+/*
+ * ImageShrink.java
+ *
+ * Created on 4. Mai 2002, 20:25
+ */
+
+
+/**
+ *
+ * @author dschulten
+ */
+
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lib.uno.helper.WeakBase;
+
+public class ImageShrink extends WeakBase
+ implements com.sun.star.lang.XServiceInfo,
+ org.openoffice.test.XImageShrinkFilter {
+
+ com.sun.star.uno.XComponentContext xComponentContext = null;
+
+
+ // maintain a static implementation id for all instances of ImageShrink
+ // initialized by the first call to getImplementationId()
+ static byte[] _implementationId;
+
+
+ // hold the service name in a private static member variable of the class
+ protected static final String __serviceName = "org.openoffice.test.ImageShrink";
+
+
+ String destDir = "";
+ String sourceDir = "";
+ boolean cancel = false;
+ com.sun.star.awt.Size dimension = new com.sun.star.awt.Size();
+
+ /** Creates a new instance of ImageShrink */
+ public ImageShrink() {
+ }
+
+
+ // static __getServiceFactory() Implementation
+ public static XSingleServiceFactory __getServiceFactory(String implName,
+ XMultiServiceFactory multiFactory,
+ com.sun.star.registry.XRegistryKey regKey) {
+
+ com.sun.star.lang.XSingleServiceFactory xSingleServiceFactory = null;
+ if (implName.equals( ImageShrink.class.getName()) )
+ xSingleServiceFactory = FactoryHelper.getServiceFactory( ImageShrink.class,
+ ImageShrink.__serviceName,
+ multiFactory,
+ regKey);
+
+ return xSingleServiceFactory;
+ }
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ //System.out.println(ImageShrink.class.getName());
+ return FactoryHelper.writeRegistryServiceInfo( ImageShrink.class.getName(),
+ __serviceName,
+ regKey);
+ }
+
+ // XFilter implementation (a sub-interface of XImageShrinkFilter)
+ public void cancel() {
+ cancel = true;
+ }
+
+ public boolean filter(com.sun.star.beans.PropertyValue[] propertyValue) {
+ // while cancel = false,
+ // scale images found in sourceDir according to dimension and
+ // write them to destDir, using the image file format given in
+
+
+ // []propertyValue
+ return true;
+ }
+
+ // XImageShrink implementation (a sub-interface of XImageShrinkFilter)
+ public String getDestinationDirectory() {
+ return destDir;
+ }
+
+ public com.sun.star.awt.Size getDimension() {
+ return dimension;
+ }
+
+ public String getSourceDirectory() {
+ return sourceDir;
+ }
+
+ public void setDestinationDirectory(String str) {
+ destDir = str;
+ }
+
+ public void setDimension(com.sun.star.awt.Size size) {
+ dimension = size;
+ }
+
+ public void setSourceDirectory(String str) {
+ sourceDir = str;
+ }
+
+ //XServiceInfo implementation
+ public String getImplementationName( ) {
+ return getClass().getName();
+ }
+
+ public boolean supportsService(String serviceName) {
+ if ( serviceName.equals( __serviceName))
+ return true;
+ return false;
+ }
+
+ public String[] getSupportedServiceNames( ) {
+ return new String[] { __serviceName };
+ }
+
+}
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile
new file mode 100644
index 000000000000..2b990e22ae2e
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile
@@ -0,0 +1,128 @@
+#*************************************************************************
+#
+# 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 SpreadSheet examples of the Developers Guide.
+
+PRJ=../../../../../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+include ../../../../thumbs.mk
+
+# Define non-platform/compiler specific settings
+PACKAGE = org/openoffice/comp/test
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
+
+
+# Targets
+.PHONY: ALL
+ALL : $(REGISTERFLAG) \
+ $(APP1_JAR)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMP_CLASS)/%.Manifest :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
+ @echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(basename $(basename $(@F)))>> $@
+
+$(OUT_COMP_CLASS)/$(PACKAGE)/%.class : %.java
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $<
+
+$(OUT_COMP_CLASS)/%.mf :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo Main-Class: com.sun.star.lib.loader.Loader> $@
+ $(ECHOLINE)>> $@
+ @echo Name: com/sun/star/lib/loader/Loader.class>> $@
+ @echo Application-Class: $(subst /,.,$(PACKAGE)).$*>> $@
+
+# rule for component jar file
+$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(OUT_COMP_CLASS)/$(PACKAGE)/$(COMPONENT_NAME).class
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) $(PACKAGE)/$(basename $(basename $(@F))).class $(patsubst %.class,-C $(OUT_COMP_CLASS) %.class,$(GENCLASSNAMES))
+
+# rule for component package manifest
+$(OUT_COMP_CLASS)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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-typelibrary;type=RDB$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMPONENT_PACKAGE) : $(COMPONENT_RDB) $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(COPY) $(subst /,$(PS),$(COMPONENT_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS))
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(COMPONENT_RDB_NAME) $(COMPONENT_JAR_NAME)
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+ $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_CLASS)/$(COMPONENT_RDB_NAME)))
+
+$(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(PACKAGE)/$(APP1_NAME).class
+ -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) $(PACKAGE)/$(basename $(@F)).class $(patsubst %.class,-C $(OUT_COMP_CLASS) %.class,$(GENCLASSNAMES))
+ +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
+
+
+$(REGISTERFLAG) : $(COMPONENT_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
+ @echo flagged > $(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
+
+.PHONY: clean
+clean :
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(APP1_JAR)))
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java
new file mode 100644
index 000000000000..3ef79b89e9c0
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+package org.openoffice.comp.test;
+
+import com.sun.star.uno.UnoRuntime;
+
+
+/**
+ * Test class for testing the ImageShrink service skeleton.
+ * Note: the image shrink functionality is not implemented
+ */
+public class Thumbs {
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ try {
+ // get the remote office component context
+ com.sun.star.uno.XComponentContext xRemoteContext =
+ com.sun.star.comp.helper.Bootstrap.bootstrap();
+
+ System.out.println("Connected to a running office ...");
+
+ // use the generated default create method to instantiate a
+ // new ImageShrink object
+ org.openoffice.test.XImageShrinkFilter xImageShrinkFilter =
+ org.openoffice.test.ImageShrink.create(xRemoteContext);
+
+ System.out.println("ImageShrink component succesfully instantiated");
+
+ java.io.File f = new java.io.File(".");
+ System.out.println("set SourceDrectory ...");
+ xImageShrinkFilter.setSourceDirectory(f.getCanonicalPath());
+
+ System.out.println("source Directory = "
+ + xImageShrinkFilter.getSourceDirectory());
+ }
+ catch (java.lang.Exception e){
+ System.err.println("Error: " + e);
+ e.printStackTrace();
+ }
+ finally {
+ System.exit(0);
+ }
+ }
+}
+
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl
new file mode 100644
index 000000000000..b891982f5133
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _org_openoffice_test_ImageShrink_idl_
+#define _org_openoffice_test_ImageShrink_idl_
+
+#include <org/openoffice/test/XImageShrinkFilter.idl>
+
+module org { module openoffice { module test {
+
+ service ImageShrink : XImageShrinkFilter;
+
+}; }; };
+
+#endif
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile
new file mode 100644
index 000000000000..698670084a23
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile
@@ -0,0 +1,73 @@
+#*************************************************************************
+#
+# 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 SpreadSheet examples of the Developers Guide.
+
+PRJ=../../../../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+include ../../../thumbs.mk
+
+PACKAGE = org/openoffice/test
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
+
+# Targets
+.PHONY: ALL
+ALL : \
+ $(GENCLASSFILES)
+
+include $(SETTINGS)/stdtarget.mk
+
+$(OUT_COMP_GEN)/%.urd : %.idl
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(IDLC) -I. -I../../.. -I$(IDL_DIR) -O$(OUT_COMP_GEN) $^
+
+$(OUT_COMP_GEN)/%.rdb : $(GENURDFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(REGMERGE) $@ /UCR $(GENURDFILES)
+
+$(OUT_COMP_CLASS)/%.class : $(COMPONENT_RDB)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMPONENT_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
+
+.PHONY: clean
+clean :
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(GENCLASSFILES)))
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl
new file mode 100644
index 000000000000..361e9914e10e
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _org_openoffice_test_XImageShrink_idl_
+#define _org_openoffice_test_XImageShrink_idl_
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/awt/Size.idl>
+
+module org { module openoffice { module test {
+
+interface XImageShrink {
+
+ [attribute] string SourceDirectory;
+ [attribute] string DestinationDirectory;
+ [attribute] com::sun::star::awt::Size Dimension;
+
+};
+
+}; }; };
+
+#endif
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl
new file mode 100644
index 000000000000..18a59aa667c4
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _org_openoffice_test_XImageShrinkFilter_idl_
+#define _org_openoffice_test_XImageShrinkFilter_idl_
+
+#include <com/sun/star/document/XFilter.idl>
+#include <org/openoffice/test/XImageShrink.idl>
+
+module org { module openoffice { module test {
+
+interface XImageShrinkFilter {
+ interface XImageShrink;
+ interface com::sun::star::document::XFilter;
+};
+
+}; }; };
+
+#endif
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk b/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk
new file mode 100644
index 000000000000..ae6a5c94f0fa
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk
@@ -0,0 +1,27 @@
+OUT_COMP_CLASS = $(OUT_CLASS)/ComponentThumbsExample
+OUT_COMP_GEN = $(OUT_MISC)/ComponentThumbsExample
+
+COMPONENT_NAME=ImageShrink
+COMPONENT_RDB_NAME = $(COMPONENT_NAME).uno.rdb
+COMPONENT_RDB = $(OUT_COMP_GEN)/$(COMPONENT_RDB_NAME)
+COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT)
+COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
+COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar
+COMPONENT_JAR = $(OUT_COMP_CLASS)/$(COMPONENT_JAR_NAME)
+COMPONENT_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest
+COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml
+REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMPONENT_NAME)_register_component.flag
+
+IDL_PACKAGE=org/openoffice/test
+
+IDLFILES = XImageShrink.idl \
+ XImageShrinkFilter.idl \
+ ImageShrink.idl
+
+GENCLASSFILES = $(patsubst %.idl,$(OUT_COMP_CLASS)/$(IDL_PACKAGE)/%.class,$(IDLFILES))
+GENCLASSNAMES = $(patsubst %.idl,$(IDL_PACKAGE)/%.class,$(IDLFILES))
+GENTYPELIST = $(subst /,.,$(patsubst %.idl,-T$(IDL_PACKAGE)/% ,$(IDLFILES)))
+GENURDFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/%.urd,$(IDLFILES))
+
+APP1_NAME=Thumbs
+APP1_JAR=$(OUT_COMP_CLASS)/$(APP1_NAME).jar
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
new file mode 100644
index 000000000000..f7ad9ad4b7c8
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XDialogProvider2;
+import com.sun.star.awt.XDialogEventHandler;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XControlContainer;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XFrame;
+
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.awt.XMessageBox;
+import com.sun.star.awt.WindowAttribute;
+import com.sun.star.awt.WindowClass;
+import com.sun.star.awt.WindowDescriptor;
+import com.sun.star.awt.Rectangle;
+
+import com.sun.star.test.XTestDialogHandler;
+
+// DialogComponent implements all necessary interfaces self, this is only
+// for demonstration. More convenient is to use the impelmentation WeakBase or
+// ComponentBase, see implementation of TestComponentA.
+public class DialogComponent {
+
+ // public static class _DialogComponent extends WeakBase
+ public static class _DialogComponent
+ implements XTypeProvider, XServiceInfo, XTestDialogHandler, XDialogEventHandler {
+
+ static final String __serviceName= "com.sun.star.test.TestDialogHandler";
+
+ static byte[] _implementationId;
+ private XComponentContext m_xCmpCtx;
+
+ private XFrame m_xFrame;
+ private XToolkit m_xToolkit;
+
+ public _DialogComponent(XComponentContext context) {
+ m_xCmpCtx= context;
+
+ try {
+ // Create the toolkit to have access to it later
+ m_xToolkit = (XToolkit) UnoRuntime.queryInterface(
+ XToolkit.class,
+ m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
+ m_xCmpCtx));
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ // XTestDialogHandler
+ public String createDialog( String DialogURL, XModel xModel, XFrame xFrame ) {
+ m_xFrame = xFrame;
+
+ try {
+ XMultiComponentFactory xMCF = m_xCmpCtx.getServiceManager();
+ Object obj;
+
+ // If valid we must pass the XModel when creating a DialogProvider object
+ if( xModel != null ) {
+ Object[] args = new Object[1];
+ args[0] = xModel;
+
+ obj = xMCF.createInstanceWithArgumentsAndContext(
+ "com.sun.star.awt.DialogProvider2", args, m_xCmpCtx );
+ }
+ else {
+ obj = xMCF.createInstanceWithContext(
+ "com.sun.star.awt.DialogProvider2", m_xCmpCtx );
+ }
+
+ XDialogProvider2 xDialogProvider = (XDialogProvider2)
+ UnoRuntime.queryInterface( XDialogProvider2.class, obj );
+
+ XDialog xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this );
+ if( xDialog != null )
+ xDialog.execute();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ return "Created dialog \"" + DialogURL + "\"";
+ }
+
+ public void copyText( XDialog xDialog, Object aEventObject ) {
+ XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(
+ XControlContainer.class, xDialog );
+ String aTextPropertyStr = "Text";
+ String aText = "";
+ XControl xTextField1Control = xControlContainer.getControl( "TextField1" );
+ XControlModel xControlModel1 = xTextField1Control.getModel();
+ XPropertySet xPropertySet1 = (XPropertySet)UnoRuntime.queryInterface(
+ XPropertySet.class, xControlModel1 );
+ try
+ {
+ aText = (String)xPropertySet1.getPropertyValue( aTextPropertyStr );
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ XControl xTextField2Control = xControlContainer.getControl( "TextField2" );
+ XControlModel xControlModel2 = xTextField2Control.getModel();
+ XPropertySet xPropertySet2 = (XPropertySet)UnoRuntime.queryInterface(
+ XPropertySet.class, xControlModel2 );
+ try
+ {
+ xPropertySet2.setPropertyValue( aTextPropertyStr, aText );
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ showMessageBox( "DialogComponent", "copyText() called" );
+ }
+
+ public void handleEvent() {
+ showMessageBox( "DialogComponent", "handleEvent() called" );
+ }
+
+ public void handleEventWithArguments( XDialog xDialog, Object aEventObject ) {
+ showMessageBox( "DialogComponent", "handleEventWithArguments() called\n\n" +
+ "Event Object = " + aEventObject );
+ }
+
+ private final String aHandlerMethod1 = "doit1";
+ private final String aHandlerMethod2 = "doit2";
+ private final String aHandlerMethod3 = "doit3";
+
+ //XDialogEventHandler
+ public boolean callHandlerMethod( /*IN*/XDialog xDialog, /*IN*/Object EventObject, /*IN*/String MethodName ) {
+ if ( MethodName.equals( aHandlerMethod1 ) )
+ {
+ showMessageBox( "DialogComponent", "callHandlerMethod() handled \"" + aHandlerMethod1 + "\"" );
+ return true;
+ }
+ else if ( MethodName.equals( aHandlerMethod2 ) )
+ {
+ showMessageBox( "DialogComponent", "callHandlerMethod() handled \"" + aHandlerMethod2 + "\"" );
+ return true;
+ }
+ else if ( MethodName.equals( aHandlerMethod3 ) )
+ {
+ showMessageBox( "DialogComponent", "callHandlerMethod() handled \"" + aHandlerMethod3 + "\"" );
+ return true;
+ }
+ return false;
+ }
+
+ public String[] getSupportedMethodNames() {
+ String[] retValue= new String[3];
+ retValue[0]= aHandlerMethod1;
+ retValue[1]= aHandlerMethod2;
+ retValue[2]= aHandlerMethod3;
+ return retValue;
+ }
+
+
+ //XTypeProvider
+ public com.sun.star.uno.Type[] getTypes( ) {
+ Type[] retValue= new Type[4];
+ retValue[0]= new Type( XServiceInfo.class);
+ retValue[1]= new Type( XTypeProvider.class);
+ retValue[2]= new Type( XTestDialogHandler.class);
+ retValue[3]= new Type( XDialogEventHandler.class);
+ return retValue;
+ }
+ //XTypeProvider
+ synchronized public byte[] getImplementationId( ) {
+ if (_implementationId == null) {
+ _implementationId= new byte[16];
+ int hash = hashCode();
+ _implementationId[0] = (byte)(hash & 0xff);
+ _implementationId[1] = (byte)((hash >>> 8) & 0xff);
+ _implementationId[2] = (byte)((hash >>> 16) & 0xff);
+ _implementationId[3] = (byte)((hash >>>24) & 0xff);
+ }
+ return _implementationId;
+ }
+
+
+
+ /** This method is a simple helper function to used in the
+ * static component initialisation functions as well as in
+ * getSupportedServiceNames.
+ */
+ public static String[] getServiceNames() {
+ String[] sSupportedServiceNames = { __serviceName };
+ return sSupportedServiceNames;
+ }
+
+ //XServiceInfo
+ public String[] getSupportedServiceNames() {
+ return getServiceNames();
+ }
+
+ //XServiceInfo
+ public boolean supportsService( String sServiceName ) {
+ return sServiceName.equals( __serviceName );
+ }
+
+ //XServiceInfo
+ public String getImplementationName() {
+ // return DialogComponent.class.getName();
+ return _DialogComponent.class.getName();
+ }
+
+ public void showMessageBox(String sTitle, String sMessage) {
+ try {
+ if ( null != m_xFrame && null != m_xToolkit ) {
+
+ // describe window properties.
+ WindowDescriptor aDescriptor = new WindowDescriptor();
+ aDescriptor.Type = WindowClass.MODALTOP;
+ aDescriptor.WindowServiceName = new String( "infobox" );
+ aDescriptor.ParentIndex = -1;
+ aDescriptor.Parent = (XWindowPeer)UnoRuntime.queryInterface(
+ XWindowPeer.class, m_xFrame.getContainerWindow());
+ aDescriptor.Bounds = new Rectangle(0,0,300,200);
+ aDescriptor.WindowAttributes = WindowAttribute.BORDER |
+ WindowAttribute.MOVEABLE |
+ WindowAttribute.CLOSEABLE;
+
+ XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
+ if ( null != xPeer ) {
+ XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
+ XMessageBox.class, xPeer);
+ if ( null != xMsgBox )
+ {
+ xMsgBox.setCaptionText( sTitle );
+ xMsgBox.setMessageText( sMessage );
+ xMsgBox.execute();
+ }
+ }
+ }
+ } catch ( com.sun.star.uno.Exception e) {
+ // do your error handling
+ }
+ }
+ }
+
+ /**
+ * Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns a <code>XSingleComponentFactory</code> for creating
+ * the component
+ * @param sImplName the name of the implementation for which a
+ * service is desired
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static XSingleComponentFactory __getComponentFactory(String sImplName)
+ {
+ XSingleComponentFactory xFactory = null;
+
+ if ( sImplName.equals( _DialogComponent.class.getName() ) )
+ xFactory = Factory.createComponentFactory(_DialogComponent.class,
+ _DialogComponent.getServiceNames());
+
+ return xFactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns true if the operation succeeded
+ * @param regKey the registryKey
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ return Factory.writeRegistryServiceInfo(_DialogComponent.class.getName(),
+ _DialogComponent.getServiceNames(),
+ regKey);
+ }
+}
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.odt b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.odt
new file mode 100644
index 000000000000..bd6a9b40f5b6
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.odt
Binary files differ
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile b/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile
new file mode 100644
index 000000000000..8726029ec222
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile
@@ -0,0 +1,177 @@
+#*************************************************************************
+#
+# 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 dialog component example of the SDK.
+
+PRJ=../../../..
+SETTINGS=$(PRJ)/settings
+
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+# Define non-platform/compiler specific settings
+
+# we use the sample directory name dor separating this example
+# from others in the output directory
+SAMPLE_NAME=DialogComponentSample
+SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
+SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
+
+COMP_NAME=DialogComponent
+COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME)
+COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
+COMP_RDB_NAME=$(COMP_NAME).uno.rdb
+COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_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=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME)
+COMP_JAR_MANIFEST=$(COMP_GEN_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
+
+IDLFILES = XTestDialogHandler.idl \
+ TestDialogHandler.idl
+
+# normally the idl file should be stored in a directory tree fitting the module structure,
+# for the example we know the module structure
+PACKAGE = com/sun/star/test
+#PACKAGE = org/openoffice
+
+COMP_JAVAFILES = DialogComponent.java
+COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
+
+GEN_CLASSFILES = $(patsubst %.idl,$(SAMPLE_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES))
+GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
+GEN_URDFILES = $(patsubst %.idl,$(SAMPLE_GEN_OUT)/%.urd,$(IDLFILES))
+
+# the generated types are necessary for the component and the application jar
+GEN_CLASSFILENAMES = $(subst $(SAMPLE_CLASS_OUT)/,,$(GEN_CLASSFILES))
+
+SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
+ $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
+ $(PATH_SEPARATOR)$(COMP_CLASS_OUT)\
+ $(PATH_SEPARATOR)$(APP1_CLASS_OUT))
+
+
+# Targets
+.PHONY: ALL
+ALL : DialogComponentExample
+
+include $(SETTINGS)/stdtarget.mk
+
+$(COMP_GEN_OUT)/%.Manifest :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
+ @echo RegistrationClassName: $(basename $*)>> $@
+
+$(SAMPLE_GEN_OUT)/%.urd : %.idl
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(IDLC) -C -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $<
+
+$(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(REGMERGE) $@ /UCR $(GEN_URDFILES)
+
+$(GEN_CLASSFILES) : $(COMP_RDB)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(SAMPLE_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
+
+# component as well as application are dependent from the generated types
+# rule for component class files
+$(COMP_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES)
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $<
+
+# rule for component jar file
+$(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) .
+ +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES)
+
+# rule for component package manifest
+$(COMP_GEN_OUT)/%/manifest.xml :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @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-typelibrary;type=RDB$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST)
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME)
+ cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
+ cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
+
+$(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
+ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
+ @echo flagged > $(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
+
+DialogComponentExample : $(COMP_REGISTERFLAG)
+# TODO: adapt
+ @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) DialogComponent.odt.load
+ @echo --------------------------------------------------------------------------------
+
+DialogComponent.odt.load : $(COMP_REGISTERFLAG)
+ "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
+
+.PHONY: clean
+clean :
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
+ -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl b/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl
new file mode 100644
index 000000000000..7196b173b4fa
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+#ifndef INCLUDED_COM_SUN_STAR_TEST_TESTDIALOGHANDLER_IDL
+#define INCLUDED_COM_SUN_STAR_TEST_TESTDIALOGHANDLER_IDL
+
+#include "XTestDialogHandler.idl"
+
+module com { module sun { module star { module test {
+ service TestDialogHandler : XTestDialogHandler;
+}; }; }; };
+
+#endif
+
+
+
+
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl b/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl
new file mode 100644
index 000000000000..aa968917d5c9
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef INCLUDED_COM_SUN_STAR_TEST_XTESTDIALOGHANDLER_IDL
+#define INCLUDED_COM_SUN_STAR_TEST_XTESTDIALOGHANDLER_IDL
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/awt/XDialog.idl>
+#include <com/sun/star/frame/XModel.idl>
+#include <com/sun/star/frame/XFrame.idl>
+
+module com { module sun { module star { module test {
+ interface XTestDialogHandler {
+ string createDialog( [in] string DialogURL, [in] ::com::sun::star::frame::XModel xModel,
+ [in] ::com::sun::star::frame::XFrame xFrame );
+ void copyText( [in] ::com::sun::star::awt::XDialog xDialog, [in] any aEventObject );
+ void handleEvent();
+ void handleEventWithArguments( [in] ::com::sun::star::awt::XDialog xDialog, [in] any aEventObject );
+ };
+}; }; }; };
+
+#endif
diff --git a/odk/examples/DevelopersGuide/Components/makefile.mk b/odk/examples/DevelopersGuide/Components/makefile.mk
new file mode 100644
index 000000000000..7c399b33c109
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/makefile.mk
@@ -0,0 +1,123 @@
+#*************************************************************************
+#
+# 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=odk
+TARGET=copying
+
+#----------------------------------------------------------------
+.INCLUDE: settings.mk
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+#----------------------------------------------------------------
+
+#----------------------------------------------------
+# this makefile is only used for copying the example
+# files into the SDK
+#----------------------------------------------------
+
+DESTJOBSADDON=$(DESTDIRDEVGUIDEEXAMPLES)$/Components$/Addons$/JobsAddon
+JOBSADDON_FILES=\
+ $(DESTJOBSADDON)$/Addons.xcu \
+ $(DESTJOBSADDON)$/AsyncJob.java \
+ $(DESTJOBSADDON)$/Jobs.xcu \
+ $(DESTJOBSADDON)$/Makefile
+
+DESTPROTOCOLHANDLERADDONCPP=$(DESTDIRDEVGUIDEEXAMPLES)$/Components$/Addons$/ProtocolHandlerAddon_cpp
+PROTOCOLHANLDERADDONCPP_FILES=\
+ $(DESTPROTOCOLHANDLERADDONCPP)$/addon.cxx \
+ $(DESTPROTOCOLHANDLERADDONCPP)$/addon.hxx \
+ $(DESTPROTOCOLHANDLERADDONCPP)$/Addons.xcu \
+ $(DESTPROTOCOLHANDLERADDONCPP)$/component.cxx \
+ $(DESTPROTOCOLHANDLERADDONCPP)$/Makefile \
+ $(DESTPROTOCOLHANDLERADDONCPP)$/ProtocolHandler.xcu \
+ $(DESTPROTOCOLHANDLERADDONCPP)$/ProtocolHandlerAddon_cpp.uno.xml
+
+DESTPROTOCOLHANDLERADDONJAVA=$(DESTDIRDEVGUIDEEXAMPLES)$/Components$/Addons$/ProtocolHandlerAddon_java
+PROTOCOLHANLDERADDONJAVA_FILES=\
+ $(DESTPROTOCOLHANDLERADDONJAVA)$/Addons.xcu \
+ $(DESTPROTOCOLHANDLERADDONJAVA)$/Makefile \
+ $(DESTPROTOCOLHANDLERADDONJAVA)$/ProtocolHandler.xcu \
+ $(DESTPROTOCOLHANDLERADDONJAVA)$/ProtocolHandlerAddon.java \
+ $(DESTPROTOCOLHANDLERADDONJAVA)$/ProtocolHandlerAddon_java.uno.xml
+
+CPPCOMPONENT_FILES=\
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/CppComponent.uno.xml \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/Makefile \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/service1_impl.cxx \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/service2_impl.cxx \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/TestCppComponent.cxx \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/SimpleComponent.odt \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/CppComponent$/some.idl
+
+JAVACOMPONENT_FILES=\
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/Makefile \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/TestComponentA.java \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/TestComponentB.java \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/TestServiceProvider.java \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/TestJavaComponent.java \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/XSomethingA.idl \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/XSomethingB.idl \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/SomethingA.idl \
+ $(DESTDIRDEVGUIDEEXAMPLES)$/Components$/JavaComponent$/SomethingB.idl
+
+DESTTHUMBS=$(DESTDIRDEVGUIDEEXAMPLES)$/Components$/Thumbs
+THUMBS_FILES=\
+ $(DESTTHUMBS)$/org$/openoffice$/comp$/test$/ImageShrink.java \
+ $(DESTTHUMBS)$/org$/openoffice$/comp$/test$/Thumbs.java \
+ $(DESTTHUMBS)$/org$/openoffice$/comp$/test$/Makefile \
+ $(DESTTHUMBS)$/org$/openoffice$/test$/ImageShrink.idl \
+ $(DESTTHUMBS)$/org$/openoffice$/test$/XImageShrink.idl \
+ $(DESTTHUMBS)$/org$/openoffice$/test$/XImageShrinkFilter.idl \
+ $(DESTTHUMBS)$/org$/openoffice$/test$/Makefile \
+ $(DESTTHUMBS)$/thumbs.mk \
+ $(DESTTHUMBS)$/Makefile
+
+
+DIR_FILE_LIST= \
+ $(JOBSADDON_FILES) \
+ $(PROTOCOLHANLDERADDONCPP_FILES) \
+ $(PROTOCOLHANLDERADDONJAVA_FILES) \
+ $(CPPCOMPONENT_FILES) \
+ $(JAVACOMPONENT_FILES) \
+ $(THUMBS_FILES)
+
+DIR_DIRECTORY_LIST=$(uniq $(DIR_FILE_LIST:d))
+DIR_CREATE_FLAG=$(MISC)$/devguide_components_dirs_created.txt
+DIR_FILE_FLAG=$(MISC)$/devguide_components.txt
+
+#--------------------------------------------------
+# TARGETS
+#--------------------------------------------------
+all : \
+ $(DIR_FILE_LIST) \
+ $(DIR_FILE_FLAG)
+
+#--------------------------------------------------
+# use global rules
+#--------------------------------------------------
+.INCLUDE: $(PRJ)$/util$/odk_rules.pmk
+