diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx index 6e425e2540bb..f5d529d0b2ad 100644 --- a/fpicker/source/win32/filepicker/FilePicker.cxx +++ b/fpicker/source/win32/filepicker/FilePicker.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FilePicker.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: tra $ $Date: 2001-10-09 06:57:38 $ + * last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,10 +109,12 @@ using ::com::sun::star::uno::Sequence; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::ui::dialogs::TemplateDescription; -using ::cppu::WeakComponentImplHelper8; +using ::cppu::WeakComponentImplHelper9; using ::rtl::OUString; using ::osl::MutexGuard; +using ::com::sun::star::beans::StringPair; + //------------------------------------------------------------------------ // defines //------------------------------------------------------------------------ @@ -139,8 +141,9 @@ namespace //----------------------------------------------------------------------------------------- CFilePicker::CFilePicker( const Reference< XMultiServiceFactory >& xServiceMgr ) : - WeakComponentImplHelper8< + WeakComponentImplHelper9< XFilterManager, + XFilterGroupManager, XFilePickerControlAccess, XFilePickerNotifier, XFilePreview, @@ -411,6 +414,18 @@ OUString SAL_CALL CFilePicker::getCurrentFilter( ) throw(RuntimeException) // //----------------------------------------------------------------------------------------- +void SAL_CALL CFilePicker::appendFilterGroup( const OUString& sGroupTitle, const Sequence< StringPair >& aFilters ) + throw (IllegalArgumentException, RuntimeException) +{ + OSL_ASSERT( 0 != m_pImpl.get( ) ); + MutexGuard aGuard( m_aMutex ); + m_pImpl->appendFilterGroup( sGroupTitle, aFilters ); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + void SAL_CALL CFilePicker::setDefaultName( const OUString& aName ) throw(IllegalArgumentException, RuntimeException) { diff --git a/fpicker/source/win32/filepicker/FilePicker.hxx b/fpicker/source/win32/filepicker/FilePicker.hxx index f03161f9dfdd..761c904f02a4 100644 --- a/fpicker/source/win32/filepicker/FilePicker.hxx +++ b/fpicker/source/win32/filepicker/FilePicker.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FilePicker.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tra $ $Date: 2001-10-09 06:57:38 $ + * last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,8 +67,8 @@ //_______________________________________________________________________________________________________________________ -#ifndef _CPPUHELPER_COMPBASE8_HXX_ -#include +#ifndef _CPPUHELPER_COMPBASE9_HXX_ +#include #endif #ifndef _OSL_MUTEX_HXX_ @@ -83,14 +83,18 @@ #include #endif -#ifndef _COM_SUN_STAR_UI_XFILEPICKERNOTIFIER_HPP_ +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_ #include #endif -#ifndef _COM_SUN_STAR_UI_XFILTERMANAGER_HPP_ +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERMANAGER_HPP_ #include #endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_ +#include +#endif + #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_ #include #endif @@ -133,8 +137,9 @@ protected: class CFilePicker : public CFilePickerDummy, - public cppu::WeakComponentImplHelper8< + 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, @@ -199,6 +204,13 @@ public: virtual ::rtl::OUString SAL_CALL getCurrentFilter( ) throw( ::com::sun::star::uno::RuntimeException ); + //------------------------------------------------------------------------------------ + // XFilterGroupManager functions + //------------------------------------------------------------------------------------ + + virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aFilters ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + //------------------------------------------------------------------------------------ // XFilePickerControlAccess functions //------------------------------------------------------------------------------------ diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx index 16672fa4c25c..037bda2dd9e2 100644 --- a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx +++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WinFileOpenImpl.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: tra $ $Date: 2001-10-09 06:57:38 $ + * last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,6 +155,8 @@ using ::com::sun::star::ui::dialogs::FilePickerEvent; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::ui::dialogs::XFilePicker; +using ::com::sun::star::beans::StringPair; + using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; using namespace ::com::sun::star::ui::dialogs::ListboxControlActions; @@ -186,6 +188,9 @@ struct EnumParam //------------------------------------------------------------------------- const OUString BACKSLASH = OUString::createFromAscii( "\\" ); +const OUString FILTER_SEPARATOR = OUString::createFromAscii( "------------------------------------------" ); +const OUString ALL_FILES_WILDCARD = OUString::createFromAscii( "*.*" ); +const sal_Bool ALLOW_DUPLICATES = sal_True; //------------------------------------------------------------------------- // ctor @@ -366,6 +371,40 @@ OUString SAL_CALL CWinFileOpenImpl::getCurrentFilter( ) throw(RuntimeException) return currentFilter; } +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- + +inline void SAL_CALL CWinFileOpenImpl::appendFilterGroupSeparator( ) +{ + m_filterContainer->addFilter( FILTER_SEPARATOR, ALL_FILES_WILDCARD, ALLOW_DUPLICATES ); +} + +//----------------------------------------------------------------------------------------- +// XFilterGroupManager +//----------------------------------------------------------------------------------------- + +void SAL_CALL CWinFileOpenImpl::appendFilterGroup( const OUString& sGroupTitle, const Sequence< StringPair >& aFilters ) + throw (IllegalArgumentException, RuntimeException) +{ + OSL_ENSURE( 0 == sGroupTitle.getLength( ), "appendFilterGroup: Parameter 'GroupTitle' currently ignored" ); + + sal_Int32 nFilters = aFilters.getLength( ); + + OSL_PRECOND( nFilters > 0, "Empty filter list" ); + + if ( nFilters > 0 ) + { + // append a separator before the next group if + // there is already a group of filters + if ( m_filterContainer->numFilter( ) > 0 ) + appendFilterGroupSeparator( ); + + for ( int i = 0; i < nFilters; i++ ) + appendFilter( aFilters[i].First, aFilters[i].Second ); + } +} + //================================================================================================================= // XExtendedFilePicker //================================================================================================================= diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx index e00c76a7438d..7731ff3ff47c 100644 --- a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx +++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: WinFileOpenImpl.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: tra $ $Date: 2001-10-09 06:57:38 $ + * last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,6 +75,10 @@ #include #endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_ +#include +#endif + #ifndef _FILTER_CONTAINER_HXX_ #include "FilterContainer.hxx" #endif @@ -155,6 +159,13 @@ public: virtual ::rtl::OUString SAL_CALL getCurrentFilter( ) throw( ::com::sun::star::uno::RuntimeException ); + //----------------------------------------------------------------------------------------- + // XFilterGroupManager + //----------------------------------------------------------------------------------------- + + virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aFilters ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + //----------------------------------------------------------------------------------------- // XFilePickerControlAccess //----------------------------------------------------------------------------------------- @@ -221,6 +232,8 @@ protected: virtual sal_uInt32 SAL_CALL onCtrlCommand( HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode ); private: + inline void SAL_CALL appendFilterGroupSeparator( ); + // initialize all controls from cache void SAL_CALL InitControlLabel( HWND hWnd );