After exploring the forum.openoffice.org and some other forums, I found following macro that do the job with some limitations:
Goto Tools -> Macros -> Organize Macros -> LibreOffice Basic... In displayed dialog, create a new one and write below code:
Sub CopyFilePath
dim document as object
dim dispatcher as object
dim oDoc, oVC, Mark, var
oDoc = ThisComponent
oVC = oDoc.CurrentController.getViewCursor
Mark = oDoc.Text.createTextCursorByRange(oVC)
oVC.collapseToEnd
var = ThisComponent.getURL()
oVC.String = var
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
oVC.String = ""
oVC.gotoRange(Mark,false)
End Sub
- Save it and assign a key to it by using following steps:
- Open Customize dialog by Tool -> Customize
- Select Keyboard tab
- Select available key from Shortcut Keys component
- Select your macro from Category component under LibreOffice Macros
- Click on Modify button.
PS: Above code is posted by JohnV at forum.openoffice.org.
Emoticon Emoticon