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

Michael Stahl mstahl at redhat.com
Tue Oct 27 23:39:32 PDT 2015


 sw/inc/dbmgr.hxx                 |    2 +-
 sw/source/uibase/dbui/dbmgr.cxx  |    2 +-
 sw/source/uibase/dbui/dbtree.cxx |   27 ++-------------------------
 3 files changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 5d3c37b99e8bfa9256f12015152439bf4e5ebbb4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 21 17:39:31 2015 +0200

    sw: remove SwDBTreeList_Impl::m_aConnections
    
    ... which actually does nothing since commit
    fca027b0bd76a76b50f4d6d667d2d479417a74a6 but was dutifully converted to
    a boost::ptr_vector.
    
    Change-Id: I69186d6ba7d90fb2f94b417fede3a907811c32c0
    Reviewed-on: https://gerrit.libreoffice.org/19518
    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 c2a94f0..4c0fe40 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -310,7 +310,7 @@ public:
     /** create and store or find an already stored connection to a data source for use
     in SwFieldMgr and SwDBTreeList */
     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>
-                    RegisterConnection(OUString& rSource);
+                    RegisterConnection(OUString const& rSource);
 
     const SwDSParam* CreateDSData(const SwDBData& rData)
                         {return FindDSData(rData, true);}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 0c763ab..f65903d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2293,7 +2293,7 @@ bool SwDBManager::OpenDataSource(const OUString& rDataSource, const OUString& rT
     return pFound->xResultSet.is();
 }
 
-uno::Reference< sdbc::XConnection> SwDBManager::RegisterConnection(OUString& rDataSource)
+uno::Reference< sdbc::XConnection> SwDBManager::RegisterConnection(OUString const& rDataSource)
 {
     SwDSParam* pFound = SwDBManager::FindDSConnection(rDataSource, true);
     uno::Reference< sdbc::XDataSource> xSource;
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index 65b098c..4ddad2a 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -50,7 +50,6 @@
 
 #include <unomid.h>
 
-#include <boost/ptr_container/ptr_vector.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -68,12 +67,9 @@ struct SwConnectionData
     Reference<XConnection>  xConnection;
 };
 
-typedef boost::ptr_vector<SwConnectionData> SwConnectionArr;
-
 class SwDBTreeList_Impl : public cppu::WeakImplHelper < XContainerListener >
 {
     Reference< XDatabaseContext > m_xDatabaseContext;
-    SwConnectionArr m_aConnections;
     SwWrtShell* m_pWrtShell;
 
     public:
@@ -119,14 +115,6 @@ void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent ) throw (Ru
     SolarMutexGuard aGuard;
     OUString sSource;
     rEvent.Accessor >>= sSource;
-    for(SwConnectionArr::iterator i = m_aConnections.begin(); i != m_aConnections.end(); ++i)
-    {
-        if(i->sSourceName == sSource)
-        {
-            m_aConnections.erase(i);
-            break;
-        }
-    }
 }
 
 void SwDBTreeList_Impl::disposing( const EventObject&  ) throw (RuntimeException, std::exception)
@@ -153,20 +141,9 @@ bool SwDBTreeList_Impl::HasContext()
 Reference<XConnection>  SwDBTreeList_Impl::GetConnection(const OUString& rSourceName)
 {
     Reference<XConnection> xRet;
-    for(SwConnectionArr::const_iterator i = m_aConnections.begin(); i != m_aConnections.end(); ++i)
-    {
-        if(i->sSourceName == rSourceName)
-        {
-            xRet = i->xConnection;
-            break;
-        }
-    }
-    if(!xRet.is() && m_xDatabaseContext.is() && m_pWrtShell)
+    if (m_xDatabaseContext.is() && m_pWrtShell)
     {
-        SwConnectionData* pPtr = new SwConnectionData();
-        pPtr->sSourceName = rSourceName;
-        xRet = m_pWrtShell->GetDBManager()->RegisterConnection(pPtr->sSourceName);
-        m_aConnections.push_back(pPtr);
+        xRet = m_pWrtShell->GetDBManager()->RegisterConnection(rSourceName);
     }
     return xRet;
 }


More information about the Libreoffice-commits mailing list