[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin
noelgrandin at gmail.com
Wed Jun 3 23:34:10 PDT 2015
sw/inc/dbmgr.hxx | 9 +++++----
sw/source/ui/dbui/addresslistdialog.cxx | 2 +-
sw/source/uibase/dbui/dbmgr.cxx | 8 ++++----
sw/source/uibase/dbui/mmconfigitem.cxx | 2 +-
sw/source/uibase/shells/textsh2.cxx | 2 +-
5 files changed, 12 insertions(+), 11 deletions(-)
New commits:
commit a9a2375a744368415a7ea4c563c8e4776a6ec059
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Tue May 19 20:49:17 2015 +0200
convert SW_DB_SELECT constants to scoped enum
Change-Id: I03387e8e90891b3477c9c15200acc127262170bc
Reviewed-on: https://gerrit.libreoffice.org/16070
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 657e957..007755d 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -89,9 +89,10 @@ enum DBManagerOptions
};
// Administration of (new) logical databases.
-#define SW_DB_SELECT_UNKNOWN 0
-#define SW_DB_SELECT_TABLE 1
-#define SW_DB_SELECT_QUERY 2
+enum class SwDBSelect
+{
+ UNKNOWN, TABLE, QUERY
+};
struct SwDSParam : public SwDBData
{
@@ -339,7 +340,7 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
GetColumnSupplier(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>,
const OUString& rTableOrQuery,
- sal_uInt8 eTableOrQuery = SW_DB_SELECT_UNKNOWN);
+ SwDBSelect eTableOrQuery = SwDBSelect::UNKNOWN);
static ::com::sun::star::uno::Sequence<OUString> GetExistingDatabaseNames();
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index cda553a..4bf8261 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -616,7 +616,7 @@ void SwAddressListDialog::DetectTablesAndQueries(
pUserData->xColumnsSupplier = SwDBManager::GetColumnSupplier(pUserData->xConnection,
m_aDBData.sCommand,
m_aDBData.nCommandType == CommandType::TABLE ?
- SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY );
+ SwDBSelect::TABLE : SwDBSelect::QUERY );
//#i97577#
if( pUserData->xColumnsSupplier.is() )
m_pListLB->SetEntryText(m_aDBData.sCommand, pSelect, ITEMID_TABLE - 1);
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index d59d78b..be81dce 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1755,12 +1755,12 @@ uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rD
uno::Reference< sdbcx::XColumnsSupplier> SwDBManager::GetColumnSupplier(uno::Reference<sdbc::XConnection> xConnection,
const OUString& rTableOrQuery,
- sal_uInt8 eTableOrQuery)
+ SwDBSelect eTableOrQuery)
{
Reference< sdbcx::XColumnsSupplier> xRet;
try
{
- if(eTableOrQuery == SW_DB_SELECT_UNKNOWN)
+ if(eTableOrQuery == SwDBSelect::UNKNOWN)
{
//search for a table with the given command name
Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
@@ -1768,10 +1768,10 @@ uno::Reference< sdbcx::XColumnsSupplier> SwDBManager::GetColumnSupplier(uno::Ref
{
Reference<XNameAccess> xTables = xTSupplier->getTables();
eTableOrQuery = xTables->hasByName(rTableOrQuery) ?
- SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY;
+ SwDBSelect::TABLE : SwDBSelect::QUERY;
}
}
- sal_Int32 nCommandType = SW_DB_SELECT_TABLE == eTableOrQuery ?
+ sal_Int32 nCommandType = SwDBSelect::TABLE == eTableOrQuery ?
CommandType::TABLE : CommandType::QUERY;
Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
Reference<XRowSet> xRowSet(xMgr->createInstance("com.sun.star.sdb.RowSet"), UNO_QUERY);
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx
index 8523fac..468a54c 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -858,7 +858,7 @@ Reference< XColumnsSupplier> SwMailMergeConfigItem::GetColumnsSupplier()
m_pImpl->xColumnsSupplier = SwDBManager::GetColumnSupplier(m_pImpl->xConnection,
m_pImpl->aDBData.sCommand,
m_pImpl->aDBData.nCommandType == CommandType::TABLE ?
- SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY );
+ SwDBSelect::TABLE : SwDBSelect::QUERY );
}
return m_pImpl->xColumnsSupplier;
}
diff --git a/sw/source/uibase/shells/textsh2.cxx b/sw/source/uibase/shells/textsh2.cxx
index 671c9e3..cf95548 100644
--- a/sw/source/uibase/shells/textsh2.cxx
+++ b/sw/source/uibase/shells/textsh2.cxx
@@ -256,7 +256,7 @@ IMPL_LINK( SwBaseShell, InsertDBTextHdl, DBTextStruct_Impl*, pDBStruct )
xColSupp = SwDBManager::GetColumnSupplier(xConnection,
pDBStruct->aDBData.sCommand,
pDBStruct->aDBData.nCommandType == CommandType::QUERY ?
- SW_DB_SELECT_QUERY : SW_DB_SELECT_TABLE);
+ SwDBSelect::QUERY : SwDBSelect::TABLE);
if( xColSupp.is() )
{
More information about the Libreoffice-commits
mailing list