Kaydet (Commit) aa22ccf0 authored tarafından Kurt Zenker's avatar Kurt Zenker

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
üst 1608ec79
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: SalAquaFolderPicker.cxx,v $ * $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 Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -40,50 +40,64 @@ ...@@ -40,50 +40,64 @@
#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/DisposedException.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_ #ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_ #ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_ #ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_
#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_ #ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#endif #endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ #ifndef _CPPUHELPER_INTERFACECONTAINER_H_
#include <cppuhelper/interfacecontainer.h> #include <cppuhelper/interfacecontainer.h>
#endif #endif
#ifndef _OSL_DIAGNOSE_H_ #ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h> #include <osl/diagnose.h>
#endif #endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_ #ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ #ifndef _COM_SUN_STAR_UNO_ANY_HXX_
#include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Any.hxx>
#endif #endif
#ifndef _FPSERVICEINFO_HXX_ #ifndef _FPSERVICEINFO_HXX_
#include <FPServiceInfo.hxx> #include <FPServiceInfo.hxx>
#endif #endif
#ifndef _VOS_MUTEX_HXX_ #ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx> #include <vos/mutex.hxx>
#endif #endif
#ifndef _SV_SVAPP_HXX #ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#endif #endif
#ifndef _SALAQUAFOLDERPICKER_HXX_ #ifndef _SALAQUAFOLDERPICKER_HXX_
#include "SalAquaFolderPicker.hxx" #include "SalAquaFolderPicker.hxx"
#endif #endif
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include <iostream> #include <iostream>
#include "resourceprovider.hxx" #include "resourceprovider.hxx"
#ifndef _SV_RC_H #ifndef _SV_RC_H
#include <tools/rc.hxx> #include <tools/rc.hxx>
#endif #endif
...@@ -94,6 +108,14 @@ ...@@ -94,6 +108,14 @@
#include "CFStringUtilities.hxx" #include "CFStringUtilities.hxx"
#endif #endif
#ifndef _NSSTRING_OOOADDITIONS_HXX_
#include "NSString_OOoAdditions.hxx"
#endif
#ifndef _NSURL_OOOADDITIONS_HXX_
#include "NSURL_OOoAdditions.hxx"
#endif
#pragma mark DEFINES #pragma mark DEFINES
#define CLASS_NAME "SalAquaFolderPicker" #define CLASS_NAME "SalAquaFolderPicker"
...@@ -144,6 +166,8 @@ void SAL_CALL SalAquaFolderPicker::setTitle( const rtl::OUString& aTitle ) throw ...@@ -144,6 +166,8 @@ void SAL_CALL SalAquaFolderPicker::setTitle( const rtl::OUString& aTitle ) throw
{ {
DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle); DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle);
::vos::OGuard aGuard( Application::GetSolarMutex() );
implsetTitle(aTitle); implsetTitle(aTitle);
DBG_PRINT_EXIT(CLASS_NAME, __func__); DBG_PRINT_EXIT(CLASS_NAME, __func__);
...@@ -157,22 +181,22 @@ sal_Int16 SAL_CALL SalAquaFolderPicker::execute() throw( uno::RuntimeException ) ...@@ -157,22 +181,22 @@ sal_Int16 SAL_CALL SalAquaFolderPicker::execute() throw( uno::RuntimeException )
sal_Int16 retVal = 0; sal_Int16 retVal = 0;
OSStatus nStatus = runandwaitforresult(); int nResult = runandwaitforresult();
switch( nStatus ) switch( nResult )
{ {
case noErr: case NSOKButton:
OSL_TRACE("Dialog returned with OK"); OSL_TRACE("Dialog returned with OK");
retVal = ExecutableDialogResults::OK; retVal = ExecutableDialogResults::OK;
break; break;
case userCanceledErr: case NSCancelButton:
OSL_TRACE("Dialog was cancelled!"); OSL_TRACE("Dialog was cancelled!");
retVal = ExecutableDialogResults::CANCEL; retVal = ExecutableDialogResults::CANCEL;
break; break;
default: default:
retVal = 0; throw uno::RuntimeException(rtl::OUString::createFromAscii("The dialog returned with an unknown result!"), static_cast< XFolderPicker* >( this ));
break; break;
} }
...@@ -191,7 +215,7 @@ void SAL_CALL SalAquaFolderPicker::setDisplayDirectory( const rtl::OUString& aDi ...@@ -191,7 +215,7 @@ void SAL_CALL SalAquaFolderPicker::setDisplayDirectory( const rtl::OUString& aDi
::vos::OGuard aGuard( Application::GetSolarMutex() ); ::vos::OGuard aGuard( Application::GetSolarMutex() );
m_sDisplayDirectory = aDirectory; implsetDisplayDirectory(aDirectory);
DBG_PRINT_EXIT(CLASS_NAME, __func__); DBG_PRINT_EXIT(CLASS_NAME, __func__);
} }
...@@ -202,23 +226,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDisplayDirectory() throw( uno::Ru ...@@ -202,23 +226,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDisplayDirectory() throw( uno::Ru
::vos::OGuard aGuard( Application::GetSolarMutex() ); ::vos::OGuard aGuard( Application::GetSolarMutex() );
::rtl::OUString aDirectory; OUString aDirectory = implgetDisplayDirectory();
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);
}
DBG_PRINT_EXIT(CLASS_NAME, __func__, aDirectory); DBG_PRINT_EXIT(CLASS_NAME, __func__, aDirectory);
...@@ -229,10 +237,32 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDirectory() throw( uno::RuntimeEx ...@@ -229,10 +237,32 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDirectory() throw( uno::RuntimeEx
{ {
DBG_PRINT_ENTRY(CLASS_NAME, __func__); 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; return aDirectory;
} }
...@@ -241,6 +271,8 @@ void SAL_CALL SalAquaFolderPicker::setDescription( const rtl::OUString& rDescrip ...@@ -241,6 +271,8 @@ void SAL_CALL SalAquaFolderPicker::setDescription( const rtl::OUString& rDescrip
{ {
DBG_PRINT_ENTRY(CLASS_NAME, __func__, "description", rDescription); DBG_PRINT_ENTRY(CLASS_NAME, __func__, "description", rDescription);
[m_pDialog setMessage:[NSString stringWithOUString:rDescription]];
DBG_PRINT_EXIT(CLASS_NAME, __func__); DBG_PRINT_EXIT(CLASS_NAME, __func__);
} }
...@@ -298,10 +330,7 @@ void SAL_CALL SalAquaFolderPicker::cancel() throw( uno::RuntimeException ) ...@@ -298,10 +330,7 @@ void SAL_CALL SalAquaFolderPicker::cancel() throw( uno::RuntimeException )
::vos::OGuard aGuard( Application::GetSolarMutex() ); ::vos::OGuard aGuard( Application::GetSolarMutex() );
OSStatus status = NavCustomControl(m_pDialog, kNavCtlCancel, NULL); [m_pDialog cancel:nil];
if (status != noErr) {
OSL_TRACE("NavigationServices wouldn't allow cancellation");
}
DBG_PRINT_EXIT(CLASS_NAME, __func__); DBG_PRINT_EXIT(CLASS_NAME, __func__);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment