Hi Robert,
Il domenica 6 gennaio 2008 17:27:39 Robert Vojta ha scritto:
> Hallo all,
>
> is there an easy way how to obtain object from XTextDocument, which
> received mouse double click event? I would like to know in which XCell
> (in XTextTable) this event happend. My goal is to open special window
> for XTextTable's XCell editing.
I think that you can do this by registering a XMouseClickHandler in the
CurrentController of the document.
In the event handler you should check the ViewCursor for the TextTable and
Cell properties
Please see the example below.
However, the example does not manage the case of current controller changed
(e.g. if the user creates a new view)
I think that you could manage this case by registering an XFrameActionListener
on the Desktop service, but I'm not so sure that this is the the best way.
HTH
Paolo M
-------------------------
REM ***** BASIC *****
Global oDoc As Object
Global oMouseClickHandler As Object
Sub RegisterMouseClickHandler
oDoc = ThisComponent
oMouseClickHandler = CreateUnoListener( _
"MyDoc_", "com.sun.star.awt.XMouseClickHandler")
oDoc.CurrentController.addMouseClickHandler(oMouseClickHandler)
End Sub
Sub UnregisterMouseClickHandler
On Error Resume Next
oDoc.CurrentController.removeMouseClickHandler(oMouseClickHandler)
End Sub
Function MyDoc_mousePressed(oEvt As Object) As Boolean
MyDoc_mousePressed = False
End Function
Function MyDoc_mouseReleased(oEvt As Object) As Boolean
If oEvt.ClickCount = 2 And oEvt.Buttons = 1 Then
oCursor = oDoc.CurrentController.ViewCursor
If oCursor.getPropertyState("TextTable") = 0 Then
sTable = oCursor.TextTable.Name
sCell = oCursor.Cell.CellName
MsgBox sTable & "." & sCell
End If
End If
MyDoc_mouseReleased = False
End Function
Sub MyDoc_disposing(oEvt As Object)
'nothing to do
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]