[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Hi Mathias,

sorry for the noise, the accelerators work correctly for both menu and
toolbar items.

The problem: during different test runs I created accelerators with
Shift+Ctrl and for Shift+Alt without ever removing the accelerators upon
uninstall. Therefore both sets of accelerators were operational, where
for the menus the Shift+Ctrl shortcuts got used.

After removing the accelerators with removeCommandFromAllKeyEvents()
upon uninstall fixed the problem from then on.

---rony


On 25.05.2011 23:09, Rony G. Flatscher wrote:
> Hi Mathias,
>
> maybe one more question: in addition to the toolbar I have created a
> menubar and all menu-items match the toolbar items (CommandURL, Label,
> etc.).
>
> The menus also work and show the icons and in addition they show the
> accelerator keys.
>
> *However*, the menu item accelerators show "Shift+Ctrl", whereas the
> toolbar item accelerators (which are the only ones that got defined by
> my program) were defined with "Shift+Meta2" (i.e. "Shift+Alt"). Both set
> of accelerators are operational!
>
> Is there a possibility to have the menu display and use the accelerator
> that got defined, i.e. "Shift+Meta2"?
>
> TIA,
>
> ---rony
>
>
>
>
>
> On 25.05.2011 18:01, Mathias Bauer wrote:
>   
>> On 25.05.2011 17:35, Rony G. Flatscher wrote:
>>
>> 
>>>>>> As an example, I configured "SHIFT-ALT-G" for "Insert-Gallery" in the
>>>>>> keyboard configuration. The "view" menu (don't ask me why the menu
>>>>>> has
>>>>>> it in "view", the config in "insert" ;-)) immediately shows the new
>>>>>> accelerator, the toolbar quickhelp doesn't. If I now open a new
>>>>>> document, its toolbar shows the accelerator in the quickhelp text of
>>>>>> the "Gallery" button.
>>>>>> 
>>>>> Just tried this via "Tools->Customize", but it did not work with the
>>>>> toolbar item.
>>>>>   
>>>> *what* did you try? My example with ".uno:Gallery" or your
>>>> script/macro?
>>>> 
>>> Your example.
>>>
>>>   
>>>> In case you didn't notice, it is necessary to create the toolbar
>>>> *after* you have configured the shortcut, e.g. by opening a new
>>>> document window.
>>>> 
>>> Did try that, even shut down all instances of OOo writer.
>>>
>>> It's OOo 3.2.1 though, so maybe that does not work with that "old"
>>> version?
>>>   
>> Hm, probable. I tested with 3.3. Maybe if I come across a 3.2.1 I
>> might try it again.
>>
>> Regards,
>> Mathias 
>> 
>   

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Hi Mathias,

maybe one more question: in addition to the toolbar I have created a
menubar and all menu-items match the toolbar items (CommandURL, Label,
etc.).

The menus also work and show the icons and in addition they show the
accelerator keys.

*However*, the menu item accelerators show "Shift+Ctrl", whereas the
toolbar item accelerators (which are the only ones that got defined by
my program) were defined with "Shift+Meta2" (i.e. "Shift+Alt"). Both set
of accelerators are operational!

Is there a possibility to have the menu display and use the accelerator
that got defined, i.e. "Shift+Meta2"?

TIA,

---rony





On 25.05.2011 18:01, Mathias Bauer wrote:
> On 25.05.2011 17:35, Rony G. Flatscher wrote:
>
>>>>> As an example, I configured "SHIFT-ALT-G" for "Insert-Gallery" in the
>>>>> keyboard configuration. The "view" menu (don't ask me why the menu
>>>>> has
>>>>> it in "view", the config in "insert" ;-)) immediately shows the new
>>>>> accelerator, the toolbar quickhelp doesn't. If I now open a new
>>>>> document, its toolbar shows the accelerator in the quickhelp text of
>>>>> the "Gallery" button.
>>>> Just tried this via "Tools->Customize", but it did not work with the
>>>> toolbar item.
>>>
>>> *what* did you try? My example with ".uno:Gallery" or your
>>> script/macro?
>> Your example.
>>
>>> In case you didn't notice, it is necessary to create the toolbar
>>> *after* you have configured the shortcut, e.g. by opening a new
>>> document window.
>> Did try that, even shut down all instances of OOo writer.
>>
>> It's OOo 3.2.1 though, so maybe that does not work with that "old"
>> version?
>
> Hm, probable. I tested with 3.3. Maybe if I come across a 3.2.1 I
> might try it again.
>
> Regards,
> Mathias 

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Invoking macros via toolbar items: where does the argument come from ?

2011-05-25 Thread Rony G. Flatscher
Hi Ariel,

thank you *very* much for this link which explains the situation!

Unbelievable what you find (and know), kudos !

Best regards,

---rony


On 25.05.2011 17:41, Ariel Constenla-Haile wrote:
> Hello Rony,
>
> On Wednesday 25 May 2011, 07:25, Rony G. Flatscher wrote:
>   
>> Hi there,
>>
>> if executing a macro via "Tools -> Macro -> Run" there is no argument
>> supplied to the script.
>>
>> However, if running the same macro via a toolbar item, an argument is
>> supplied, which seems to have always a value of "0" (false?). Where does
>> this argument come from and what is its purpose, where can one find the
>> documentation for this?
>> 
> there is an explanation in 
> http://openoffice.org/bugzilla/show_bug.cgi?id=85298#c3
>
>
> Regards
>   

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Hi Mathias,

On 25.05.2011 16:40, Mathias Bauer wrote:
> On 25.05.2011 14:32, Rony G. Flatscher wrote:
>
>> How can I define a quickhelp text for each toolbar item? It seems that
>> by default the label of the toolbar item is used as the quickhelp
>> (tooltip?) text, and that does not exhibit the shortcut key by
>> underlying it.
>
> Indeed the quickhelp text is the label. It *should* exhibit the
> shortcut key that is assigned to the same command as the toolbar item,
> if you make sure that the keyboard configuration was created before
> the toolbar was created. If not, this would be a "missing feature" ;-).
>
> As I wrote, the accelerator key was shown for built-in commands and
> for basic macros. So I don't see a general reason why it shouldn't
> work for scripts.
>
>>> As an example, I configured "SHIFT-ALT-G" for "Insert-Gallery" in the
>>> keyboard configuration. The "view" menu (don't ask me why the menu has
>>> it in "view", the config in "insert" ;-)) immediately shows the new
>>> accelerator, the toolbar quickhelp doesn't. If I now open a new
>>> document, its toolbar shows the accelerator in the quickhelp text of
>>> the "Gallery" button.
>> Just tried this via "Tools->Customize", but it did not work with the
>> toolbar item.
>
> *what* did you try? My example with ".uno:Gallery" or your script/macro?
Your example.

> In case you didn't notice, it is necessary to create the toolbar
> *after* you have configured the shortcut, e.g. by opening a new
> document window.
Did try that, even shut down all instances of OOo writer.

It's OOo 3.2.1 though, so maybe that does not work with that "old" version?

In any case I changed the program to first define and store the
accelerations and then create the toolbar items.

Probably I will add a menu in addition, hoping that it will underline
the shortcut letters.


>
>> P.S.: One observation: it is not possible to delete the programmatically
>> created toolbar using "Tools ->  Customize" as the delete option is
>> greyed out. One can delete the individual toolbar items and make the
>> toolbar empty and on the next restart the toolbar seems to have gone.
>
> I don't know if this is a bug or by intent, sorry.
No problem.

Thank you *very* much for your help and insights!

Best regards,

---rony

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Mathias,

thank you very much for your explanations!A comparable functionality
does not exist for toolbar items.

... cut ...
>
> OTOH, toolbar quickhelp texts can show *accelerators* that are
> configured for the same functionality, in the same way as the menus do.
> (We don't do that in the item text as in menus as space in toolbars is
> more limited.)
>
> The quickhelp for the "Open" button shows "Open (CTRL+O)" because
> "CTRL+O" is the accelerator for the ".uno:Open" command (in the
> default configuration that may be changed via
> "tools-customize-keyboard"). And the menu item for "Open" also shows
> "CTRL+O".
>
> There is some code in OOo's framework that adds the accelerators to
> the label or quickhelpt text. In menus this code works immediately as
> menus are always created at the very moment they are opened. Toolbar
> quickhelp texts need an update notification when the shortcut was
> changed. As it seems, this update notification is not sent. But the
> quickhelp text of a new document would be correct as the accelerator
> is already known when the toolbar is created.
How can I define a quickhelp text for each toolbar item? It seems that
by default the label of the toolbar item is used as the quickhelp
(tooltip?) text, and that does not exhibit the shortcut key by
underlying it.

> As an example, I configured "SHIFT-ALT-G" for "Insert-Gallery" in the
> keyboard configuration. The "view" menu (don't ask me why the menu has
> it in "view", the config in "insert" ;-)) immediately shows the new
> accelerator, the toolbar quickhelp doesn't. If I now open a new
> document, its toolbar shows the accelerator in the quickhelp text of
> the "Gallery" button.
Just tried this via "Tools->Customize", but it did not work with the
toolbar item.

---rony

P.S.: One observation: it is not possible to delete the programmatically
created toolbar using "Tools -> Customize" as the delete option is
greyed out. One can delete the individual toolbar items and make the
toolbar empty and on the next restart the toolbar seems to have gone.

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Invoking macros via toolbar items: where does the argument come from ?

2011-05-25 Thread Rony G. Flatscher
Hi there,

if executing a macro via "Tools -> Macro -> Run" there is no argument
supplied to the script.

However, if running the same macro via a toolbar item, an argument is
supplied, which seems to have always a value of "0" (false?). Where does
this argument come from and what is its purpose, where can one find the
documentation for this?

TIA,

---rony



-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher

On 25.05.2011 11:22, Mathias Bauer wrote:
> On 25.05.2011 10:34, Rony G. Flatscher wrote:
>>
>> On 25.05.2011 08:35, Mathias Bauer wrote:
>>> On 24.05.2011 22:31, Rony G. Flatscher wrote:
>>>> Hi there,
>>>>
>>>> in the meantime I have been able to add shortcuts to the toolbar items
>>>> and they are operational. However, the shortcut letter is not
>>>> underlined, although using the tilde (~) before the letter to be
>>>> underlined in the "Label" property of the toolbar item.
>>>>
>>>> Is there a different property that I would need to use for having OOo
>>>> underline the shortcut-key?
>>>> (Again it works, using SHIFT+ALT+letter, where ALT is the META2
>>>> KeyModifier.)
>>>>
>>>> TIA,
>>>>
>>>> ---rony
>>>>
>>>>
>>>>
>>>
>>> What do you mean by "again it works, using SHIFT+ALT+LETTER" ?
>> Just that the defined shortcut-keys are operational. E.g. the shortcut
>> for the "~Import" toolbar item gets defined as SHIFT+META2+I and if you
>> press SHIFT+ALT+I (META2 is ALT on my Windows keyboard) the toolbar item
>> gets executed. It is just the case that the "I" does not get underlined
>> in the toolbar item (a button where the text and the assigned icon get
>> displayed).
>
> Sorry for being dense ;-), 
That's o.k., as I have no idea what the relevant information is when
reporting this observation. So "dense" questions hopefully help clarify.

> where did you define the shortcut? If a shortcut is defined in a menu,
> it will executed only if the menu has the focus. I don't think that
> this works in toolbars. If I just ad a tilde to a toolbar item label,
> I don't see a way to execute this label as a command like in a menu.
>
> Are you sure that you don't talk about accelerators (those who are
> assigned to commands using tools-customize-keyboard)?
O.K., I think the best is that I show you the code snippets then.

The code is in ooRexx but excersises the Java API "behind the curtain".
The tilde in ooRexx is the message operator, so left of the tilde is the
receiving object, right of it the message. In case a queryInterface() is
needed, the ooRexx UNO support allows one to merely send the unqualified
interface name to the UNO object in order to retrieve that interface.

Line comments start with two consecutive dashes (--), block comments are
C-like (but can be nested in the Rexx language).

Having said that, here's the snippet, which should give you the exact
information, please look for the area after the comments lead in as "/*
*** shortcut *** */":

::routine BNF_toolbar   -- rgf, 2011-05-21: create toolbar for writer module
   use arg xContext, install=.true, location="user"   -- "location": Rexx 
scripts location

   -- define where to store the toolbar
   ToolbarURL = "private:resource/toolbar/custom_bnf4oootoolbar"

   -- get the user interface configuration
   x_MultiServiceFactory = xContext~getServiceManager~XMultiServiceFactory

   configsupplier = "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"
   x_Supplier = 
x_MultiServiceFactory~createInstance(configsupplier)~XModuleUIConfigurationManagerSupplier
   
   -- the document type this toolbar is bound to
   DocumentType = "com.sun.star.text.TextDocument"
   -- get the user interface configuration of writer
   x_UIConfigurationManager = 
x_Supplier~getUIConfigurationManager(DocumentType)

  -- define macros and sequence for toolbar
   arrMacro =.array  ~of("OOoBNF2Diagram.rex", "OOoBNF2All.rex", -
 "OOoBNF2XML.rex", "OOoXML2BNF.rex", -
 "OOoImport.rex" , "OOoExport.rex" , -
 "OptionGUI.rex" , "addBNF4OOoStyles.rex" , 
-
 "installBNF4OOo.rex")

/* *** shortcut *** */
  -- in toolbars the label text does not underline the shortcut char 
indicated with the tilde '~'
   arrMacroLabel=.array  ~of("BNF2~Diagram"   , "BNF2~All"   , -
 "BNF2~XML"   , "XML2~BNF"   , -
 "~Import", "~Export", -
 "~Options"   , "Add BNF4OOo ~Styles" ,-
 "~Uninstall BNF4OOo" )

/* *** shortcut *** */
  -- define shortcu

[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Fernand,

On 25.05.2011 09:15, Fernand Vanrie wrote:
>
> When making mi extentions i found (by accident if forgot to use ~) 
> the system (at least for menubar items) automaticly gives a underlined
> letter
thank you for that hint. Unfortunately, this does not work either.

---rony

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher

On 25.05.2011 08:35, Mathias Bauer wrote:
> On 24.05.2011 22:31, Rony G. Flatscher wrote:
>> Hi there,
>>
>> in the meantime I have been able to add shortcuts to the toolbar items
>> and they are operational. However, the shortcut letter is not
>> underlined, although using the tilde (~) before the letter to be
>> underlined in the "Label" property of the toolbar item.
>>
>> Is there a different property that I would need to use for having OOo
>> underline the shortcut-key?
>> (Again it works, using SHIFT+ALT+letter, where ALT is the META2
>> KeyModifier.)
>>
>> TIA,
>>
>> ---rony
>>
>>
>>
>
> What do you mean by "again it works, using SHIFT+ALT+LETTER" ?
Just that the defined shortcut-keys are operational. E.g. the shortcut
for the "~Import" toolbar item gets defined as SHIFT+META2+I and if you
press SHIFT+ALT+I (META2 is ALT on my Windows keyboard) the toolbar item
gets executed. It is just the case that the "I" does not get underlined
in the toolbar item (a button where the text and the assigned icon get
displayed).

For usability it would be desirable to underline the shortcut letter in
the toolbar text.

---rony
-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-24 Thread Rony G. Flatscher
Hi there,

in the meantime I have been able to add shortcuts to the toolbar items
and they are operational. However, the shortcut letter is not
underlined, although using the tilde (~) before the letter to be
underlined in the "Label" property of the toolbar item.

Is there a different property that I would need to use for having OOo
underline the shortcut-key?
(Again it works, using SHIFT+ALT+letter, where ALT is the META2
KeyModifier.)

TIA,

---rony



-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Problem with - XUIConfigurationPersistence.store()

2011-05-24 Thread Rony G. Flatscher
Hi there,

as strange as it may seem,  XUIConfigurationPersistence.store() has
started to work!
Not having the slightest idea what was wrong (maybe a "erroneous"
leftover configuration from earlier, just a pure speculation)?

---rony


On 22.05.2011 13:18, Rony G. Flatscher wrote:
> Hi there,
>
> firstly, I reported the wrong version of OOo, it is 3.2.1 (build #
> 9502), Windows XP, SP3.
>
> Compiling and running the example Java program at
> <http://java.sun.com/developer/technicalArticles/J2SE/Desktop/menus_toolbars/createMenuAndToolbar.java>
> also yields the reported error. Here is the stack trace:
>
> com.sun.star.io.IOException:
> at 
> com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:177)
> at 
> com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:143)
> at 
> com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:335)
> at 
> com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:304)
> at 
> com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:91)
> at 
> com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:639)
> at 
> com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:151)
> at 
> com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:133)
> at $Proxy12.store(Unknown Source)
> at 
> createMenuAndToolbar.createNewTopLevelMenu(createMenuAndToolbar.java:225)
> at createMenuAndToolbar.main(createMenuAndToolbar.java:72)
>   
>
> Maybe this is a known bug that was fixed with 3.3? However, I cannot
> find anything related to this in the OOo bugzilla.
>
> Any ideas, hints ?
>
> ---rony
>
>
> On 21.05.2011 20:57, Rony G. Flatscher wrote:
>> Hi there,
>>
>> in order to make a successfully created Toolbar for TextDocuments
>> persistent
>> <http://java.sun.com/developer/technicalArticles/J2SE/Desktop/menus_toolbars/>
>> hints at using the 
>> interface's "store()" method.
>>
>> Invoking the store() method unfortunately yields an exception
>> "com.sun.star.ui.XUIConfigurationPersistence".
>>
>> This is running OOo 3.3 for Windows under XP:
>>
>> * the program uses a bootstrap supplied XContext to query the
>>   ServiceManager and its XMultiServiceFactory interface to create
>>   a "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"
>> * then the "XModuleUIConfigurationManagerSupplier" interface gets
>>   queried,
>> * then the method
>>   "getUIConfigurationManager("com.sun.star.text.TextDocument")"
>>   is successfully carried out
>> * this is then used to run the method "createSettings()", which
>>   then is used to add all toolbar items that get defined.
>>
>> Everything works (the toolbar is shown in swriter components and is
>> operational), however the defined toolbar vanishes after OOo gets
>> closed and reopened. Therefore the need for making this definition
>> persistent.
>>
>> Using the UIConfigurationManager's "getUIConfigurationManager"
>> interface and invoking the "store()" method throws that
>> "com.sun.star.io.IOException: ]" exception.
>>
>> This is using the Java APIs of OOo from a commandline program.
>>
>> ---
>>
>> Would anyone have any ideas what the cause of this may be? What could
>> I try/do ?
>>
>> TIA,
>>
>> ---rony

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Problem with - XUIConfigurationPersistence.store()

2011-05-22 Thread Rony G. Flatscher
Hi there,

firstly, I reported the wrong version of OOo, it is 3.2.1 (build #
9502), Windows XP, SP3.

Compiling and running the example Java program at
<http://java.sun.com/developer/technicalArticles/J2SE/Desktop/menus_toolbars/createMenuAndToolbar.java>
also yields the reported error. Here is the stack trace:

com.sun.star.io.IOException:
at 
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:177)
at 
com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:143)
at 
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:335)
at 
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:304)
at 
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:91)
at 
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:639)
at 
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:151)
at 
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:133)
at $Proxy12.store(Unknown Source)
at 
createMenuAndToolbar.createNewTopLevelMenu(createMenuAndToolbar.java:225)
at createMenuAndToolbar.main(createMenuAndToolbar.java:72)
  

Maybe this is a known bug that was fixed with 3.3? However, I cannot
find anything related to this in the OOo bugzilla.

Any ideas, hints ?

---rony


On 21.05.2011 20:57, Rony G. Flatscher wrote:
> Hi there,
>
> in order to make a successfully created Toolbar for TextDocuments
> persistent
> <http://java.sun.com/developer/technicalArticles/J2SE/Desktop/menus_toolbars/>
> hints at using the 
> interface's "store()" method.
>
> Invoking the store() method unfortunately yields an exception
> "com.sun.star.ui.XUIConfigurationPersistence".
>
> This is running OOo 3.3 for Windows under XP:
>
> * the program uses a bootstrap supplied XContext to query the
>   ServiceManager and its XMultiServiceFactory interface to create
>   a "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"
> * then the "XModuleUIConfigurationManagerSupplier" interface gets
>   queried,
> * then the method
>   "getUIConfigurationManager("com.sun.star.text.TextDocument")" is
>   successfully carried out
> * this is then used to run the method "createSettings()", which
>   then is used to add all toolbar items that get defined.
>
> Everything works (the toolbar is shown in swriter components and is
> operational), however the defined toolbar vanishes after OOo gets
> closed and reopened. Therefore the need for making this definition
> persistent.
>
> Using the UIConfigurationManager's "getUIConfigurationManager"
> interface and invoking the "store()" method throws that
> "com.sun.star.io.IOException: ]" exception.
>
> This is using the Java APIs of OOo from a commandline program.
>
> ---
>
> Would anyone have any ideas what the cause of this may be? What could
> I try/do ?
>
> TIA,
>
> ---rony
>

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Problem with - XUIConfigurationPersistence.store()

2011-05-21 Thread Rony G. Flatscher
Hi there,

in order to make a successfully created Toolbar for TextDocuments
persistent

hints at using the 
interface's "store()" method.

Invoking the store() method unfortunately yields an exception
"com.sun.star.ui.XUIConfigurationPersistence".

This is running OOo 3.3 for Windows under XP:

* the program uses a bootstrap supplied XContext to query the
  ServiceManager and its XMultiServiceFactory interface to create a
  "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"
* then the "XModuleUIConfigurationManagerSupplier" interface gets
  queried,
* then the method
  "getUIConfigurationManager("com.sun.star.text.TextDocument")" is
  successfully carried out
* this is then used to run the method "createSettings()", which then
  is used to add all toolbar items that get defined.

Everything works (the toolbar is shown in swriter components and is
operational), however the defined toolbar vanishes after OOo gets closed
and reopened. Therefore the need for making this definition persistent.

Using the UIConfigurationManager's "getUIConfigurationManager" interface
and invoking the "store()" method throws that
"com.sun.star.io.IOException: ]" exception.

This is using the Java APIs of OOo from a commandline program.

---

Would anyone have any ideas what the cause of this may be? What could I
try/do ?

TIA,

---rony

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


Re: [api-dev] LO removing Java, why would they want to? (Re: [api-dev] Java-Midi not working on Mac?

2010-12-24 Thread Rony G. Flatscher
On 24.12.2010 11:20, Konstantin Tokarev wrote:
>> That's the point: not all of OOo is written in C++ anymore, there are
>> quite important subsystems written in Java.
>>
>> One premiere example is the scripting subsystem, which makes JavaScript,
>> BeanShell, ooRexx and others available to OOo. Removing Java removes all
>> these options and renders programs written in these languages useless.
>>
>> Another premiere example is the Java-API-interface to the entire OOo.
>> Removing Java removes the ability to use OOo from Java and to deploy all
>> Java applications that use OOo.
>>
>> Therefore the conclusion, that removing Java from OOo yields OOo to be
>> badly crippled.
>>
>> 
> So people who need these features won't use LO. Where is the problem?
>   
There is no problem, unless the LO people found a problem in the Java
support for OOo and are therefore removing it in their distribution. And
if that is the case I would like to know the reasons. Currently it seems
that there are no technical reasons for this move/decision.

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] LO removing Java, why would they want to? (Re: [api-dev] Java-Midi not working on Mac?

2010-12-24 Thread Rony G. Flatscher

On 23.12.2010 17:49, Jan Holst Jensen wrote:
> On 2010-12-23 17:30, Rony G. Flatscher wrote:
>> On 22.12.2010 19:13, Jürgen Schmidt wrote:
>>> On 12/22/10 6:03 PM, Martin Dobiasch wrote:
>>>
>> ... cut ...
>>>> Its installed as I've tested some other code on that Mac using the
>>>> Midi API
>>>> of Sun-Java. For example the same extension works for NeoOffice.
>>>> Do you know where in the code I can find the java implementation?
>>>> Maybe I
>>>> can dig into it and compare Libre/Open-Office with NeoOffice
>>>>
>>> The UI of NeoOffice is completely Java based i assume they run
>>> native 64
>>> bit. Anyway you can't simply compare NeoOffice with OpenOffice.org
>>> here.
>>>
>>> Don't expect a fix form LibO they work more in the direction to remove
>>> Java completely ;-)
>>>
>> Why would they want to cripple OOo that badly ?
>>
>> Do you happen to know the rationale by any chance?
>> Maybe the question rephrased to make it more on-track: would there be a
>> problem with Java in OOo, such that removing Java would solve a problem?
>> And if so, what would it be?
>
> Most of OOo is written in C++ so it won't be badly crippled if Java is
> removed from the product. I have used OOo without Java on a machine
> and almost all of OOo works just fine without Java.
That's the point: not all of OOo is written in C++ anymore, there are
quite important subsystems written in Java.

One premiere example is the scripting subsystem, which makes JavaScript,
BeanShell, ooRexx and others available to OOo. Removing Java removes all
these options and renders programs written in these languages useless.

Another premiere example is the Java-API-interface to the entire OOo.
Removing Java removes the ability to use OOo from Java and to deploy all
Java applications that use OOo.

Therefore the conclusion, that removing Java from OOo yields OOo to be
badly crippled.

> As far as I can understand LibreOffice is just trying to minimize the
> _dependency_ on Java. Developers will still be able to write
> extensions in Java but the core (of LibreOffice) won't ideally require
> a Java runtime anymore. 
It removes the ability for Java programmers to use LO and it removes the
ability to script LO with the scripting languages added since OOo 2.0.

> As for the reasons: It would potentially minimize memory usage and
> some are probably concerned about the Oracle <> Google debacle:
>
> http://www.mail-archive.com/discuss@documentfoundation.org/msg02492.html
> http://www.mail-archive.com/discuss@documentfoundation.org/msg02612.html
I cannot see why this has anything to do with LO.

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] LO removing Java, why would they want to? (Re: [api-dev] Java-Midi not working on Mac?

2010-12-23 Thread Rony G. Flatscher

On 22.12.2010 19:13, Jürgen Schmidt wrote:
> On 12/22/10 6:03 PM, Martin Dobiasch wrote:
>   
... cut ...
>> Its installed as I've tested some other code on that Mac using the
>> Midi API
>> of Sun-Java. For example the same extension works for NeoOffice.
>> Do you know where in the code I can find the java implementation? Maybe I
>> can dig into it and compare Libre/Open-Office with NeoOffice
>> 
> The UI of NeoOffice is completely Java based i assume they run native 64
> bit. Anyway you can't simply compare NeoOffice with OpenOffice.org here.
>
> Don't expect a fix form LibO they work more in the direction to remove
> Java completely ;-)
>   
Why would they want to cripple OOo that badly ?

Do you happen to know the rationale by any chance?
Maybe the question rephrased to make it more on-track: would there be a
problem with Java in OOo, such that removing Java would solve a problem?
And if so, what would it be?

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Enhancing StarBasic then ? (Re: [api-dev] use of css.container.EnumerableMap

2010-12-23 Thread Rony G. Flatscher

On 22.12.2010 17:56, Paolo Mantovani wrote:
>
> Il 21/12/2010 10:25, Frank Schönheit ha scritto:
> [...]
>> as I was the one who wrote this service (out of a particular need):
>> Sorry, I wasn't aware that Type is such a ... difficult thing in Basic.
>> I'll keep that in mind for the next API I design :-\
>
> Thank you, this is great!
>
> In any case, I think that this kind of situation will be repeated in
> the future.
>
> The fact is that the usability and compatibility with StarBasic or
> other scripting languages is not a requirement for new API. (AFAIK)
If that is true, it is shooting in oneselves foot!
:(

So is that really true?
(It should be a *must* that non-OOo-core-developers are able to easily
create scripts and macros for remote-controlling an OOo installation!)

---

What about enhancing StarBasic then which would allow it to be fully
able to exploit any of the OOo services, no matter whether they are old
or newly developped services ?

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] API documentation and improving interactivity

2010-09-10 Thread Rony G. Flatscher
Alexandro,

you may want to look into
, once the
slides are made available online by Peter (he has been doing a lot of
work and needs probably more time to process all of the slides of the
numerous presentations at this year's OOoCon, all in all, an incredible
time-consuming task).

"UNO API Info" is a tool that allows to gain documentation on the fly
from any OOo programming language by either supplying the name of an IDL
type (the fully qualified name e.g. of a service, an interface, a
constant group, etc.) or by supplying any UNO object which then gets
documented using reflection (which programmatically can be very
challenging as you write yourself).

The result is a writer/pdf document that has all the information
formatted in a nice manner (members sorted by name, members sorted by
type and name, constants sorted by name, depicting their values,
properties sorted by name giving their type and attributes like
maybevoid and the like, etc.) and also linked directly to the OOo
documentation on the web. This way one can get an overview of all the
functionality that is available, and for further documentation you just
follow the links of those types/members that you are interested in.

Finally, one can also have not only a single IDL service, interface or
single UNO object documented, but also the members they contain ("layer:
2").

If you point your browser to
, then you'll
get to see example PDFs that got generated on the fly by supplying the
UNO object representing a writer object (which interestingly implements
more than one service). This is a somewhat extreme example, which also
demonstrates how much functionality is at the hands of a programmer of
the writer component. However, it also demonstrates how documentation
can be devised that lets one see the forest (instead of the many trees
making up the forest) too.

At this OOoCon I also presented this live, demonstrating how to use this
facility among other languages from JavaScript and Python.

There is a readme/documentation of the tool at
,
which documents this utility (including code to demonstrate how to use
it from Basic, Java, ooRexx as well).

The tool is not meant as a replacement for XRay and relatives, but as an
additional means of on-the-fly-documentation generation with overview
character to help the programmers mastering their challenging work.

If you (or anyone else) have (has) any questions/comments regarding this
tool, then please just post them via this list.

HTH,

---rony



On 10.09.2010 16:19, Alexandro Colorado wrote:
> 2010/9/6 Jürgen Schmidt 
>
>   
>> Hi Alexandro,
>>
>> thanks for picking up this topic immediately.
>>
>> Whatever we think will be an appropriate solution to provide an easier way
>> how users can give feedback. I would suggest that we create a tool that use
>> the input from the IDLs (the generated type library) as input and produce
>> based on this info whatever is necessary.
>>
>> 
> Do we have this tool already? How does the current documentation gets form?
> AFAIK the UNO interface is atomic and this will provide far too many items.
>
>
>   
>> Follow up please only on one list -> dev@api.openoffice.org
>>
>> Juergen
>>
>>
>>
>> On 9/5/10 10:37 AM, Alexandro Colorado wrote:
>>
>> 
>>> Hi during OOoCon a conversation started about the lack of examples on the
>>> API documentation as far as contributions goes. Basically there are
>>> several
>>> places where to go to:
>>> - API Documentation
>>> - CodeSnippets
>>> - Developer Guide
>>> - OOo Wiki
>>>
>>> The main issue is that users and readers have low accessibility to
>>> introduce
>>> examples or comments on the documentation. There have been some possible
>>> solutions discussed:
>>> - Move the API Docs to the Wiki
>>> - Version the API Docs depending on the OOo version
>>> - Close codeSnippets or move it to a technology that allow users to just
>>> paste snippets directly on the site
>>>
>>> As always the issue becomes lack of resources, time and information. My
>>> feeling is that if we air this topic with possible solutions would help us
>>> find better solutions. I do have a small script that allow me to clean off
>>> the documentation from the collabnet HTML and just isolate the HTML
>>> snippet.
>>> My next step could be to find a converter from HTML to a wikilang that
>>> allow
>>> us to easy publish it on the wiki and publish it on the wiki as a service
>>> (batch upload).
>>>
>>> Help is welcomed.
>>>   


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Announcement: "IDL-XML-Converter - A Package for Transforming IDL into XML" available ...

2010-07-29 Thread Rony G. Flatscher
Hi there,

today a student, Lukas Schreier, turned in his final version of a
seminar paper about "IDL-XML-Converter - A Package for Transforming IDL
into XML". Here's the author's abstract:

Author's abstract:

The IDL-XML-Converter-Package is used to convert IDL to XML files.
Those XML files can then be used to write an appropriate
OpenOffice-Registry.

The package includes the following functions:

* Converting IDL-files into XML files,
* Converting XML files into an OpenOffice-Registry format,
* Converting OpenOffice-Registries into XML files,
* Merging two OpenOffice-Registries.

The content of the package consists of six Java programs, which are
published under the LGPLv3- license.

|idl2xml.jar|
This program converts an existing OpenOffice.org IDL file into
an XML file. 
|XMLReg.jar|
Writes an XML file which contains OpenOffice IDL-types into an
OpenOffice-Registry file. 
|RegXML.jar|
Extracts a given OpenOffice-Registry key into an XML file. 
|RegMerge.jar|
Merges two specified OpenOffice-Registries into one. 

The paper (in PDF), which documents the registry and the Java-based
classes and the DTD that he developed for transforming IDL into XML,
registry into XML, XML into registry, and merging registries can be
fournd with its accompanying materials (source code, jars, examples)
here: .

---rony



Re: [api-dev] Questions ad XPrintable.print(properties) ...

2010-07-15 Thread Rony G. Flatscher
Hi Mathias,

thank you for your comments!

Please see inline comments.


On 15.07.2010 09:40, Mathias Bauer wrote:
> On 14.07.2010 11:37, Rony G. Flatscher wrote:
>> Hi there,
>>
>> so far I have been under the assumptions that the list of properties
>> that one is able to supply to the XPrintable.print(...) method matches
>> the options that can be given in the GUI of the respective component
>> type. This way each document type would have a common set of properties,
>> but also additional print properties it would honor. Then, that's what I
>> was expecting, the task would be to find the documentation of the print
>> properties of the respective document type.
>>
>> Now, trying to print a presentation and taking advantage of its GUI
>> defined print properties programmatically (i.e. print the presentation
>> in form of handouts, where each page would depict a programmatically
>> defined number of slides per printed page)  seems to not be possible. At
>> least I cannot find any documentation or working examples for this.
>>
>> So, two questions:
>>
>>  * Is it intended that the print properties for
>> XPrintable.print(...)
>>allow for defining all print options that the document type's GUI
>>allows for?
>
> There are two different kinds of such properties - the print options
> (those are passe to the "print" call) and the print settings (that are
> general printer options set with a "setPrinter" call). The generic
> services are defined in the css.view package.
>
> At least that was the plan. Reality obviously is different.

It still would help *tremendeously* everyone else in the world who is
not acquainted with the gory details of OOo programming, if this simple
rule would be at least implemented now for every document/component type.

Currently, printing is much more too effortful than really necessary,
besides, there are document types which seem to be impossible to be
addressed by customers of the UNO APIs as they lack the knowledge (and
also the documentation!) that the core OOo developers have at their command.


> To my knowledge none of our applications have own print options
> (though the API would allow to treat it as you described it). At least
> there is no documentation for additional print options, so basically
> they don't exist. ;-)
>
> Writer has its own PrintSettings Service (css.text.PrintSettings)
> defined, but I failed to find comparable service definitions for the
> other applications.
That's a very interesting information, thank you very much !

>>(simpress components) such, that one can programmatically print
>>handouts with multiple slides per printed page?
>  * How can one exploit the GUI print options for presentations
>
> It seems that the Impress developers didn't implement that. I also
> couldn't find a setPrinter() implementation in Writer, though - as
> mentioned above - there is a service definition for PrinterSettings in
> the css.text IDL.
>
> It seems that printer settings are set through the DocumentSettings
> services of the applications. I discovered the text PrinterSettings
> properties in the css.text.DocumentSettings and, amongst others, a
> "IsPrintHandout" property in the css.presentation.DocumentSettings.
Yes, Ariel Constenla-Haile was kind enough to share his findings in
<http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=22705> (start
of the thread:
<http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=22704>). As a
result I have experimented more than an hour with all kind of
properties, but have not been able to become successful!
:(

Again, any ideas, hints, docs howto print impress docuemnts as handouts
with multiple slides per page would be very welcome!

Regards,

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Questions ad XPrintable.print(properties) ...

2010-07-14 Thread Rony G. Flatscher
Hi there,

so far I have been under the assumptions that the list of properties
that one is able to supply to the XPrintable.print(...) method matches
the options that can be given in the GUI of the respective component
type. This way each document type would have a common set of properties,
but also additional print properties it would honor. Then, that's what I
was expecting, the task would be to find the documentation of the print
properties of the respective document type.

Now, trying to print a presentation and taking advantage of its GUI
defined print properties programmatically (i.e. print the presentation
in form of handouts, where each page would depict a programmatically
defined number of slides per printed page)  seems to not be possible. At
least I cannot find any documentation or working examples for this.

So, two questions:

* Is it intended that the print properties for XPrintable.print(...)
  allow for defining all print options that the document type's GUI
  allows for?
* How can one exploit the GUI print options for presentations
  (simpress components) such, that one can programmatically print
  handouts with multiple slides per printed page?

---rony





Re: [api-dev] simpress: printing handouts programmatically, howto?

2010-07-13 Thread Rony G. Flatscher
Upon further inspection, the following docuemnt.Settings are in effect
*after* printing:

ApplyUserData: [1]
BitmapTableURL:

[file:///D:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/OpenOffice.org/3/user/config/standard.sob]
CharacterCompressionType: [0]
ColorTableURL:

[file:///D:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/OpenOffice.org/3/user/config/standard.soc]
DashTableURL:

[file:///D:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/OpenOffice.org/3/user/config/standard.sod]
DefaultTabStop: [1250]
ForbiddenCharacters: [com.sun.star.uno@cfec48]
GradientTableURL:

[file:///D:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/OpenOffice.org/3/user/config/standard.sog]
HandoutsHorizontal: [1]
HatchTableURL:

[file:///D:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/OpenOffice.org/3/user/config/standard.soh]
IsKernAsianPunctuation: [0]
IsPrintBooklet: [0]
IsPrintBookletBack: [1]
IsPrintBookletFront: [1]
IsPrintDate: [0]
IsPrintDrawing: [1]
*IsPrintFitPage: [1]*
*IsPrintHandout: [0]*
IsPrintHiddenPages: [1]
IsPrintNotes: [0]
IsPrintOutline: [0]
IsPrintPageName: [0]
IsPrintTilePage: [0]
IsPrintTime: [0]
LineEndTableURL:

[file:///D:/Dokumente%20und%20Einstellungen/Administrator/Anwendungsdaten/OpenOffice.org/3/user/config/standard.soe]
LoadReadonly: [0]
PageNumberFormat: [4]
ParagraphSummation: [0]
PrintQuality: [0]
PrinterIndependentLayout: [2]
PrinterName: [Adobe PDF]
PrinterSetup: [...@e80842]
SaveVersionOnClose: [0]
SlidesPerHandout: [6]
UpdateFromTemplate: [1]

Immediately before printing a getPropertyValue(IsPrintHandout) returns
true (1), after printing it returns false (0). The property
"IsPrintFitPage" is set to false before printing, and to true afterards.

So in the process of executing XPrintable.print(props) the properties
"IsPrintFitPage" and "IsPrintHandout" get set to their opposite boolean
value.

---rony


On 13.07.2010 23:43, Rony G. Flatscher wrote:
> Hi Ariel,
>
> On 13.07.2010 22:19, Ariel Constenla-Haile wrote:
>   
>> Hello Rony,
>>
>> On Tuesday 13 July 2010, 14:52, Rony G. Flatscher wrote:
>>   
>> 
>>> The script that I have been trying to tidy up already opened
>>> (loadComponentFromurl) the impress component with a PropertyValue of
>>> ("IsPrintHandout", true), which had no visual effect on the displayed
>>> document.
>>> 
>>>   
>> you were in the wrong way: these settings are not in the document's main 
>> settings (querying css.beans.XPropertySet on the document's model), not in 
>> the 
>> printer settings, not in the MediaDescriptor when loading the document.
>>
>> As explained in 
>> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Settings
>> you must instantiate the com.sun.star.document.Settings at the document's 
>> factory.
>>   
>> 
> Totally overlooked that one!
>
> And thanks to your nice example I was able to duplicate your code into
> my sample, thank you *very much* again! Incredible, how you researched
> and were able to come up with an example demonstrating the necessary
> code to define and set those properties!
>
> Unfortunately, in the end I was not able to achieve the desired result:
> printing a presentation as handouts and having six slides on one page.
> It stiill prints each slide in full on each page...
> :(
>
> Regards,
>
> ---rony
>   



Re: [api-dev] simpress: printing handouts programmatically, howto?

2010-07-13 Thread Rony G. Flatscher
Hi Ariel,

On 13.07.2010 22:19, Ariel Constenla-Haile wrote:
> Hello Rony,
>
> On Tuesday 13 July 2010, 14:52, Rony G. Flatscher wrote:
>   
>> The script that I have been trying to tidy up already opened
>> (loadComponentFromurl) the impress component with a PropertyValue of
>> ("IsPrintHandout", true), which had no visual effect on the displayed
>> document.
>> 
> you were in the wrong way: these settings are not in the document's main 
> settings (querying css.beans.XPropertySet on the document's model), not in 
> the 
> printer settings, not in the MediaDescriptor when loading the document.
>
> As explained in 
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Settings
> you must instantiate the com.sun.star.document.Settings at the document's 
> factory.
>   
Totally overlooked that one!

And thanks to your nice example I was able to duplicate your code into
my sample, thank you *very much* again! Incredible, how you researched
and were able to come up with an example demonstrating the necessary
code to define and set those properties!

Unfortunately, in the end I was not able to achieve the desired result:
printing a presentation as handouts and having six slides on one page.
It stiill prints each slide in full on each page...
:(

Regards,

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] simpress: printing handouts programmatically, howto ?

2010-07-13 Thread Rony G. Flatscher
In the meantime I checked the impress document, whether it has the
optional DocumentSetting named "IsPrintHandout", which it has not.

Here's a list of available properties on the impress component,
iterating over xProps.getPropertySetInfo().getProperties():

TabStop: [1250]
BuildId: [320$9502]
RuntimeUID: [45]
MapUnit: [0]
CharLocale: [com.sun.star.lang.loc...@b1c5fa]
BasicLibraries: [com.sun.star.uno@efd552]
ForbiddenCharacters: [com.sun.star.uno@1abab88]
AutomaticControlFocus: [0]
ApplyFormDesignMode: [0]
VisibleArea: [com.sun.star.awt.rectan...@18a7efd]
DialogLibraries: [com.sun.star.uno@1971afc]
HasValidSignatures: [0]

So supplying the property value "IsPrintHandout" to the
loadComponentFromURL() won't be honored, but also does not throw an
exception.

Again, trying to programmatically print a presentation as a handout with
two slides per handout page.

---rony



On 13.07.2010 19:52, Rony G. Flatscher wrote:
> Hello Ariel,
>
> On 13.07.2010 19:25, Ariel Constenla-Haile wrote:
>   
>> Hello Rony,
>>
>> On Tuesday 13 July 2010, 13:35, Rony G. Flatscher wrote:
>>   
>> 
>>> Having an impress document, I would like to programmatically print out a
>>> presentation in form of handouts, with e.g. 2 slides per page. Tried the
>>> English print-dialog names as print options, but to no avail.
>>>
>>> How can one achieve that programmatically, what steps are needed, what
>>> PropertyValue can be supplied to control that ?
>>> 
>>>   
>> not sure if this helps, but 
>> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Printing_Drawing_Documents#Special_Print_Settings
>>  
>> says
>>
>> "The printed drawing view (drawings, notes, handout pages, outline), the 
>> print 
>> quality (color, grayscale), the page options (tile, fit to page, brochure, 
>> paper tray) and additional options (page name, date, time, hidden pages) can 
>> all be controlled. Settings describes how these settings are used."
>>
>> where "Settings" is 
>> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Settings
>>
>> it looks like printing handouts is a property of the document's settings.
>> Look at the second table on that wiki page, which resumes 
>> http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/DocumentSettings.html
>>   
>> 
> Thank you very much for your hints!
>
> The script that I have been trying to tidy up already opened
> (loadComponentFromurl) the impress component with a PropertyValue of
> ("IsPrintHandout", true), which had no visual effect on the displayed
> document.
>
> When printing that impress component I supplied PropertyValues to
> XPrintable.print() like
>
> * ("IsPrintHandout", true) and
> * ("SlidesPerPage" | "SlidesPerHandout",  2), where "2" was supplied
>   as a String and then as a Short to no avail.
>
> If any of these PropertyValues were illegal, I cannot tell as no
> exception got thrown. All in all I permutated quite some time (and tried
> to google something related to this) in vain, before I turned to the list.
>
> It is like a little (?) puzzle...
> :)
>
> Again, thank you for your hints! (If you had any other ideas please let
> me know.)
>
> ---rony



Re: [api-dev] simpress: printing handouts programmatically, howto ?

2010-07-13 Thread Rony G. Flatscher
Hello Ariel,

On 13.07.2010 19:25, Ariel Constenla-Haile wrote:
> Hello Rony,
>
> On Tuesday 13 July 2010, 13:35, Rony G. Flatscher wrote:
>   
>> Having an impress document, I would like to programmatically print out a
>> presentation in form of handouts, with e.g. 2 slides per page. Tried the
>> English print-dialog names as print options, but to no avail.
>>
>> How can one achieve that programmatically, what steps are needed, what
>> PropertyValue can be supplied to control that ?
>> 
> not sure if this helps, but 
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Printing_Drawing_Documents#Special_Print_Settings
>  
> says
>
> "The printed drawing view (drawings, notes, handout pages, outline), the 
> print 
> quality (color, grayscale), the page options (tile, fit to page, brochure, 
> paper tray) and additional options (page name, date, time, hidden pages) can 
> all be controlled. Settings describes how these settings are used."
>
> where "Settings" is 
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Settings
>
> it looks like printing handouts is a property of the document's settings.
> Look at the second table on that wiki page, which resumes 
> http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/DocumentSettings.html
>   
Thank you very much for your hints!

The script that I have been trying to tidy up already opened
(loadComponentFromurl) the impress component with a PropertyValue of
("IsPrintHandout", true), which had no visual effect on the displayed
document.

When printing that impress component I supplied PropertyValues to
XPrintable.print() like

* ("IsPrintHandout", true) and
* ("SlidesPerPage" | "SlidesPerHandout",  2), where "2" was supplied
  as a String and then as a Short to no avail.

If any of these PropertyValues were illegal, I cannot tell as no
exception got thrown. All in all I permutated quite some time (and tried
to google something related to this) in vain, before I turned to the list.

It is like a little (?) puzzle...
:)

Again, thank you for your hints! (If you had any other ideas please let
me know.)

---rony



[api-dev] simpress: printing handouts programmatically, howto ?

2010-07-13 Thread Rony G. Flatscher
Having an impress document, I would like to programmatically print out a
presentation in form of handouts, with e.g. 2 slides per page. Tried the
English print-dialog names as print options, but to no avail.

How can one achieve that programmatically, what steps are needed, what
PropertyValue can be supplied to control that ?

TIA,

---rony

P.S.: Unfortunately, the impress component has no XPagePrintable
interface defined, which one could use instead to mimick the handout
printings with mulitple slides per page.

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Maybe a stupid question w.r.t. XPrintable

2010-07-13 Thread Rony G. Flatscher
Hi Fernand,
> i use for years a  routine for printing maybe it can help ?
thank you very much for your hint!

In the meantime I stumbled over the PrintOptions "Wait" (I see you are
employing it as well), which prints synchroneously. So possibly, you do
not have to check for the property "Busy" in your code, if the property
"Wait" got set to true?

Regards,

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Maybe a stupid question w.r.t. XPrintable

2010-07-13 Thread Rony G. Flatscher
O.K. it seems that one needs to synchroneously print the documents in
the same thread.

Found the PrintOptions "Wait" property, which one needs to set to true,
alleviating one from the need of registering and processing a
XPrintJobListener. Also cf.
<http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Printing_Drawing_Documents>.

---rony


On 13.07.2010 16:57, Rony G. Flatscher wrote:
> Maybe this is a stupid question w.r.t. XPrintable:
>
> * If one wishes to print three different documents within the same
>   thread using their respecitve XPrintable.print(...), is it then
>   necessary to make sure that the first print job has completed,
>   before the next one starts?
>   If so, then probably using the
>   com.sun.star.view.XPrintJobBroadcaster interface's
>   addPrintJobListener(XPrintJobListener) needs to be used. Now,
>   which enum value of PrintableState indicates, that it is o.k. to
>   a) dispose of the printed document and b) start to print the next
>   document: JOB_COMPLETED or JOB_SPOOLED? (Besides the states that
>   indicate abnormal states like JOB_ABORTED etc.) 
>
> TIA,
>
> ---rony
>
> P.S.: Would the printing make any difference if all documents to be
> printed are hidden?
>   


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Maybe a stupid question w.r.t. XPrintable

2010-07-13 Thread Rony G. Flatscher
Maybe this is a stupid question w.r.t. XPrintable:

* If one wishes to print three different documents within the same
  thread using their respecitve XPrintable.print(...), is it then
  necessary to make sure that the first print job has completed,
  before the next one starts?
  If so, then probably using the
  com.sun.star.view.XPrintJobBroadcaster interface's
  addPrintJobListener(XPrintJobListener) needs to be used. Now,
  which enum value of PrintableState indicates, that it is o.k. to
  a) dispose of the printed document and b) start to print the next
  document: JOB_COMPLETED or JOB_SPOOLED? (Besides the states that
  indicate abnormal states like JOB_ABORTED etc.) 

TIA,

---rony

P.S.: Would the printing make any difference if all documents to be
printed are hidden?



Re: [api-dev] Problem using XPropertySet.setPropertyValue() with an "EllipsesShape" for properties of UNO type "long", when supplying a String object instead

2010-07-12 Thread Rony G. Flatscher

On 12.07.2010 09:14, Stephan Bergmann wrote:
> Yes, it is most likely the specific UNO object implementation that
> causes the problems you describe, not the UNO infrastructure.  You
> need to look up the implementation of that EllipsesShape to find out.
Thank you for clarifying, Stephan. Will file an issue (also
RectangleShape seems to behave like EllipsesShape).

---rony

>
> On 07/11/10 16:24, Rony G. Flatscher wrote:
>> Hi there,
>>
>> just stumbled over the
>> "http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/ConnectorShape";
>>
>> service, which has two UNO long (i.e. java.lang.Integer) properties,
>> named "StartGluePointIndex" and "EndGluePointIndex". Here exceptions get
>> thrown, if one supplies a String object (with the numbers, "2" and "4").
>> Could it therfore be, that "EllipsesShape" is at fault?
>>
>> ---rony
>>
>>
>>
>> On 11.07.2010 15:49, Rony G. Flatscher wrote:
>>> Hi there,
>>>
>>> while tidying up some nutshells, I ran into the following problem:
>>>
>>>  * setting a PropertyValue to a value with a wrong data type will
>>>correctly cause an exception;
>>>o the Java exception handler will look up the correct
>>> property
>>>  data type and will then set the property to the new value
>>>  using the correct datatype (which fine).
>>>  * however, setting the two properties "CircleStartAngle" and
>>>"CircleEndAngle" via Java supplying a String object
>>> containing all
>>>decimal numbers, does not throw an exception, therefore the
>>>exception handler does not get triggered and is not able to
>>> render
>>>the value to the correct type (in this case to a type of
>>>java.lang.Integer)!
>>>The old value remains unchanged, if a string value is supplied!
>>>
>>> The used infrastructure (Java based) is dependent on receiving an
>>> exception, if the wrong datatype was assumed (defaulting to a String
>>> object value). The properties in question are "CircleStartAngle" and
>>> "CircleEndAngle" which both are defined to be of UNO type "long" (cf.
>>> <http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/EllipseShape>).
>>>
>>>
>>>
>>> Any ideas what might cause this rather strange behaviour?
>>>
>>> ---rony
>>>
>>> P.S.: Setting the mentioned property values explicitly as
>>> java.lang.Integer values works as expected.


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Problem using XPropertySet.setPropertyValue() with an "EllipsesShape" for properties of UNO type "long", when supplying a String object instead

2010-07-11 Thread Rony G. Flatscher
Hi there,

just stumbled over the
"http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/ConnectorShape";
service, which has two UNO long (i.e. java.lang.Integer) properties,
named "StartGluePointIndex" and "EndGluePointIndex". Here exceptions get
thrown, if one supplies a String object (with the numbers, "2" and "4").
Could it therfore be, that "EllipsesShape" is at fault?

---rony



On 11.07.2010 15:49, Rony G. Flatscher wrote:
> Hi there,
>
> while tidying up some nutshells, I ran into the following problem:
>
> * setting a PropertyValue to a value with a wrong data type will
>   correctly cause an exception;
>   o the Java exception handler will look up the correct property
> data type and will then set the property to the new value
> using the correct datatype (which fine).
> * however, setting the two properties "CircleStartAngle" and
>   "CircleEndAngle" via Java supplying a String object containing all
>   decimal numbers, does not throw an exception, therefore the
>   exception handler does not get triggered and is not able to render
>   the value to the correct type (in this case to a type of
>   java.lang.Integer)!
>   The old value remains unchanged, if a string value is supplied!
>
> The used infrastructure (Java based) is dependent on receiving an
> exception, if the wrong datatype was assumed (defaulting to a String
> object value). The properties in question are "CircleStartAngle" and
> "CircleEndAngle" which both are defined to be of UNO type "long" (cf.
> <http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/EllipseShape>).
>
>
> Any ideas what might cause this rather strange behaviour?
>
> ---rony
>
> P.S.: Setting the mentioned property values explicitly as
> java.lang.Integer values works as expected.
>
>   


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Problem using XPropertySet.setPropertyValue() with an "EllipsesShape" for properties of UNO type "long", when supplying a String object instead

2010-07-11 Thread Rony G. Flatscher
Hi there,

while tidying up some nutshells, I ran into the following problem:

* setting a PropertyValue to a value with a wrong data type will
  correctly cause an exception;
  o the Java exception handler will look up the correct property
data type and will then set the property to the new value
using the correct datatype (which fine).
* however, setting the two properties "CircleStartAngle" and
  "CircleEndAngle" via Java supplying a String object containing all
  decimal numbers, does not throw an exception, therefore the
  exception handler does not get triggered and is not able to render
  the value to the correct type (in this case to a type of
  java.lang.Integer)!
  The old value remains unchanged, if a string value is supplied!

The used infrastructure (Java based) is dependent on receiving an
exception, if the wrong datatype was assumed (defaulting to a String
object value). The properties in question are "CircleStartAngle" and
"CircleEndAngle" which both are defined to be of UNO type "long" (cf.
).


Any ideas what might cause this rather strange behaviour?

---rony

P.S.: Setting the mentioned property values explicitly as
java.lang.Integer values works as expected.


[api-dev] Problem using "SimpleSystemMail" in Windows XP SP3

2010-07-09 Thread Rony G. Flatscher
Hi there,

while tidying up some samples, I stumbled over a problem using
"com.sun.star.system.SimpleSystemMail" (cf.
)
to send e-mail via an installed e-mail client.

Software:

* Windows XP with SP3 [the same behaviour was reported by students
  using Vista and W7],
* OOo 3.2.1,
* Thunderbird 3.0.3.

Creating the mail using "SimpleSystemMail" and using
"sendSimpleMailMessage(mail, flag)" with a flag of value "0"
("DEFAULTS") works, but a GUI (actually the Thunderbird send message
window with everything that got set in the macro displayed correctly,
including attachments) is displayed and the user must physically send
the mail.

Now, having a macro means that one wishes to also automate the sending
process, hence the desire to use a flag of value "1"
("NO_USER_INTERFACE", cf.
)
causes an error with an error message:

"Sending of message failed. Please verify that your Mail &
Newsgroups account settings are correct and try again."

All settings seem to be correct, as the "DEFAULTS" version works flawlessly.

---

Researching this on the issue tracker did not really reveal anything
meaningful, just
 which says
"Will not be fixed.".

So I am wondering, whether I have been doing something wrong expecting
"NO_USER_INTERFACE" to work flawlessly, if "DEFAULTS" works ?

Any hints, insights highly appreciated !

---rony



Re: [api-dev] Example, snippet for creating and using an XCommandEnvironment, even better, deploying/removing packages via UNO ?

2010-03-22 Thread Rony G. Flatscher
With unopkg things become quite cumbersome. In addition, the Windows
> version does not allow redirecting stderr and stdout (intending to
> redirect stderr to nul, but leave stdout). :(
>   
Thanks to Jan Holst Jensen (on the d...@openoffice.org list):
.

---rony

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org




Re: [api-dev] Example, snippet for creating and using an XCommandEnvironment, even better, deploying/removing packages via UNO ?

2010-03-21 Thread Rony G. Flatscher
Jürgen:


On 21.03.2010 11:06, Juergen Schmidt wrote:
> On 3/20/10 10:10 PM, Rony G. Flatscher wrote:
>> Hi Ariel,
>>
>> just a little update. Your hints have helped me indeed. However, the
>> XPackageManager and related APIs are *not published*, and AFAICT for a
>> good reason, as digging out pre 2.2 code and comparing it with the
>> current set of APIs, they have changed (like an "identifier" argument
>> for removePackage as the first argument and the like).
>>
>> As I am interested in this corner because of the installation of a
>> little package, which is functional starting with OOo 2.0, I would not
>> want myself to restrict to the current set of the unpublished
>> XPackageManager+related APIs. Rather using the executable "unopkg"
>> instead.
>>
>> However, I still appreciate your help a lot (and if there is a way to
>> buy you a beer or two, then please let me know! :) ).
>
> why not simply using the unopkg command line tool to install your
> package. That will work always! The API's will probably change and
> improve over time because they are mainly intended for internal use.

with the APIs it is possible to query up-front whether an older version
of a package is installed already, and if so, remove it (intended for an
installation program, which in its course of actions will turn towards
OOo and see whether an older version got installed - by a differnt name!
- etc. - you get the idea, I am sure). Using this API just makes
querying, removing and installing just a breeze, hence the desire to
take advantage of it.

With unopkg things become quite cumbersome. In addition, the Windows
version does not allow redirecting stderr and stdout (intending to
redirect stderr to nul, but leave stdout). :(

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Example, snippet for creating and using an XCommandEnvironment, even better, deploying/removing packages via UNO ?

2010-03-20 Thread Rony G. Flatscher
Hi Ariel,

just a little update. Your hints have helped me indeed. However, the
XPackageManager and related APIs are *not published*, and AFAICT for a
good reason, as digging out pre 2.2 code and comparing it with the
current set of APIs, they have changed (like an "identifier" argument
for removePackage as the first argument and the like).

As I am interested in this corner because of the installation of a
little package, which is functional starting with OOo 2.0, I would not
want myself to restrict to the current set of the unpublished
XPackageManager+related APIs. Rather using the executable "unopkg" instead.

However, I still appreciate your help a lot (and if there is a way to
buy you a beer or two, then please let me know! :) ).

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Example, snippet for creating and using an XCommandEnvironment, even better, deploying/removing packages via UNO ?

2010-03-20 Thread Rony G. Flatscher
Dear Ariel,

thank you *very, very* much for your fast response with those excellent
pointers, especially:
> Depending on your purpose, you could try something more modest, like in
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java
>   
which fired off a few ideas and also demonstrates that it is possible to
merely intercept the XProgressHandler invocatons. From peeking into
XInteractionHandler it seems also that the handle-method can do nothing
(in my use-case - adding/removing an extension - I would not expect to
have anything to handle).

Again, thank you very much!

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Example, snippet for creating and using an XCommandEnvironment, even better, deploying/removing packages via UNO ?

2010-03-20 Thread Rony G. Flatscher
Hi there,

it may be me, but I have not found an example/explanation of how to
create and use a XCommandEnvironment.

Purpose: for an installation script, which is supposed to install/remove
a package from OOo, I would like to use
""/singletons/com.sun.star.deployment.thePackageManagerFactory"" (which
I was able to successfully exploit back in the pre 2.2 days; with OOo
2.2; my notes tell me that then an XCommandEnvironment object was
mandatory to be passed to one of the methods, such that I switched to
using the "unopkg" executable instead).

Thankful for any hints, pointers !

---rony




-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-16 Thread Rony G. Flatscher
Hi Ariel,

*very* interesting, thank you for your findings (and very impressed,
that you were able to find/spot that particular code) !

Regards

---rony


On 16.03.2010 16:28, Ariel Constenla-Haile wrote:
> Hello Rony,
>
> in the meantime I've found
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/vcl/inc/vcl/window.hxx#858
>
> //  window extents including border and decoratrion
> Rectangle   GetWindowExtentsRelative( Window *pRelativeWindow );
> // window extents of the client window, coordinates to be used in SetPosPixel
> Rectangle   GetClientWindowExtentsRelative( Window *pRelativeWindow );
>
>
> On Monday 15 March 2010, 16:21, Rony G. Flatscher wrote:
>   
>> just a pointer, having gone through the Javadocs over the weekend: if
>> creating an instance of javax.swing.JFrame and pack it, one can use the
>> getInsets() method to retrieve an Inset object which has the
>> members/fields left, top, right, bottom, giving the respecitve insets.
>>
>> Now if you want to adjust the OOo document's XFrame's containerWindow
>> posSize to include the Window decoration (borders and title bar), you
>> would have to do something like:
>>
>> posSize~x  -= insets~left
>> posSize~Y  -= insets~top
>> posSize~width  += insets~left + insets~right
>> posSize~height += insets~top  + insets~bottom
>> 
> much like 
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/vcl/source/window/window.cxx#7468
>
> I'll try to wrap this in a css::awt::XWindow3 [my god, what awfulness!] API 
> and test how it works (indeed quite easy task, no rocket science).
>
> It's "interesting" to see that some developer needed such a thing (and other 
> missing features in OOo API), but instead of improving the API he designed 
> something ad hoc; that in fact does not work for your use case, because it 
> checks you pass a valid parent window, and top windows have no parent:
>
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/sd/source/ui/presenter/PresenterHelper.cxx#325
>
> Regards
>   


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-15 Thread Rony G. Flatscher
Hi there,

just a pointer, having gone through the Javadocs over the weekend: if
creating an instance of javax.swing.JFrame and pack it, one can use the
getInsets() method to retrieve an Inset object which has the
members/fields left, top, right, bottom, giving the respecitve insets.

Now if you want to adjust the OOo document's XFrame's containerWindow
posSize to include the Window decoration (borders and title bar), you
would have to do something like:

posSize~x  -= insets~left
posSize~Y  -= insets~top
posSize~width  += insets~left + insets~right
posSize~height += insets~top  + insets~bottom

HTH,

---rony


On 04.03.2010 02:38, Ariel Constenla-Haile wrote:
> Hello Rony,
>
> On Wednesday 03 March 2010, 14:16, Rony G. Flatscher wrote:
>   
>> 
>>> You could file a RFE to enhance the com.sun.star.awt.XTopWindow (haha now
>>> I see someone [fs in dba33a?] added a com.sun.star.awt.XTopWindow2).
>>>   
>> But that one seems not to be available (it cannot be interrogated via
>> reflection).
>> 
> I founded it in a Dev. snapshot
> cf. 
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m73/offapi/com/sun/star/awt/XTopWindow2.idl
> you can get the Dev. version of OOo and its respective SDK from any mirror, 
> for example
> ftp://mirror.switch.ch/mirror/OpenOffice/extended/developer/DEV300_m73
>
> Anyway this new interface does not help you with this current problem.
>
> Regards
>   



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-08 Thread Rony G. Flatscher

On 08.03.2010 13:55, Carsten Driesner wrote:
> Rony G. Flatscher wrote:
>> Hi Ariel,
>>
>> On 04.03.2010 02:38, Ariel Constenla-Haile wrote:
>>  
>>> On Wednesday 03 March 2010, 14:16, Rony G. Flatscher wrote:
>>>  
>>>>  
>>>>> You could file a RFE to enhance the com.sun.star.awt.XTopWindow
>>>>> (haha now
>>>>> I see someone [fs in dba33a?] added a com.sun.star.awt.XTopWindow2).
>>>>>   
>>>> But that one seems not to be available (it cannot be interrogated via
>>>> reflection).
>>>>   
>>> I founded it in a Dev. snapshot
>>> cf.
>>> http://svn.services.openoffice.org/opengrok/xref/DEV300_m73/offapi/com/sun/star/awt/XTopWindow2.idl
>>>
>>> you can get the Dev. version of OOo and its respective SDK from any
>>> mirror, for example
>>> ftp://mirror.switch.ch/mirror/OpenOffice/extended/developer/DEV300_m73
>>>
>>> Anyway this new interface does not help you with this current problem.
>>>   
>> somehow the people in the know from Sun/Oracle seem to have been busy
>> these days as astonishingly no one has followed up.
>>
>> Hoping the best, waiting till next week for additional feedback/infos.
>>   
> Hi Ron,
>
> The UNO AWT toolkit is a small wrapper on top of VCL. The vcl methods
> provide the output (client) area to the caller and therefore you see
> that in UNO AWT toolkit, too. You are right that this is not always
> the needed information. As there is currently no other way than the
> workaround from Ariel you have to write a request for enhancement.
> XTopWindow2 would be a good place to provide this kind of information.
> UNO AWT is known to have many missing functions but available
> developers are rare. Help is always appreciated. 
Short of students who are acquainted with C++ there is unfortunately no
resource around here to help out in this corner. :(
Wherever otherwise help is possible it is being attempted (like a
student taking on IDL-text <-> registry, IDL-text <-> some sort of
XML-encoded IDL where ideas and suggestions are of course welcome).

---rony




-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-05 Thread Rony G. Flatscher
Hi Ariel,

On 04.03.2010 02:38, Ariel Constenla-Haile wrote:
> On Wednesday 03 March 2010, 14:16, Rony G. Flatscher wrote:
>   
>> 
>>> You could file a RFE to enhance the com.sun.star.awt.XTopWindow (haha now
>>> I see someone [fs in dba33a?] added a com.sun.star.awt.XTopWindow2).
>>>   
>> But that one seems not to be available (it cannot be interrogated via
>> reflection).
>> 
> I founded it in a Dev. snapshot
> cf. 
> http://svn.services.openoffice.org/opengrok/xref/DEV300_m73/offapi/com/sun/star/awt/XTopWindow2.idl
> you can get the Dev. version of OOo and its respective SDK from any mirror, 
> for example
> ftp://mirror.switch.ch/mirror/OpenOffice/extended/developer/DEV300_m73
>
> Anyway this new interface does not help you with this current problem.
>   
somehow the people in the know from Sun/Oracle seem to have been busy
these days as astonishingly no one has followed up.

Hoping the best, waiting till next week for additional feedback/infos.

Regards,

---rony




-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-03 Thread Rony G. Flatscher
Hi Ariel,

On 3/3/2010 4:12 PM, Ariel Constenla-Haile wrote:
> On Wednesday 03 March 2010, 10:24, Rony G. Flatscher wrote:
>   
>>> maybe
>>>
>>> ContainerWindow.Toolkit
>>> can do the job
>>>   
>> thank you! Tried that already to no avail yesterday; here is what I did:
>>
>> * create an emnpty swriter document (named: "oDoc",
>>   o get oDoc's XModel -> getCurrentController() -> getFrame()
>> + get its getContainerWindow() -> getPosSize(): this
>>   contains everything, but the enclosing window/frame
>>   (the top-level window in Windows having the frame and
>>   the title bar etc.),
>> + get the XWindowPeer interface from the container
>>   window, then its toolkit and from it the work area,
>>   o get xFrame's parent (assuming that then one could get to the
>> encompassing frame (window), which works, but the position
>> information (a Dimension object) has all its members set to 0.
>>
>> Tried to research the OOo docs, the DevGuide and search facilities to
>> get further, but have not been successful.
>>
>> Maybe the route I am taking is false, or I do not see the forest for the
>> trees, or the information is not available via UNO.
>> thank you! Unfortunately, this does not help solve the problem.
>>
>> ---
>>
>> The problem rephrased would be: using UNO, how can one get a hold of the
>> e.g. Windows window in which OOo creates its components, such that one
>> can get the exact window position, width and height?
>> 
> let me see if I get you...
> You want to get the window dimensions including the window decorations (that 
> is: the window border and the window title bar).
>   
Yep!

> You are in the right way searching through the container window: *this* is 
> the 
> system window the frame (where the document is loaded) is initialized with.
>
> The problem is that OOo API does not take into account the window manager 
> hints (window decorations, window border and the window title bar).
>
> The closest I could get was working with the 
> com.sun.star.awt.DeviceInfo.TopInset (in Linux [well, on Fedora with KDE 4.4] 
> this gives me an approximate idea of the window title bar height).
> Nevertheless this gives no idea about the window borders.
>
> Play with this awful example:
> http://arielch.fedorapeople.org/devel/ooo/SystemWindow.tar.gz
> As OOo API can't handle to bring the window to the front, you will have to do 
> it manually (read the comments main method).
>   
Thank you *very* much for that interesting example!

> May be the underlying implementation (the vcl WorkWindow/SystemWindow/Window) 
> knows how to get this data, sure Carsten joins the discussion and gives us 
> some light.
>   
Keeping my fingers crossed.

> You could file a RFE to enhance the com.sun.star.awt.XTopWindow (haha now I 
> see 
> someone [fs in dba33a?] added a com.sun.star.awt.XTopWindow2).
>   
But that one seems not to be available (it cannot be interrogated via
reflection).

---

Yesterday, I went after Java itself to find the missing pieces, i.e. the
title bar inset and the width of the window frames, but was not lucky
(looked in the corner of Toolkit, Robot; being a little pressed with
time, I quickly turned back to UNO, hoping at a pure UNO solution).

---rony





-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-03 Thread Rony G. Flatscher
Fernand,
> maybe
>
> ContainerWindow.Toolkit
> can do the job
thank you! Tried that already to no avail yesterday; here is what I did:

* create an emnpty swriter document (named: "oDoc",
  o get oDoc's XModel -> getCurrentController() -> getFrame()
+ get its getContainerWindow() -> getPosSize(): this
  contains everything, but the enclosing window/frame
  (the top-level window in Windows having the frame and
  the title bar etc.),
+ get the XWindowPeer interface from the container
  window, then its toolkit and from it the work area,
  o get xFrame's parent (assuming that then one could get to the
encompassing frame (window), which works, but the position
information (a Dimension object) has all its members set to 0.

Tried to research the OOo docs, the DevGuide and search facilities to
get further, but have not been successful.

Maybe the route I am taking is false, or I do not see the forest for the
trees, or the information is not available via UNO.
thank you! Unfortunately, this does not help solve the problem.

---

The problem rephrased would be: using UNO, how can one get a hold of the
e.g. Windows window in which OOo creates its components, such that one
can get the exact window position, width and height?

---rony



Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-03 Thread Rony G. Flatscher
Fernand,

thank you! Unfortunately, this does not help solve the problem.

On 3/3/2010 9:19 AM, Fernand Vanrie wrote:
> For doing things when opening Formdocs i use 2 BASIC subs, maybe they
> can help you ?
>
> Sub setDocPosSize(Doc As Object , X As long, Y as long , Width as
> long, Height as long )
>Dim Window As Object ' CONTAINER WINDOW
>If IsNull(Doc) Or IsEmpty(Doc) Then Exit Sub
>
>Window=Doc.CurrentController.Frame.ContainerWindow
The containerWindow does not encompass the window that has a frame and a
title bar. I would like to get a reference in any form to that
particular window (then I would be able to figure out whether it is
being displayed in full, resize and move it such that two different OOo
documents can be aligned alongside each other etc.).

Regards,

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] How to get document's windows (position, size, moving) via UNO ?

2010-03-03 Thread Rony G. Flatscher
Hi there,

trying to find a means to learn about the position and size of document
windows via UNO (and the ability to move and resize the entire document
window). What would be the classes, interfaces to use?

Researched and experimented with XFrame (getContainerWindow,
getComponentWindow and their XWindowPeer's toolkit) and the parent of
the XFrame (using findFrame("_parent",) to get at the system's window in
which the container window resides, however the windows have 0 in their
respective dimension elements.

Tried to find the necessary information via various searches and in the
DevGuide, but have been unsuccessful so far.

Any kind soul who would give some pointers?
(Also, moving the entire window and resizing it via UNO would be a
necessity.)

TIA,

---rony






-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Specs/code for registry file-structure ? (Re: Question ad creating and deploying components, implemented in (dispatchable) scritpting languages ...

2010-02-15 Thread Rony G. Flatscher
Hi Jürgen,

On 15.02.2010 13:07, Juergen Schmidt wrote:
> On 2/15/10 12:40 PM, Rony G. Flatscher wrote:
>> Hi there,
>>
>> where could one find the specs or the code (Java/C/++) for creating the
>> registry file-structure from IDL files, such that one can create
>> registry files oneself?
> i would like to ask again for what reason you want to create it on
> your own. You should or have to provide the IDL files anyway.

in order to make it as easy as possible for script language users to
create UNO components, they should not be forced to install anything
else than OOo (and possibly an external scripting language). Especially
"end-user-programmers" (who may have no clues about C++ or Java at all!)
should not be forced to install and setting up the SDK or NetBeans
(Eclipse).

It seems that in order to deploy a component one must supply a physical
registry file that will get honored at installation time. This file
should therefore be created when creating the necessary infrastructure
for packaging a component. The only means available at that point in
time would be either the scripting language itself or Java. (If there
was a means to register the new types with OOo at installation time
programmatically that would be even preferable.)

To boil it down: a script programmer (focusing on end-user programmers)
should get a (script defined) assistant where s/he fills-in whatever is
needed for successfully creating an extension package, without the user
needing to know anything of the intimate details that need to be honored.

If there are simpler means to achieve that (SDK-less, C++-less), the better.

[Even though I am targeting the scripting language ooRexx which is
deployed/uses the OOo-Java-scripting framework, I am interested in
creating the support such, that at least the packaging - including the
type definitions - could be used for any scripting language deployable
via the OOo-Java-scripting framework. This way efforts can be reused,
and users can pick any language that best fits their own needs.]


> There is no formal spec available. But you can check the idlc and the
> registry module.
>
> If you want to provide type descriptions on your own you should more
> focus on an own implementation of an TypeDescriptionProvider
> (http://api.openoffice.org/docs/common/ref/com/sun/star/reflection/TypeDescriptionProvider.html)
>
Thank you very much for these pointers. How could one then register new
types with OOo (what other services, interfaces would need to be
instrumentated, if any)?

Regards,

---rony




-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Specs/code for registry file-structure ? (Re: Question ad creating and deploying components, implemented in (dispatchable) scritpting languages ...

2010-02-15 Thread Rony G. Flatscher
Hi there,

where could one find the specs or the code (Java/C/++) for creating the
registry file-structure from IDL files, such that one can create
registry files oneself?

TIA,

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Question ad creating and deploying components, implemented in (dispatchable) scritpting languages ...

2010-01-27 Thread Rony G. Flatscher
Hi Jürgen,
> see some comments inline
thank you very much!

>> The question: how would one create and implement UNO components in
>> scripting languages that can be deployed via the OOo (Java-based)
>> scripting framework (e.g. JavaScript/Rhino, BeanShell, but also ooRexx
>> or other BSF-scripting languages)?
>>
>> Some of the questions that may be needed to be addressed would be:
>>
>>  * How can one dynamically add IDL kind of type information to the
>>registry, such that the new types become reflectable?
> do we want this because we wouldn't have any documentation for this
> new types. Don't get me wrong it's just a question, we also have
> thought in this direction in the past as well.
Well, I was thinking along the lines that while installing a component a
script could be fired that would create the "appropriate" entries in the
registry. Con: could be quite complex and error-prone (maybe one could
define the IDL in XML and have unopkg process it and - let? - create the
appropriate rdb entries).

But I have no clues what I am talking about (w.r.t. complexities and
risks in this delicate area).

>>  * How can one register a component dynamically ?
> that is already possible i think. You add an appropriate factory
> implementation for a new service implementation.
>
>>  * How can one supply a service manager object to be used for
>> instantiating instances?
> that would be one of the more interesting parts. All language bindings
> provide some kind of bootstrap mechanism to get started, prepare a
> connection etc. That would be necessary
Would it be possible/conceivable that the above two needed
functionalities could be also defined in a XML configuration file,
defining the respective dispatch URIs? This way a script engine
implementation could define the dispatch for running the respective
scripts that implement  "__getServiceFactory (String,
XMultServiceFactory, XRegistryKey)" and
"__writeRegistryServiceInfo(XRegistryKey").

>>  * How can one take advantage of helper classes (XWeak,
>> XComponent) ?
> you have to provide similar helper for the scripting language of choice
O.K. (this would be fairly straight-forward, some BSF/javax.script
scripting languages could even take advantage of the Java helper classes).

... cut ...

>> ---
>>
>> Maybe to rephrase this question differently: I would like to come up
>> with a solution for OOo disptachable scripting languages, in which
>> script programmers have no need for the OOo SDK, if they wish to create
>> UNO components in their scripting language of choice. (The necessary
>> complexity involved in creating UNO components, should be reduced to an
>> absolute minimum, where this minimum should be to have no need for
>> installing the OOo SDK.)
> i agree to the statement "The necessary complexity involved in
> creating UNO components, should be reduced to an absolute minimum" but
> the SDK doesn't provide too much i would say.
> New APIs have to be defined in IDL -> so at least idlc is necessary.
> The other tools can be useful for C++ and Java. The header files for
> C++. What else is there, the IDL reference, some docu and examples.
>
> Ok for IDL we can think of an integrated idl compiler ...
>
> In general i like the idea but i would focus more on better tooling
> around scripting languages. I still have in mind to provide a better
> integration for scripting languages in NB.
If you (or anyone else) is going to enhance the scripting language
support of OOo, may I suggest to use the "javax.script" framework, which
is available in a pre-Java6-implementation from Apache under the project
name "BSF *3.0*" (this is an implementation of JSR-223 specs, which got
implmented in Java 6 in the package "javax.script"):
?

This would allow OOo to make all JSR-223-scripting languages available
for OOo (but of course the UI would need to be adjusted as the
Tools->Macro branch would have to cater for a flexible number of
scripting languages that may be available). To get an overview of how to
use it (how "complex" it is), cf. e.g.
.
Enumerating all available scripting languages is as easy as e.g.
, which also
demonstrates how easy it is to invoke ECMAScript/JavaScript/Rhino from
Java. A (not complete) list of available JSR-223-scripting languages can
be found here: .

Using BSF 3.0 would allow OOo, which Java baseline is 1.5, to fully
exploit/employ the "javax.script" package, as BSF 3.0 can be deployed
from Java 1.4 on. (On Java 6 and higher the respective "javax.script"
implementations would take over, of course.)

Regards,

---rony

P.S.: Just a side-note: for the current ooRexx support I am using BSF
2.4 which is not compatible with BSF 3.0, but follows the same
principles: defining a Java framework to ease deploying scripts in
non-Java-languages for

[api-dev] Question ad creating and deploying components, implemented in (dispatchable) scritpting languages ...

2010-01-27 Thread Rony G. Flatscher
Hi there,

if this is not the right list, please advise. [This e-mail is directed
at dev@api.openoffice.org and d...@openoffice.org, and the Reply-To-field
set to d...@openoffice.org.]

After peeking around the documentation (mainly developer's guide)
currently one is able to create componenents in C++ and  Java (and also
in Python).

The question: how would one create and implement UNO components in
scripting languages that can be deployed via the OOo (Java-based)
scripting framework (e.g. JavaScript/Rhino, BeanShell, but also ooRexx
or other BSF-scripting languages)?

Some of the questions that may be needed to be addressed would be:

* How can one dynamically add IDL kind of type information to the
  registry, such that the new types become reflectable?
* How can one register a component dynamically ?
* How can one supply a service manager object to be used for
  instantiating instances?
* How can one take advantage of helper classes (XWeak, XComponent) ?

Are there any links/hints to postings, definitions, sketches of such a
functionality? Is there some experimental implementation available
somewhere (or is it even available already)?

Short of that, how is the Python support implemented? Is there a
documentation about the architecture and the UNO APIs it uses? What
are/were the problems there, are there any shortcomings?

---

Maybe to rephrase this question differently: I would like to come up
with a solution for OOo disptachable scripting languages, in which
script programmers have no need for the OOo SDK, if they wish to create
UNO components in their scripting language of choice. (The necessary
complexity involved in creating UNO components, should be reduced to an
absolute minimum, where this minimum should be to have no need for
installing the OOo SDK.)

TIA,

---rony




Re: [api-dev] Connecting to OOBean under Linux

2009-11-27 Thread Rony G. Flatscher

>> Locating a native library loaded by a Java jar is typically done
>> using relative path entries in the jar manifest Class-Path. 
>> Resolving a relative path relative to a symlink can obviously have
>> different results, depending on whether or not the symlink is resolved.
> For Java there seems to be no problem resolving symlinks. I placed my
> main jar in /basis-link/program/ and did put symlinks
> and other needed jars into a newly createed  Installation>/basis-link/program/lib folder. Resolving those symlinks
> was no problem for Java as I could see in -verbose mode. All
> classes/methods were properply loaded, except those JNI methods. I
> don't know why it is like that and if that is needed or a missing
> feature from classloaders/infrastructure.
just a wild guess: if you are relying on the operating system to locate
the libs, then you may be hit by "ldconfig"'s not processing symlinked
files.

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] URL to a new "OpenOffice.org Automation Using ooRexx Scripting Language by means of Selected Nutshell Examples by Andrew Pitonyak" ...

2009-10-17 Thread Rony G. Flatscher
Hi there,

here is the URL to another student's work on some of Andrew Pitonyak's
great nutshells (cf. ):
.

As the ooRexx nutshells use the OOo Java bridge they also show which UNO
interfaces one needs to query in order to get at the needed
functionality (something that is not necessary in Basic, hence usually
missing from Basic code and as a result making it quite cumbersome to
research the necessary interfaces), so Java bridge users may find these
nutshells helpful from that perspective (saving themselves potentially a
lot of research time).

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Progress on exporting the Dev Guide to ODT and PDF

2009-08-21 Thread Rony G. Flatscher
Hi Clayton,

Clayton wrote:
> I've finally been able to make some progress with exporting the
> Developer's Guide out of the Wiki and into ODT and PDF.  Updating the
> Wiki was a big help in getting this working smoothly.
>
> You can find the latest documents here:
> http://wiki.services.openoffice.org/wiki/Documentation/Wiki_Books
>   
looks great and will be *very* helpful for getting interested parties
and especially newcomers acquainted with OOo! Kudos to you!

>  - ODT chapters marked as First Draft are raw exports from the Wiki that
> are imported to the Book template - no cleanup has been done.  They are
> not in a final condition, do if you download/read one of those chapters,
> expect there to be formatting and layout problems that will affect
> readability - especially with tables.
>
> - ODT chapters that do NOT have First Draft have had a pass at
> formatting and layout cleanup.  There are still a few minor issues here
> adn there that I will work on for teh next big export.  For now, unless
> someone sports a really major issue, this is as far as I will take the
> export.
>
> I am also combining the chapters into one single document.  So far,
> Chapters 1 to 6 are in one doc, and can also be downloaded from the page
> linked above.
>   
Maybe one suggestion ("very nice to have"): would it be possible to
apply syntax coloring/highlighting to the example code? It would make it
so much easier for readers to orientate themselves in the code examples.
Something like applying the [g]vim syntax highlighting?

Would you be able/contemplate of adding it?

Regards,

---rony



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] OpenOffice 3.0 and Java 1.5

2009-04-20 Thread Rony G. Flatscher
Hi Cristian,

Cristian Fonti wrote:
> Hi to all,
> two years ago, i have  created an application client-server to editing
> rtf file with OpenOffice 2.X calling the client into an applet from
> Oracle E-Business Suite (Oracle Forms).
> Now i would upgrade to OpenOffice 3.0 but when i'm trying to load the
> openoffice jars i obtain this error: "Unsupported major minor version
> 49.0".
> I supposed that the problem is that the jar in
> $OpenOffice_Installation_dir/Basis/program/classes e
> $OpenOffice_Installation_dir/Ure/java are compiled with JDK 1.6.
> There is a version of OpenOffice 3.0 compiled with JDK 1.5??
> Or someone have an idea how to solve this problems??

"49.0" is Java 1.5 AFAIK. Probably the client (the forms application)
uses an earlier version of Java. You may want to output something like

 System.out.err("java.version: "+System.getProperty("java.version");

Or output all properties to see the Java configuration in use.

HTH,

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Announcing an "Open Office API-Viewer" ...

2009-03-09 Thread Rony G. Flatscher
Hi there,


as you may know, from time to time students work on assignments related
to creating scripts/programs for OOo. One problematic area in OOo
programming is gaining an overview of the available APIs and how to use
them. Sometimes it is as if one cannot tell the forrest for the trees!

Thanks to Nicole Scholz and thanks to many helpful hands in this group
(*special* kudos go to the Ariel Constenla-Haile, who has been of
tremendeous help!) work on creating an on-the-fly "OpenOffice
API-Viewer" has finished.

Here's the URL:
 to
the thesis, which explains the work. Quite a few snippets got created in
the context of her work and placed on the OOo snippet homepage at
.

---

As a matter of fact, Nicole Scholz' work yields very nice and helpful
API documentations, such that I overhauled her code a little bit (in the
process allowing it to be invoked from non-Rexx-programs like OOo Basic,
C++, Java etc.) and am about to make it part of the BSF4Rexx
distribution, such that Rexx programmers will have it available right
away. In addition there is a GUI supplied that allows one to enter any
UNO IDL string and set the analysis and rendering options to create the
respective OOo API overview.

For non-Rexx coders this work may be taken advantage of, by installing
ooRexx and BSF4Rexx (cf. the above URL for more information and URLs on
this), which is a matter of probably five minutes. Using the dispatch
interface you then will be able to supply either UNO IDL stirngs or UNO
objects for documentation; alternatively you could from then on use the
GUI interface to supply UNO IDL strings.

The API documentation will create a writer document, listing the full
UNO IDL definitions in various ways and having them linked to the OOo
documentation on the Internet (there would also be a possibility to link
to your locally installed documentation instead, if any).

Example renderings can be viewed right away following the above URL and
following the link to "examples_from_the_BSF4Rexx_version" and will give
you insights into the available APIs for all OpenOffice.org document
types that can be created via the "File -> New..." menu.

Regards,

---rony




-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Now with OOo Basic called from pure Java ... (Re: [dev] More infos, request for help/hints ... (Re: [api-dev] XDispatchHelper.executeDisptatch(...) - Boolean argument appended by OOo ?

2009-02-13 Thread Rony G. Flatscher
Hi Jürgen,

Juergen Schmidt wrote:
 [BTW, please note that there seems to be an error in this area, as
 from
 outside of Basic one must denote "application" rather than the correct
 "user" as the location.]
>>> mmh, i am not sure. Well i have never used this but maybe
>>> "application"  provides a view from outside of basic on both "user"
>>> and "share" and you don't have to differentiate. But of course using
>>> "user" directly should work probably also.
>> Shall I file an issue for this?
> i don't know how it should be, maybe wait until somebody with deeper
> knowledge of this area has answered.
>
> I think an issue would get a very low prio because it's not often used
> ...
Thanks, will do.

 Compiling and running the Java program above will cause a message
 box to
 popup (needs to be closed by the user, or just comment the
 MsgBox-instruction), and at the end of the run will display the
 result's
 value (the result of the Basic function):

 -- cut here --

 F:\test\ooo\studenten\diplarbeit\scholz\20090108>java TestBasic
 Connected to a running office ...
 Returned from executing dispatch, Result=[(some Basic datatypes:
 0=Empty, 2=Integer, 8=String, 9=Object, 11=Boolean)

 isMissing(arg1)=False, value=someObject, datatype=9
 isMissing(arg2)=False, value=True, datatype=11
 isMissing(arg3)=True], State=[1]
 Successful run.

 -- cut here --

 As you can see, the Basic function gets TWO arguments, instead of only
 one. The last argument is of type Boolean and has a value of "True".

 Any comments/hints/explanations now that only "genuine" OOo
 functionality is used? Does this qualify as a bug?
>>> sorry no hints without further investigation ...
>> O.K., I'll wait before submitting an issue for this then (as it could be
>> very well intentional and just the documentation for it is missing,
>> although the "surprise" factor would be there fore the application
>> programmers, potentially leading to wrong expectations and therefore to
>> mix-ups at runtime as a system added argument may change the logic of
>> the receiving function/subroutine).
>
> well i would never do it this way but anyway. It's definitely seldom
> used. You should try to use the scripting framework directly to invoke
> scripts. But don't ask me how it has to be used. I simply forget it. I
> played with it some time in the past but that's it.
As explained in my other posting, entitled "ad UNO.java and the use-case
in question...", this is probably not a viable solution, as I would have
no control how the script will get invoked and it would not be feasible
to mandate the "clients" to do so (maybe in the future, if this
alternative is made available by OOo to all UNO clients).

Regards,

---rony


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] ad UNO.java and the use-case in question ... (Re: [api-dev] Now with OOo Basic called from pure Java ... (Re: [dev] More infos, request for help/hints ... (Re: [api-dev] XDispatchHelper.exe

2009-02-13 Thread Rony G. Flatscher (Apache)
Hi Matthias,
> I don't know in what context you hit this issue but just in case it
> helps you I'd like to mention that the scripting framework provides
> another way to invoke macros besides dispatches. If you're interested,
> you can find ready to use functions for invoking macros via the
> scripting framework in the file UNO.java (a self-contained UNO Wrapper
> and support library) which you can find inside the wollmux_*.tar.gz
> archive downloadable from
>
> http://forge.osor.eu/frs/?group_id=11
>   
thank you very much for this interesting link (path to UNO.java:
<\wollmux_5.1.0.tar\wollmux-5.1.0\UNOHelper\src\de\muenchen\allg\afid\UNO.java>)
!

[This is a *very* interesting solution for invoking scripts using the
OOo scripting framework, bypassing the
XDispatchHelper.executeDispatch(). It also demonstrates how to use an
XBrowseNode to traverse the tree of script nodes in executeMacro().]

---

For the current use-case in question, the user of any programming
language should be able to invoke a script written in ooRexx (by a
student, Nicole Scholz). The script takes either an UNO object or an IDL
string and creates a writer document that lists all available
definitions in various forms and links to the official OOo
documentation, such that one can easily get an overview of all the
functionality and structures available and being able to link from each
chunk to the OOo documentation.

This script can be invoked via the dispatch interface and therefore
programmers should be able to take advantage of it with the means
available to them. The easier the better. For this group of
programmers/people it is currently out of the question to use the
interesting solution you pointed to, as they are used to 
executeDispatch(...) which is demonstrated in numerous snippets/examples.

There are up to nine (!) arguments possible that drive the production of
the "just-in-time" documentation, where only the first one is mandatory.
Hence, getting an additional argument, appended by OOo somewhere causes
a problem. In order to demonstrate some renderings (and then just click
to navigate the embedded links), I just created the following ones,
which may be interesting to look at as they demonstrate (and document)
what a writer document implements:

* 
* 


As you can see this might be really quite useful for OOo programmers of
all levels, and therefore I would like the ooRexx script to be easily
dispatched by anyone from any language using the OOo built-in dispatch
functionality for it. This intention is the motivation to ask for
help/infos w.r.t. the argument problem, but also the problem encountered
with OOo Basic, which can invoke the script, but once the script uses
the bootstrap mechanism to get at a new context to create the writer
document containing the rendered documentation, but goes out to lunch
(which is not the case if doing the same thing from a Java program).

---rony




[api-dev] Runtime issues, if OOo Basic invokes Java, which bootstraps its own connection to OOo ? (Hangs OOo hard, OOo Basic macro enclosed)

2009-02-12 Thread Rony G. Flatscher (Apache)
Hi there,

not being sure which e-mail list would be appropriate, I send it to
those two that may help the most, but setting the reply-to field to
"dev@api.openoffice.org" to avoid spamming multiple lists. If this is
not appropriate please advise.

Following use-case:

* OOo Basic subroutine using the dispatch interface to dispatch an
  ooRexx macro/script, supplying it arguments (an UNO object to be
  documented explicitly and for which a writer document will be
  created which will receive formatted text with underlying links to
  the OOo UNO documentation),
* the bridge to ooRexx (itself written in C++) is realized via Java
  as a bridge, using the OOo Java based scripting interface for
  communication; all communication between OOo and ooRexx is carried
  out via the Java bridge from the perspective of OOo.

The problem:

* The ooRexx script is invoked, but at the moment where on its side
  the Java "com.sun.star.comp.helper.Bootstrap.bootstrap()" is
  executed, in order to get an independent xContext, which then is
  used to create a  "com.sun.star.frame.Desktop" UNO object, which
  then is used to get the xComponentLoader to use its
  "loadComponentFromUrl(...)" to load an empty swriter document,
  then there OOo hangs hard (need a task manager to kill it).
* Doing the same with Java (i.e. invoking the very same ooRexx
  script/macro from a Java OOo app) works!

Can someone shed some light on interdependencies between OOo Basic and
invoked non-OOo-Basic code via Java that bootstraps independently to OOo
in order to get a xContext?

TIA,

---rony

P.S.: Here's the OOo Basic code-snippet to invoke the ooRexx script via
dispatch:

-- cut here -

Sub TestDispatchCreateApiInfoWithRexx 
   Dim oDispHelper, oProvider as object
   Dim macroUrl as string
   dim args0(0) as new com.sun.star.beans.PropertyValue
   
   oProvider=ThisComponent.CurrentController.Frame
   oDispHelper=createUnoService("com.sun.star.frame.DispatchHelper")
   
   
macroUrl="vnd.sun.star.script:wu_tools.createApiInfo.rex?language=ooRexx&location=user"
   
   args0(0).Name="arg1"
   args0(0).Value=oDispHelper ' some UNO object/IDL string
   
   r=oDispHelper.executeDispatch(oProvider, macroUrl, "", 0, args0())
   
   msgbox r.Result, 0, "result from dispatching createApiInfo.rex"   
End Sub

-- cut here -






[api-dev] More infos, request for help/hints ... (Re: [api-dev] XDispatchHelper.executeDisptatch(...) - Boolean argument appended by OOo ?

2009-02-12 Thread Rony G. Flatscher (Apache)
Hi there,

not sure whether "d...@openoffice.org" would be the "better" list for
this question, hence cc:'ing it, but reply-to is set to point to
"dev@api.openoffice.org". Please advise, if another e-mail-list would be
better.

rony wrote:
> Hi there,
>
> it seems that if using XDispatchHelper.executeDisptatch(...) from Java
> the argument list (fifth argument being an array of type PropertyValue)
> gets a Boolean entry appended (that is always set to true). Is that
> truly the case? (If so, where would that be documented?)
>
> Using OOo 3.0.0 (O300m9, build:9358) and the Java interface to OOo to
> invoke "executeDispatch()". Online documentation
> ,
> looking up Parameter "Arguments".
>
> TIA,
>
> ---rony
>
>   
Maybe this was not enough information, so:

* Using XDispatchHelpter.executeDispatch(...), allows one to supply
  five arguments, the last argument being an array of PropertyValues,
* Using the OOo scripting framework, the method "invoke(Object[]
  aParams, short[][] aOutParamIndex, Object[][] aOutParams)" of the
  "com.sun.star.script.framework.provider.XXX.ScriptProviderForXXX" 
  class is invoked (where "XXX" stands for the scripting language
  this class will serve).
  o "aParams" will have always one argument more than supplied
by "XDispatchHelpter.executeDispatch(...)", and that
argument is of type Boolean (in my case always set to "true".

Here's an example Java code that employs
"XDispatchHelper.executeDispatch(...)":

- cut here 

// ---rgf, 2009-02-11, Java program to invoke "createApiInfo.rex" from Java

import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XDispatchHelper;
import com.sun.star.frame.XDispatchProvider;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.frame.DispatchResultEvent;

class TestCreateApiInfo {
public static void main (String args[]) {
// excerpted from "HardFormatting.java" from the OOo development package
XDesktop  xDesktop = null;
XMultiComponentFactory xMCF = null;
XMultiServiceFactory   xMSF = null;

try {
XComponentContext xContext = null;

// bootstrap the UNO runtime environment
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();

// get the service manager
xMCF = xContext.getServiceManager();
xMSF = (XMultiServiceFactory) 
UnoRuntime.queryInterface(XMultiServiceFactory.class, xMCF);

if (xMSF!=null)
{
System.out.println("Connected to a running office ...");

// get XDispatchProvider from XDesktop
Object oDesktop = 
xMSF.createInstance("com.sun.star.frame.Desktop");
xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, 
oDesktop);
XDispatchProvider xDispatchProvider=(XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class, 
xDesktop);


Object sDispatchHelper= 
xMSF.createInstance("com.sun.star.frame.DispatchHelper");
XDispatchHelper xDispatchHelper=(XDispatchHelper)
UnoRuntime.queryInterface(XDispatchHelper.class, 
sDispatchHelper);


// define arguments
PropertyValue propValue=new PropertyValue();
propValue.Name="arg1";  // not used, but what the 
heck
propValue.Value=sDispatchHelper;// an UNO object (could be 
an UNO IDL string instead)

PropertyValue parameters[]={propValue};

// invoke the ooRexx script to document the UNO object/IDL
String location="user"; // "user" or "share" or "application"
String 
macroUrl="vnd.sun.star.script:wu_tools.createApiInfo.rex?language=ooRexx&location="
+location;

// dispatch, supplying arguments
DispatchResultEvent dre=(DispatchResultEvent)
  xDispatchHelper.executeDispatch(
xDispatchProvider,  // XDispatchProvider
macroUrl,   // URL
"", // TargetFrameName
0,  // SearchFlags
parameters);// Arguments

System.out.println("Returned from executing dispatch, 
Result=["+dre.Result+"], State=["+dre.State+"]");
}
}
catch( Exception e) {
e.printStackTrace(System.err);
System.exit(1);
}

  

Re: [api-dev] Packaging 3rd Party DLLs

2008-11-26 Thread Rony G. Flatscher
Hi Stephan,

 how about X loading Y loading Z dynamically on all mentioned
 platforms?
 Would that be possible?
 (This might allow a single package to be used on multiple operating
 systems picking the appropriate libraries at runtime.)
>>> For X (that can link against sal) the way to dynamically load Y next
>>> to itself is to use osl_loadModuleRelative.  Problems arise if third
>>> party Y is written so poorly that it fails to dynamically load Z next
>>> to itself.
>> So would that mean that Y, realizing where it is located (and knowing
>> where Z is located relative to it), would be able to dynamic load Z,
>> given that an absolute path to it is used by Y?
>
> Are we talking past each other?  If Y knows where it is located and
> knows where Z is located relative to it, of course it can compute an
> absolute filepath for Z and load it.
Sorry for this, but I just wanted to make sure that this would work o.k.
(as it would not be complicated at all, which I mistakingly inferred
from a comment in this thread).

Thanks!

---rony



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



Re: [api-dev] Packaging 3rd Party DLLs

2008-11-26 Thread Rony G. Flatscher
Hi Stephan,
>> how about X loading Y loading Z dynamically on all mentioned platforms?
>> Would that be possible?
>> (This might allow a single package to be used on multiple operating
>> systems picking the appropriate libraries at runtime.)
>
> For X (that can link against sal) the way to dynamically load Y next
> to itself is to use osl_loadModuleRelative.  Problems arise if third
> party Y is written so poorly that it fails to dynamically load Z next
> to itself.
So would that mean that Y, realizing where it is located (and knowing
where Z is located relative to it), would be able to dynamic load Z,
given that an absolute path to it is used by Y?

---rony

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



Re: [api-dev] ad Wiki: possible to get whole chapters?

2008-11-26 Thread Rony G. Flatscher
Hi Clayton,

thank you for your answer!

... cut ...

> I hope to simplify this a bit in the future.  I have been working on an
> idea to auto-generate the Collections for each chapter.  The Wiki syntax
> for a Collection and the Wiki syntax we use to generate the TOC box are
> similar.  We should be able to run a WikiBot over the TOC pages extract
> the chapter information and generate a Collection.  When things are
> ready to go on with this step, I will write up an outline of what is
> needed, and will call on the community here to help with the scripting.
>   
... cut ...

Please count me in, once you think that going the scripting route
becomes feasible (but also allow some reaction/development time).

As nice as the Wiki-based documentation is, as important seems to be the
ability to easily (re-)create a book(let) containing "all relevant"
information such, that one can print them out and read them wherever one
usually reads stuff (at the beach, in the bathroom, in the dining room,
while having dinner/lunch, a coffee break, ...).
Regards,

---rony



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



Re: [api-dev] Packaging 3rd Party DLLs

2008-11-26 Thread Rony G. Flatscher
Hi Stephan,

how about X loading Y loading Z dynamically on all mentioned platforms?
Would that be possible?
(This might allow a single package to be used on multiple operating
systems picking the appropriate libraries at runtime.)

---rony


Stephan Bergmann wrote:
> On 11/26/08 13:56, RKVS Raman wrote:
>> Thanks for your help.
>>
>> We have 3 level dependencies. Things are getting interesting.
>
> You mean your X links against Y, which in turn links against Z, which
> in turn links against W?  Then, package Z and W the same way you
> packaged Y into the extension .oxt, and additionally make sure both Y
> and Z fulfill the platform-specific requirements listed below to find
> their dependencies.
>
> -Stephan
>
>> -Raman
>>
>>
>> On Wed, Nov 26, 2008 at 6:22 PM, Stephan Bergmann
>> <[EMAIL PROTECTED]> wrote:
>>> On 11/26/08 11:58, RKVS Raman wrote:
 Hi,

 How do i  package 3rd party DLLs with my Extension which uses them?
>>> If your extension shared library X is linked against a single
>>> additional
>>> ("3rd party") shared library Y, then place Y into the same directory
>>> as X in
>>> the extension .oxt, do not mention Y in the manifest of the
>>> extension .oxt,
>>> and, depending on platform, do one of the following:
>>>
>>> On Windows, nothing more should be necessary, due to the
>>> LOAD_WITH_ALTERED_SEARCH_PATH at
>>> tags/DEV300_m36/sal/osl/w32/[EMAIL PROTECTED]
>>> l. 70.
>>>
>>> On ELF based Unix (Linux, Solaris), make sure $ORIGIN is in the
>>> RPATH of X.
>>>
>>> On Mac OS X, make sure X references Y via @loader_path.
>>>
>>> If, however, X loads Y dynamically, or Y in turn is linked against
>>> or loads
>>> dynamically further shared libraries, things start to get
>>> complicated...
>>>
>>> -Stephan


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



[api-dev] URL to "OpenOffice.org: Selected Pitonyak' Nutshells in ooRexx" ...

2008-10-21 Thread Rony G. Flatscher
Hi there,

here is the URL to another student's work on some of Andrew Pitonyak's
great nutshells (cf. ):
.

As the ooRexx nutshells use the OOo Java bridge they also show which UNO
interfaces one needs to query in order to get at the needed
functionality (something that is not necessary in Basic, hence usually
missing from Basic code and as a result making it quite cumbersome to
research the necessary interfaces), so Java bridge users may find these
nutshells helpful from that perspective (saving themselves potentially a
lot of research time).

Regards,

---rony


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



[api-dev] New Snippets ... (Re: [api-dev] Some interesting OOo macros, many based on Andrew Pitonyaks great Basic examples ...

2008-10-20 Thread Rony G. Flatscher
Hi there,

today, new snippets in ooRexx got added. The code has hyperlinks where
appropriate (just click on interface names, i.e. names that start with a
"X" or at UNO IDL names), leading directly to the OOo documentation. As
ooRexx uses the Java bridge, the snippets allow one to see which
interfaces one would have to request in Java and related languages (in
ooRexx the unqualified name of an interface is sufficient: to learn
about the fully qualified name just hover the mouse over those interface
names).

Here's the list:

1. Scholz-Snippets

http://codesnippets.services.openoffice.org/Writer/Writer.AddDateToFooter.snip

http://codesnippets.services.openoffice.org/Writer/Writer.AdjustTableCellTextToTheRight.snip

http://codesnippets.services.openoffice.org/Writer/Writer.ChangeTableColumnWidth.snip
http://codesnippets.services.openoffice.org/Writer/Writer.Hyperlink.snip

http://codesnippets.services.openoffice.org/Writer/Writer.MergeTableCells.snip

http://codesnippets.services.openoffice.org/Writer/Writer.TableOfContent.snip


2. Frysak-Snippets

http://codesnippets.services.openoffice.org/Calc/Calc.ChangeATextCellToACellWithURLObject.snip

http://codesnippets.services.openoffice.org/Calc/Calc.ClearAllCellsOfASpreadsheet.snip

http://codesnippets.services.openoffice.org/Calc/Calc.ClearTheSelectedCellsOfASpreadsheet.snip
http://codesnippets.services.openoffice.org/Calc/Calc.DrawALine.snip

http://codesnippets.services.openoffice.org/Calc/Calc.ImportAGraphicFile.snip

http://codesnippets.services.openoffice.org/Calc/Calc.MergeAndUnmergeCells.snip

http://codesnippets.services.openoffice.org/Calc/Calc.ToggleAutomaticCalculationOfSpreadsheets.snip


http://codesnippets.services.openoffice.org/Office/Office.ChangeTheWorkPath.snip

http://codesnippets.services.openoffice.org/Office/Office.CloseADocument.snip

http://codesnippets.services.openoffice.org/Office/Office.ConnectToOpenOffice.snip

http://codesnippets.services.openoffice.org/Office/Office.CreateADialogAtRuntime.snip

http://codesnippets.services.openoffice.org/Office/Office.CreateAToolbar.snip

http://codesnippets.services.openoffice.org/Office/Office.ExportAnOoRexxMacroLibrary.snip

http://codesnippets.services.openoffice.org/Office/Office.GetOpenOfficeVersionAndLanguage.snip

http://codesnippets.services.openoffice.org/Office/Office.ReadATextStringOutOfTheSystemsClipboard.snip

http://codesnippets.services.openoffice.org/Office/Office.RemoveAToolbar.snip
http://codesnippets.services.openoffice.org/Office/Office.RunAMacro.snip

http://codesnippets.services.openoffice.org/Office/Office.StartUNOAcceptorUsingAnOoRexxScript.snip


http://codesnippets.services.openoffice.org/Writer/Writer.AddAndRemoveHeaderAndFooter.snip

http://codesnippets.services.openoffice.org/Writer/Writer.AutomaticallyCreateAParagraphStyleNamedCode.snip

http://codesnippets.services.openoffice.org/Writer/Writer.AutomaticallyImportCodeWithVim.snip

http://codesnippets.services.openoffice.org/Writer/Writer.CountWordsOfTheSelectedTextWithOoRexx.snip

http://codesnippets.services.openoffice.org/Writer/Writer.CreateADateField.snip

http://codesnippets.services.openoffice.org/Writer/Writer.DeactivateTextLocale_languageCheck_.snip

http://codesnippets.services.openoffice.org/Writer/Writer.ExportAllGraphicsOfAWriterDocument.snip

http://codesnippets.services.openoffice.org/Writer/Writer.GetTheSelectedTextParts.snip

http://codesnippets.services.openoffice.org/Writer/Writer.InsertAnAnnotationField.snip

The "Frysak"-snippets are also explained in his Bachelor thesis (see
link below).

HTH,

---rony


Rony G. Flatscher wrote:
> from time to time students work on creating/transcribing OOo macros for
> the different document types using an end-user developer (EUD)
> programming/scripting language named ooRexx. As ooRexx uses the Java
> bridge, those macros/examples may proof helpful for others, creating
> macros in different programming languages.
>
> Here is a very nice Bacherlor paper from this September by Josef Frysak,
> who intends to "snippetize" his snippets for the OOo code snippet
> repository. (Those snippets will have links to the OOo interfaces and
> service definitions right in the code.)
>
> Many of the interesting/helpful macros in Josef Frysak's work relate to
> the great repository of the "Andrew Pitonyak" macros available on the
> Internet, especially to his "scratch book"
> <http://www.pitonyak.org/AndrewMacro.odt>.
>
> Here's the direct link to the Bachelor paper:
> <http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2008/200809_Frysak/200809_Frysak_Automating_OOo_ooRexx_Nutshells.pdf>.
> Here's the link to the overview page:
> <http://wi.wu-wien.ac.at/rgf/diplomarbeiten/index.html#bakk_200809>.
>
> Regards,
>
> ---rony
>   



[api-dev] Some interesting OOo macros, many based on Andrew Pitonyaks great Basic examples ...

2008-09-30 Thread Rony G. Flatscher
Hi there,

from time to time students work on creating/transcribing OOo macros for
the different document types using an end-user developer (EUD)
programming/scripting language named ooRexx. As ooRexx uses the Java
bridge, those macros/examples may proof helpful for others, creating
macros in different programming languages.

Here is a very nice Bacherlor paper from this September by Josef Frysak,
who intends to "snippetize" his snippets for the OOo code snippet
repository. (Those snippets will have links to the OOo interfaces and
service definitions right in the code.)

Many of the interesting/helpful macros in Josef Frysak's work relate to
the great repository of the "Andrew Pitonyak" macros available on the
Internet, especially to his "scratch book"
.

Here's the direct link to the Bachelor paper:
.
Here's the link to the overview page:
.

Regards,

---rony


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



Re: [api-dev] Get Selected Text in the actual TextDocument

2008-09-30 Thread Rony G. Flatscher
Joel Cordeiro wrote:
> does anyone could help me about how to get the selected text in the actual
> TextDocument (Writer)? How does we cast the returned object in the method
> getCurrentSelection() ? Or there is another way?
> If possible, a simple example would be really nice..
>   
You could look-up
,
page 95-98, which demonstrates this. It is based on one of Andrew
Pitonyaks great macros which are written in Basic.

Although in ooRexx, the syntax is easy, such that you probably can get
the gist of it and know how to proceed from skimming over the few lines
of code.

HTH,

---rony



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



[api-dev] Code snippets, ooRexx ... (Re: [api-dev] automatic chapter numbering

2008-09-24 Thread Rony G. Flatscher
Hi Ariel,

first of all, I think you are doing an incredible and admirable job
helping people on this list!

It is more than remarkable to see how well you have mastered many of the
OOo APIs (if not all?) and how helpful you are.

Many of the code samples that you supply could serve *very* well as "OOo
snippets", helping even more people (beyond the mailing lists you happen
to interface with):
.

Creating those OOo code snippets is quite straight forward, i.e. quite
easy and hence quickly created, thanks to Paolo Mantovani's great
wizard:
.


This would make all those treasures of yours available to a large
audience! (But of course, it still takes some, if very little time.)

---
> [ooRexx code]
>
>   as my ooRexx knowledge is null, I can't get if you're doing something
> wrong; but you can try with the code I attach, which does almost the
> same [I added the LevelFormat demo]; maybe stepping into the code, you
> can find if you're missing something.
As the ooRexx support uses the Java bridge, your code samples should be
right at the top, if Nicole Scholz transcribes them 1:1 to ooRexx. Also,
it would be possible for people understanding one, two things about
ooRexx to take ooRexx code samples and translate them back to whatever
language one uses, hence two, three remarks and as a little thank you
the transcription of one of your static Java methods to ooRexx code,
such that you could see the difference and map the concepts more easily:

* ooRexx is a dynamic language, hence no typing (that may come into
  the way of programmers) is really needed; the UNO/OOo support
  takes advantage of that and tries to alleviate the typing needs
  from OOo-script programmers,
* in ooRexx the interaction with objects is not done with
  dereferencing a structure with the dot operator, rather there is
  an explicit message operator (~), the tilde. This allows one to
  send objects (left of the tilde) messages (richt of the tilde). If
  messages carry arguments, then one can supply them in round
  parenthesis, otherwise the parenthesis can be omitted. (Also, it
  is permissible to have white space before and after the message
  operator).
  One feature of the ooRexx UNO/OOo support is the observation, that
  queryInterface() is a fundamental, basic and important operation,
  making it quite cumbersome at times to code that (especially
  without context-sensivitive-/intelligense-editors). Due to the
  features available in ooRexx the querying of interfaces can be
  eased for the programmers by merely sending those UNO objects the
  names of the interfaces; it is possible to use the unqualified
  name of such interfaces.
* Before an ooRexx program is executed by the interpreter, it first
  gets scanned for syntax errors, then for directives (led in with
  double colons at the end of a program), which will be carried out
  by the interpreter, before running the program with the very first
  statement in line 1.

What follows is first the static Java method "getOOoLocale(...)" and a
transcription to ooRexx which takes advantage of the UNO/OOo support set
up in the ooRexx module "UNO.CLS":

-- cut here (Java code) -
public static Locale getOOoLocale( XComponentContext xContext ) {
   Locale aLocale = new Locale();
   try {
   Object oConfigurationProvider =
   xContext.getServiceManager().createInstanceWithContext(
   "com.sun.star.configuration.ConfigurationProvider", xContext);
   XMultiServiceFactory xConfigurationProvider =
   (XMultiServiceFactory) UnoRuntime.queryInterface(
   XMultiServiceFactory.class,
   oConfigurationProvider);

   PropertyValue aPropValue = new PropertyValue();
   aPropValue.Name = "nodepath";
   aPropValue.Value = "/org.openoffice.Setup/L10N";

   XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(
   XNameAccess.class, 
xConfigurationProvider.createInstanceWithArguments(
   "com.sun.star.configuration.ConfigurationAccess",
   new PropertyValue[]{aPropValue}));

   String sLocale = AnyConverter.toString(
   xNameAccess.getByName("ooLocale"));

   if ( sLocale.length() > 0) {
   if (sLocale.contains("-")){
   String[] sLocaleInfo = sLocale.split("-");
   aLocale.Language = sLocaleInfo[0];
   if (sLocaleInfo.length > 1) {
   aLocale.Country = sLocaleInfo[1];
   }
   } else {
   aLocale.Language = sLocale;
   }
   }
   } catch (Exception ex) {
   ex.printStackTrace();
   } finally {
   return aLocale;
   }
}
-- cut here (Java code) ---

Re: [api-dev] OOo Java ClassLoader strategies ? (Re: [dev] Saxon9 and OpenOffice 2.4

2008-08-12 Thread Rony G. Flatscher

Hi Stephan,

Stephan Bergmann wrote:

On 08/12/08 01:35, Rony G. Flatscher wrote:

Hi there,

starting with OOo 2.4 the OOo Java ClassLoader strategies got changed.

What are the current rules for OOo 2.4 and OOo 3.x ClassLoaders?
(Maybe together with a simple explanation of the problems that have 
been intended to be solved by those changes. But also, why would the 
CLASSPATH setting not be honored by OOo, whereas the PATH setting - 
thankfully! - is honored?)


Knowing them would really alleviate a lot of developing problems, 
where one loses really tons of time/resources to a) figure out that a 
class loader problem may be in effect and b) trying to find possible 
solutions.


The rules are really simple (also see 
<http://blogs.sun.com/GullFOSS/entry/is_your_java_extension_ready>):


- The root application class loader of the VM knows virtually no jars.

- The Java UNO environment uses one underlying class loader (child of 
the root application class loader, loading the Java UNO runtime 
classes and the classes that represent UNO types---also see the 
discussion of the UNO-Type-Path manifest entry in the Developer 
Guide), and a dedicated class loader (child of the one underlying 
class loader) per Java UNO component (i.e., jar).


- Native code that starts Java code needs to create appropriate class 
loaders manually.


- A jar that depends on additional classes needs to make sure they are 
found (e.g., with a Class-Path manifest entry).


- Java code that instantiates classes from names needs to make sure it 
does so relative to an appropriate class loader (e.g., by setting a 
context class loader).



Thank you *very* much indeed!

This helps a *lot* to judge and analyze/trace problems, that may be 
linked to Java ClassLoaders (and also to more precisely coin/discuss 
RFEs in this area :) ...).
[Together with Tobias' link it has become possible to grasp a bit the 
motivation for the change that took place for 2.3 (and also to see how 
long in advance it was prepared).]


Regards,

---rony







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



Re: [api-dev] OOo Java ClassLoader strategies ? (Re: [dev] Saxon9 and OpenOffice 2.4

2008-08-12 Thread Rony G. Flatscher

Hi Tobias,

Tobias Krais wrote:

Hi Rony,

  

Knowing them would really alleviate a lot of developing problems, where
one loses really tons of time/resources to a) figure out that a class
loader problem may be in effect and b) trying to find possible solutions.



May be this Issue helps you:
http://www.openoffice.org/issues/show_bug.cgi?id=80100
  
thank you *very* much for this interesting link, which allowed me to 
learn about the change and induce the motivation behind it!


Regards,

---rony


[api-dev] OOo Java ClassLoader strategies ? (Re: [dev] Saxon9 and OpenOffice 2.4

2008-08-11 Thread Rony G. Flatscher

Hi there,

starting with OOo 2.4 the OOo Java ClassLoader strategies got changed.

What are the current rules for OOo 2.4 and OOo 3.x ClassLoaders?
(Maybe together with a simple explanation of the problems that have been 
intended to be solved by those changes. But also, why would the 
CLASSPATH setting not be honored by OOo, whereas the PATH setting - 
thankfully! - is honored?)


Knowing them would really alleviate a lot of developing problems, where 
one loses really tons of time/resources to a) figure out that a class 
loader problem may be in effect and b) trying to find possible solutions.


If this is the wrong list then please advise which list would be the 
appropriate one, where Java class loader issues get discussed.


---rony

P.S.: Please note the Reply-to: .

P.P.S.: It can be really quite frustrating to realize that OOo programs 
work nicely via Java, but deployed from within of OOo all of a sudden 
exhibit all kind of weird and hard to debug errors.





Ariel Constenla-Haile wrote:

Agnisys escribió:

Hi,
  Can someone help me run an XSLT transformation using Saxon in an 
Openoffice 2.4 extension?
  I get a  "net.sf.saxon.TransformerFactoryImpl not found" error. 
Thanks,

Anupam.


Hi Anupam,

this sound like the typical classpath problem with OOo extensions 
(since changes in 2.3): search for "classpath" in 
[EMAIL PROTECTED] and dev@api.openoffice.org, for example


"Classpath problem in OOo 2.3" 
http://extensions.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1865383 



"Classpath in OO Extensions" 
http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1938832 



"ClassNotFoundException while loading class from external jar" 
http://extensions.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=2096555 



As this seems to be a very frequent question, I thinks it's time that 
someone writes a Wiki page explaining why things changed from 2.2 to 
2.3, and how to solve it, providing a simple example.


Regards
Ariel. 




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



Re: [api-dev] Table of Content Hyperlink problem

2008-07-17 Thread Rony G. Flatscher

Hi,

The property "LevelFormat" is defined in the service 
"com.sun.star.text.BaseIndex". The online documentation is located at 
, 
but misses to document the "LevelFormat" property!

:(
Sorry, just learned that I overlooked the documentation of the property 
"LevelFormat" in "BaseIndex.html", where it is indeed listed (just 
double-checked it right now)!


Regards,

---rony


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



Re: [api-dev] Hyperlink within a shape

2008-07-17 Thread Rony G. Flatscher

Hi Cor,

Cor Nouws wrote:

Hi Nicole,

Nicole Scholz wrote (15-7-2008 21:16)


I tried to add a hyperlink to a text within a rectangle. Usually a
hyperlink is set on the textproperties with setpropertyvalue and then
the hyperlink for example: 
xTextProps~setPropertyValue("HyperLinkURL", “www.google.at”)


Now I would like to add the hyperlink to a shape. I tried it the same
way with the xText within the shape.

xShapeText = Shape~xText xShapeTextCursor =
xShapeText~createTextCursor props = xShapeTextCursor~xPropertySet 
props~setPropertyValue("HyperLinkURL", “www.google.at”)


But this does not work. I get the exception that the method is not
found. Can someone give me a hint why I get this error and how I can
get the hyperlink into the shape?


When a shape is selected, you can choose Presentation|Interaction.
The Document as target and the URL you like.
This works in the UI, so I expect that is is possible via the API as well.
The problem, I think, is not the shape object itself, but the text 
*within* a shape, where each line/paragraph of text should be marked-up 
with an individual hyperlink.


E.g. a rectangle containing a list of services, where each listed 
service should hyperlink to its documentation.


It is this application for which she seems to look for a solution (she 
was able to add hyperlinks to "regular" text, i.e. text outside of 
shapes and wishes to do the same for texts within a shape).


---rony



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



Re: [api-dev] Table of Content Hyperlink problem

2008-07-17 Thread Rony G. Flatscher

Hi,

not having heard of you yet, but having been able to research a little 
bit (sitting in meetings since 8:30 in the morning), here is what I did 
and found out, as it may be of interest of "lurkers" who are interested 
how one could approach the problem using the ooRexx-support for UNO/OOo.


I changed the replacement statement to:  
LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(1, propsToc) 
but unfortunately I get this error:
method [REPLACEBYINDEX], method not found or error (exception) 
executing method!


Perhaps I have forgotten to link this statement to an interface, 
service or something?
This indicates that an argument is in error (missing, wrong type, etc.). 
So the next step was to find out of what type the argument should be.




 -- TOC
   contentInd = xDMsf~createInstance("com.sun.star.text.ContentIndex")

Adding the statements:say "contentInd~uno.getDefinition:"

   say "contentInd~uno.getDefinition:"
   say ppd(contentInd~uno.getDefinition)
   say "---"

yielded the following output:

   contentInd~uno.getDefinition:
   
UNO_SERVICE|com.sun.star.text.BaseIndex+com.sun.star.text.ContentIndex|SwXDocumentIndex
   
com.sun.star.text.XDocumentIndex|UNO_INTERFACE||com.sun.star.text.BaseIndex
   
Title|UNO_PROPERTY||java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
IsProtected|UNO_PROPERTY||java.lang.Boolean:UNO_BOOLEAN::|com.sun.star.text.BaseIndex
   
ParaStyleHeading|UNO_PROPERTY||java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel1|UNO_PROPERTY||java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel2|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel3|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel4|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel5|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel6|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel7|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel8|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel9|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleLevel10|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
ParaStyleSeparator|UNO_PROPERTY|OPTIONAL|java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
TextColumns|UNO_PROPERTY||com.sun.star.text.XTextColumns:UNO_INTERFACE::|com.sun.star.text.BaseIndex
   
BackGraphicURL|UNO_PROPERTY||java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
BackGraphicFilter|UNO_PROPERTY||java.lang.String:UNO_STRING::|com.sun.star.text.BaseIndex
   
BackGraphicLocation|UNO_PROPERTY||com.sun.star.style.GraphicLocation:UNO_ENUM::|com.sun.star.text.BaseIndex
   
BackColor|UNO_PROPERTY||com.sun.star.util.Color:UNO_TYPEDEF:int:UNO_LONG|com.sun.star.text.BaseIndex
   
BackTransparent|UNO_PROPERTY||java.lang.Boolean:UNO_BOOLEAN::|com.sun.star.text.BaseIndex
   
*LevelFormat*|*UNO_PROPERTY*|OPTIONAL|com.sun.star.container.XIndexReplace:UNO_INTERFACE::|*com.sun.star.text.BaseIndex*
   
CreateFromChapter|UNO_PROPERTY|OPTIONAL|java.lang.Boolean:UNO_BOOLEAN::|com.sun.star.text.BaseIndex
   
ContentSection|UNO_PROPERTY||com.sun.star.text.XTextSection:UNO_INTERFACE::|com.sun.star.text.BaseIndex
   
HeaderSection|UNO_PROPERTY||com.sun.star.text.XTextSection:UNO_INTERFACE::|com.sun.star.text.BaseIndex
   
com.sun.star.text.BaseIndex|UNO_SERVICE||com.sun.star.text.ContentIndex
   
Level|UNO_PROPERTY|OPTIONAL|java.lang.Short:UNO_SHORT::|com.sun.star.text.ContentIndex
   
CreateFromOutline|UNO_PROPERTY|OPTIONAL|java.lang.Boolean:UNO_BOOLEAN::|com.sun.star.text.ContentIndex
   
LevelParagraphStyles|UNO_PROPERTY|OPTIONAL|com.sun.star.container.XIndexReplace:UNO_INTERFACE::|com.sun.star.text.ContentIndex
   
CreateFromMarks|UNO_PROPERTY|OPTIONAL|java.lang.Boolean:UNO_BOOLEAN::|com.sun.star.text.ContentIndex
   ---
 

The property "LevelFormat" is defined in the service 
"com.sun.star.text.BaseIndex". The online documentation is located at 
, 
but misses to document the "LevelFormat" property!

:(

So the next approach is to get at the definition of the LevelFormat 
attribute (see below).




   contentProps = contentInd~XPropertySet

  propsToc = bsf.createArray(.UNO~PropertyValue, 1)
  propsToc[1] = .UNO~PropertyValue~new
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkStart"
  propsToc[1]~name="To

Re: [api-dev] Table of Content Hyperlink problem

2008-07-16 Thread Rony G. Flatscher

Hi,

Nicole Scholz wrote:

Thanks for the fast answer!

I changed the replacement statement to: 
 LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(1, propsToc) 
but unfortunately I get this error:

method [REPLACEBYINDEX], method not found or error (exception) executing method!

Perhaps I have forgotten to link this statement to an interface, service or 
something?
  
Please send me the full error description and the script code off-line 
and I'll look at it (e.g. your "propsToc" array obviously should consist 
of three elements, but you are only creating and saving one 
PropertyValue, which you change three times ).


Regards,

---rony


 Original-Nachricht 
  

Datum: Wed, 16 Jul 2008 00:48:39 +0200
Von: "Rony G. Flatscher" <[EMAIL PROTECTED]>
An: dev@api.openoffice.org
Betreff: Re: [api-dev] Table of Content Hyperlink problem



  

Hi,


I have created a table of content. Now I would like to hyperlink the
  
entries in the TOC. I found some examples and tried to integrate this code. 


As I found in the documentation I have to create an arry with the
  

elements which are included in the TOC. Here is my code:


 -- TOC
   contentInd = xDMsf~createInstance("com.sun.star.text.ContentIndex")
   contentProps = contentInd~XPropertySet

  propsToc = bsf.createArray(.UNO~PropertyValue, 1)
  propsToc[1] = .UNO~PropertyValue~new
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkStart"
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenText"
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkEnd"

  contentProps~setPropertyValue("CreateFromOutline",box("boolean",
  

.true))


  contentProps~setPropertyValue("Level",box("short", 2))
  contentProps~setPropertyValue("Title","Table of Content")
  contentProps~setPropertyValue("IsProtected",box("boolean", .false))

Then I have to get the LevelFormat and replace it with my properties.
  

But here I get the error that the method replaceByIndex does not exist or
there is an exception.


  LevelFormat = contentProps~getPropertyValue("LevelFormat")
  LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(box("long", 1),
  
propsToc) 


Can someone give me a hint where I have the mistake?
  
  

The replacement statement (the very last statement) should probably read:

  LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(1, propsToc) 
  

[Boxing of arguments is only needed in the case of property values, if 
you need to use a primitive type (boolean, byte, char, short, int, long, 
float, double).]


HTH,

---rony



Re: [api-dev] Table of Content Hyperlink problem

2008-07-15 Thread Rony G. Flatscher

Hi,
I have created a table of content. Now I would like to hyperlink the entries in the TOC. I found some examples and tried to integrate this code. 


As I found in the documentation I have to create an arry with the elements 
which are included in the TOC. Here is my code:

 -- TOC
   contentInd = xDMsf~createInstance("com.sun.star.text.ContentIndex")
   contentProps = contentInd~XPropertySet

  propsToc = bsf.createArray(.UNO~PropertyValue, 1)
  propsToc[1] = .UNO~PropertyValue~new
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkStart"
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenText"
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkEnd"

  contentProps~setPropertyValue("CreateFromOutline",box("boolean", .true))
  contentProps~setPropertyValue("Level",box("short", 2))
  contentProps~setPropertyValue("Title","Table of Content")
  contentProps~setPropertyValue("IsProtected",box("boolean", .false))

Then I have to get the LevelFormat and replace it with my properties. But here 
I get the error that the method replaceByIndex does not exist or there is an 
exception.

  LevelFormat = contentProps~getPropertyValue("LevelFormat")
  LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(box("long", 1), propsToc) 


Can someone give me a hint where I have the mistake?
  

The replacement statement (the very last statement) should probably read:

 LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(1, propsToc) 
 

[Boxing of arguments is only needed in the case of property values, if 
you need to use a primitive type (boolean, byte, char, short, int, long, 
float, double).]


HTH,

---rony





[api-dev] Also XScriptProviderFactory ... (Re: [api-dev] OOo ScriptingFramework, XDispatchHelper and stdout/stderr ?

2008-07-11 Thread Rony G. Flatscher

Hi there,

in the meantime I could test the dispatching of macros via the OOo 
ScriptingFramework using XScriptProviderFactory.


However, same problem as with XDispatchHelper: invoking more than one 
(ooRexx) macros via the scripting framework works flawlessly, if the 
script is *not* invoked by OOo. If the same script gets invoked via OOo 
(Tools -> Macros) then an error is caused, indicating a problem with 
stdin/stdout.


It looks as if OOo is interfering with stdin/stdout in an unexpected 
way, causing the *second* time a problem, when ooRexx interacts with 
stdin/stdout itself.


So I was wondering what the cause could be in order to become able to 
either fix OOo (if it is a bug there) or to work around a deliberate 
limitation.


A little bit baffled,

---rony

P.S.: This occurs on Windows XP, OOo 2.4.1.


Rony G. Flatscher wrote:

Hi there,

running a script from the commandline that uses XDispatchHelper (via 
Java) to dispatch macros via the OOo scripting framework works 
(dispatching the same macro via the OOo Java based scripting framework 
twice).


Running the same script via OpenOffice (Tools -> Macros) causes an 
error on the *second* invocation of the macro indicating a problem 
with stdin/stdout.


Is there anything on the OOo side controlling the running of macros 
that deals with/reserves/locks access to stdin/stderr?


---rony

P.S.: Invoking OOo Basic macros via XDispatchHelper many times over 
works from the commandline and via Tools->Macros.





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



[api-dev] OOo ScriptingFramework, XDispatchHelper and stdout/stderr ?

2008-07-07 Thread Rony G. Flatscher

Hi there,

running a script from the commandline that uses XDispatchHelper (via 
Java) to dispatch macros via the OOo scripting framework works 
(dispatching the same macro via the OOo Java based scripting framework 
twice).


Running the same script via OpenOffice (Tools -> Macros) causes an error 
on the *second* invocation of the macro indicating a problem with 
stdin/stdout.


Is there anything on the OOo side controlling the running of macros that 
deals with/reserves/locks access to stdin/stderr?


---rony

P.S.: Invoking OOo Basic macros via XDispatchHelper many times over 
works from the commandline and via Tools->Macros.




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



Re: [api-dev] Improvements for the OOo Scripting Framework (was Re: [api-dev] A recapitulation attempt ...)

2008-07-03 Thread Rony G. Flatscher

Hi Jim,

... cut ...

If one uses BSF 3.0 then one can also use JSR-223 (a.k.a. "Java 6 
scripting") scripting engines, as long as their Java level does not 
exceed the installed Java runtime environment.


---

Ad BSF 2.4: this is the "classic" scripting framework, originating in 
Java 1.1 (!), nowadays using Java 1.3 as its base level. There are 
quite a few scriping engines available for it, from Javascript 
(Rhino) via XSLT (sic! using Xalan) to Prolog (JLog), cf. the BSF 
homepage. Next developments that I intend do do will be a scripting 
engine that will incorporate JSR-223 scripting engines into the BSF 
2.4 framework. Also, another idea would be to create a JSR-223 bridge 
to BSF 2.x (to make also those scripting engines available, that do 
not exist for JSR-223).


Yes, I'm thoroughly familiar with BSF and used it back in the days 
before JSR-223 appeared (and ranted about how Sun had yet again failed 
to properly embrace the community's de facto standard with Java).


I was asking about what you're working on for OpenOffice with BSF.  Is 
there a place where this work is publicly available?

Hmm, yes and no.
:)

What I do is helping maintain BSF 2.4 and getting BSF 3.0 out the door 
in a GA form.


W.r.t. OpenOffice: I use BSF to bridge a scripting language named ooRexx 
(Open Object Rexx, cf. ) to/from Java. ooRexx is 
an object-oriented successor to a "human centric" scripting language 
which originated almost 30 years ago on IBM mainframes, named REXX. 
(Version 4.0 of ooRexx, a major rewrite/overhaul, is being developed 
right now and it is expected within the next few months).


Rexx was later used as a scripting language on Amiga OS, but also on 
IBM's OS/2 1.3 Extended Edition, and the 32-Bit version of OS/2 (the 
portable Microsoft version of the 32-Bit OS/2 was originally called OS/2 
NT, later, when IBM and Microsoft broke up, it was called Windows NT, 
"NT" meaning "new technology").


To make a long story short: because of the design principles of REXX 
(author Mike F. Cowlishaw, an English gentleman) it is truly an easy to 
learn scripting/macro language, ideally suited for end-user type of 
programming. The object-oriented successor from IBM followed the same 
design principles and got opensourced about four years ago. As I am 
situated at the "Wirtschaftsuniversität Wien" (Vienna University of 
Economics and Business Adminstration), MIS department, I tested ooRexx 
with end-user kind of students, to see whether it is possible to teach 
object-oriented concepts, and later, being astonishingly successful with 
it, extended that to remote control/script Windows and Windows 
applications via D/COM|ActiveX.


In parallel I was looking for a platform independent application of 
creating scripting/macro programs with ooRexx. I.e. programs that could 
execute unchanged on Windows and Unix operating systems, still being 
able to have end-user type of students being able to take full advantage 
of it. That's where BSF comes into play and my interest in it, 
eventually yielding BSF4Rexx (cf. the current GA-version at 
, but please note 
the latest test versions will be at 
, where today or 
tomorrow a new version will be placed, that overcomes the dynamically 
defining class problem).


Now, one thing end-user kind of programmers can shine is with 
"remote-controlling" end-user applications like Microsoft Office. Having 
an openplatform automation/scripting infrastructure available (BSF, and 
in my case BSF4Rexx), enables me to use OpenOffice for the same purpose. 
This is also important for the students, as they get to learn a free and 
legally owned office product, that does not lock them in into a single 
operating system, but allows them to freely choose an operating system 
of their choice.


Such students, having these kind of experiences, are also "ambassadors" 
to the "outside" world, being able to communicate that it is a reality 
that OpenOffice can be used *and* automated on multiple platforms.


However, in order for them to being able to tackle OpenOffice 
programming a few hurdles need to be mastered:


   * the UNO framework,
   * the programmatic interface (why and how does one need to
 constantly query interfaces),
   * and most importantly, documentation, nutshell examples and the like.

For that reason I have been trying different routes:

   * assign interested students tasks which they need to solve and
 document them in English (such that everyone interested on the
 world would be able to study it)
 o making them publically available; cf.
    and look for
   the keywords "BSF", "BSF4Rexx" and or "OpenOffice", "OOo";
   please note, even those works that are not so "shiny" are
   still quite helpful for newcomers and costed the students an
 

Re: [api-dev] Improvements for the OOo Scripting Framework (was Re: [api-dev] A recapitulation attempt ...)

2008-07-03 Thread Rony G. Flatscher

Hi Jim,

...
P.S.: There exists a version ASF BSF 3.0 (currently in beta), which 
is a total rewrite from scratch matching Java's 6 "javax.script". 
However, that package can be deployed on Java 1.3 and up. This means 
that in principle it would be possible to add Java 6 style scripting 
to OOo, if OOo was taking advantage of BSF 3.0, even if using earlier 
versions of Java! If interested, we could talk about this on another 
thread.


That (supporting any JSR-223 Java Script API engine) is what IFCX 
Wings and GroovyForOpenOffice are doing.  I've proposed (in my OOo 
Community Improvement Program entry) that OOo extend the Scripting 
Framework along those lines.


Note that JSR-223 (javax.script) does not require Java 6, it works 
fine with Java 5 which is all that IFCX Wings & G4OO require.  Java 6 
is fine of course, but pre-Java 5 doesn't work because unfortunately 
they used generics in the API.

That is probably linked to the class file format, rather than Generics.

I'm also interested in working out IDE integration so that OOo macros 
in these JVM-based languages can be editted and debugged directly in 
OOo without having to set up an external client/server style project.


So count me interested!

Where do we find your BSF-based work?

Here are the links:

   * Apache Software Foundation, Project "Jakarta" (originally meant to
 umbrella all Apache Java projects, in the meantime quite a few ASF
 Java projects have become top level projects, having their own
 domain), Subproject "Bean Scripting Framework (BSF)":
 o 
   * BSF 3.0, a.k.a. "Java 6" scripting framework:
 o 
 o Being employed in the Apache Harmony project, which is the
   opensource ASF Java implementation

If one uses BSF 3.0 then one can also use JSR-223 (a.k.a. "Java 6 
scripting") scripting engines, as long as their Java level does not 
exceed the installed Java runtime environment.


---

Ad BSF 2.4: this is the "classic" scripting framework, originating in 
Java 1.1 (!), nowadays using Java 1.3 as its base level. There are quite 
a few scriping engines available for it, from Javascript (Rhino) via 
XSLT (sic! using Xalan) to Prolog (JLog), cf. the BSF homepage. Next 
developments that I intend do do will be a scripting engine that will 
incorporate JSR-223 scripting engines into the BSF 2.4 framework. Also, 
another idea would be to create a JSR-223 bridge to BSF 2.x (to make 
also those scripting engines available, that do not exist for JSR-223).


---rony




Re: [api-dev] A recapitulation attempt ... (Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-07-03 Thread Rony G. Flatscher

Stephan Bergmann wrote:

...
   * *creating a class on the fly* by creating the necessary 
byte codes
 saved in a byte array with the ClassLoader's 
/|defineClass(String

 name, byte[] b, int off, int len)| /
 o works, if using URE to access OOo (i.e. script 
invoked from

   outside OOo),
 o goes out to lunch (no Java catchable exceptions!), 
if the

   same script is dispatched via OOo, i.e. the OOo
   ScriptingFramework.

   The only information that can be gathered from the 
JNI/C++

   code is a Throwable message (/|getMessage()|/) of
   "com/sun/star/awt/XActionListener". This 
information seems
   to come from the defineClass(...) invocation of 
the OOo
   class loader named 
"sun.misc.Launcher$AppClassLoader".

...
Changed the JNI code to get the exception type and it is: 
"java.lang.NoClassDefFoundError: 
com/sun/star/awt/XActionListener".


Not sure how your code looks like exactly; how do you obtain the 
class loader at which you call defineClass?


O.K.: the BSF framework will be used to create an event adapter 
dynamically. Evenutally this uses 
org.apache.bsf.util.event.generator.EventAdapterGenerator 
(generates the byte code according to the supplied argument 
"listener type" class object in a static method 
makeEventAdapterClass()) in which the class loader gets created:


 public static AdapterClassLoader ldr = new 
AdapterClassLoader();
(The org.apache.bsf.util.event.generator.AdapterClassLoader 
extends ClassLoader.)


If that AdapterClassLoader has no connection to the 
com.sun.star.lib.unoloader.UnoClassLoader, how is it supposed to 
be able to resolve Java classes that represent UNO types?  (As you 
noted, it sometimes can work, a little, by accident, if for 
example the application class loader loads jurt.jar and ridl.jar; 
but even then it will fail for additional UNO types, that are for 
example brought in by OOo extensions.)

[...]
My interest is to find a solution, which allows BSF to remain 
generic (and not making parts of it dependent on OOo custom class 
loader schemes), but being also able to be usable if deployed from 
OOo.


So, if you have an idea on how one can reliably (and stably for the 
future) come over this situation, I would appreciate it and 
implement it in BSF, hopefully solving this issue once and forever.


From what you write, it looks to me that what is needed is to allow 
clients of BSF to control which class loader is used as the parent 
class loader of AdapterClassLoader instances.
Will have to look into it. However, there is another question 
beforehand for which I would request an answer: for unknown reasons 
this class not found exception cannot be caught from the Java side 
(JRE 1.6.0_06). If it was, it became possible to react accordingly in 
that class loader.


Is this an issue with the OOo class loader that should be reported in 
order to get it fixed or is this working as designed (and if so, what 
would be the reasoning for it)?


No idea why your code cannot catch the java.lang.NoClassDefFoundError 
(note that it derives from java.lang.Error, not from 
java.lang.Exception).  

Thank you for stressing that "Error" part!

Although I realized that originally and looked up the documentation for 
NoClassDefFoundError I constantly forgot/oversaw to change the catch 
statement's filter to that specific Throwable. So that was the reason 
for not being able to catch it.


(The information about stopping the thread in case of an error is 
ex/implicitly given in the documentation for java.lang.Error, which 
serves as the superclass for all error type throwable classes.)


If the JNI-UNO bridge is in between the throw and catch sides, note 
that it will convert the Java NoClassDefFoundError into a UNO 
RuntimeException (I think).

No, the JNI-UNO bridge was not involved at all.

As the BSFManager is imported and instantiated by the ooRexx supporting 
OOo scripting framework 
(com.sun.star.script.framework.provider.oorexx.{ScriptProviderForooRexx|ScriptSourceModel}) 
which is deployed by OOo, I expected that the customized defining class 
loader ("sun.misc.Launcher$AppClassLoader") would have been set up 
already to see the OOo UNO types.


At the moment I have an experimental version of the 
BSF-AdapterClassLoader that in conjunction with the invoking scripting 
framework code works. Will have to test and further analyze the impacts 
more thoroughly (not wanting to break any existing BSF-deployments, as I 
would intend to change the ASF BSF 2.3 accordingly, such that all BSF 
2.3 scripting engines could be used as macro languages for OOo).


Thank you for your comments!

---rony

P.S.: There exists a version ASF BSF 3.0 (currently in beta), which is a 
total rewrite from scratch matching Java's 6 "javax.script". However, 
that package can be deployed on Java 1.3 and up. This means that in 
principle it would be possible to add Java 6 style scripting to OOo, i

Re: [api-dev] A recapitulation attempt ... (Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-07-03 Thread Rony G. Flatscher

Stephan Bergmann wrote:

...
   * *creating a class on the fly* by creating the necessary 
byte codes
 saved in a byte array with the ClassLoader's 
/|defineClass(String

 name, byte[] b, int off, int len)| /
 o works, if using URE to access OOo (i.e. script 
invoked from

   outside OOo),
 o goes out to lunch (no Java catchable exceptions!), 
if the

   same script is dispatched via OOo, i.e. the OOo
   ScriptingFramework.

   The only information that can be gathered from the 
JNI/C++

   code is a Throwable message (/|getMessage()|/) of
   "com/sun/star/awt/XActionListener". This information 
seems

   to come from the defineClass(...) invocation of the OOo
   class loader named "sun.misc.Launcher$AppClassLoader".
...
Changed the JNI code to get the exception type and it is: 
"java.lang.NoClassDefFoundError: com/sun/star/awt/XActionListener".


Not sure how your code looks like exactly; how do you obtain the 
class loader at which you call defineClass?


O.K.: the BSF framework will be used to create an event adapter 
dynamically. Evenutally this uses 
org.apache.bsf.util.event.generator.EventAdapterGenerator 
(generates the byte code according to the supplied argument 
"listener type" class object in a static method 
makeEventAdapterClass()) in which the class loader gets created:


 public static AdapterClassLoader ldr = new AdapterClassLoader();
(The org.apache.bsf.util.event.generator.AdapterClassLoader 
extends ClassLoader.)


If that AdapterClassLoader has no connection to the 
com.sun.star.lib.unoloader.UnoClassLoader, how is it supposed to be 
able to resolve Java classes that represent UNO types?  (As you 
noted, it sometimes can work, a little, by accident, if for example 
the application class loader loads jurt.jar and ridl.jar; but even 
then it will fail for additional UNO types, that are for example 
brought in by OOo extensions.)

[...]
My interest is to find a solution, which allows BSF to remain generic 
(and not making parts of it dependent on OOo custom class loader 
schemes), but being also able to be usable if deployed from OOo.


So, if you have an idea on how one can reliably (and stably for the 
future) come over this situation, I would appreciate it and implement 
it in BSF, hopefully solving this issue once and forever.


From what you write, it looks to me that what is needed is to allow 
clients of BSF to control which class loader is used as the parent 
class loader of AdapterClassLoader instances.
Will have to look into it. However, there is another question beforehand 
for which I would request an answer: for unknown reasons this class not 
found exception cannot be caught from the Java side (JRE 1.6.0_06). If 
it was, it became possible to react accordingly in that class loader.


Is this an issue with the OOo class loader that should be reported in 
order to get it fixed or is this working as designed (and if so, what 
would be the reasoning for it)?


---rony



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



Re: [api-dev] A recapitulation attempt ... (Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-07-03 Thread Rony G. Flatscher



Stephan Bergmann wrote:

Rony G. Flatscher wrote:


Stephan Bergmann wrote:

Rony G. Flatscher wrote:

Hi Jim,

...
   * *creating a class on the fly* by creating the necessary byte 
codes
 saved in a byte array with the ClassLoader's 
/|defineClass(String

 name, byte[] b, int off, int len)| /
 o works, if using URE to access OOo (i.e. script invoked 
from

   outside OOo),
 o goes out to lunch (no Java catchable exceptions!), if the
   same script is dispatched via OOo, i.e. the OOo
   ScriptingFramework.

   The only information that can be gathered from the 
JNI/C++

   code is a Throwable message (/|getMessage()|/) of
   "com/sun/star/awt/XActionListener". This information 
seems

   to come from the defineClass(...) invocation of the OOo
   class loader named "sun.misc.Launcher$AppClassLoader".
...
Changed the JNI code to get the exception type and it is: 
"java.lang.NoClassDefFoundError: com/sun/star/awt/XActionListener".


Not sure how your code looks like exactly; how do you obtain the 
class loader at which you call defineClass?


O.K.: the BSF framework will be used to create an event adapter 
dynamically. Evenutally this uses 
org.apache.bsf.util.event.generator.EventAdapterGenerator (generates 
the byte code according to the supplied argument "listener type" 
class object in a static method makeEventAdapterClass()) in which the 
class loader gets created:


 public static AdapterClassLoader ldr = new AdapterClassLoader();
(The org.apache.bsf.util.event.generator.AdapterClassLoader 
extends ClassLoader.)


If that AdapterClassLoader has no connection to the 
com.sun.star.lib.unoloader.UnoClassLoader, how is it supposed to be 
able to resolve Java classes that represent UNO types?  (As you noted, 
it sometimes can work, a little, by accident, if for example the 
application class loader loads jurt.jar and ridl.jar; but even then it 
will fail for additional UNO types, that are for example brought in by 
OOo extensions.)
BSF supplies generic support and has been used for almost ten years in 
all sort of deployments including IBM's WebSphere for which originally 
BSF got created as an opensource project to allow scripting languages to 
be deployed in JSPs. Knowing Java based application servers/J2EE 
deployment patterns, you will be probably able to acknowledge that all 
kind of complex class loader patterns are in place. BSF has been handed 
over to the Apache Software Foundation and has been deployed in quite a 
few Java based Apache projects (from ant to Xerces), deploying BSF in 
even more challenging environments.


Now, everything has been working fine with this infrastructure, but now 
there is one situation, where it seems that the current OOo custom class 
loader schemes step in and cause a problem. (AFAICT, it worked up to OOo 
2.3.)


My interest is to find a solution, which allows BSF to remain generic 
(and not making parts of it dependent on OOo custom class loader 
schemes), but being also able to be usable if deployed from OOo.


So, if you have an idea on how one can reliably (and stably for the 
future) come over this situation, I would appreciate it and implement it 
in BSF, hopefully solving this issue once and forever.


Regards,

---rony

P.S.: Of course, I also would like that the OOo class loader schemes 
keep the flexibility of Java runtime environments by honoring the 
environment variable CLASSPATH, if set.


P.P.S.: Will only be able to get back in the late afternoon due to a 
tough schedule of meetings.





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



Re: [api-dev] A recapitulation attempt ... (Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-07-02 Thread Rony G. Flatscher


Stephan Bergmann wrote:

Rony G. Flatscher wrote:

Hi Jim,

...
   * *creating a class on the fly* by creating the necessary byte 
codes

 saved in a byte array with the ClassLoader's /|defineClass(String
 name, byte[] b, int off, int len)| /
 o works, if using URE to access OOo (i.e. script invoked from
   outside OOo),
 o goes out to lunch (no Java catchable exceptions!), if the
   same script is dispatched via OOo, i.e. the OOo
   ScriptingFramework.

   The only information that can be gathered from the JNI/C++
   code is a Throwable message (/|getMessage()|/) of
   "com/sun/star/awt/XActionListener". This information seems
   to come from the defineClass(...) invocation of the OOo
   class loader named "sun.misc.Launcher$AppClassLoader".
...
Changed the JNI code to get the exception type and it is: 
"java.lang.NoClassDefFoundError: com/sun/star/awt/XActionListener".


Not sure how your code looks like exactly; how do you obtain the class 
loader at which you call defineClass?


O.K.: the BSF framework will be used to create an event adapter 
dynamically. Evenutally this uses 
org.apache.bsf.util.event.generator.EventAdapterGenerator (generates the 
byte code according to the supplied argument "listener type" class 
object in a static method makeEventAdapterClass()) in which the class 
loader gets created:


 public static AdapterClassLoader ldr = new AdapterClassLoader();
 

(The org.apache.bsf.util.event.generator.AdapterClassLoader extends 
ClassLoader.)


Regards,

---rony



Re: [api-dev] A recapitulation attempt ... (Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-07-01 Thread Rony G. Flatscher

Hi Jim,

...
   * *creating a class on the fly* by creating the necessary byte codes
 saved in a byte array with the ClassLoader's /|defineClass(String
 name, byte[] b, int off, int len)| /
 o works, if using URE to access OOo (i.e. script invoked from
   outside OOo),
 o goes out to lunch (no Java catchable exceptions!), if the
   same script is dispatched via OOo, i.e. the OOo
   ScriptingFramework.

   The only information that can be gathered from the JNI/C++
   code is a Throwable message (/|getMessage()|/) of
   "com/sun/star/awt/XActionListener". This information seems
   to come from the defineClass(...) invocation of the OOo
   class loader named "sun.misc.Launcher$AppClassLoader".
...
Changed the JNI code to get the exception type and it is: 
"java.lang.NoClassDefFoundError: com/sun/star/awt/XActionListener".


That sounds to me very much like the situation I encountered with the 
classpath change for OOo 2.3.  

Probably, as I recall that that had worked on earlier versions of OOo!
[Also I think that a set CLASSPATH environment variable must be honored 
by the OOo customized class loader (as do any of the customized class 
loaders I know of). Cf. 
 for an issue 
which might need more discussion in order to get it moving ahead.]


If you're using any classes in com.sun.star.script.framework.* then 
that is the problem.  Classes in com.sun.star.script.provider.* are OK.  

Hmm, why would that be?

That is why you see org.ifcx.oo.scripting.framework.* classes in G4OO 
which are simply copied & refactored from OOo.


http://ifcx.svn.sourceforge.net/viewvc/ifcx/GroovyForOpenOffice/trunk/src/org/ifcx/oo/scripting/framework/ 

Hmm, that is definiteley something to try out (it's too late now for me, 
but will look into it tomorrow evening), but thanks a *lot* for these 
hints, Jim!


Something I just learned that I do regard as a bug (or at least 
critically needed enhancement) is that although the OOo 2.3 classpath 
change did move the OOo implementation classes out of the extensions' 
classpath, all extensions are in the same classpath (same 
URLClassLoader actually).  That is even worse that having OOo classes 
visible since it is totally unpredicatable and uncontrollable what 
extensions users might install.  But as I say, that is probably 
unrelated to your issue.
Hmm, very interesting too, but you are right, it probably has nothing to 
do with my issue.


Regards,

---rony


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



[api-dev] A recapitulation attempt ... (Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-07-01 Thread Rony G. Flatscher

Hi there,

Waiting a little bit more and giving maybe one more helpful information, 
before filing an issue:


   * loading classes dynamically works (e.g. using Class.forName(...));
 assuming that Jim White's posting meant this kind of dynamic
 loading of a Java class;
   * *creating a class on the fly* by creating the necessary byte codes
 saved in a byte array with the ClassLoader's /|defineClass(String
 name, byte[] b, int off, int len)| /
 o works, if using URE to access OOo (i.e. script invoked from
   outside OOo),
 o goes out to lunch (no Java catchable exceptions!), if the
   same script is dispatched via OOo, i.e. the OOo
   ScriptingFramework.

   The only information that can be gathered from the JNI/C++
   code is a Throwable message (/|getMessage()|/) of
   "com/sun/star/awt/XActionListener". This information seems
   to come from the defineClass(...) invocation of the OOo
   class loader named "sun.misc.Launcher$AppClassLoader".

   [The dynamically created bytecode supplied to
   defineClass(...) should be used for creating a class named
   "org/apache/bsf/util/event/adapters/com_sun_star_awt_XActionAdapter"
   (that implements all XActionListener event methods), which
   package name maps into the existing BSF name space.]

Looking through the code in ScriptProviderForooRexx and 
ScriptSourceModel there seems to be no reason, why a class loader mix-up 
should be assumed (there is no setting of the Thread's context class 
loader which could come into its way). Again, dynamically loading any 
class works without problems in either scenario (and I am pretty sure 
that the dynamic creation of adapter classes worked in pre 2.3 OOo!), on 
the fly creation of a class from a dynamically created bytecode array 
goes unexplicably out to lunch.


Before filing an issue (this situation is quite inhibiting, to say the 
least, giving the importance of event handling), I would like to check 
out whatever those in the know think that I should check out something 
different.


As it stands now, I think that the method "defineClass(name, byte[], 
start, len)" of the OOo custom class loader named 
"sun.misc.Launcher$AppClassLoader" is the culprit. (Also, it seems 
strange to me, that there is no Java-catchable exception thrown by it.)


Regards,

---rony



Rony G. Flatscher wrote:

Hi Jim,
If so, how do you dynamically define classes? 
Are you using dynamic loading via a byte array of bytecodes? And if so 
in Java 1.1. form?


Could you send me the respective code or let me know where it could 
be downloaded from?
Thank you very much for those hints and pointers! (Though, will take 
me a while to dig into and digest it.)


Regards,

---rony




Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-06-30 Thread Rony G. Flatscher

Hi Jim,
If so, how do you dynamically define classes? 
Are you using dynamic loading via a byte array of bytecodes? And if so 
in Java 1.1. form?


Could you send me the respective code or let me know where it could 
be downloaded from?
Thank you very much for those hints and pointers! (Though, will take me 
a while to dig into and digest it.)


Regards,

---rony






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



Re: [api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-06-30 Thread Rony G. Flatscher

Hi Jim,
running a macro which gets dispatched as a macro via the OOo 2.4.1 
Java bridge (the Java scripting framework of OOo) will be aborted, if 
the Java support (Apache BSF, cf. ) 
creates dynamically an event adapter. Running the same program via 
URE succeeds!


The Apache BSF employs its own class loader (extending 
java.lang.ClassLoader) for caching the dynamically created event 
adapter classes (done in 
org.apache.bsf.util.event.generator.AdapterClassLoader). 
Unfortunately, when dispatched by OOo 2.4.1 as a macro invoking 
ClassLoader.defineClass() causes an (uncatchable!) abend. (Running 
the same code via URE works as expected.)


What causes this surprising behaviour, and even more important, how 
can one come by it! (Support for dynamic languages is dependent on 
being able to create Java classes on the fly from time to time.)


The likely cause is some code that is loaded by a parent classloader 
trying to find the class in the generator's classloader.


The usual solution is to use the thread context classloader.
Yes. However, it *is* using the context thread loader (just double 
checked).


If the same script is run from outside of OpenOffice, i.e. using the 
plain Java class loaders, everything works fine and as expected!


So therefore I speculate, that this behaviour has to do with the OOo 
custom class loader in effect ("sun.misc.Launcher$AppClassLoader"), when 
running the script via OOo's scripting framework: the problem occurs 
when a class object should be created from a byte array using super's 
"/defineClass(String n|ame, byte[] b, int off, int len)|/ ".


The "name" of the class to be defined in this case is: 
"org/apache/bsf/util/event/adapters/com_sun_star_awt_XActionAdapter".


---

*Strangely*, there is *no* catchable exception thrown (at the Java 
side), the invocation just seems to stop without any further notice!
However, coming back to JNI-code an exception on the Java side is 
noticed where the "getMessage()" returns the string 
"com/sun/star/awt/XActionListener".


You should be very careful to do any changing of the 
contextClassLoader in a try-finally block so that you don't expose the 
OOo code that calls your to a strange classloader.

Right, looking over the code, so it should.


P.S.: Ad Beta 3.0, Dev300m21: currently I am not able to add the 
scripting package (same package can be added to 2.4). Were there any 
changes to the OOo scripting framework for OOo 3.0 which one needs to 
take into account? If so, where would that be documented?


I've successfully run GroovyForOpenOffice and IFCX Wings on OOo 3.0 
Beta m20 without changes from those needed for OOo 2.3 (which did 
break extensions that access the Scripting Framework Java API).
Are you able to get your GroovyForOpenOffice scripts dispatched as 
macros from OOo 2.4.x or 3.0 Beta m20? I.e. choosing 
"Extras->Macros->Run" or the like?


If so, how do you dynamically define classes? Could you send me the 
respective code or let me know where it could be downloaded from?



I recently posted to an old thread of yours on that issue:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg00794.html

Yes, I saw that post and I agree.

The only significant problem I'm having with OOo 3.0 is on PPC OS X 
where anything with Swing hangs the whole application.

Regards,

---rony




[api-dev] Class loader problem with OOo 2.4, what may be the cause, how to come by ?

2008-06-28 Thread Rony G. Flatscher

Hi there,

running a macro which gets dispatched as a macro via the OOo 2.4.1 Java 
bridge (the Java scripting framework of OOo) will be aborted, if the 
Java support (Apache BSF, cf. ) creates 
dynamically an event adapter. Running the same program via URE succeeds!


The Apache BSF employs its own class loader (extending 
java.lang.ClassLoader) for caching the dynamically created event adapter 
classes (done in 
org.apache.bsf.util.event.generator.AdapterClassLoader). Unfortunately, 
when dispatched by OOo 2.4.1 as a macro invoking 
ClassLoader.defineClass() causes an (uncatchable!) abend. (Running the 
same code via URE works as expected.)


What causes this surprising behaviour, and even more important, how can 
one come by it! (Support for dynamic languages is dependent on being 
able to create Java classes on the fly from time to time.)


---rony

P.S.: Ad Beta 3.0, Dev300m21: currently I am not able to add the 
scripting package (same package can be added to 2.4). Were there any 
changes to the OOo scripting framework for OOo 3.0 which one needs to 
take into account? If so, where would that be documented?





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



Re: [api-dev] Java documentation for instantiating new style services? (Re: [api-dev] ScriptURIHelper, a question ad "getStorageURI()" and libraries

2008-06-18 Thread Rony G. Flatscher

Hi Ariel,


just a question looking at your Java code example:
... cut ..

xScriptURIHelper = ScriptURIHelper.create( xContext,sLanguage, sLoc );
  

... cut ...

Where did you find the documentation about this variant of instantiating
a new style services?



mmm ... is it documented somewhere? ... yes in Professional UNO:
Java language binding
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Java/Mapping_of_Services
C++ language binding
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/Mapping_of_Services

"The semantics of both explicit and implicit service constructors in C++
are as follows. They are the same as for Java:
* The first argument to a service constructor is always a
com.sun.star.uno.XComponentContext, which must be a non-null reference.
[...]"
  

Did I already mention that you are the *best*?
;-)

Thank's an awful lot!


but to be honest I didn't learn it from the Dev's Guide, but thanks to
the code completion in NetBeans/MS Visual Studio/et.al.
  

8-)

---

This is just for the record how one would be able to take advantage of 
the new style service instantiation from ooRexx (and depicting the 
"classic" style for comparison):


   -- * ooRexx *
   xContext = uno.connect()  -- connect to server and retrieve the XContext

  /* load the UNO class */
   clz=uno.loadClass("com.sun.star.script.provider.ScriptURIHelper")

  /* new style service, returns already a XScriptURIHelper interface 
object! */
   xScriptURIHelper = clz~create(xContext,"ooRexx","share")
   ...
 


Or (classic style instantiation):

   -- * ooRexx *
   xContext = uno.connect()  -- connect to server and retrieve the XContext
   oSM  = xContext~getServiceManager  -- retrieve XMultiComponentFactory

  /* create the service object */
   sSrvc = "com.sun.star.script.provider.ScriptURIHelper"

   mArgs = uno.createArray(.bsf4rexx~string.class, 2) /* create a 
java.lang.String array */
   mArgs[1]="ooRexx"/* assign first argument   */
   mArgs[2]="share" /* assign second argument  */

   oScriptURIHelper = 
oSM~createInstanceWithArgumentsAndContext(sSrvc,mArgs,xContext)
   xScriptURIHelper = oScriptURIHelper~XScriptUriHelper  /* query its interface 
*/
   ...
 


That's *quite* a difference in coding efforts !

Regards,

---rony





[api-dev] Bug in ScriptURIHelper.getStorageURI() ? ( Re: [api-dev] ScriptURIHelper, a question ad "getStorageURI()" and libraries

2008-06-18 Thread Rony G. Flatscher

Hi there,

maybe one of the questions was buried to deep in this thread.

Looking at the following input and output from 
ScriptURIHelper.getStorageURI() it seems that there is a bug, in that 
the directory (dubbed "library" in the scripting framework) which 
contains the scripts is not resolved correctly. The "library" part is 
not delimited with the 'file.separator' character, but with a dot !



... cut ...

as we have it in OOo Basic and ooRexx, here is in Java:

//***
import com.sun.star.uno.XComponentContext;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.script.provider.ScriptURIHelper;
import com.sun.star.script.provider.XScriptURIHelper;

/**
 *
 * @author ariel
 */
public class ScriptURIHelperDemo {


/** Creates a new instance of ScriptURIHelperDemo */
public ScriptURIHelperDemo() {
}

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
try {
String[][] sScripts = {
{
"Basic", "user",// Language, Location
"vnd.sun.star.script:Standard.Module1.Main?" + 
"language=Basic&location=application"// Script URI

},
{
"BeanShell", "share",
"vnd.sun.star.script:HelloWorld.helloworld.bsh?" + 
"language=BeanShell&location=share"

},
{
"JavaScript", "share",
"vnd.sun.star.script:HelloWorld.helloworld.js?" + 
"language=JavaScript&location=share"

},
{
"Java", "share",

"vnd.sun.star.script:HelloWorld.HelloWorld.printHW?" + 
"language=Java&location=share"

},
{
"Python", "share",
 
"vnd.sun.star.script:pythonSamples|TableSample.py$createTable?" + 
"language=Python&location=share"

}
};

// get the remote office component context
XComponentContext xContext = Bootstrap.bootstrap();

XScriptURIHelper xScriptURIHelper; String sLanguage, sLoc;

for (String[] scripts : sScripts) {
sLanguage = scripts[0];
sLoc = scripts[1];


System.out.printf("*" + 
"%n%s - %s%n%n", sLanguage, sLoc);


xScriptURIHelper = ScriptURIHelper.create( xContext, 
sLanguage, sLoc );


System.out.printf("getRootStorageURI() - %s%n%n", 
xScriptURIHelper.getRootStorageURI() );


String sOriginalURI = scripts[2];
String sStorageURI = xScriptURIHelper.getStorageURI( 
sOriginalURI );
String sScriptURI = xScriptURIHelper.getScriptURI( 
sStorageURI );


System.out.printf( "script URI - %s%n" + 
"getStorageURI() - %s%n" + "getScriptURI() - %s%n%n", sOriginalURI, 
sStorageURI, sScriptURI);

}
} catch (java.lang.Exception e) {
e.printStackTrace();
} finally {
System.exit(0);
}
}
}

//***


the output in Linux/SuSe is

*
Basic - user

getRootStorageURI() - 
file:///home/ariel/.openoffice.org2/user/Scripts/basic


script URI -
vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application 


getStorageURI() -
file:///home/ariel/.openoffice.org2/user/Scripts/basic/Standard.Module1.Main 


getScriptURI() -
vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=user

*
BeanShell - share

getRootStorageURI() -
file:///opt/openoffice.org2.4/program/../share/Scripts/beanshell

script URI -
vnd.sun.star.script:HelloWorld.helloworld.bsh?language=BeanShell&location=share 


getStorageURI() -
file:///opt/openoffice.org2.4/program/../share/Scripts/beanshell/HelloWorld.helloworld.bsh 


getScriptURI() -
vnd.sun.star.script:HelloWorld.helloworld.bsh?language=BeanShell&location=share 



*
JavaScript - share

getRootStorageURI() -
file:///opt/openoffice.org2.4/program/../share/Scripts/javascript

script URI -
vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share 


getStorageURI() -
file:///opt/openoffice.org2.4/program/../share/Scripts/javascript/HelloWorld.helloworld.js 


getScriptURI() -
vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share 



*
Java - share

getRootStorageURI() -
file:///opt/openoffice.org2.4/program/../share/Scripts/java

script URI -
vnd.sun.star.script:HelloWorld.HelloWorld.printHW?language=Java&location=share 


getStorageURI() -
file:///opt/openoffice.org2.4/program/../share/Scripts/java/HelloWorld

[api-dev] Java documentation for instantiating new style services? (Re: [api-dev] ScriptURIHelper, a question ad "getStorageURI()" and libraries

2008-06-17 Thread Rony G. Flatscher

Hi Ariel,

just a question looking at your Java code example:

... cut ...

xScriptURIHelper = ScriptURIHelper.create( xContext, 
sLanguage, sLoc );

... cut ...

Where did you find the documentation about this variant of instantiating 
a new style services?
(Was only aware of the creation with the help of a service manager. 
Also, looking up the IDL definition would show the method create() as a 
constructor, but the signature lacks the first argument xContext 
altogether!)


Regards,

---rony



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



Re: [api-dev] convertToURL() and convertFromURL() for languages other than OOo Basic [was: Possibly a stupid question ...]

2008-06-17 Thread Rony G. Flatscher

Hi Ariel,



Ariel Constenla-haile wrote:

Hi Rony,

Rony G. Flatscher escribió:
  

could anyone point me to the UNO service that one is supposed to use to
convert a fully qualified file to the UNO URI, which could be used from
Java and/or C++?



com.sun.star.ucb.FileContentProvider implements
com.sun.star.ucb.XFileIdentifierConverter
  
As usual, Ariel: you are the *best*, thank you very much again (I have 
been looking for hours in the docs/IDL definition without finding this)!!



see the example in
http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=19331 where I
named the two Java methods convertToURL and convertFromURL ...
and you could have answered yourself ;-)
http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=19335 and
teach yourself the ooRexx version :-)
  
Ahem, I only vaguely remembered that (and obviously did not save it 
locally and was not able to find my own posting myself) !

:-(

The reason for looking for this is a change I need to make in a piece of 
Java code and thought that the Java snippet 
<http://codesnippets.services.openoffice.org/Office/Office.CreateUNOCompatibleURL.snip> 
would be a little bit too cumbersome (though, if I had used it 
immediately, I might have saved myself a couple of hours of research, 
OTOH I would not have "stumbled" over all kind of interesting services)...


Again, thank you very much!

Regards,

---rony

P.S.: The ooRexx support has the public routines uno.convertToUrl() and 
uno.convertFromUrl()  but coded in ooRexx itself. Will probably use the 
OOo service just to make sure that I won't forget those services so 
quickly anymore...
(My only excuse for totally forgetting this is that I am totally 
overworked, but then, everyone on these lists has probably the same 
difficulty.)





[api-dev] Possibly a stupid question ...

2008-06-17 Thread Rony G. Flatscher

Hi there,

could anyone point me to the UNO service that one is supposed to use to 
convert a fully qualified file to the UNO URI, which could be used from 
Java and/or C++?


[I seem to vaguely remember that such a service existed, but after 
researching for quite some time, nothing showed up that would have the 
counterpart methods for e.g. Basic's convertToURL() or convertFromURL()...]


Possibly this is a stupid question, because the service name would be 
named so obviously, that one should get at it on its own...


TIA,

---rony



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



Re: [api-dev] ScriptURIHelper, a question ad "getStorageURI()" and libraries

2008-06-16 Thread Rony G. Flatscher

Hi Ariel,
Ariel Constenla-Haile wrote:

[thanks for the flowers on your previous mail :-)  ]

Ehre, wem Ehre gebührt!
:)



as we have it in OOo Basic and ooRexx, here is in Java:

Thanks, great!


the output in Linux/SuSe is

Great, thank you for that as well!


in all the cases the "physical" LibraryContainer/Script [for example
user/basic/Standard/Module1.xba] seems to turns to
LibraryContainer.Script with getStorageURI()


* in OOo Basic
vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application 


turns to
file:///home/ariel/.openoffice.org2/user/Scripts/basic/Standard.Module1.Main 


 instead of
file:///home/ariel/.openoffice.org2/user/Scripts/basic/Standard/Module1.Main 



* BeanShell
vnd.sun.star.script:HelloWorld.helloworld.bsh?language=BeanShell&location=share 

file:///opt/openoffice.org2.4/program/../share/Scripts/beanshell/HelloWorld.helloworld.bsh 


instead of ../share/Scripts/beanshell/HelloWorld/helloworld.bsh

* JavaScript
vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share 

file:///opt/openoffice.org2.4/program/../share/Scripts/javascript/HelloWorld.helloworld.js 


instead of ../share/Scripts/javascript/HelloWorld/helloworld.js


* Java
vnd.sun.star.script:HelloWorld.HelloWorld.printHW?language=Java&location=share 

file:///opt/openoffice.org2.4/program/../share/Scripts/java/HelloWorld.HelloWorld.printHW 


instead of ../share/Scripts/java/HelloWorld/HelloWorld.printHW


The Python example may look special:

vnd.sun.star.script:pythonSamples|TableSample.py$createTable?language=Python&location=share 


turns to
file:///opt/openoffice.org2.4/program/../share/Scripts/python/pythonSamples/TableSample.py$createTable 



while the "real" location is
/opt/openoffice.org2.4/share/Scripts/python/pythonSamples/TableSample.py


The bottom line: I've no idea what rule it follows

* for using the dot instead of the slash
* for using "$" in the Python example instead of the point, as in
Standard.Module1.Main (instead of Standard.Module1$Main)
It seems to me that the dollar sign is just a delimiter between the file 
name containing the Python code and the Python function that should be 
run within that file.


Here is the output of running a Python script URL using the dot between 
the root directory and the subdirectory where the Python script is located:


   
[vnd.sun.star.script:pythonSamples.TableSample.py$createTable?language=Python&location=share]:
  
   file:///D:/Programme/OpenOffice.org%202.4/share/Scripts/oorexx/pythonSamples.TableSample.py$createTable
  
   vnd.sun.star.script:pythonSamples.TableSample.py$createTable?language=ooRexx&location=share




Another good question I didn't try yet is: what are we allowed to do
with this storage URI? can it be used with UCB methods to access the
storage?
Well, it is helpful already to turn a script with a physical path into 
the script URI OOo expects us to use.



I found this ScriptURIHelper looking for a better way to embedded Java
Archives (JARs) and Python scripts inside OOo documents, as the
Scripting Framework has left them alone [can ooRexx be also embedded
inside OOo docs.?]. 

Yes.

Currently I'm using the embed API 
(http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.html) 


to store the JAR and the parcel descriptor.
Well, ooRexx is using the Java scripting framework of OOo, which is also 
used for BeanShell or JavaScript (Rhino, the Java implementation by 
Mozilla), if I am not mistaken. This framework will allow to create and 
store scripts with "user", "share" or "document".


The ooRexx (written in C++) support uses the Java scripting framework 
BSF (Bean Scripting Framework) from Apache, cf. 
, which allows Java programs to easily 
employ any of its supported scripting languages, and vice versa, 
BSFEngine implementations may allow scripting languages to interact with 
Java objects. So in essence this is what happens:


   ooRexx-script <-> BSF4Rexx <-> OOo Scripting Framework <-> OOo

Again, the BSF framework is a Java framework and could be used to make 
more scirpting languages available to OOo. The ooRexx support could 
serve as a model for it.


Was thinking about offering/submitting a talk on the architecture and 
what one could do with it for UNO/OOo for the OOo-Con, but am unsure 
whether such a topic would be interesting for the attendees. (Although 
it may be interesting for developers for learning how one would proceed 
in order to add new scripting languages to OOo. Having all nuts and 
bolts put on the table and learning how the parts play together could 
help jump-start others.)




Another thing I didn't try is if/how the ScriptURIHelper works when the
script is located inside a document.
Just tested this: there will be an exception thrown, if you try to use 
"document" as location. Currently the valid argument values for 
"location" seem to be "user" and "share".


Regards,

---rony



[api-dev] ScriptURIHelper, a question ad "getStorageURI()" and libraries ( Re: [api-dev] How to get the canonical path from a script URL, or at least the root directories "user" and "share" in a rel

2008-06-15 Thread Rony G. Flatscher

Hi Paolo,

Paolo Mantovani wrote:

Hi Ariel,

Il sabato 14 giugno 2008 22:13:45 Ariel Constenla-Haile ha scritto:
[]
  

http://api.openoffice.org/docs/common/ref/com/sun/star/script/provider/Scri
ptURIHelper.html for the service description ("This service is used to help
transform Scripting Framework storage locations to Scripting Framework
script URIs and vice versa."), this *seems* to be what you're looking for
(didn't try it yet in Basic, as there is no simple way to instantiate a
new-style service here; 



I must admit that I don't know the exact meaning of "new-style service" but 
I've tried with createInstanceWithArguments on the service manager and it 
seems to work:
  
Studying your sample I transcribed it to ooRexx and tested the service 
with the "shortFormScriptURL", but also with the "scriptFullURL", which 
contains an expansion part, and the service processes both in the same 
manner.


The service's "getScriptURI()" always returns the short form script URL, 
which has a potential symbolic path part expanded already, which is very 
useful as well. But it seems as if there is a bug, if a library is 
involved (see below).


Just for the record (and because the student in cc: may need it) the 
ooRexx transcription:


   -- * ooRexx *
   xContext = uno.connect()  -- connect to server and retrieve the XContext
   oSM  = xContext~getServiceManager  -- retrieve XMultiComponentFactory

  /* create the service object */
   sSrvc = "com.sun.star.script.provider.ScriptURIHelper"

   mArgs = uno.createArray(.bsf4rexx~string.class, 2) /* create a 
java.lang.String array */
   mArgs[1]="ooRexx"/* assign first argument   */
   mArgs[2]="share" /* assign second argument  */

   oScriptURIHelper = 
oSM~createInstanceWithArgumentsAndContext(sSrvc,mArgs,xContext)
   xScriptURIHelper = oScriptURIHelper~XScriptUriHelper  /* query its interface 
*/

  /* query the storage URI of this language root directory */
   say xScriptURIHelper~getRootStorageURI

  /* define array of scriptURIs and query their storage URI */
   scriptURIS = .array~of( -
  
"vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share",
 -
  
"vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::BaseInstallation}/share/Scripts/oorexx/Library1"
 )

   do scriptURI over scriptURIS
  say
  say pp(scriptURI)":"
  storageURI = xScriptURIHelper~getStorageURI(scriptURI)
  say "   " storageURI

 /* query script URI from its storage URI */
  scriptURI = xScriptURIHelper~getScriptURI(storageURI)
  say "   " scriptURI
   end

   ::requires uno.cls   -- get the UNO support for ooRexx (exploiting the Java 
interfaces)
 



Running the above program from the command line on WXP will yield as its 
output:


   E:\rony\dev\bsf\src\samples\OOo>testScriptUriHelper.rex
   file:///D:/Programme/OpenOffice.org%202.4/share/Scripts/oorexx

   
[vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share]:
   
file:///D:/Programme/OpenOffice.org%202.4/share/Scripts/oorexx/Library1.metaDataInfosShare.rex
   
vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share

   
[vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini:
   :BaseInstallation}/share/Scripts/oorexx/Library1]:
   
file:///D:/Programme/OpenOffice.org%202.4/share/Scripts/oorexx/Library1.metaDataInfosShare.rex
   
vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share
 

Looking at the results of "getStorageURI()" the libarary name "Library1" 
should be delimited from the script's name "metaDataInfosShare" by the 
file separator character "/" (i.e., the dot would need to be turned into 
a slash).


Is this a bug or a feature?

Regards,

---rony



Re: [api-dev] How to get the canonical path from a script URL, or at least the root directories "user" and "share" in a reliable manner ?

2008-06-14 Thread Rony G. Flatscher

Hi Ariel,

you are the best, thank you very much for your help and especially your 
pointers!



Ariel Constenla-Haile wrote:

Rony G. Flatscher escribió:

Hi there,

have tried to research the service needed for expanding a script URL 
to its canonical path to no avail.


E.g. given the following infos from OOo, how would one be able to get 
at the canonical path (fully qualified, but shortest operating system 
dependent path, but the OOo-URL rendering of it would be fine as well)?


   * parcelLocation
 o 
vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::UserInstallation}/user/Scripts/oorexx/Library3-Tests 



 o 
vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::BaseInstallation}/share/Scripts/oorexx/Library1 



   * shortFormScriptURL
 o 
vnd.sun.star.script:Library3-Tests.metaDataInfosUser.rex?language=ooRexx&location=user 



 o 
vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share 



   * scriptFullURL
 o  
vnd.sun.star.script:Library3-Tests.metaDataInfosUser.rex?language=ooRexx&location=vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::UserInstallation}/user/Scripts/oorexx/Library3-Tests 



 o 
vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::BaseInstallation}/share/Scripts/oorexx/Library1 




Or, alternatively: how can one reliably infer the canonical path to 
the "user" and "share" root directory with the help of OOo services? 
Would that solution work for 3.x as well?


TIA,

---rony


Hi Rony,

I'm not sure about the first part of your question, so I answer first
your "at least".

For getting the "user" and "share" you can try with:

http://api.openoffice.org/docs/common/ref/com/sun/star/util/PathSubstitution.html 

http://api.openoffice.org/docs/common/ref/com/sun/star/util/PathSettings.html 

Found the above two and experimented with them already. However, I have 
felt a little bit unsecure whether the assumptions one needs to apply in 
order to build the physical path to the user and share level macros 
would be stable, especially when 3.0 comes along.


http://api.openoffice.org/docs/common/ref/com/sun/star/util/OfficeInstallationDirectories.html 

This one was new, thank you! (But again, the same considerations would 
apply as for the above two starting points.)




Bellow [1] is a demo (results from DEV300_m19).

For your original question (expand a script URL), you may take a look at

*
http://api.openoffice.org/docs/common/ref/com/sun/star/util/theMacroExpander.html 


I've tested this [2] on other subjects, but not with Scripts URIs

*That was it*! Thank you *very* much, Ariel!

This singleton is able to expand the "parcelLocation" and the 
"scriptFullUrl" encodings above.


Here is an ooRexx script that tests that singleton:

   /* an ooRexx script for testen the theMacroExpander singleton */
   xContext = UNO.connect()  -- connect to server and retrieve the XContext 
object

   xme= 
xContext~getValueByName("/singletons/com.sun.star.util.theMacroExpander")~XMacroExpander

   macrofiedExpressions= .array~of( -
  
"vnd.sun.star.script:Library3-Tests.metaDataInfosUser.rex?language=ooRexx&location=user"
 , -
  
"vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share"
 , -
  
"vnd.sun.star.script:Library3-Tests.metaDataInfosUser.rex?language=ooRexx&location=vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::UserInstallation}/user/Scripts/oorexx/Library3-Tests",
 -
  
"vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::BaseInstallation}/share/Scripts/oorexx/Library1"
  , -
  
"vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::UserInstallation}/user/Scripts/oorexx/Library3-Tests"
 , -
  
"vnd.sun.star.expand:${$SYSBINDIR/bootstrap.ini::BaseInstallation}/share/Scripts/oorexx/Library1"
-
  )

   do expr over macrofiedExpressions  -- iterate over the collection
  say pp(expr)":" -- show macrofied expression
  say "  " pp(xme~expandMacros(expr)) -- expand and show the expression
  say
   end

   ::requires uno.cls   -- get the UNO support for ooRexx (exploiting the Java 
interfaces)

 

The output produced matches the location on my PC (in this case a 
Windows XP laptop):


   F:\test\ooo\studenten\macroExpansions>testMacroExpander.rex
   
[vnd.sun.star.script:Library3-Tests.metaDataInfosUser.rex?language=ooRexx&location=user]:
  
[vnd.sun.star.script:Library3-Tests.metaDataInfosUser.rex?language=ooRexx&location=user]

   
[vnd.sun.star.script:Library1.metaDataInfosShare.rex?language=ooRexx&location=share]:
  
[vnd.sun.star.script:Libra

Re: [api-dev] How to use "com.sun.star.ui.dialogs.FolderPicker" such that it works as documented ?

2008-06-14 Thread Rony G. Flatscher

Hi Ariel, hi Bernard,

thank you both for your interesting pointers!

Regards,

---rony


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



Re: [api-dev] How to use "com.sun.star.ui.dialogs.FolderPicker" such that it works as documented ?

2008-06-14 Thread Rony G. Flatscher

Hi Thomas,


Rony G. Flatscher schrieb:
[..]
  
Ha, one question in this context that you may by chance be able to 
answer: how would it be possible to set (query) that setting via a script?



Not nessessary to do this. Just use
com.sun.star.ui.dialogs.OfficeFolderPicker - then it is the right dialog
every time :-)
  

*WOW* !

Where did you get this nice piece of information from ?
(It certainly cannot be found at 
<http://api.openoffice.org/docs/common/ref/com/sun/star/ui/dialogs/module-ix.html>.)


Regards,

---rony



Re: [api-dev] How to use "com.sun.star.ui.dialogs.FolderPicker" such that it works as documented ?

2008-06-14 Thread Rony G. Flatscher

Hi Thomas,


Platform is Windows XP SP 3.


[..]
  
However, this does not work at all. Tried all variations (system file 
path, URL, with and without trailing slash, feeding the directory path 
exactly like the service returns it).



It is a bug of Windows - i guess, you use the windows own dialogs?

Change to OpenOffice.org own dialogs (Extras - options - OOo - general)
and it will work :-)
  

Wow, that was it! Thank you *very* much, indeed!

Ha, one question in this context that you may by chance be able to 
answer: how would it be possible to set (query) that setting via a script?


Regards,

---rony



  1   2   3   >