Servus Andreas,
thanks a lot for your explanations!
Andreas Schlüns schrieb:
Can you describe more in detail what are you doing ?
Might be there exists another (might be more elegant) solution.
The use case is the integration of Fritz!Fax, a very common pc fax
solution for Microsoft Windows.
Sending a fax from Writer means nothing else, than printing a
document to a virtual printer. Normally the printer driver pops up a
dialog for entering the destination´s fax number. However, Fritz!Fax
won´t show a dialog and retrieve the fax number from the Windows
registry, if it has been filed there.
Fritz!Fax looks for values in the following registry key:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\FRITZ!fax\Print\
If the name of one of the values found there, matches the name of
the printing job, Fritz!Fax takes the data of this value for the fax
number, instead of asking the user for an GUI input.
Automating Fritz!Fax by OpenOffice.org Basic means to write the fax
number to a value in the registry before printing the document. The
name of this value must equal the name of the printing job, that OOo
passes to the system.
I must admit, that I am completely unexperienced with the OOo object
model and programming model, as well as the OOo Basic IDE and I am
still spoiled by many years of programming with MS VB and VBA. (I
believe, I generally understand classes, objects, properties and
methods. But I am at loss with services and interfaces.)
At leased I managed to create an integration of Fritz!Fax and
Writer, which you can see here (description in german, comments to
the code in english):
http://wiki.services.openoffice.org/wiki/DE/Fax_mit_OOo_und_Fritz!Fax
There is a procedure that is to be called by the 'Print Document'
event. It reads the fax number out of a special bookmark in the
document. My biggest challenge was how to get the name of the
printing job, that OOo would pass to the printer. I took it from the
title of the program window, although I knew that this might not be
very elegant.
My code was meant as an academic code example, not ready for real
world deployment. However, a number of users seem to have adopted it
from the wiki page and have been using it day-to-day. With OOo 3.0
the solution is broken for faxing unsaved documents, because the
title of the document and the label of the printing job are no
longer equal: "Untitled 1" <--> "Untitled1"
A silver bullet would be a way to retrieve the name of the print
job, that OOo would pass to the printing system in a code line just
as simple as:
DocName = thisComponent.CurrentController.Frame.Title
Right now, I am considering to modify my solution by explicitly
removing the space character in case the title starts with
"Untitled". Not very elegant, I know, but maybe a pragmatic way to
deal with it.
Regards,
Stefan
--
Ich bin keine Ameise.
http://www.stefan-weigel.de/?ID=112
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]