diff options
author | Aron Budea <aron.budea@collabora.com> | 2018-01-22 03:00:28 +0100 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-01-25 14:42:27 +0100 |
commit | 6feeb77552c38e3d9819611e9678470a44c00c84 (patch) | |
tree | 6b89810bf9c8336c838de5604862815381927ad0 /sw | |
parent | 404a2ff6222228877087233bbe1f2a1544a46d8a (diff) |
tdf115103: find data source if sDataSource/sCommand are empty
In several functions data source was only found if sDataSource and
sCommand corresponded to what was set in fields.
In imported DOC(X) files these aren't set.
Now use the data source even if field's sDataSource/sCommand are
empty (similarly to SwDBManager::IsDataSourceOpen(...)).
Change-Id: I9563cb56e700e7fd033100cb200f41f074669020
Reviewed-on: https://gerrit.libreoffice.org/48285
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 102e6dd4ab71..6067bd834ac2 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1696,7 +1696,8 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName, uno::Reference< sdbcx::XColumnsSupplier> xColsSupp; bool bDisposeConnection = false; if(pImpl->pMergeData && - pImpl->pMergeData->sDataSource == rDBName && pImpl->pMergeData->sCommand == rTableName) + ((pImpl->pMergeData->sDataSource == rDBName && pImpl->pMergeData->sCommand == rTableName) || + (rDBName.isEmpty() && rTableName.isEmpty()))) { xConnection = pImpl->pMergeData->xConnection; xSource = SwDBManager::getDataSourceAsParent(xConnection,rDBName); @@ -2400,11 +2401,15 @@ sal_uInt32 SwDBManager::GetSelectedRecordId( { sal_uInt32 nRet = 0xffffffff; //check for merge data source first - if(pImpl->pMergeData && rDataSource == pImpl->pMergeData->sDataSource && - rTableOrQuery == pImpl->pMergeData->sCommand && - (nCommandType == -1 || nCommandType == pImpl->pMergeData->nCommandType) && - pImpl->pMergeData->xResultSet.is()) + if(pImpl->pMergeData && + ((rDataSource == pImpl->pMergeData->sDataSource && + rTableOrQuery == pImpl->pMergeData->sCommand) || + (rDataSource.isEmpty() && rTableOrQuery.isEmpty())) && + (nCommandType == -1 || nCommandType == pImpl->pMergeData->nCommandType) && + pImpl->pMergeData->xResultSet.is()) + { nRet = GetSelectedRecordId(); + } else { SwDBData aData; @@ -2460,8 +2465,10 @@ void SwDBManager::CloseAll(bool bIncludingMerge) SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate) { //prefer merge data if available - if(pImpl->pMergeData && rData.sDataSource == pImpl->pMergeData->sDataSource && - rData.sCommand == pImpl->pMergeData->sCommand && + if(pImpl->pMergeData && + ((rData.sDataSource == pImpl->pMergeData->sDataSource && + rData.sCommand == pImpl->pMergeData->sCommand) || + (rData.sDataSource.isEmpty() && rData.sCommand.isEmpty())) && (rData.nCommandType == -1 || rData.nCommandType == pImpl->pMergeData->nCommandType || (bCreate && pImpl->pMergeData->nCommandType == -1))) { |