[Libreoffice-commits] core.git: sw/source

Aron Budea aron.budea at collabora.com
Thu Jan 25 13:42:53 UTC 2018


 sw/source/uibase/dbui/dbmgr.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 6feeb77552c38e3d9819611e9678470a44c00c84
Author: Aron Budea <aron.budea at collabora.com>
Date:   Mon Jan 22 03:00:28 2018 +0100

    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 at libreoffice.org>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>

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)))
     {


More information about the Libreoffice-commits mailing list