[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/source

Aron Budea aron.budea at collabora.com
Thu Jan 25 17:37:22 UTC 2018


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

New commits:
commit b4cef1fb91c7b5024c4e370b0c57a1d4c463a476
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(...)).
    
    Reviewed-on: https://gerrit.libreoffice.org/48285
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit 6feeb77552c38e3d9819611e9678470a44c00c84)
    
    Change-Id: I9563cb56e700e7fd033100cb200f41f074669020
    Reviewed-on: https://gerrit.libreoffice.org/48614
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-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 ac44e0b8bcc0..a404a206be21 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1707,7 +1707,8 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
         uno::Reference< sdbcx::XColumnsSupplier> xColsSupp;
         bool bDisposeConnection = false;
         if(pImpl->pMergeData &&
-            pImpl->pMergeData->sDataSource.equals(rDBName) && pImpl->pMergeData->sCommand.equals(rTableName))
+            ((pImpl->pMergeData->sDataSource == rDBName && pImpl->pMergeData->sCommand == rTableName) ||
+            (rDBName.isEmpty() && rTableName.isEmpty())))
         {
             xConnection = pImpl->pMergeData->xConnection;
             xSource = SwDBManager::getDataSourceAsParent(xConnection,rDBName);
@@ -2415,11 +2416,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;
@@ -2475,8 +2480,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