Joachim,
> As I mentioned before, OOoBean needed a way to receive the component 
> context to fully support this example. This is not yet implemented. But 
> I may work nonetheless, because now the application and the bean will be 
> loaded with a special classloader that knows the location of the jar 
> files. Notice that this classloader is used by 
> LocalOfficeConnection.getProgramPath to find the office.
> Did you try that out? Is the office located and started?
> 
yes, when I have original jars path in classpath (jars are in 
OFFICE_HOME/program/classes)
> Add the OOoBean to the panel as you would do with every other component. 
> For example:
> 
>              m_bean = new com.sun.star.comp.beans.OOoBean();
>              add(m_bean, BorderLayout.CENTER);
>              pack();
>              setBounds(x, y, width, height);
>              setVisible(true);
>              m_bean.loadFromURL("private:factory/swriter", null);
>              validate(); //may not be necessary
> 
> --Joachim

I try your suggestion, but I have any adding :

after loadFromURL , I have to add aquireSystemWindow().
Panel must be in frame before aquireSystemWindow
This is simple example - it work for SAL_USE_VCLPLUGIN=kde 
(I isn't important what I use : kde or gnome - it work only for kde)
I try gtk 2.4.14,2.8.3,2.8.4 without success - frame is open, there isn't 
exception or error
but office isn't in frame (I have empty frame - background color is from gnome)

I try with java.awt.Frame instead javax.swing.JFrame - it is same

Thanks
Haris Peco

example :

package firststeps;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import javax.swing.JFrame;
import com.sun.star.comp.beans.NoConnectionException;
import com.sun.star.comp.beans.OOoBean;
import com.sun.star.comp.beans.SystemWindowException;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.util.CloseVetoException;

public class OOoBeanExample extends JFrame {

 private static final long serialVersionUID = 1L;
 private  OOoBean m_bean;

 public OOoBeanExample(String title) {
  super(title);
  m_bean = new com.sun.star.comp.beans.OOoBean();
  add(m_bean, BorderLayout.CENTER);
  setBounds(0, 0, 800, 600);
  setVisible(true);
  try {
   m_bean.loadFromURL("private:factory/swriter", null);
   m_bean.aquireSystemWindow(); // doesn't work without this
  } catch (IllegalArgumentException e) {
   e.printStackTrace();
  } catch (CloseVetoException e) {
   e.printStackTrace();
  } catch (NoConnectionException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  } catch (SystemWindowException e) {
   e.printStackTrace();
  }
  validate(); // may not be necessary
 }
 
 public void stop () {
  setVisible(false);
  m_bean.stopOOoConnection(); 
 }
 
 private static void createAndShowGUI() {
        final OOoBeanExample frame = new OOoBeanExample("OOoBean example");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
             frame.stop();
                System.exit(0);
            }
        });
        frame.pack();
        frame.setVisible(true);
    }

 public static void main(String[] args) {
  javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
 }

}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to