Re: [api-dev] Java storeAsURL PDF Problem

2006-01-02 Thread Laurent Godard

Hi Mathias,


i try to export a writer document (odt) to PDF. Here is the code:

try {
xStorable.storeAsURL(pdfUrl, propertyValues);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


you have to use storeToURL as PDF format is not editable by OOo

Laurent


--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org
Indesko  http://www.indesko.com
Nuxeo CPS  http://www.nuxeo.com - http://www.cps-project.org
Livre Programmation OpenOffice.org, Eyrolles 2004

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



Re: [api-dev] Is there any way to catch when a Base document is being opened.

2006-01-02 Thread Andrew Jensen
hmm...looking at this section again, maybe I am wrong. This time I read 
the API doc page for GlobalEventBroadcaster also.


I will try it using Java and see if I get something to check against.

Thanks agaiin

Andrew Jensen wrote:


Matthias,

Thanks for the suggestion. However, I had read that section. The way I 
took this was that it is equivilant to assigning a procedure to a 
given event using

ToolsConfigureEvents and selecting OpenOffice.org. Am I wrong on this?

Also the documentation states:

The event source in the notifications is NULL (empty).

This is my problem, what I don't understand is how once in my event 
handler is called what am I checking

to see if it supprots the interfcae XOfficeDatabaseDocument?

As I state in the first email if the event is a Base document opening 
then
thisComponent is null, StarDesktop.CurrentComponent and 
StarDesktip.CurrentController don't seem to help.


I know I must be missing something, but I don't know what to check 
against?


Andrew 'Drew' Jensen


Matthias Benkmann wrote:


Hi Andrew,

register an event handler (Dev Guide 6.2.6) on the
GlobalEventBroadcaster. Your listener will be passed an EventObject
whose Source member should refer to the component the event relates
to. If this object supports the interface XOfficeDatabaseDocument then
it's an ODB.
I don't know if and how event handlers work in Basic, but that's how
it should work in Java.

Ciao

Matthias

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



 



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





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



Re: [api-dev] Java storeAsURL PDF Problem

2006-01-02 Thread Matthias Scholz

Laurent Godard schrieb:


Hi Mathias,


i try to export a writer document (odt) to PDF. Here is the code:

try {
xStorable.storeAsURL(pdfUrl, propertyValues);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



you have to use storeToURL as PDF format is not editable by OOo


It runs, thank you!

Matthias



Laurent





--

-
Stadt Mansfeld

Lutherstraße 9
06343 Mansfeld


Öffnungszeiten:
Dienstag9 - 12 Uhr  13 - 18 Uhr
Donnerstag  9 - 12 Uhr  13 - 15 Uhr
Freitag 9 - 12 Uhr  


Telefon:+49 34782 8710
Fax:+49 34782 87122
E-Mail: [EMAIL PROTECTED]
WorldWideWeb:   www.stadtverwaltung-mansfeld.de
-


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



Re: [api-dev] Upgrading from 1.x.x to 2.x.x -- Without Re-Learning An API?

2006-01-02 Thread Christian Junker
Hi Hal, I have some good news for you...

2005/12/31, Hal Vaughan [EMAIL PROTECTED]:
 I was looking for a page or summary about what has changed from OOo 1.x.x to
 2.x.x and can't find one.

There is none, because nothing has really *changed* (backwards
compatibility). The API has been extended instead, but your full code
that worked for 1.1.x should also work for 2.0, if not then you can
directly submit an issue for it.

 If I can use my old code with OOo 2.x.x, that
 would be perfect.  Is that possible?

Yes, see above.

 I've heard that the new API makes it
 easier to connect to, but since the old application has been written and is
 working I don't want to change it.  I've also heard (but am not sure) that
 in 2.x.x, to get OOo to listen to a Java connection, I have to do something
 other than the old edit to Setup.xcu.

Yes, the SimpleBootstrap mechanism which automates the IPC via a named pipe.
Everything related to making the office listen for TCP/IP connections
is documented in the Developer's Guide (first chapter, I think)
available at api.openoffice.org .

--
Best Regards
Christian Junker

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



Re: [api-dev] Java storeAsURL PDF Problem

2006-01-02 Thread Christian Junker
This makes me think if we should add a note to the storeAsURL method
description.
http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XStorable.html#storeAsURL

Like so:
NOTE - saving of document formats that cannot be edited but only
exported like PDF should be done with storeToURL only.

What do others think?

--
Best Regards
Christian Junker

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



Re: [api-dev] Optional Parameters in Starbasic function call

2006-01-02 Thread Andrew Douglas Pitonyak

Andrew Jensen wrote:


Question,

I attempted to write a function with the following declaration:

function findCodeVal( RegDSName as String, _
  TableName as String, _
  SrchColName as String, _
  SrchFor as variant, _
  RetColName as String, _
  optional isCaseSensitive as boolean, _
  optional isFuzzy as boolean, _
  optional aConn as variant, _
  optional UserName as String, _
  optional Password as String) _
  as variant

However, with this declaration,  isMissing returns False for every 
optional parameter, even when none have been pass in to functions call.


When I changed the order of the parameters to:

function findCodeVal( RegDSName as String, _
  TableName as String, _
  SrchColName as String, _
  SrchFor as variant, _
  RetColName as String, _
  optional UserName as String, _
  optional Password as String, _
  optional isCaseSensitive as boolean, _
  optional isFuzzy as boolean, _
  optional aConn as variant) _
  as variant

Then isMissing returned the correct response in all cases.  So is this 
because of the Boolean types as optional parameters?


If so, can any one tell me what other rules apply to order of optional 
parameters.


Thanks in advance.

Andrew 'Drew' Jensen

(Apologies if this is a second posting, I sent this yesterday but it 
does not seem to have made it for some reason)


As of version 1.0.3.1, IsMissing will fail with Optional parameters if 
the type is not Variant and the missing optional parameter is 
represented by two consecutive commas. I first investigated this 
behavior after speaking with Christian Anderson [EMAIL PROTECTED] This is 
issue 11678 in issuezilla. The issue was closed with a note that it 
needed to be created under a different topic, which I know because I 
just went back and checked the status. This may be related Then 
again, I have not verified that the original issue is still a problem.


--
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: [api-dev] Is there any way to catch when a Base document is being opened.

2006-01-02 Thread Andrew Jensen

Jörg ,

Well, down and dirty works, maybe..

I am left with one puzzle and a concern, however. I changed my little
routine to this.

const title_must_be =  OpenOffice.org Base

sub onOpenDocumentMain
dim df as variant
 df = Stardesktop.Frames
 If  RIGHT((df(df.count-1).title), len(title_must_be)) = title_must_be Then
   msgbox this is a Base document
  ' check if database is registered in
  ' dbMaster
 else
 msgBox Not a Base Document
 End if

end sub

Now here is the puzzle. If I open anything other then a Base document 
the document

opens and the msgBox is displayed once, ontop of the newly opened window.

If it is a Base document then the msgBox is displayed twice and the 
actual document
frame doesnot open until the seconod message box is closed. Now this 
might turn
out to be an advantage for my use, which is to associate a default form 
for a given

database, and then optionaly not display the actual database frame at all.


Thanks

Drew
Jörg Schmidt wrote:


Hello,

the following (dirty) workaround is a solution (not so smart, but it
works):

sub odb_open_test()
'for a german OOo
title_must_be = OpenOffice.org Base
df = Stardesktop.Frames
If  RIGHT((df(df.count-1).title), 19) = title_must_be Then
msgbox this is a Base document
End if
end sub

I think that code works correctly (under your specific conditions!) in
all cases.



Jörg


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



 



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



Re: [api-dev] Optional Parameters in Starbasic function call

2006-01-02 Thread Bernard Marcelly

Bonjour Andrew Douglas Pitonyak
Message du 2006-01-02 16:30:

Andrew Jensen wrote:


I attempted to write a function with the following declaration:

function findCodeVal( RegDSName as String, _
  TableName as String, _
  SrchColName as String, _
  SrchFor as variant, _
  RetColName as String, _
  optional isCaseSensitive as boolean, _
  optional isFuzzy as boolean, _
  optional aConn as variant, _
  optional UserName as String, _
  optional Password as String) _
  as variant

However, with this declaration,  isMissing returns False for every 
optional parameter, even when none have been pass in to functions call.


When I changed the order of the parameters to:


(...)

Then isMissing returned the correct response in all cases.  So is this 
because of the Boolean types as optional parameters?


(Note that this subject concerns udk, not API mailing list)

The bug is not in the order or the type of optional parameters, but in 
the order of testing the optional parameters. If you test the optional 
parameters in the same order as they appear in the definition, IsMissing 
is working OK. If you test in a different order, result is nonsense.

Example, call the above routine without any optional argument.

Put this in the routine, it will work OK:
if IsMissing(isCaseSensitive)  then MsgBox(isCaseSensitive is missing)
if IsMissing(UserName)  then MsgBox(UserName is missing)

But this code instead will give a wrong answer:
if IsMissing(UserName)  then MsgBox(UserName is missing)
if IsMissing(isCaseSensitive)  then MsgBox(isCaseSensitive is missing)

The bug was reported in IZ 30500. In versions 1.1.x and 2.0.1 it is 
still not corrected and not even documented, so it should not have 
status RESOLVED and FIXED.


   Bernard


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



Re: [api-dev] Java storeAsURL PDF Problem

2006-01-02 Thread Laurent Godard

Hi christian,


Like so:
NOTE - saving of document formats that cannot be edited but only
exported like PDF should be done with storeToURL only.

What do others think?


it is explicit and will save a FAQ
i would say yes

Laurent

--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org
Indesko  http://www.indesko.com
Nuxeo CPS  http://www.nuxeo.com - http://www.cps-project.org
Livre Programmation OpenOffice.org, Eyrolles 2004

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



Re: [api-dev] Optional Parameters in Starbasic function call

2006-01-02 Thread Laurent Godard

Hi Bernard,

The bug was reported in IZ 30500. In versions 1.1.x and 2.0.1 it is 
still not corrected and not even documented, so it should not have 
status RESOLVED and FIXED.


perhraps reopen the bug and mark it as regression in keywords

where are optional parameters located in the source code ? I can 
perharps have a look


Laurent

--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org
Indesko  http://www.indesko.com
Nuxeo CPS  http://www.nuxeo.com - http://www.cps-project.org
Livre Programmation OpenOffice.org, Eyrolles 2004

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



Re: [api-dev] Optional Parameters in Starbasic function call

2006-01-02 Thread Andrew Jensen
Well, I have done a quick test with the information about order of 
testing,.that does cause the problem. But it still appears that the type 
of parameter plays a role. It seems that as long as the order, relative 
to type is maintained it works. I will take time this evening and try to 
pin this down and put up what I find.


Thanks

Drew

Laurent Godard wrote:


Hi Bernard,

The bug was reported in IZ 30500. In versions 1.1.x and 2.0.1 it is 
still not corrected and not even documented, so it should not have 
status RESOLVED and FIXED.



perhraps reopen the bug and mark it as regression in keywords

where are optional parameters located in the source code ? I can 
perharps have a look


Laurent



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



Re: [api-dev] Is there any way to catch when a Base document is being opened.

2006-01-02 Thread Matthias Benkmann
On 1/2/06, Andrew Jensen [EMAIL PROTECTED] wrote:
 Matthias,

 Thanks for the suggestion. However, I had read that section. The way I took 
 this
 was that it is equivilant to assigning a procedure to a given event using
 ToolsConfigureEvents and selecting OpenOffice.org. Am I wrong on this?

GlobalEventBroadcaster supports 2 interfaces: XEventsSupplier and
XEventBroadcaster. I'm talking about the XEventBroadcaster interface
which is not the same as Tools-Configure-Events.

 Also the documentation states:

 The event source in the notifications is NULL (empty).

I don't know where this particular quote comes from but I know for a
fact that if you register an event handler via XEventBroadcaster you
will get a proper event source.

 This is my problem, what I don't understand is how
 once in my event handler is called what am I checking
 to see if it supprots the interfcae XOfficeDatabaseDocument?

In Java you use UnoRuntime.queryInterface().

 As I state in the first email if the event is a Base document opening then
  thisComponent is null,

ThisComponent is only useful for macros stored in documents.

 StarDesktop.CurrentComponent
 and StarDesktip.CurrentController don't seem to help.

They refer to the foreground document which is not necessarily the
event source, so it is usually just as unhelpful as ThisComponent as
far as events are concerned.

To do things properly you have to use the XEventBroadcaster interface
to register a real event handler. I don't know how to do this from
StarBasic or if it it is even possible.

Matthias

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



Re: [api-dev] Is there any way to catch when a Base document is being opened.

2006-01-02 Thread Andrew Jensen




First - thanks again. So forgive me for being a little dense on this. 

Matthias Benkmann wrote:

  On 1/2/06, Andrew Jensen [EMAIL PROTECTED] wrote:
  
  
Matthias,

Thanks for the suggestion. However, I had read that section. The way I took this
was that it is equivilant to assigning a procedure to a given event using
ToolsConfigureEvents and selecting OpenOffice.org. Am I wrong on this?

  
  
GlobalEventBroadcaster supports 2 interfaces: XEventsSupplier and
XEventBroadcaster. I'm talking about the XEventBroadcaster interface
which is not the same as Tools-Configure-Events.
  

OK, I will go over that in more detail. On page 478 in the Dev.Guide
5-2005 it says;
"All event bindings can be seen or set in the OpenOffice.org UI in the
Tools-Configure dialog on
Events page."
I did not realize it was limiting this just to one of the interfaces. 

  
  
  
Also the documentation states:

"The event source in the notifications is NULL (empty)."

  
  
I don't know where this particular quote comes from but I know for a
fact that if you register an event handler via XEventBroadcaster you
will get a proper event source.

  

On page 478 in DevGuide again. I may have missed the context on this
however, it is just below as 
section talking about the events OnStartApp and OnCloseApp, maybe this
is limited to only this case.
I am guessing however that it may have more to do with the 2 seperate
interfaces you mentioned 
earlier. Because if you assign any of these events to a procedure that
takes a parameter it generates an
error 'Wrong number of parameters", assign to a procedure with no
parameters and it is happy.

  
  
This is my problem, what I don't understand is how
once in my event handler is called what am I checking
to see if it supprots the interfcae XOfficeDatabaseDocument?

  
  
In Java you use UnoRuntime.queryInterface().

  

Thanks

  
  
As I state in the first email if the event is a Base document opening then
 thisComponent is null,

  
  
ThisComponent is only useful for macros stored in documents.
  

OK

  
  
  
StarDesktop.CurrentComponent
and StarDesktip.CurrentController don't seem to help.

  
  
They refer to the foreground document which is not necessarily the
event source, so it is usually just as unhelpful as ThisComponent as
far as events are concerned.
  

Actually, in the case of all document types other then Base they are
very useful. The macro (basic procedure) assigned to the event is 
not called until the frame is already on the desktop - so I could have
used thisComponent, StarDeskTop.CurrentComponet or 
StarDesktop.CurrentController.Frame for my purposes. It is only when it
is an ODB file being loaded that the frame has not been
displayed on the desktop before the call to the assigned procedure.

  
To do things properly you have to use the XEventBroadcaster interface
to register a real event handler. I don't know how to do this from
StarBasic or if it it is even possible.

Matthias
  


Bottom line is, I have a lot to learn abou this tool and appreciate
your help

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