diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-11-30 16:08:23 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-12-03 00:48:13 +0100 |
commit | 5754213c709428b19c68d5242df54683bf83536e (patch) | |
tree | a1f23a0e7218884f9186cd063ba46515a26cab6c /sfx2/source/dialog | |
parent | db74fdf5346c4f97256522ee2a3200fcdce1af5a (diff) |
sfx2::FileDialogHelper: refactor construction:
There are currently 2 different ways to specify what kind of file dialog
should be created: the nDialogType and nFlags ctor parameters.
Simplify that by using the nDialogType for the API specified variety,
and the nFlags only for options that cannot be specified by the API.
This allows to get rid of 3 constructors, and the following constants:
WB_OPEN, WB_SAVEAS, WB_PASSWORD, SFXWB_PASSWORD, SFXWB_SHOWSTYLES
Diffstat (limited to 'sfx2/source/dialog')
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 72 |
1 files changed, 4 insertions, 68 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 08af95aa3b88..1ab73ed2353e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2216,47 +2216,6 @@ void FileDialogHelper_Impl::SetContext( FileDialogHelper::Context _eNewContext ) // ------------------------------------------------------------------------ FileDialogHelper::FileDialogHelper( - sal_Int64 nFlags, - const String& rFact, - SfxFilterFlags nMust, - SfxFilterFlags nDont ) -{ - mpImp = new FileDialogHelper_Impl( this, getDialogType( nFlags ), nFlags ); - mxImp = mpImp; - - // create the list of filters - mpImp->addFilters( - SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont ); -} - -FileDialogHelper::FileDialogHelper( - sal_Int64 nFlags, - const String& rFact, - sal_Int16 nDialog, - SfxFilterFlags nMust, - SfxFilterFlags nDont, - const String& rStandardDir, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList) -{ - mpImp = new FileDialogHelper_Impl( this, getDialogType( nFlags ), nFlags, nDialog, NULL , rStandardDir, rBlackList ); - mxImp = mpImp; - - // create the list of filters - mpImp->addFilters( - SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont ); -} - -// ------------------------------------------------------------------------ -FileDialogHelper::FileDialogHelper( sal_Int64 nFlags ) -{ - sal_Int16 nDialogType = getDialogType( nFlags ); - - mpImp = new FileDialogHelper_Impl( this, nDialogType, nFlags ); - mxImp = mpImp; -} - -// ------------------------------------------------------------------------ -FileDialogHelper::FileDialogHelper( sal_Int16 nDialogType, sal_Int64 nFlags, const String& rFact, @@ -2634,31 +2593,6 @@ uno::Reference < XFilePicker > FileDialogHelper::GetFilePicker() const } // ------------------------------------------------------------------------ -sal_Int16 FileDialogHelper::getDialogType( sal_Int64 nFlags ) const -{ - sal_Int16 nDialogType = FILEOPEN_SIMPLE; - - if ( nFlags & WB_SAVEAS ) - { - if ( nFlags & SFXWB_PASSWORD ) - nDialogType = FILESAVE_AUTOEXTENSION_PASSWORD; - else - nDialogType = FILESAVE_SIMPLE; - } - else if ( nFlags & SFXWB_GRAPHIC ) - { - if ( nFlags & SFXWB_SHOWSTYLES ) - nDialogType = FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE; - else - nDialogType = FILEOPEN_LINK_PREVIEW; - } - else if ( SFXWB_INSERT != ( nFlags & SFXWB_INSERT ) ) - nDialogType = FILEOPEN_READONLY_VERSION; - - return nDialogType; -} - -// ------------------------------------------------------------------------ // XFilePickerListener Methods // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper::FileSelectionChanged( const FilePickerEvent& aEvent ) @@ -2700,7 +2634,8 @@ void SAL_CALL FileDialogHelper::DialogClosed( const DialogClosedEvent& _rEvent ) // ------------------------------------------------------------------------ -ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, +ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, + sal_Int64 nFlags, const String& rFact, SvStringsDtor *& rpURLList, String& rFilter, @@ -2711,7 +2646,8 @@ ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList ) { ErrCode nRet; - FileDialogHelper aDialog( nFlags, rFact, nDialog, 0, 0, rStandardDir, rBlackList ); + FileDialogHelper aDialog( nDialogType, nFlags, + rFact, nDialog, 0, 0, rStandardDir, rBlackList ); String aPath; if ( pPath ) |