public class OOoBean
extends java.awt.Container
implements java.io.Externalizable
| Constructor and Description |
|---|
OOoBean()
Generic constructor of the OOoBean.
|
OOoBean(OfficeConnection iConnection)
Deprecated.
Clients could use the getOOoConnection to obtain an OfficeConnection
and use it as argument in a constructor for another OOoBean instance. Calling
the dispose method of the OfficeConnection or the OOoBean's stopOOoConnection
method would make all instances of OOoBean stop working.
|
| Modifier and Type | Method and Description |
|---|---|
protected com.sun.star.beans.PropertyValue[] |
addArgument(com.sun.star.beans.PropertyValue[] aArguments,
com.sun.star.beans.PropertyValue aArgument)
Adds a single argument to an array of arguments.
|
protected void |
applyToolVisibilities()
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible. |
void |
aquireSystemWindow()
This method causes the office window to be displayed.
|
void |
clear()
Resets the OOoBean to an empty status.
|
void |
clearDocument(boolean bClearStateToo)
Deprecated.
There is currently no way to dismiss changes, except for loading
of the unchanged initial document. Furthermore it is unclear how derived classes
handle this and what exactly their state is (e.g. what members make up their state).
Calling this method on a derived class requires knowledge about their implementation.
Therefore a deriving class should declare their own clearDocument if needed. Clients
should call the clearDocument of the deriving class or
clear() which discards
the currently displayed document. |
Controller |
getController()
returns the
|
OfficeDocument |
getDocument()
returns the
|
Frame |
getFrame()
returns the
|
com.sun.star.lang.XMultiServiceFactory |
getMultiServiceFactory()
Returns the service factory used by this OOoBean instance.
|
OfficeConnection |
getOOoConnection()
Returns the a connection to an OOo instance.
|
com.sun.star.frame.XDesktop |
getOOoDesktop()
Returns the XDesktop interface of the OOo instance used by this OOoBean.
|
boolean |
isMenuBarVisible()
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
boolean |
isOOoConnected()
Deprecated.
This method is not useful in a multithreaded environment. Then
all threads accessing the instance would have to be synchronized in order to
make is method work. It is better
to call OOoBean's methods and be prepared to catch a NoConnectionException.
|
boolean |
isStandardBarVisible()
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
boolean |
isStatusBarVisible()
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
boolean |
isToolBarVisible()
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
void |
loadFromByteArray(byte[] aInBuffer,
com.sun.star.beans.PropertyValue[] aArguments)
Loads a document from a byte array.
|
void |
loadFromStream(java.io.InputStream iInStream,
com.sun.star.beans.PropertyValue[] aArguments)
Loads a document from a Java stream.
|
void |
loadFromURL(java.lang.String aURL,
com.sun.star.beans.PropertyValue[] aArguments)
Loads the bean from the given URL.
|
void |
paint(java.awt.Graphics aGraphics)
Deprecated.
|
void |
readExternal(java.io.ObjectInput aObjIn)
Deprecated.
|
void |
releaseSystemWindow()
Deprecated.
When Component.removeNotify of the parent window of the actual
office window is called, then the actions are performed for which this method
needed to be called previously.
|
void |
setAllBarsVisible(boolean bVisible)
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. For example:
com.sun.star.beans.XPropertySet xPropSet =
(com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, aFrame );
com.sun.star.frame.XLayoutManager xLayoutManager =
(com.sun.star.frame.XLayoutManager) UnoRuntime.queryInterface(
com.sun.star.frame.XLayoutManager.class,
xPropSet.getPropertyValue( "LayoutManager" ) );
xLayoutManager.showElement("private:resource/menubar/menubar");
|
void |
setMenuBarVisible(boolean bVisible)
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
void |
setOOoCallTimeOut(int nMilliSecs)
Sets the timeout for normal OOO methods calls in milli seconds.
|
void |
setOOoCheckCycle(int nMilliSecs)
Sets the period length in milli seconds to check the OOo connection.
|
void |
setOOoStartTimeOut(int nMilliSecs)
Sets the timeout for methods which launch OOo in milli seconds.
|
void |
setStandardBarVisible(boolean bVisible)
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
void |
setStatusBarVisible(boolean bVisible)
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
void |
setToolBarVisible(boolean bVisible)
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
protected boolean |
setToolVisible(java.lang.String aProperty,
java.lang.String aResourceURL,
boolean bOldValue,
boolean bNewValue)
Deprecated.
Clients should use the service com.sun.star.frame.LayoutManager,
which can be obtained from a frame, to control toolbars. See also
setAllBarsVisible(boolean). |
void |
startOOoConnection(java.lang.String aConnectionURL)
Starts a connection to an OOo instance which is lauched if not running.
|
void |
stopOOoConnection()
Disconnects from the connected OOo instance.
|
byte[] |
storeToByteArray(byte[] aOutBuffer,
com.sun.star.beans.PropertyValue[] aArguments)
Stores a document to a byte array.
|
java.io.OutputStream |
storeToStream(java.io.OutputStream aOutStream,
com.sun.star.beans.PropertyValue[] aArguments)
Stores a document to a stream.
|
void |
storeToURL(java.lang.String aURL,
com.sun.star.beans.PropertyValue[] aArguments)
Stores a document to the given URL.
|
void |
writeExternal(java.io.ObjectOutput aObjOut)
Deprecated.
|
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic OOoBean()
public OOoBean(OfficeConnection iConnection) throws NoConnectionException
NoConnectionException - if the connection is not established.public void writeExternal(java.io.ObjectOutput aObjOut)
writeExternal in interface java.io.Externalizablepublic void readExternal(java.io.ObjectInput aObjIn)
readExternal in interface java.io.Externalizablepublic void setOOoStartTimeOut(int nMilliSecs)
public void setOOoCallTimeOut(int nMilliSecs)
public void setOOoCheckCycle(int nMilliSecs)
public void startOOoConnection(java.lang.String aConnectionURL)
throws java.net.MalformedURLException,
HasConnectionException,
NoConnectionException
HasConnectionException - if a connection was already established.NoConnectionException - if the specified connection cannot be establishedjava.net.MalformedURLExceptionpublic boolean isOOoConnected()
public void stopOOoConnection()
public OfficeConnection getOOoConnection() throws NoConnectionException
stopOOoConnection or other API methods. If other instances share the
same connection then they will stop function properly, because they loose their
connection as well. The recommended way to end the connection is
calling stopOOoConnection.NoConnectionException - if no connection can be establishedpublic com.sun.star.lang.XMultiServiceFactory getMultiServiceFactory()
throws NoConnectionException
NoConnectionException - if no connection is established and no default connection can be established.public com.sun.star.frame.XDesktop getOOoDesktop()
throws NoConnectionException
NoConnectionException - if no connection is established and no default connection can be established.public void clearDocument(boolean bClearStateToo)
throws com.sun.star.util.CloseVetoException,
NoConnectionException
clear() which discards
the currently displayed document.bClearStateToo - Not only the document content but also the state of the bean,
like visibility of child components is cleared.com.sun.star.util.CloseVetoExceptionNoConnectionExceptionpublic void clear()
public void aquireSystemWindow()
throws SystemWindowException,
NoConnectionException
loadFromURL, loadFromStream1,
or loadFromByteArray
is called, then the document is automatically displayed.
Should one of the load methods have been called before the Java container
was showing, then this method needs to be called after the container window
was made visible (java.lang.Component.setVisible(true)).
Another scenario is that a OOoBean contains a document and is removed from a Java container and later added again. Then aquireSystemWindow needs to be called after the container window is displayed.
SystemWindowException - if no system window can be aquired.NoConnectionException - if the connection is not established.public void releaseSystemWindow()
throws SystemWindowException,
NoConnectionException
SystemWindowException - if system window is not aquired.NoConnectionException - if the connection is not established.public void loadFromURL(java.lang.String aURL,
com.sun.star.beans.PropertyValue[] aArguments)
throws NoConnectionException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException,
com.sun.star.util.CloseVetoException
java.lang.IllegalArgumentException - if either of the arguments is out of the specified range.java.io.IOException - if an IO error occurs reading the ressource specified by the URL.com.sun.star.lang.NoConnectionException - if no connection can be established.com.sun.star.util.CloseVetoException - if the currently displayed document cannot be closed because it is
still be used, for example it is printed.NoConnectionExceptioncom.sun.star.lang.IllegalArgumentExceptionpublic void loadFromStream(java.io.InputStream iInStream,
com.sun.star.beans.PropertyValue[] aArguments)
throws NoConnectionException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException,
com.sun.star.util.CloseVetoException
NoConnectionExceptionjava.io.IOExceptioncom.sun.star.lang.IllegalArgumentExceptioncom.sun.star.util.CloseVetoExceptionpublic void loadFromByteArray(byte[] aInBuffer,
com.sun.star.beans.PropertyValue[] aArguments)
throws NoConnectionException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException,
com.sun.star.util.CloseVetoException
NoConnectionExceptionjava.io.IOExceptioncom.sun.star.lang.IllegalArgumentExceptioncom.sun.star.util.CloseVetoExceptionpublic void storeToURL(java.lang.String aURL,
com.sun.star.beans.PropertyValue[] aArguments)
throws NoConnectionException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException,
NoDocumentException
Due due a bug (50651) calling this method may cause the office to crash,
when at the same time the office writes a backup of the document. This bug
also affects storeToByteArray and
storeToStream. The workaround
is to start the office with the option -norestore, which disables the automatic
backup and recovery mechanism. OOoBean offers currently no supported way of providing
startup options for OOo. But it is possible to set a Java property when starting
Java, which is examined by OOoBean:
java -Dcom.sun.star.officebean.Options=-norestore ...
It is planned to offer a way of specifying startup options in a future version.
The property can be used until then. When using this property only one option
can be provided.java.lang.IllegalArgumentException - if either of the arguments is out of the specified range.java.io.IOException - if an IO error occurs reading the ressource specified by the URL.com.sun.star.lang.NoConnectionException - if no connection is established.NoDocumentException - if no document is loadedNoConnectionExceptioncom.sun.star.lang.IllegalArgumentExceptionpublic java.io.OutputStream storeToStream(java.io.OutputStream aOutStream,
com.sun.star.beans.PropertyValue[] aArguments)
throws NoConnectionException,
NoDocumentException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException
storeToURL for further information.NoConnectionExceptionNoDocumentExceptionjava.io.IOExceptioncom.sun.star.lang.IllegalArgumentExceptionstoreToURLpublic byte[] storeToByteArray(byte[] aOutBuffer,
com.sun.star.beans.PropertyValue[] aArguments)
throws NoConnectionException,
NoDocumentException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException
storeToURL for further information.NoConnectionExceptionNoDocumentExceptionjava.io.IOExceptioncom.sun.star.lang.IllegalArgumentExceptionstoreToURLpublic Frame getFrame() throws NoConnectionException
NoConnectionException - if the connection is not established.NotDocumentException - if no document is loaded an thus no frame is available.public Controller getController() throws NoConnectionException
NoConnectionException - if the connection is not established.public OfficeDocument getDocument() throws NoConnectionException
NoConnectionException - if the connection is not established.public void setAllBarsVisible(boolean bVisible)
com.sun.star.beans.XPropertySet xPropSet =
(com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, aFrame );
com.sun.star.frame.XLayoutManager xLayoutManager =
(com.sun.star.frame.XLayoutManager) UnoRuntime.queryInterface(
com.sun.star.frame.XLayoutManager.class,
xPropSet.getPropertyValue( "LayoutManager" ) );
xLayoutManager.showElement("private:resource/menubar/menubar");
If an older OOoBean instance is used with a newer OOo instance, some tool bars might not be affected by this method.
If no connection is established or no document is loaded, the setting is memorized until a document is loaded. Same is valid when the connection dies within this function call.
protected void applyToolVisibilities()
throws java.lang.InterruptedException
setAllBarsVisible.java.lang.InterruptedExceptionprotected boolean setToolVisible(java.lang.String aProperty,
java.lang.String aResourceURL,
boolean bOldValue,
boolean bNewValue)
throws java.lang.InterruptedException
setAllBarsVisible(boolean).bnewValue - If false, the tool bar is disabled,
If true, the tool bar is visible.java.lang.InterruptedExceptionpublic void setMenuBarVisible(boolean bVisible)
setAllBarsVisible(boolean).If not connected or no document loaded, the value is stored and automatically applied to the document after it is loaded. Same is valid when the connection dies within this function call.
bVisible - If false, the menu bar is disabled,
If true, the menu bar is visible.public boolean isMenuBarVisible()
setAllBarsVisible(boolean).public void setStandardBarVisible(boolean bVisible)
setAllBarsVisible(boolean).bVisible - If false, the main function bar is disabled,
If true, the main function bar is visible.public boolean isStandardBarVisible()
setAllBarsVisible(boolean).public void setToolBarVisible(boolean bVisible)
setAllBarsVisible(boolean).bVisible - If false, the tool function bar is disabled,
If true, the tool function bar is visible.public boolean isToolBarVisible()
setAllBarsVisible(boolean).public void setStatusBarVisible(boolean bVisible)
setAllBarsVisible(boolean).bVisible - If false, the status function bar is disabled,
If true, the status function bar is visible.public boolean isStatusBarVisible()
setAllBarsVisible(boolean).public void paint(java.awt.Graphics aGraphics)
paint in class java.awt.Containerprotected com.sun.star.beans.PropertyValue[] addArgument(com.sun.star.beans.PropertyValue[] aArguments,
com.sun.star.beans.PropertyValue aArgument)
If the argument by its name is not yet in aArguments, a new array is created, aArgument added and the new array returned.