#93244#implementing XFilterGroupManager

This commit is contained in:
Tino Rachui 2001-10-16 13:03:12 +00:00
parent a8a514d610
commit ca64429ead
4 changed files with 94 additions and 15 deletions

View file

@ -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)
{

View file

@ -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 <cppuhelper/compbase8.hxx>
#ifndef _CPPUHELPER_COMPBASE9_HXX_
#include <cppuhelper/compbase9.hxx>
#endif
#ifndef _OSL_MUTEX_HXX_
@ -83,14 +83,18 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_XFILEPICKERNOTIFIER_HPP_
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_
#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_XFILTERMANAGER_HPP_
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERMANAGER_HPP_
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_
#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#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
//------------------------------------------------------------------------------------

View file

@ -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
//=================================================================================================================

View file

@ -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 <com/sun/star/ui/dialogs/FilePickerEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_
#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
#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 );