diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:37:59 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:37:59 +0000 |
commit | aa22ccf09d83e93fa6fe6a0c487868a2f84be6db (patch) | |
tree | 35c45f27f790b046e85ff46c956839c47a730c46 /fpicker/source | |
parent | 1608ec79c8f1d05c3bb0e0def594b80f4e7b735b (diff) |
INTEGRATION: CWS aquafilepicker02_DEV300 (1.2.40); FILE MERGED
2008/02/13 07:54:42 fheckl 1.2.40.4: Making Aqua Folder Picker work a little more correctly
2008/02/11 17:37:37 fheckl 1.2.40.3: RESYNC: (1.2-1.3); FILE MERGED
2008/01/14 08:23:24 fheckl 1.2.40.2: Code cleanup and some implementation details
2007/11/18 19:36:37 fheckl 1.2.40.1: initial support for Cocoa version
Diffstat (limited to 'fpicker/source')
-rw-r--r-- | fpicker/source/aqua/SalAquaFolderPicker.cxx | 93 |
1 files changed, 61 insertions, 32 deletions
diff --git a/fpicker/source/aqua/SalAquaFolderPicker.cxx b/fpicker/source/aqua/SalAquaFolderPicker.cxx index cfaa352d0a3b..6c6d4e852fc4 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.cxx +++ b/fpicker/source/aqua/SalAquaFolderPicker.cxx @@ -4,9 +4,9 @@ * * $RCSfile: SalAquaFolderPicker.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: ihi $ $Date: 2008-02-05 12:20:53 $ + * last change: $Author: kz $ $Date: 2008-03-05 16:37:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,50 +40,64 @@ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif + #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #endif + #ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #endif + #ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_ #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #endif + #ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_ #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #endif + #ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_ #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #endif + #ifndef _CPPUHELPER_INTERFACECONTAINER_H_ #include <cppuhelper/interfacecontainer.h> #endif + #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif + #ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #endif + #ifndef _COM_SUN_STAR_UNO_ANY_HXX_ #include <com/sun/star/uno/Any.hxx> #endif + #ifndef _FPSERVICEINFO_HXX_ #include <FPServiceInfo.hxx> #endif + #ifndef _VOS_MUTEX_HXX_ #include <vos/mutex.hxx> #endif + #ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> #endif + #ifndef _SALAQUAFOLDERPICKER_HXX_ #include "SalAquaFolderPicker.hxx" #endif #include <tools/urlobj.hxx> - #include <iostream> + #include "resourceprovider.hxx" + #ifndef _SV_RC_H #include <tools/rc.hxx> #endif @@ -94,6 +108,14 @@ #include "CFStringUtilities.hxx" #endif +#ifndef _NSSTRING_OOOADDITIONS_HXX_ +#include "NSString_OOoAdditions.hxx" +#endif + +#ifndef _NSURL_OOOADDITIONS_HXX_ +#include "NSURL_OOoAdditions.hxx" +#endif + #pragma mark DEFINES #define CLASS_NAME "SalAquaFolderPicker" @@ -144,6 +166,8 @@ void SAL_CALL SalAquaFolderPicker::setTitle( const rtl::OUString& aTitle ) throw { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + implsetTitle(aTitle); DBG_PRINT_EXIT(CLASS_NAME, __func__); @@ -157,22 +181,22 @@ sal_Int16 SAL_CALL SalAquaFolderPicker::execute() throw( uno::RuntimeException ) sal_Int16 retVal = 0; - OSStatus nStatus = runandwaitforresult(); + int nResult = runandwaitforresult(); - switch( nStatus ) + switch( nResult ) { - case noErr: + case NSOKButton: OSL_TRACE("Dialog returned with OK"); retVal = ExecutableDialogResults::OK; break; - case userCanceledErr: + case NSCancelButton: OSL_TRACE("Dialog was cancelled!"); retVal = ExecutableDialogResults::CANCEL; break; default: - retVal = 0; + throw uno::RuntimeException(rtl::OUString::createFromAscii("The dialog returned with an unknown result!"), static_cast< XFolderPicker* >( this )); break; } @@ -191,7 +215,7 @@ void SAL_CALL SalAquaFolderPicker::setDisplayDirectory( const rtl::OUString& aDi ::vos::OGuard aGuard( Application::GetSolarMutex() ); - m_sDisplayDirectory = aDirectory; + implsetDisplayDirectory(aDirectory); DBG_PRINT_EXIT(CLASS_NAME, __func__); } @@ -202,23 +226,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDisplayDirectory() throw( uno::Ru ::vos::OGuard aGuard( Application::GetSolarMutex() ); - ::rtl::OUString aDirectory; - - long count; - AEDescList selection; - FSRef folder; - //char path[MAXPATHLEN]; - - selection = m_pReplyRecord.selection; - AECountItems(&selection, &count); - - // Choose folder dialog -> only one item should be returned! - if ( count==1 ) - { - // Get the FSRef of selected directory - AEGetNthPtr(&selection, 1, typeFSRef, NULL, NULL, &folder, sizeof(folder), NULL); - aDirectory = FSRefToOUString(folder); - } + OUString aDirectory = implgetDisplayDirectory(); DBG_PRINT_EXIT(CLASS_NAME, __func__, aDirectory); @@ -229,10 +237,32 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDirectory() throw( uno::RuntimeEx { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - rtl::OUString aDirectory = getDisplayDirectory(); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); - DBG_PRINT_EXIT(CLASS_NAME, __func__, aDirectory); + NSArray *files = nil; + if (m_nDialogType == NAVIGATIONSERVICES_DIRECTORY) { + files = [(NSOpenPanel*)m_pDialog URLs]; + } + + long nFiles = [files count]; + OSL_TRACE("# of items: %d", nFiles); + if (nFiles < 1) { + throw uno::RuntimeException(rtl::OUString::createFromAscii("no directory selected"), static_cast< XFolderPicker* >( this )); + } + + rtl::OUString aDirectory; + + NSURL *url = [files objectAtIndex:0]; + OSL_TRACE("handling %s", [[url description] UTF8String]); + + aDirectory = [url OUStringForInfo:FULLPATH]; + + implsetDisplayDirectory(aDirectory); + + OSL_TRACE("dir url: %s", OUStringToOString(aDirectory, RTL_TEXTENCODING_UTF8).getStr()); + + DBG_PRINT_EXIT(CLASS_NAME, __func__); return aDirectory; } @@ -241,6 +271,8 @@ void SAL_CALL SalAquaFolderPicker::setDescription( const rtl::OUString& rDescrip { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "description", rDescription); + [m_pDialog setMessage:[NSString stringWithOUString:rDescription]]; + DBG_PRINT_EXIT(CLASS_NAME, __func__); } @@ -298,10 +330,7 @@ void SAL_CALL SalAquaFolderPicker::cancel() throw( uno::RuntimeException ) ::vos::OGuard aGuard( Application::GetSolarMutex() ); - OSStatus status = NavCustomControl(m_pDialog, kNavCtlCancel, NULL); - if (status != noErr) { - OSL_TRACE("NavigationServices wouldn't allow cancellation"); - } + [m_pDialog cancel:nil]; DBG_PRINT_EXIT(CLASS_NAME, __func__); } |