To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=36783
User as changed the following:
What |Old value |New value
================================================================================
Assigned to|as |masato12610
--------------------------------------------------------------------------------
------- Additional comments from [EMAIL PROTECTED] Tue Feb 13 15:12:19 +0000
2007 -------
The script mentioned by SW was not realy correct ... here a newer version,
which
should the thing you need:
Global xFrame as Object
Global xViewListener as Object
rem ======================================================
sub startListeningOnFrame
if isNull(xFrame) then
msgbox "initialize listener connections ..."
xModel = ThisComponent
if not isNull(xModel) then
xController = xModel.CurrentController
endif
if not isNull(xController) then
xFrame = xController.Frame
endif
if not isNull(xFrame) then
xFrameListener =
createUnoListener("onFrameEvent_","com.sun.star.frame.XFrameActionListener" )
xViewListener = createUnoListener("onCalcEvent_"
,"com.sun.star.beans.XPropertyChangeListener")
xFrame.addFrameActionListener(xFrameListener)
registerSheetListener(xController)
endif
endif
end sub
rem ======================================================
sub onCalcEvent_propertyChange(aEvent)
print("OK Current Sheet has changed")
end sub
rem ======================================================
sub onCalcEvent_disposing(aEvent)
print("controller will be disposed")
end sub
rem ======================================================
sub onFrameEvent_disposing(aEvent)
print("frame will be disposed")
dim xNull as object
xFrame = xNull
end sub
rem ======================================================
sub onFrameEvent_frameAction (aAction)
'COMPONENT_ATTACHED || COMPONENT_REATTACHED
if ((aAction.Action=0) or (aAction.Action=2)) then
if not isNull(xFrame) then
registerSheetListener(xFrame.Controller)
endif
endif
end sub
rem ======================================================
sub registerSheetListener(xController)
if not isNull(xController) then
if HasUnoInterfaces(xController,
"com.sun.star.beans.XPropertySet") then
xPropSetInfo = xController.getPropertySetInfo()
rem if xPropSetInfo.hasPropertyByName("ActiveSheet") then
msgbox "register listener again ..."
xController.addPropertyChangeListener("ActiveSheet", xViewListener)
rem endif
endif
endif
end sub
But some additional notes for using uno listener in basic ...
It's not realy a stable feature. Why ? You must make sure that your basic code
resists inside the right library/module. E.g. putting this macro into a
document
wont work. Its a question of lifetime. Basic cant live longer then the document
itself. So disposing() of your listener isnt guaranteed. But you will have a
global
variable ... which cant be reseted then.
Please make sure that this script will be executed in the right context and try
to
check everything you can check during runtime. A more stable solution would be
using of a non context sensitive environment (e.g. using a real UNO component
written in Java, C++ or Python).
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]