diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-06-06 01:28:55 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-06-06 01:55:19 -0400 |
commit | d0c3c24da2506bff1719a276f2eff34589fa7663 (patch) | |
tree | a4b1c4f5acc3662164734d834f92012291bd5173 /framework | |
parent | f209a7562e85c6d5dd491c8999e8fc61da18a965 (diff) |
Check if the system window has a close handler, and if yes, call it.
This allows the close event in the preview window to be handled in a
custom fashion, instead of having it call the normal "close window"
command.
Change-Id: Id324c4f5c96d0222bf82caa8029aa1c724262c32
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/dispatch/closedispatcher.hxx | 4 | ||||
-rw-r--r-- | framework/source/dispatch/closedispatcher.cxx | 23 |
2 files changed, 26 insertions, 1 deletions
diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx index eabad8c7c56e..9ec937c6ab91 100644 --- a/framework/inc/dispatch/closedispatcher.hxx +++ b/framework/inc/dispatch/closedispatcher.hxx @@ -60,6 +60,8 @@ //_______________________________________________ // namespace +class SystemWindow; + namespace framework{ //----------------------------------------------- @@ -135,6 +137,8 @@ class CloseDispatcher : public css::lang::XTypeProvider /** @short holded alive for internaly asynchronous operations! */ css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener; + SystemWindow* m_pSysWindow; + //------------------------------------------- // native interface diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index cf81fa5d1554..4a5413158443 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -53,12 +53,15 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> +#include "vcl/syswin.hxx" #include <osl/mutex.hxx> #include <unotools/moduleoptions.hxx> //_______________________________________________ // namespace +using namespace com::sun::star; + namespace framework{ #ifdef fpf @@ -96,8 +99,19 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::lang::XMultiSer , m_xSMGR (xSMGR ) , m_aAsyncCallback (LINK( this, CloseDispatcher, impl_asyncCallback)) , m_lStatusListener (m_aLock.getShareableOslMutex() ) + , m_pSysWindow(NULL) { - m_xCloseFrame = CloseDispatcher::static_impl_searchRightTargetFrame(xFrame, sTarget); + uno::Reference<frame::XFrame> xTarget = static_impl_searchRightTargetFrame(xFrame, sTarget); + m_xCloseFrame = xTarget; + + // Try to retrieve the system window instance of the closing frame. + uno::Reference<awt::XWindow> xWindow = xTarget->getContainerWindow(); + if (xWindow.is()) + { + Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + if (pWindow->IsSystemWindow()) + m_pSysWindow = dynamic_cast<SystemWindow*>(pWindow); + } } //----------------------------------------------- @@ -211,6 +225,13 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL& return; } + if (m_pSysWindow && m_pSysWindow->GetCloseHdl().IsSet()) + { + // The closing frame has its own close handler. Call it instead. + m_pSysWindow->GetCloseHdl().Call(m_pSysWindow); + return; + } + // OK - URLs are the right ones. // But we cant execute synchronously :-) // May we are called from a generic key-input handler, |