summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2011-11-30 16:08:23 +0100
committerMichael Stahl <mstahl@redhat.com>2011-12-03 00:48:13 +0100
commit5754213c709428b19c68d5242df54683bf83536e (patch)
treea1f23a0e7218884f9186cd063ba46515a26cab6c /dbaccess
parentdb74fdf5346c4f97256522ee2a3200fcdce1af5a (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 'dbaccess')
-rw-r--r--dbaccess/source/ext/adabas/AdabasNewDb.cxx9
-rw-r--r--dbaccess/source/ui/app/AppController.cxx5
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx18
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx5
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx7
5 files changed, 30 insertions, 14 deletions
diff --git a/dbaccess/source/ext/adabas/AdabasNewDb.cxx b/dbaccess/source/ext/adabas/AdabasNewDb.cxx
index cd1a90856724..4c31eff2989e 100644
--- a/dbaccess/source/ext/adabas/AdabasNewDb.cxx
+++ b/dbaccess/source/ext/adabas/AdabasNewDb.cxx
@@ -48,6 +48,7 @@
#include <unotools/tempfile.hxx>
#include <unotools/localfilehelper.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <unotools/ucbhelper.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbexception.hxx>
@@ -59,6 +60,7 @@
using namespace adabasui;
using namespace ucbhelper;
using namespace utl;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
@@ -549,7 +551,8 @@ IMPL_LINK( OAdabasNewDbDlg, LoseFocusHdl, Edit *, pEdit )
//------------------------------------------------------------------------
IMPL_LINK( OAdabasNewDbDlg, LoadButtonClickHdl, Button *, /*pButton*/ )
{
- ::sfx2::FileDialogHelper aLoad(0);
+ ::sfx2::FileDialogHelper aLoad(
+ ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0);
if(!m_Backup_File.Len())
aLoad.SetDisplayDirectory(SvtPathOptions().GetWorkPath());
else
@@ -573,8 +576,8 @@ IMPL_LINK( OAdabasNewDbDlg, LoadButtonClickHdl, Button *, /*pButton*/ )
//------------------------------------------------------------------------
IMPL_LINK( OAdabasNewDbDlg, ButtonClickHdl, Button *, pButton )
{
- WinBits nBits(WB_SAVEAS);
- ::sfx2::FileDialogHelper aFileDlg( static_cast<sal_uInt32>(nBits) );
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0);
String aPath;
if(pButton == &m_PB_SYSDEVSPACE)
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 81a2dd0d7d08..216d65ffe63f 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -1172,14 +1172,15 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
case ID_BROWSER_SAVEASDOC:
{
- WinBits nBits(WB_SAVEAS);
::rtl::OUString sUrl;
if ( m_xModel.is() )
sUrl = m_xModel->getURL();
if ( !sUrl.getLength() )
sUrl = SvtPathOptions().GetWorkPath();
- ::sfx2::FileDialogHelper aFileDlg( com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,static_cast<sal_uInt32>(nBits) ,getView());
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
+ 0, getView());
aFileDlg.SetDisplayDirectory( sUrl );
const SfxFilter* pFilter = getStandardDatabaseFilter();
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 3f1bbd52d3a7..8c34de3c5b69 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -55,6 +55,7 @@
#include <svl/filenotation.hxx>
#include "dbustrings.hrc"
#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
@@ -87,6 +88,7 @@
namespace dbaui
{
//.........................................................................
+ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::ui::dialogs;
@@ -229,9 +231,11 @@ DBG_NAME(OConnectionHelper)
case ::dbaccess::DST_CALC:
{
SvtModuleOptions aModule;
- ::sfx2::FileDialogHelper aFileDlg(0
- ,aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
- ,SFX_FILTER_IMPORT);
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
+ 0,
+ aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
+ ,SFX_FILTER_IMPORT);
askForFileName(aFileDlg);
}
break;
@@ -239,7 +243,9 @@ DBG_NAME(OConnectionHelper)
{
const ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb"));
String sFilterName(ModuleRes (STR_MSACCESS_FILTERNAME));
- ::sfx2::FileDialogHelper aFileDlg(0);
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
+ 0);
aFileDlg.AddFilter(sFilterName,sExt);
aFileDlg.SetCurrentFilter(sFilterName);
askForFileName(aFileDlg);
@@ -249,7 +255,9 @@ DBG_NAME(OConnectionHelper)
{
const ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb"));
String sFilterName2(ModuleRes (STR_MSACCESS_2007_FILTERNAME));
- ::sfx2::FileDialogHelper aFileDlg(0);
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
+ 0);
aFileDlg.AddFilter(sFilterName2,sAccdb);
aFileDlg.SetCurrentFilter(sFilterName2);
askForFileName(aFileDlg);
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 71dbcb357faa..a17d60abd0fd 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -888,8 +888,9 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
sal_Bool ODbTypeWizDialogSetup::callSaveAsDialog()
{
sal_Bool bRet = sal_False;
- WinBits nBits(WB_SAVEAS);
- ::sfx2::FileDialogHelper aFileDlg( com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, static_cast<sal_uInt32>(nBits), this);
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
+ 0, this);
const SfxFilter* pFilter = getStandardDatabaseFilter();
if ( pFilter )
{
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index db870237bc85..6f1ed9b41b32 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -44,6 +44,7 @@
#include <vcl/waitobj.hxx>
#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
#include "DriverSettings.hxx"
@@ -56,6 +57,7 @@
namespace dbaui
{
//.........................................................................
+ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
@@ -602,8 +604,9 @@ namespace dbaui
//-------------------------------------------------------------------------
IMPL_LINK(OGeneralPage, OnOpenDocument, PushButton*, /*_pBox*/)
{
- ::sfx2::FileDialogHelper aFileDlg( 0,
- ::String::CreateFromAscii("sdatabase") );
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
+ 0, ::String::CreateFromAscii("sdatabase") );
const SfxFilter* pFilter = getStandardDatabaseFilter();
if ( pFilter )
{