summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.cxx9
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx19
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx1
3 files changed, 28 insertions, 1 deletions
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 939ade408e3a..2efdad5af545 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -30,6 +30,7 @@
#include "../misc/WinImplHelper.hxx"
#include "shared.hxx"
+#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
@@ -524,7 +525,11 @@ void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::An
}
break;
}
-
+ css::uno::Reference<css::awt::XWindow> xParentWindow;
+ if(lArguments.getLength() > 1)
+ {
+ lArguments[1] >>= xParentWindow;
+ }
RequestRef rRequest(new Request());
if (bFileOpenDialog)
rRequest->setRequest (VistaFilePickerImpl::E_CREATE_OPEN_DIALOG);
@@ -532,6 +537,8 @@ void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::An
rRequest->setRequest (VistaFilePickerImpl::E_CREATE_SAVE_DIALOG);
rRequest->setArgument(PROP_FEATURES, nFeatures);
rRequest->setArgument(PROP_TEMPLATE_DESCR, nTemplate);
+ if(xParentWindow.is())
+ rRequest->setArgument(PROP_PARENT_WINDOW, xParentWindow);
if ( ! m_aAsyncExecute.isRunning())
m_aAsyncExecute.create();
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index 9e24e9e352ed..3018a08282c2 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -26,9 +26,13 @@
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+#include <com/sun/star/lang/SystemDependent.hpp>
#include <comphelper/sequence.hxx>
#include <osl/file.hxx>
#include <osl/mutex.hxx>
+#include <rtl/process.h>
#ifdef __MINGW32__
#include <limits.h>
#endif
@@ -477,6 +481,21 @@ void VistaFilePickerImpl::impl_sta_CreateSaveDialog(const RequestRef& rRequest)
::sal_Int32 nFeatures = rRequest->getArgumentOrDefault(PROP_FEATURES, (::sal_Int32)0);
::sal_Int32 nTemplate = rRequest->getArgumentOrDefault(PROP_TEMPLATE_DESCR, (::sal_Int32)0);
+ css::uno::Reference<css::awt::XWindow> xWindow = rRequest->getArgumentOrDefault(PROP_PARENT_WINDOW, css::uno::Reference<css::awt::XWindow>());
+ if(xWindow.is())
+ {
+ css::uno::Reference<css::awt::XSystemDependentWindowPeer> xSysDepWin(xWindow,css::uno::UNO_QUERY);
+ if(xSysDepWin.is()) {
+ css::uno::Sequence<sal_Int8> aProcessIdent(16);
+ rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray());
+ css::uno::Any aAny = xSysDepWin->getWindowHandle(aProcessIdent,css::lang::SystemDependent::SYSTEM_WIN32);
+ sal_Int64 tmp;
+ aAny >>= tmp;
+ if(tmp != 0)
+ m_hParentWindow = (HWND) tmp;
+ }
+ }
+
impl_sta_enableFeatures(nFeatures, nTemplate);
VistaFilePickerEventHandler* pHandlerImpl = (VistaFilePickerEventHandler*)iHandler.get();
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
index 5a7e7f44d97e..c457e290064d 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
@@ -90,6 +90,7 @@ static const OUString PROP_CONTROL_ACTION("control_action" ); // [sal_Int16]
static const OUString PROP_CONTROL_VALUE("control_value" ); // [Any]
static const OUString PROP_CONTROL_LABEL("control_label" ); // [OUString]
static const OUString PROP_CONTROL_ENABLE("control_enable" ); // [sal_Bool] true=ON, false=OFF
+static const OUString PROP_PARENT_WINDOW("ParentWindow"); //[css::awt::XWindow] preferred parent window
static const OUString STRING_SEPARATOR("------------------------------------------" );