2002-10-01 11:02:12 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* $RCSfile: filedlgimpl.hxx,v $
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* $Revision: 1.9 $
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-07 18:18:47 $
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
2005-09-07 17:18:47 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-10-01 11:02:12 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _SFX_FILEDLGIMPL_HXX
|
|
|
|
#define _SFX_FILEDLGIMPL_HXX
|
|
|
|
|
|
|
|
#ifndef _SV_TIMER_HXX
|
|
|
|
#include <vcl/timer.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_GRAPH_HXX
|
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_STRINGPAIR_HPP_
|
|
|
|
#include <com/sun/star/beans/StringPair.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKER_HPP_
|
|
|
|
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERLISTENER_HPP_
|
|
|
|
#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SFX_FCONTNR_HXX
|
|
|
|
#include "fcontnr.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _SVSTDARR_STRINGSDTOR
|
|
|
|
#include <svtools/svstdarr.hxx>
|
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
#include "filedlghelper.hxx"
|
|
|
|
|
2002-10-01 11:02:12 +00:00
|
|
|
class SfxFilterMatcher;
|
|
|
|
class GraphicFilter;
|
|
|
|
class FileDialogHelper;
|
|
|
|
|
|
|
|
namespace sfx2
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef ::com::sun::star::beans::StringPair FilterPair;
|
|
|
|
|
|
|
|
class FileDialogHelper_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XFilePickerListener >
|
|
|
|
{
|
|
|
|
friend class FileDialogHelper;
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > mxFileDlg;
|
|
|
|
::com::sun::star::uno::Reference < ::com::sun::star::container::XNameAccess > mxFilterCFG;
|
|
|
|
|
|
|
|
std::vector< FilterPair > maFilters;
|
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
SfxFilterMatcher* mpMatcher;
|
|
|
|
GraphicFilter* mpGraphicFilter;
|
2003-04-04 17:06:11 +00:00
|
|
|
FileDialogHelper* mpAntiImpl;
|
|
|
|
Window* mpPreferredParentWindow;
|
2002-10-15 10:12:35 +00:00
|
|
|
|
|
|
|
::rtl::OUString maPath;
|
2003-03-27 10:29:38 +00:00
|
|
|
::rtl::OUString maFileName;
|
2002-10-15 10:12:35 +00:00
|
|
|
::rtl::OUString maCurFilter;
|
|
|
|
::rtl::OUString maSelectFilter;
|
2002-10-23 06:16:36 +00:00
|
|
|
::rtl::OUString maButtonLabel;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
Timer maPreViewTimer;
|
|
|
|
Graphic maGraphic;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
const short m_nDialogType;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
SfxFilterFlags m_nMustFlags;
|
|
|
|
SfxFilterFlags m_nDontFlags;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
2002-10-18 12:51:05 +00:00
|
|
|
ULONG mnPostUserEventId;
|
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
ErrCode mnError;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
FileDialogHelper::Context meContext;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
2002-10-15 10:12:35 +00:00
|
|
|
sal_Bool mbHasPassword : 1;
|
|
|
|
sal_Bool mbIsPwdEnabled : 1;
|
|
|
|
sal_Bool m_bHaveFilterOptions : 1;
|
|
|
|
sal_Bool mbHasVersions : 1;
|
|
|
|
sal_Bool mbHasAutoExt : 1;
|
|
|
|
sal_Bool mbHasLink : 1;
|
|
|
|
sal_Bool mbHasPreview : 1;
|
|
|
|
sal_Bool mbShowPreview : 1;
|
|
|
|
sal_Bool mbIsSaveDlg : 1;
|
|
|
|
sal_Bool mbExport : 1;
|
|
|
|
|
|
|
|
sal_Bool mbDeleteMatcher : 1;
|
|
|
|
sal_Bool mbInsert : 1;
|
|
|
|
sal_Bool mbSystemPicker : 1;
|
|
|
|
sal_Bool mbPwdCheckBoxState : 1;
|
2003-03-27 10:29:38 +00:00
|
|
|
sal_Bool mbSelection : 1;
|
|
|
|
sal_Bool mbSelectionEnabled : 1;
|
2002-10-01 11:02:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void addFilters( sal_uInt32 nFlags,
|
2003-09-19 06:59:22 +00:00
|
|
|
const String& rFactory,
|
2002-10-01 11:02:12 +00:00
|
|
|
SfxFilterFlags nMust,
|
|
|
|
SfxFilterFlags nDont );
|
|
|
|
void addFilter( const ::rtl::OUString& rFilterName,
|
|
|
|
const ::rtl::OUString& rExtension );
|
|
|
|
void addGraphicFilter();
|
|
|
|
void enablePasswordBox( sal_Bool bInit );
|
|
|
|
void updateFilterOptionsBox();
|
2002-10-23 06:16:36 +00:00
|
|
|
void updateExportButton();
|
2002-10-01 11:02:12 +00:00
|
|
|
void updateSelectionBox();
|
|
|
|
void updateVersions();
|
|
|
|
void updatePreviewState( sal_Bool _bUpdatePreviewWindow = sal_True );
|
|
|
|
void dispose();
|
|
|
|
|
|
|
|
void loadConfig();
|
|
|
|
void saveConfig();
|
|
|
|
|
|
|
|
const SfxFilter* getCurentSfxFilter();
|
|
|
|
sal_Bool updateExtendedControl( sal_Int16 _nExtendedControlId, sal_Bool _bEnable );
|
|
|
|
|
|
|
|
ErrCode getGraphic( const ::rtl::OUString& rURL, Graphic& rGraphic ) const;
|
|
|
|
void setDefaultValues();
|
|
|
|
|
|
|
|
void preExecute();
|
|
|
|
void postExecute( sal_Int16 _nResult );
|
|
|
|
sal_Int16 implDoExecute();
|
|
|
|
|
|
|
|
void correctVirtualDialogType();
|
|
|
|
|
|
|
|
void setControlHelpIds( const sal_Int16* _pControlId, const sal_Int32* _pHelpId );
|
|
|
|
void setDialogHelpId( const sal_Int32 _nHelpId );
|
|
|
|
|
|
|
|
sal_Bool CheckFilterOptionsCapability( const SfxFilter* _pFilter );
|
|
|
|
|
|
|
|
sal_Bool isInOpenMode() const;
|
|
|
|
String getCurrentFilterUIName() const;
|
|
|
|
|
2002-10-31 12:51:13 +00:00
|
|
|
void LoadLastUsedFilter( const ::rtl::OUString& _rContextIdentifier );
|
|
|
|
void SaveLastUsedFilter( const ::rtl::OUString& _rContextIdentifier );
|
|
|
|
void SaveLastUsedFilter( void );
|
|
|
|
|
2003-03-27 10:29:38 +00:00
|
|
|
void implInitializeFileName( );
|
|
|
|
|
2002-10-01 11:02:12 +00:00
|
|
|
DECL_LINK( TimeOutHdl_Impl, Timer* );
|
|
|
|
DECL_LINK( HandleEvent, FileDialogHelper* );
|
|
|
|
DECL_LINK( InitControls, void* );
|
|
|
|
|
|
|
|
public:
|
|
|
|
// XFilePickerListener methods
|
|
|
|
virtual void SAL_CALL fileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual void SAL_CALL directoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual ::rtl::OUString SAL_CALL helpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual void SAL_CALL controlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual void SAL_CALL dialogSizeChanged() throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// XEventListener methods
|
|
|
|
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// handle XFilePickerListener events
|
|
|
|
void handleFileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
|
|
|
|
void handleDirectoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
|
|
|
|
::rtl::OUString handleHelpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
|
|
|
|
void handleControlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
|
|
|
|
void handleDialogSizeChanged();
|
|
|
|
|
|
|
|
// Own methods
|
2003-04-04 17:06:11 +00:00
|
|
|
FileDialogHelper_Impl(
|
|
|
|
FileDialogHelper* _pAntiImpl,
|
|
|
|
const short nDialogType,
|
|
|
|
sal_uInt32 nFlags,
|
|
|
|
Window* _pPreferredParentWindow = NULL
|
|
|
|
);
|
2002-10-15 10:12:35 +00:00
|
|
|
virtual ~FileDialogHelper_Impl();
|
2002-10-01 11:02:12 +00:00
|
|
|
|
|
|
|
ErrCode execute( SvStringsDtor*& rpURLList,
|
|
|
|
SfxItemSet *& rpSet,
|
|
|
|
String& rFilter );
|
|
|
|
ErrCode execute();
|
|
|
|
|
|
|
|
void setFilter( const ::rtl::OUString& rFilter );
|
|
|
|
|
2003-03-27 10:29:38 +00:00
|
|
|
/** sets the directory which should be browsed
|
|
|
|
|
|
|
|
<p>If the given path does not point to a valid (existent and accessible) folder, the request
|
|
|
|
is silently dropped</p>
|
|
|
|
*/
|
|
|
|
void displayFolder( const ::rtl::OUString& rPath );
|
|
|
|
void setFileName( const ::rtl::OUString& _rFile );
|
|
|
|
|
2002-10-01 11:02:12 +00:00
|
|
|
::rtl::OUString getPath() const;
|
|
|
|
::rtl::OUString getFilter() const;
|
|
|
|
void getRealFilter( String& _rFilter ) const;
|
|
|
|
|
|
|
|
ErrCode getGraphic( Graphic& rGraphic ) const;
|
2003-09-19 06:59:22 +00:00
|
|
|
void createMatcher( const String& rFactory );
|
2002-10-01 11:02:12 +00:00
|
|
|
|
|
|
|
sal_Bool isShowFilterExtensionEnabled() const;
|
|
|
|
void addFilterPair( const ::rtl::OUString& rFilter,
|
|
|
|
const ::rtl::OUString& rFilterWithExtension );
|
|
|
|
::rtl::OUString getFilterName( const ::rtl::OUString& rFilterWithExtension ) const;
|
|
|
|
::rtl::OUString getFilterWithExtension( const ::rtl::OUString& rFilter ) const;
|
2002-10-15 10:12:35 +00:00
|
|
|
|
|
|
|
void SetContext( FileDialogHelper::Context _eNewContext );
|
2002-10-01 11:02:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace sfx2
|
|
|
|
|
|
|
|
#endif // _SFX_FILEDLGIMPL_HXX
|
|
|
|
|