#i10000# Deintegrate cws fpicker6
This commit is contained in:
parent
2de7c54d0a
commit
b04c2937bb
7 changed files with 71 additions and 139 deletions
|
@ -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.
|
||||
|
@ -546,33 +546,6 @@ sal_Int16 SAL_CALL SvtFilePicker::execute( ) throw (RuntimeException)
|
|||
return OCommonPicker::execute();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// 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
|
||||
//------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
@ -184,12 +180,6 @@ public:
|
|||
virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw ( ::com::sun::star::uno::RuntimeException );
|
||||
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
|
||||
//------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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,16 +161,9 @@ 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
|
||||
//------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: filedlghelper.cxx,v $
|
||||
*
|
||||
* $Revision: 1.124 $
|
||||
* $Revision: 1.125 $
|
||||
*
|
||||
* last change: $Author: ihi $ $Date: 2006-08-03 13:21:55 $
|
||||
* last change: $Author: vg $ $Date: 2006-08-07 13:57:16 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -69,9 +69,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
|
||||
|
@ -1554,30 +1551,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
|
|||
getRealFilter( rFilter );
|
||||
|
||||
// fill the rpURLList
|
||||
Reference<XFilePickerWorkaround> xFileWorkarounds(mxFileDlg, UNO_QUERY);
|
||||
Sequence < OUString > aPathSeq;
|
||||
if (xFileWorkarounds.is())
|
||||
Sequence < OUString > aPathSeq = mxFileDlg->getFiles();
|
||||
|
||||
if ( aPathSeq.getLength() )
|
||||
{
|
||||
aPathSeq = xFileWorkarounds->getFilesAsURIs();
|
||||
if ( !aPathSeq.getLength() )
|
||||
return ERRCODE_ABORT;
|
||||
|
||||
rpURLList = new SvStringsDtor;
|
||||
|
||||
for ( USHORT i = 0; i < aPathSeq.getLength(); ++i )
|
||||
{
|
||||
String* pURL = new String( aPathSeq[i] );
|
||||
rpURLList->Insert( pURL, rpURLList->Count() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_TRACE("Obsolete & broken multiselect code path");
|
||||
aPathSeq = mxFileDlg->getFiles();
|
||||
|
||||
if ( !aPathSeq.getLength() )
|
||||
return ERRCODE_ABORT;
|
||||
|
||||
rpURLList = new SvStringsDtor;
|
||||
|
||||
if ( aPathSeq.getLength() == 1 )
|
||||
|
@ -1603,9 +1580,11 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
|
|||
rpURLList->Insert( pURL, rpURLList->Count() );
|
||||
}
|
||||
}
|
||||
SaveLastUsedFilter();
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
SaveLastUsedFilter();
|
||||
return ERRCODE_NONE;
|
||||
else
|
||||
return ERRCODE_ABORT;
|
||||
}
|
||||
else
|
||||
return ERRCODE_ABORT;
|
||||
|
|
Loading…
Reference in a new issue