diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-06-30 15:31:30 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2015-07-16 09:53:16 +0200 |
commit | 86859c115c9d8ff1b46f6fef4fdc0fc30a4a766f (patch) | |
tree | 79977672ada15feac4f0da58acd3708cf9f9d8ee /fpicker | |
parent | 0b2ec9b1b32eac9d99c4ea7aa9401168a8cd5da2 (diff) |
FilePicker interface for RemoteFilesDialog
Change-Id: I797d3fcf62bb858713d1e8af10e82f9c095bcf2b
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 79 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.hxx | 39 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFolderPicker.cxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFolderPicker.hxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/commonpicker.hxx | 8 | ||||
-rw-r--r-- | fpicker/source/office/fps_office.component | 3 | ||||
-rw-r--r-- | fpicker/source/office/fps_office.cxx | 6 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 4 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.hxx | 51 |
9 files changed, 177 insertions, 17 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 20d6e1d448c9..5846e588face 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -20,6 +20,7 @@ #include "OfficeFilePicker.hxx" #include "iodlg.hxx" +#include <svtools/RemoteFilesDialog.hxx> #include <list> #include <functional> @@ -463,7 +464,7 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) } -VclPtr<SvtFileDialog> SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) { WinBits nExtraBits; WinBits nBits = getWinBits( nExtraBits ); @@ -491,6 +492,13 @@ IMPLEMENT_FORWARD_XINTERFACE2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) +IMPLEMENT_FORWARD_XINTERFACE3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) + + +// disambiguate XTypeProvider + +IMPLEMENT_FORWARD_XTYPEPROVIDER3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) + // XExecutableDialog functions @@ -1165,4 +1173,73 @@ Reference< XInterface > SAL_CALL SvtFilePicker::impl_createInstance( return Reference< XInterface >( *new SvtFilePicker( xServiceManager ) ); } +// SvtRemoteFilePicker + +SvtRemoteFilePicker::SvtRemoteFilePicker( const Reference < XMultiServiceFactory >& xFactory ) + :SvtFilePicker( xFactory ) +{ +} + +VclPtr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog( vcl::Window* _pParent ) +{ + WinBits nExtraBits; + WinBits nBits = getWinBits( nExtraBits ); + + VclPtrInstance<RemoteFilesDialog> dialog( _pParent, nBits); // TODO: extrabits + + // Set StandardDir if present + if ( !m_aStandardDir.isEmpty()) + { + OUString sStandardDir = m_aStandardDir; + dialog->SetStandardDir( sStandardDir ); + dialog->SetBlackList( m_aBlackList ); + } + + return dialog; +} + +// XServiceInfo + + +/* XServiceInfo */ +OUString SAL_CALL SvtRemoteFilePicker::getImplementationName() throw( RuntimeException, std::exception ) +{ + return impl_getStaticImplementationName(); +} + +/* XServiceInfo */ +sal_Bool SAL_CALL SvtRemoteFilePicker::supportsService( const OUString& sServiceName ) throw( RuntimeException, std::exception ) +{ + return cppu::supportsService(this, sServiceName); +} + +/* XServiceInfo */ +Sequence< OUString > SAL_CALL SvtRemoteFilePicker::getSupportedServiceNames() throw( RuntimeException, std::exception ) +{ + return impl_getStaticSupportedServiceNames(); +} + +/* Helper for XServiceInfo */ +Sequence< OUString > SvtRemoteFilePicker::impl_getStaticSupportedServiceNames() +{ + Sequence< OUString > seqServiceNames( 1 ); + OUString* pArray = seqServiceNames.getArray(); + pArray[0] = "com.sun.star.ui.dialogs.RemoteFilePicker"; + return seqServiceNames ; +} + +/* Helper for XServiceInfo */ +OUString SvtRemoteFilePicker::impl_getStaticImplementationName() +{ + return OUString( "com.sun.star.svtools.RemoteFilePicker" ); +} + +/* Helper for registry */ +Reference< XInterface > SAL_CALL SvtRemoteFilePicker::impl_createInstance( + const Reference< XComponentContext >& rxContext) throw( Exception ) +{ + Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW); + return Reference< XInterface >( *new SvtRemoteFilePicker( xServiceManager ) ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index fa8313e16a85..df6ad1c7b195 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -61,7 +61,7 @@ class SvtFilePicker :public SvtFilePicker_Base ,public ::svt::OCommonPicker ,public ::svt::IFilePickerListener { -private: +protected: FilterList* m_pFilterList; ElementList* m_pElemList; @@ -205,14 +205,14 @@ protected: // OCommonPicker overridables - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; virtual bool implHandleInitializationArgument( const OUString& _rName, const ::com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE; -private: +protected: WinBits getWinBits( WinBits& rExtraBits ); virtual void notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) SAL_OVERRIDE; @@ -226,6 +226,39 @@ private: DECL_LINK( DialogClosedHdl, Dialog* ); }; +// SvtRemoteFilePicker + +class SvtRemoteFilePicker : public SvtFilePicker +{ +public: + SvtRemoteFilePicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + + // disambiguate XInterface + + DECLARE_XINTERFACE( ) + + // disambiguate XTypeProvider + + DECLARE_XTYPEPROVIDER( ) + + /* XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + /* Helper for XServiceInfo */ + static com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); + static OUString impl_getStaticImplementationName(); + + /* Helper for registry */ + static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( + const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) + throw( com::sun::star::uno::Exception ); +}; + #endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index 8f524856884c..33a3e53d2245 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -69,7 +69,7 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); } -VclPtr<SvtFileDialog> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) { return VclPtr<SvtFileDialog>::Create( _pParent, SFXWB_PATHDIALOG ); } diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx index 266c99cbef8a..b2697aef43e5 100644 --- a/fpicker/source/office/OfficeFolderPicker.hxx +++ b/fpicker/source/office/OfficeFolderPicker.hxx @@ -99,7 +99,7 @@ protected: // OCommonPicker overridables - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; }; diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx index a08c31ee2ba0..b74f1a906b7c 100644 --- a/fpicker/source/office/commonpicker.hxx +++ b/fpicker/source/office/commonpicker.hxx @@ -35,7 +35,7 @@ #include <tools/link.hxx> #include <vcl/vclptr.hxx> -class SvtFileDialog; +class SvtFileDialog_Base; namespace vcl { class Window; } struct ImplSVEvent; @@ -65,7 +65,7 @@ namespace svt ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; // </properties> - VclPtr<SvtFileDialog> m_pDlg; + VclPtr<SvtFileDialog_Base> m_pDlg; ImplSVEvent * m_nCancelEvent; bool m_bExecuting; @@ -79,7 +79,7 @@ namespace svt OUString m_aDisplayDirectory; protected: - inline SvtFileDialog* getDialog() { return m_pDlg; } + inline SvtFileDialog_Base* getDialog() { return m_pDlg; } inline const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return OCommonPicker_Base::rBHelper; } inline ::cppu::OBroadcastHelper& GetBroadcastHelper() { return OCommonPicker_Base::rBHelper; } @@ -93,7 +93,7 @@ namespace svt // overridables // will be called with locked SolarMutex - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) = 0; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) = 0; virtual sal_Int16 implExecutePicker( ) = 0; // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ... diff --git a/fpicker/source/office/fps_office.component b/fpicker/source/office/fps_office.component index 8804be2a91e9..b76edc61b401 100644 --- a/fpicker/source/office/fps_office.component +++ b/fpicker/source/office/fps_office.component @@ -22,6 +22,9 @@ <implementation name="com.sun.star.svtools.OfficeFilePicker"> <service name="com.sun.star.ui.dialogs.OfficeFilePicker"/> </implementation> + <implementation name="com.sun.star.svtools.RemoteFilePicker"> + <service name="com.sun.star.ui.dialogs.RemoteFilePicker"/> + </implementation> <implementation name="com.sun.star.svtools.OfficeFolderPicker"> <service name="com.sun.star.ui.dialogs.OfficeFolderPicker"/> </implementation> diff --git a/fpicker/source/office/fps_office.cxx b/fpicker/source/office/fps_office.cxx index c98b21f3c095..5e33e83fe2a4 100644 --- a/fpicker/source/office/fps_office.cxx +++ b/fpicker/source/office/fps_office.cxx @@ -28,6 +28,12 @@ static const cppu::ImplementationEntry g_entries[] = { { + SvtRemoteFilePicker::impl_createInstance, + SvtRemoteFilePicker::impl_getStaticImplementationName, + SvtRemoteFilePicker::impl_getStaticSupportedServiceNames, + cppu::createSingleComponentFactory, 0, 0 + }, + { SvtFilePicker::impl_createInstance, SvtFilePicker::impl_getStaticImplementationName, SvtFilePicker::impl_getStaticSupportedServiceNames, diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index dc1c820d12b4..a73c1c205212 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -303,7 +303,7 @@ SvtFileDialog::SvtFileDialog WinBits nBits, WinBits nExtraBits ) : - ModalDialog( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) + SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) ,_pCbReadOnly( NULL ) ,_pCbLinkBox( NULL) @@ -327,7 +327,7 @@ SvtFileDialog::SvtFileDialog SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits ) - :ModalDialog( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) + :SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) ,_pCbReadOnly( NULL ) ,_pCbLinkBox( NULL) ,_pCbPreviewBox( NULL ) diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 7770935f0e78..e32199175448 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -72,6 +72,46 @@ class SvtFileDialogFilter_Impl; #define FILEDIALOG_FILTER_ALL "*.*" +// SvtFileDialog_Base + +class SvtFileDialog_Base : public ModalDialog, public ::svt::IFilePickerController +{ +public: + SvtFileDialog_Base( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ) + : ModalDialog( pParent, rID, rUIXMLDescription ) + { + } + + virtual SvtFileView* GetView() = 0; + + virtual void SetHasFilename( bool bHasFilename ) = 0; + virtual void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) = 0; + virtual const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const = 0; + virtual void SetStandardDir( const OUString& rStdDir ) = 0; + virtual const OUString& GetStandardDir() const = 0; + virtual void SetPath( const OUString& rNewURL ) = 0; + virtual const OUString& GetPath() = 0; + virtual std::vector<OUString> GetPathList() const = 0; + virtual bool ContentIsFolder( const OUString& rURL ) = 0; + + virtual void AddFilter( const OUString& rFilter, const OUString& rType ) = 0; + virtual void AddFilterGroup( const OUString& _rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) = 0; + virtual OUString GetCurFilter() const = 0; + virtual void SetCurFilter( const OUString& rFilter ) = 0; + + virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) = 0; + + virtual void EnableAutocompletion( bool _bEnable = true ) = 0; + + virtual sal_Int32 getTargetColorDepth() = 0; + virtual sal_Int32 getAvailableWidth() = 0; + virtual sal_Int32 getAvailableHeight() = 0; + + virtual void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) = 0; + + virtual bool getShowState() = 0; +}; // SvtFileDialog @@ -79,7 +119,8 @@ class SvtFileDialogFilter_Impl; class SvtExpFileDlg_Impl; class CustomContainer; -class SvtFileDialog : public ModalDialog, public ::svt::IFilePickerController +class SvtFileDialog : //public ModalDialog, public ::svt::IFilePickerController, +public SvtFileDialog_Base { private: VclPtr<CheckBox> _pCbReadOnly; @@ -226,7 +267,7 @@ public: void PrevLevel_Impl(); void OpenURL_Impl( const OUString& rURL ); - inline SvtFileView* GetView() const; + SvtFileView* GetView(); void InitSize(); void UpdateControls( const OUString& rURL ); @@ -254,7 +295,7 @@ public: // inline inline void SetPath( const OUString& rNewURL ); inline void SetHasFilename( bool bHasFilename ); - inline const OUString& GetPath() const; + inline const OUString& GetPath(); inline void SetDefaultExt( const OUString& rExt ); inline void EraseDefaultExt( sal_Int32 _nIndex = 0 ); inline const OUString& GetDefaultExt() const; @@ -337,7 +378,7 @@ inline void SvtFileDialog::SetHasFilename( bool bHasFilename ) -inline const OUString& SvtFileDialog::GetPath() const +inline const OUString& SvtFileDialog::GetPath() { return _aPath; } @@ -360,7 +401,7 @@ inline const OUString& SvtFileDialog::GetDefaultExt() const } -inline SvtFileView* SvtFileDialog::GetView() const +inline SvtFileView* SvtFileDialog::GetView() { return _pFileView; } |