[Libreoffice-commits] .: Branch 'libreoffice-3-6' - framework/inc framework/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Jun 5 22:56:05 PDT 2012
framework/inc/dispatch/closedispatcher.hxx | 4 ++++
framework/source/dispatch/closedispatcher.cxx | 23 ++++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
New commits:
commit ca182b4545239ccf5b0326674fd66891c1ed9f71
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jun 6 01:28:55 2012 -0400
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
diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx
index eabad8c..9ec937c 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 cf81fa5..4a54131 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,
More information about the Libreoffice-commits
mailing list