diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2006-08-07 13:00:34 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2006-08-07 13:00:34 +0000 |
commit | b04c2937bbc5b3db538e9523e078b469f9899b67 (patch) | |
tree | 234d26b996cc5e15bae65fbcdd9d2f6a10897d83 /fpicker | |
parent | 2de7c54d0a75c571f39d5adf403d3a9a6c04e799 (diff) |
#i10000# Deintegrate cws fpicker6
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 31 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.hxx | 20 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.cxx | 77 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.hxx | 28 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.cxx | 7 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.hxx | 8 |
6 files changed, 62 insertions, 109 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index bcb9da22407c..f3a2c44f1078 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -4,9 +4,9 @@ * * $RCSfile: OfficeFilePicker.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: ihi $ $Date: 2006-08-03 13:19:34 $ + * last change: $Author: vg $ $Date: 2006-08-07 14:00:34 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -547,33 +547,6 @@ sal_Int16 SAL_CALL SvtFilePicker::execute( ) throw (RuntimeException) } //------------------------------------------------------------------------------------ -// XFilePickerWorkaround functions -//------------------------------------------------------------------------------------ - -// Obsoletes getFiles -Sequence< rtl::OUString > SAL_CALL SvtFilePicker::getFilesAsURIs() throw (RuntimeException) -{ - checkAlive(); - - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( ! getDialog() ) - { - Sequence< rtl::OUString > aEmpty; - return aEmpty; - } - - SvStringsDtor* pPathList = getDialog()->GetPathList(); - USHORT i, nCount = pPathList->Count(); - - Sequence< rtl::OUString > aPath( nCount ); - for ( i = 0; i < nCount; i++) - aPath[i] = rtl::OUString( *pPathList->GetObject( i ) ); - - delete pPathList; - return aPath; -} - -//------------------------------------------------------------------------------------ // XFilePicker functions //------------------------------------------------------------------------------------ diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index 9ceedcbcabb1..a497e1657f2b 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -4,9 +4,9 @@ * * $RCSfile: OfficeFilePicker.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: ihi $ $Date: 2006-08-03 13:19:48 $ + * last change: $Author: vg $ $Date: 2006-08-07 14:00:34 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,8 +35,8 @@ #ifndef INCLUDED_SVT_FILEPICKER_HXX #define INCLUDED_SVT_FILEPICKER_HXX -#ifndef _CPPUHELPER_IMPLBASE7_HXX_ -#include <cppuhelper/implbase7.hxx> +#ifndef _CPPUHELPER_IMPLBASE6_HXX_ +#include <cppuhelper/implbase6.hxx> #endif #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_ @@ -45,9 +45,6 @@ #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_ #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> #endif -#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERWORKAROUND_HPP_ -#include <com/sun/star/ui/dialogs/XFilePickerWorkaround.hpp> -#endif #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPREVIEW_HPP_ #include <com/sun/star/ui/dialogs/XFilePreview.hpp> #endif @@ -96,11 +93,10 @@ typedef ::com::sun::star::uno::Sequence< UnoFilterEntry > UnoFilterList; // c // class SvtFilePicker --------------------------------------------------- -typedef ::cppu::ImplHelper7 < ::com::sun::star::ui::dialogs::XFilePickerControlAccess +typedef ::cppu::ImplHelper6 < ::com::sun::star::ui::dialogs::XFilePickerControlAccess , ::com::sun::star::ui::dialogs::XFilePickerNotifier , ::com::sun::star::ui::dialogs::XFilePreview , ::com::sun::star::ui::dialogs::XFilterManager - , ::com::sun::star::ui::dialogs::XFilePickerWorkaround , ::com::sun::star::ui::dialogs::XFilterGroupManager , ::com::sun::star::lang::XServiceInfo > SvtFilePicker_Base; @@ -185,12 +181,6 @@ public: virtual sal_Bool SAL_CALL getShowState() throw ( ::com::sun::star::uno::RuntimeException ); //------------------------------------------------------------------------------------ - // XFilePickerWorkaround functions - //------------------------------------------------------------------------------------ - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFilesAsURIs() throw (::com::sun::star::uno::RuntimeException); - - //------------------------------------------------------------------------------------ // XFilterManager functions //------------------------------------------------------------------------------------ diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index d745e2aa46f2..093dd00ea101 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -4,9 +4,9 @@ * * $RCSfile: SalGtkFilePicker.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: ihi $ $Date: 2006-08-03 13:20:02 $ + * last change: $Author: vg $ $Date: 2006-08-07 13:59:36 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -157,13 +157,12 @@ void SalGtkFilePicker::InitialMapping() } SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : - cppu::WeakComponentImplHelper10< + cppu::WeakComponentImplHelper9< XFilterManager, - XFilterGroupManager, - XFilePickerControlAccess, + XFilterGroupManager, + XFilePickerControlAccess, XFilePickerNotifier, - XFilePreview, - XFilePickerWorkaround, + XFilePreview, lang::XInitialization, util::XCancellable, lang::XEventListener, @@ -878,41 +877,48 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getDisplayDirectory() throw( uno::Runti return implgetDisplayDirectory(); } -// Obsoleted by XFilePickerWorkaround::getFilesAsURIs uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::RuntimeException ) { - uno::Sequence<rtl::OUString> aFiles = getFilesAsURIs(); - /* - The previous multiselection API design was completely broken - and unimplementable for some hetrogenous pseudo-URIs eg. search:// - Thus crop unconditionally to a single selection. - */ - aFiles.realloc (1); - return aFiles; -} - -uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFilesAsURIs() throw( uno::RuntimeException ) -{ OSL_ASSERT( m_pDialog != NULL ); ::vos::OGuard aGuard( Application::GetSolarMutex() ); GSList* pPathList = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER(m_pDialog) ); - int nCount = g_slist_length( pPathList ); - int nIndex = 0; - OSL_TRACE( "GETFILES called %d files\n", nCount ); + int nFromCount = g_slist_length( pPathList ); + OSL_TRACE( "GETFILES called %d files\n", nFromCount ); // get the current action setting GtkFileChooserAction eAction = gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog )); - uno::Sequence< rtl::OUString > aSelectedFiles(nCount); + /* + This is insane, if its one file then return the URL, + If its its more return the URL of the dir as the first entry, + and then list each seperate entry (relative to the base URL) after it + */ + bool bMultiple = nFromCount > 1; + int nToCount = bMultiple ? nFromCount + 1 : nFromCount; + int nURLOffset = 0; + uno::Sequence< rtl::OUString > aSelectedFiles(nToCount); + + if (bMultiple) + { + gchar *path = gtk_file_chooser_get_current_folder_uri( + GTK_FILE_CHOOSER( m_pDialog )); + nURLOffset = strlen(path) + 1; + aSelectedFiles[0] = uritounicode(path); + g_free(path); + } // Convert to OOo - for( GSList *pElem = pPathList; pElem; pElem = pElem->next) + for( int nToIndex = bMultiple ? 1 : 0; + ((nToIndex < nToCount) && pPathList); + ++nToIndex, pPathList = g_slist_next(pPathList) + ) { - gchar *pURI = reinterpret_cast<gchar*>(pElem->data); - aSelectedFiles[ nIndex ] = uritounicode(pURI); + const gchar *path = reinterpret_cast<gchar*>(pPathList->data) + + nURLOffset; + aSelectedFiles[ nToIndex ] = uritounicode(path); if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction ) { @@ -932,12 +938,12 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFilesAsURIs() throw( } else { - if( aSelectedFiles[nIndex].indexOf('.') > 0 ) + if( aSelectedFiles[nToIndex].indexOf('.') > 0 ) { rtl::OUString sExtension; nTokenIndex = 0; do - sExtension = aSelectedFiles[nIndex].getToken( 0, '.', nTokenIndex ); + sExtension = aSelectedFiles[nToIndex].getToken( 0, '.', nTokenIndex ); while( nTokenIndex >= 0 ); if( sExtension.getLength() >= 3 ) // 3 = typical/minimum extension length @@ -1004,7 +1010,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFilesAsURIs() throw( { //if the filename does not already have the auto extension, stick it on OUString sExtension = OUString::createFromAscii( "." ) + sToken; - OUString &rBase = aSelectedFiles[nIndex]; + OUString &rBase = aSelectedFiles[nToIndex]; sal_Int32 nExtensionIdx = rBase.getLength() - sExtension.getLength(); OSL_TRACE( "idx are %d %d\n", rBase.lastIndexOf( sExtension ), nExtensionIdx ); @@ -1014,8 +1020,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFilesAsURIs() throw( } - nIndex++; - g_free( pURI ); + g_free( ( char* )( pPathList->data ) ); } g_slist_free( pPathList ); @@ -1860,10 +1865,10 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) g_return_val_if_fail( data != NULL, FALSE ); g_return_val_if_fail( filter_info != NULL, FALSE ); - if( !filter_info->uri ) + if( !filter_info->filename ) return FALSE; - const char *pExtn = strrchr( filter_info->uri, '.' ); + const char *pExtn = strrchr( filter_info->filename, '.' ); if( !pExtn ) return FALSE; pExtn++; @@ -1873,7 +1878,7 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) #ifdef DEBUG fprintf( stderr, "'%s' match extn '%s' vs '%s' yeilds %d\n", - filter_info->uri, pExtn, pFilter, bRetval ); + filter_info->filename, pExtn, pFilter, bRetval ); #endif return bRetval; @@ -1908,7 +1913,7 @@ int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rT if (aTokens.getLength()) aTokens += OUString::createFromAscii(","); aTokens = aTokens += aToken; - gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_URI, + gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME, case_insensitive_filter, g_strdup( rtl::OUStringToOString( aToken, RTL_TEXTENCODING_UTF8 ) ), (GDestroyNotify) g_free ); diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx index bd552d1ab256..021e66cfe8a1 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx @@ -4,9 +4,9 @@ * * $RCSfile: SalGtkFilePicker.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: ihi $ $Date: 2006-08-03 13:20:16 $ + * last change: $Author: vg $ $Date: 2006-08-07 13:59:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,8 +40,8 @@ // includes of other projects //_______________________________________________________________________________________________________________________ -#ifndef _CPPUHELPER_COMPBASE10_HXX_ -#include <cppuhelper/compbase10.hxx> +#ifndef _CPPUHELPER_COMPBASE9_HXX_ +#include <cppuhelper/compbase9.hxx> #endif #ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ @@ -108,18 +108,17 @@ typedef ::com::sun::star::uno::Sequence< UnoFilterEntry > UnoFilterList; // c //---------------------------------------------------------- class SalGtkFilePicker : - public SalGtkPicker, - public cppu::WeakComponentImplHelper10< + public SalGtkPicker, + public cppu::WeakComponentImplHelper9< ::com::sun::star::ui::dialogs::XFilterManager, ::com::sun::star::ui::dialogs::XFilterGroupManager, ::com::sun::star::ui::dialogs::XFilePickerControlAccess, ::com::sun::star::ui::dialogs::XFilePickerNotifier, ::com::sun::star::ui::dialogs::XFilePreview, - ::com::sun::star::ui::dialogs::XFilePickerWorkaround, - ::com::sun::star::lang::XInitialization, + ::com::sun::star::lang::XInitialization, ::com::sun::star::util::XCancellable, - ::com::sun::star::lang::XEventListener, - ::com::sun::star::lang::XServiceInfo > + ::com::sun::star::lang::XEventListener, + ::com::sun::star::lang::XServiceInfo > { public: @@ -162,17 +161,10 @@ class SalGtkFilePicker : virtual ::rtl::OUString SAL_CALL getDisplayDirectory( ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles() + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( ) throw( ::com::sun::star::uno::RuntimeException ); //------------------------------------------------------------------------------------ - // XFilePickerWorkaround functions - //------------------------------------------------------------------------------------ - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFilesAsURIs() - throw (::com::sun::star::uno::RuntimeException); - - //------------------------------------------------------------------------------------ // XFilterManager functions //------------------------------------------------------------------------------------ diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index a08fc637236c..ea8f441efe77 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -4,9 +4,9 @@ * * $RCSfile: SalGtkPicker.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: ihi $ $Date: 2006-08-03 13:20:28 $ + * last change: $Author: vg $ $Date: 2006-08-07 13:59:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -80,9 +80,6 @@ using namespace ::com::sun::star::uno; rtl::OUString SalGtkPicker::uritounicode(const gchar* pIn) { - rtl::OUString aEmpty; - g_return_val_if_fail (pIn != NULL, aEmpty); - rtl::OUString sURL( const_cast<const sal_Char *>(pIn), strlen(pIn), RTL_TEXTENCODING_UTF8 ); diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 285d8866d3c1..0e72f8fca833 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -4,9 +4,9 @@ * * $RCSfile: SalGtkPicker.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: ihi $ $Date: 2006-08-03 13:20:41 $ + * last change: $Author: vg $ $Date: 2006-08-07 13:59:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,10 +48,6 @@ #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #endif -#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERWORKAROUND_HPP_ -#include <com/sun/star/ui/dialogs/XFilePickerWorkaround.hpp> -#endif - #ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_ #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> #endif |