| View previous topic :: View next topic |
| Author |
Message |
sher General User

Joined: 06 Sep 2005 Posts: 7 Location: Russia
|
Posted: Tue Nov 08, 2005 5:47 am Post subject: Context Menu Intercepting |
|
|
I tried this OOO mechanism and had no success (OOO Version 2.0)
I did some modifications to SDK sample of UNO component. Now it implements the com.sun.star.ui.XContextMenuInterceptor interface among the other interfaces. Implementation of single method of this interface I took from SDK (section 4.7.5, light modification of standard context menu).
I registered this UNO component and tried to call some of its methods and examine properties (dbg_suppurtedInterfaces for example) - OK. It suppurts desired interface.
Then I tried to register this interceptor and had no exceptions at all - all was fine.
But there is no result at all
// Code of registration
sub registerInterceptor
oTestComp = createUnoService("com.sun.star.test.SomethingA")
ThisComponent.CurrentController.registerContextMenuInterceptor(oTestComp)
end sub
// end
Any suggestions? I need to cancel all context menus in the end.
I can provide all code and all idls if it can help. Search in this forum gave me nothing. _________________ Mirror stares back hard... |
|
| Back to top |
|
 |
sher General User

Joined: 06 Sep 2005 Posts: 7 Location: Russia
|
Posted: Fri Nov 18, 2005 5:00 am Post subject: |
|
|
Amazing. It is hard to believe that nobody ever tried to cancel or modify context menus, and had samples or typical solutions...
Perhaps I've asked my question in wrong subforum or have used wrong words?
I need to cancel context menu in running Writer, that's all. _________________ Mirror stares back hard... |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3208 Location: Troyes France
|
|
| Back to top |
|
 |
Pash General User

Joined: 08 Sep 2005 Posts: 15
|
|
| Back to top |
|
 |
sher General User

Joined: 06 Sep 2005 Posts: 7 Location: Russia
|
Posted: Tue Dec 13, 2005 1:16 am Post subject: |
|
|
Yes.
It's working... for now. I hope that "illegal" creation of ContextMenuInterceptor using CreateUnoListener routine will not change in new OOO versions. _________________ Mirror stares back hard... |
|
| Back to top |
|
 |
kentgibson Power User

Joined: 24 Jan 2006 Posts: 85
|
Posted: Thu Jan 26, 2006 5:42 am Post subject: |
|
|
Here is what is supposed to be a clean solution:
http://documentation.openoffice.org/HOW_TO/various_topics/HowTo_modify_context_menu.pdf
But I am already having problems implementing it.
for example this line doesn't seem to want to compile:
ContextMenuInterceptor mContext = new ContextMenuInterceptor(mFrame.getController());
Could it be XContextMenuInterceptor mContext = new XContextMenuInterceptor(mFrame.getController());
I don't think so either, that doesn't compile but at least the class is known.
hmm. tell me if anyone has better luck. |
|
| Back to top |
|
 |
kentgibson Power User

Joined: 24 Jan 2006 Posts: 85
|
Posted: Thu Jan 26, 2006 6:10 am Post subject: |
|
|
Well it is a bit clearer now, I need my own ContextMenuInterceptor which implements XContextMenuInterceptor.
ie
| Code: |
public class ContextMenuInterceptor implements XContextMenuInterceptor {
public ContextMenuInterceptorAction notifyContextMenuExecute(
ContextMenuExecuteEvent arg0) {
// TODO Auto-generated method stub
return null;
}
} |
|
|
| Back to top |
|
 |
kentgibson Power User

Joined: 24 Jan 2006 Posts: 85
|
Posted: Thu Jan 26, 2006 6:40 am Post subject: |
|
|
| this solution described in this does work. |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3208 Location: Troyes France
|
|
| Back to top |
|
 |
kentgibson Power User

Joined: 24 Jan 2006 Posts: 85
|
Posted: Tue Jan 31, 2006 3:52 am Post subject: |
|
|
i don' t reckon it is neccessary, that article has all the code needed, the first time I read it though I was just a bit confused.
But don't get me wrong, the snippets forum is a great idea, I just posted something do with the LayoutManager |
|
| Back to top |
|
 |
|