[Libreoffice-commits] core.git: 4 commits - comphelper/source desktop/source include/comphelper include/svtools ucb/source

Noel Grandin noel at peralex.com
Fri Jan 29 00:54:57 PST 2016


 comphelper/source/eventattachermgr/eventattachermgr.cxx |   24 ++++++----------
 comphelper/source/misc/documentiologring.cxx            |    8 ++---
 comphelper/source/misc/documentiologring.hxx            |    3 +-
 comphelper/source/misc/interaction.cxx                  |    8 ++---
 desktop/source/deployment/misc/dp_interact.cxx          |    8 ++---
 include/comphelper/interaction.hxx                      |    9 +++---
 include/svtools/genericunodialog.hxx                    |    2 -
 ucb/source/ucp/file/filinsreq.cxx                       |    2 -
 ucb/source/ucp/ftp/ftpintreq.cxx                        |    2 -
 9 files changed, 29 insertions(+), 37 deletions(-)

New commits:
commit b9daeb01a26d21f1801d2b4c861eb3d59c886949
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jan 28 15:45:16 2016 +0200

    spelling
    
    Change-Id: Ide111b7b8826d966e29df6a802b434ef1c12b56e

diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx
index 3ba669f..15ebdec 100644
--- a/include/svtools/genericunodialog.hxx
+++ b/include/svtools/genericunodialog.hxx
@@ -121,7 +121,7 @@ namespace svt
         virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw(css::uno::Exception, css::uno::RuntimeException, std::exception) override;
 
     protected:
-        /** create the concret dialog instance. note that m_aMutex is not locked when this method get's called,
+        /** create the concrete dialog instance. note that m_aMutex is not locked when this method get's called,
             but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog).
             @param      pParent     the parent window for the new dialog
         */
commit e76b00978187486876cdc2adde14ef5043b2a9b0
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jan 28 15:44:38 2016 +0200

    sequence->vector in OInteractionRequest
    
    Change-Id: I995cb96e514e1aaa05a96f29344ef51e4ca83c64

diff --git a/comphelper/source/misc/interaction.cxx b/comphelper/source/misc/interaction.cxx
index d16aed7..745320e 100644
--- a/comphelper/source/misc/interaction.cxx
+++ b/comphelper/source/misc/interaction.cxx
@@ -45,7 +45,7 @@ namespace comphelper
     }
 
     OInteractionRequest::OInteractionRequest(const Any& rRequestDescription,
-            Sequence<Reference<XInteractionContinuation>> const& rContinuations)
+            std::vector<Reference<XInteractionContinuation>> const& rContinuations)
         : m_aRequest(rRequestDescription)
         , m_aContinuations(rContinuations)
     {
@@ -56,9 +56,7 @@ namespace comphelper
         OSL_ENSURE(_rxContinuation.is(), "OInteractionRequest::addContinuation: invalid argument!");
         if (_rxContinuation.is())
         {
-            sal_Int32 nOldLen = m_aContinuations.getLength();
-            m_aContinuations.realloc(nOldLen + 1);
-            m_aContinuations[nOldLen] = _rxContinuation;
+            m_aContinuations.push_back(_rxContinuation);
         }
     }
 
@@ -71,7 +69,7 @@ namespace comphelper
 
     Sequence< Reference< XInteractionContinuation > > SAL_CALL OInteractionRequest::getContinuations(  ) throw(RuntimeException, std::exception)
     {
-        return m_aContinuations;
+        return comphelper::containerToSequence(m_aContinuations);
     }
 
 
diff --git a/desktop/source/deployment/misc/dp_interact.cxx b/desktop/source/deployment/misc/dp_interact.cxx
index 254aded..f6c35e8 100644
--- a/desktop/source/deployment/misc/dp_interact.cxx
+++ b/desktop/source/deployment/misc/dp_interact.cxx
@@ -108,11 +108,9 @@ bool interactContinuation( Any const & request,
         if (xInteractionHandler.is()) {
             bool cont = false;
             bool abort = false;
-            Sequence< Reference<task::XInteractionContinuation> > conts( 2 );
-            conts[ 0 ] = new InteractionContinuationImpl(
-                continuation, &cont );
-            conts[ 1 ] = new InteractionContinuationImpl(
-                cppu::UnoType<task::XInteractionAbort>::get(), &abort );
+            std::vector< Reference<task::XInteractionContinuation> > conts {
+                new InteractionContinuationImpl(continuation, &cont ),
+                new InteractionContinuationImpl( cppu::UnoType<task::XInteractionAbort>::get(), &abort ) };
             xInteractionHandler->handle(
                 new ::comphelper::OInteractionRequest( request, conts ) );
             if (cont || abort) {
diff --git a/include/comphelper/interaction.hxx b/include/comphelper/interaction.hxx
index f0d9683..3ec18f8 100644
--- a/include/comphelper/interaction.hxx
+++ b/include/comphelper/interaction.hxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/task/XInteractionPassword.hpp>
 #include <com/sun/star/task/XInteractionRequest.hpp>
 #include <comphelper/comphelperdllapi.h>
+#include <vector>
 
 
 namespace comphelper
@@ -38,8 +39,8 @@ namespace comphelper
 
     //= OInteraction
 
-    /** template for instantiating concret interaction handlers<p/>
-        the template argument must eb an interface derived from XInteractionContinuation
+    /** template for instantiating concrete interaction handlers<p/>
+        the template argument must be an interface derived from XInteractionContinuation
     */
     template <class INTERACTION>
     class OInteraction
@@ -119,13 +120,13 @@ namespace comphelper
     {
         css::uno::Any
                     m_aRequest;         /// the request we represent
-        css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >
+        std::vector< css::uno::Reference< css::task::XInteractionContinuation > >
                     m_aContinuations;   /// all registered continuations
 
     public:
         OInteractionRequest(const css::uno::Any& _rRequestDescription);
         OInteractionRequest(const css::uno::Any& rRequestDescription,
-            css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> const& rContinuations);
+            std::vector<css::uno::Reference<css::task::XInteractionContinuation>> const& rContinuations);
 
         /// add a new continuation
         void addContinuation(const css::uno::Reference< css::task::XInteractionContinuation >& _rxContinuation);
diff --git a/ucb/source/ucp/file/filinsreq.cxx b/ucb/source/ucp/file/filinsreq.cxx
index e6466b9..664c45c 100644
--- a/ucb/source/ucp/file/filinsreq.cxx
+++ b/ucb/source/ucp/file/filinsreq.cxx
@@ -53,7 +53,7 @@ XInteractionRequestImpl::XInteractionRequestImpl(
 {
     if( pShell )
         pShell->retrieveError(CommandId,m_nErrorCode,m_nMinorError);
-    uno::Sequence<uno::Reference<task::XInteractionContinuation>> continuations{
+    std::vector<uno::Reference<task::XInteractionContinuation>> continuations{
         Reference<XInteractionContinuation>(p1),
         Reference<XInteractionContinuation>(p2) };
     Any aAny;
diff --git a/ucb/source/ucp/ftp/ftpintreq.cxx b/ucb/source/ucp/ftp/ftpintreq.cxx
index 4cb1c9be..9698080 100644
--- a/ucb/source/ucp/ftp/ftpintreq.cxx
+++ b/ucb/source/ucp/ftp/ftpintreq.cxx
@@ -69,7 +69,7 @@ XInteractionRequestImpl::XInteractionRequestImpl()
     : p1( new XInteractionApproveImpl )
     , p2( new XInteractionDisapproveImpl )
 {
-    uno::Sequence<uno::Reference<task::XInteractionContinuation>> continuations{
+    std::vector<uno::Reference<task::XInteractionContinuation>> continuations{
         Reference<XInteractionContinuation>(p1),
         Reference<XInteractionContinuation>(p2) };
     Any aAny;
commit 31f12941635f52d34497b9af1361c0e81906762d
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jan 28 15:15:19 2016 +0200

    sequence->vector in OSimpleLogRing
    
    Change-Id: Ief35ce33a11c93a4a78e50ccdd936ec7e17102a2

diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx
index a9457a8..aaea0ca 100644
--- a/comphelper/source/misc/documentiologring.cxx
+++ b/comphelper/source/misc/documentiologring.cxx
@@ -78,7 +78,7 @@ void SAL_CALL OSimpleLogRing::logString( const OUString& aMessage ) throw (uno::
     ::osl::MutexGuard aGuard( m_aMutex );
 
     m_aMessages[m_nPos] = aMessage;
-    if ( ++m_nPos >= m_aMessages.getLength() )
+    if ( ++m_nPos >= (sal_Int32)m_aMessages.size() )
     {
         m_nPos = 0;
         m_bFull = true;
@@ -93,12 +93,12 @@ uno::Sequence< OUString > SAL_CALL OSimpleLogRing::getCollectedLog() throw (uno:
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nResLen = m_bFull ? m_aMessages.getLength() : m_nPos;
+    sal_Int32 nResLen = m_bFull ? m_aMessages.size() : m_nPos;
     sal_Int32 nStart = m_bFull ? m_nPos : 0;
     uno::Sequence< OUString > aResult( nResLen );
 
     for ( sal_Int32 nInd = 0; nInd < nResLen; nInd++ )
-        aResult[nInd] = m_aMessages[ ( nStart + nInd ) % m_aMessages.getLength() ];
+        aResult[nInd] = m_aMessages[ ( nStart + nInd ) % m_aMessages.size() ];
 
     // if used once then default initialized
     m_bInitialized = true;
@@ -121,7 +121,7 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu
     {
         sal_Int32 nLen = 0;
         if ( aArguments.getLength() == 1 && ( aArguments[0] >>= nLen ) && nLen )
-            m_aMessages.realloc( nLen );
+            m_aMessages.resize( nLen );
         else
             throw lang::IllegalArgumentException(
                 "Nonnull size is expected as the first argument!",
diff --git a/comphelper/source/misc/documentiologring.hxx b/comphelper/source/misc/documentiologring.hxx
index ffd124e..e6974d9 100644
--- a/comphelper/source/misc/documentiologring.hxx
+++ b/comphelper/source/misc/documentiologring.hxx
@@ -26,6 +26,7 @@
 
 #include <osl/mutex.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <vector>
 
 #define SIMPLELOGRING_SIZE 256
 
@@ -37,7 +38,7 @@ class OSimpleLogRing : public ::cppu::WeakImplHelper< css::logging::XSimpleLogRi
                                                       css::lang::XServiceInfo >
 {
     ::osl::Mutex m_aMutex;
-    css::uno::Sequence< OUString > m_aMessages;
+    std::vector< OUString > m_aMessages;
 
     bool      m_bInitialized;
     bool      m_bFull;
commit ba03604b55e757d31aef3c676e177a7b7101cf20
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jan 28 14:56:59 2016 +0200

    sequence->vector in AttachedObject_Impl
    
    Change-Id: I457de7e83554fbea0a9c5a50c628664fa3887df4

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 2f2fb5d..1be6f43 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -64,7 +64,7 @@ namespace comphelper
 struct AttachedObject_Impl
 {
     Reference< XInterface >                 xTarget;
-    Sequence< Reference< XEventListener > > aAttachedListenerSeq;
+    std::vector< Reference< XEventListener > > aAttachedListenerSeq;
     Any                                     aHelper;
 };
 
@@ -439,17 +439,13 @@ void SAL_CALL ImplEventAttacherManager::registerScriptEvent
     // register new new Event
     for( auto& rObj : aIt->aObjList )
     {
-        // resize
-        sal_Int32 nPos = rObj.aAttachedListenerSeq.getLength();
-        rObj.aAttachedListenerSeq.realloc( nPos + 1 );
-        Reference< XEventListener >* pArray = rObj.aAttachedListenerSeq.getArray();
         Reference< XAllListener > xAll =
             new AttacherAllListener_Impl( this, ScriptEvent.ScriptType, ScriptEvent.ScriptCode );
         try
         {
-        pArray[nPos] = xAttacher->attachSingleEventListener( rObj.xTarget, xAll,
+            rObj.aAttachedListenerSeq.push_back( xAttacher->attachSingleEventListener( rObj.xTarget, xAll,
                         rObj.aHelper, ScriptEvent.ListenerType,
-                        ScriptEvent.AddListenerParam, ScriptEvent.EventMethod );
+                        ScriptEvent.AddListenerParam, ScriptEvent.EventMethod ) );
         }
         catch( Exception& )
         {
@@ -604,7 +600,7 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference
     aCurrentPosition->aObjList.push_back( aTmp );
 
     AttachedObject_Impl & rCurObj = aCurrentPosition->aObjList.back();
-    rCurObj.aAttachedListenerSeq = Sequence< Reference< XEventListener > >( aCurrentPosition->aEventList.size() );
+    rCurObj.aAttachedListenerSeq = std::vector< Reference< XEventListener > >( aCurrentPosition->aEventList.size() );
 
     if (aCurrentPosition->aEventList.empty())
         return;
@@ -628,8 +624,8 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference
 
     try
     {
-        rCurObj.aAttachedListenerSeq =
-            xAttacher->attachMultipleEventListeners(rCurObj.xTarget, aEvents);
+        rCurObj.aAttachedListenerSeq = comphelper::sequenceToContainer<std::vector<Reference< XEventListener >>>(
+            xAttacher->attachMultipleEventListeners(rCurObj.xTarget, aEvents));
     }
     catch (const Exception&)
     {
@@ -654,17 +650,15 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference
     {
         if( aObjIt->xTarget == xObject )
         {
-            Reference< XEventListener > * pArray = aObjIt->aAttachedListenerSeq.getArray();
-
             sal_Int32 i = 0;
             for( const auto& rEvt : aCurrentPosition->aEventList )
             {
-                if( pArray[i].is() )
+                if( aObjIt->aAttachedListenerSeq[i].is() )
                 {
                     try
                     {
-                    xAttacher->removeListener( aObjIt->xTarget, rEvt.ListenerType,
-                                               rEvt.AddListenerParam, pArray[i] );
+                        xAttacher->removeListener( aObjIt->xTarget, rEvt.ListenerType,
+                                               rEvt.AddListenerParam, aObjIt->aAttachedListenerSeq[i] );
                     }
                     catch( Exception& )
                     {


More information about the Libreoffice-commits mailing list