Re: [dba-dev] Image control aspect ratio

2008-09-25 Thread Frank Schönheit - Sun Microsystems Germany
Hi Marc,

 The proper macro has an additional oPipe.closeOutput right after
 writing the document into the pipe, but before passing the pipe to
 setBinaryStream.
 
 That does work. :)

Fine.

 I assume blocking on giving the exact size as a limit did for the same
 reason, waiting for the EOF.

Yes.

 Well, it does only partly. I succeeded in writing to JDBC connected
 databases, using ODBC didn't do, blocking as before.

Fixed in CWS dba31c (too lazy to write a dedicated issue).

 (Strictly, the implementation of setBinaryStream for the dBase driver is
 broken, as it does *not* do what your macro requests it to do.)
 
 Because it doesn't start reading on a stream that hasn't finished
 getting all data from the writing end?

Yes.

 Thanks for investigating and finding a solution,

You're welcome.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



Re: [dba-dev] Image control aspect ratio

2008-09-19 Thread Marc Santhoff
Am Donnerstag, den 18.09.2008, 13:15 +0200 schrieb Frank Schönheit:
 The proper macro has an additional oPipe.closeOutput right after
 writing the document into the pipe, but before passing the pipe to
 setBinaryStream.

That does work. :)

I assume blocking on giving the exact size as a limit did for the same
reason, waiting for the EOF.

Well, it does only partly. I succeeded in writing to JDBC connected
databases, using ODBC didn't do, blocking as before. But this clearly is
a works for me-remark currently.

 (Strictly, the implementation of setBinaryStream for the dBase driver is
 broken, as it does *not* do what your macro requests it to do.)

Because it doesn't start reading on a stream that hasn't finished
getting all data from the writing end?

Thanks for investigating and finding a solution,
Marc



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



Re: [dba-dev] Image control aspect ratio

2008-09-18 Thread Frank Schönheit
Hi Marc,

 I was trying to use a css.io.Pipe to connect the two active data sources
 (doc.storeToUrl and XParameter.setBinaryStream).

 Using dbase I succeeded in writing othe train to ut a doc this way, for
 mysql or hsql the office hangs.
 
 Now known as issue 94027, targeted to 3.1.

Now resolved as INVALID, after I debugged a little bit into it ...

Look into the issue for a detailed reasoning why your sample macro is
broken, and OOo does exactly what you requested it to do.

The proper macro has an additional oPipe.closeOutput right after
writing the document into the pipe, but before passing the pipe to
setBinaryStream.

(Strictly, the implementation of setBinaryStream for the dBase driver is
broken, as it does *not* do what your macro requests it to do.)

Ciao
Frank

-- 
Frank Schönheit StarOffice/OpenOffice.org Base
[EMAIL PROTECTED]+49 40 23 646 663 / +3
Sun Microsystems Germany Hamburg, Nagelsweg 55
--

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



Re: [dba-dev] Image control aspect ratio

2008-09-02 Thread Frank Schönheit - Sun Microsystems Germany
Hi Marc,

 I hope your workload will lower soon. In fact the statement I'll file
 an issue ... is part of the citation. ;)

Oh ... which also means the other part of the citation wasn't mine -
doh, I knew that was too profound for that ...

 But I'd take that task if I am sure what to write.

Thanks.

 Is it a limit or a lenght for:
 
Form.Columns.getByName().setBinarySream()
aka ResultSet.get/setAnything.setBinaryStream()
 
Form.Columns.getByName().updateBinaryStream()
aka ResultSet.get/setAnything.updateBinaryStream()
 
css.sdbc.XParameter.setBinaryStream()
 
 ?

I'd say it should be a limit for all of those.

 And I'll try again:
 
 Does the last of those three (or all at best) need a stream implementing
 css.io.XSeekable besides the XInputStream/XOutputSream interface?

None of those should need it. All implementations I found try to read as
much bytes as indicated by the Length parameter.

Now that I looked up the implementations, again ... most of them even
seem to silently ignore (implicitly, by using XInputStream::readBytes,
which also does so) when there were less bytes than specified. The only
exception is the ODBC bridge, whose setBinaryStream in fact throws an
exception if it cannot read the specified number.

 The same is true for the ComponentLoader (not Documentloader) for input
 streams, which is why people have to implement a stream wrapper offering
 both interfaces (XInputStream  XSeekable).
 
 Since my experiments handing over an input stream to a XParameter are
 all blocking except when a dbase db is used as backend this could be the
 problem. Or the length argument is biting back ...

What exactly do you mean with are all blocking? Does the call not return?

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



Re: [dba-dev] Image control aspect ratio

2008-09-02 Thread Marc Santhoff
Hello Frank,

Am Dienstag, den 02.09.2008, 10:24 +0200 schrieb Frank Schönheit - Sun
Microsystems Germany:
 Hi Marc,
 
  I hope your workload will lower soon. In fact the statement I'll file
  an issue ... is part of the citation. ;)
 
 Oh ... which also means the other part of the citation wasn't mine -
 doh, I knew that was too profound for that ...
 
  But I'd take that task if I am sure what to write.
 
 Thanks.
 
  Is it a limit or a lenght for:
  
 Form.Columns.getByName().setBinarySream()
 aka ResultSet.get/setAnything.setBinaryStream()
  
 Form.Columns.getByName().updateBinaryStream()
 aka ResultSet.get/setAnything.updateBinaryStream()
  
 css.sdbc.XParameter.setBinaryStream()
  
  ?
 
 I'd say it should be a limit for all of those.

Okay.

  And I'll try again:
  
  Does the last of those three (or all at best) need a stream implementing
  css.io.XSeekable besides the XInputStream/XOutputSream interface?
 
 None of those should need it. All implementations I found try to read as
 much bytes as indicated by the Length parameter.
 
 Now that I looked up the implementations, again ... most of them even
 seem to silently ignore (implicitly, by using XInputStream::readBytes,
 which also does so) when there were less bytes than specified. The only
 exception is the ODBC bridge, whose setBinaryStream in fact throws an
 exception if it cannot read the specified number.
 
  The same is true for the ComponentLoader (not Documentloader) for input
  streams, which is why people have to implement a stream wrapper offering
  both interfaces (XInputStream  XSeekable).
  
  Since my experiments handing over an input stream to a XParameter are
  all blocking except when a dbase db is used as backend this could be the
  problem. Or the length argument is biting back ...
 
 What exactly do you mean with are all blocking? Does the call not return?

When I use XParameter.setBinaryStream() the Office goes into no
display any more-mode. Using top on FreeBSD I can see the process being
in in poll-mode. Looks like there is some synchronization issue or I'm
doing something wrongly.

On Win32 the behaviour is the same, in all cases there is no CPU load,
the office only doesn't do anything including refreshing the display.

I was trying to use a css.io.Pipe to connect the two active data sources
(doc.storeToUrl and XParameter.setBinaryStream).

Using dbase I succeeded in writing othe train to ut a doc this way, for
mysql or hsql the office hangs. See some code below, maybe the
limit-argument is the problem, which I set to 65536 as a limit and the
document was anytime smaller than that on storage (~30kB).

code
...
sql = INSERT INTO pieces (ID, piece) VALUES (?, ?)
oPStatement = aConnection.prepareStatement( sql )
oPStatement.setInt(1, aID)

dim Args(0) as new com.sun.star.beans.PropertyValue

oPipe = CreateUNOService(com.sun.star.io.Pipe)
Args(0).Name = OutputStream
Args(0).Value = oPipe ' s.u.

' order IS IMPORTANT !!! for dbase ...
tmpDoc.storeToUrl(private:stream, Args())

' never-come-back-call ...
oPStatement.setBinaryStream(2, oPipe, 65536)

oPStatement.executeUpdate()

/code

Marc



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



Re: [dba-dev] Image control aspect ratio

2008-09-02 Thread Frank Schönheit - Sun Microsystems Germany
Hi Marc,

 Using dbase I succeeded in writing othe train to ut a doc this way, for
 mysql or hsql the office hangs. See some code below, maybe the
 limit-argument is the problem, which I set to 65536 as a limit and the
 document was anytime smaller than that on storage (~30kB).

it might ... The length argument is used for XInputStream.readBytes (in
some cases, for XInputStream.readSomeBytes, which I consider a bug), and
though the API definition says the method should return in case of EOF,
there might be a bug somewhere that it blocks in this case.

 code
   ...
   sql = INSERT INTO pieces (ID, piece) VALUES (?, ?)
   oPStatement = aConnection.prepareStatement( sql )
   oPStatement.setInt(1, aID)
 
   dim Args(0) as new com.sun.star.beans.PropertyValue
 
   oPipe = CreateUNOService(com.sun.star.io.Pipe)
   Args(0).Name = OutputStream
   Args(0).Value = oPipe ' s.u.
 
   ' order IS IMPORTANT !!! for dbase ...
   tmpDoc.storeToUrl(private:stream, Args())
 
   ' never-come-back-call ...
   oPStatement.setBinaryStream(2, oPipe, 65536)
 
   oPStatement.executeUpdate()
 
 /code

Will try to reproduce. As always, an issue is highly welcome, and might
speed up things :)

Thanks  Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



Re: [dba-dev] Image control aspect ratio

2008-08-28 Thread Frank Schönheit - Sun Microsystems Germany
Hi Marc,

 This *may* be something like the documentation bug there was talk about
 once upon a time. You wrote:
 
 cite
 Hi Matthias,
 
 
 The only conclusion I can draw from such an inconsistent API is that any
 implementation that claims to be usable can only ignore the 'Length'
 argument.

I wrote that, really? Sounds like I knew what I was talking about back
then :)

 
 Probably only 'setBinaryStream()' documentation (and implementation?)
 need to be fixed to clarify 'Length' as 'Limit'.
 
 I fully agree, and I'll file an issue to adjust the documentation as
 well as the implementations.

Thanks. If you could refer to this old discussion and the reasoning
therein, this could be helpful.

I in fact looked up the implementation before I answered to Fernand, and
we use the length as length currently, not as limit.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



Re: [dba-dev] Image control aspect ratio

2008-08-25 Thread Fernand Vanrie

Frank Schönheit - Sun Microsystems Germany wrote:

Hi Fernand,

  

A related question:
Can you give me some hints   to produce a minimal code (maybe no code at 
all :-) )to  put images out of a database into a writerdoc who is the 
base document to run a mailmerge using the beamer(F4)



In general, the database column is able to provide its content as stream
(getBinaryStream, being an XInputStream). Of course you could write this
to a file (though I do not know the API for this). Whether it's possible
to directly put the binary content into a text doc - not sure, perhaps
the css.graphic API has something for it. I suggest asking this in
detail in [EMAIL PROTECTED]

If your main problem is how to get the column which supplies the binary
stream, then I might be able to help - if you tell me somewhat more
about your setup.
  
Frank, thanks for the reply but in the mean time we decided to store the 
URL's in the datbase and not the dinary data.


But  storing formated text into a database field is a related problem, 
and  Marc Santhof replied as follows:


Use doc.StoreToUrl() using a stream as target and connect that stream
object to the db field (on a prepared statement get/setBinaryStream()
IIRC).

I'm sure *Frank* can help with the details of connecting a stream to a
database column ...

Can you help me Frank :-)

Greetz

Fernand



Ciao
Frank

  



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



Re: [dba-dev] Image control aspect ratio

2008-08-21 Thread Frank Schönheit - Sun Microsystems Germany
Hi Andrew,

 My expectation is that most images will be larger than the control size. 
 I am scanning receipts so that I can extract the image from the database 
 and print it if I require warranty repair on something.

Okay, in this case the Scale property in its current appearance
doesn't help you.

 PS: Alternatively ... write a small patch which enables the control to
 scale the image by keeping its ratio :).
 Seriously: Is anybody aware of an RFE for this?
   
 I was considering creating one...

Would it help your considerations if I additionally encourage you to do
so? :)

I have a patch running which changes the Scale property from Yes/No
to No/Keep Ratio/Fit to Size, which I could use for this. What's still
missing is the file format change, which unfortunately also requires a
file format specification fragment to be submitted to OASIS ... :-\ (Ah,
those lucky times where we justed dumped some bits into some proprietary
binary file format ... :)

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



Re: [dba-dev] Image control aspect ratio

2008-08-20 Thread Andrew Douglas Pitonyak


Frank Schönheit - Sun Microsystems Germany wrote:

Hello Andrew,

  
Insert an image control into a form and associate the control to a field 
in the database.


The image control has a specific size. If the control displays an image 
with a different aspect ratio, then the image may be severely distorted.


Any thoughts on how to avoid this?



Set the Scale image property to no and ensure all images in the DB
are smaller than the control size.
  


I was NOT aware of this property...

My expectation is that most images will be larger than the control size. 
I am scanning receipts so that I can extract the image from the database 
and print it if I require warranty repair on something.



(Sorry if this is a dumb hint. You didn't mention whether you knew the
property, so I thought I mention it.)
  


I will gladly accept numerous dumb hints, because every now and then, 
one hits the jackpot!



Ciao
Frank

PS: Alternatively ... write a small patch which enables the control to
scale the image by keeping its ratio :).
Seriously: Is anybody aware of an RFE for this?
  

I was considering creating one...

--
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]



Re: [dba-dev] Image control aspect ratio

2008-08-20 Thread Andrew Douglas Pitonyak



Fernand Vanrie wrote:

Andrew Douglas Pitonyak wrote:
Hi Andrew I have some questions


Insert an image control into a form and associate the control to a 
field in the database.
Is the Image datafile stored in the database or is het just the URL of 
the image


I store the image in the database.

The image control has a specific size. If the control displays an 
image with a different aspect ratio, then the image may be severely 
distorted.
In the Image control we need just a sort of representation  of the 
image. This represenation could be resised = ( easy to do)  or croped 
=(more complicated in OO)


I would not change the image, just the control size.


Any thoughts on how to avoid this?

Handling with a macro  who is resising or cropping  :-)


Yes, good point. When I create the control, I set the size and aspect 
ration of the control. I could use a macro to change the size of the 
control so that the aspect ration was the same as the image. The macro 
would need to be called when a new image was displayed. Not certain off 
hand which events I would need to catch, but it sure seems like a lot of 
work.




greetz Fernand

Thanks for the reply!

--
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]



[dba-dev] Image control aspect ratio

2008-08-19 Thread Andrew Douglas Pitonyak


Insert an image control into a form and associate the control to a field 
in the database.


The image control has a specific size. If the control displays an image 
with a different aspect ratio, then the image may be severely distorted.


Any thoughts on how to avoid this?

My primary thought is that I would write a macro that resizes the image 
control based on the aspect ratio of the currently displayed image.



--
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]