summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2009-08-05 09:18:12 +0200
committersb <sb@openoffice.org>2009-08-05 09:18:12 +0200
commit8cc805c72c5ba47161a29a321f0502bc545923f4 (patch)
treefd8f13dbb6b026879a2cd15f8f0f418c7a4ae278 /fpicker
parent12e4406275bcc76322bc5c6f10a86b3159fb9277 (diff)
parent2cb47c5b89bd896be8cd0a3565d9bdf22b8b3a69 (diff)
merged in DEV300_m54
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/filepicker/FPentry.cxx4
-rw-r--r--fpicker/source/win32/filepicker/SolarMutex.cxx58
-rw-r--r--fpicker/source/win32/filepicker/SolarMutex.hxx33
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.cxx16
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx126
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx5
-rw-r--r--fpicker/source/win32/filepicker/asynceventnotifier.cxx5
-rw-r--r--fpicker/source/win32/filepicker/asyncrequests.cxx2
-rw-r--r--fpicker/source/win32/filepicker/filepickerstate.cxx23
-rw-r--r--fpicker/source/win32/filepicker/makefile.mk3
-rw-r--r--fpicker/source/win32/folderpicker/MtaFop.cxx34
-rw-r--r--fpicker/source/win32/misc/WinImplHelper.cxx46
-rw-r--r--fpicker/source/win32/misc/WinImplHelper.hxx2
13 files changed, 299 insertions, 58 deletions
diff --git a/fpicker/source/win32/filepicker/FPentry.cxx b/fpicker/source/win32/filepicker/FPentry.cxx
index 48cc3cc53a50..bc3d020baaad 100644
--- a/fpicker/source/win32/filepicker/FPentry.cxx
+++ b/fpicker/source/win32/filepicker/FPentry.cxx
@@ -66,9 +66,9 @@ static Reference< XInterface > SAL_CALL createInstance(
const Reference< XMultiServiceFactory >& rServiceManager )
{
Reference< XInterface > xDlg;
- bool bVista = IsWindowsVista();
+ bool bVistaOrNewer = IsWindowsVistaOrNewer();
- if (bVista)
+ if (bVistaOrNewer)
{
fprintf(stdout, "use special (vista) system file picker ...\n");
xDlg.set(
diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx
new file mode 100644
index 000000000000..3c446f412e46
--- /dev/null
+++ b/fpicker/source/win32/filepicker/SolarMutex.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asynceventnotifier.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <osl/thread.hxx>
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId)
+{
+ int nAcquireCount = 0;
+ vos::IMutex& rSolarMutex = Application::GetSolarMutex();
+ vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier();
+
+ if ( nMainThreadId == nThreadId )
+ {
+ ::vos::IMutex& rMutex = Application::GetSolarMutex();
+ if ( rMutex.tryToAcquire() )
+ nAcquireCount = Application::ReleaseSolarMutex() - 1;
+ }
+
+ return nAcquireCount;
+}
+
+void AcquireSolarMutex(int nAcquireCount)
+{
+ if ( nAcquireCount )
+ Application::AcquireSolarMutex( nAcquireCount );
+}
diff --git a/fpicker/source/win32/filepicker/SolarMutex.hxx b/fpicker/source/win32/filepicker/SolarMutex.hxx
new file mode 100644
index 000000000000..95dcf13ecc3b
--- /dev/null
+++ b/fpicker/source/win32/filepicker/SolarMutex.hxx
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: asynceventnotifier.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId);
+
+void AcquireSolarMutex(int nAcquireCount);
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index eb26f23952d7..84d17dbbc0b1 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <cppuhelper/interfacecontainer.h>
+#include <comphelper/configurationhelper.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <osl/file.hxx>
@@ -294,9 +295,24 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const ::rtl::OUString& sDirec
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
+ const ::rtl::OUString aPackage( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/"));
+ const ::rtl::OUString aRelPath( RTL_CONSTASCII_USTRINGPARAM("Path/Info"));
+ const ::rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged"));
+
+ css::uno::Any aValue = ::comphelper::ConfigurationHelper::readDirectKey(
+ m_xSMGR, aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY);
+
+ bool bChanged(false);
+ if (( aValue >>= bChanged ) && bChanged )
+ {
+ ::comphelper::ConfigurationHelper::writeDirectKey(
+ m_xSMGR, aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD);
+ }
+
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_SET_DIRECTORY);
rRequest->setArgument(PROP_DIRECTORY, sDirectory);
+ rRequest->setArgument(PROP_FORCE, bChanged);
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
}
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index a22ef2bea143..23467f148f4b 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -40,6 +40,7 @@
#include <comphelper/sequenceasvector.hxx>
#include <osl/file.hxx>
#include <osl/mutex.hxx>
+#include "..\misc\WinImplHelper.hxx"
inline bool is_current_process_window(HWND hwnd)
{
@@ -401,7 +402,6 @@ void VistaFilePickerImpl::impl_sta_CreateOpenDialog(const RequestRef& rRequest)
nFlags |= FOS_FILEMUSTEXIST;
nFlags |= FOS_OVERWRITEPROMPT;
nFlags |= FOS_DONTADDTORECENT;
- nFlags |= FOS_ALLOWMULTISELECT;
iDialog->SetOptions ( nFlags );
@@ -462,6 +462,14 @@ static const ::sal_Int32 GROUP_IMAGETEMPLATE = 3;
static const ::sal_Int32 GROUP_CHECKBOXES = 4;
//-------------------------------------------------------------------------------
+static void setLabelToControl(CResourceProvider& rResourceProvider, TFileDialogCustomize iCustom, sal_uInt16 nControlId)
+{
+ ::rtl::OUString aLabel = rResourceProvider.getResString(nControlId);
+ aLabel = SOfficeToWindowsLabel(aLabel);
+ iCustom->SetControlLabel(nControlId, reinterpret_cast<LPCWSTR>(aLabel.getStr()) );
+}
+
+//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_Int32 nTemplate)
{
GUID aGUID = {};
@@ -536,23 +544,48 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I
iCustom->StartVisualGroup (GROUP_CHECKBOXES, L"");
+ sal_uInt16 nControlId(0);
if ((nFeatures & FEATURE_AUTOEXTENSION) == FEATURE_AUTOEXTENSION)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, L"Auto Extension", true);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION;
+ iCustom->AddCheckButton (nControlId, L"Auto Extension", true);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_PASSWORD) == FEATURE_PASSWORD)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, L"Password", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD;
+ iCustom->AddCheckButton (nControlId, L"Password", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_READONLY) == FEATURE_READONLY)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY, L"Readonly", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY;
+ iCustom->AddCheckButton (nControlId, L"Readonly", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_FILTEROPTIONS) == FEATURE_FILTEROPTIONS)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, L"Filter Options", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS;
+ iCustom->AddCheckButton (nControlId, L"Filter Options", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_LINK) == FEATURE_LINK)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, L"Link", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK;
+ iCustom->AddCheckButton (nControlId, L"Link", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
if ((nFeatures & FEATURE_SELECTION) == FEATURE_SELECTION)
- iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, L"Selection", false);
+ {
+ nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION;
+ iCustom->AddCheckButton (nControlId, L"Selection", false);
+ setLabelToControl(m_ResProvider, iCustom, nControlId);
+ }
/* can be ignored ... new COM dialog supports preview native now !
if ((nFeatures & FEATURE_PREVIEW) == FEATURE_PREVIEW)
@@ -620,8 +653,9 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const RequestRef& rRequest)
void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
{
::rtl::OUString sDirectory = rRequest->getArgumentOrDefault(PROP_DIRECTORY, ::rtl::OUString());
+ bool bForce = rRequest->getArgumentOrDefault(PROP_FORCE, false);
- if( !m_bInExecute )
+ if( !m_bInExecute)
{
// Vista stores last used folders for file dialogs
// so we don't want the application to change the folder
@@ -629,7 +663,6 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
// Store the requested folder in the mean time and decide later
// what to do
m_sDirectory = sDirectory;
- return;
}
// SYNCHRONIZED->
@@ -647,7 +680,13 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
if ( FAILED(hResult) )
return;
- iDialog->SetFolder(pFolder);
+ if ( m_bInExecute || bForce )
+ iDialog->SetFolder(pFolder);
+ else
+ {
+ // Use set default folder as Microsoft recommends in the IFileDialog documentation.
+ iDialog->SetDefaultFolder(pFolder);
+ }
}
void VistaFilePickerImpl::impl_sta_GetDirectory(const RequestRef& rRequest)
@@ -815,21 +854,62 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
aLock.clear();
// <- SYNCHRONIZED
+ // we set the directory only if we have a save dialog and a filename
+ // for the other cases, the file dialog remembers its last location
+ // according to its client guid.
if( m_sDirectory.getLength())
{
- // we set the directory only if we have a save dialog and a filename
- // for the other cases, the file dialog remembers its last location
- // according to its client guid.
- if (iSave.is() && m_sFilename.getLength())
+ ComPtr< IShellItem > pFolder;
+ #ifdef __MINGW32__
+ HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) );
+ #else
+ HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) );
+ #endif
+ if ( SUCCEEDED(hResult) )
{
- ComPtr< IShellItem > pFolder;
- #ifdef __MINGW32__
- HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) );
- #else
- HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) );
- #endif
- if ( SUCCEEDED(hResult) )
- iDialog->SetFolder(pFolder);
+ if (m_sFilename.getLength())
+ {
+ ::rtl::OUString aFileURL(m_sDirectory);
+ sal_Int32 nIndex = aFileURL.lastIndexOf('/');
+ if (nIndex != aFileURL.getLength()-1)
+ aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/"));
+ aFileURL += m_sFilename;
+
+ TFileDialogCustomize iCustom = impl_getCustomizeInterface();
+
+ BOOL bValue = FALSE;
+ HRESULT hResult = iCustom->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
+ if ( bValue )
+ {
+ ::rtl::OUString aExt;
+ UINT nFileType;
+ hResult = iDialog->GetFileTypeIndex(&nFileType);
+ if ( SUCCEEDED(hResult) )
+ {
+ ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters);
+ LPCWSTR lpFilterExt = lFilters[nFileType].pszSpec;
+
+ lpFilterExt = wcsrchr( lpFilterExt, '.' );
+ if ( lpFilterExt )
+ aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt);
+ }
+ }
+
+ // Check existence of file. Set folder only for this special case
+ ::rtl::OUString aSystemPath;
+ osl_getSystemPathFromFileURL( aFileURL.pData, &aSystemPath.pData );
+
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( reinterpret_cast<LPCWSTR>(aSystemPath.getStr()), &aFindFileData );
+ if (hFind != INVALID_HANDLE_VALUE)
+ iDialog->SetFolder(pFolder);
+ else
+ hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
+
+ FindClose( hFind );
+ }
+ else
+ hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
}
}
@@ -1048,7 +1128,7 @@ void VistaFilePickerImpl::impl_sta_SetControlLabel(const RequestRef& rRequest)
}
//-------------------------------------------------------------------------------
-void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& rRequest)
+void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& /*rRequest*/)
{
}
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
index 6046876207fc..b15b5c24c52d 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
@@ -42,6 +42,7 @@
#include "FilterContainer.hxx"
#include "VistaFilePickerEventHandler.hxx"
#include "IVistaFilePickerInternalNotify.hxx"
+#include "..\misc\resourceprovider.hxx"
#include <com/sun/star/uno/Sequence.hxx>
@@ -101,6 +102,7 @@ static const ::rtl::OUString PROP_FEATURES = ::rtl::OUString::createF
static const ::rtl::OUString PROP_TEMPLATE_DESCR = ::rtl::OUString::createFromAscii("templatedescription"); // [sal_Int32]
static const ::rtl::OUString PROP_FILTER_TITLE = ::rtl::OUString::createFromAscii("filter_title" ); // [OUString]
static const ::rtl::OUString PROP_FILTER_VALUE = ::rtl::OUString::createFromAscii("filter_value" ); // [OUString]
+static const ::rtl::OUString PROP_FORCE = ::rtl::OUString::createFromAscii("force" ); // [sal_Bool]
static const ::rtl::OUString PROP_CONTROL_ID = ::rtl::OUString::createFromAscii("control_id" ); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_ACTION = ::rtl::OUString::createFromAscii("control_action" ); // [sal_Int16]
@@ -334,6 +336,9 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
//
::rtl::OUString m_sFilename;
+
+ // Resource provider
+ CResourceProvider m_ResProvider;
};
} // namespace vista
diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
index a780eeaea52d..b715457b76dd 100644
--- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx
+++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx
@@ -41,6 +41,7 @@
#include <process.h>
#include <memory>
+#include "SolarMutex.hxx"
//------------------------------------------------
//
@@ -159,7 +160,9 @@ bool SAL_CALL CAsyncEventNotifier::startup(bool bCreateSuspended)
void SAL_CALL CAsyncEventNotifier::shutdown()
{
- OSL_PRECOND(GetCurrentThreadId() != m_ThreadId, "Method called in wrong thread context!");
+ unsigned nThreadId = GetCurrentThreadId();
+
+ OSL_PRECOND(nThreadId != m_ThreadId, "Method called in wrong thread context!");
osl::ResettableMutexGuard aGuard(m_Mutex);
diff --git a/fpicker/source/win32/filepicker/asyncrequests.cxx b/fpicker/source/win32/filepicker/asyncrequests.cxx
index 17352345eb2b..dad19a629f7f 100644
--- a/fpicker/source/win32/filepicker/asyncrequests.cxx
+++ b/fpicker/source/win32/filepicker/asyncrequests.cxx
@@ -30,6 +30,7 @@
#include "asyncrequests.hxx"
#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
//-----------------------------------------------------------------------------
// namespace
@@ -68,6 +69,7 @@ void Request::wait(::sal_Int32 nMilliSeconds)
void Request::waitProcessMessages()
{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
while (!m_aJoiner.check())
Application::Yield();
}
diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx
index ee7cd363794e..bd945a2d7939 100644
--- a/fpicker/source/win32/filepicker/filepickerstate.cxx
+++ b/fpicker/source/win32/filepicker/filepickerstate.cxx
@@ -220,6 +220,26 @@ OUString MatchFixBrokenPath(const OUString& path)
return path;
}
+//-----------------------------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------------------------
+static ::rtl::OUString trimTrailingSpaces(const ::rtl::OUString& rString)
+{
+ rtl::OUString aResult(rString);
+
+ sal_Int32 nIndex = rString.lastIndexOf(' ');
+ if (nIndex == rString.getLength()-1)
+ {
+ while (nIndex >= 0 && rString[nIndex] == ' ')
+ nIndex--;
+ if (nIndex >= 0)
+ aResult = rString.copy(0,nIndex+1);
+ else
+ aResult = ::rtl::OUString();
+ }
+ return aResult;
+}
+
Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog )
{
OSL_PRECOND( aFileOpenDialog, "invalid parameter" );
@@ -258,8 +278,9 @@ Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDia
for ( sal_Int32 i = 0; i < lenFileList; i++ )
{
+ aFilePath = trimTrailingSpaces(aFilePathList[i]);
rc = ::osl::FileBase::getFileURLFromSystemPath(
- aFilePathList[i], aFilePathURL );
+ aFilePath, aFilePathURL );
// we do return all or nothing, that means
// in case of failures we destroy the sequence
diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk
index c23c08108e42..de192879b629 100644
--- a/fpicker/source/win32/filepicker/makefile.mk
+++ b/fpicker/source/win32/filepicker/makefile.mk
@@ -79,7 +79,8 @@ SLOFILES=$(SLO)$/FileOpenDlg.obj\
$(SLO)$/asyncrequests.obj\
$(SLO)$/VistaFilePickerEventHandler.obj\
$(SLO)$/VistaFilePickerImpl.obj\
- $(SLO)$/VistaFilePicker.obj
+ $(SLO)$/VistaFilePicker.obj\
+ $(SLO)$/SolarMutex.obj
# --- Targets ------------------------------------------------------
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index 573036c74252..147e0ef09cdd 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -448,34 +448,22 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUStri
if ( !aDirectory.getLength( ) )
return NULL;
- IMallocPtr pIMalloc;
- SHGetMalloc(&pIMalloc);
+ LPITEMIDLIST lpItemIdList(NULL);
- LPITEMIDLIST lpItemIdList = static_cast<LPITEMIDLIST>(
- pIMalloc->Alloc(sizeof(ITEMIDLIST)));
+ IShellFolderPtr pIShellFolder;
+ SHGetDesktopFolder(&pIShellFolder);
- if (lpItemIdList)
+ if (pIShellFolder.is())
{
- IShellFolderPtr pIShellFolder;
- SHGetDesktopFolder(&pIShellFolder);
-
- if (pIShellFolder.is())
- {
- pIShellFolder->ParseDisplayName(
- NULL,
- NULL,
- reinterpret_cast<LPOLESTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
- NULL,
- &lpItemIdList,
- NULL );
- }
+ pIShellFolder->ParseDisplayName(
+ NULL,
+ NULL,
+ reinterpret_cast<LPWSTR>(const_cast< sal_Unicode* >( aDirectory.getStr( ) )),
+ NULL,
+ &lpItemIdList,
+ NULL );
}
- if (pIMalloc.is())
- pIMalloc->Free(lpItemIdList);
-
- lpItemIdList = NULL;
-
return lpItemIdList;
}
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index befd02352243..e253385a3c3d 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -69,6 +69,7 @@ const sal_Unicode AMPERSAND_SIGN = L'&';
// Windows 2000 VER_PLATFORM_WIN32_NT 5 0
// Windows XP VER_PLATFORM_WIN32_NT 5 1
// Windows Vista VER_PLATFORM_WIN32_NT 6 0
+// Windows 7 VER_PLATFORM_WIN32_NT 6 1
// Windows 95 VER_PLATFORM_WIN32_WINDOWS 4 0
// Windows 98 VER_PLATFORM_WIN32_WINDOWS 4 10
// Windows ME VER_PLATFORM_WIN32_WINDOWS 4 90
@@ -94,25 +95,47 @@ bool SAL_CALL IsWindowsVersion(unsigned int PlatformId, unsigned int MajorVersio
}
//------------------------------------------------------------
-// determine if we are running under Win2000
+// determine if we are running under Vista or newer OS
//------------------------------------------------------------
-bool SAL_CALL IsWindowsVista()
+bool SAL_CALL IsWindowsVistaOrNewer()
{
- return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0);
+ OSVERSIONINFO osvi;
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+
+ if(!GetVersionEx(&osvi))
+ return false;
+
+ bool bRet = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) &&
+ (osvi.dwMajorVersion >= 6);
+
+ bRet = bRet &&
+ (osvi.dwMinorVersion >=
+ sal::static_int_cast< unsigned int >(0));
+
+ return bRet;
}
//------------------------------------------------------------
-// determine if we are running under Win2000
+// determine if we are running under Windows 7
//------------------------------------------------------------
-bool SAL_CALL IsWindows2000()
+bool SAL_CALL IsWindows7()
{
- return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 1);
}
//------------------------------------------------------------
-//
+// determine if we are running under Windows Vista
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindowsVista()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 6, 0);
+}
+
+//------------------------------------------------------------
+// determine if we are running under Windows XP
//------------------------------------------------------------
bool SAL_CALL IsWindowsXP()
@@ -121,6 +144,15 @@ bool SAL_CALL IsWindowsXP()
}
//------------------------------------------------------------
+// determine if we are running under Windows 2000
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindows2000()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);
+}
+
+//------------------------------------------------------------
//
//------------------------------------------------------------
diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx
index 3a8bd3179c81..6f29a2bb1226 100644
--- a/fpicker/source/win32/misc/WinImplHelper.hxx
+++ b/fpicker/source/win32/misc/WinImplHelper.hxx
@@ -53,6 +53,8 @@
// deklarations
//------------------------------------------------------------------------
+bool SAL_CALL IsWindowsVistaOrNewer();
+bool SAL_CALL IsWindows7();
bool SAL_CALL IsWindowsVista();
bool SAL_CALL IsWindows2000();
bool SAL_CALL IsWindowsXP();