Kaydet (Commit) d0c3c24d authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst f209a756
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
//_______________________________________________ //_______________________________________________
// namespace // namespace
class SystemWindow;
namespace framework{ namespace framework{
//----------------------------------------------- //-----------------------------------------------
...@@ -135,6 +137,8 @@ class CloseDispatcher : public css::lang::XTypeProvider ...@@ -135,6 +137,8 @@ class CloseDispatcher : public css::lang::XTypeProvider
/** @short holded alive for internaly asynchronous operations! */ /** @short holded alive for internaly asynchronous operations! */
css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener; css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener;
SystemWindow* m_pSysWindow;
//------------------------------------------- //-------------------------------------------
// native interface // native interface
......
...@@ -53,12 +53,15 @@ ...@@ -53,12 +53,15 @@
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include "vcl/syswin.hxx"
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <unotools/moduleoptions.hxx> #include <unotools/moduleoptions.hxx>
//_______________________________________________ //_______________________________________________
// namespace // namespace
using namespace com::sun::star;
namespace framework{ namespace framework{
#ifdef fpf #ifdef fpf
...@@ -96,8 +99,19 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::lang::XMultiSer ...@@ -96,8 +99,19 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::lang::XMultiSer
, m_xSMGR (xSMGR ) , m_xSMGR (xSMGR )
, m_aAsyncCallback (LINK( this, CloseDispatcher, impl_asyncCallback)) , m_aAsyncCallback (LINK( this, CloseDispatcher, impl_asyncCallback))
, m_lStatusListener (m_aLock.getShareableOslMutex() ) , 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& ...@@ -211,6 +225,13 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
return; 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. // OK - URLs are the right ones.
// But we cant execute synchronously :-) // But we cant execute synchronously :-)
// May we are called from a generic key-input handler, // May we are called from a generic key-input handler,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment