Re: [api-dev] LoadComponentFromURL using an XInputStream in Basic

2006-08-08 Thread Andrew Douglas Pitonyak





snip


snip snip :-)

It can be solved ... if you implement an UNO Service which accepts a 
Sequence sal_Int8  as IN parameter and returns an 
XSeekable/XInputStream as result. Such service can be used in Java, 
C++, Basic, Phyton etcpp.


Currently I do not know if such help service still exists .-)


OK, for now, I will consider this as NOT possible unless I implement the 
service to do this myself.


b) Use another filter or dont specify any filter so 
loadComponentFromURL() can search for it's own one.



I have tried specifying, and not specifying, the filter.



Then it does not depend on your content. It seams realy a problem of 
your non-seekable stream. But I don not understand then why the office 
locked up. Normaly the call loadComponentFromURL() should return 
without  loading this content.


May be you can provide some stacks (produced with an attached 
debugger), which shows us, where the office is hanging ?


That I can try to do...
I use Linux (FC4). If you have any advise on which debugger to attempt 
to use, that would perhaps be useful. I will see if I can figure out how 
to do this with gdb. It looks like I can attach it to a running process!

Wahooo! I did not know that I could do that!

Here is the first time with the macro started from the IDE:

(gdb) bt
#0  0xf74517a5 in rtl_uStringbuffer_insert_ascii () from 
/opt/openoffice.org2.0/program/libuno_sal.so.3

#1  0xf21375a5 in ?? () from /opt/openoffice.org2.0/program/libgcc3_uno.so
#2  0xf2137a23 in ?? () from /opt/openoffice.org2.0/program/libgcc3_uno.so
#3  0xf213a81c in ?? () from /opt/openoffice.org2.0/program/libgcc3_uno.so
#4  0xf213aabd in ?? () from /opt/openoffice.org2.0/program/libgcc3_uno.so
#5  0xed3908e5 in component_getFactory () from 
/opt/openoffice.org2.0/program/reflection.uno.so
#6  0xf24c8a97 in SbUnoObject::Notify () from 
/opt/openoffice.org2.0/program/libsb680li.so
#7  0xf7cfb6f9 in SfxBroadcaster::Broadcast () from 
/opt/openoffice.org2.0/program/libsvl680li.so
#8  0xf2506add in SbxVariable::Broadcast () from 
/opt/openoffice.org2.0/program/libsb680li.so
#9  0xf250309e in SbxValue::SbxValue$base () from 
/opt/openoffice.org2.0/program/libsb680li.so
#10 0xf25065b9 in SbxVariable::SbxVariable$base () from 
/opt/openoffice.org2.0/program/libsb680li.so
#11 0xf24eb0a1 in SbiRuntime::FindElement () from 
/opt/openoffice.org2.0/program/libsb680li.so
#12 0xf24eb346 in SbiRuntime::StepELEM () from 
/opt/openoffice.org2.0/program/libsb680li.so
#13 0xf24e2938 in SbiRuntime::Step () from 
/opt/openoffice.org2.0/program/libsb680li.so
#14 0xf24b4dbd in SbModule::Run () from 
/opt/openoffice.org2.0/program/libsb680li.so
#15 0xf24b508e in SbModule::Notify () from 
/opt/openoffice.org2.0/program/libsb680li.so
#16 0xf7cfb6f9 in SfxBroadcaster::Broadcast () from 
/opt/openoffice.org2.0/program/libsvl680li.so
#17 0xf24b7733 in SbMethod::Broadcast () from 
/opt/openoffice.org2.0/program/libsb680li.so
#18 0xf250309e in SbxValue::SbxValue$base () from 
/opt/openoffice.org2.0/program/libsb680li.so
#19 0xf25065b9 in SbxVariable::SbxVariable$base () from 
/opt/openoffice.org2.0/program/libsb680li.so
#20 0xf24eb0a1 in SbiRuntime::FindElement () from 
/opt/openoffice.org2.0/program/libsb680li.so
#21 0xf24eb625 in SbiRuntime::StepFIND () from 
/opt/openoffice.org2.0/program/libsb680li.so
#22 0xf24e2938 in SbiRuntime::Step () from 
/opt/openoffice.org2.0/program/libsb680li.so
#23 0xf24b4dbd in SbModule::Run () from 
/opt/openoffice.org2.0/program/libsb680li.so
#24 0xf24b508e in SbModule::Notify () from 
/opt/openoffice.org2.0/program/libsb680li.so
#25 0xf7cfb6f9 in SfxBroadcaster::Broadcast () from 
/opt/openoffice.org2.0/program/libsvl680li.so
#26 0xf24b7733 in SbMethod::Broadcast () from 
/opt/openoffice.org2.0/program/libsb680li.so
#27 0xf250376f in SbxValue::Get () from 
/opt/openoffice.org2.0/program/libsb680li.so
#28 0xebc1a643 in basicide_choose_macro () from 
/opt/openoffice.org2.0/program/libbasctl680li.so
#29 0xebc09a12 in ?? () from 
/opt/openoffice.org2.0/program/libbasctl680li.so
#30 0xebc09afd in ?? () from 
/opt/openoffice.org2.0/program/libbasctl680li.so
#31 0xebc0cb56 in ?? () from 
/opt/openoffice.org2.0/program/libbasctl680li.so
#32 0xebc05d29 in ?? () from 
/opt/openoffice.org2.0/program/libbasctl680li.so
#33 0xebbfdcf2 in ?? () from 
/opt/openoffice.org2.0/program/libbasctl680li.so
#34 0xf27ce04d in SfxDispatcher::GetDisableFlags () from 
/opt/openoffice.org2.0/program/libsfx680li.so
#35 0xf27ce382 in SfxDispatcher::_Execute () from 
/opt/openoffice.org2.0/program/libsfx680li.so
#36 0xf27ce422 in SfxDispatcher::_Execute () from 
/opt/openoffice.org2.0/program/libsfx680li.so
#37 0xf27f6033 in non-virtual thunk to 
SvxSearchItem::Notify(com::sun::star::uno::Sequencertl::OUString 
const) () from /opt/openoffice.org2.0/program/libsfx680li.so

#38 0xebb8cf3c in ?? ()
#39 0xeb15feb8 in ?? ()
#40 0xebb8f8f0 in ?? ()
#41 0xff8526d0 in ?? ()
#42 0xf27f5ff0 in non-virtual thunk to 

[api-dev] LoadComponentFromURL using an XInputStream in Basic

2006-08-06 Thread Andrew Douglas Pitonyak

I am using OOo 2.0.3 on Linux FC4.

I store a binary file into a database - Base document if it matters. 
First I tried to use a stream:


oStatement.setBinaryStream(2, oStream, oStream.getLength())

The error message said that there was an error from the ODBC driver 
stating that the stream was NULL. I found that the following works:


lLen = oStream.getLength()
ReDim oData(0 To lLen-1)
oStream.readBytes(oData(), lLen)
oStatement.setBytes(2, oData(), lLen)

I can extract the data from my database to a file.

oSimpleFileAccess.writeFile(sURL, oStream)

Rather than writing the file to disk, I would prefer to load the file 
directly.


Dim oProp(0) As New com.sun.star.beans.PropertyValue
oProp(0).Name  = InputStream : oProp(0).Value = oStream
REM oProp(1).Name  = ReadOnly: oProp(1).Value = True
REM oProp(2).Name  = FilterName  : oProp(2).Value = writer8
StarDesktop.LoadComponentFromUrl(private:stream, _blank, 0, oProp())

When I try this, however, soffice locks up and I have to manually kill 
soffice.


The closest that I could find to a solution is in Java, but it uses a 
com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter

The speculation is that the XInputStream does not support XSeekable.
http://joott.cvs.sourceforge.net/joott/jooconverter2/src/net/sf/jooreports/openoffice/converter/OpenOfficeDocumentConverter.java?view=markup

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

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