Hi there,
did try to find a solution firstly by searching the api-search interface
to no avail. (E.g.
<http://api.openoffice.org/servlets/Search?scope=projectAndSubs&resultsPerPage=40&query=bring+to+front&Button=Go>,
short of a document object at that point in time I cannot try to use
that for getting access at the CurrentController).
The problem: for a conversion from a writer-document to pdf the user is
presented with a FilePicker dialog only, where he should pick the file
to be converted, and which gets loaded therafter into OOo. Unfortunately
the dialog is not displayed as the top/front window, so the user needs
to get it to front manually.
What would be a starting point to research to get the FilePicker to the
front programmatically (without having a document object yet)?
Regards,
---rony
P.S.: In case it is helpful (or if some are a little bit curious) I
copied that particular ooRexx script, so you can see the flow of logic.
ooRexx is case-insensitive and the tilde (~) is the message operator
(hence it is clear that the literal right to it is always the message
name to be sent to the object left to it). Routines like ConvertToURL()
or ConvertFromURL() are named/modelled after {Star|OOo]Basic. (The next
steps are to forego the explicit need for requesting interface objects
like Basic allows for; although in the meantime I am not so sure whether
that will be really so helpful to macro/script programmers, because
requesting explicitly interfaces makes it perfect clear over time what
functionality is sought and is available; yet some people may still want
that feature; that's the reason why I was so eager to learn about
reflecting UNO and being able to do it via Java, which serves as a
bridging technology.)
------------------- cut here --------------------
/* ooRexx Example 10 (cf. <http://www.ooRexx.org>)
Open an existing textfile and convert it to *.pdf
Possible files are *.sxw, *.doc, *.txt,.... */
/* initialize connection to server, get its Desktop-service and
XComponentLoader interface */
xMsf = OOo.connect() -- connect to server and get remote multi service factory
-- Retrieve the Desktop object, we need its XComponentLoader interface to
load a new document
oDesktop = xMsf~createInstance("com.sun.star.frame.Desktop")
xComponentLoader = oDesktop~xDesktop~XComponentLoader -- get componentLoader
interface
url=getFileName(xMsf) -- get file name from user
if url=.nil then exit -- user did not pick a file
say "File:" pp(ConvertFromURL(url)) "..."
props = bsf.createArray(.ooo~propertyValue, 1)
props[1] = .OOo~PropertyValue~new
props[1]~Name = "Hidden"
props[1]~Value = box("boolean", .true)
xWriterComponent = xComponentLoader~loadComponentFromURL(url, "_blank", 0,
props)
xStorable = xWriterComponent~XStorable -- get xStorable interface
/* convert it to *.pdf */
props = bsf.createArray(.OOo~PropertyValue, 2)
props[1] = .OOo~PropertyValue~new
props[1]~Name = "FilterName"
props[1]~Value = "writer_pdf_Export"
props[2] = .OOo~PropertyValue~new
props[2]~Name = "CompressMode"
props[2]~Value = 2
storeURL=substr(url, 1, lastpos(".", url)) || "pdf" -- create output file
name
xStorable~storeToUrl(storeURL, props) -- store the file with props to URL
say "File:" pp(ConvertFromURL(storeURL)) "successfully created!"
::requires OOo.cls -- get OOo support
::routine getFileName -- FilePicker dialog to ask the user to pick a file to
convert
use arg xMsf, oDesktop -- retrieve multi service factory
fd=xMsf~createInstance("com.sun.star.ui.dialogs.FilePicker")
xfp=fd~XFilePicker -- get the interface for driving the FilePicker
functionality
urlPath=convertToUrl(directory()) -- convert current directory to URL
xfp~setDisplayDirectory(urlPath) -- determine directory to start out with
ret=xfp~setTitle(date("S") time()": Please choose a writer file to convert to
PDF!")
xfm=xfp~XFilterManager -- get the filter manager interface
fileTypes="*.sxw;*.doc;*.txt;*.text"
xfm~appendFilter("Text files" pp(fileTypes), fileTypes) -- first filter is
"current" one
xfm~appendFilter("All files", "*")
ret=xfp~execute -- execute the dialog
if ret=1 then -- 1...o.k., 0...cancel
file=xfp~files[1]
fd~XComponent~dispose -- close dialog
if ret=1 then return file
return .nil -- canceled by user
------------------- cut here --------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]