summaryrefslogtreecommitdiff
path: root/bean
diff options
context:
space:
mode:
authorMichael Hönnig <mi@openoffice.org>2004-09-06 14:11:38 +0000
committerMichael Hönnig <mi@openoffice.org>2004-09-06 14:11:38 +0000
commit4d05ec4dff25bd784b0aed90799729c43c165a82 (patch)
treee94bc3e849449051892fc1beb2206704768e82b5 /bean
parent99231b5f902d8bd0e413c9ab769f308baf901201 (diff)
initial release
Diffstat (limited to 'bean')
-rw-r--r--bean/com/sun/star/comp/beans/ContainerFactory.java80
-rw-r--r--bean/com/sun/star/comp/beans/Controller.java140
-rw-r--r--bean/com/sun/star/comp/beans/Frame.java212
-rw-r--r--bean/com/sun/star/comp/beans/HasConnectionException.java72
-rw-r--r--bean/com/sun/star/comp/beans/InvalidArgumentException.java68
-rw-r--r--bean/com/sun/star/comp/beans/JavaWindowPeerFake.java162
-rw-r--r--bean/com/sun/star/comp/beans/LocalOfficeConnection.java650
-rw-r--r--bean/com/sun/star/comp/beans/LocalOfficeWindow.java343
-rw-r--r--bean/com/sun/star/comp/beans/NativeConnection.java92
-rw-r--r--bean/com/sun/star/comp/beans/NativeService.java69
-rw-r--r--bean/com/sun/star/comp/beans/NoConnectionException.java72
-rw-r--r--bean/com/sun/star/comp/beans/NoDocumentException.java68
-rw-r--r--bean/com/sun/star/comp/beans/OOoBean.java1450
-rw-r--r--bean/com/sun/star/comp/beans/OfficeConnection.java113
-rw-r--r--bean/com/sun/star/comp/beans/OfficeDocument.java258
-rw-r--r--bean/com/sun/star/comp/beans/OfficeWindow.java88
-rw-r--r--bean/com/sun/star/comp/beans/SystemWindowException.java68
-rw-r--r--bean/com/sun/star/comp/beans/Wrapper.java136
-rw-r--r--bean/com/sun/star/comp/beans/makefile.mk116
19 files changed, 4257 insertions, 0 deletions
diff --git a/bean/com/sun/star/comp/beans/ContainerFactory.java b/bean/com/sun/star/comp/beans/ContainerFactory.java
new file mode 100644
index 000000000000..70a948b25c3d
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/ContainerFactory.java
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * $RCSfile: ContainerFactory.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:30 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import java.awt.Container;
+
+/**
+ * This interface reprecents an AWT container factory.
+ *
+ * @see OfficeBean
+ */
+
+public interface ContainerFactory
+{
+ /**
+ * Creates an AWT container.
+ *
+ * @return An AWT container.
+ */
+ Container createContainer();
+}
diff --git a/bean/com/sun/star/comp/beans/Controller.java b/bean/com/sun/star/comp/beans/Controller.java
new file mode 100644
index 000000000000..2978251b45a6
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/Controller.java
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * $RCSfile: Controller.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import com.sun.star.uno.UnoRuntime;
+
+class Controller
+ extends Wrapper
+ implements
+ com.sun.star.frame.XController
+{
+ private com.sun.star.frame.XController xController;
+ private com.sun.star.frame.XDispatchProvider xDispatchProvider;
+
+ Controller( com.sun.star.frame.XController xController )
+ {
+ super( xController );
+ this.xController = xController;
+ xDispatchProvider = (com.sun.star.frame.XDispatchProvider)
+ UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
+ xController );
+ }
+
+ //==============================================================
+ // com.sun.star.frame.XController
+ //--------------------------------------------------------------
+
+ public void attachFrame( /*IN*/ com.sun.star.frame.XFrame xFrame )
+ {
+ xController.attachFrame( xFrame );
+ }
+
+ public boolean attachModel( /*IN*/ com.sun.star.frame.XModel xModel )
+ {
+ return xController.attachModel( xModel );
+ }
+
+ public boolean suspend( /*IN*/boolean bSuspend )
+ {
+ return xController.suspend( bSuspend );
+ }
+
+ public java.lang.Object getViewData( )
+ {
+ return xController.getViewData();
+ }
+
+ public void restoreViewData( /*IN*/java.lang.Object aData )
+ {
+ xController.restoreViewData( aData );
+ }
+
+ public com.sun.star.frame.XModel getModel( )
+ {
+ return xController.getModel();
+ }
+
+ public com.sun.star.frame.XFrame getFrame( )
+ {
+ return xController.getFrame();
+ }
+
+ //==============================================================
+ // com.sun.star.frame.XDispatchProvider
+ //--------------------------------------------------------------
+
+ public com.sun.star.frame.XDispatch queryDispatch(
+ /*IN*/ com.sun.star.util.URL aURL,
+ /*IN*/ String aTargetFrameName,
+ /*IN*/ int nSearchFlags )
+ {
+ return xDispatchProvider.queryDispatch( aURL, aTargetFrameName, nSearchFlags );
+ }
+
+ public com.sun.star.frame.XDispatch[] queryDispatches(
+ /*IN*/ com.sun.star.frame.DispatchDescriptor[] aRequests )
+ {
+ return xDispatchProvider.queryDispatches( aRequests );
+ }
+}
+
diff --git a/bean/com/sun/star/comp/beans/Frame.java b/bean/com/sun/star/comp/beans/Frame.java
new file mode 100644
index 000000000000..4056cfd0ced4
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/Frame.java
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * $RCSfile: Frame.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import com.sun.star.uno.UnoRuntime;
+
+class Frame
+ extends Wrapper
+ implements
+ com.sun.star.frame.XFrame,
+ com.sun.star.frame.XDispatchProvider,
+ com.sun.star.frame.XDispatchProviderInterception
+{
+ private com.sun.star.frame.XFrame xFrame;
+ private com.sun.star.frame.XDispatchProvider xDispatchProvider;
+ private com.sun.star.frame.XDispatchProviderInterception xDispatchProviderInterception;
+
+ public Frame( com.sun.star.frame.XFrame xFrame )
+ {
+ super( xFrame );
+ this.xFrame = xFrame;
+ xDispatchProvider = (com.sun.star.frame.XDispatchProvider)
+ UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class,
+ xFrame );
+ xDispatchProviderInterception = (com.sun.star.frame.XDispatchProviderInterception)
+ UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProviderInterception.class,
+ xFrame );
+ }
+
+ //==============================================================
+ // com.sun.star.frame.XFrame
+ //--------------------------------------------------------------
+
+ public void initialize( /*IN*/com.sun.star.awt.XWindow xWindow )
+ {
+ xFrame.initialize( xWindow );
+ }
+
+ public com.sun.star.awt.XWindow getContainerWindow( )
+ {
+ return xFrame.getContainerWindow();
+ }
+
+ public void setCreator( /*IN*/ com.sun.star.frame.XFramesSupplier xCreator )
+ {
+ xFrame.setCreator( xCreator );
+ }
+
+ public com.sun.star.frame.XFramesSupplier getCreator( )
+ {
+ return xFrame.getCreator();
+ }
+
+ public String getName( )
+ {
+ return xFrame.getName();
+ }
+
+ public void setName( /*IN*/ String aName )
+ {
+ xFrame.setName( aName );
+ }
+
+ public com.sun.star.frame.XFrame findFrame( /*IN*/String aTargetFrameName, /*IN*/int nSearchFlags )
+ {
+ return xFrame.findFrame( aTargetFrameName, nSearchFlags );
+ }
+
+ public boolean isTop( )
+ {
+ return xFrame.isTop();
+ }
+
+ public void activate( )
+ {
+ xFrame.activate();
+ }
+
+ public void deactivate( )
+ {
+ xFrame.deactivate();
+ }
+
+ public boolean isActive( )
+ {
+ return xFrame.isActive();
+ }
+
+ public boolean setComponent( /*IN*/com.sun.star.awt.XWindow xComponentWindow, /*IN*/ com.sun.star.frame.XController xController )
+ {
+ return xFrame.setComponent( xComponentWindow, xController );
+ }
+
+ public com.sun.star.awt.XWindow getComponentWindow( )
+ {
+ return xFrame.getComponentWindow();
+ }
+
+ public com.sun.star.frame.XController getController( )
+ {
+ return xFrame.getController();
+ }
+
+ public void contextChanged( )
+ {
+ xFrame.contextChanged();
+ }
+
+ public void addFrameActionListener( /*IN*/ com.sun.star.frame.XFrameActionListener xListener )
+ {
+ xFrame.addFrameActionListener( xListener );
+ }
+
+ public void removeFrameActionListener( /*IN*/ com.sun.star.frame.XFrameActionListener xListener )
+ {
+ xFrame.removeFrameActionListener( xListener );
+ }
+
+ //==============================================================
+ // com.sun.star.frame.XDispatchProvider
+ //--------------------------------------------------------------
+
+ public com.sun.star.frame.XDispatch queryDispatch(
+ /*IN*/ com.sun.star.util.URL aURL,
+ /*IN*/ String aTargetFrameName,
+ /*IN*/ int nSearchFlags )
+ {
+ return xDispatchProvider.queryDispatch( aURL, aTargetFrameName, nSearchFlags );
+ }
+
+ public com.sun.star.frame.XDispatch[] queryDispatches(
+ /*IN*/ com.sun.star.frame.DispatchDescriptor[] aRequests )
+ {
+ return xDispatchProvider.queryDispatches( aRequests );
+ }
+
+ //==============================================================
+ // com.sun.star.frame.XDispatchProviderInterception
+ //--------------------------------------------------------------
+
+ public void registerDispatchProviderInterceptor(
+ /*IN*/ com.sun.star.frame.XDispatchProviderInterceptor xInterceptor )
+ {
+ xDispatchProviderInterception.registerDispatchProviderInterceptor( xInterceptor );
+ }
+
+ public void releaseDispatchProviderInterceptor(
+ /*IN*/ com.sun.star.frame.XDispatchProviderInterceptor xInterceptor )
+ {
+ xDispatchProviderInterception.releaseDispatchProviderInterceptor( xInterceptor );
+ }
+};
+
diff --git a/bean/com/sun/star/comp/beans/HasConnectionException.java b/bean/com/sun/star/comp/beans/HasConnectionException.java
new file mode 100644
index 000000000000..589fb10610de
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/HasConnectionException.java
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: HasConnectionException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+/** This expception is thrown when a method is called which
+ is only defined for not already having an established
+ connection.
+ */
+public class HasConnectionException extends Exception
+{
+};
+
+
diff --git a/bean/com/sun/star/comp/beans/InvalidArgumentException.java b/bean/com/sun/star/comp/beans/InvalidArgumentException.java
new file mode 100644
index 000000000000..c6d3a7d4dfd7
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/InvalidArgumentException.java
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: InvalidArgumentException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+public class InvalidArgumentException extends Exception
+{
+};
+
+
diff --git a/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java b/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java
new file mode 100644
index 000000000000..8ae139c7ab4c
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: JavaWindowPeerFake.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import java.awt.*;
+
+import com.sun.star.uno.*;
+import com.sun.star.lang.*;
+import com.sun.star.awt.*;
+import com.sun.star.util.*;
+import com.sun.star.beans.*;
+import com.sun.star.container.*;
+
+/** <p>Class to pass the system window handle to the OpenOffice.org toolkit.</p>
+ */
+/* package */ class JavaWindowPeerFake
+ implements XSystemDependentWindowPeer, XWindowPeer
+{
+
+ protected long hWindow;
+ protected int localSystemType;
+
+ /** Create the faked window peer.
+ * @param _hWindow the system handle to the window.
+ * @param _systemType specifies the system type.
+ */
+ public JavaWindowPeerFake(long _hWindow, int _systemType)
+ {
+ hWindow = _hWindow;
+ localSystemType = _systemType;
+ }
+
+ /** <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)
+ throws com.sun.star.uno.RuntimeException
+ {
+
+ if (SystemType == localSystemType) {
+ return new Integer((int)hWindow);
+ }
+ else return null;
+ }
+
+ /** not really neaded.
+ */
+ public XToolkit getToolkit()
+ throws com.sun.star.uno.RuntimeException
+ {
+ return null;
+ }
+
+ /** not really neaded.
+ */
+ public void setPointer(/*IN*/XPointer Pointer)
+ throws com.sun.star.uno.RuntimeException
+ {
+ }
+
+ /** not really neaded.
+ */
+ public void setBackground(/*IN*/int Color)
+ throws com.sun.star.uno.RuntimeException
+ {
+ }
+
+ /** not really neaded.
+ */
+ 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)
+ throws com.sun.star.uno.RuntimeException
+ {
+ }
+
+ /** not really neaded.
+ */
+ public void dispose()
+ throws com.sun.star.uno.RuntimeException
+ {
+ }
+
+ /** not really neaded.
+ */
+ 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)
+ throws com.sun.star.uno.RuntimeException
+ {
+ }
+}
+
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
new file mode 100644
index 000000000000..af6631a8d8ba
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
@@ -0,0 +1,650 @@
+/*************************************************************************
+ *
+ * $RCSfile: LocalOfficeConnection.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import java.util.Properties;
+import java.util.Enumeration;
+
+import com.sun.star.comp.helper.Bootstrap;
+
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.container.XSet;
+import com.sun.star.connection.XConnection;
+import com.sun.star.bridge.XBridge;
+import com.sun.star.bridge.XBridgeFactory;
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.comp.loader.JavaLoader;
+import com.sun.star.loader.XImplementationLoader;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Exception;
+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.
+ */
+public class LocalOfficeConnection
+ implements OfficeConnection
+{
+ public static final String OFFICE_APP_NAME = "soffice";
+ public static final String OFFICE_LIB_NAME = "officebean";
+ public static final String OFFICE_ID_SUFFIX = "_Office";
+
+ private Process mProcess;
+ private ContainerFactory mContainerFactory;
+ private XComponentContext mContext;
+
+ private String mURL;
+ private String mProgramPath;
+ private String mConnType;
+ private String mPipe;
+ private String mPort;
+ private String mProtocol;
+ private String mInitialObject;
+
+ private List mComponents = new Vector();
+
+ /**
+ * Constructor.
+ * Sets up paths to the office application and native libraries if
+ * values are available in <code>OFFICE_PROP_FILE</code> in the user
+ * home directory.<br />
+ * "com.sun.star.beans.path" - the office application directory;<br/>
+ * "com.sun.star.beans.libpath" - native libraries directory.
+ */
+ public LocalOfficeConnection()
+ {
+ // init member vars
+ try
+ {
+ setUnoUrl( "uno:pipe,name=" + getPipeName() + ";urp;StarOffice.ServiceManager" );
+ }
+ catch ( java.net.MalformedURLException e )
+ {}
+
+ // load libofficebean.so/officebean.dll
+ String aSharedLibName = getProgramPath() + java.io.File.separator +
+ System.mapLibraryName(OFFICE_LIB_NAME);
+ System.load( aSharedLibName );
+ }
+
+ /**
+ * Sets a connection URL.
+ * This implementation accepts a UNO URL with following format:<br />
+ * <pre>
+ * url := uno:localoffice[,&lt;params&gt;];urp;StarOffice.ServiceManager
+ * params := &lt;path&gt;[,&lt;pipe&gt;]
+ * path := path=&lt;pathv&gt;
+ * pipe := pipe=&lt;pipev&gt;
+ * pathv := platform_specific_path_to_the_local_office_distribution
+ * pipev := local_office_connection_pipe_name
+ * </pre>
+ *
+ * @param url This is UNO URL which discribes the type of a connection.
+ */
+ public void setUnoUrl(String url)
+ throws java.net.MalformedURLException
+ {
+ mURL = null;
+
+ String prefix = "uno:localoffice";
+ if ( url.startsWith(prefix) )
+ parseUnoUrlWithOfficePath( url, prefix );
+ else
+ {
+ try
+ {
+ UnoUrl aURL = UnoUrl.parseUnoUrl( url );
+ mProgramPath = null;
+ mConnType = aURL.getConnection();
+ mPipe = (String) aURL.getConnectionParameters().get( "pipe" );
+ mPort = (String) aURL.getConnectionParameters().get( "port" );
+ mProtocol = aURL.getProtocol();
+ mInitialObject = aURL.getRootOid();
+ }
+ catch ( com.sun.star.lang.IllegalArgumentException eIll )
+ {
+ throw new java.net.MalformedURLException(
+ "Invalid UNO connection URL.");
+ }
+ }
+ mURL = url;
+ }
+
+ /**
+ * Sets an AWT container catory.
+ *
+ * @param containerFactory This is a application provided AWT container
+ * factory.
+ */
+ public void setContainerFactory(ContainerFactory containerFactory)
+ {
+ mContainerFactory = containerFactory;
+ }
+
+ /**
+ * Retrives 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
+ * to the office application.
+ *
+ * @return The office UNO component context.
+ */
+ public XComponentContext getComponentContext()
+ {
+ if ( mContext == null )
+ mContext = connect();
+ return mContext;
+ }
+
+ /**
+ * Creates an office window.
+ * The window is either a sub-class of java.awt.Canvas (local) or
+ * java.awt.Container (RVP).
+ *
+ * @param container This is an AWT container.
+ * @return The office window instance.
+ */
+ public OfficeWindow createOfficeWindow(Container container)
+ {
+ return new LocalOfficeWindow(this);
+ }
+
+ /**
+ * Closes the connection.
+ */
+ public void dispose()
+ {
+ Iterator itr = mComponents.iterator();
+ while (itr.hasNext() == true) {
+ // ignore runtime exceptions in dispose
+ try { ((XEventListener)itr.next()).disposing(null); }
+ catch ( RuntimeException aExc ) {}
+ }
+ mComponents.clear();
+
+ mContainerFactory = null;
+ mContext = null;
+ }
+
+ /**
+ * Adds an event listener to the object.
+ *
+ * @param listener is a listener object.
+ */
+ public void addEventListener(XEventListener listener)
+ {
+ mComponents.add(listener);
+ }
+
+ /**
+ * Removes an event listener from the listener list.
+ *
+ * @param listener is a listener object.
+ */
+ public void removeEventListener(XEventListener listener)
+ {
+ mComponents.remove(listener);
+ }
+
+ /**
+ * Establishes the connection to the office.
+ */
+ private XComponentContext connect()
+ {
+ try
+ {
+ // create default local component context
+ XComponentContext xLocalContext =
+ com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
+
+ // initial serviceManager
+ XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
+
+ // create a urlresolver
+ Object urlResolver = xLocalServiceManager.createInstanceWithContext(
+ "com.sun.star.bridge.UnoUrlResolver", xLocalContext );
+
+ // query for the XUnoUrlResolver interface
+ XUnoUrlResolver xUrlResolver =
+ (XUnoUrlResolver) UnoRuntime.queryInterface( XUnoUrlResolver.class, urlResolver );
+
+ // try to connect to soffice
+ Object aInitialObject = null;
+ try
+ {
+ aInitialObject = xUrlResolver.resolve( mURL );
+ }
+ catch( com.sun.star.connection.NoConnectException e )
+ {
+ // launch soffice
+ OfficeService aSOffice = new OfficeService();
+ aSOffice.startupService();
+
+ // wait until soffice is started
+ long nMaxMillis = System.currentTimeMillis() + 1000*aSOffice.getStartupTime();
+ while ( aInitialObject == null )
+ {
+ try
+ {
+ // try to connect to soffice
+ Thread.currentThread().sleep( 500 );
+ aInitialObject = xUrlResolver.resolve( mURL );
+ }
+ catch( com.sun.star.connection.NoConnectException aEx )
+ {
+ // soffice did not start in time
+ if ( System.currentTimeMillis() > nMaxMillis )
+ throw aEx;
+
+ }
+ }
+ }
+ finally
+ {
+ }
+
+ // XComponentContext
+ if( null != aInitialObject )
+ {
+ XPropertySet xPropertySet = (XPropertySet)
+ UnoRuntime.queryInterface( XPropertySet.class, aInitialObject);
+ Object xContext = xPropertySet.getPropertyValue("DefaultContext");
+ XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(
+ XComponentContext.class, xContext);
+ return xComponentContext;
+ }
+ }
+ catch( com.sun.star.connection.NoConnectException e )
+ {
+ System.out.println( "Couldn't connect to remote server" );
+ System.out.println( e.getMessage() );
+ }
+ catch( com.sun.star.connection.ConnectionSetupException e )
+ {
+ System.out.println( "Couldn't access necessary local resource to establish the interprocess connection" );
+ System.out.println( e.getMessage() );
+ }
+ catch( com.sun.star.lang.IllegalArgumentException e )
+ {
+ System.out.println( "uno-url is syntactical illegal ( " + mURL + " )" );
+ System.out.println( e.getMessage() );
+ }
+ catch( com.sun.star.uno.RuntimeException e )
+ {
+ System.out.println( "--- RuntimeException:" );
+ System.out.println( e.getMessage() );
+ e.printStackTrace();
+ System.out.println( "--- end." );
+ throw e;
+ }
+ catch( java.lang.Exception e )
+ {
+ System.out.println( "java.lang.Exception: " );
+ System.out.println( e );
+ e.printStackTrace();
+ System.out.println( "--- end." );
+ throw new com.sun.star.uno.RuntimeException( e.toString() );
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrives a path to the office program folder.
+ *
+ * @return The path to the office program folder.
+ */
+ private String getProgramPath()
+ {
+ if (mProgramPath == null)
+ {
+ // determine name of executable soffice
+ String aExec = OFFICE_APP_NAME; // default for UNIX
+ String aOS = System.getProperty("os.name");
+
+ // running on Windows?
+ if (aOS.startsWith("Windows"))
+ aExec = OFFICE_APP_NAME + ".exe";
+
+ // add other non-UNIX operating systems here
+ // ...
+
+ // find soffice executable relative to this class's class loader:
+ File path = NativeLibraryLoader.getResource(
+ this.getClass().getClassLoader(), aExec);
+ if (path != null)
+ mProgramPath = path.getParent();
+
+ // default is ""
+ if ( mProgramPath == null )
+ mProgramPath = "";
+ }
+ return mProgramPath;
+ }
+
+ /**
+ * Parses a connection URL.
+ * This method accepts a UNO URL with following format:<br />
+ * <pre>
+ * url := uno:localoffice[,&lt;params&gt;];urp;StarOffice.NamingService
+ * params := &lt;path&gt;[,&lt;pipe&gt;]
+ * path := path=&lt;pathv&gt;
+ * pipe := pipe=&lt;pipev&gt;
+ * pathv := platform_specific_path_to_the_local_office_distribution
+ * pipev := local_office_connection_pipe_name
+ * </pre>
+ *
+ * <h4>Examples</h4>
+ * <ul>
+ * <li>"uno:localoffice,pipe=xyz_Office,path=/opt/openoffice11/program;urp;StarOffice.ServiceManager";
+ * <li>"uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager";
+ * </ul>
+ *
+ * @param url This is UNO URL which describes the type of a connection.
+ * @exception java.net.MalformedURLException when inappropreate URL was
+ * provided.
+ */
+ private void parseUnoUrlWithOfficePath(String url, String prefix)
+ throws java.net.MalformedURLException
+ {
+ // Extruct parameters.
+ int idx = url.indexOf(";urp;StarOffice.NamingService");
+ if (idx < 0)
+ throw new java.net.MalformedURLException(
+ "Invalid UNO connection URL.");
+ String params = url.substring(prefix.length(), idx + 1);
+
+ // Parse parameters.
+ String name = null;
+ String path = null;
+ String pipe = null;
+ char ch;
+ int state = 0;
+ StringBuffer buffer = new StringBuffer();
+ for(idx = 0; idx < params.length(); idx += 1) {
+ ch = params.charAt(idx);
+ switch (state) {
+ case 0: // initial state
+ switch(ch) {
+ case ',':
+ buffer.delete(0, buffer.length());
+ state = 1;
+ break;
+
+ case ';':
+ state = 7;
+ break;
+
+ default:
+ buffer.delete(0, buffer.length());
+ buffer.append(ch);
+ state = 1;
+ break;
+ }
+ break;
+
+ case 1: // parameter name
+ switch(ch) {
+ case ' ':
+ case '=':
+ name = buffer.toString();
+ state = (ch == ' ')? 2: 3;
+ break;
+
+ case ',':
+ case ';':
+ state = -6; // error: invalid name
+ break;
+
+ default:
+ buffer.append(ch);
+ break;
+ }
+ break;
+
+ case 2: // equal between the name and the value
+ switch(ch) {
+ case '=':
+ state = 3;
+ break;
+
+ case ' ':
+ break;
+
+ default:
+ state = -1; // error: missing '='
+ break;
+ }
+ break;
+
+ case 3: // value leading spaces
+ switch(ch) {
+ case ' ':
+ break;
+
+ default:
+ buffer.delete(0, buffer.length());
+ buffer.append(ch);
+ state = 4;
+ break;
+ }
+ break;
+
+ case 4: // value
+ switch(ch) {
+ case ' ':
+ case ',':
+ case ';':
+ idx -= 1; // put back the last read character
+ state = 5;
+ if (name.equals("path")) {
+ if (path == null)
+ path = buffer.toString();
+ else
+ state = -3; // error: more then one 'path'
+ } else if (name.equals("pipe")) {
+ if (pipe == null)
+ pipe = buffer.toString();
+ else
+ state = -4; // error: more then one 'pipe'
+ } else
+ state = -2; // error: unknown parameter
+ buffer.delete(0, buffer.length());
+ break;
+
+ default:
+ buffer.append(ch);
+ break;
+ }
+ break;
+
+ case 5: // a delimeter after the value
+ switch(ch) {
+ case ' ':
+ break;
+
+ case ',':
+ state = 6;
+ break;
+
+ case ';':
+ state = 7;
+ break;
+
+ default:
+ state = -5; // error: ' ' inside the value
+ break;
+ }
+ break;
+
+ case 6: // leading spaces before next parameter name
+ switch(ch) {
+ case ' ':
+ break;
+
+ default:
+ buffer.delete(0, buffer.length());
+ buffer.append(ch);
+ state = 1;
+ break;
+ }
+ break;
+
+ default:
+ throw new java.net.MalformedURLException(
+ "Invalid UNO connection URL.");
+ }
+ }
+ if (state != 7)
+ throw new java.net.MalformedURLException(
+ "Invalid UNO connection URL.");
+
+ // Set up the connection parameters.
+ if (path != null)
+ mProgramPath = path;
+ if (pipe != null)
+ mPipe = pipe;
+ }
+
+ /** creates a unique pipe name.
+ */
+ static String getPipeName()
+ {
+ // turn user name into a URL and file system safe name (% chars will not work)
+ String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX;
+ aPipeName = aPipeName.replaceAll( "_", "%B7" );
+ return java.net.URLEncoder.encode(aPipeName).replaceAll( "\\+", "%20" ).replaceAll( "%", "_" );
+ }
+
+ /**
+ * @para This is an implementation of the native office service.
+ */
+ private class OfficeService
+ implements NativeService
+ {
+ /**
+ * Retrive the office service identifier.
+ *
+ * @return The identifier of the office service.
+ */
+ public String getIdentifier()
+ {
+ if ( mPipe == null)
+ return getPipeName();
+ else
+ return mPipe;
+ }
+
+ /**
+ * Starts the office process.
+ */
+ public void startupService()
+ throws java.io.IOException
+ {
+ // create call with arguments
+ String[] cmdArray = new String[4];
+ cmdArray[0] = (new File(getProgramPath(), OFFICE_APP_NAME)).getPath();
+ cmdArray[1] = "-nologo";
+ cmdArray[2] = "-nodefault";
+ if ( mConnType.equals( "pipe" ) )
+ cmdArray[3] = "-accept=pipe,name=" + getIdentifier() + ";" +
+ mProtocol + ";" + mInitialObject;
+ else if ( mConnType.equals( "socket" ) )
+ cmdArray[3] = "-accept=socket,port=" + mPort + ";urp";
+ else
+ throw new java.io.IOException( "not connection specified" );
+
+ // start process
+System.err.println( "exec" + cmdArray[0] + " " + cmdArray[1] + " " + cmdArray[2] + " " + cmdArray[3] );
+ mProcess = Runtime.getRuntime().exec(cmdArray);
+ if ( mProcess == null )
+ throw new RuntimeException( "cannot start soffice: " + cmdArray );
+ }
+
+ /**
+ * Retrives the ammount of time to wait for the startup.
+ *
+ * @return The ammount of time to wait in seconds(?).
+ */
+ public int getStartupTime()
+ {
+ return 60;
+ }
+ }
+}
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java
new file mode 100644
index 000000000000..29ea22613c7f
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java
@@ -0,0 +1,343 @@
+/*************************************************************************
+ *
+ * $RCSfile: LocalOfficeWindow.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import java.awt.Component;
+import java.awt.Canvas;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.SystemDependent;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.awt.XVclWindowPeer;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.WindowDescriptor;
+import com.sun.star.awt.WindowAttribute;
+import com.sun.star.awt.WindowClass;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.Exception;
+
+/**
+ * This class represents a local office window.
+ */
+public class LocalOfficeWindow
+ extends java.awt.Canvas
+ implements OfficeWindow, XEventListener
+{
+ private transient OfficeConnection mConnection;
+ private transient XWindowPeer mParentProxy;
+ private transient XWindowPeer mWindow;
+ private boolean bPeer = false;
+
+ /**
+ * Construnctor.
+ *
+ * @param connection The office connection object the window
+ * belongs to.
+ */
+ /* package */ LocalOfficeWindow(OfficeConnection connection)
+ {
+ mConnection = connection;
+ mConnection.addEventListener((XEventListener)this);
+ }
+
+ /**
+ * Retrives an AWT component object associated with the OfficeWindow.
+ *
+ * @return The AWT component object associated with the OfficeWindow.
+ */
+ public Component getAWTComponent()
+ {
+ return this;
+ }
+
+ /**
+ * Retrives an UNO XWindowPeer object associated with the OfficeWindow.
+ *
+ * @return The UNO XWindowPeer object associated with the OfficeWindow.
+ */
+ public XWindowPeer getUNOWindowPeer()
+ {
+ if (mWindow == null)
+ createUNOWindowPeer();
+ return mWindow;
+ }
+
+ /**
+ * Receives a notification about the connection has been closed.
+ * This method has to set the connection to <code>null</code>.
+ *
+ * @source The event object.
+ */
+ public void disposing(EventObject source)
+ {
+ // the window will be disposed by the framework
+ mWindow = null;
+ mConnection = null;
+ }
+
+ /**
+ * Returns an AWT toolkit.
+ */
+ private XToolkit queryAWTToolkit()
+ throws com.sun.star.uno.Exception
+ {
+ // Create a UNO toolkit.
+ XMultiComponentFactory compfactory;
+ XComponentContext xContext = mConnection.getComponentContext();
+ if ( xContext != null )
+ {
+ compfactory = mConnection.getComponentContext().getServiceManager();
+ XMultiServiceFactory factory;
+ factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, compfactory);
+ Object object = factory.createInstance( "com.sun.star.awt.Toolkit");
+ return (XToolkit)UnoRuntime.queryInterface(XToolkit.class, object);
+ }
+ else
+ return null;
+ }
+
+ /// called when system parent is available, reparents the bean window
+ private void aquireSystemWindow()
+ {
+ if ( !bPeer )
+ {
+ // set real parent
+ XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface(
+ XVclWindowPeer.class, mWindow);
+ xVclWindowPeer.setProperty( "PluginParent", new Long(getNativeWindow()) );
+ bPeer = true;
+
+ // show document window
+ XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
+ aWindow.setVisible( true );
+ }
+ }
+
+ /// called when system parent is about to die, reparents the bean window
+ private void releaseSystemWindow()
+ {
+ if ( bPeer )
+ {
+ // hide document window
+ XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
+ aWindow.setVisible( false );
+
+ // set null parent
+ XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface(
+ XVclWindowPeer.class, mWindow);
+ xVclWindowPeer.setProperty( "PluginParent", new Long(0) );
+ bPeer = false;
+ }
+ }
+
+ /// callback handler to get to know when we become visible
+ class ComponentEventHandler
+ extends java.awt.event.ComponentAdapter
+ {
+ public void componentHidden( java.awt.event.ComponentEvent e)
+ {
+ // only when we become invisible, we might lose our system window
+ CallWatchThread aCallWatchThread = new CallWatchThread( 500 );
+ setVisible(false);
+ try { aCallWatchThread.cancel(); }
+ catch ( java.lang.InterruptedException aExc )
+ {} // ignore
+ }
+
+ public void componentShown( java.awt.event.ComponentEvent e)
+ {
+ // only when we become visible, we get a system window
+ aquireSystemWindow();
+ }
+ }
+
+ /// Overriding java.awt.Component.setVisible() due to Java bug (no showing event).
+ public void setVisible( boolean b )
+ {
+ super.setVisible(b);
+
+ // Java-Bug: componentShown() is never called :-(
+ // is still at least in Java 1.4.1_02
+ if ( b )
+ aquireSystemWindow();
+ else
+ releaseSystemWindow();
+ }
+
+ /** Factory method for a UNO AWT toolkit window as a child of this Java window.
+ *
+ */
+ private XWindowPeer createUNOWindowPeer()
+ {
+ try
+ {
+ // get this windows native window type
+ int type = getNativeWindowSystemType();
+
+ // Java AWT windows only have a system window when showing.
+ XWindowPeer parentPeer;
+ if ( isShowing() )
+ {
+ // create direct parent relationship
+ //setVisible( true );
+ parentPeer = new JavaWindowPeerFake( getNativeWindow(), type);
+ bPeer = true;
+ }
+ else
+ {
+ // no parent yet
+ parentPeer = null;
+ bPeer = false;
+ }
+
+ // create native window (mWindow)
+ Rectangle aRect = new Rectangle( 0, 0, 20, 20 );
+ WindowDescriptor desc = new WindowDescriptor();
+ desc.Type = WindowClass.TOP;
+ desc.Parent = parentPeer;
+ desc.Bounds = aRect;
+ desc.WindowServiceName = "workwindow";
+ desc.WindowAttributes = (type == SystemDependent.SYSTEM_WIN32)
+ ? WindowAttribute.SHOW : 0;
+ mWindow = queryAWTToolkit().createWindow(desc);
+
+ // to get notified when we become visible
+ addComponentListener( new ComponentEventHandler() );
+
+ // set initial visibility
+ XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow);
+ aWindow.setVisible( bPeer );
+ }
+ catch (com.sun.star.uno.Exception exp) {
+ }
+
+ return mWindow;
+ }
+
+ /**
+ * Retrives a platform dependant system window identifier.
+ *
+ * @return The system window identifier.
+ */
+ private native long getNativeWindow();
+
+ /**
+ * Retrives a platform dependant system window type.
+ *
+ * @return The system window type.
+ */
+ private native int getNativeWindowSystemType();
+
+ //---------------------------------------------------------------------------
+ /** Helper class to watch calls into OOo with a timeout.
+ */
+ class CallWatchThread extends Thread
+ {
+ Thread aWatchedThread;
+ long nTimeout;
+
+ CallWatchThread( long nTimeout )
+ {
+ this.aWatchedThread = Thread.currentThread();
+ this.nTimeout = nTimeout;
+ start();
+ }
+
+ void cancel()
+ throws java.lang.InterruptedException
+ {
+ Thread aThread = aWatchedThread;
+ aWatchedThread = null;
+ stop();
+
+ if ( aThread.interrupted() )
+ throw new InterruptedException();
+ }
+
+ public void run()
+ {
+ while ( aWatchedThread != null )
+ {
+ try { sleep( nTimeout ); }
+ catch ( java.lang.InterruptedException aExc )
+ {}
+
+ //synchronized
+ {
+ if ( aWatchedThread != null )
+ {
+ aWatchedThread.interrupt();
+ }
+ }
+ }
+ }
+ };
+
+}
diff --git a/bean/com/sun/star/comp/beans/NativeConnection.java b/bean/com/sun/star/comp/beans/NativeConnection.java
new file mode 100644
index 000000000000..9d2f431c64e6
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/NativeConnection.java
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: NativeConnection.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import com.sun.star.connection.XConnection;
+
+/* package */ 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)
+ throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException;
+
+ public native void write(/*IN*/byte[] aData)
+ throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException;
+
+ public native void flush()
+ throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException;
+
+ public native void close()
+ throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException;
+
+ public synchronized String getDescription()
+ throws com.sun.star.uno.RuntimeException
+ {
+ return Description;
+ }
+
+ private long NativeHandle;
+ private String Description;
+}
diff --git a/bean/com/sun/star/comp/beans/NativeService.java b/bean/com/sun/star/comp/beans/NativeService.java
new file mode 100644
index 000000000000..04a70aa6ab1f
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/NativeService.java
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: NativeService.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+
+/* package */ interface NativeService {
+ public String getIdentifier();
+ public void startupService() throws java.io.IOException;
+ public int getStartupTime();
+}
diff --git a/bean/com/sun/star/comp/beans/NoConnectionException.java b/bean/com/sun/star/comp/beans/NoConnectionException.java
new file mode 100644
index 000000000000..db5c454967f3
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/NoConnectionException.java
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: NoConnectionException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+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.
+ */
+public class NoConnectionException extends Exception
+{
+};
+
+
diff --git a/bean/com/sun/star/comp/beans/NoDocumentException.java b/bean/com/sun/star/comp/beans/NoDocumentException.java
new file mode 100644
index 000000000000..964cc9d3abbb
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/NoDocumentException.java
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: NoDocumentException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+public class NoDocumentException extends Exception
+{
+};
+
+
diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java
new file mode 100644
index 000000000000..447cdcfcc685
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/OOoBean.java
@@ -0,0 +1,1450 @@
+/*************************************************************************
+ *
+ * $RCSfile: OOoBean.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import com.sun.star.uno.UnoRuntime;
+
+// @requirement FUNC.PERF.LRN/0.6
+// @requirement FUNC.PERF.LOC/0.6
+// @requirement FUNC.PERF.FIX/0.6
+/** This is the basic JavaBean for all OOo application modules.
+
+ @requirement FUNC.RES.OTH/0.2
+ No other resources are needed yet.
+ */
+public class OOoBean
+
+ // @requirement FUNC.BEAN.VIEW/0.4
+ extends java.awt.Container
+
+ implements
+ // @requirement FUNC.PER/0.2
+ java.io.Externalizable,
+
+ com.sun.star.comp.beans.OOoBeanInterface
+{
+ // timeout values (milli secs)
+ int nOOoStartTimeOut = 60000;
+ int nOOoCallTimeOut = 3000;
+ int nOOoCheckCycle = 1000;
+
+ // used slot ids
+ public final static short SID_TOGGLEMENUBAR = 6661;
+ public final static short SID_TOGGLEOBJECTBAR = 5905;
+ public final static short SID_TOGGLETOOLBAR = 5909;
+ public final static short SID_TOGGLEMAINBAR = 5910;
+ public final static short SID_TOGGLESTATUSBAR = 5920;
+
+ // This member contains the connection to an OOo instance if established.
+ private transient OfficeConnection iConnection;
+ private transient EventListener xConnectionListener;
+
+ // @requirement FUNC.BEAN.VIEW/0.4
+ // @requirement FUNC.BEAN.EDIT/0.4
+ // This member contains the OOo window
+ // if a connection is established.
+ // It is a child of the OOoBean canvas.
+ private OfficeWindow xFrameWindow;
+
+ // application environment
+ private transient com.sun.star.lang.XMultiServiceFactory xServiceFactory;
+ private transient com.sun.star.frame.XDesktop xDesktop;
+
+ // document and frame
+ private transient Frame aFrame;
+ private transient Controller aController;
+ private transient OfficeDocument aDocument;
+
+ // slot command execution environment
+ private transient com.sun.star.frame.XDispatchProvider xDispatcher;
+ private transient com.sun.star.util.XURLTransformer xURLTransformer;
+
+ // properties
+ private boolean bIgnoreVisibility = false; // to show even if already visible
+ private boolean bMenuBarVisible = true;
+ private boolean bStandardBarVisible = true;
+ private boolean bToolBarVisible = true;
+ private boolean bStatusBarVisible = true;
+
+ //-------------------------------------------------------------------------
+ // debugging method
+ private void dbgPrint( String aMessage )
+ {
+ // System.err.println( aMessage );
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.PER/0.2
+ /** @internal
+ */
+ public void writeExternal( java.io.ObjectOutput aObjOut )
+ {
+ // TBD
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.PER/0.2
+ /** @internal
+ */
+ public void readExternal( java.io.ObjectInput aObjIn )
+ {
+ // TBD
+ }
+
+ //-------------------------------------------------------------------------
+ /** Generic constructor of the OOoBean.
+
+ Neither a connection is established nor any document loaded.
+ */
+ public OOoBean()
+ {}
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.CON.MULT/0.3
+ /** Constructor for an OOoBean which uses a specific office connection.
+
+ The connection must be established but no document is loaded.
+
+ @throws NoConnectionException
+ if the connection is not established.
+ */
+ public OOoBean( OfficeConnection iConnection )
+ throws NoConnectionException
+ {
+ try { setOOoConnection( iConnection ); }
+ catch ( HasConnectionException aExc )
+ { /* impossible here */ }
+ }
+
+ //-------------------------------------------------------------------------
+ /// Sets the timeout for methods which launch OOo in milli seconds.
+ public void setOOoStartTimeOut( int nMilliSecs )
+ {
+ nOOoStartTimeOut = nMilliSecs;
+ }
+
+ //-------------------------------------------------------------------------
+ /// Sets the timeout for normal OOO methods calls in milli seconds.
+ public void setOOoCallTimeOut( int nMilliSecs )
+ {
+ nOOoCallTimeOut = nMilliSecs;
+ }
+
+ //-------------------------------------------------------------------------
+ /// Sets the period length in milli seconds to check the OOo connection.
+ public void setOOoCheckCycle( int nMilliSecs )
+ {
+ nOOoCheckCycle = nMilliSecs;
+ }
+
+ //-------------------------------------------------------------------------
+ /** Sets the a connection to an OOo instance.
+
+ @internal
+ */
+ private synchronized void setOOoConnection( OfficeConnection iNewConnection )
+ throws HasConnectionException, NoConnectionException
+ {
+ // the connection cannot be exchanged
+ if ( iConnection != null )
+ throw new HasConnectionException();
+
+ // is there a real connection, not just the proxy?
+ com.sun.star.uno.XComponentContext xComponentContext = null;
+ try { xComponentContext = iNewConnection.getComponentContext(); }
+ catch ( java.lang.Throwable aExc )
+ { throw new NoConnectionException(); }
+ if ( xComponentContext == null )
+ throw new NoConnectionException();
+
+ // set the connection
+ iConnection = iNewConnection;
+
+ // get notified when connection dies
+ if ( xConnectionListener != null )
+ xConnectionListener.stop();
+ xConnectionListener = this.new EventListener();
+ dbgPrint( "new EventListener()" );
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.CON.STRT/0.4
+ /** Starts a connection to an OOo instance which is lauched if not running.
+ */
+ public void startOOoConnection( String aConnectionURL )
+ throws java.net.MalformedURLException,
+ HasConnectionException,
+ NoConnectionException
+ {
+ // create a new connection from the given connection URL
+ LocalOfficeConnection aConnection = new LocalOfficeConnection();
+ aConnection.setUnoUrl( aConnectionURL );
+ setOOoConnection( aConnection );
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.CON.CHK/0.7
+ /** Returns true if this OOoBean is connected to an OOo instance,
+ false otherwise.
+ */
+ public boolean isOOoConnected()
+ {
+ // TBD: could there be an existing, but dead connection?
+ return iConnection != null;
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.CON.STOP/0.4
+ /** Disconnects from the connected OOo instance.
+ */
+ public synchronized void stopOOoConnection()
+ {
+ // clear OOo document, frame etc.
+ try { clear(); }
+ catch ( java.lang.InterruptedException aExc )
+ {} // ignore exceptions from an old, dead connection
+
+ // cut the connection
+ OfficeConnection iExConnection = iConnection;
+ if ( iConnection != null )
+ {
+ xConnectionListener = null;
+ iConnection = null;
+ iExConnection.dispose();
+ }
+
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.CON.STOP/0.4 (via XComponent.dispose())
+ // @requirement FUNC.CON.NTFY/0.4 (via XComponent.addEventListener())
+ /** Returns the a connection to an OOo instance.
+
+ If no connection exists, a default connection will be created.
+ */
+ public synchronized OfficeConnection getOOoConnection()
+ throws NoConnectionException
+ {
+ if ( iConnection == null )
+ {
+ try { setOOoConnection( new LocalOfficeConnection() ); }
+ catch ( HasConnectionException aExc )
+ { /* impossible here */ }
+ }
+ if ( iConnection.getComponentContext() == null )
+ throw new NoConnectionException();
+ return iConnection;
+ }
+
+ //-------------------------------------------------------------------------
+
+ public synchronized com.sun.star.lang.XMultiServiceFactory getMultiServiceFactory()
+ throws NoConnectionException
+ {
+ if ( xServiceFactory == null )
+ {
+ // avoid concurrent access from multiple threads
+ final OfficeConnection iConn = getOOoConnection();
+
+ Thread aConnectorThread = new Thread() {
+ public void run()
+ {
+ com.sun.star.lang.XMultiComponentFactory aFactory =
+ iConn.getComponentContext().getServiceManager();
+ xServiceFactory = (com.sun.star.lang.XMultiServiceFactory)
+ UnoRuntime.queryInterface(
+ com.sun.star.lang.XMultiServiceFactory.class, aFactory );
+ }
+ };
+ aConnectorThread.start();
+ try { aConnectorThread.join(nOOoStartTimeOut); }
+ catch ( java.lang.InterruptedException aExc )
+ { throw new NoConnectionException(); }
+ if ( xServiceFactory == null )
+ throw new NoConnectionException();
+ }
+
+ return xServiceFactory;
+ }
+
+ //-------------------------------------------------------------------------
+ /// TBD
+ public synchronized com.sun.star.frame.XDesktop getOOoDesktop()
+ throws NoConnectionException
+ {
+ if ( xDesktop == null )
+ {
+ try
+ {
+ Object aObject = getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop");
+ xDesktop = (com.sun.star.frame.XDesktop) UnoRuntime.queryInterface(
+ com.sun.star.frame.XDesktop.class, aObject );
+ }
+ catch ( com.sun.star.uno.Exception aExc )
+ {} // TBD: what if no connection exists?
+ }
+
+ return xDesktop;
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement TBD
+ // @estimation 4h
+ /** Resets this bean to an empty document.
+
+ If a document is loaded and the content modified,
+ the changes are dismissed. Otherwise nothing happens.
+
+ This method works with and without a connection.
+
+ @param bClearStateToo
+ Not only the document content but also the state of the bean,
+ like visibility of child components is cleared.
+ */
+ public synchronized void clearDocument( boolean bClearStateToo )
+ throws com.sun.star.util.CloseVetoException
+ {
+ // TBD
+ com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable)
+ UnoRuntime.queryInterface( com.sun.star.util.XCloseable.class, aFrame );
+ if ( xCloseable != null )
+ xCloseable.close(true);
+ else
+ throw new RuntimeException( "frame without XCloseable" );
+ }
+
+ //-------------------------------------------------------------------------
+ /** Resets the OOoBean to an empty status.
+
+ Any loaded document is unloaded, no matter whether it is modified or not.
+ After calling this method, the OOoBean has no office document and no frame
+ anymore. The connection will stay, though.
+ */
+ public synchronized void clear()
+ throws java.lang.InterruptedException
+ {
+ CallWatchThread aCallWatchThread =
+ new CallWatchThread( nOOoCallTimeOut );
+ aDocument = null;
+ xDispatcher = null;
+ aFrame = null;
+
+ // clear xFrameWindow
+ if ( xFrameWindow != null )
+ {
+ try { releaseSystemWindow(); }
+ catch ( NoConnectionException aExc )
+ {} // ignore
+ catch ( SystemWindowException aExc )
+ {} // ignore
+ remove( xFrameWindow.getAWTComponent() );
+ xFrameWindow = null;
+ }
+
+ // clear xURTTransformer
+ if ( xURLTransformer != null )
+ {
+ try
+ {
+ com.sun.star.lang.XComponent xComp = (com.sun.star.lang.XComponent)
+ UnoRuntime.queryInterface(
+ com.sun.star.lang.XComponent.class, xURLTransformer );
+ if ( xComp != null )
+ xComp.dispose();
+ }
+ catch ( java.lang.Throwable aExc )
+ {} // ignore
+ xURLTransformer = null;
+ }
+
+ xDesktop = null;
+ xServiceFactory = null;
+
+ aCallWatchThread.cancel();
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.PAR.LWP/0.4
+ // @estimation 2h
+ /** This method must be called when the OOoBean can aquire a
+ sytem window from it's parent AWT/Swing component.
+
+ This is the case when java.awt.Component.isDisplayable() returns
+ true. This again is usually true when the parent is visible and
+ the parent container chain is created up to a top level system
+ window.
+
+ @throws SystemWindowException
+ if no system window can be aquired.
+
+ @throws NoConnectionException
+ if the connection is not established.
+ */
+ public synchronized void aquireSystemWindow()
+ throws
+ SystemWindowException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+ {
+ if ( iConnection == null )
+ throw new NoConnectionException();
+ if ( !isShowing() )
+ throw new SystemWindowException();
+
+ if ( xFrameWindow != null )
+ xFrameWindow.getAWTComponent().setVisible(true);
+ doLayout();
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.PAR.RWL/0.4
+ // @estimation 16h
+ /** This method must be called when the OOoBean before the
+ sytem window may be released by it's parent AWT/Swing component.
+
+ This is the case when java.awt.Component.isDisplayable() returns
+ true. This is definitely the case when the OOoBean is removed
+ from it's parent container.
+
+ @throws SystemWindowException
+ if system window is not aquired.
+
+ @throws NoConnectionException
+ if the connection is not established.
+ */
+ public synchronized void releaseSystemWindow()
+ throws
+ SystemWindowException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+ {
+ if ( iConnection == null )
+ throw new NoConnectionException();
+
+ try { xFrameWindow.getAWTComponent().setVisible(false); }
+ catch ( com.sun.star.lang.DisposedException aExc )
+ { throw new NoConnectionException(); }
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.BEAN.LOAD/0.4
+ // @requirement FUNC.CON.AUTO/0.3
+ // @estimation 2h
+ /** Loads the bean from the given URL.
+
+ If a document is already loaded and the content modified,
+ the changes are dismissed.
+
+ If no connection exists, a default connection is established.
+
+ @throws java.io.IOException
+ if an IO error occurs reading the ressource specified by the URL.
+
+ @throws IllegalArgumentException
+ if either of the arguments is out of the specified range.
+
+ @throws NoConnectionException
+ if no connection can be established.
+ */
+ public void loadFromURL(
+ final String aURL,
+ final com.sun.star.beans.PropertyValue aArguments[] )
+ throws
+ java.io.IOException,
+ java.lang.InterruptedException,
+ com.sun.star.lang.IllegalArgumentException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+ {
+ dbgPrint( "loadFromURL()" );
+
+ // try loading
+ boolean bLoaded = false;
+ while ( !bLoaded )
+ {
+ // watch loading in a thread with a timeout (if OOo hangs)
+ CallWatchThread aCallWatchThread =
+ new CallWatchThread( nOOoStartTimeOut );
+
+ try
+ {
+ // get window from OOo on demand
+ if ( xFrameWindow == null )
+ {
+ // Establish the connection by request of the ServiceFactory.
+ getMultiServiceFactory();
+
+ // remove existing child windows
+ removeAll();
+
+ // Create the OfficeWindow.
+ xFrameWindow = getOOoConnection().createOfficeWindow(OOoBean.this);
+ add( xFrameWindow.getAWTComponent() );
+ }
+
+ // create the document frame from UNO window.
+ if ( aFrame == null )
+ {
+ // create the frame
+ com.sun.star.awt.XWindow xWindow =
+ (com.sun.star.awt.XWindow) UnoRuntime.queryInterface(
+ com.sun.star.awt.XWindow.class, xFrameWindow.getUNOWindowPeer());
+ Object xFrame = xServiceFactory.createInstance( "com.sun.star.frame.Frame");
+ aFrame = new Frame( (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
+ com.sun.star.frame.XFrame.class, xFrame ) );
+ aFrame.initialize( xWindow );
+ aFrame.setName( aFrame.toString() );
+
+ // register the frame at the desktop
+ com.sun.star.frame.XFrames xFrames =
+ ( (com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface(
+ com.sun.star.frame.XFramesSupplier.class, getOOoDesktop() ) ).getFrames();
+ xFrames.append( aFrame );
+ }
+
+ // Initializes the slot command execution environment.
+ xURLTransformer = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(
+ com.sun.star.util.XURLTransformer.class,
+ xServiceFactory.createInstance( "com.sun.star.util.URLTransformer") );
+ xDispatcher = (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+ com.sun.star.frame.XDispatchProvider.class, aFrame );
+
+ // get XComponentLoader from frame
+ com.sun.star.frame.XComponentLoader xLoader = (com.sun.star.frame.XComponentLoader)
+ UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class, aFrame );
+ if ( xLoader == null )
+ {
+ throw new java.lang.RuntimeException(
+ "com.sun.star.frame.Frame(" + aFrame +
+ ") without com.sun.star.frame.XComponentLoader" );
+ }
+
+ // Avoid Dialog 'Document changed' while reloading
+ if ( aDocument != null )
+ {
+ com.sun.star.frame.XController xOldController = null;
+ if ( aFrame != null && aFrame.getController() != null )
+ xOldController = aFrame.getController();
+ try
+ {
+ if ( aFrame != null && xOldController != null )
+ xOldController.suspend(true);
+ aDocument.setModified(false);
+ }
+ catch (java.lang.IllegalStateException exp)
+ {}
+ }
+
+ // load the document.
+ com.sun.star.beans.PropertyValue aArgs[] =
+ addArgument( aArguments, new com.sun.star.beans.PropertyValue(
+ "MacroExecutionMode", -1,
+ new Short( com.sun.star.document.MacroExecMode.USE_CONFIG ),
+ com.sun.star.beans.PropertyState.DIRECT_VALUE ) );
+ com.sun.star.lang.XComponent xComponent = xLoader.loadComponentFromURL(
+ aURL, aFrame.getName(), com.sun.star.frame.FrameSearchFlag.ALL, aArgs );
+
+ // nothing loaded?
+ if ( xComponent == null && aDocument != null )
+ {
+ // reactivate old document
+ if ( aFrame != null && aFrame.getController() != null )
+ aFrame.getController().suspend(false);
+ aDocument.setModified(true);
+
+ // throw exception
+ throw new java.io.IOException(
+ "Can not load a document: \"" + aURL + "\"");
+ }
+ // mDocumentURL = aURL; TBD: still needed?
+
+ // Get document's XModifiable interface if any.
+ aDocument = new OfficeDocument(
+ (com.sun.star.frame.XModel) UnoRuntime.queryInterface(
+ com.sun.star.frame.XModel.class, xComponent ) );
+ bLoaded = true;
+ }
+ catch ( NoConnectionException aExc )
+ {
+ // stop, clear and retry
+ stopOOoConnection();
+ }
+ catch ( com.sun.star.lang.DisposedException aExc )
+ {
+ // stop, clear and retry
+ stopOOoConnection();
+ }
+ catch ( com.sun.star.uno.Exception aExc )
+ {
+ // TDB: handling failure in createInstance
+ aExc.printStackTrace();
+ throw new java.io.IOException();
+ }
+
+ aCallWatchThread.cancel();
+ if ( xServiceFactory == null )
+ throw new NoConnectionException();
+ }
+
+ if ( iConnection == null )
+ {
+ throw new NoConnectionException();
+ }
+
+ applyToolVisibilities();
+ }
+
+ //---------------------------------------------------------------------------
+ /** Loads a document from a Java stream.
+
+ See loadFromURL() for further information.
+ */
+ public void loadFromStream(
+ final java.io.InputStream iInStream,
+ final com.sun.star.beans.PropertyValue aArguments[] )
+ throws
+ java.io.IOException,
+ java.lang.InterruptedException,
+ com.sun.star.lang.IllegalArgumentException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+
+ {
+ // wrap Java stream into UNO stream
+ com.sun.star.io.XInputStream xStream =
+ new InputStreamToXInputStreamAdapter(
+ iInStream );
+
+ // add stream to arguments
+ com.sun.star.beans.PropertyValue[] aExtendedArguments =
+ addArgument( aArguments, new com.sun.star.beans.PropertyValue(
+ "InputStream", -1, xStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) );
+
+ // call normal load method
+ loadFromURL( "private:stream/", aExtendedArguments );
+ }
+
+ //---------------------------------------------------------------------------
+ /** Loads a document from a byte array.
+
+ See loadFromURL() for further information.
+ */
+ public void loadFromByteArray(
+ final byte aInBuffer[],
+ final com.sun.star.beans.PropertyValue aArguments[] )
+ throws
+ java.io.IOException,
+ java.lang.InterruptedException,
+ com.sun.star.lang.IllegalArgumentException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+
+ {
+ // wrap byte arrray into UNO stream
+ com.sun.star.io.XInputStream xStream =
+ new ByteArrayToXInputStreamAdapter(
+ aInBuffer );
+
+ // add stream to arguments
+ com.sun.star.beans.PropertyValue[] aExtendedArguments =
+ addArgument( aArguments, new com.sun.star.beans.PropertyValue(
+ "InputStream", -1, xStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) );
+
+ // call normal load method
+ loadFromURL( "private:stream/", aExtendedArguments );
+ }
+
+ //---------------------------------------------------------------------------
+ /** Stores a document to a URL.
+ *
+ * TBD
+ */
+ public void storeToURL(
+ final String aURL,
+ final com.sun.star.beans.PropertyValue aArguments[] )
+ throws
+ java.io.IOException,
+ java.lang.InterruptedException,
+ com.sun.star.lang.IllegalArgumentException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+ {
+ // start runtime timeout
+ CallWatchThread aCallWatchThread =
+ new CallWatchThread( nOOoCallTimeOut );
+
+ // store the document
+ try { aDocument.storeToURL( aURL, aArguments ); }
+ catch ( com.sun.star.io.IOException aExc )
+ { throw new java.io.IOException(); }
+
+ // end runtime timeout
+ aCallWatchThread.cancel();
+ }
+
+ //---------------------------------------------------------------------------
+ /** Stores a document to a byte array.
+
+ See storeToURL() for further information.
+ */
+ public byte[] storeToBuffer(
+ byte aOutBuffer[],
+ final com.sun.star.beans.PropertyValue aArguments[] )
+ throws
+ java.io.IOException,
+ java.lang.InterruptedException,
+ com.sun.star.lang.IllegalArgumentException,
+
+ // @requirement FUNC.CON.LOST/0.2
+ NoConnectionException
+
+ {
+ // wrap byte arrray into UNO stream
+ com.sun.star.beans.XOutputStreamToByteArrayAdapter aStream =
+ new com.sun.star.beans.XOutputStreamToByteArrayAdapter(
+ aOutBuffer );
+
+ // add stream to arguments
+ com.sun.star.beans.PropertyValue[] aExtendedArguments =
+ addArgument( aArguments, new com.sun.star.beans.PropertyValue(
+ "OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) );
+
+ // call normal store method
+ storeToURL( "private:stream/", aExtendedArguments );
+
+ // get byte array from document stream
+ try { aStream.closeOutput(); }
+ catch ( com.sun.star.io.NotConnectedException aExc )
+ { /* TDB */ }
+ catch ( com.sun.star.io.BufferSizeExceededException aExc )
+ { /* TDB */ }
+ catch ( com.sun.star.io.IOException aExc )
+ { throw new java.io.IOException(); }
+ return aStream.getBuffer();
+ }
+
+ //-------------------------------------------------------------------------
+
+ // @requirement FUNC.BEAN.PROG/0.5
+ // @requirement API.SIM.SEAP/0.2
+ /** returns the <type scope="com::sun::star::frame">Frame</a>
+ of the bean.
+
+ @returns
+ a Java class which implements all interfaces which the service
+ <type scope="com::sun::star::frame">Frame</a> implements.
+ Thus, methods can be called directly without queryInterface.
+ This feature might be implemented by UNO or explicitely coded.
+
+ @throws NoConnectionException
+ if the connection is not established.
+ */
+ public Frame getFrame()
+
+ // @requirement FUNC.CON.LOST/0.2
+ throws NoConnectionException
+ {
+ if ( iConnection == null )
+ throw new NoConnectionException();
+ return aFrame;
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.BEAN.PROG/0.5
+ // @requirement API.SIM.SEAP/0.2
+ // @estimation 1h
+ /** returns the <type scope="com::sun::star::frame::Controller"> of the bean.
+
+ @returns
+ a Java class which implements all interfaces which the service
+ <type scope="com::sun::star::frame">Controller</a> implements.
+ Thus, methods can be called directly without queryInterface.
+ This feature might be implemented by UNO or explicitely coded.
+
+ @throws NoConnectionException
+ if the connection is not established.
+
+ @throws NotDocumentLoadedException
+ if no document is loaded an thus no controller is available.
+ */
+ public Controller getController()
+
+ // @requirement FUNC.CON.LOST/0.2
+ throws NoConnectionException,
+
+ // @requirement API.NODC
+ NoDocumentException
+ {
+ if ( iConnection == null )
+ throw new NoConnectionException();
+ if ( aController == null )
+ aController = new Controller( aFrame.getController() );
+ return aController;
+ }
+
+ //-------------------------------------------------------------------------
+ // @requirement FUNC.BEAN.PROG/0.5
+ // @requirement FUNC.BEAN.STOR/0.4
+ // @requirement FUNC.BEAN.PRNT/0.4
+ // @requirement API.SIM.SEAP/0.2
+ // @estimation 1h
+ /** returns the <type scope="com::sun::star::document::OfficeDocument">
+ of the bean.
+
+ @returns
+ a Java class which implements all interfaces which the service
+ <type scope="com::sun::star::document">OfficeDocument</a>
+ implements.
+ Thus, methods can be called directly without queryInterface.
+ This feature might be implemented by UNO or explicitely coded.
+
+ @throws NoConnectionException
+ if the connection is not established.
+
+ @throws NotDocumentLoadedException
+ if no document is loaded.
+ */
+ public OfficeDocument getDocument()
+
+ // @requirement FUNC.CON.LOST/0.2
+ throws NoConnectionException,
+
+ // @requirement API.NODC
+ NoDocumentException // TBD
+ {
+ if ( iConnection == null )
+ throw new NoConnectionException();
+ return aDocument;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Sets visibility of all tool bars known by this OOoBean version.
+
+ Initially all tool bars are visible. By hiding all tool bars
+ utilizing this method, it is possible to turn just a subset of
+ tool bars on afterwards, no matter whether all available tool
+ bars are known or not.
+
+ If an older OOoBean instance is used with a newer OOo instance,
+ some tool bars might not be affected by this method.
+ */
+ public void setAllBarsVisible( boolean bVisible )
+ throws
+ java.lang.InterruptedException
+ {
+ bIgnoreVisibility = true;
+ setMenuBarVisible( bVisible );
+ setStandardBarVisible( bVisible );
+ setToolBarVisible( bVisible );
+ setStatusBarVisible( bVisible );
+ bIgnoreVisibility = false;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Applies all tool visiblities to the real thing.
+ */
+ protected void applyToolVisibilities()
+ throws
+ java.lang.InterruptedException
+ {
+ bIgnoreVisibility = true;
+ setMenuBarVisible( bMenuBarVisible );
+ setStandardBarVisible( bStandardBarVisible );
+ setToolBarVisible( bToolBarVisible );
+ setStatusBarVisible( bStatusBarVisible );
+ bIgnoreVisibility = false;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Helper method to set tool bar visibilty.
+
+ @param bnewValue
+ If false, the tool bar is disabled,
+ If true, the tool bar is visible.
+ */
+ protected boolean setToolVisible( String aProperty, String aResourceURL,
+ short nSlotID, String aSlotArgName, boolean bOldValue, boolean bNewValue )
+ throws
+ java.lang.InterruptedException
+ {
+ // start runtime timeout
+ CallWatchThread aCallWatchThread =
+ new CallWatchThread( nOOoCallTimeOut );
+
+ // Does a frame exist?
+ if ( aFrame != null )
+ {
+ if ( bIgnoreVisibility || bOldValue != bNewValue )
+ {
+ try
+ {
+ com.sun.star.beans.XPropertySet xPropSet =
+ (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class, aFrame );
+ drafts.com.sun.star.frame.XLayoutManager xLayoutManager =
+ (drafts.com.sun.star.frame.XLayoutManager) UnoRuntime.queryInterface(
+ drafts.com.sun.star.frame.XLayoutManager.class,
+ xPropSet.getPropertyValue( "LayoutManager" ) );
+ if ( bNewValue )
+ xLayoutManager.showElement( aResourceURL );
+ else
+ xLayoutManager.hideElement( aResourceURL );
+
+ System.err.println( "ResourceURLs:" );
+ for ( int n = 0; n < xLayoutManager.getElements().length; ++n )
+ {
+ com.sun.star.beans.XPropertySet xElementPropSet =
+ (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class,
+ xLayoutManager.getElements()[n] );
+ System.err.println( xElementPropSet.getPropertyValue("ResourceURL") );
+ }
+ System.err.println( "" );
+ }
+ catch ( com.sun.star.beans.UnknownPropertyException aExc )
+ {
+ throw new RuntimeException( "not layout manager found" );
+ }
+ catch ( com.sun.star.lang.WrappedTargetException aExc )
+ {
+ throw new RuntimeException( "not layout manager found" );
+ }
+
+ // notify change
+ firePropertyChange( aProperty, new Boolean(bOldValue), new Boolean(bNewValue) );
+ }
+ }
+
+ // end runtime timeout
+ aCallWatchThread.cancel();
+
+ // the new value will be stored by caller
+ return bNewValue;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Sets the visibility of the menu bar.
+
+ Initially the menu bar is visible.
+
+ If not connected or no document loaded, the value is stored
+ and automatically applied to the document after it is loaded.
+
+ @param bVisible
+ If false, the menu bar is disabled,
+ If true, the menu bar is visible.
+ */
+ public void setMenuBarVisible(boolean bVisible)
+ throws
+ java.lang.InterruptedException
+ {
+ bMenuBarVisible = setToolVisible( "MenuBarVisible", "private:resource/menubar/menubar",
+ SID_TOGGLEMENUBAR, "MenuBarVisible", bMenuBarVisible, bVisible );
+ }
+
+ //--------------------------------------------------------------------------
+ /* Returns the visibility of the menu bar.
+
+ This method works independently from a connetion or loaded document.
+
+ @return
+ True if the menu bar is visible,
+ false if the menu bar is hidden.
+ */
+ public boolean isMenuBarVisible()
+ {
+ return bMenuBarVisible;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Sets the main function bar visibilty.
+
+ Initially the menu bar is visible.
+
+ If not connected or no document loaded, the value is stored
+ and automatically applied to the document after it is loaded.
+
+ @param bVisible
+ If false, the main function bar is disabled,
+ If true, the main function bar is visible.
+ */
+ public void setStandardBarVisible(boolean bVisible)
+ throws
+ java.lang.InterruptedException
+ {
+ bStandardBarVisible = setToolVisible( "StandardBarVisible", "private:resource/toolbar/standardbar",
+ SID_TOGGLEMAINBAR, "FunctionBarVisible", bStandardBarVisible, bVisible );
+ }
+
+ //--------------------------------------------------------------------------
+ /* Returns the visibility of the main function bar.
+
+ This method works independently from a connetion or loaded document.
+
+ @return
+ True if the main function bar is visible,
+ false if the main function bar is hidden.
+ */
+ public boolean isStandardBarVisible()
+ {
+ return bStandardBarVisible;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Sets the tool function bar visibilty.
+
+ Initially the menu bar is visible.
+
+ If not connected or no document loaded, the value is stored
+ and automatically applied to the document after it is loaded.
+
+ @param bVisible
+ If false, the tool function bar is disabled,
+ If true, the tool function bar is visible.
+ */
+ public void setToolBarVisible(boolean bVisible)
+ throws
+ java.lang.InterruptedException
+ {
+ bToolBarVisible = setToolVisible( "ToolBarVisible", "private:resource/toolbar/toolbar",
+ SID_TOGGLETOOLBAR, "ToolBarVisible", bToolBarVisible, bVisible );
+ }
+
+ //--------------------------------------------------------------------------
+ /* Returns the visibility of the tool function bar.
+
+ This method works independently from a connetion or loaded document.
+
+ @return
+ True if the tool function bar is visible,
+ false if the tool function bar is hidden.
+ */
+ public boolean isToolBarVisible()
+ {
+ return bToolBarVisible;
+ }
+
+ //--------------------------------------------------------------------------
+ /* Sets the status function bar visibilty.
+
+ Initially the menu bar is visible.
+
+ If not connected or no document loaded, the value is stored
+ and automatically applied to the document after it is loaded.
+
+ @param bVisible
+ If false, the status function bar is disabled,
+ If true, the status function bar is visible.
+ */
+ public void setStatusBarVisible(boolean bVisible)
+ throws
+ java.lang.InterruptedException
+ {
+ bStatusBarVisible = setToolVisible( "StatusBarVisible", "private:resource/statusbar/statusbar",
+ SID_TOGGLESTATUSBAR, "StatusBarVisible", bStatusBarVisible, bVisible );
+ }
+
+ //--------------------------------------------------------------------------
+ /* Returns the visibility of the status function bar.
+
+ This method works independently from a connetion or loaded document.
+
+ @return
+ True if the status function bar is visible,
+ false if the status function bar is hidden.
+ */
+ public boolean isStatusBarVisible()
+ {
+ return bStatusBarVisible;
+ }
+
+ //===========================================================================
+ // Helper Methods / Internal Methods
+ //---------------------------------------------------------------------------
+
+ // general instance intializer
+ {
+ setLayout(new java.awt.BorderLayout());
+ }
+
+ //---------------------------------------------------------------------------
+ /// TBD
+ public void paint( java.awt.Graphics aGraphics )
+ {
+ // TBD
+ aGraphics.drawString( "empty", 10, 10 );
+ }
+
+ //---------------------------------------------------------------------------
+ /** Adds a single argument to an array of arguments.
+
+ If the argument by its name is already in aArguments
+ it is exchanged and aArguments is returned.
+
+ If the argument by its name is not yet in aArguments,
+ a new array is created, aArgument added and the new
+ array returned.
+ */
+ protected com.sun.star.beans.PropertyValue[] addArgument(
+ com.sun.star.beans.PropertyValue aArguments[],
+ final com.sun.star.beans.PropertyValue aArgument )
+ {
+ // get number of current arguments
+ int nNumArgs = 0;
+ if ( aArguments != null )
+ nNumArgs = aArguments.length;
+
+ // is new argument already set?
+ for ( int n = 0; n < nNumArgs; ++n )
+ {
+ if ( aArguments[n].Name == aArgument.Name )
+ {
+ // substitute this argument
+ aArguments[n] = aArgument;
+
+ // return current array
+ return aArguments;
+ }
+ }
+
+ // create extended arguments
+ com.sun.star.beans.PropertyValue[] aExtendedArguments =
+ new com.sun.star.beans.PropertyValue[ nNumArgs + 1 ];
+
+ // copy current arguments
+ for ( int n = 0; n < nNumArgs; ++n )
+ aExtendedArguments[n] = aArguments[n];
+
+ // add new argument
+ aExtendedArguments[ nNumArgs ] = aArgument;
+
+ // return new arguments
+ return aExtendedArguments;
+ }
+
+ //===========================================================================
+ // Helper Classes
+ //---------------------------------------------------------------------------
+
+ //---------------------------------------------------------------------------
+ /** Helper class to listen on the connection to learn when it dies.
+
+ @internal
+ */
+ private class EventListener
+ extends Thread
+ implements
+ com.sun.star.lang.XEventListener,
+ com.sun.star.frame.XTerminateListener
+ {
+ EventListener()
+ throws NoConnectionException
+ {
+ // listen on a dying connection
+ iConnection.addEventListener( this );
+
+ // listen on a dying OOo
+ getOOoDesktop().addTerminateListener( this );
+
+ // start this thread as a daemon
+ setDaemon( true );
+ start();
+ }
+
+ /// gets called when the connection dies
+ public void disposing( /*IN*/ com.sun.star.lang.EventObject Source )
+ {
+ // empty the OOoBean and cut the connection
+ stopOOoConnection();
+ }
+
+ /// gets called when the user wants to terminate OOo
+ public void queryTermination( /*IN*/ com.sun.star.lang.EventObject Event )
+ throws com.sun.star.frame.TerminationVetoException
+ {
+ // disallow termination of OOo while a OOoBean exists
+ throw new com.sun.star.frame.TerminationVetoException();
+ }
+
+ /// gets called when OOo terminates
+ public void notifyTermination( /*IN*/ com.sun.star.lang.EventObject Event )
+ {
+ // empty the OOoBean and cut the connection
+ stopOOoConnection();
+ }
+
+ /// watching the connection
+ public void run()
+ {
+ dbgPrint( "EventListener.run()" );
+
+ // remote call might hang => watch try
+ CallWatchThread aCallWatchThread =
+ new CallWatchThread( nOOoCallTimeOut );
+
+ // continue to trying to connect the OOo instance
+ while ( iConnection != null && iConnection.getComponentContext() != null )
+ {
+ dbgPrint( "EventListener.running()" );
+
+ // still alive?
+ try
+ {
+ try
+ {
+ iConnection.getComponentContext().getServiceManager();
+ aCallWatchThread.cancel();
+ }
+ catch ( com.sun.star.lang.DisposedException aExc )
+ {
+ // dead
+ OfficeConnection iDeadConn = iConnection;
+ iConnection = null;
+ iDeadConn.dispose();
+ }
+ catch ( java.lang.InterruptedException aExc )
+ {
+ // hung
+ OfficeConnection iDeadConn = iConnection;
+ iConnection = null;
+ iDeadConn.dispose();
+ }
+ }
+ catch ( java.lang.NullPointerException aExc )
+ {} // ignore
+ catch ( com.sun.star.lang.DisposedException aExc )
+ {
+ // not alive => dispose the dead connection
+ iConnection.dispose();
+ }
+
+ // sleep
+ try {
+ sleep(nOOoCheckCycle);
+ }
+ catch ( java.lang.InterruptedException aExc )
+ {
+ // empty the OOoBean and cut the connection
+ stopOOoConnection();
+ }
+
+ // this loop successvully performed, restart watch for next loop
+ aCallWatchThread.restart();
+ }
+ }
+ }
+
+ //---------------------------------------------------------------------------
+ /** Helper class to watch calls into OOo with a timeout.
+ */
+ protected class CallWatchThread extends Thread
+ {
+ Thread aWatchedThread;
+ boolean bAlive;
+ long nTimeout;
+
+ CallWatchThread( long nTimeout )
+ {
+ this.aWatchedThread = Thread.currentThread();
+ this.nTimeout = nTimeout;
+ dbgPrint( "CallWatchThread.start()" );
+ start();
+ }
+
+ void cancel()
+ throws java.lang.InterruptedException
+ {
+ if ( aWatchedThread != null && aWatchedThread != Thread.currentThread() )
+ throw new RuntimeException( "wrong thread" );
+ aWatchedThread = null;
+ if ( interrupted() )
+ throw new InterruptedException();
+ }
+
+ synchronized void restart()
+ {
+ dbgPrint( "CallWatchThread.restart()" );
+ bAlive = true;
+ notify();
+ }
+
+ public void run()
+ {
+ while ( aWatchedThread != null )
+ {
+ dbgPrint( "CallWatchThread.run() running" );
+ bAlive = false;
+
+ try { wait( 10*nTimeout ); }
+ catch ( java.lang.InterruptedException aExc )
+ {}
+
+ // synchronized
+ {
+ if ( !bAlive && aWatchedThread != null )
+ {
+ aWatchedThread.interrupt();
+ aWatchedThread = null;
+ }
+ }
+ }
+
+ dbgPrint( "CallWatchThread.run() terminated" );
+ }
+ };
+
+ //---------------------------------------------------------------------------
+ /**
+ * This class reprecents an office slot command.
+ */
+ public class OfficeCommand
+ {
+ private short mSlot;
+ private java.util.List mProps = new java.util.ArrayList();
+
+ /**
+ * Constructor.
+ *
+ * @param slot The office slot identifier.
+ * @param args The arguments of the office slot command.
+ */
+ public OfficeCommand(short slot, com.sun.star.beans.PropertyValue args[])
+ {
+ mSlot = slot;
+ for (int idx = 0; idx < args.length; idx += 1) {
+ mProps.add(args[idx]);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param slot The office slot identifier.
+ */
+ public OfficeCommand(short slot)
+ {
+ mSlot = slot;
+ }
+
+ /**
+ * Appends an office slot command parameter.
+ *
+ * @param name The parameter name.
+ * @param value The parameter value.
+ */
+ public synchronized void appendParameter(String name, Object value)
+ {
+ mProps.add(new com.sun.star.beans.PropertyValue(name, 0, value,
+ com.sun.star.beans.PropertyState.DIRECT_VALUE));
+ }
+
+ /**
+ * Executes the command on the specified office instance.
+ *
+ * @param office The office instance which is the target of the command.
+ */
+ public synchronized void execute()
+ throws com.sun.star.comp.beans.NoConnectionException
+ {
+ // avoid conflicts with connect/disconnect...
+ synchronized(OOoBean.this)
+ {
+ // ... do the job
+ com.sun.star.util.URL[] aURL =
+ new com.sun.star.util.URL[1];
+ aURL[0] = new com.sun.star.util.URL(
+ "slot:" + Short.toString(mSlot),
+ "", // string Main
+ "", // string Protocol
+ "", // string User
+ "", // string Password
+ "", // string Server
+ (short)0, // short Port
+ "", // string Path
+ "", // string Name
+ "", // string Arguments
+ ""); // string Mark
+ xURLTransformer.parseSmart(aURL, "slot");
+
+ // workaround bug in dispatch
+ aURL[0].Complete = aURL[0].Main;
+ com.sun.star.frame.XDispatch xDispatcher
+ = getFrame().queryDispatch( aURL[0], "", 0);
+ xDispatcher.dispatch(aURL[0],
+ (com.sun.star.beans.PropertyValue[])mProps.toArray(
+ new com.sun.star.beans.PropertyValue[mProps.size()]));
+ }
+
+ // Good things come to those who wait...
+ notifyAll();
+ }
+ }
+};
+
+
+
diff --git a/bean/com/sun/star/comp/beans/OfficeConnection.java b/bean/com/sun/star/comp/beans/OfficeConnection.java
new file mode 100644
index 000000000000..d9fb6c8c50e2
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/OfficeConnection.java
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: OfficeConnection.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import java.awt.Container;
+import java.net.MalformedURLException;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.uno.XComponentContext;
+
+/**
+ * This abstract class reprecents a connection to the office
+ * application.
+ */
+public interface OfficeConnection
+ extends XComponent
+{
+ /**
+ * Sets a connection URL.
+ *
+ * @param url This is UNO URL which describes the type of a connection.
+ */
+ void setUnoUrl(String url)
+ throws java.net.MalformedURLException;
+
+ /**
+ * Sets an AWT container catory.
+ *
+ * @param containerFactory This is a application provided AWT container
+ * factory.
+ */
+ void setContainerFactory(ContainerFactory containerFactory);
+
+ /**
+ * Retrives the UNO component context.
+ * Establishes a connection if necessary and initialises the
+ * UNO service manager if it has not already been initialised.
+ *
+ * @return The office UNO component context.
+ */
+ XComponentContext getComponentContext();
+
+ /**
+ * Creates an office window.
+ * 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.
+ *
+ * @param container This is an AWT container.
+ * @return The office window instance.
+ */
+ OfficeWindow createOfficeWindow(Container container);
+}
diff --git a/bean/com/sun/star/comp/beans/OfficeDocument.java b/bean/com/sun/star/comp/beans/OfficeDocument.java
new file mode 100644
index 000000000000..b93fc5677b1c
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/OfficeDocument.java
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * $RCSfile: OfficeDocument.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+import com.sun.star.uno.UnoRuntime;
+
+//==========================================================================
+/** Wrapper class for service OfficeDocument which emulates the upcoming
+ mode of automatic runtime Java classes to get rid of the need for
+ queryInterface.
+
+ See further information on the wrapping and compatibility limitations
+ in the base class Wrapper.
+ */
+class OfficeDocument extends Wrapper
+ implements
+ com.sun.star.frame.XModel,
+ com.sun.star.util.XModifiable,
+ com.sun.star.frame.XStorable,
+ com.sun.star.view.XPrintable
+{
+ private com.sun.star.frame.XModel xModel;
+ private com.sun.star.util.XModifiable xModifiable;
+ private com.sun.star.view.XPrintable xPrintable;
+ private com.sun.star.frame.XStorable xStorable;
+
+ public OfficeDocument( com.sun.star.frame.XModel xModel )
+ {
+ super( xModel );
+
+ this.xModel = xModel;
+ this.xModifiable = (com.sun.star.util.XModifiable)
+ UnoRuntime.queryInterface(
+ com.sun.star.util.XModifiable.class, xModel );
+ this.xPrintable = (com.sun.star.view.XPrintable)
+ UnoRuntime.queryInterface(
+ com.sun.star.view.XPrintable.class, xModel );
+ this.xStorable = (com.sun.star.frame.XStorable)
+ UnoRuntime.queryInterface(
+ com.sun.star.frame.XStorable.class, xModel );
+ }
+
+ //==========================================================
+ // com.sun.star.frame.XModel
+ //----------------------------------------------------------
+
+ public boolean attachResource( /*IN*/String aURL,
+ /*IN*/com.sun.star.beans.PropertyValue[] aArguments )
+ {
+ return xModel.attachResource( aURL, aArguments );
+ }
+
+ public String getURL( )
+ {
+ return xModel.getURL();
+ }
+
+ public com.sun.star.beans.PropertyValue[] getArgs( )
+ {
+ return xModel.getArgs();
+ }
+
+ public void connectController(
+ /*IN*/ com.sun.star.frame.XController xController )
+ {
+ xModel.connectController( xController );
+ }
+
+ public void disconnectController(
+ /*IN*/ com.sun.star.frame.XController xController )
+ {
+ xModel.disconnectController( xController );
+ }
+
+ public void lockControllers( )
+ {
+ xModel.lockControllers();
+ }
+
+ public void unlockControllers( )
+ {
+ xModel.unlockControllers();
+ }
+
+ public boolean hasControllersLocked( )
+ {
+ return xModel.hasControllersLocked();
+ }
+
+ public com.sun.star.frame.XController getCurrentController( )
+ {
+ return xModel.getCurrentController();
+ }
+
+ public void setCurrentController(
+ /*IN*/ com.sun.star.frame.XController xController )
+ throws com.sun.star.container.NoSuchElementException
+ {
+ xModel.setCurrentController( xController );
+ }
+
+ public java.lang.Object getCurrentSelection( )
+ {
+ return xModel.getCurrentSelection();
+ }
+
+ //==========================================================
+ // com.sun.star.util.XModifyBroadcaster
+ //----------------------------------------------------------
+
+ public void addModifyListener(
+ /*IN*/ com.sun.star.util.XModifyListener xListener )
+ {
+ xModifiable.addModifyListener( xListener );
+ }
+
+ public void removeModifyListener(
+ /*IN*/ com.sun.star.util.XModifyListener xListener )
+ {
+ xModifiable.removeModifyListener( xListener );
+ }
+
+ //==========================================================
+ // com.sun.star.util.XModifiable
+ //----------------------------------------------------------
+
+ public boolean isModified( )
+ {
+ return xModifiable.isModified();
+ }
+
+ public void setModified( /*IN*/boolean bModified )
+ throws com.sun.star.beans.PropertyVetoException
+ {
+ xModifiable.setModified( bModified );
+ }
+
+ //==========================================================
+ // com.sun.star.view.XPrintable
+ //----------------------------------------------------------
+
+ public com.sun.star.beans.PropertyValue[] getPrinter( )
+ {
+ return xPrintable.getPrinter();
+ }
+
+ public void setPrinter( /*IN*/ com.sun.star.beans.PropertyValue[] aPrinter )
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ xPrintable.setPrinter( aPrinter );
+ }
+
+ public void print( /*IN*/ com.sun.star.beans.PropertyValue[] xOptions )
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ xPrintable.print( xOptions );
+ }
+
+ //==========================================================
+ // com.sun.star.frame.XStorable
+ //----------------------------------------------------------
+
+ public boolean hasLocation( )
+ {
+ return xStorable.hasLocation();
+ }
+
+ public String getLocation( )
+ {
+ return xStorable.getLocation();
+ }
+
+ public boolean isReadonly( )
+ {
+ return xStorable.isReadonly();
+ }
+
+ public void store( )
+ throws com.sun.star.io.IOException
+ {
+ xStorable.store();
+ }
+
+ public void storeAsURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments )
+ throws com.sun.star.io.IOException
+ {
+ xStorable.storeAsURL( aURL, aArguments );
+ }
+
+ public void storeToURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments )
+ throws com.sun.star.io.IOException
+ {
+ xStorable.storeToURL( aURL, aArguments );
+ }
+
+};
+
+
+
diff --git a/bean/com/sun/star/comp/beans/OfficeWindow.java b/bean/com/sun/star/comp/beans/OfficeWindow.java
new file mode 100644
index 000000000000..f14f0c82d71c
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/OfficeWindow.java
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * $RCSfile: OfficeWindow.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+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
+ * and java.awt.Container for remote).
+ */
+public interface OfficeWindow
+{
+ /**
+ * Retrives 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.
+ *
+ * @return The UNO XWindowPeer object associated with the OfficeWindow.
+ */
+ XWindowPeer getUNOWindowPeer();
+}
diff --git a/bean/com/sun/star/comp/beans/SystemWindowException.java b/bean/com/sun/star/comp/beans/SystemWindowException.java
new file mode 100644
index 000000000000..2e1e96a23fbc
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/SystemWindowException.java
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: SystemWindowException.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+public class SystemWindowException extends Exception
+{
+};
+
+
diff --git a/bean/com/sun/star/comp/beans/Wrapper.java b/bean/com/sun/star/comp/beans/Wrapper.java
new file mode 100644
index 000000000000..fe8a2952a297
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/Wrapper.java
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * $RCSfile: Wrapper.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mi $ $Date: 2004-09-06 15:11:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., September, 2004
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2004 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.beans;
+
+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
+ queryInterface.
+
+ Because its not worth the efford 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 alread
+ directly calltheir methods.
+
+ This wrapper will only work for UNO objects via a bridge, not for
+ direct Java objects.
+ */
+class Wrapper
+ implements
+ com.sun.star.uno.IQueryInterface,
+ com.sun.star.lang.XComponent
+{
+ private com.sun.star.uno.IQueryInterface xQueryInterface;
+ private com.sun.star.lang.XComponent xComponent;
+
+ public Wrapper( com.sun.star.uno.XInterface xProxy )
+ {
+ xQueryInterface = (com.sun.star.uno.IQueryInterface) xProxy;
+ xComponent = (com.sun.star.lang.XComponent)
+ UnoRuntime.queryInterface(
+ com.sun.star.lang.XComponent.class, xProxy );
+ }
+
+ //==============================================================
+ // com.sun.star.uno.IQueryInterface
+ //--------------------------------------------------------------
+
+ public String getOid()
+ {
+ return xQueryInterface.getOid();
+ }
+
+ public boolean isSame( Object aObject )
+ {
+ return xQueryInterface.isSame( aObject );
+ }
+
+ public Object queryInterface( com.sun.star.uno.Type aType )
+ {
+//System.err.println( "Wrapper::queryInterface(" + aType + ")" );
+ return xQueryInterface.queryInterface( aType );
+ }
+
+ //==============================================================
+ // com.sun.star.lang.XComponent
+ //--------------------------------------------------------------
+
+ public void dispose( )
+ {
+ xComponent.dispose();
+ }
+
+ public void addEventListener( /*IN*/ com.sun.star.lang.XEventListener xListener )
+ {
+ xComponent.addEventListener( xListener );
+ }
+
+ public void removeEventListener( /*IN*/ com.sun.star.lang.XEventListener xListener )
+ {
+ xComponent.removeEventListener( xListener );
+ }
+};
+
+
diff --git a/bean/com/sun/star/comp/beans/makefile.mk b/bean/com/sun/star/comp/beans/makefile.mk
new file mode 100644
index 000000000000..06fa1925860f
--- /dev/null
+++ b/bean/com/sun/star/comp/beans/makefile.mk
@@ -0,0 +1,116 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: mi $ $Date: 2004-09-06 15:11:38 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., September, 2004
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2004 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2004 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = beans
+TARGET = officebean
+PACKAGE = com$/sun$/star$/comc$/beans
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+.IF "$(OS)"=="MACOSX"
+
+dummy:
+ @echo "Nothing to build for OS $(OS)"
+
+.ELSE # "$(OS)"=="MACOSX"
+
+JARFILES = sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar
+JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES)))
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Files --------------------------------------------------------
+
+JAVACLASSFILES=\
+ $(CLASSDIR)$/$(PACKAGE)$/OfficeConnection.class \
+ $(CLASSDIR)$/$(PACKAGE)$/OfficeWindow.class \
+ $(CLASSDIR)$/$(PACKAGE)$/ContainerFactory.class \
+ $(CLASSDIR)$/$(PACKAGE)$/JavaWindowPeerFake.class \
+ $(CLASSDIR)$/$(PACKAGE)$/NativeConnection.class \
+ $(CLASSDIR)$/$(PACKAGE)$/NativeService.class \
+ $(CLASSDIR)$/$(PACKAGE)$/LocalOfficeConnection.class \
+ $(CLASSDIR)$/$(PACKAGE)$/LocalOfficeWindow.class \
+ $(CLASSDIR)$/$(PACKAGE)$/OutputStreamToXOutputStreamAdapter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/InputStreamToXInputStreamAdapter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/XOutputStreamToByteArrayAdapter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/ByteArrayToXInputStreamAdapter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/InvalidArgumentException.class \
+ $(CLASSDIR)$/$(PACKAGE)$/HasConnectionException.class \
+ $(CLASSDIR)$/$(PACKAGE)$/NoConnectionException.class \
+ $(CLASSDIR)$/$(PACKAGE)$/SystemWindowException.class \
+ $(CLASSDIR)$/$(PACKAGE)$/NoDocumentException.class \
+ $(CLASSDIR)$/$(PACKAGE)$/OfficeDocument.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Controller.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Frame.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Wrapper.class \
+ $(CLASSDIR)$/$(PACKAGE)$/OOoBeanInterface.class \
+ $(CLASSDIR)$/$(PACKAGE)$/OOoBean.class
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk