popupmenu with icons

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
rameshkancherla
Posts: 16
Joined: Fri May 30, 2008 1:38 pm

popupmenu with icons

Post by rameshkancherla »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using?2.3
What Operating System (version) are you using?windows XP
What is your question or comment?

i have a button in my toolbar while click on button i want to show one popupmenu.
in the popupmenu i want to insert icons and text.
i have inserted text using xpopupmenu interface.
but i am uanable to inserting icons.

how can i insert icons to popupmenu.?

can any one please help me

thanks
ramesh
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: popupmenu with icons

Post by acknak »

Are you doing this through programming--a BASIC macro, perhaps? Some other language?
AOO4/LO5 • Linux • Fedora 23
rameshkancherla
Posts: 16
Joined: Fri May 30, 2008 1:38 pm

Re: popupmenu with icons

Post by rameshkancherla »

I am doing using java language.
can you please give me advice
how can i insert icons to popupmenu through programatically.

i will be waiting for your replay
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: popupmenu with icons

Post by acknak »

[Moved topic to Macros and UNO API]
AOO4/LO5 • Linux • Fedora 23
rameshkancherla
Posts: 16
Joined: Fri May 30, 2008 1:38 pm

Re: popupmenu with icons

Post by rameshkancherla »

i have to create popupmenu with icons and text items .
popupmenu contains (icon text)
icon text
icon text
icon text
icon text

how can i create this popupmenu

can any one please give me procedure or sample code

please help me

thanks
ramesh k
rameshkancherla
Posts: 16
Joined: Fri May 30, 2008 1:38 pm

Re: popupmenu with icons

Post by rameshkancherla »

Good evening

Tthis is Ramesh.
i am creating a toolbar through add-on in java language.
in my toolbar 4 buttons are there. in one button contains dropdown.
so
I have to create one popupmenu for displaying under that drop down
button.

i have created popupmenu through java language(using co.sun.star package) .
but in that package xpopupmenu interfce doesnot contained insertitem method
(both icon and text). it contains only text insert method . so i cant
done through java.

i have seen that in openoffice menubar.xml contains some commands,this
commands are linking to images

like .uno:About ., i created my own command, and insert in menubar.xml i
got image in menubar. (but it is menubar)


but i have to create popupmenu with images. (i am trying to create like new
button on stadared toolbar (it gives popup with images))
how is it possible
is there any xml for popupmenu or else any
can you please give me advice.

i will be waiting for your replay.


Thanks & Regards
Ramesh k
rameshkancherla
Posts: 16
Joined: Fri May 30, 2008 1:38 pm

Re: popupmenu with icons

Post by rameshkancherla »

I have to display dropdownmenu with icons and label items on toolbar dropdown button.

can anyone please help me

Thanks & Regards
Ramesh K
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: popupmenu with icons

Post by hanya »

There is the implementation of the .uno:AddDirect menu (Files - New menu entry) in the source code.
http://lxr.go-oo.org/source/framework/f ... roller.cxx

I have also tried to implement new popupmenu controller and I couldn't find any way to add icon through api in Python. I don't have any skill on C++.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: popupmenu with icons

Post by ms777 »

Hanya,

I have come as far as you in identifying the newmenucontroller service as a potential candidate, but no further, too. The service uses some SetImage function, which is not exposed through any api. So I assume that, independent of the programming language, you have no chance to set image icons in drop down menus withour adding code and recompiling oo, which is not good for redistribution ...

One other idea I did not yet follow up: How about (temporally) abusing the .uno:AddDirect dispatch along the following steps ?

1. Identify, where newdocumentcontroller gets the config for the menus from. http://lxr.go-oo.org/source/util/svtool ... ns.cxx#493 may be a help here ...

2. Overwrite the configuration with the wanted configuration data

3. call the popupmenu via .AddDirect

4. restore the original settings

This workaround would by a very dirty workaround, though ...

ms777
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: popupmenu with icons

Post by hanya »

Hi, ms777
ms777 wrote:One other idea I did not yet follow up: How about (temporally) abusing the .uno:AddDirect dispatch along the following steps ?
Sounds interesting. I made the configuration entry like the following:

Code: Select all

<?xml version="1.0"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" 
xmlns:install="http://openoffice.org/2004/installation" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
oor:name="Common" 
oor:package="org.openoffice.Office">
  <node oor:name="Menus">
    <node oor:name="New">
      <node oor:name="m100" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>.uno:About</value>
        </prop>
        <prop oor:name="Title">
          <value xml:lang="en-US">~About</value>
        </prop>
        <prop oor:name="TargetName" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <prop oor:name="ImageIdentifier" oor:type="xs:string">
          <value>.uno:Cut</value>
        </prop>
      </node>
    </node>
  </node>
</oor:component-data>
This configuration adds a new entry with the icon image of the Cut button into the New menu.
And then I tried to replace from the command url to my popupmenucontroller, however the item is shown as a normal menu entry that does not have sub menus. So, it seems the popupmenu is not created by the factory.

But there is the way to add new entries to the AddDirect or AutoPilotMenu menu.

Thanks ms777 for the idea.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: popupmenu with icons

Post by ms777 »

Hi Hanya,

I used the ConfigurationProvider to change the existing new menu entry from 'Drawing' to 'Drawwwwing' and found that it worked, but only after leaving and restarting OO. So the config changes seem not to be listened to ...

ms777
rameshkancherla
Posts: 16
Joined: Fri May 30, 2008 1:38 pm

Re: popupmenu with icons

Post by rameshkancherla »

hi ms777,
I have inserted common.xcu (your code )file in my project. i got cut button in file- new entry menu.

But how can i get it in my popupmenu.

can you please tell me


Thanks & Regards
Ramesh K
User avatar
Kiel
Posts: 44
Joined: Wed Nov 26, 2014 5:28 pm

Re: popupmenu with icons

Post by Kiel »

Do you have insert de file with this example?
OpenOffice 3.4 - LibreOffice 4.0 / 4.1 / 4.2 on Windows Seven
Post Reply