Thanks for your prompt reply and please ignore the previous mail, sent
erroneously prior to editing completely.

> Yes. Create the model as a service and either initialize or load it. In
> Basic code:
>
> model = createUNOService("com.sun.star.text.TextDocument")

> model.initNew()
>
> will create a new empty text document.
>
> dim mediadescriptor(n) as new com.sun.star.beans.PropertyValue
> ' fill mediadescriptor
> model = createUNOService("com.sun.star.text.TextDocument")
> model.load( mediadescriptor )
>
> will create and load a document from what you put into the
> mediadescriptor. Of course in this case you don't have a type detection
> and you must either put the filter name into the mediadescriptor or
> manually call the type detection service (not a big deal).

I tried something like this in java:

args = (PropertyValue[])jmalte.MjUtils.ArrayAdd(
        args, -1,
        new PropertyValue(MjOO.OO_HIDDEN, -1, new Boolean(true),
                          PropertyState.DIRECT_VALUE),
                          PropertyValue.class));

com.sun.star.text.XTextDocument xm = (com.sun.star.text.TextDocument)
    queryInterface(com.sun.star.text.XTextDocument.class,
      getMultiServiceFactory().createInstance(
        "com.sun.star.text.TextDocument"));

xm.attachResource(surl, args);

I also tried the above with:
  createInstancewithArguments(..."com.sun.star.text.TextDocument", args)...,
without success.

I can't find any method to explicitly load from a url and the above does
not work (I thought it wouldn't). I scoured the api docs, but nothing. How
do I do this in java.

> Register a CloseListener at the model and veto against closing as long
> as you need the model. Of course then you must keep track of all models
> and close them by yourself when you are done with them.
>
> I must confess that I don't remember if this really works in your case
> (it definitely works in case of closing the frame) but you could try and
> report back. If it doesn't work it's a bug that needs to be fixed.

I had allready tried that and the dispose is still being called. I did
notice that if I use a "private:factory" type url, i.e. create a doc from
scratch it does not get disposed. Is this inconsistent behaviour or
something I am doing wrong?

> The most resources are taken by the model, the frame and controller are
> much smaller for non-trivial documents. At least that's my guestimation.

I have spent about 4 weeks trying to get a set of my own classes to wrap
some OO functionality to be able to integrate it with my application. I
have come quite far after trying many things, but still have many
questions. Would you be prepared to discuss some of them with me during
the next few weeks? I need to continue with other parts of my project but
still need to iron out some OO related code.

This would be of great help to me. I seem to spend a huge amount of time
trying many alternatives to determine exactly how the OO API works.

Thanks
Malte

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

Reply via email to