Re: [dev] Adding menus / menu items at Runtime
Hi Kent, I found this helpful: http://documentation.openoffice.org/HOW_TO/various_topics/HowTo_modify_context_menu.pdf however this may only be relevant to the context menu. yes, its only for the context menu. I will throw a glance on it. Thanks, Tobias --- Tobias Krais [EMAIL PROTECTED] wrote: Hi together, since some weeks I'm developing a little OpenOffice connector for a program we develeped (called JUDAS: www.judas.de). At the moment I try to add a menu called JUDAS to the menu bar at runtime. I found how to disable menus at runtime, but not how to add them. You may ask why is it necessary that the menus should be added at runtime. The menus should appear only if OpenOffice was started by JUDAS. If the user starts OpenOffice by itself, the menu should not appear. My question is: is it possible to generate menus at runtime? We are using OOo2. If yes, do you have examples or know where I should start studying? If not, how would you solve this issue? Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Adding menus / menu items at Runtime
Hi Carsten, My question is: is it possible to generate menus at runtime? We are using OOo2. If yes, do you have examples or know where I should start studying? I think I answered this question on the mailing list api.openoffice.org several times. I attached two small examples which modifies the menu bar of an application module. If you only want to do temporary changes, please use the transient example. Thanks a lot. I will try the transient example because only temporary changes are needed. Is it possible to do the same in Java? At the moment I am searching the ML archiv dev@api.openoffice.org for this topic. Thanks for the hint. Greetings, Tobias Regards, Carsten REM * BASIC * Sub Main REM *** Adds a item to the File Menu only transient. Means REM *** that this menu item only exists for and during the REM *** lifetime of the current frame. REM *** Initialize strings sMenuBar = private:resource/menubar/menubar sMyPopupMenuCmdId = .uno:PickList sMyCommand = macro:///Standard.Module1.Test() REM *** Retrieve the current frame of my model oModel = ThisComponent if not isNull( oModel ) then REM *** Retrieve frame from current controller oFrame = oModel.getCurrentController().getFrame() REM *** Retrieve the layout manager of my current frame oLayoutManager = oFrame.LayoutManager() REM *** Retrieve the menu bar from the layout manager oMenuBar = oLayoutManager.getElement( sMenuBar ) REM *** Retrieve writable configuration settings from menu bar oMenuBarSettings = oMenuBar.getSettings( true ) REM *** Make our changes only transient. An Add-on should REM *** never change configuration persistently as it can REM *** be deinstalled by a user without any chance to REM *** undo its configuration changes! REM *** Please look for bug #i46194 which prevents using REM *** oMenuBar.Persistent = false!! oMenuBar.Persistent = false REM *** Look for the File popup menu and add our command REM *** We must look if we haven't added our command already! fileMenuIndex = FindPopupMenu( sMyPopupMenuCmdId, oMenuBarSettings ) if fileMenuIndex = 0 then oPopupMenuItem() = oMenuBarSettings.getByIndex(fileMenuIndex) oPopupMenu = GetProperty( ItemDescriptorContainer, oPopupMenuItem() ) if not isNull( oPopupMenu ) then if FindCommand( sMyCommand, oPopupMenu ) = -1 then oMenuItem = CreateMenuItem( sMyCommand, Standard.Module1.Test ) nCount = oPopupMenu.getCount() oPopupMenu.insertByIndex( nCount, oMenuItem ) endif endif else msgbox No file menu found! endif oMenuBar.setSettings( oMenuBarSettings ) endif End Sub Function FindCommand( Command as String, oPopupMenu as Object ) as Integer nCount = oPopupMenu.getCount()-1 for i = 0 to nCount oMenuItem() = oPopupMenu.getByIndex(i) nPropertyCount = ubound(oMenuItem()) for j = 0 to nPropertyCount if oMenuItem(j).Name = CommandURL then if oMenuItem(j).Value = Command then FindCommand = j exit function endif endif next j next i FindCommand = -1 End Function Function FindPopupMenu( Command as String, oMenuBarSettings as Object ) as Integer for i = 0 to oMenuBarSettings.getCount()-1 oPopupMenu() = oMenuBarSettings.getByIndex(i) nPopupMenuCount = ubound(oPopupMenu()) for j = 0 to nPopupMenuCount if oPopupMenu(j).Name = CommandURL then if oPopupMenu(j).Value = Command then FindPopupMenu = j exit function endif endif next j next i FindPopupMenu = -1 End Function Function GetProperty( PropertyName as String, properties() as Variant ) as Variant for j = lbound( properties() ) to ubound( properties() ) oPropertyValue = properties(j) if oPropertyValue.Name = PropertyName then GetProperty = oPropertyValue.Value exit function endif next j GetProperty = null end function Function CreateMenuItem( Command as String, Label as String ) as Variant Dim aMenuItem(2) as new com.sun.star.beans.PropertyValue aMenuItem(0).Name = CommandURL aMenuItem(0).Value = Command aMenuItem(1).Name = Label aMenuItem(1).Value = Label aMenuItem(2).Name = Type aMenuItem(2).Value = 0 CreateMenuItem = aMenuItem() End Function Sub Test MsgBox Test End Sub REM * BASIC * Sub Main REM *** Creates a top-level popup menu on the Writer menu bar persistently. REM *** It checks if its popup menu has already been added to the menu bar
Re: [dev] Adding menus / menu items at Runtime
Couldn't you package this as an Code-Snippet. Using Paolos Snippet-Creator found here this would take less than a minute ;-) http://www.paolo-mantovani.org/ Tom Carsten Driesner wrote: Tobias Krais wrote: Hi together, since some weeks I'm developing a little OpenOffice connector for a program we develeped (called JUDAS: www.judas.de). At the moment I try to add a menu called JUDAS to the menu bar at runtime. I found how to disable menus at runtime, but not how to add them. You may ask why is it necessary that the menus should be added at runtime. The menus should appear only if OpenOffice was started by JUDAS. If the user starts OpenOffice by itself, the menu should not appear. My question is: is it possible to generate menus at runtime? We are using OOo2. If yes, do you have examples or know where I should start studying? Hi Tobias, I think I answered this question on the mailing list api.openoffice.org several times. I attached two small examples which modifies the menu bar of an application module. If you only want to do temporary changes, please use the transient example. Regards, Carsten REM * BASIC * Sub Main REM *** Adds a item to the File Menu only transient. Means REM *** that this menu item only exists for and during the REM *** lifetime of the current frame. REM *** Initialize strings sMenuBar = private:resource/menubar/menubar sMyPopupMenuCmdId = .uno:PickList sMyCommand = macro:///Standard.Module1.Test() REM *** Retrieve the current frame of my model oModel = ThisComponent if not isNull( oModel ) then REM *** Retrieve frame from current controller oFrame = oModel.getCurrentController().getFrame() REM *** Retrieve the layout manager of my current frame oLayoutManager = oFrame.LayoutManager() REM *** Retrieve the menu bar from the layout manager oMenuBar = oLayoutManager.getElement( sMenuBar ) REM *** Retrieve writable configuration settings from menu bar oMenuBarSettings = oMenuBar.getSettings( true ) REM *** Make our changes only transient. An Add-on should REM *** never change configuration persistently as it can REM *** be deinstalled by a user without any chance to REM *** undo its configuration changes! REM *** Please look for bug #i46194 which prevents using REM *** oMenuBar.Persistent = false!! oMenuBar.Persistent = false REM *** Look for the File popup menu and add our command REM *** We must look if we haven't added our command already! fileMenuIndex = FindPopupMenu( sMyPopupMenuCmdId, oMenuBarSettings ) if fileMenuIndex = 0 then oPopupMenuItem() = oMenuBarSettings.getByIndex(fileMenuIndex) oPopupMenu = GetProperty( ItemDescriptorContainer, oPopupMenuItem() ) if not isNull( oPopupMenu ) then if FindCommand( sMyCommand, oPopupMenu ) = -1 then oMenuItem = CreateMenuItem( sMyCommand, Standard.Module1.Test ) nCount = oPopupMenu.getCount() oPopupMenu.insertByIndex( nCount, oMenuItem ) endif endif else msgbox No file menu found! endif oMenuBar.setSettings( oMenuBarSettings ) endif End Sub Function FindCommand( Command as String, oPopupMenu as Object ) as Integer nCount = oPopupMenu.getCount()-1 for i = 0 to nCount oMenuItem() = oPopupMenu.getByIndex(i) nPropertyCount = ubound(oMenuItem()) for j = 0 to nPropertyCount if oMenuItem(j).Name = CommandURL then if oMenuItem(j).Value = Command then FindCommand = j exit function endif endif next j next i FindCommand = -1 End Function Function FindPopupMenu( Command as String, oMenuBarSettings as Object ) as Integer for i = 0 to oMenuBarSettings.getCount()-1 oPopupMenu() = oMenuBarSettings.getByIndex(i) nPopupMenuCount = ubound(oPopupMenu()) for j = 0 to nPopupMenuCount if oPopupMenu(j).Name = CommandURL then if oPopupMenu(j).Value = Command then FindPopupMenu = j exit function endif endif next j next i FindPopupMenu = -1 End Function Function GetProperty( PropertyName as String, properties() as Variant ) as Variant for j = lbound( properties() ) to ubound( properties() ) oPropertyValue = properties(j) if oPropertyValue.Name = PropertyName then GetProperty = oPropertyValue.Value exit function endif next j GetProperty = null end function Function CreateMenuItem( Command as String, Label as String ) as Variant Dim aMenuItem(2) as new com.sun.star.beans.PropertyValue aMenuItem(0).Name = CommandURL aMenuItem(0).Value = Command aMenuItem(1).Name = Label
Re: [dev] Adding menus / menu items at Runtime
Hi Tom, Couldn't you package this as an Code-Snippet. Using Paolos Snippet-Creator found here this would take less than a minute ;-) http://www.paolo-mantovani.org/ if my plans work out this will be a good idea. I already searched the snippeds page for examples... Greetings, Tobias REM * BASIC * Sub Main REM *** Adds a item to the File Menu only transient. Means REM *** that this menu item only exists for and during the REM *** lifetime of the current frame. REM *** Initialize strings sMenuBar = private:resource/menubar/menubar sMyPopupMenuCmdId = .uno:PickList sMyCommand = macro:///Standard.Module1.Test() REM *** Retrieve the current frame of my model oModel = ThisComponent if not isNull( oModel ) then REM *** Retrieve frame from current controller oFrame = oModel.getCurrentController().getFrame() REM *** Retrieve the layout manager of my current frame oLayoutManager = oFrame.LayoutManager() REM *** Retrieve the menu bar from the layout manager oMenuBar = oLayoutManager.getElement( sMenuBar ) REM *** Retrieve writable configuration settings from menu bar oMenuBarSettings = oMenuBar.getSettings( true ) REM *** Make our changes only transient. An Add-on should REM *** never change configuration persistently as it can REM *** be deinstalled by a user without any chance to REM *** undo its configuration changes! REM *** Please look for bug #i46194 which prevents using REM *** oMenuBar.Persistent = false!! oMenuBar.Persistent = false REM *** Look for the File popup menu and add our command REM *** We must look if we haven't added our command already! fileMenuIndex = FindPopupMenu( sMyPopupMenuCmdId, oMenuBarSettings ) if fileMenuIndex = 0 then oPopupMenuItem() = oMenuBarSettings.getByIndex(fileMenuIndex) oPopupMenu = GetProperty( ItemDescriptorContainer, oPopupMenuItem() ) if not isNull( oPopupMenu ) then if FindCommand( sMyCommand, oPopupMenu ) = -1 then oMenuItem = CreateMenuItem( sMyCommand, Standard.Module1.Test ) nCount = oPopupMenu.getCount() oPopupMenu.insertByIndex( nCount, oMenuItem ) endif endif else msgbox No file menu found! endif oMenuBar.setSettings( oMenuBarSettings ) endif End Sub Function FindCommand( Command as String, oPopupMenu as Object ) as Integer nCount = oPopupMenu.getCount()-1 for i = 0 to nCount oMenuItem() = oPopupMenu.getByIndex(i) nPropertyCount = ubound(oMenuItem()) for j = 0 to nPropertyCount if oMenuItem(j).Name = CommandURL then if oMenuItem(j).Value = Command then FindCommand = j exit function endif endif next j next i FindCommand = -1 End Function Function FindPopupMenu( Command as String, oMenuBarSettings as Object ) as Integer for i = 0 to oMenuBarSettings.getCount()-1 oPopupMenu() = oMenuBarSettings.getByIndex(i) nPopupMenuCount = ubound(oPopupMenu()) for j = 0 to nPopupMenuCount if oPopupMenu(j).Name = CommandURL then if oPopupMenu(j).Value = Command then FindPopupMenu = j exit function endif endif next j next i FindPopupMenu = -1 End Function Function GetProperty( PropertyName as String, properties() as Variant ) as Variant for j = lbound( properties() ) to ubound( properties() ) oPropertyValue = properties(j) if oPropertyValue.Name = PropertyName then GetProperty = oPropertyValue.Value exit function endif next j GetProperty = null end function Function CreateMenuItem( Command as String, Label as String ) as Variant Dim aMenuItem(2) as new com.sun.star.beans.PropertyValue aMenuItem(0).Name = CommandURL aMenuItem(0).Value = Command aMenuItem(1).Name = Label aMenuItem(1).Value = Label aMenuItem(2).Name = Type aMenuItem(2).Value = 0 CreateMenuItem = aMenuItem() End Function Sub Test MsgBox Test End Sub REM * BASIC * Sub Main REM *** Creates a top-level popup menu on the Writer menu bar persistently. REM *** It checks if its popup menu has already been added to the menu bar REM *** and does nothing. REM *** The popup menu contains one menu item with a REM *** Initialize strings sMenuBar = private:resource/menubar/menubar sMyPopupMenuCmdId = vnd.openoffice.org:MyMenu REM *** Retrieve the module configuration manager from central module configuration manager supplier oModuleCfgMgrSupplier = createUnoService(com.sun.star.ui.ModuleUIConfigurationManagerSupplier) REM *** Retrieve the module configuration manager with module identifier REM *** See
Re: [dev] Adding menus / menu items at Runtime
Hi Carsten, Thanks a lot. I will try the transient example because only temporary changes are needed. Is it possible to do the same in Java? Yes, you can also use Java. The example uses a UNO API, therefore you can use any supported language. sounds very good. At the moment I am reading your document http://specs.openoffice.org/ui_in_general/api/ProgrammaticControlOfMenuAndToolbarItems.sxw and up to now it is easy to read. If I have further questions should I post them to dev@api.openoffice.org or on this list? Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Writer behavior on high res widescreen displays [feature request]
Hi, I'm not a developer on the openoffice project, and I probably won't have the time to become one, so this is mainly just a feature request for writer. The market for widescreen displays both for laptops and desktop computers is increasing. These usually have a rather high resolution. My display has 1920x1200 pixels. This opens the possibility for viewing two full pages side by side in writer. Both word and writer normally displays pages, one under another with no possibility for utilizing the high horizontal resolution of todays widescreen displays. This is an example of how I would like writer to behave on these displays: -- -- | | | | | | | | | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | | | | | | | | | | | -- -- This is an example on how writer does behave: -- | | | | | | | | | | -- -- | | | | | | | | | | -- -- | | | | | | | | | | -- -- | | | | | | | | | | -- Each of these squares of |s and -s represents an A4 page. Thanks for the attention and for the great project that openoffice is. Håvar Nielsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Innbrudd på no.OOo's hjemmeside?
Hei Forsøkte å finne ut om dere hadde OOo 2.0.1 klar. Gikk til nedlasting, og fikk en side med noe tekst som slett ikke virket som den var produsert av dere! Mvh. Nils M. Nielsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Innbrudd på no.OOo's hjemmeside?
Kan De vær så snill og lag Deres poster på engelsk? Majoriteten av denne lister tale opp Engelsk, og De sannsynlig motta bedre resultater på den måten. Could you please make your posts in English? The majority of this list speaks English, and you'll probably receive better results that way. Takk/Thanks, Robin Monks Drupal.org Marketing On 2/14/06, Nils Nielsen [EMAIL PROTECTED] wrote: Hei Forsøkte å finne ut om dere hadde OOo 2.0.1 klar. Gikk til nedlasting, og fikk en side med noe tekst som slett ikke virket som den var produsert av dere! Mvh. Nils M. Nielsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robin Monks, CSL Web Administrator [EMAIL PROTECTED] Public Key: http://shurl.org/key/[EMAIL PROTECTED] ( http://gmking.org, a gamers dream, looking for admins )
Re: [dev] Innbrudd på no.OOo's hjemmesi de?
No offence but this translation sucks :-) you must have been translating the wrong message :-) What he wants to know is if there is a (norwegian) 2.0.1 version of OpenOffice.org and why the pages he got when trying to download the version found at the no.openoffice.org site looked liek the site had been hacked! /Christian Andersson Robin Monks wrote: A rough translation of this message would go like: Hi I've been trying your OpenOffice 2.0.1 and it never prints as it appears while I'm editing it. Nils M. Nielsen Although that translation is very rough. Robin On 2/14/06, Nils Nielsen [EMAIL PROTECTED] wrote: Hei Forsøkte å finne ut om dere hadde OOo 2.0.1 klar. Gikk til nedlasting, og fikk en side med noe tekst som slett ikke virket som den var produsert av dere! Mvh. Nils M. Nielsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robin Monks, CSL Web Administrator [EMAIL PROTECTED] Public Key: http://shurl.org/key/[EMAIL PROTECTED] ( http://gmking.org, a gamers dream, looking for admins ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Innbrudd på no.OOo's hjemmesi de?
first of all, you are writing to a mailing list that is english based, therefore most users in here will not understand what you have written. what you might have experienced is that the download of OOo 2.0 on no.openoffice.org links to the ftp site that holds the 2.0 norwegian build of OpenOffice.org, this build is not hosted on the main openoffice.org site. (btw I have nothing to do with the norwegian version, or any other version, I'm just an user reading the mailing list you have written to) however the links on the norwegian download pages seems to be wrong since they give an error 404 page from wha tI can see that build has been removed on the ftp site, and a newer build (2.0.1 rc5) can be downloaded instead here (on the same ftp-site) http://ftp.linux.cz/pub/localization/OpenOffice.org/devel/680/2.0.1-RC5/ fo windows you probably want to download OOo_2.0.1_windows_install_nb.exe for the bokmål version and OOo_2.0.1_windows_install_nn.exe for the nynorsk version /Christian Andersson Nils Nielsen wrote: Hei Forsøkte å finne ut om dere hadde OOo 2.0.1 klar. Gikk til nedlasting, og fikk en side med noe tekst som slett ikke virket som den var produsert av dere! Mvh. Nils M. Nielsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Writer behavior on high res widescreen displays [feature request]
It seems my example on the bottom of the previous message got a bit skewed. The example on this page: http://www.havarnielsen.com/writer.jpg (100kbytes) illustrates what I am talking about much better. www.havarnielsen.com/writer.jpg Regards, Håvar Håvar Illøkken Nielsen wrote: Hi, I'm not a developer on the openoffice project, and I probably won't have the time to become one, so this is mainly just a feature request for writer. The market for widescreen displays both for laptops and desktop computers is increasing. These usually have a rather high resolution. My display has 1920x1200 pixels. This opens the possibility for viewing two full pages side by side in writer. Both word and writer normally displays pages, one under another with no possibility for utilizing the high horizontal resolution of todays widescreen displays. This is an example of how I would like writer to behave on these displays: -- -- | | | | | | | | | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | | | | | | | | | | | -- -- This is an example on how writer does behave: -- | | | | | | | | | | -- -- | | | | | | | | | | -- -- | | | | | | | | | | -- -- | | | | | | | | | | -- Each of these squares of |s and -s represents an A4 page. Thanks for the attention and for the great project that openoffice is. Håvar Nielsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]