summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2011-11-30 16:08:21 +0100
committerMichael Stahl <mstahl@redhat.com>2011-12-03 00:48:12 +0100
commit1274babb68e9dc09747ac54ea19421af839db92a (patch)
tree424dec72286ce76ea8d778b5e2cd5fac7822b6c6 /sfx2
parente913083ed0db342f161b40a153c8af7ada6b4acc (diff)
sfx2::FileDialogHelper: remove use of WB_OPEN
This can really be derived from the dialog type, don't duplicate it.
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appopen.cxx3
-rw-r--r--sfx2/source/appl/shutdownicon.cxx2
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx3
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx46
-rw-r--r--sfx2/source/dialog/filedlgimpl.hxx3
-rw-r--r--sfx2/source/doc/docvor.cxx2
6 files changed, 43 insertions, 16 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index d35b2c2d8b34..c6fe758d777b 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -758,7 +758,8 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
sal_uIntPtr nErr = sfx2::FileOpenDialog_Impl(
- WB_OPEN | SFXWB_MULTISELECTION | SFXWB_SHOWVERSIONS, String(), pURLList, aFilter, pSet, &aPath, nDialog, sStandardDir, aBlackList );
+ SFXWB_MULTISELECTION | SFXWB_SHOWVERSIONS, String(), pURLList,
+ aFilter, pSet, &aPath, nDialog, sStandardDir, aBlackList );
if ( nErr == ERRCODE_ABORT )
{
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index 2b32ee2c5c4c..6418317b6a81 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -420,7 +420,7 @@ void ShutdownIcon::StartFileDialog()
}
if ( !m_pFileDlg )
- m_pFileDlg = new FileDialogHelper( WB_OPEN | SFXWB_MULTISELECTION, String() );
+ m_pFileDlg = new FileDialogHelper( SFXWB_MULTISELECTION, String() );
m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) );
}
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 1832e05767d5..df7f9634b974 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1374,7 +1374,8 @@ IMPL_LINK( SfxInternetPage, ClickHdlForward, Control*, pCtrl )
IMPL_LINK( SfxInternetPage, ClickHdlBrowseURL, PushButton*, EMPTYARG )
{
if ( !pFileDlg )
- pFileDlg = new sfx2::FileDialogHelper( TemplateDescription::FILEOPEN_SIMPLE, WB_OPEN );
+ pFileDlg = new sfx2::FileDialogHelper(
+ TemplateDescription::FILEOPEN_SIMPLE, 0 );
pFileDlg->SetDisplayDirectory( aEDForwardURL.GetText() );
pFileDlg->StartExecuteModal( LINK( this, SfxInternetPage, DialogClosedHdl ) );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 5a87f5d96ab6..08af95aa3b88 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -856,6 +856,29 @@ static bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker >& _rxFP )
return false;
}
+enum open_or_save_t {OPEN, SAVE};
+static open_or_save_t lcl_OpenOrSave(sal_Int16 const nDialogType)
+{
+ switch (nDialogType)
+ {
+ case FILEOPEN_SIMPLE:
+ case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
+ case FILEOPEN_PLAY:
+ case FILEOPEN_READONLY_VERSION:
+ case FILEOPEN_LINK_PREVIEW:
+ return OPEN;
+ case FILESAVE_SIMPLE:
+ case FILESAVE_AUTOEXTENSION_PASSWORD:
+ case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
+ case FILESAVE_AUTOEXTENSION_SELECTION:
+ case FILESAVE_AUTOEXTENSION_TEMPLATE:
+ case FILESAVE_AUTOEXTENSION:
+ return SAVE;
+ default:
+ assert(false); // invalid dialog type
+ }
+}
+
// ------------------------------------------------------------------------
// ----------- FileDialogHelper_Impl ---------------------------
// ------------------------------------------------------------------------
@@ -909,7 +932,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
// default settings
m_nDontFlags = SFX_FILTER_INTERNAL | SFX_FILTER_NOTINFILEDLG | SFX_FILTER_NOTINSTALLED;
- if( WB_OPEN == ( nFlags & WB_OPEN ) )
+ if (OPEN == lcl_OpenOrSave(m_nDialogType))
m_nMustFlags = SFX_FILTER_IMPORT;
else
m_nMustFlags = SFX_FILTER_EXPORT;
@@ -1697,8 +1720,7 @@ void FileDialogHelper_Impl::createMatcher( const String& rFactory )
}
// ------------------------------------------------------------------------
-void FileDialogHelper_Impl::addFilters( sal_Int64 nFlags,
- const String& rFactory,
+void FileDialogHelper_Impl::addFilters( const String& rFactory,
SfxFilterFlags nMust,
SfxFilterFlags nDont )
{
@@ -1757,7 +1779,7 @@ void FileDialogHelper_Impl::addFilters( sal_Int64 nFlags,
// append the filters
::rtl::OUString sFirstFilter;
- if ( WB_OPEN == ( nFlags & WB_OPEN ) )
+ if (OPEN == lcl_OpenOrSave(m_nDialogType))
::sfx2::appendFiltersForOpen( aIter, xFltMgr, sFirstFilter, *this );
else if ( mbExport )
::sfx2::appendExportFilters( aIter, xFltMgr, sFirstFilter, *this );
@@ -2203,7 +2225,8 @@ FileDialogHelper::FileDialogHelper(
mxImp = mpImp;
// create the list of filters
- mpImp->addFilters( nFlags, SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
+ mpImp->addFilters(
+ SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
}
FileDialogHelper::FileDialogHelper(
@@ -2219,7 +2242,8 @@ FileDialogHelper::FileDialogHelper(
mxImp = mpImp;
// create the list of filters
- mpImp->addFilters( nFlags, SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
+ mpImp->addFilters(
+ SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
}
// ------------------------------------------------------------------------
@@ -2243,7 +2267,8 @@ FileDialogHelper::FileDialogHelper(
mxImp = mpImp;
// create the list of filters
- mpImp->addFilters( nFlags, SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
+ mpImp->addFilters(
+ SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
}
// ------------------------------------------------------------------------
@@ -2261,7 +2286,8 @@ FileDialogHelper::FileDialogHelper(
mxImp = mpImp;
// create the list of filters
- mpImp->addFilters( nFlags, SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
+ mpImp->addFilters(
+ SfxObjectShell::GetServiceNameFromFactory(rFact), nMust, nDont );
}
// ------------------------------------------------------------------------
@@ -2299,8 +2325,8 @@ FileDialogHelper::FileDialogHelper(
aWildcard += aExtName;
- ::rtl::OUString aUIString =
- ::sfx2::addExtension( aFilterUIName, aWildcard, ( WB_OPEN == ( nFlags & WB_OPEN ) ), *mpImp );
+ ::rtl::OUString const aUIString = ::sfx2::addExtension( aFilterUIName,
+ aWildcard, (OPEN == lcl_OpenOrSave(mpImp->m_nDialogType)), *mpImp);
AddFilter( aUIString, aWildcard );
}
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 6b6b66d64c46..8d0ddcb2ca55 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -112,8 +112,7 @@ namespace sfx2
sal_Bool mbSelectionFltrEnabled : 1;
private:
- void addFilters( sal_Int64 nFlags,
- const String& rFactory,
+ void addFilters( const String& rFactory,
SfxFilterFlags nMust,
SfxFilterFlags nDont );
void addFilter( const ::rtl::OUString& rFilterName,
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 243e5f2f2619..1a6204506d85 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -2221,7 +2221,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, AddFiles_Impl, Button *, pButton )
(void)pButton; //unused
if ( pFileDlg )
delete pFileDlg;
- pFileDlg = new sfx2::FileDialogHelper( WB_OPEN, String() );
+ pFileDlg = new sfx2::FileDialogHelper( 0, String() );
// add config and basic filter
static String sOpenBracket( DEFINE_CONST_UNICODE( " (" ) );