Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-27 Thread Kent Gibson
cool the work around worked a treat! thanks again for
your help.

--- Mathias Bauer <[EMAIL PROTECTED]> wrote:

> Kent Gibson wrote:
> 
> > thanks for the details. What you said about adding
> a
> > model to the media descriptor seems very
> interesting.
> > However it does not seem to be documented. I tried
> > something quickly along these lines:
> > 
> > XModel model = ( XModel )
> UnoRuntime.queryInterface(
> > XModel.class, connection.getTextDocument());
> > 
> > PropertyValue prop1 = new PropertyValue();
> > prop1.Name = "Model"; 
> > prop1.Value = model;
> > 
> > loadedComponent =
> > frameComponentLoader.loadComponentFromURL(
> > "private:stream", "_self", 0, args );
> > 
> > and I get 
> > om.sun.star.lang.IllegalArgumentException: URL
> seems
> > to be an unsupported one.
> 
> It seems that OOo tries to do a type detection
> though this is
> superfluous here. I will check this. Meanwhile you
> could try to provide
> a valid stream here to workaround the problem (it
> will not be used for
> loading!).
> 
> Best regards,
> Mathias
> 
> -- 
> Mathias Bauer - OpenOffice.org Application Framework
> Project Lead
> Please reply to the list only, [EMAIL PROTECTED]
> is a spam sink.
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-26 Thread Mathias Bauer
Kent Gibson wrote:

> thanks for the details. What you said about adding a
> model to the media descriptor seems very interesting.
> However it does not seem to be documented. I tried
> something quickly along these lines:
> 
> XModel model = ( XModel ) UnoRuntime.queryInterface(
> XModel.class, connection.getTextDocument());
> 
> PropertyValue prop1 = new PropertyValue();
> prop1.Name = "Model"; 
> prop1.Value = model;
> 
> loadedComponent =
> frameComponentLoader.loadComponentFromURL(
> "private:stream", "_self", 0, args );
> 
> and I get 
> om.sun.star.lang.IllegalArgumentException: URL seems
> to be an unsupported one.

It seems that OOo tries to do a type detection though this is
superfluous here. I will check this. Meanwhile you could try to provide
a valid stream here to workaround the problem (it will not be used for
loading!).

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-26 Thread Kent Gibson
thanks for the details. What you said about adding a
model to the media descriptor seems very interesting.
However it does not seem to be documented. I tried
something quickly along these lines:

XModel model = ( XModel ) UnoRuntime.queryInterface(
XModel.class, connection.getTextDocument());

PropertyValue prop1 = new PropertyValue();
prop1.Name = "Model"; 
prop1.Value = model;

loadedComponent =
frameComponentLoader.loadComponentFromURL(
"private:stream", "_self", 0, args );

and I get 
om.sun.star.lang.IllegalArgumentException: URL seems
to be an unsupported one.

--- Mathias Bauer <[EMAIL PROTECTED]> wrote:

> Kent Gibson wrote:
> 
> > argh. please help. this is driving me batty. 
> > 
> > Ok i have an empty frame,
> > 
> > XWindow xWindow = ( XWindow )
> > UnoRuntime.queryInterface( XWindow.class,
> > officeWindow.getUNOWindowPeer() );
> > object = serviceFactory.createInstance(
> > "com.sun.star.frame.Frame" );
> > XFrame documentFrame = ( XFrame )
> > UnoRuntime.queryInterface( XFrame.class, object );
> > documentFrame.initialize( xWindow );
> > documentFrame.setName( documentFrame.toString() );
> > 
> > // Register frame at the desktop
> > XFrames xFrames = ( ( XFramesSupplier )
> > UnoRuntime.queryInterface( XFramesSupplier.class,
> > desktop ) ).getFrames();
> > xFrames.append( documentFrame );
> > 
> > then I go and create a blank document and put it
> into
> > my frame:
> > 
> > XComponentLoader frameComponentLoader = (
> > XComponentLoader ) UnoRuntime.queryInterface(
> > XComponentLoader.class, documentFrame);
> > loadedComponent =
> > frameComponentLoader.loadComponentFromURL( url,
> > "_self", 0, args ); 
> > 
> > the purpose so that I can see a nice blank doc.
> > 
> > then I go and create another blank doc. I do some
> > rendering and I want
> > to replace my first doc with the second doc.
> 
> This isn't possible so easily. There are several
> other options, but I
> don't know which I should recommend because I don't
> know what your goal
> is. You could:
> 
> - not create the first document at all (why do you?)
> - add the model of the second document to a
> MediaDescriptor and use
> loadComponentFromURL at the first frame, thus
> replacing the first doc
> - perhaps even don't create a second frame and only
> use a standalone
> model that you insert in the same way into your
> frame
> 
> It's hard do make a good suggestion without knowing
> your intended
> workflow or functionality.
> 
> > for example this does not work:
> > documentFrame.setComponent(
> >
>
documentFrame.getContainerWindow(),officeDocument.getCurrentController());
> 
> Yes, this is not possible, a controller is owned by
> a frame as soon as
> you have created it and it can be only in one frame
> at a time. This
> means once you remove it from a frame to put it into
> another one the
> frame will dispose of the controller.
> 
> You only can move the *model* from one frame to
> another (or have it in
> more than one frame at the same time), thus creating
> a new controller
> each time you insert the model into a frame.
> Currently this needs the way mentioned above (use a
> "Model" parameter in
> MediaDescriptor, see DevGuide), we are working on an
> API to make this
> easier and more elegant.
> 
> > The guide says"Currently, the only way for clients
> to
> > construct a frame and insert a OpenOffice.org
> document
> > into it, is to use the
> > com.sun.star.frame.XComponentLoader interface of
> the
> > com.sun.star.frame.Desktop" but this is not
> > clear to me.
> 
> Yes, as I said: Controllers can't be moved between
> frames, the only way
> to get a model into a frame is to create a new
> Controller. And the only
> way to achieve this currently is
> loadComponentFromURL.
> 
> Best regards,
> Mathias
> 
> -- 
> Mathias Bauer - OpenOffice.org Application Framework
> Project Lead
> Please reply to the list only, [EMAIL PROTECTED]
> is a spam sink.
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-25 Thread Mathias Bauer
Kent Gibson wrote:

> argh. please help. this is driving me batty. 
> 
> Ok i have an empty frame,
> 
> XWindow xWindow = ( XWindow )
> UnoRuntime.queryInterface( XWindow.class,
> officeWindow.getUNOWindowPeer() );
> object = serviceFactory.createInstance(
> "com.sun.star.frame.Frame" );
> XFrame documentFrame = ( XFrame )
> UnoRuntime.queryInterface( XFrame.class, object );
> documentFrame.initialize( xWindow );
> documentFrame.setName( documentFrame.toString() );
> 
> // Register frame at the desktop
> XFrames xFrames = ( ( XFramesSupplier )
> UnoRuntime.queryInterface( XFramesSupplier.class,
> desktop ) ).getFrames();
> xFrames.append( documentFrame );
> 
> then I go and create a blank document and put it into
> my frame:
> 
> XComponentLoader frameComponentLoader = (
> XComponentLoader ) UnoRuntime.queryInterface(
> XComponentLoader.class, documentFrame);
> loadedComponent =
> frameComponentLoader.loadComponentFromURL( url,
> "_self", 0, args ); 
> 
> the purpose so that I can see a nice blank doc.
> 
> then I go and create another blank doc. I do some
> rendering and I want
> to replace my first doc with the second doc.

This isn't possible so easily. There are several other options, but I
don't know which I should recommend because I don't know what your goal
is. You could:

- not create the first document at all (why do you?)
- add the model of the second document to a MediaDescriptor and use
loadComponentFromURL at the first frame, thus replacing the first doc
- perhaps even don't create a second frame and only use a standalone
model that you insert in the same way into your frame

It's hard do make a good suggestion without knowing your intended
workflow or functionality.

> for example this does not work:
> documentFrame.setComponent(
> documentFrame.getContainerWindow(),officeDocument.getCurrentController());

Yes, this is not possible, a controller is owned by a frame as soon as
you have created it and it can be only in one frame at a time. This
means once you remove it from a frame to put it into another one the
frame will dispose of the controller.

You only can move the *model* from one frame to another (or have it in
more than one frame at the same time), thus creating a new controller
each time you insert the model into a frame.
Currently this needs the way mentioned above (use a "Model" parameter in
MediaDescriptor, see DevGuide), we are working on an API to make this
easier and more elegant.

> The guide says"Currently, the only way for clients to
> construct a frame and insert a OpenOffice.org document
> into it, is to use the
> com.sun.star.frame.XComponentLoader interface of the
> com.sun.star.frame.Desktop" but this is not
> clear to me.

Yes, as I said: Controllers can't be moved between frames, the only way
to get a model into a frame is to create a new Controller. And the only
way to achieve this currently is loadComponentFromURL.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-25 Thread Kent Gibson
argh. please help. this is driving me batty. 

Ok i have an empty frame,

XWindow xWindow = ( XWindow )
UnoRuntime.queryInterface( XWindow.class,
officeWindow.getUNOWindowPeer() );
object = serviceFactory.createInstance(
"com.sun.star.frame.Frame" );
XFrame documentFrame = ( XFrame )
UnoRuntime.queryInterface( XFrame.class, object );
documentFrame.initialize( xWindow );
documentFrame.setName( documentFrame.toString() );

// Register frame at the desktop
XFrames xFrames = ( ( XFramesSupplier )
UnoRuntime.queryInterface( XFramesSupplier.class,
desktop ) ).getFrames();
xFrames.append( documentFrame );

then I go and create a blank document and put it into
my frame:

XComponentLoader frameComponentLoader = (
XComponentLoader ) UnoRuntime.queryInterface(
XComponentLoader.class, documentFrame);
loadedComponent =
frameComponentLoader.loadComponentFromURL( url,
"_self", 0, args ); 

the purpose so that I can see a nice blank doc.

then I go and create another blank doc. I do some
rendering and I want
to replace my first doc with the second doc.

this works with streams, but performance is bad. now
when i play with the windows, ie
setVisible, I can never successfully replacing my
firstwindow with my secondwindow.

for example this does not work:
documentFrame.setComponent(
documentFrame.getContainerWindow(),officeDocument.getCurrentController());

sorry for all the details but this is a tricky
problem, one that I have been fighting for days. I
will be happy to provide more source code, if someone
wants to help. The root of the problem is isolated in
one class.

The guide says"Currently, the only way for clients to
construct a frame and insert a OpenOffice.org document
into it, is to use the
com.sun.star.frame.XComponentLoader interface of the
com.sun.star.frame.Desktop" but this is not
clear to me.

Any help would be great.

--- Kent Gibson <[EMAIL PROTECTED]> wrote:

> thanks that was pretty much the solution I needed.
> 
> you see becuase the documentation said "do not mess
> around with setVisible" i didn't, so I did the same
> thing with streams. But now that I know that this is
> fixed with 2.0.2 I know now where to concentrate on.
> I
> did try this before but had some problems and
> assuemed
> it had to do with the fact that I was doing some
> that
> I shouldn't, alrighty I will give it any try thanks!
> 
> --- Mathias Bauer <[EMAIL PROTECTED]> wrote:
> 
> > Kent Gibson wrote:
> > 
> > > Hi-ya
> > > 
> > > Sorry to pester but does anyone have any ideas?
> I
> > > tried to explain the problem clearly but it is a
> > > tricky problem. I suppose I could summarise it
> by
> > > asking, how would one convert a hidden document
> > > efficiently into a non hidden document. Right
> now
> > it
> > > takes me about 3 minutes to render the document
> > and
> > > then about 10 minutes just to convert it into a
> > non
> > > hidden document for viewing.
> > 
> > OOO 2.0.2 allows you to make a hidden document
> > visible by a simple API
> > call. Is that what you want?
> > 
> > In Basic it's simply:
> > 
> > doc.loadComponentFromURL(...) ' hidden loading
> > '
> > ' now do with the document what you want
> > '
> > ' now make it visible
> >
>
doc.CurrentController.Frame.ContainerWindow.setVisible(
> > True )
> > 
> > You could do the same in older versions (the API
> > already existed) but
> > the document would behave strange afterwards (file
> > will not be released
> > when document is closed), it needed some fixes in
> > the code that have
> > been applied in 2.0.2.
> > 
> > But admittedly I don't understand how this is
> > related to your original
> > question about the bad performance for refreshing
> a
> > document by reloading.
> > 
> > BTW: considering that each "refresh" requires a
> > complete write/read
> > cycle I don't think that the performance is as
> > expected. In general the
> > load/save performance in OOo is not very good and
> we
> > are working on
> > this, but don't expect exact promises now about
> when
> > we will reach which
> > performance gain.
> > 
> > Best regards,
> > Mathias
> > 
> > -- 
> > Mathias Bauer - OpenOffice.org Application
> Framework
> > Project Lead
> > Please reply to the list only, [EMAIL PROTECTED]
> > is a spam sink.
> > 
> >
>
-
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--

Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-25 Thread Kent Gibson
thanks that was pretty much the solution I needed.

you see becuase the documentation said "do not mess
around with setVisible" i didn't, so I did the same
thing with streams. But now that I know that this is
fixed with 2.0.2 I know now where to concentrate on. I
did try this before but had some problems and assuemed
it had to do with the fact that I was doing some that
I shouldn't, alrighty I will give it any try thanks!

--- Mathias Bauer <[EMAIL PROTECTED]> wrote:

> Kent Gibson wrote:
> 
> > Hi-ya
> > 
> > Sorry to pester but does anyone have any ideas? I
> > tried to explain the problem clearly but it is a
> > tricky problem. I suppose I could summarise it by
> > asking, how would one convert a hidden document
> > efficiently into a non hidden document. Right now
> it
> > takes me about 3 minutes to render the document
> and
> > then about 10 minutes just to convert it into a
> non
> > hidden document for viewing.
> 
> OOO 2.0.2 allows you to make a hidden document
> visible by a simple API
> call. Is that what you want?
> 
> In Basic it's simply:
> 
> doc.loadComponentFromURL(...) ' hidden loading
> '
> ' now do with the document what you want
> '
> ' now make it visible
>
doc.CurrentController.Frame.ContainerWindow.setVisible(
> True )
> 
> You could do the same in older versions (the API
> already existed) but
> the document would behave strange afterwards (file
> will not be released
> when document is closed), it needed some fixes in
> the code that have
> been applied in 2.0.2.
> 
> But admittedly I don't understand how this is
> related to your original
> question about the bad performance for refreshing a
> document by reloading.
> 
> BTW: considering that each "refresh" requires a
> complete write/read
> cycle I don't think that the performance is as
> expected. In general the
> load/save performance in OOo is not very good and we
> are working on
> this, but don't expect exact promises now about when
> we will reach which
> performance gain.
> 
> Best regards,
> Mathias
> 
> -- 
> Mathias Bauer - OpenOffice.org Application Framework
> Project Lead
> Please reply to the list only, [EMAIL PROTECTED]
> is a spam sink.
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-24 Thread Mathias Bauer
Kent Gibson wrote:

> Hi-ya
> 
> Sorry to pester but does anyone have any ideas? I
> tried to explain the problem clearly but it is a
> tricky problem. I suppose I could summarise it by
> asking, how would one convert a hidden document
> efficiently into a non hidden document. Right now it
> takes me about 3 minutes to render the document and
> then about 10 minutes just to convert it into a non
> hidden document for viewing.

OOO 2.0.2 allows you to make a hidden document visible by a simple API
call. Is that what you want?

In Basic it's simply:

doc.loadComponentFromURL(...) ' hidden loading
'
' now do with the document what you want
'
' now make it visible
doc.CurrentController.Frame.ContainerWindow.setVisible( True )

You could do the same in older versions (the API already existed) but
the document would behave strange afterwards (file will not be released
when document is closed), it needed some fixes in the code that have
been applied in 2.0.2.

But admittedly I don't understand how this is related to your original
question about the bad performance for refreshing a document by reloading.

BTW: considering that each "refresh" requires a complete write/read
cycle I don't think that the performance is as expected. In general the
load/save performance in OOo is not very good and we are working on
this, but don't expect exact promises now about when we will reach which
performance gain.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-24 Thread Kent Gibson
Hi-ya

Sorry to pester but does anyone have any ideas? I
tried to explain the problem clearly but it is a
tricky problem. I suppose I could summarise it by
asking, how would one convert a hidden document
efficiently into a non hidden document. Right now it
takes me about 3 minutes to render the document and
then about 10 minutes just to convert it into a non
hidden document for viewing.

thanks.

--- Kent Gibson <[EMAIL PROTECTED]> wrote:

> I set up a connection, get my XTextDocument and
> render
> with it.
> 
> Then later I want to put my XTextDocument back into
> a
> frame.
> 
> This all works perfectly, but the performance is
> bad.
> 
> It takes about half a second for a one page document
> to "refresh it".
> 
> You can pretty much see the algorithmn below.
> 
> Does anyone have any ideas how I could improve this?
> 
> many thanks.
> 
> ###
> 
> 
> // Store given connection's document into stream.
> // Therefore create byte array stream and wrap into
> UNO output stream
> ByteArrayOutputStream byteOut = new
> ByteArrayOutputStream( 1 );
> OutputStreamToXOutputStreamAdapter unoOut = new
> OutputStreamToXOutputStreamAdapter( byteOut );
> PropertyValue[] storeArgs = { new PropertyValue(
> "OutputStream", 
>  
> -1, unoOut,
> PropertyState.DIRECT_VALUE
> ) };
> // store our document to a stream
> connection.getDocument().storeToURL(
> "private:stream",
> storeArgs ); 
> 
> // Wrap filled byte array into UNO input stream and
> load new document from it
> XInputStream unoIn = new
> ByteArrayToXInputStreamAdapter(
> byteOut.toByteArray()
> );
> PropertyValue[] loadArgs =
> OpenOfficeCoreUtils.addPropertyValue( args,
>  new PropertyValue( "InputStream", -1,
> unoIn, PropertyState.DIRECT_VALUE ) );
> // reload our document from a stream
> loadedComponent =
> frameComponentLoader.loadComponentFromURL(
> "private:stream", "_self", 0, loadArgs ); 
> 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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