anwen wrote > > > BTW, I am not sure how to initialize a XDocumentEventBroadcaster which you > mentioned previously in a Calc Extension. I tried this method: > Reference<XSpreadsheetDocument> > xCalc(m_xCC->getServiceManager()->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument")), > m_xCC), UNO_QUERY); But it did not work. > >
I am also interested in XDocumentEventBroadcaster/XDocumentEventListener. I am wondering if you could correct my following code which tries to register a XDocumentListener with the XDocumentEventBroadcaster in a Calc Extension. I did some research on this topic. Most of examples initialize a EventBroadcaster following a bootstrap() method which could not be used in Calc Extension. void SAL_CALL BLPAPIAddIn_Impl::addDocEvtListener() throw (RuntimeException) { // Reference<XModel> xModel = UnoRuntime.queryInterface(XModel.class, uno::UNO_QUERY); Reference<XSpreadsheetDocument> xCalc(m_xCC->getServiceManager()->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument")), m_xCC), UNO_QUERY); if (xCalc.is()) { Reference< XDocumentEventBroadcaster > xBroadcaster(xCalc, UNO_QUERY); if (xBroadcaster.is()) { Reference< XDocumentEventListener > xDocListener( static_cast<XDocumentEventListener*>(new CalcListener()), UNO_QUERY); xBroadcaster->addDocumentEventListener(xDocListener); std::cout << "added an DocEvtListener" << std::endl; } } } Thanks a lot. -- View this message in context: http://nabble.documentfoundation.org/Solarmutex-Deadlock-when-Closing-Calc-which-contains-functions-with-XVolatileResult-return-values-tp3998056p4000189.html Sent from the Dev mailing list archive at Nabble.com. _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice