Hi everyone.
I'm running OpenOffice Writer through a Java application and I'm desperately trying to intercept clicks on hyperlinks.
I refered to this topic in oooforum this topic in oooforum and managed to get interception on .uno commands (save, save as, etc.).
But I did not find how to intercept hyperlinks. Still wondering wether this could be done through a dispatch interceptor on the frame.
Anyone has an idea ?
Many thanks in advance.
Intercepting Hyperlinks from Java
Intercepting Hyperlinks from Java
OOo 3.3 on MS Windows XP
Re: Intercepting Hyperlinks from Java
In the SDK there used to be an example for a ProtocolHandler add-on. As far as I know, you need to implement a protocol handler for the http: protocol.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Intercepting Hyperlinks from Java
Many thanks for your reply, Villeroy.
I'll keep digging in this direction and will let you know if it's a success...
I'll keep digging in this direction and will let you know if it's a success...
OOo 3.3 on MS Windows XP
Re: Intercepting Hyperlinks from Java
It seems to open hyperlink on documents does not pass through dispatch framework. I tried to make a protocol handler for http protocol but it does not used at the link opening. When I set a http item for one of menu item, it called.
But link to the file is opened by css.system.SystemShellExecute service. So I have tried to replace it with my one: http://extensions.services.openoffice.o ... ultBrowser
But link to the file is opened by css.system.SystemShellExecute service. So I have tried to replace it with my one: http://extensions.services.openoffice.o ... ultBrowser
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
Apache OpenOffice 4-dev on Xubuntu 14.04
Re: Intercepting Hyperlinks from Java
Many thanks for your response, hanya.
I dezipped your extension and try to understand how you wrote it, but I'm discovering oxt format and python language...
By the way, one question, though : in your search, did you consider intercepting mouse clicks, trying then to determine if the pointer is on a hyperlink ?
I'm asking because I would have liked to intercept clicks on hyperlinks, even those which don't lead to opening a browser (for instance, leading to a file or to a bookmark.
Thanks once again for helping.
I dezipped your extension and try to understand how you wrote it, but I'm discovering oxt format and python language...
By the way, one question, though : in your search, did you consider intercepting mouse clicks, trying then to determine if the pointer is on a hyperlink ?
I'm asking because I would have liked to intercept clicks on hyperlinks, even those which don't lead to opening a browser (for instance, leading to a file or to a bookmark.
Thanks once again for helping.
Last edited by bracho on Thu Feb 09, 2012 11:03 am, edited 1 time in total.
OOo 3.3 on MS Windows XP
Re: Intercepting Hyperlinks from Java
MouseHandler and accessibility api might be used this task.By the way, one question, though : in your search, did you consider intercepting mouse clicks, tryning then to determine if the pointer is on a hyperlink ?
Jump to bookmark is executed by .uno:JumpToMark and opening another file with link is done by .uno:Open command, it seems. So, keyword for this way is css.frame.XDispatchProviderInterception.
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
Apache OpenOffice 4-dev on Xubuntu 14.04
Re: Intercepting Hyperlinks from Java
Many thanks hanya.
I believe intercepting "jump to bookmark" will be just fine for my needs.
Unfortunately, I did not succeed in intercepting this command url. I'm actually trying to adapt this code :
called from :
But, doing so, I'm only able to intercept commands that are present in menus or toolbars.
Sorry to bother you with that, but could you give me a clue (or a piece of code) that would allow me to intercept the ".uno:JumpToBookmark" command ?
Many thanks once again !
I believe intercepting "jump to bookmark" will be just fine for my needs.
Unfortunately, I did not succeed in intercepting this command url. I'm actually trying to adapt this code :
Code: Select all
public class MyInterceptor implements XDispatchProviderInterceptor {
private XDispatchProvider slaveDispatchProvider;
private XDispatchProvider masterDispatchProvider;
public XDispatchProvider getMasterDispatchProvider() {
return masterDispatchProvider;
}
public XDispatchProvider getSlaveDispatchProvider() {
return slaveDispatchProvider;
}
public void setMasterDispatchProvider(XDispatchProvider arg0) {
masterDispatchProvider = arg0;
}
public void setSlaveDispatchProvider(XDispatchProvider arg0) {
slaveDispatchProvider = arg0;
}
/**
* intercepts the command URLs and dispatches to the user defined handlers.
*/
public XDispatch queryDispatch(URL arg0, String arg1, int arg2) {
// To intercept the .uno:Save
if(arg0.Complete.equals(".uno:Save")) {
// your command handler
return new MySave();
} else if(arg0.Complete.equals(".uno:Paste")) {
// return your paste command handler
}
return getSlaveDispatchProvider().queryDispatch(arg0, arg1, arg2); // to get next command url.
}
public XDispatch[] queryDispatches(DispatchDescriptor[] arg0) {
return getSlaveDispatchProvider().queryDispatches(arg0);
}
Code: Select all
XDispatchProviderInterception xDPI = (XDispatchProviderInterception) UnoRuntime.queryInterface(XDispatchProviderInterception.class, xFrame);
MyInterceptor interceptor = new MyInterceptor();
xDPI.registerDispatchProviderInterceptor(interceptor);
Sorry to bother you with that, but could you give me a clue (or a piece of code) that would allow me to intercept the ".uno:JumpToBookmark" command ?
Many thanks once again !
OOo 3.3 on MS Windows XP
Re: Intercepting Hyperlinks from Java
I am sorry for that I have not tried to capture JumpToBookmark call by clicking hyperlinks. It does not work on my environment also.
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
Apache OpenOffice 4-dev on Xubuntu 14.04