summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-05-19 20:49:17 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-06-04 06:33:47 +0000
commita9a2375a744368415a7ea4c563c8e4776a6ec059 (patch)
tree849498a6defcc8c1e2fae1d875a5fe2cafc8e50f
parent68577e5a902db11b5ec000e878cf212007452c72 (diff)
convert SW_DB_SELECT constants to scoped enum
Change-Id: I03387e8e90891b3477c9c15200acc127262170bc Reviewed-on: https://gerrit.libreoffice.org/16070 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--sw/inc/dbmgr.hxx9
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx2
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx8
-rw-r--r--sw/source/uibase/dbui/mmconfigitem.cxx2
-rw-r--r--sw/source/uibase/shells/textsh2.cxx2
5 files changed, 12 insertions, 11 deletions
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 657e957e1e68..007755d8424b 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 cda553ad2945..4bf8261ee5ae 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 d59d78be73a4..be81dce3e81c 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 8523fac38a6b..468a54c19e2b 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 671c9e3b653d..cf95548cb6b9 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() )
{