Kaydet (Commit) 9a7d098a authored tarafından August Sodora's avatar August Sodora

SV_DECL_PTRARR_DEL->boost::ptr_vector

üst b026e5a4
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#include <unomid.h> #include <unomid.h>
#include <boost/ptr_container/ptr_vector.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container; using namespace ::com::sun::star::container;
...@@ -73,9 +75,7 @@ struct SwConnectionData ...@@ -73,9 +75,7 @@ struct SwConnectionData
Reference<XConnection> xConnection; Reference<XConnection> xConnection;
}; };
typedef SwConnectionData* SwConnectionDataPtr; typedef boost::ptr_vector<SwConnectionData> SwConnectionArr;
SV_DECL_PTRARR_DEL( SwConnectionArr, SwConnectionDataPtr, 32 )
SV_IMPL_PTRARR( SwConnectionArr, SwConnectionDataPtr )
class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener > class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener >
{ {
...@@ -125,12 +125,11 @@ void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent ) throw (Ru ...@@ -125,12 +125,11 @@ void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent ) throw (Ru
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
::rtl::OUString sSource; ::rtl::OUString sSource;
rEvent.Accessor >>= sSource; rEvent.Accessor >>= sSource;
for(sal_uInt16 i = 0; i < aConnections.Count(); i++) for(SwConnectionArr::iterator i = aConnections.begin(); i != aConnections.end(); ++i)
{ {
SwConnectionDataPtr pPtr = aConnections[i]; if(i->sSourceName == sSource)
if(pPtr->sSourceName == sSource)
{ {
aConnections.DeleteAndDestroy(i); aConnections.erase(i);
break; break;
} }
} }
...@@ -168,21 +167,20 @@ sal_Bool SwDBTreeList_Impl::HasContext() ...@@ -168,21 +167,20 @@ sal_Bool SwDBTreeList_Impl::HasContext()
Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rSourceName) Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rSourceName)
{ {
Reference<XConnection> xRet; Reference<XConnection> xRet;
for(sal_uInt16 i = 0; i < aConnections.Count(); i++) for(SwConnectionArr::const_iterator i = aConnections.begin(); i != aConnections.end(); ++i)
{ {
SwConnectionDataPtr pPtr = aConnections[i]; if(i->sSourceName == rSourceName)
if(pPtr->sSourceName == rSourceName)
{ {
xRet = pPtr->xConnection; xRet = i->xConnection;
break; break;
} }
} }
if(!xRet.is() && xDBContext.is() && pWrtSh) if(!xRet.is() && xDBContext.is() && pWrtSh)
{ {
SwConnectionDataPtr pPtr = new SwConnectionData(); SwConnectionData* pPtr = new SwConnectionData();
pPtr->sSourceName = rSourceName; pPtr->sSourceName = rSourceName;
xRet = pWrtSh->GetNewDBMgr()->RegisterConnection(pPtr->sSourceName); xRet = pWrtSh->GetNewDBMgr()->RegisterConnection(pPtr->sSourceName);
aConnections.Insert(pPtr, aConnections.Count()); aConnections.push_back(pPtr);
} }
return xRet; return xRet;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment