Kaydet (Commit) 43debfae authored tarafından Chris Sherlock's avatar Chris Sherlock Kaydeden (comit) Thomas Arnhold

General cleanup of OfficeBeans

Cleaned up Java source files:
    + removed unnecessary commented out code
    + corrected many spelling errors
    + formatting changes (remove decorations from comments,
      whitespacing, etc.)

Change-Id: I4133908ceac874b273fe409d763b3ddbfc2055e5
Reviewed-on: https://gerrit.libreoffice.org/3413Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Reviewed-by: 's avatarThomas Arnhold <thomas@arnhold.org>
Tested-by: 's avatarThomas Arnhold <thomas@arnhold.org>
üst 7cac1bc7
......@@ -19,13 +19,12 @@
package com.sun.star.comp.beans;
//---------------------------------------------------------------------------
/** Helper class to watch calls into OOo with a timeout.
*/
//Do not add the thread instances to a threadgroup. When testing the bean in
//an applet it turned out the ThreadGroup was in an inconsistent state
//after navigating off the site that contains the applet and back to it.
//That was tested with a Sun JRE 1.4.2_06
// Do not add the thread instances to a threadgroup. When testing the bean in
// an applet it turned out the ThreadGroup was in an inconsistent state
// after navigating off the site that contains the applet and back to it.
// That was tested with a Sun JRE 1.4.2_06
public class CallWatchThread extends Thread
{
private static boolean DEBUG = false;
......
......@@ -21,7 +21,7 @@ package com.sun.star.comp.beans;
import java.awt.Container;
/**
* This interface reprecents an AWT container factory.
* This interface represents an AWT container factory.
*
* @deprecated
*
......
......@@ -49,7 +49,7 @@ public class Frame
// com.sun.star.frame.XFrame
//--------------------------------------------------------------
public void initialize( /*IN*/com.sun.star.awt.XWindow xWindow )
public void initialize( /*IN*/ com.sun.star.awt.XWindow xWindow )
{
xFrame.initialize( xWindow );
}
......@@ -79,7 +79,7 @@ public class Frame
xFrame.setName( aName );
}
public com.sun.star.frame.XFrame findFrame( /*IN*/String aTargetFrameName, /*IN*/int nSearchFlags )
public com.sun.star.frame.XFrame findFrame( /*IN*/ String aTargetFrameName, /*IN*/ int nSearchFlags )
{
return xFrame.findFrame( aTargetFrameName, nSearchFlags );
}
......@@ -104,7 +104,7 @@ public class Frame
return xFrame.isActive();
}
public boolean setComponent( /*IN*/com.sun.star.awt.XWindow xComponentWindow, /*IN*/ com.sun.star.frame.XController xController )
public boolean setComponent( /*IN*/ com.sun.star.awt.XWindow xComponentWindow, /*IN*/ com.sun.star.frame.XController xController )
{
return xFrame.setComponent( xComponentWindow, xController );
}
......
......@@ -25,7 +25,7 @@ import com.sun.star.awt.*;
*
* @since OOo 2.0.0
*/
/* package */ class JavaWindowPeerFake
class JavaWindowPeerFake
implements XSystemDependentWindowPeer, XWindowPeer
{
protected int localSystemType;
......@@ -44,7 +44,7 @@ import com.sun.star.awt.*;
/** <p>Implementation of XSystemDependentWindowPeer (that's all we really need)</p>
* This method is called back from the OpenOffice.org toolkit to retrieve the system data.
*/
public Object getWindowHandle(/*IN*/byte[] ProcessId, /*IN*/short SystemType)
public Object getWindowHandle(/*IN*/ byte[] ProcessId, /*IN*/ short SystemType)
throws com.sun.star.uno.RuntimeException
{
if (SystemType == localSystemType) {
......@@ -63,28 +63,28 @@ import com.sun.star.awt.*;
/** not really neaded.
*/
public void setPointer(/*IN*/XPointer Pointer)
public void setPointer(/*IN*/ XPointer Pointer)
throws com.sun.star.uno.RuntimeException
{
}
/** not really neaded.
*/
public void setBackground(/*IN*/int Color)
public void setBackground(/*IN*/ int Color)
throws com.sun.star.uno.RuntimeException
{
}
/** not really neaded.
*/
public void invalidate(/*IN*/short Flags)
public void invalidate(/*IN*/ short Flags)
throws com.sun.star.uno.RuntimeException
{
}
/** not really neaded.
*/
public void invalidateRect(/*IN*/com.sun.star.awt.Rectangle Rect, /*IN*/short Flags)
public void invalidateRect(/*IN*/ com.sun.star.awt.Rectangle Rect, /*IN*/ short Flags)
throws com.sun.star.uno.RuntimeException
{
}
......@@ -98,14 +98,14 @@ import com.sun.star.awt.*;
/** not really neaded.
*/
public void addEventListener(/*IN*/com.sun.star.lang.XEventListener xListener)
public void addEventListener(/*IN*/ com.sun.star.lang.XEventListener xListener)
throws com.sun.star.uno.RuntimeException
{
}
/** not really neaded.
*/
public void removeEventListener(/*IN*/com.sun.star.lang.XEventListener aListener)
public void removeEventListener(/*IN*/ com.sun.star.lang.XEventListener aListener)
throws com.sun.star.uno.RuntimeException
{
}
......
......@@ -38,7 +38,7 @@ import com.sun.star.lib.uno.helper.UnoUrl;
import com.sun.star.lib.util.NativeLibraryLoader;
/**
* This class reprecents a connection to the local office application.
* This class represents a connection to the local office application.
*
* @since OOo 2.0.0
*/
......@@ -49,22 +49,22 @@ public class LocalOfficeConnection
public static final String OFFICE_LIB_NAME = "officebean";
public static final String OFFICE_ID_SUFFIX = "_Office";
private Process mProcess;
private Process mProcess;
private ContainerFactory mContainerFactory;
private XComponentContext mContext;
private XBridge mBridge;
private String mURL;
private String mConnType;
private String mPipe;
private String mPort;
private String mProtocol;
private String mInitialObject;
private String mURL;
private String mConnType;
private String mPipe;
private String mPort;
private String mProtocol;
private String mInitialObject;
private List<XEventListener> mComponents = new ArrayList<XEventListener>();
private static long m_nBridgeCounter = 0;
//-------------------------------------------------------------------------
static
{
// preload shared libraries whichs import lips are linked to officebean
......@@ -115,7 +115,6 @@ public class LocalOfficeConnection
NativeLibraryLoader.loadLibrary( LocalOfficeConnection.class.getClassLoader(), "officebean" );
}
//-------------------------------------------------------------------------
/**
* Constructor.
......@@ -190,7 +189,7 @@ public class LocalOfficeConnection
}
/**
* Sets an AWT container catory.
* Sets an AWT container factory.
*
* @param containerFactory This is a application provided AWT container
* factory.
......@@ -201,7 +200,7 @@ public class LocalOfficeConnection
}
/**
* Retrives the UNO component context.
* Retrieves the UNO component context.
* Establishes a connection if necessary and initialises the
* UNO service manager if it has not already been initialised.
* This method can return <code>null</code> if it fails to connect
......@@ -242,12 +241,12 @@ public class LocalOfficeConnection
}
mComponents.clear();
//Terminate the bridge. It turned out that this is necessary for the bean
//to work properly when displayed in an applet within Internet Explorer.
//When navigating off the page which is showing the applet and then going
//back to it, then the Java remote bridge is damaged. That is the Java threads
//do not work properly anymore. Therefore when Applet.stop is called the connection
//to the office including the bridge needs to be terminated.
// Terminate the bridge. It turned out that this is necessary for the bean
// to work properly when displayed in an applet within Internet Explorer.
// When navigating off the page which is showing the applet and then going
// back to it, then the Java remote bridge is damaged. That is the Java threads
// do not work properly anymore. Therefore when Applet.stop is called the connection
// to the office including the bridge needs to be terminated.
if (mBridge != null)
{
XComponent comp = UnoRuntime.queryInterface(
......@@ -379,19 +378,19 @@ public class LocalOfficeConnection
}
//The function is copied and adapted from the UrlResolver.resolve.
//We cannot use the URLResolver because we need access to the bridge which has
//to be disposed when Applet.stop is called.
// The function is copied and adapted from the UrlResolver.resolve.
// We cannot use the URLResolver because we need access to the bridge which has
// to be disposed when Applet.stop is called.
private Object resolve(XComponentContext xLocalContext, String dcp)
throws com.sun.star.connection.NoConnectException,
com.sun.star.connection.ConnectionSetupException,
com.sun.star.lang.IllegalArgumentException
{
String conDcp = null;
String conDcp = null;
String protDcp = null;
String rootOid = null;
if(dcp.indexOf(';') == -1) {// use old style
if(dcp.indexOf(';') == -1) { // use old style
conDcp = dcp;
protDcp = "iiop";
rootOid = "classic_uno";
......@@ -437,9 +436,9 @@ public class LocalOfficeConnection
// connect to the server
XConnection xConnection = connector_xConnector.connect(conDcp);
// create the bridge name. This should not be necessary if we pass an
//empty string as bridge name into createBridge. Then we should always get
//a new bridge. This does not work because of (i51323). Therefore we
//create unique bridge names for the current process.
// empty string as bridge name into createBridge. Then we should always get
// a new bridge. This does not work because of (i51323). Therefore we
// create unique bridge names for the current process.
String sBridgeName = "OOoBean_private_bridge_" + String.valueOf(m_nBridgeCounter++);
try {
mBridge = xBridgeFactory.createBridge(sBridgeName, protDcp, xConnection, null);
......@@ -478,7 +477,7 @@ public class LocalOfficeConnection
private void parseUnoUrlWithOfficePath(String url, String prefix)
throws java.net.MalformedURLException
{
// Extruct parameters.
// Extract parameters.
int idx = url.indexOf(";urp;StarOffice.ServiceManager");
if (idx < 0)
throw new java.net.MalformedURLException(
......@@ -589,7 +588,7 @@ public class LocalOfficeConnection
}
break;
case 5: // a delimeter after the value
case 5: // a delimiter after the value
switch(ch) {
case ' ':
break;
......@@ -670,7 +669,7 @@ public class LocalOfficeConnection
implements NativeService
{
/**
* Retrive the office service identifier.
* Retrieve the office service identifier.
*
* @return The identifier of the office service.
*/
......@@ -690,12 +689,12 @@ public class LocalOfficeConnection
{
int nSizeCmdArray = 4;
String sOption = null;
//examine if user specified command-line options in system properties.
//We may offer later a more sophisticated way of providing options if
//the need arises. Currently this is intended to ease the pain during
//development with pre-release builds of LibO where one wants to start
//LibO with the --norestore options. The value of the property is simple
//passed on to the Runtime.exec call.
// examine if user specified command-line options in system properties.
// We may offer later a more sophisticated way of providing options if
// the need arises. Currently this is intended to ease the pain during
// development with pre-release builds of LibO where one wants to start
// LibO with the --norestore options. The value of the property is simple
// passed on to the Runtime.exec call.
try {
sOption = System.getProperty("com.sun.star.officebean.Options");
if (sOption != null)
......@@ -704,7 +703,7 @@ public class LocalOfficeConnection
{
e.printStackTrace();
}
// create call with arguments
// create call with arguments
String[] cmdArray = new String[nSizeCmdArray];
// read UNO_PATH environment variable to get path to soffice binary
......@@ -712,7 +711,6 @@ public class LocalOfficeConnection
if (unoPath == null)
throw new java.io.IOException( "UNO_PATH environment variable is not set (required system path to the office program directory)" );
// cmdArray[0] = (new File(getProgramPath(), OFFICE_APP_NAME)).getPath();
cmdArray[0] = (new File(unoPath, OFFICE_APP_NAME)).getPath();
cmdArray[1] = "--nologo";
cmdArray[2] = "--nodefault";
......@@ -736,9 +734,9 @@ public class LocalOfficeConnection
}
/**
* Retrives the ammount of time to wait for the startup.
* Retrieves the amount of time to wait for the startup.
*
* @return The ammount of time to wait in seconds(?).
* @return The amount of time to wait in seconds(?).
*/
public int getStartupTime()
{
......
......@@ -66,7 +66,7 @@ public class LocalOfficeWindow
}
/**
* Retrives an AWT component object associated with the OfficeWindow.
* Retrieves an AWT component object associated with the OfficeWindow.
*
* @return The AWT component object associated with the OfficeWindow.
*/
......@@ -76,7 +76,7 @@ public class LocalOfficeWindow
}
/**
* Retrives an UNO XWindowPeer object associated with the OfficeWindow.
* Retrieves an UNO XWindowPeer object associated with the OfficeWindow.
*
* @return The UNO XWindowPeer object associated with the OfficeWindow.
*/
......@@ -233,24 +233,24 @@ public class LocalOfficeWindow
}
/**
* Retrives a platform dependant system window identifier.
* Retrieves a platform dependent system window identifier.
*
* @return The system window identifier.
*/
private native long getNativeWindow();
/**
* Retrives a platform dependant system window type.
* Retrieves a platform dependent system window type.
*
* @return The system window type.
*/
private native int getNativeWindowSystemType();
/**
Returns an Any containing a sequences of com.sun.star.beans.NamedValue. One NamedValue
contains the name "WINDOW" and the value is a Long representing the window handle.
The second NamedValue has the name "XEMBED" and the value is true, when the XEmbed
protocol shall be used fore embedding the native Window.
* Returns an Any containing a sequences of com.sun.star.beans.NamedValue. One NamedValue
* contains the name "WINDOW" and the value is a Long representing the window handle.
* The second NamedValue has the name "XEMBED" and the value is true, when the XEmbed
* protocol shall be used fore embedding the native Window.
*/
protected Any getWrappedWindowHandle()
{
......
......@@ -24,16 +24,16 @@ import com.sun.star.connection.XConnection;
*
* @deprecated.
*/
/* package */ class NativeConnection
class NativeConnection
implements XConnection
{
public native void connect(NativeService aNativeService)
throws com.sun.star.io.IOException;
public native int read(/*OUT*/byte[][] aReadBytes, /*IN*/int nBytesToRead)
public native int read(/*OUT*/ byte[][] aReadBytes, /*IN*/ int nBytesToRead)
throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException;
public native void write(/*IN*/byte[] aData)
public native void write(/*IN*/ byte[] aData)
throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException;
public native void flush()
......
......@@ -21,7 +21,7 @@ package com.sun.star.comp.beans;
/*
* @deprecated
*/
/* package */ interface NativeService {
interface NativeService {
public String getIdentifier();
public void startupService() throws java.io.IOException;
public int getStartupTime();
......
......@@ -19,8 +19,8 @@
package com.sun.star.comp.beans;
/** This exception is called when a method is called which
needs an established connection but no connection is
established yet or anymore.
needs an established connection but no connection is
established yet.
@since OOo 2.0.0
*/
......
......@@ -18,7 +18,7 @@
package com.sun.star.comp.beans;
/** indicates that an operation needed a document, but no document was loaded.
/** Indicates that an operation needed a document, but no document was loaded.
@since OOo 2.0.0
*/
......
......@@ -24,7 +24,7 @@ import com.sun.star.lang.XComponent;
import com.sun.star.uno.XComponentContext;
/**
* This abstract class reprecents a connection to the office
* This abstract class represents a connection to the office
* application.
@deprecated
......@@ -62,7 +62,7 @@ public interface OfficeConnection
* The window is either a sub-class of java.awt.Canvas (local) or
* java.awt.Container (RVP).
*
* This method does not add add the office window to its container.
* This method does not add the office window to its container.
*
* @param container This is an AWT container.
* @return The office window instance.
......
......@@ -23,8 +23,8 @@ import java.awt.Component;
import com.sun.star.awt.XWindowPeer;
/**
* The concreate implementation of the OfficeWindow extends an
* approperate type of visual component (java.awt.Canvas for local
* The concrete implementation of the OfficeWindow extends an
* appropriate type of visual component (java.awt.Canvas for local
* and java.awt.Container for remote).
@deprecated
......@@ -32,14 +32,14 @@ import com.sun.star.awt.XWindowPeer;
public interface OfficeWindow
{
/**
* Retrives an AWT component object associated with the OfficeWindow.
* Retrieves an AWT component object associated with the OfficeWindow.
*
* @return The AWT component object associated with the OfficeWindow.
*/
Component getAWTComponent();
/**
* Retrives an UNO XWindowPeer object associated with the OfficeWindow.
* Retrieves an UNO XWindowPeer object associated with the OfficeWindow.
*
* @return The UNO XWindowPeer object associated with the OfficeWindow.
*/
......
......@@ -22,10 +22,10 @@ import com.sun.star.uno.UnoRuntime;
//==========================================================================
/** Wrapper base class for UNO services which emulates the upcoming
mode of automatic runtime Java classes to get rid of the need for
mode of automatic runtime Java classes to get rid of the need for
queryInterface.
Because its not worth the efford to create a runtime generated wrapper
Because it's not worth the effort to create a runtime generated wrapper
for this purpose, as it might be for OOo 2.0, you still have to use
UnoRuntime.queryInterface() for interfaces which are optional or come
from a subclass. But for non optional interfaces you can already
......@@ -71,7 +71,6 @@ class Wrapper
public Object queryInterface( com.sun.star.uno.Type aType )
{
//System.err.println( "Wrapper::queryInterface(" + aType + ")" );
return xQueryInterface.queryInterface( aType );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment