summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/Components/Addons
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Components/Addons')
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu81
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.components8
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java444
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Jobs.xcu27
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile137
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Addons.xcu220
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile163
-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.cxx135
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Addons.xcu220
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile139
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandler.xcu10
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java287
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.components8
16 files changed, 2265 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.components b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.components
new file mode 100644
index 000000000000..c47f26b0187d
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.components
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://openoffice.org/2010/uno-components">
+ <component loader="com.sun.star.loader.Java2" uri="AsyncJob.uno.jar">
+ <implementation name="com.sun.star.comp.framework.java.services.AsyncJob">
+ <service name="com.sun.star.task.AsyncJob"/>
+ </implementation>
+ </component>
+</components>
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..790a52d46fb1
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * 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.
+ final java.lang.String sFinalTitle = sTitle;
+ final java.lang.String sFinalMessage = sMessage;
+
+ // On Mac OS X, AWT/Swing must not be accessed from the AppKit thread, so call
+ // SwingUtilities.invokeLater always on a fresh thread to avoid that problem
+ // (also, the current thread must not wait for that fresh thread to terminate,
+ // as that would cause a deadlock if this thread is the AppKit thread):
+ final Runnable doRun = new Runnable() {
+ public void run() {
+ javax.swing.JOptionPane.showMessageDialog(null, sFinalMessage, sFinalTitle, javax.swing.JOptionPane.INFORMATION_MESSAGE);
+ }
+ };
+
+ new Thread( doRun ) {
+ public void run() { javax.swing.SwingUtilities.invokeLater(doRun); }
+ }.start();
+ }
+
+ //___________________________________________
+
+ /** 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;
+ }
+
+ //___________________________________________
+ // This method not longer necessary since OOo 3.4 where the component registration
+ // was changed to passive component registration. For more details see
+ // http://wiki.services.openoffice.org/wiki/Passive_Component_Registration
+
+// 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..052cea359530
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile
@@ -0,0 +1,137 @@
+#*************************************************************************
+#
+# 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
+COMP_NAME=AsyncJob
+OUT_COMP_CLASS=$(OUT_CLASS)/$(COMP_NAME)
+OUT_COMP_MISC=$(OUT_MISC)/$(COMP_NAME)
+COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
+COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
+COMP_JAR_NAME=$(COMP_NAME).uno.jar
+COMP_JAR=$(OUT_CLASS)/$(COMP_JAR_NAME)
+COMP_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest
+COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml
+REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMP_NAME)_register_component.flag
+COMP_COMPONENTS=$(COMP_NAME).components
+
+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
+$(COMP_JAR) : $(COMP_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-components$(QM)">> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(COMP_JAR) Addons.xcu Jobs.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS)
+ -$(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 $(COMP_COMPONENTS)
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(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),$@))
+ -$(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
+
+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),$(COMP_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_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..98bbab16ba2c
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile
@@ -0,0 +1,163 @@
+#*************************************************************************
+#
+# 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
+COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components
+
+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)
+$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
+ -$(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-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+$(COMP_COMPONENTS) :
+ -$(MKDIR) $(subst /,$(PS),$(@D))
+ @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
+ @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)org.openoffice.Office.addon.example$(QM)"$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.frame.ProtocolHandler$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@
+ @echo $(OSEP)/components$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS)
+ -$(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) $(COMP_NAME).components
+ cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../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),$(COMP_COMPONENTS)))
+ -$(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..ae8a7bc1476f
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the BSD license.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *************************************************************************/
+
+#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" SAL_DLLPUBLIC_EXPORT 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
+ */
+// This method not longer necessary since OOo 3.4 where the component registration was
+// was changed to passive component registration. For more details see
+// http://wiki.services.openoffice.org/wiki/Passive_Component_Registration
+//
+// extern "C" SAL_DLLPUBLIC_EXPORT 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" SAL_DLLPUBLIC_EXPORT 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..82a87aea4ecf
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile
@@ -0,0 +1,139 @@
+#*************************************************************************
+#
+# 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
+COMP_NAME=ProtocolHandlerAddon_java
+OUT_COMP_CLASS=$(OUT_CLASS)/$(COMP_NAME)
+OUT_COMP_MISC=$(OUT_MISC)/$(COMP_NAME)
+COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
+COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
+COMP_JAR_NAME=$(COMP_NAME).uno.jar
+COMP_JAR=$(OUT_CLASS)/$(COMP_JAR_NAME)
+COMP_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest
+COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml
+COMP_COMPONENTS=$(COMP_NAME).components
+
+REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMP_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
+$(COMP_JAR) : $(COMP_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-components$(QM)">> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@
+ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
+
+# rule for component package file
+$(COMP_PACKAGE) : $(COMP_JAR) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS)
+ -$(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 $(COMP_COMPONENTS)
+ cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(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),$@))
+ -$(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
+
+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),$(COMP_PACKAGE_URL)))
+ -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_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..debc2ce8d8af
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * 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.
+ */
+ // This method not longer necessary since OOo 3.4 where the component registration
+ // was changed to passive component registration. For more details see
+ // http://wiki.services.openoffice.org/wiki/Passive_Component_Registration
+
+// public static boolean __writeRegistryServiceInfo(
+// XRegistryKey xRegistryKey ) {
+// return Factory.writeRegistryServiceInfo(
+// ProtocolHandlerAddonImpl.class.getName(),
+// ProtocolHandlerAddonImpl.getServiceNames(),
+// xRegistryKey );
+// }
+}
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.components b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.components
new file mode 100644
index 000000000000..13665ebbc3c5
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.components
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://openoffice.org/2010/uno-components">
+ <component loader="com.sun.star.loader.Java2" uri="ProtocolHandlerAddon_java.uno.jar">
+ <implementation name="ProtocolHandlerAddon$ProtocolHandlerAddonImpl">
+ <service name="com.sun.star.frame.ProtocolHandler"/>
+ </implementation>
+ </component>
+</components>