[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Feb 13 06:38:08 UTC 2017
sw/inc/dbmgr.hxx | 18 +++++++++--------
sw/source/uibase/dbui/dbmgr.cxx | 42 +++++++++++++++++++++-------------------
2 files changed, 33 insertions(+), 27 deletions(-)
New commits:
commit 64cb9fb42fb4d56eb9bf42fb9b91a01a405d881d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 13 08:36:33 2017 +0200
Revert "convert DBConnURIType to scoped enum"
This reverts commit f0c57266709509ae24cfb1615d136263fb1e8d60.
Missed the WIN32 only code where the JET and ACE enumerators were
being used.
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index cc9c0b9..e1ad5f7 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -285,12 +285,14 @@ public:
SwDBManager(SwDoc* pDoc);
~SwDBManager();
- enum class DBConnURIType {
- Unknown,
- Odb,
- Calc,
- Dbase,
- Flat
+ enum DBConnURITypes {
+ DBCONN_UNKNOWN = 0,
+ DBCONN_ODB,
+ DBCONN_CALC,
+ DBCONN_DBASE,
+ DBCONN_FLAT,
+ DBCONN_MSJET,
+ DBCONN_MSACE
};
/// MailMergeEvent source
@@ -395,7 +397,7 @@ public:
static css::uno::Sequence<OUString> GetExistingDatabaseNames();
- static DBConnURIType GetDBunoURI(const OUString &rURI, css::uno::Any &aURLAny);
+ static DBConnURITypes GetDBunoURI(const OUString &rURI, css::uno::Any &aURLAny);
/**
Loads a data source from file and registers it.
@@ -412,7 +414,7 @@ public:
In case of success it returns the registered name, otherwise an empty string.
Optionally add a prefix to the registered DB name.
*/
- static OUString LoadAndRegisterDataSource(const DBConnURIType type, const css::uno::Any &rUnoURI,
+ static OUString LoadAndRegisterDataSource(const DBConnURITypes type, const css::uno::Any &rUnoURI,
const css::uno::Reference < css::beans::XPropertySet > *pSettings,
const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir,
SwDocShell* pDocShell = nullptr);
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index e62aec5..59eff0e 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2598,29 +2598,29 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
uno::Any aURLAny;
uno::Reference< beans::XPropertySet > aSettings;
const OUString aURI( xFP->getSelectedFiles().getConstArray()[0] );
- const DBConnURIType type = GetDBunoURI( aURI, aURLAny );
+ const DBConnURITypes type = GetDBunoURI( aURI, aURLAny );
- if( DBConnURIType::Flat == type )
+ if( DBCONN_FLAT == type )
{
uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
uno::Reference < sdb::XTextConnectionSettings > xSettingsDlg = sdb::TextConnectionSettings::create(xContext);
if( xSettingsDlg->execute() )
aSettings.set( uno::Reference < beans::XPropertySet >( xSettingsDlg, uno::UNO_QUERY_THROW ) );
}
- sFind = LoadAndRegisterDataSource( type, aURLAny, DBConnURIType::Flat == type ? &aSettings : nullptr, aURI, nullptr, nullptr, pDocShell );
+ sFind = LoadAndRegisterDataSource( type, aURLAny, DBCONN_FLAT == type ? &aSettings : nullptr, aURI, nullptr, nullptr, pDocShell );
}
return sFind;
}
-SwDBManager::DBConnURIType SwDBManager::GetDBunoURI(const OUString &rURI, uno::Any &aURLAny)
+SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::Any &aURLAny)
{
INetURLObject aURL( rURI );
OUString sExt( aURL.GetExtension() );
- DBConnURIType type = DBConnURIType::Unknown;
+ DBConnURITypes type = DBCONN_UNKNOWN;
if(sExt == "odb")
{
- type = DBConnURIType::Odb;
+ type = DBCONN_ODB;
}
else if(sExt.equalsIgnoreAsciiCase("sxc")
|| sExt.equalsIgnoreAsciiCase("ods")
@@ -2629,7 +2629,7 @@ SwDBManager::DBConnURIType SwDBManager::GetDBunoURI(const OUString &rURI, uno::A
OUString sDBURL("sdbc:calc:");
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL;
- type = DBConnURIType::Calc;
+ type = DBCONN_CALC;
}
else if(sExt.equalsIgnoreAsciiCase("dbf"))
{
@@ -2638,7 +2638,7 @@ SwDBManager::DBConnURIType SwDBManager::GetDBunoURI(const OUString &rURI, uno::A
OUString sDBURL("sdbc:dbase:");
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL;
- type = DBConnURIType::Dbase;
+ type = DBCONN_DBASE;
}
else if(sExt.equalsIgnoreAsciiCase("csv") || sExt.equalsIgnoreAsciiCase("txt"))
{
@@ -2648,7 +2648,7 @@ SwDBManager::DBConnURIType SwDBManager::GetDBunoURI(const OUString &rURI, uno::A
//only the 'path' has to be added
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL;
- type = DBConnURIType::Flat;
+ type = DBCONN_FLAT;
}
#ifdef _WIN32
else if (sExt.equalsIgnoreAsciiCase("mdb") || sExt.equalsIgnoreAsciiCase("mde"))
@@ -2656,14 +2656,14 @@ SwDBManager::DBConnURIType SwDBManager::GetDBunoURI(const OUString &rURI, uno::A
OUString sDBURL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=");
sDBURL += aURL.PathToFileName();
aURLAny <<= sDBURL;
- type = DBConnURIType::MsJet;
+ type = DBCONN_MSJET;
}
else if (sExt.equalsIgnoreAsciiCase("accdb") || sExt.equalsIgnoreAsciiCase("accde"))
{
OUString sDBURL("sdbc:ado:PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=");
sDBURL += aURL.PathToFileName();
aURLAny <<= sDBURL;
- type = DBConnURIType::MsAce;
+ type = DBCONN_MSACE;
}
#endif
return type;
@@ -2682,7 +2682,7 @@ OUString lcl_getOwnURL(SwDocShell* pDocShell)
return aRet;
}
-OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURIType type, const uno::Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
+OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const uno::Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir, SwDocShell* pDocShell)
{
INetURLObject aURL( rURI );
@@ -2695,18 +2695,22 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURIType type, const
uno::Sequence<OUString> aFilters(1);
switch (type) {
- case DBConnURIType::Unknown:
- case DBConnURIType::Calc:
+ case DBCONN_UNKNOWN:
+ case DBCONN_CALC:
break;
- case DBConnURIType::Odb:
+ case DBCONN_ODB:
bStore = false;
break;
- case DBConnURIType::Flat:
- case DBConnURIType::Dbase:
+ case DBCONN_FLAT:
+ case DBCONN_DBASE:
//set the filter to the file name without extension
aFilters[0] = aURL.getBase();
aTableFilterAny <<= aFilters;
break;
+ case DBCONN_MSJET:
+ case DBCONN_MSACE:
+ aSuppressVersionsAny = uno::makeAny(true);
+ break;
}
try
@@ -2751,7 +2755,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURIType type, const
if(aInfoAny.hasValue())
xDataProperties->setPropertyValue("Info", aInfoAny);
- if( DBConnURIType::Flat == type && pSettings )
+ if( DBCONN_FLAT == type && pSettings )
{
uno::Any aSettings = xDataProperties->getPropertyValue( "Settings" );
uno::Reference < beans::XPropertySet > xDSSettings;
@@ -2820,7 +2824,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const OUString &rURI, const OUSt
const uno::Reference< beans::XPropertySet > *pSettings)
{
uno::Any aURLAny;
- DBConnURIType type = GetDBunoURI( rURI, aURLAny );
+ DBConnURITypes type = GetDBunoURI( rURI, aURLAny );
return LoadAndRegisterDataSource( type, aURLAny, pSettings, rURI, pPrefix, pDestDir );
}
More information about the Libreoffice-commits
mailing list