summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java')
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java64
1 files changed, 32 insertions, 32 deletions
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
index ad3b0efe8747..2844d25e3def 100644
--- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -2,7 +2,7 @@
*
* 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.
*
@@ -29,7 +29,7 @@
* 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;
@@ -42,12 +42,12 @@ 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.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;
@@ -62,14 +62,14 @@ public class ProtocolHandlerAddon {
*/
public static class ProtocolHandlerAddonImpl extends WeakBase implements
XDispatchProvider,
- XDispatch,
+ 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;
@@ -83,7 +83,7 @@ public class ProtocolHandlerAddon {
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.
@@ -91,7 +91,7 @@ public class ProtocolHandlerAddon {
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
@@ -114,7 +114,7 @@ public class ProtocolHandlerAddon {
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.
*/
@@ -125,7 +125,7 @@ public class ProtocolHandlerAddon {
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.
@@ -133,22 +133,22 @@ public class ProtocolHandlerAddon {
*/
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,
@@ -164,23 +164,23 @@ public class ProtocolHandlerAddon {
}
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;
+
+ 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 )
@@ -197,11 +197,11 @@ public class ProtocolHandlerAddon {
}
}
}
-
+
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 ) {
}
@@ -221,7 +221,7 @@ public class ProtocolHandlerAddon {
aDescriptor.WindowAttributes = WindowAttribute.BORDER |
WindowAttribute.MOVEABLE |
WindowAttribute.CLOSEABLE;
-
+
XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
if ( null != xPeer ) {
XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
@@ -235,12 +235,12 @@ public class ProtocolHandlerAddon {
}
}
} catch ( com.sun.star.uno.Exception e) {
- // do your error handling
+ // do your error handling
}
}
}
-
-
+
+
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
* <p>
@@ -256,14 +256,14 @@ public class ProtocolHandlerAddon {
*/
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