diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-10-22 06:45:25 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-10-22 06:45:25 +0000 |
commit | 15ddc051c2e562e727510cc395be99f6f375e823 (patch) | |
tree | 065085ce47bbf4b517b021286b861aa282d869e5 /fpicker | |
parent | 31a7eb68eeecf46109f9707385aec1330c0fa73a (diff) |
INTEGRATION: CWS dtransfix (1.9.28); FILE MERGED
2004/10/12 05:41:34 tra 1.9.28.1: #i33833#replaced MS COM auto pointers with an own COM auto pointer template because the .Net 2003 toolkit doesn't contains the MS COM auto pointers
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/win32/folderpicker/MtaFop.cxx | 55 |
1 files changed, 19 insertions, 36 deletions
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx index eedb3135aa16..86645d0c446f 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.cxx +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -2,9 +2,9 @@ * * $RCSfile: MtaFop.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: obo $ $Date: 2003-10-20 17:12:25 $ + * last change: $Author: rt $ $Date: 2004-10-22 07:45:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,23 +74,16 @@ #include "MtaFop.hxx" #include <wchar.h> #include <process.h> -#include <comdef.h> #ifndef _RESOURCEPROVIDER_HXX_ #include "..\misc\resourceprovider.hxx" #endif -//---------------------------------------------------------------- -// namespace directives -//---------------------------------------------------------------- +#include <systools/win32/comtools.hxx> using rtl::OUString; using osl::Condition; -//-------------------------------------------------------- -// messages constants -//-------------------------------------------------------- - const sal_uInt32 MSG_BROWSEFORFOLDER = WM_USER + 1; const sal_uInt32 MSG_SHUTDOWN = WM_USER + 2; @@ -100,9 +93,8 @@ const sal_Bool MANUAL_RESET = sal_True; const sal_Bool AUTO_RESET = sal_False; const sal_Bool INIT_NONSIGNALED = sal_False; -//---------------------------------------------------------------- -// defines -//---------------------------------------------------------------- +typedef sal::systools::COMReference<IMalloc> IMallocPtr; +typedef sal::systools::COMReference<IShellFolder> IShellFolderPtr; namespace { @@ -478,17 +470,12 @@ sal_Bool SAL_CALL CMtaFolderPicker::onBrowseForFolder( ) void SAL_CALL CMtaFolderPicker::releaseItemIdList( LPITEMIDLIST lpItemIdList ) { IMallocPtr pIMalloc; - SHGetMalloc( &pIMalloc ); - - try + SHGetMalloc(&pIMalloc); + if (pIMalloc.is()) { - pIMalloc->Free( lpItemIdList ); + pIMalloc->Free(lpItemIdList); lpItemIdList = NULL; } - catch( _com_error& ) - { - OSL_ASSERT( sal_False ); - } } //-------------------------------------------------------------------- @@ -502,20 +489,18 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUStri return NULL; IMallocPtr pIMalloc; - SHGetMalloc( &pIMalloc ); + SHGetMalloc(&pIMalloc); - LPITEMIDLIST lpItemIdList = NULL; + LPITEMIDLIST lpItemIdList = static_cast<LPITEMIDLIST>( + pIMalloc->Alloc(sizeof(ITEMIDLIST))); - try + if (lpItemIdList) { - lpItemIdList = static_cast< LPITEMIDLIST >( - pIMalloc->Alloc( sizeof( ITEMIDLIST ) ) ); + IShellFolderPtr pIShellFolder; + SHGetDesktopFolder(&pIShellFolder); - if ( lpItemIdList ) + if (pIShellFolder.is()) { - IShellFolderPtr pIShellFolder; - SHGetDesktopFolder( &pIShellFolder ); - pIShellFolder->ParseDisplayName( NULL, NULL, @@ -525,13 +510,11 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const rtl::OUStri NULL ); } } - catch( _com_error& ) - { - if ( pIMalloc ) - pIMalloc->Free( lpItemIdList ); - lpItemIdList = NULL; - } + if (pIMalloc.is()) + pIMalloc->Free(lpItemIdList); + + lpItemIdList = NULL; return lpItemIdList; } |