/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using std::pair; namespace svxform { using ::com::sun::star::uno::Reference; using ::com::sun::star::script::XEventAttacherManager; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::script::XScriptListener; using ::com::sun::star::script::ScriptEvent; using ::com::sun::star::lang::EventObject; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::lang::DisposedException; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::XInterface; using ::com::sun::star::awt::XControl; using ::com::sun::star::beans::XPropertySet; //= FormScriptListener typedef ::cppu::WeakImplHelper < XScriptListener > FormScriptListener_Base; /** implements the XScriptListener interface, is used by FormScriptingEnvironment */ class FormScriptListener :public FormScriptListener_Base { private: ::osl::Mutex m_aMutex; FormScriptingEnvironment *m_pScriptExecutor; public: explicit FormScriptListener( FormScriptingEnvironment * pScriptExecutor ); // XScriptListener virtual void SAL_CALL firing( const ScriptEvent& aEvent ) override; virtual Any SAL_CALL approveFiring( const ScriptEvent& aEvent ) override; // XEventListener virtual void SAL_CALL disposing( const EventObject& Source ) override; // lifetime control void dispose(); protected: virtual ~FormScriptListener() override; private: /** determines whether calling a given method at a given listener interface can be done asynchronously @param _rListenerType the name of the UNO type whose method is to be checked @param _rMethodName the name of the method at the interface determined by _rListenerType @return if and only if the method is declared oneway, i.e. can be called asynchronously */ static bool impl_allowAsynchronousCall_nothrow( const OUString& _rListenerType, const OUString& _rMethodName ); /** determines whether the instance is already disposed */ bool impl_isDisposed_nothrow() const { return !m_pScriptExecutor; } /** fires the given script event in a thread-safe manner This methods calls our script executor's doFireScriptEvent, with previously releasing the given mutex guard, but ensuring that our script executor is not deleted between this release and the actual call. @param _rGuard a clearable guard to our mutex. Must be the only active guard to our mutex. @param _rEvent the event to fire @param _pSynchronousResult a place to take a possible result of the script call. @precond m_pScriptExecutor is not . */ void impl_doFireScriptEvent_nothrow( ::osl::ClearableMutexGuard& _rGuard, const ScriptEvent& _rEvent, Any* _pSynchronousResult ); private: DECL_LINK( OnAsyncScriptEvent, void*, void ); }; FormScriptListener::FormScriptListener( FormScriptingEnvironment* pScriptExecutor ) :m_pScriptExecutor( pScriptExecutor ) { } FormScriptListener::~FormScriptListener() { } bool FormScriptListener::impl_allowAsynchronousCall_nothrow( const OUString& _rListenerType, const OUString& _rMethodName ) { // This used to be implemented as: // is (_rListenerType + "::" + _rMethodName) a oneway function? // since we got rid of the notion of oneway, this is the list // of oneway methods, autogenerated by postprocessing of // commitdiff 90eac3e69749a9227c4b6902b1f3cef1e338c6d1 static const o3tl::sorted_vector> delayed_event_listeners{ pair("com.sun.star.accessibility.XAccessibleComponent","grabFocus"), pair("com.sun.star.accessibility.XAccessibleEventBroadcaster","addAccessibleEventListener"), pair("com.sun.star.accessibility.XAccessibleEventBroadcaster","removeAccessibleEventListener"), pair("com.sun.star.accessibility.XAccessibleSelection","clearAccessibleSelection"), pair("com.sun.star.accessibility.XAccessibleSelection","selectAllAccessibleChildren"), pair("com.sun.star.awt.XActionListener","actionPerformed"), pair("com.sun.star.awt.XActivateListener","windowActivated"), pair("com.sun.star.awt.XActivateListener","windowDeactivated"), pair("com.sun.star.awt.XAdjustmentListener","adjustmentValueChanged"), pair("com.sun.star.awt.XButton","addActionListener"), pair("com.sun.star.awt.XButton","removeActionListener"), pair("com.sun.star.awt.XButton","setLabel"), pair("com.sun.star.awt.XButton","setActionCommand"), pair("com.sun.star.awt.XCheckBox","addItemListener"), pair("com.sun.star.awt.XCheckBox","removeItemListener"), pair("com.sun.star.awt.XCheckBox","setState"), pair("com.sun.star.awt.XCheckBox","setLabel"), pair("com.sun.star.awt.XCheckBox","enableTriState"), pair("com.sun.star.awt.XComboBox","addItemListener"), pair("com.sun.star.awt.XComboBox","removeItemListener"), pair("com.sun.star.awt.XComboBox","addActionListener"), pair("com.sun.star.awt.XComboBox","removeActionListener"), pair("com.sun.star.awt.XComboBox","addItem"), pair("com.sun.star.awt.XComboBox","addItems"), pair("com.sun.star.awt.XComboBox","removeItems"), pair("com.sun.star.awt.XComboBox","setDropDownLineCount"), pair("com.sun.star.awt.XControl","setContext"), pair("com.sun.star.awt.XControl","createPeer"), pair("com.sun.star.awt.XControl","setDesignMode"), pair("com.sun.star.awt.XControlContainer","setStatusText"), pair("com.sun.star.awt.XControlContainer","addControl"), pair("com.sun.star.awt.XControlContainer","removeControl"), pair("com.sun.star.awt.XCurrencyField","setValue"), pair("com.sun.star.awt.XCurrencyField","setMin"), pair("com.sun.star.awt.XCurrencyField","setMax"), pair("com.sun.star.awt.XCurrencyField","setFirst"), pair("com.sun.star.awt.XCurrencyField","setLast"), pair("com.sun.star.awt.XCurrencyField","setSpinSize"), pair("com.sun.star.awt.XCurrencyField","setDecimalDigits"), pair("com.sun.star.awt.XCurrencyField","setStrictFormat"), pair("com.sun.star.awt.XDateField","setDate"), pair("com.sun.star.awt.XDateField","setMin"), pair("com.sun.star.awt.XDateField","setMax"), pair("com.sun.star.awt.XDateField","setFirst"), pair("com.sun.star.awt.XDateField","setLast"), pair("com.sun.star.awt.XDateField","setLongFormat"), pair("com.sun.star.awt.XDateField","setStrictFormat"), pair("com.sun.star.awt.XDialog","setTitle"), pair("com.sun.star.awt.XDisplayConnection","addEventHandler"), pair("com.sun.star.awt.XDisplayConnection","removeEventHandler"), pair("com.sun.star.awt.XDisplayConnection","addErrorHandler"), pair("com.sun.star.awt.XDisplayConnection","removeErrorHandler"), pair("com.sun.star.awt.XExtendedToolkit","addTopWindowListener"), pair("com.sun.star.awt.XExtendedToolkit","removeTopWindowListener"), pair("com.sun.star.awt.XExtendedToolkit","addKeyHandler"), pair("com.sun.star.awt.XExtendedToolkit","removeKeyHandler"), pair("com.sun.star.awt.XExtendedToolkit","addFocusListener"), pair("com.sun.star.awt.XExtendedToolkit","removeFocusListener"), pair("com.sun.star.awt.XExtendedToolkit","fireFocusGained"), pair("com.sun.star.awt.XExtendedToolkit","fireFocusLost"), pair("com.sun.star.awt.XFileDialog","setPath"), pair("com.sun.star.awt.XFileDialog","setFilters"), pair("com.sun.star.awt.XFileDialog","setCurrentFilter"), pair("com.sun.star.awt.XFixedHyperlink","setText"), pair("com.sun.star.awt.XFixedHyperlink","setURL"), pair("com.sun.star.awt.XFixedHyperlink","setAlignment"), pair("com.sun.star.awt.XFixedHyperlink","addActionListener"), pair("com.sun.star.awt.XFixedHyperlink","removeActionListener"), pair("com.sun.star.awt.XFixedText","setText"), pair("com.sun.star.awt.XFixedText","setAlignment"), pair("com.sun.star.awt.XFocusListener","focusGained"), pair("com.sun.star.awt.XFocusListener","focusLost"), pair("com.sun.star.awt.XGraphics","setFont"), pair("com.sun.star.awt.XGraphics","selectFont"), pair("com.sun.star.awt.XGraphics","setTextColor"), pair("com.sun.star.awt.XGraphics","setTextFillColor"), pair("com.sun.star.awt.XGraphics","setLineColor"), pair("com.sun.star.awt.XGraphics","setFillColor"), pair("com.sun.star.awt.XGraphics","setRasterOp"), pair("com.sun.star.awt.XGraphics","setClipRegion"), pair("com.sun.star.awt.XGraphics","intersectClipRegion"), pair("com.sun.star.awt.XGraphics","push"), pair("com.sun.star.awt.XGraphics","pop"), pair("com.sun.star.awt.XGraphics","copy"), pair("com.sun.star.awt.XGraphics","draw"), pair("com.sun.star.awt.XGraphics","drawPixel"), pair("com.sun.star.awt.XGraphics","drawLine"), pair("com.sun.star.awt.XGraphics","drawRect"), pair("com.sun.star.awt.XGraphics","drawRoundedRect"), pair("com.sun.star.awt.XGraphics","drawPolyLine"), pair("com.sun.star.awt.XGraphics","drawPolygon"), pair("com.sun.star.awt.XGraphics","drawPolyPolygon"), pair("com.sun.star.awt.XGraphics","drawEllipse"), pair("com.sun.star.awt.XGraphics","drawArc"), pair("com.sun.star.awt.XGraphics","drawPie"), pair("com.sun.star.awt.XGraphics","drawChord"), pair("com.sun.star.awt.XGraphics","drawGradient"), pair("com.sun.star.awt.XGraphics","drawText"), pair("com.sun.star.awt.XGraphics","drawTextArray"), pair("com.sun.star.awt.XImageButton","addActionListener"), pair("com.sun.star.awt.XImageButton","removeActionListener"), pair("com.sun.star.awt.XImageButton","setActionCommand"), pair("com.sun.star.awt.XImageConsumer","init"), pair("com.sun.star.awt.XImageConsumer","setColorModel"), pair("com.sun.star.awt.XImageConsumer","setPixelsByBytes"), pair("com.sun.star.awt.XImageConsumer","setPixelsByLongs"), pair("com.sun.star.awt.XImageConsumer","complete"), pair("com.sun.star.awt.XImageProducer","addConsumer"), pair("com.sun.star.awt.XImageProducer","removeConsumer"), pair("com.sun.star.awt.XImageProducer","startProduction"), pair("com.sun.star.awt.XItemEventBroadcaster","addItemListener"), pair("com.sun.star.awt.XItemEventBroadcaster","removeItemListener"), pair("com.sun.star.awt.XItemListener","itemStateChanged"), pair("com.sun.star.awt.XKeyListener","keyPressed"), pair("com.sun.star.awt.XKeyListener","keyReleased"), pair("com.sun.star.awt.XListBox","addItemListener"), pair("com.sun.star.awt.XListBox","removeItemListener"), pair("com.sun.star.awt.XListBox","addActionListener"), pair("com.sun.star.awt.XListBox","removeActionListener"), pair("com.sun.star.awt.XListBox","addItem"), pair("com.sun.star.awt.XListBox","addItems"), pair("com.sun.star.awt.XListBox","removeItems"), pair("com.sun.star.awt.XListBox","selectItemPos"), pair("com.sun.star.awt.XListBox","selectItemsPos"), pair("com.sun.star.awt.XListBox","selectItem"), pair("com.sun.star.awt.XListBox","setMultipleMode"), pair("com.sun.star.awt.XListBox","setDropDownLineCount"), pair("com.sun.star.awt.XListBox","makeVisible"), pair("com.sun.star.awt.XMenu","addMenuListener"), pair("com.sun.star.awt.XMenu","removeMenuListener"), pair("com.sun.star.awt.XMenu","insertItem"), pair("com.sun.star.awt.XMenu","removeItem"), pair("com.sun.star.awt.XMenu","enableItem"), pair("com.sun.star.awt.XMenu","setItemText"), pair("com.sun.star.awt.XMenu","setPopupMenu"), pair("com.sun.star.awt.XMenuListener","highlight"), pair("com.sun.star.awt.XMenuListener","select"), pair("com.sun.star.awt.XMenuListener","activate"), pair("com.sun.star.awt.XMenuListener","deactivate"), pair("com.sun.star.awt.XMessageBox","setCaptionText"), pair("com.sun.star.awt.XMessageBox","setMessageText"), pair("com.sun.star.awt.XMouseListener","mousePressed"), pair("com.sun.star.awt.XMouseListener","mouseReleased"), pair("com.sun.star.awt.XMouseListener","mouseEntered"), pair("com.sun.star.awt.XMouseListener","mouseExited"), pair("com.sun.star.awt.XNumericField","setValue"), pair("com.sun.star.awt.XNumericField","setMin"), pair("com.sun.star.awt.XNumericField","setMax"), pair("com.sun.star.awt.XNumericField","setFirst"), pair("com.sun.star.awt.XNumericField","setLast"), pair("com.sun.star.awt.XNumericField","setSpinSize"), pair("com.sun.star.awt.XNumericField","setDecimalDigits"), pair("com.sun.star.awt.XNumericField","setStrictFormat"), pair("com.sun.star.awt.XPaintListener","windowPaint"), pair("com.sun.star.awt.XPatternField","setMasks"), pair("com.sun.star.awt.XPatternField","setString"), pair("com.sun.star.awt.XPatternField","setStrictFormat"), pair("com.sun.star.awt.XPointer","setType"), pair("com.sun.star.awt.XPopupMenu","insertSeparator"), pair("com.sun.star.awt.XPopupMenu","setDefaultItem"), pair("com.sun.star.awt.XPopupMenu","checkItem"), pair("com.sun.star.awt.XProgressBar","setForegroundColor"), pair("com.sun.star.awt.XProgressBar","setBackgroundColor"), pair("com.sun.star.awt.XProgressBar","setRange"), pair("com.sun.star.awt.XProgressBar","setValue"), pair("com.sun.star.awt.XProgressMonitor","addText"), pair("com.sun.star.awt.XProgressMonitor","removeText"), pair("com.sun.star.awt.XProgressMonitor","updateText"), pair("com.sun.star.awt.XRadioButton","addItemListener"), pair("com.sun.star.awt.XRadioButton","removeItemListener"), pair("com.sun.star.awt.XRadioButton","setState"), pair("com.sun.star.awt.XRadioButton","setLabel"), pair("com.sun.star.awt.XRegion","clear"), pair("com.sun.star.awt.XRegion","move"), pair("com.sun.star.awt.XRegion","unionRectangle"), pair("com.sun.star.awt.XRegion","intersectRectangle"), pair("com.sun.star.awt.XRegion","excludeRectangle"), pair("com.sun.star.awt.XRegion","xOrRectangle"), pair("com.sun.star.awt.XRegion","unionRegion"), pair("com.sun.star.awt.XRegion","intersectRegion"), pair("com.sun.star.awt.XRegion","excludeRegion"), pair("com.sun.star.awt.XRegion","xOrRegion"), pair("com.sun.star.awt.XScrollBar","addAdjustmentListener"), pair("com.sun.star.awt.XScrollBar","removeAdjustmentListener"), pair("com.sun.star.awt.XScrollBar","setValue"), pair("com.sun.star.awt.XScrollBar","setValues"), pair("com.sun.star.awt.XScrollBar","setMaximum"), pair("com.sun.star.awt.XScrollBar","setLineIncrement"), pair("com.sun.star.awt.XScrollBar","setBlockIncrement"), pair("com.sun.star.awt.XScrollBar","setVisibleSize"), pair("com.sun.star.awt.XScrollBar","setOrientation"), pair("com.sun.star.awt.XSpinField","addSpinListener"), pair("com.sun.star.awt.XSpinField","removeSpinListener"), pair("com.sun.star.awt.XSpinField","up"), pair("com.sun.star.awt.XSpinField","down"), pair("com.sun.star.awt.XSpinField","first"), pair("com.sun.star.awt.XSpinField","last"), pair("com.sun.star.awt.XSpinField","enableRepeat"), pair("com.sun.star.awt.XSpinListener","up"), pair("com.sun.star.awt.XSpinListener","down"), pair("com.sun.star.awt.XSpinListener","first"), pair("com.sun.star.awt.XSpinListener","last"), pair("com.sun.star.awt.XSpinValue","addAdjustmentListener"), pair("com.sun.star.awt.XSpinValue","removeAdjustmentListener"), pair("com.sun.star.awt.XSpinValue","setValue"), pair("com.sun.star.awt.XSpinValue","setValues"), pair("com.sun.star.awt.XSpinValue","setMinimum"), pair("com.sun.star.awt.XSpinValue","setMaximum"), pair("com.sun.star.awt.XSpinValue","setSpinIncrement"), pair("com.sun.star.awt.XTabController","setModel"), pair("com.sun.star.awt.XTabController","setContainer"), pair("com.sun.star.awt.XTabController","autoTabOrder"), pair("com.sun.star.awt.XTabController","activateTabOrder"), pair("com.sun.star.awt.XTabController","activateFirst"), pair("com.sun.star.awt.XTabController","activateLast"), pair("com.sun.star.awt.XTabControllerModel","setGroupControl"), pair("com.sun.star.awt.XTabControllerModel","setControlModels"), pair("com.sun.star.awt.XTabControllerModel","setGroup"), pair("com.sun.star.awt.XTextComponent","addTextListener"), pair("com.sun.star.awt.XTextComponent","removeTextListener"), pair("com.sun.star.awt.XTextComponent","setText"), pair("com.sun.star.awt.XTextComponent","insertText"), pair("com.sun.star.awt.XTextComponent","setSelection"), pair("com.sun.star.awt.XTextComponent","setEditable"), pair("com.sun.star.awt.XTextComponent","setMaxTextLen"), pair("com.sun.star.awt.XTextEditField","setEchoChar"), pair("com.sun.star.awt.XTextListener","textChanged"), pair("com.sun.star.awt.XTimeField","setTime"), pair("com.sun.star.awt.XTimeField","setMin"), pair("com.sun.star.awt.XTimeField","setMax"), pair("com.sun.star.awt.XTimeField","setFirst"), pair("com.sun.star.awt.XTimeField","setLast"), pair("com.sun.star.awt.XTimeField","setStrictFormat"), pair("com.sun.star.awt.XTopWindow","addTopWindowListener"), pair("com.sun.star.awt.XTopWindow","removeTopWindowListener"), pair("com.sun.star.awt.XTopWindow","toFront"), pair("com.sun.star.awt.XTopWindow","toBack"), pair("com.sun.star.awt.XTopWindow","setMenuBar"), pair("com.sun.star.awt.XTopWindowListener","windowOpened"), pair("com.sun.star.awt.XTopWindowListener","windowClosing"), pair("com.sun.star.awt.XTopWindowListener","windowClosed"), pair("com.sun.star.awt.XTopWindowListener","windowMinimized"), pair("com.sun.star.awt.XTopWindowListener","windowNormalized"), pair("com.sun.star.awt.XTopWindowListener","windowActivated"), pair("com.sun.star.awt.XTopWindowListener","windowDeactivated"), pair("com.sun.star.awt.XUnoControlContainer","setTabControllers"), pair("com.sun.star.awt.XUnoControlContainer","addTabController"), pair("com.sun.star.awt.XUnoControlContainer","removeTabController"), pair("com.sun.star.awt.XUserInputInterception","addKeyHandler"), pair("com.sun.star.awt.XUserInputInterception","removeKeyHandler"), pair("com.sun.star.awt.XUserInputInterception","addMouseClickHandler"), pair("com.sun.star.awt.XUserInputInterception","removeMouseClickHandler"), pair("com.sun.star.awt.XVclContainer","addVclContainerListener"), pair("com.sun.star.awt.XVclContainer","removeVclContainerListener"), pair("com.sun.star.awt.XVclContainerListener","windowAdded"), pair("com.sun.star.awt.XVclContainerListener","windowRemoved"), pair("com.sun.star.awt.XVclContainerPeer","enableDialogControl"), pair("com.sun.star.awt.XVclContainerPeer","setTabOrder"), pair("com.sun.star.awt.XVclContainerPeer","setGroup"), pair("com.sun.star.awt.XVclWindowPeer","setDesignMode"), pair("com.sun.star.awt.XVclWindowPeer","enableClipSiblings"), pair("com.sun.star.awt.XVclWindowPeer","setForeground"), pair("com.sun.star.awt.XVclWindowPeer","setControlFont"), pair("com.sun.star.awt.XView","draw"), pair("com.sun.star.awt.XView","setZoom"), pair("com.sun.star.awt.XWindow","setPosSize"), pair("com.sun.star.awt.XWindow","setVisible"), pair("com.sun.star.awt.XWindow","setEnable"), pair("com.sun.star.awt.XWindow","setFocus"), pair("com.sun.star.awt.XWindow","addWindowListener"), pair("com.sun.star.awt.XWindow","removeWindowListener"), pair("com.sun.star.awt.XWindow","addFocusListener"), pair("com.sun.star.awt.XWindow","removeFocusListener"), pair("com.sun.star.awt.XWindow","addKeyListener"), pair("com.sun.star.awt.XWindow","removeKeyListener"), pair("com.sun.star.awt.XWindow","addMouseListener"), pair("com.sun.star.awt.XWindow","removeMouseListener"), pair("com.sun.star.awt.XWindow","addMouseMotionListener"), pair("com.sun.star.awt.XWindow","removeMouseMotionListener"), pair("com.sun.star.awt.XWindow","addPaintListener"), pair("com.sun.star.awt.XWindow","removePaintListener"), pair("com.sun.star.awt.XWindowListener","windowResized"), pair("com.sun.star.awt.XWindowListener","windowMoved"), pair("com.sun.star.awt.XWindowListener","windowShown"), pair("com.sun.star.awt.XWindowListener","windowHidden"), pair("com.sun.star.awt.XWindowListener2","windowEnabled"), pair("com.sun.star.awt.XWindowListener2","windowDisabled"), pair("com.sun.star.awt.XWindowPeer","setPointer"), pair("com.sun.star.awt.XWindowPeer","setBackground"), pair("com.sun.star.awt.XWindowPeer","invalidate"), pair("com.sun.star.awt.XWindowPeer","invalidateRect"), pair("com.sun.star.awt.grid.XGridSelectionListener","selectionChanged"), pair("com.sun.star.awt.tab.XTabPageContainer","addTabPageContainerListener"), pair("com.sun.star.awt.tab.XTabPageContainer","removeTabPageContainerListener"), pair("com.sun.star.awt.tab.XTabPageContainerListener","tabPageActivated"), pair("com.sun.star.configuration.backend.XBackendChangesNotifier","addChangesListener"), pair("com.sun.star.configuration.backend.XBackendChangesNotifier","removeChangesListener"), pair("com.sun.star.datatransfer.clipboard.XClipboard","setContents"), pair("com.sun.star.datatransfer.clipboard.XClipboardListener","changedContents"), pair("com.sun.star.datatransfer.clipboard.XClipboardNotifier","addClipboardListener"), pair("com.sun.star.datatransfer.clipboard.XClipboardNotifier","removeClipboardListener"), pair("com.sun.star.datatransfer.clipboard.XClipboardOwner","lostOwnership"), pair("com.sun.star.datatransfer.dnd.XAutoscroll","autoscroll"), pair("com.sun.star.datatransfer.dnd.XDragGestureListener","dragGestureRecognized"), pair("com.sun.star.datatransfer.dnd.XDragGestureRecognizer","addDragGestureListener"), pair("com.sun.star.datatransfer.dnd.XDragGestureRecognizer","removeDragGestureListener"), pair("com.sun.star.datatransfer.dnd.XDragSource","startDrag"), pair("com.sun.star.datatransfer.dnd.XDragSourceContext","setCursor"), pair("com.sun.star.datatransfer.dnd.XDragSourceContext","setImage"), pair("com.sun.star.datatransfer.dnd.XDragSourceContext","transferablesFlavorsChanged"), pair("com.sun.star.datatransfer.dnd.XDragSourceListener","dragDropEnd"), pair("com.sun.star.datatransfer.dnd.XDragSourceListener","dragEnter"), pair("com.sun.star.datatransfer.dnd.XDragSourceListener","dragExit"), pair("com.sun.star.datatransfer.dnd.XDragSourceListener","dragOver"), pair("com.sun.star.datatransfer.dnd.XDragSourceListener","dropActionChanged"), pair("com.sun.star.datatransfer.dnd.XDropTarget","addDropTargetListener"), pair("com.sun.star.datatransfer.dnd.XDropTarget","removeDropTargetListener"), pair("com.sun.star.datatransfer.dnd.XDropTarget","setDefaultActions"), pair("com.sun.star.datatransfer.dnd.XDropTargetDragContext","acceptDrag"), pair("com.sun.star.datatransfer.dnd.XDropTargetDragContext","rejectDrag"), pair("com.sun.star.datatransfer.dnd.XDropTargetDropContext","acceptDrop"), pair("com.sun.star.datatransfer.dnd.XDropTargetDropContext","rejectDrop"), pair("com.sun.star.datatransfer.dnd.XDropTargetDropContext","dropComplete"), pair("com.sun.star.datatransfer.dnd.XDropTargetListener","dragEnter"), pair("com.sun.star.datatransfer.dnd.XDropTargetListener","dragExit"), pair("com.sun.star.datatransfer.dnd.XDropTargetListener","dragOver"), pair("com.sun.star.datatransfer.dnd.XDropTargetListener","dropActionChanged"), pair("com.sun.star.document.XEventBroadcaster","addEventListener"), pair("com.sun.star.document.XEventBroadcaster","removeEventListener"), pair("com.sun.star.document.XEventListener","notifyEvent"), pair("com.sun.star.document.XStorageChangeListener","notifyStorageChange"), pair("com.sun.star.drawing.XControlShape","setControl"), pair("com.sun.star.form.XApproveActionBroadcaster","addApproveActionListener"), pair("com.sun.star.form.XApproveActionBroadcaster","removeApproveActionListener"), pair("com.sun.star.form.XBoundControl","setLock"), pair("com.sun.star.form.XChangeBroadcaster","addChangeListener"), pair("com.sun.star.form.XChangeBroadcaster","removeChangeListener"), pair("com.sun.star.form.XChangeListener","changed"), pair("com.sun.star.form.XConfirmDeleteBroadcaster","addConfirmDeleteListener"), pair("com.sun.star.form.XConfirmDeleteBroadcaster","removeConfirmDeleteListener"), pair("com.sun.star.form.XDatabaseParameterBroadcaster","addParameterListener"), pair("com.sun.star.form.XDatabaseParameterBroadcaster","removeParameterListener"), pair("com.sun.star.form.XDatabaseParameterBroadcaster2","addDatabaseParameterListener"), pair("com.sun.star.form.XDatabaseParameterBroadcaster2","removeDatabaseParameterListener"), pair("com.sun.star.form.XErrorBroadcaster","addErrorListener"), pair("com.sun.star.form.XErrorBroadcaster","removeErrorListener"), pair("com.sun.star.form.XFormController","addActivateListener"), pair("com.sun.star.form.XFormController","removeActivateListener"), pair("com.sun.star.form.XFormControllerListener","formActivated"), pair("com.sun.star.form.XFormControllerListener","formDeactivated"), pair("com.sun.star.form.XGrid","setCurrentColumnPosition"), pair("com.sun.star.form.XGridPeer","setColumns"), pair("com.sun.star.form.XLoadListener","loaded"), pair("com.sun.star.form.XLoadListener","unloading"), pair("com.sun.star.form.XLoadListener","unloaded"), pair("com.sun.star.form.XLoadListener","reloading"), pair("com.sun.star.form.XLoadListener","reloaded"), pair("com.sun.star.form.XLoadable","load"), pair("com.sun.star.form.XLoadable","unload"), pair("com.sun.star.form.XLoadable","reload"), pair("com.sun.star.form.XLoadable","addLoadListener"), pair("com.sun.star.form.XLoadable","removeLoadListener"), pair("com.sun.star.form.XPositioningListener","positioned"), pair("com.sun.star.form.XReset","reset"), pair("com.sun.star.form.XReset","addResetListener"), pair("com.sun.star.form.XReset","removeResetListener"), pair("com.sun.star.form.XResetListener","resetted"), pair("com.sun.star.form.XSubmit","submit"), pair("com.sun.star.form.XSubmit","addSubmitListener"), pair("com.sun.star.form.XSubmit","removeSubmitListener"), pair("com.sun.star.form.XUpdateBroadcaster","addUpdateListener"), pair("com.sun.star.form.XUpdateBroadcaster","removeUpdateListener"), pair("com.sun.star.frame.XBrowseHistoryRegistry","updateViewData"), pair("com.sun.star.frame.XBrowseHistoryRegistry","createNewEntry"), pair("com.sun.star.frame.XConfigManager","addPropertyChangeListener"), pair("com.sun.star.frame.XConfigManager","removePropertyChangeListener"), pair("com.sun.star.frame.XConfigManager","flush"), pair("com.sun.star.frame.XDesktop","addTerminateListener"), pair("com.sun.star.frame.XDesktop","removeTerminateListener"), pair("com.sun.star.frame.XDispatch","dispatch"), pair("com.sun.star.frame.XDispatch","addStatusListener"), pair("com.sun.star.frame.XDispatch","removeStatusListener"), pair("com.sun.star.frame.XDocumentTemplates","update"), pair("com.sun.star.frame.XFrame","setCreator"), pair("com.sun.star.frame.XFrame","setName"), pair("com.sun.star.frame.XFrame","activate"), pair("com.sun.star.frame.XFrame","deactivate"), pair("com.sun.star.frame.XFrame","addFrameActionListener"), pair("com.sun.star.frame.XFrame","removeFrameActionListener"), pair("com.sun.star.frame.XFrameActionListener","frameAction"), pair("com.sun.star.frame.XFrameLoader","load"), pair("com.sun.star.frame.XFrameLoader","cancel"), pair("com.sun.star.frame.XLoadEventListener","loadFinished"), pair("com.sun.star.frame.XLoadEventListener","loadCancelled"), pair("com.sun.star.frame.XModel","connectController"), pair("com.sun.star.frame.XModel","disconnectController"), pair("com.sun.star.frame.XModel","lockControllers"), pair("com.sun.star.frame.XModel","unlockControllers"), pair("com.sun.star.frame.XNotifyingDispatch","dispatchWithNotification"), pair("com.sun.star.frame.XRecordableDispatch","dispatchAndRecord"), pair("com.sun.star.frame.XSessionManagerClient","addSessionManagerListener"), pair("com.sun.star.frame.XSessionManagerClient","removeSessionManagerListener"), pair("com.sun.star.frame.XSessionManagerClient","queryInteraction"), pair("com.sun.star.frame.XSessionManagerClient","interactionDone"), pair("com.sun.star.frame.XSessionManagerClient","saveDone"), pair("com.sun.star.frame.XSessionManagerListener","doSave"), pair("com.sun.star.frame.XSessionManagerListener","approveInteraction"), pair("com.sun.star.frame.XSessionManagerListener","shutdownCanceled"), pair("com.sun.star.frame.XSessionManagerListener2","doQuit"), pair("com.sun.star.frame.XStatusListener","statusChanged"), pair("com.sun.star.frame.XTask","tileWindows"), pair("com.sun.star.frame.XTask","arrangeWindowsVertical"), pair("com.sun.star.frame.XTask","arrangeWindowsHorizontal"), pair("com.sun.star.frame.XWindowArranger","arrange"), pair("com.sun.star.inspection.XPropertyControlContext","activateNextControl"), pair("com.sun.star.inspection.XPropertyControlObserver","focusGained"), pair("com.sun.star.inspection.XPropertyControlObserver","valueChanged"), pair("com.sun.star.mozilla.XCloseSessionListener","sessionClosed"), pair("com.sun.star.mozilla.XMenuProxy","addMenuProxyListener"), pair("com.sun.star.mozilla.XMenuProxy","removeMenuProxyListener"), pair("com.sun.star.mozilla.XPluginInstance","start"), pair("com.sun.star.mozilla.XPluginInstance","stop"), pair("com.sun.star.mozilla.XPluginInstance","destroy"), pair("com.sun.star.mozilla.XPluginInstance","createWindow"), pair("com.sun.star.mozilla.XPluginInstance","newStream"), pair("com.sun.star.mozilla.XPluginInstance","newURL"), pair("com.sun.star.mozilla.XPluginInstanceNotifySink","notifyURL"), pair("com.sun.star.mozilla.XPluginInstancePeer","showStatusMessage"), pair("com.sun.star.mozilla.XPluginInstancePeer","enableScripting"), pair("com.sun.star.mozilla.XPluginInstancePeer","newStream"), pair("com.sun.star.mozilla.XPluginInstancePeer","getURL"), pair("com.sun.star.mozilla.XPluginInstancePeer","postURL"), pair("com.sun.star.mozilla.XPluginWindowPeer","setChildWindow"), pair("com.sun.star.script.vba.XVBACompatibility","addVBAScriptListener"), pair("com.sun.star.script.vba.XVBACompatibility","removeVBAScriptListener"), pair("com.sun.star.sdb.XDatabaseAccess","addDatabaseAccessListener"), pair("com.sun.star.sdb.XDatabaseAccess","removeDatabaseAccessListener"), pair("com.sun.star.sdb.XDatabaseAccessListener","connectionChanged"), pair("com.sun.star.sdb.XDatabaseAccessListener","connectionClosing"), pair("com.sun.star.sdb.XRowSetApproveBroadcaster","addRowSetApproveListener"), pair("com.sun.star.sdb.XRowSetApproveBroadcaster","removeRowSetApproveListener"), pair("com.sun.star.sdb.XRowSetChangeListener","onRowSetChanged"), pair("com.sun.star.sdb.XRowSetSupplier","setRowSet"), pair("com.sun.star.sdb.XRowsChangeListener","rowsChanged"), pair("com.sun.star.sdb.XSQLErrorBroadcaster","addSQLErrorListener"), pair("com.sun.star.sdb.XSQLErrorBroadcaster","removeSQLErrorListener"), pair("com.sun.star.sdbc.XRowSet","addRowSetListener"), pair("com.sun.star.sdbc.XRowSet","removeRowSetListener"), pair("com.sun.star.sdbc.XRowSetListener","cursorMoved"), pair("com.sun.star.sdbc.XRowSetListener","rowChanged"), pair("com.sun.star.sdbc.XRowSetListener","rowSetChanged"), pair("com.sun.star.sheet.XCalculatable","enableAutomaticCalculation"), pair("com.sun.star.sheet.XVolatileResult","addResultListener"), pair("com.sun.star.sheet.XVolatileResult","removeResultListener"), pair("com.sun.star.task.XJobExecutor","trigger"), pair("com.sun.star.task.XStatusIndicator","start"), pair("com.sun.star.task.XStatusIndicator","end"), pair("com.sun.star.task.XStatusIndicator","setText"), pair("com.sun.star.task.XStatusIndicator","setValue"), pair("com.sun.star.task.XStatusIndicator","reset"), pair("com.sun.star.text.XSimpleText","insertString"), pair("com.sun.star.text.XTextCursor","collapseToStart"), pair("com.sun.star.text.XTextCursor","collapseToEnd"), pair("com.sun.star.text.XTextRange","setString"), pair("com.sun.star.text.XTextViewCursor","setVisible"), pair("com.sun.star.ucb.XCommandProcessor","abort"), pair("com.sun.star.ucb.XCommandProcessor2","releaseCommandIdentifier"), pair("com.sun.star.ucb.XContent","addContentEventListener"), pair("com.sun.star.ucb.XContent","removeContentEventListener"), pair("com.sun.star.ucb.XContentProviderManager","deregisterContentProvider"), pair("com.sun.star.ucb.XContentTransmitter","transmit"), pair("com.sun.star.ucb.XPropertySetRegistry","removePropertySet"), pair("com.sun.star.ui.XUIConfigurationListener","elementInserted"), pair("com.sun.star.ui.XUIConfigurationListener","elementRemoved"), pair("com.sun.star.ui.XUIConfigurationListener","elementReplaced"), pair("com.sun.star.ui.dialogs.XFilePickerNotifier","addFilePickerListener"), pair("com.sun.star.ui.dialogs.XFilePickerNotifier","removeFilePickerListener"), pair("com.sun.star.util.XBroadcaster","lockBroadcasts"), pair("com.sun.star.util.XBroadcaster","unlockBroadcasts"), pair("com.sun.star.util.XChangesListener","changesOccurred"), pair("com.sun.star.util.XChangesNotifier","addChangesListener"), pair("com.sun.star.util.XChangesNotifier","removeChangesListener"), pair("com.sun.star.util.XCloseBroadcaster","addCloseListener"), pair("com.sun.star.util.XCloseBroadcaster","removeCloseListener"), pair("com.sun.star.util.XFlushable","addFlushListener"), pair("com.sun.star.util.XFlushable","removeFlushListener"), pair("com.sun.star.util.XModeChangeListener","modeChanged"), pair("com.sun.star.util.XModifyBroadcaster","addModifyListener"), pair("com.sun.star.util.XModifyBroadcaster","removeModifyListener"), pair("com.sun.star.util.XRefreshable","addRefreshListener"), pair("com.sun.star.util.XRefreshable","removeRefreshListener"), pair("com.sun.star.util.XSearchDescriptor","setSearchString"), pair("com.sun.star.view.XPrintJobBroadcaster","addPrintJobListener"), pair("com.sun.star.view.XPrintJobBroadcaster","removePrintJobListener"), pair("com.sun.star.view.XPrintJobListener","printJobEvent"), pair("com.sun.star.view.XPrintableBroadcaster","addPrintableListener"), pair("com.sun.star.view.XPrintableBroadcaster","removePrintableListener"), pair("com.sun.star.view.XPrintableListener","stateChanged"), pair("com.sun.star.view.XSelectionChangeListener","selectionChanged"), pair("com.sun.star.beans.XMultiPropertySet","addPropertiesChangeListener"), pair("com.sun.star.beans.XMultiPropertySet","removePropertiesChangeListener"), pair("com.sun.star.beans.XMultiPropertySet","firePropertiesChangeEvent"), pair("com.sun.star.beans.XPropertiesChangeNotifier","addPropertiesChangeListener"), pair("com.sun.star.beans.XPropertiesChangeNotifier","removePropertiesChangeListener"), pair("com.sun.star.container.XContainer","addContainerListener"), pair("com.sun.star.container.XContainer","removeContainerListener"), pair("com.sun.star.container.XContainerListener","elementInserted"), pair("com.sun.star.container.XContainerListener","elementRemoved"), pair("com.sun.star.container.XContainerListener","elementReplaced"), pair("com.sun.star.container.XNamed","setName"), pair("com.sun.star.io.XDataExporter","exportData"), pair("com.sun.star.io.XDataExporter","cancel"), pair("com.sun.star.io.XDataImporter","importData"), pair("com.sun.star.io.XDataImporter","cancel"), pair("com.sun.star.io.XDataTransferEventListener","finished"), pair("com.sun.star.io.XDataTransferEventListener","cancelled"), pair("com.sun.star.lang.XConnectionPointContainer","advise"), pair("com.sun.star.lang.XConnectionPointContainer","unadvise"), pair("com.sun.star.script.XAllListener","firing"), pair("com.sun.star.uno.XInterface","acquire"), pair("com.sun.star.uno.XInterface","release"), pair("com.sun.star.uno.XReference","dispose")}; pair k(_rListenerType, _rMethodName); return delayed_event_listeners.find(k) != delayed_event_listeners.end(); } void FormScriptListener::impl_doFireScriptEvent_nothrow( ::osl::ClearableMutexGuard& _rGuard, const ScriptEvent& _rEvent, Any* _pSynchronousResult ) { OSL_PRECOND( m_pScriptExecutor, "FormScriptListener::impl_doFireScriptEvent_nothrow: this will crash!" ); _rGuard.clear(); m_pScriptExecutor->doFireScriptEvent( _rEvent, _pSynchronousResult ); } void SAL_CALL FormScriptListener::firing( const ScriptEvent& _rEvent ) { if ( _rEvent.ScriptType == "VBAInterop" ) return; // not handled here ::osl::ClearableMutexGuard aGuard( m_aMutex ); if ( impl_isDisposed_nothrow() ) return; if ( !impl_allowAsynchronousCall_nothrow( _rEvent.ListenerType.getTypeName(), _rEvent.MethodName ) ) { impl_doFireScriptEvent_nothrow( aGuard, _rEvent, nullptr ); return; } acquire(); Application::PostUserEvent( LINK( this, FormScriptListener, OnAsyncScriptEvent ), new ScriptEvent( _rEvent ) ); } Any SAL_CALL FormScriptListener::approveFiring( const ScriptEvent& _rEvent ) { Any aResult; ::osl::ClearableMutexGuard aGuard( m_aMutex ); if ( !impl_isDisposed_nothrow() ) impl_doFireScriptEvent_nothrow( aGuard, _rEvent, &aResult ); return aResult; } void SAL_CALL FormScriptListener::disposing( const EventObject& /*Source*/ ) { // not interested in } void FormScriptListener::dispose() { ::osl::MutexGuard aGuard( m_aMutex ); m_pScriptExecutor = nullptr; } namespace { // tdf#88985 If LibreOffice tries to exit during the execution of a macro // then: detect the effort, stop basic execution, block until the macro // returns due to that stop, then restart the quit. This avoids the app // exiting and destroying itself until the macro is parked at a safe place // to do that. class QuitGuard { private: class TerminateListener : public cppu::WeakComponentImplHelper { private: css::uno::Reference m_xDesktop; osl::Mutex maMutex; bool mbQuitBlocked; public: // XTerminateListener virtual void SAL_CALL queryTermination(const css::lang::EventObject& /*rEvent*/) override { mbQuitBlocked = true; #if HAVE_FEATURE_SCRIPTING StarBASIC::Stop(); #endif throw css::frame::TerminationVetoException(); } virtual void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) override { mbQuitBlocked = false; } using cppu::WeakComponentImplHelperBase::disposing; virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override { const bool bShutDown = (rEvent.Source == m_xDesktop); if (bShutDown && m_xDesktop.is()) { m_xDesktop->removeTerminateListener(this); m_xDesktop.clear(); } } // XServiceInfo virtual OUString SAL_CALL getImplementationName() override { return "com.sun.star.comp.svx.StarBasicQuitGuard"; } virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override { return cppu::supportsService(this, ServiceName); } virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override { return { "com.sun.star.svx.StarBasicQuitGuard" }; } public: TerminateListener() : cppu::WeakComponentImplHelper(maMutex) , mbQuitBlocked(false) { } void start() { css::uno::Reference xContext(comphelper::getProcessComponentContext()); m_xDesktop = css::frame::Desktop::create(xContext); m_xDesktop->addTerminateListener(this); } void stop() { if (!m_xDesktop.is()) return; m_xDesktop->removeTerminateListener(this); if (mbQuitBlocked) m_xDesktop->terminate(); } }; rtl::Reference mxListener; public: QuitGuard() : mxListener(new TerminateListener) { mxListener->start(); } ~QuitGuard() { mxListener->stop(); } }; } IMPL_LINK( FormScriptListener, OnAsyncScriptEvent, void*, p, void ) { ScriptEvent* _pEvent = static_cast(p); OSL_PRECOND( _pEvent != nullptr, "FormScriptListener::OnAsyncScriptEvent: invalid event!" ); if ( !_pEvent ) return; { ::osl::ClearableMutexGuard aGuard( m_aMutex ); if ( !impl_isDisposed_nothrow() ) { QuitGuard aQuitGuard; impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, nullptr ); } } delete _pEvent; // we acquired ourself immediately before posting the event release(); } FormScriptingEnvironment::FormScriptingEnvironment( FmFormModel& _rModel ) :m_rFormModel( _rModel ) ,m_bDisposed( false ) { m_pScriptListener = new FormScriptListener( this ); // note that this is a cyclic reference between the FormScriptListener and the FormScriptingEnvironment // This cycle is broken up when our instance is disposed. } void FormScriptingEnvironment::impl_registerOrRevoke_throw( const Reference< XEventAttacherManager >& _rxManager, bool _bRegister ) { ::osl::MutexGuard aGuard( m_aMutex ); if ( !_rxManager.is() ) throw IllegalArgumentException(); if ( m_bDisposed ) throw DisposedException(); try { if ( _bRegister ) _rxManager->addScriptListener( m_pScriptListener.get() ); else _rxManager->removeScriptListener( m_pScriptListener.get() ); } catch( const RuntimeException& ) { throw; } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("svx"); } } void FormScriptingEnvironment::registerEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager ) { impl_registerOrRevoke_throw( _rxManager, true ); } void FormScriptingEnvironment::revokeEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager ) { impl_registerOrRevoke_throw( _rxManager, false ); } namespace { class NewStyleUNOScript { SfxObjectShell& m_rObjectShell; const OUString m_sScriptCode; public: NewStyleUNOScript( SfxObjectShell& _rObjectShell, const OUString& _rScriptCode ) :m_rObjectShell( _rObjectShell ) ,m_sScriptCode( _rScriptCode ) { } void invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult ); }; void NewStyleUNOScript::invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult ) { Sequence< sal_Int16 > aOutArgsIndex; Sequence< Any > aOutArgs; EventObject aEvent; Any aCaller; if ( _rArguments.hasElements() && ( _rArguments[ 0 ] >>= aEvent ) ) { try { Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW ); Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW ); aCaller = xProps->getPropertyValue("Name"); } catch( Exception& ) {} } m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : nullptr ); } } void FormScriptingEnvironment::doFireScriptEvent( const ScriptEvent& _rEvent, Any* _pSynchronousResult ) { #if !HAVE_FEATURE_SCRIPTING (void) _rEvent; (void) _pSynchronousResult; (void) m_rFormModel; #else SolarMutexClearableGuard aSolarGuard; ::osl::ClearableMutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) return; // SfxObjectShellRef is good here since the model controls the lifetime of the object SfxObjectShellRef xObjectShell = m_rFormModel.GetObjectShell(); if( !xObjectShell.is() ) return; // the script to execute std::shared_ptr< NewStyleUNOScript > pScript; if ( _rEvent.ScriptType != "StarBasic" ) { pScript.reset( new NewStyleUNOScript( *xObjectShell, _rEvent.ScriptCode ) ); } else { OUString sScriptCode = _rEvent.ScriptCode; OUString sMacroLocation; // is there a location in the script name ("application" or "document")? sal_Int32 nPrefixLen = sScriptCode.indexOf( ':' ); DBG_ASSERT( 0 <= nPrefixLen, "FormScriptingEnvironment::doFireScriptEvent: Basic script name in old format encountered!" ); if ( 0 <= nPrefixLen ) { // and it has such a prefix sMacroLocation = sScriptCode.copy( 0, nPrefixLen ); DBG_ASSERT( sMacroLocation == "document" || sMacroLocation == "application", "FormScriptingEnvironment::doFireScriptEvent: invalid (unknown) prefix!" ); // strip the prefix: the SfxObjectShell::CallScript knows nothing about such prefixes sScriptCode = sScriptCode.copy( nPrefixLen + 1 ); } if ( sMacroLocation.isEmpty() ) { // legacy format: use the app-wide Basic, if it has a respective method, otherwise fall back to the doc's Basic if ( SfxApplication::GetBasicManager()->HasMacro( sScriptCode ) ) sMacroLocation = "application"; else sMacroLocation = "document"; } OUString sScriptURI = "vnd.sun.star.script:" + sScriptCode + "?language=Basic&location=" + sMacroLocation; pScript.reset( new NewStyleUNOScript( *xObjectShell, sScriptURI ) ); } assert(pScript && "FormScriptingEnvironment::doFireScriptEvent: no script to execute!"); aGuard.clear(); aSolarGuard.clear(); Any aIgnoreResult; pScript->invoke( _rEvent.Arguments, _pSynchronousResult ? *_pSynchronousResult : aIgnoreResult ); pScript.reset(); { // object shells are not thread safe, so guard the destruction SolarMutexGuard aSolarGuarsReset; xObjectShell = nullptr; } #endif } void FormScriptingEnvironment::dispose() { ::osl::MutexGuard aGuard( m_aMutex ); m_bDisposed = true; m_pScriptListener->dispose(); m_pScriptListener.clear(); } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */