diff options
Diffstat (limited to 'framework/source/services/frame.cxx')
-rw-r--r-- | framework/source/services/frame.cxx | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index a1e0e745cf54..0cbc1ca68f9d 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -71,6 +71,7 @@ #include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> +#include <rtl/ref.hxx> #include <sal/log.hxx> #include <vcl/window.hxx> #include <vcl/wrkwin.hxx> @@ -78,7 +79,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <unotools/moduleoptions.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <unotools/cmdoptions.hxx> #include <vcl/threadex.hxx> #include <mutex> @@ -113,7 +114,7 @@ class XFrameImpl: { public: - explicit XFrameImpl(const css::uno::Reference< css::uno::XComponentContext >& xContext); + explicit XFrameImpl(css::uno::Reference< css::uno::XComponentContext > xContext); /// Initialization function after having acquire()'d. void initListeners(); @@ -353,7 +354,7 @@ private: // non threadsafe void impl_checkMenuCloser ( ); - void impl_setCloser ( const css::uno::Reference< css::frame::XFrame2 >& xFrame , bool bState ); + static void impl_setCloser ( const css::uno::Reference< css::frame::XFrame2 >& xFrame , bool bState ); void disableLayoutManager(const css::uno::Reference< css::frame::XLayoutManager2 >& xLayoutManager); @@ -374,7 +375,7 @@ private: /// points to an external set progress, which should be used instead of the internal one. css::uno::WeakReference< css::task::XStatusIndicator > m_xIndicatorInterception; /// helper for XDispatch/Provider and interception interfaces - css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper; + rtl::Reference< InterceptionHelper > m_xDispatchHelper; /// helper for XFrames, XIndexAccess and XElementAccess interfaces css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// container for ALL Listener @@ -452,10 +453,10 @@ private: The value must be different from NULL! @onerror ASSERT in debug version or nothing in release version. *//*-*****************************************************************************************************/ -XFrameImpl::XFrameImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext ) +XFrameImpl::XFrameImpl( css::uno::Reference< css::uno::XComponentContext > xContext ) : PartialWeakComponentImplHelper(m_aMutex) // init member - , m_xContext ( xContext ) + , m_xContext (std::move( xContext )) , m_aListenerContainer ( m_aMutex ) , m_eActiveState ( E_INACTIVE ) , m_bIsFrameTop ( true ) // I think we are top without a parent ... and there is no parent yet! @@ -765,15 +766,14 @@ void SAL_CALL XFrameImpl::initialize( const css::uno::Reference< css::awt::XWind /* SAFE AREA ----------------------------------------------------------------------------------------------- */ SolarMutexResettableGuard aWriteLock; + // This must be the first call of this method! + // We should initialize our object and open it for working. if ( m_xContainerWindow.is() ) throw css::uno::RuntimeException( "XFrameImpl::initialized() is called more than once, which is not useful nor allowed.", static_cast< css::frame::XFrame* >(this)); - // This must be the first call of this method! - // We should initialize our object and open it for working. // Set the new window. - SAL_WARN_IF( m_xContainerWindow.is(), "fwk.frame", "XFrameImpl::initialize(): Leak detected! This state should never occur ..." ); m_xContainerWindow = xWindow; // if window is initially visible, we will never get a windowShowing event @@ -799,17 +799,18 @@ void SAL_CALL XFrameImpl::initialize( const css::uno::Reference< css::awt::XWind lcl_enableLayoutManager(xLayoutManager, this); // create progress helper - css::uno::Reference< css::frame::XFrame > xThis (static_cast< css::frame::XFrame* >(this), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory = - css::task::StatusIndicatorFactory::createWithFrame(m_xContext, xThis, - false/*DisableReschedule*/, true/*AllowParentShow*/ ); + css::uno::Reference< css::frame::XFrame > xThis (this); + { + css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory = + css::task::StatusIndicatorFactory::createWithFrame(m_xContext, xThis, + false/*DisableReschedule*/, true/*AllowParentShow*/ ); - // SAFE -> ---------------------------------- - aWriteLock.reset(); - m_xIndicatorFactoryHelper = xIndicatorFactory; - aWriteLock.clear(); - // <- SAFE ---------------------------------- + // SAFE -> ---------------------------------- + aWriteLock.reset(); + m_xIndicatorFactoryHelper = std::move(xIndicatorFactory); + aWriteLock.clear(); + // <- SAFE ---------------------------------- + } // Start listening for events after setting it on helper class ... // So superfluous messages are filtered to NULL :-) @@ -1475,6 +1476,15 @@ sal_Bool SAL_CALL XFrameImpl::setComponent(const css::uno::Reference< css::awt:: { SolarMutexGuard aWriteLock; m_xController = nullptr; + + if (m_xDispatchHelper) + { + rtl::Reference<DispatchProvider> pDispatchProvider = m_xDispatchHelper->GetSlave(); + if (pDispatchProvider) + { + pDispatchProvider->ClearProtocolHandlers(); + } + } } /* } SAFE */ @@ -2109,7 +2119,7 @@ void SAL_CALL XFrameImpl::disposing() css::uno::Reference< css::lang::XEventListener > xDispatchHelper; { SolarMutexGuard g; - xDispatchHelper.set(m_xDispatchHelper, css::uno::UNO_QUERY_THROW); + xDispatchHelper = m_xDispatchHelper; } xDispatchHelper->disposing(aEvent); xDispatchHelper.clear(); @@ -2305,7 +2315,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL XFrameImpl::queryDispatch( aCommand = aURL.Path; // Make std::unordered_map lookup if the current URL is in the disabled list - if ( m_aCommandOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aCommand ) ) + if ( m_aCommandOptions.LookupDisabled( aCommand ) ) return css::uno::Reference< css::frame::XDispatch >(); else { @@ -2375,7 +2385,7 @@ void SAL_CALL XFrameImpl::registerDispatchProviderInterceptor( css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper; { SolarMutexGuard g; - xInterceptionHelper.set( m_xDispatchHelper, css::uno::UNO_QUERY ); + xInterceptionHelper = m_xDispatchHelper; } if (xInterceptionHelper.is()) { xInterceptionHelper->registerDispatchProviderInterceptor( xInterceptor ); @@ -2394,7 +2404,7 @@ void SAL_CALL XFrameImpl::releaseDispatchProviderInterceptor( css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper; { SolarMutexGuard g; - xInterceptionHelper.set( m_xDispatchHelper, css::uno::UNO_QUERY ); + xInterceptionHelper = m_xDispatchHelper; } if (xInterceptionHelper.is()) { xInterceptionHelper->releaseDispatchProviderInterceptor( xInterceptor ); @@ -3203,7 +3213,7 @@ void XFrameImpl::implts_checkSuicide() @param bState <TRUE/> enable; <FALSE/> disable this state */ - +// static void XFrameImpl::impl_setCloser( /*IN*/ const css::uno::Reference< css::frame::XFrame2 >& xFrame , /*IN*/ bool bState ) { @@ -3217,7 +3227,7 @@ void XFrameImpl::impl_setCloser( /*IN*/ const css::uno::Reference< css::frame::X css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; xFrameProps->getPropertyValue(FRAME_PROPNAME_ASCII_LAYOUTMANAGER) >>= xLayoutManager; css::uno::Reference< css::beans::XPropertySet > xLayoutProps(xLayoutManager, css::uno::UNO_QUERY_THROW); - xLayoutProps->setPropertyValue(LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, css::uno::makeAny(bState)); + xLayoutProps->setPropertyValue(LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, css::uno::Any(bState)); } catch(const css::uno::RuntimeException&) { throw; } |