OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Context Menu Intercepting

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
sher
General User
General User


Joined: 06 Sep 2005
Posts: 7
Location: Russia

PostPosted: Tue Nov 08, 2005 5:47 am    Post subject: Context Menu Intercepting Reply with quote

I tried this OOO mechanism and had no success Sad (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 Smile

// 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
View user's profile Send private message
sher
General User
General User


Joined: 06 Sep 2005
Posts: 7
Location: Russia

PostPosted: Fri Nov 18, 2005 5:00 am    Post subject: Reply with quote

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
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3208
Location: Troyes France

PostPosted: Fri Nov 18, 2005 9:11 am    Post subject: Reply with quote

Here are any threads. Don't know if it can help :
Programmatically adding to existing Menus http://www.oooforum.org/forum/viewtopic.phtml?t=18491&highlight=
Macro in a Top Level Menu http://www.oooforum.org/forum/viewtopic.phtml?t=26347&highlight=
In Java with no answer but a code example :
Dynamic menus: with Java http://www.oooforum.org/forum/viewtopic.phtml?t=26445&highlight=
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Pash
General User
General User


Joined: 08 Sep 2005
Posts: 15

PostPosted: Mon Dec 12, 2005 6:30 am    Post subject: Reply with quote

The solution is here:
http://codesnippets.services.openoffice.org/Office/Office.ContexMenuInterceptor.snip
Back to top
View user's profile Send private message
sher
General User
General User


Joined: 06 Sep 2005
Posts: 7
Location: Russia

PostPosted: Tue Dec 13, 2005 1:16 am    Post subject: Reply with quote

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
View user's profile Send private message
kentgibson
Power User
Power User


Joined: 24 Jan 2006
Posts: 85

PostPosted: Thu Jan 26, 2006 5:42 am    Post subject: Reply with quote

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
View user's profile Send private message
kentgibson
Power User
Power User


Joined: 24 Jan 2006
Posts: 85

PostPosted: Thu Jan 26, 2006 6:10 am    Post subject: Reply with quote

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
View user's profile Send private message
kentgibson
Power User
Power User


Joined: 24 Jan 2006
Posts: 85

PostPosted: Thu Jan 26, 2006 6:40 am    Post subject: Reply with quote

this solution described in this does work.
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3208
Location: Troyes France

PostPosted: Fri Jan 27, 2006 10:12 am    Post subject: Reply with quote

If you have working code you can publish it in "Code Snippets Forum" http://www.oooforum.org/forum/viewforum.phtml?f=11
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
kentgibson
Power User
Power User


Joined: 24 Jan 2006
Posts: 85

PostPosted: Tue Jan 31, 2006 3:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group