Re: [dev] Context menu interception

2007-11-26 Thread Oliver Brinzing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Andreas,

 As an optional feature you can provide an
 additional interface named XInterceptorInfo. There you can return a list
 of URL pattern (including wildcards) so the dispatch queue will call
 your interceptor only for those URLs ... and not for all.

i tried to configure my DispatchInterceptor:

private String[] interceptedURLs = { macro:///* };

public XDispatch queryDispatch(URL aURL, String sTarget, int nSearchFlags) {
[...]   
}

public String[] getInterceptedURLs() {
return interceptedURLs;
}

to listen only for macro:/// dispatches, but this seems not to work,
my queryDispatches method is called for .uno: dispatches too

Is there a broken chain ?

i found an explanation i the 
docs/common/ref/com/sun/star/frame/XInterceptorInfo.html

 makes it possible to get information about a registered interceptor and is 
 used by frame
 interceptor mechanism to perform interception.
 Frame can call right interceptor directly without calling all of registered 
 ones.
 Use it as an additional interface to XDispatchProviderInterceptor .
 If any interceptor in list doesn't support this interface - these mechanism 
 will be broken
 and normal list of master-slave interceptor objects will be used from top to 
 the bottom.

Oliver

- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHSwvjTiyrQM/QSkURAuk8AKCmYcuPPsCeO33yOJFGYmT/2IAIZgCfULRR
z58TiGImG+NYztnlvBFZExE=
=hJZI
-END PGP SIGNATURE-

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



Re: [dev] Context menu interception

2007-11-22 Thread Ariel Constenla-Haile

Schuster Gerhard escribió:
Property name = Image  Value= 
Any[Type[com.sun.star.awt.XBitmap], null]

[...]

i.e. there is no SubContainer and no Image specified.


Concerning getPropertyValue(Image), I think that something's broken
with the API (or I'm too fool make it work ;-) ): all I can get from the
object returned by getPropertyValue(Image) is a NULL reference to
XBitmap, this happens in every menu item. I'm also unable to set an
XBitmap reference to new menu items I add.


Hello Carsten,
hello Gerhard (hope you're still there!)

now that we got Carsten's attention, a puzzle I'd like to know if it has 
an answer: is it possible to get or set an image to a context menu item 
using XBitmap?


* a reference to XBitmap from the object returned by 
getPropertyValue(Image) is always null


* to set an image by using setPropertyValue(Image, XBitmap): how do we 
get a reference to XBitmap? I now how to get an XGraphic from an URL [an 
XGraphic can be used in some UNO controls instead of ImageURL], but an 
XBitmap is returned (so the API ref.) only by XDevice::createBitmap() 
and ::com::sun::star::scanner::XScannerManager::getBitmap().



The obvious way to set an image in a context menu item is to set an 
image for the command URL in the Addons.xcu config. file, but as the API 
ref. for 
http://api.openoffice.org/docs/common/ref/com/sun/star/ui/ActionTrigger.html#Image
says that the value for this property is an XBitmap, we should (in 
theory) be able to get it and set it.


Regards,
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.arielconstenlahaile.com.ar/ooo/



Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter.
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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



Re: [dev] Context menu interception

2007-11-21 Thread Carsten Driesner

Ariel Constenla-Haile schrieb:

Hi Gerhard,

Schuster Gerhard escribió:

Hi all,

I'm struggling with context menu interception and would apreciate
your help.



you have read my mind. Next week I was going to send a mail to
[EMAIL PROTECTED] with the subject How to implement a context menu
interceptor in the real world

I will try first to answer your questions, then I will try to give you
some explanations about what I've been doing.

But let me tell you that more than answers, I will (surely) complicate
even more your situation :-(


This are my questions:
a) In OO-Writer the context menu Font has a sub menu and an icon, but
the properties of the context menu Font are this:
Property name = CommandURL Value= .uno:CharFontName
Property name = HelpURLValue= 
Property name = Image  Value= 
Any[Type[com.sun.star.awt.XBitmap], null]

Property name = SubContainer   Value= null
Property name = Text   Value= Font

i.e. there is no SubContainer and no Image specified.
So there must be another mechanism to specify context menues but
the XPropertySet. Where is that documented?


if you see the menu item Style ( CommandURL=.uno:StyleMenu),
getPropertyValue(SubContainer) returns an object not null, telling
that it has a submenu, you cast/convert this to an XIndexContainer to
access the submenu.

The menu item for .uno:TransliterateMenu has also a submenu, and also
.uno:LineSpacingMenu, .uno:AlignTextMenu, etc.

You can access this submenus and add/remove items as indicated in the
Dev's Guide example.

For the menu item with CommandURL=.uno:CharFontName,
getPropertyValue(SubContainer) returns a null object reference; I
think that here, there is a logical explanation (a Sun engineer could
tell us if this is true) : as fonts can be added by the user in the OS,
OOo intercepts the context menu and adds this submenu with the fonts
names at runtime (if you try installing a new font system level, not
just inside OOo, you'll see that the context menu after you install it
lists the new font)

Concerning getPropertyValue(Image), I think that something's broken
with the API (or I'm too fool make it work ;-) ): all I can get from the
object returned by getPropertyValue(Image) is a NULL reference to
XBitmap, this happens in every menu item. I'm also unable to set an
XBitmap reference to new menu items I add.


b) I've noticed that the context menu of OO-Writer contains items hat 
are not visible.


for the context menu triggered when the cursor is in the text body and
nothing is selected I counted 36 items on the top level (sub menus are
not included in this count)

It seems like OOo gives us the list of *available* menu items for this
context, not only the items OOo will *actually* display for this context.

An example: slot:10955 is the command URL for Open hyperlink.
This item will only be displayed by OOo if the mouse is over an
hyperlink or the cursor is inside it. Nevertheless, if we query the
context menu triggered by a collapsed cursor in the text body, we will
get this menu item at index 30 (at least in OOo 2.3.0), BUT the item
won't be visible in the executed context menu unless there is an hyperlink.


In chapter 4.7.5 of the develoipers guide I read:
It is possible to accomplish certain tasks without implementing code 
in a context menu interceptor,
such as preventing a context menu from being activated. Normally, a 
context menu is changed to

provide additional functions to the user.
My question is:
b.1) What are this certain tasks?
b.2) How are this tasks performed, such as preventing a context menu
from being activated?


You can add new items, remove all items, prevent the context menu for
being executed, etc.

Your XContextMenuInterceptor implementation must have a method named
notifyContextMenuExecute, with this method you intercept the context
menu before being executed.

Depending on the value you return (one of the enum
ContextMenuInterceptorAction), you can change the context menu, cancel
its execution, etc. The example in the Dev's Guide is clear.

The event object delivered to this method (ContextMenuExecuteEvent) has
a member ActionTriggerContainer, it is an XIndexContainer == you can
insert and remove elements == menu items.

I think these are the certain tasks the Dev's Guide is talking about,
and depend of the return value of your interceptor and how you
manipulate the XIndexContainer.

Other additional functions can be introduced by new command URLs, as I
tell you later...


c) When I introduce my own context menu items they work fine until I
add a CommandURL. Once I've add a CommandURL the item gets disabled.
Here is the item:
Property name = CommandURL Value= BlaFasel:12346
Property name = HelpURLValue= 
Property name = Image  Value= 
Any[Type[com.sun.star.awt.XBitmap], null]

Property name = SubContainer   Value= null
Property name = Text   Value= Next entry

I've installed a 

Re: [dev] Context menu interception

2007-11-21 Thread Carsten Driesner

Schuster Gerhard schrieb:

Hi all,

I'm struggling with context menu interception and would apreciate
your help.

This are my questions:
a) In OO-Writer the context menu Font has a sub menu and an icon, but
the properties of the context menu Font are this:
Property name = CommandURL Value= .uno:CharFontName
Property name = HelpURLValue= 
Property name = Image  Value= Any[Type[com.sun.star.awt.XBitmap], 
null]
Property name = SubContainer   Value= null
Property name = Text   Value= Font

i.e. there is no SubContainer and no Image specified.
So there must be another mechanism to specify context menues but
the XPropertySet. Where is that documented?

b) I've noticed that the context menu of OO-Writer contains items hat are not 
visible.
In chapter 4.7.5 of the develoipers guide I read:
It is possible to accomplish certain tasks without implementing code in a 
context menu interceptor,
such as preventing a context menu from being activated. Normally, a context 
menu is changed to
provide additional functions to the user.
My question is:
b.1) What are this certain tasks?
b.2) How are this tasks performed, such as preventing a context menu
from being activated?

c) When I introduce my own context menu items they work fine until I
add a CommandURL. Once I've add a CommandURL the item gets disabled.
Here is the item:
Property name = CommandURL Value= BlaFasel:12346
Property name = HelpURLValue= 
Property name = Image  Value= Any[Type[com.sun.star.awt.XBitmap], 
null]
Property name = SubContainer   Value= null
Property name = Text   Value= Next entry

I've installed a XDispatchProviderInterceptor for BlaFasel:*, which
prints out * url complete: BlaFasel:12346... works! in its
queryDispatch method whenever the context menu is opened, but the
menu item is still not visible.

Hi Gerhard,

There is a simple answer to your question (why the menu item is still 
not visible?). A XDispatchProviderInterceptor and also a 
XDispatchProvider is responsible to provide a dispatch object for a 
command the can be executed. In your example you don't provide a 
dispatch object in queryDispatch but a short print out. The user 
interface, in this case the context menu, doesn't get a dispatch object 
and disables the command. Commands which are disabled won't be visible 
in OpenOffice.org context menus. You just have to provide a dispatch 
object and the menu item will be visible.




My question is: How do I implement a context menu item and stick my
own callback to it so that the item is still visible.
Implement a protocol handler, which is a much easier way to extend 
OpenOffice.org commands. The queryDispatch method MUST provide a 
dispatch object for your command.


Regards,
Carsten

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



Re: [dev] Context menu interception

2007-11-11 Thread Oliver Brinzing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

 For this, you have to implement a ProtocolHandler. The Dev's Guide
 explains how to do this.

i will send you a demo protocolhandler ...

Oliver

- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHNvneTiyrQM/QSkURAtDXAJ0dBGv6jyjWDooLBGKeLtJv6AVGtACgpJhR
qHJL+yJ/YNChWDMF7imcsF4=
=yLGs
-END PGP SIGNATURE-

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



[dev] Context menu interception

2007-11-10 Thread Schuster Gerhard
Hi all,

I'm struggling with context menu interception and would apreciate
your help.

This are my questions:
a) In OO-Writer the context menu Font has a sub menu and an icon, but
the properties of the context menu Font are this:
Property name = CommandURL Value= .uno:CharFontName
Property name = HelpURLValue= 
Property name = Image  Value= 
Any[Type[com.sun.star.awt.XBitmap], null]
Property name = SubContainer   Value= null
Property name = Text   Value= Font

i.e. there is no SubContainer and no Image specified.
So there must be another mechanism to specify context menues but
the XPropertySet. Where is that documented?

b) I've noticed that the context menu of OO-Writer contains items hat are not 
visible.
In chapter 4.7.5 of the develoipers guide I read:
It is possible to accomplish certain tasks without implementing code in a 
context menu interceptor,
such as preventing a context menu from being activated. Normally, a context 
menu is changed to
provide additional functions to the user.
My question is:
b.1) What are this certain tasks?
b.2) How are this tasks performed, such as preventing a context menu
from being activated?

c) When I introduce my own context menu items they work fine until I
add a CommandURL. Once I've add a CommandURL the item gets disabled.
Here is the item:
Property name = CommandURL Value= BlaFasel:12346
Property name = HelpURLValue= 
Property name = Image  Value= 
Any[Type[com.sun.star.awt.XBitmap], null]
Property name = SubContainer   Value= null
Property name = Text   Value= Next entry

I've installed a XDispatchProviderInterceptor for BlaFasel:*, which
prints out * url complete: BlaFasel:12346... works! in its
queryDispatch method whenever the context menu is opened, but the
menu item is still not visible.

My question is: How do I implement a context menu item and stick my
own callback to it so that the item is still visible.

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



Re: [dev] Context menu interception

2007-11-10 Thread Ariel Constenla-Haile

Hi Gerhard,

Schuster Gerhard escribió:

Hi all,

I'm struggling with context menu interception and would apreciate
your help.



you have read my mind. Next week I was going to send a mail to
[EMAIL PROTECTED] with the subject How to implement a context menu
interceptor in the real world

I will try first to answer your questions, then I will try to give you
some explanations about what I've been doing.

But let me tell you that more than answers, I will (surely) complicate
even more your situation :-(


This are my questions:
a) In OO-Writer the context menu Font has a sub menu and an icon, but
the properties of the context menu Font are this:
Property name = CommandURL Value= .uno:CharFontName
Property name = HelpURLValue= 
Property name = Image  Value= Any[Type[com.sun.star.awt.XBitmap], 
null]
Property name = SubContainer   Value= null
Property name = Text   Value= Font

i.e. there is no SubContainer and no Image specified.
So there must be another mechanism to specify context menues but
the XPropertySet. Where is that documented?


if you see the menu item Style ( CommandURL=.uno:StyleMenu),
getPropertyValue(SubContainer) returns an object not null, telling
that it has a submenu, you cast/convert this to an XIndexContainer to
access the submenu.

The menu item for .uno:TransliterateMenu has also a submenu, and also
.uno:LineSpacingMenu, .uno:AlignTextMenu, etc.

You can access this submenus and add/remove items as indicated in the
Dev's Guide example.

For the menu item with CommandURL=.uno:CharFontName,
getPropertyValue(SubContainer) returns a null object reference; I
think that here, there is a logical explanation (a Sun engineer could
tell us if this is true) : as fonts can be added by the user in the OS,
OOo intercepts the context menu and adds this submenu with the fonts
names at runtime (if you try installing a new font system level, not
just inside OOo, you'll see that the context menu after you install it
lists the new font)

Concerning getPropertyValue(Image), I think that something's broken
with the API (or I'm too fool make it work ;-) ): all I can get from the
object returned by getPropertyValue(Image) is a NULL reference to
XBitmap, this happens in every menu item. I'm also unable to set an
XBitmap reference to new menu items I add.



b) I've noticed that the context menu of OO-Writer contains items hat are not 
visible.


for the context menu triggered when the cursor is in the text body and
nothing is selected I counted 36 items on the top level (sub menus are
not included in this count)

It seems like OOo gives us the list of *available* menu items for this
context, not only the items OOo will *actually* display for this context.

An example: slot:10955 is the command URL for Open hyperlink.
This item will only be displayed by OOo if the mouse is over an
hyperlink or the cursor is inside it. Nevertheless, if we query the
context menu triggered by a collapsed cursor in the text body, we will
get this menu item at index 30 (at least in OOo 2.3.0), BUT the item
won't be visible in the executed context menu unless there is an hyperlink.


In chapter 4.7.5 of the develoipers guide I read:
It is possible to accomplish certain tasks without implementing code in a 
context menu interceptor,
such as preventing a context menu from being activated. Normally, a context 
menu is changed to
provide additional functions to the user.
My question is:
b.1) What are this certain tasks?
b.2) How are this tasks performed, such as preventing a context menu
from being activated?


You can add new items, remove all items, prevent the context menu for
being executed, etc.

Your XContextMenuInterceptor implementation must have a method named
notifyContextMenuExecute, with this method you intercept the context
menu before being executed.

Depending on the value you return (one of the enum
ContextMenuInterceptorAction), you can change the context menu, cancel
its execution, etc. The example in the Dev's Guide is clear.

The event object delivered to this method (ContextMenuExecuteEvent) has
a member ActionTriggerContainer, it is an XIndexContainer == you can
insert and remove elements == menu items.

I think these are the certain tasks the Dev's Guide is talking about,
and depend of the return value of your interceptor and how you
manipulate the XIndexContainer.

Other additional functions can be introduced by new command URLs, as I
tell you later...


c) When I introduce my own context menu items they work fine until I
add a CommandURL. Once I've add a CommandURL the item gets disabled.
Here is the item:
Property name = CommandURL Value= BlaFasel:12346
Property name = HelpURLValue= 
Property name = Image  Value= Any[Type[com.sun.star.awt.XBitmap], 
null]
Property name = SubContainer   Value= null
Property name = Text   Value= Next entry

I've installed a XDispatchProviderInterceptor for BlaFasel:*,