[Libreoffice-commits] .: sfx2/inc sfx2/source

Joseph Powers jpowers at kemper.freedesktop.org
Sun Jan 2 15:16:21 PST 2011


 sfx2/inc/sfx2/viewsh.hxx    |   15 ++++++------
 sfx2/source/view/viewsh.cxx |   54 +++++++++++++++++++++++++++++---------------
 2 files changed, 44 insertions(+), 25 deletions(-)

New commits:
commit 7334575929d8c54fda140a3216c2d368aaf9632c
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sun Jan 2 15:16:17 2011 -0800

    Remove DECLARE_LIST( SfxInPlaceClientList, SfxInPlaceClient* )

diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx
index 1288661..441f136 100644
--- a/sfx2/inc/sfx2/viewsh.hxx
+++ b/sfx2/inc/sfx2/viewsh.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -43,6 +43,8 @@
 #include <tools/gen.hxx>
 #include <tools/errcode.hxx>
 #include <vcl/jobset.hxx>
+#include <vector>
+
 class SfxBaseController;
 class Size;
 class Fraction;
@@ -142,7 +144,7 @@ public: \
             Factory().RegisterViewFactory( ViewShellClass::Factory() )
 
 class SfxInPlaceClient;
-DECLARE_LIST( SfxInPlaceClientList, SfxInPlaceClient* )
+typedef ::std::vector< SfxInPlaceClient* > SfxInPlaceClientList;
 
 // -----------------------------------------------------------------------
 class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener
@@ -269,11 +271,11 @@ public:
     /** forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocument
     */
     void                        SetCurrentDocument() const;
-    
+
     /** get an XRenderable instance that can render this docuement
     */
     virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
-        
+
 
     virtual void				MarginChanged();
     const Size&					GetMargin() const;
@@ -302,9 +304,8 @@ public:
     SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent );
 
     SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient )
-                                { GetIPClientList_Impl(TRUE)->Insert(pIPClient); }
-    SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient )
-                                { GetIPClientList_Impl(TRUE)->Remove(pIPClient); }
+                                { GetIPClientList_Impl(TRUE)->push_back(pIPClient); }
+    SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient );
     SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( BOOL bCreate = TRUE ) const;
     SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP );
     SAL_DLLPRIVATE void DiscardClients_Impl();
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 6fa144a..c47a546 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -364,6 +364,24 @@ enum ETypeFamily
 
 //--------------------------------------------------------------------
 
+SAL_DLLPRIVATE void SfxViewShell::IPClientGone_Impl( SfxInPlaceClient *pIPClient )
+{
+    SfxInPlaceClientList* pClientList = GetIPClientList_Impl(TRUE);
+
+    for( SfxInPlaceClientList::iterator it = pClientList->begin(); it < pClientList->end(); ++it )
+    {
+        if ( *it == pIPClient )
+        {
+            pClientList->erase( it );
+            break;
+        }
+    }
+}
+
+
+
+//--------------------------------------------------------------------
+
 void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
 {
     const USHORT nId = rReq.GetSlot();
@@ -711,9 +729,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
                             SfxInPlaceClientList *pClients = pView->GetIPClientList_Impl(FALSE);
                             if ( pClients )
                             {
-                                for (USHORT n=0; n < pClients->Count(); n++)
+                                for ( size_t n = 0; n < pClients->size(); n++)
                                 {
-                                    SfxInPlaceClient* pIPClient = pClients->GetObject(n);
+                                    SfxInPlaceClient* pIPClient = pClients->at( n );
                                     if ( pIPClient )
                                         pView->CheckIPClient_Impl( pIPClient, aVisArea );
                                 }
@@ -930,9 +948,9 @@ SfxInPlaceClient* SfxViewShell::FindIPClient
 
     if( !pObjParentWin )
         pObjParentWin = GetWindow();
-    for (USHORT n=0; n < pClients->Count(); n++)
+    for ( size_t n = 0; n < pClients->size(); n++)
     {
-        SfxInPlaceClient *pIPClient = (SfxInPlaceClient*) pClients->GetObject(n);
+        SfxInPlaceClient *pIPClient = (SfxInPlaceClient*) pClients->at( n );
         if ( pIPClient->GetObject() == xObj && pIPClient->GetEditWin() == pObjParentWin )
             return pIPClient;
     }
@@ -956,9 +974,9 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const
     if ( !pClients )
         return 0;
 
-    for (USHORT n=0; n < pClients->Count(); n++)
+    for ( size_t n = 0; n < pClients->size(); n++)
     {
-        SfxInPlaceClient* pIPClient = pClients->GetObject(n);
+        SfxInPlaceClient* pIPClient = pClients->at( n );
         if ( pIPClient->IsUIActive() )
             return pIPClient;
     }
@@ -972,9 +990,9 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const
     if ( !pClients )
         return 0;
 
-    for (USHORT n=0; n < pClients->Count(); n++)
+    for ( size_t n = 0; n < pClients->size(); n++)
     {
-        SfxInPlaceClient* pIPClient = pClients->GetObject(n);
+        SfxInPlaceClient* pIPClient = pClients->at( n );
         if ( pIPClient->IsObjectUIActive() )
             return pIPClient;
     }
@@ -1763,9 +1781,9 @@ void SfxViewShell::ResetAllClients_Impl( SfxInPlaceClient *pIP )
     if ( !pClients )
         return;
 
-    for ( USHORT n=0; n < pClients->Count(); n++ )
+    for ( size_t n = 0; n < pClients->size(); n++ )
     {
-        SfxInPlaceClient* pIPClient = pClients->GetObject(n);
+        SfxInPlaceClient* pIPClient = pClients->at( n );
         if( pIPClient != pIP )
             pIPClient->ResetObject();
     }
@@ -1779,9 +1797,9 @@ void SfxViewShell::DisconnectAllClients()
     if ( !pClients )
         return;
 
-    for ( USHORT n=0; n<pClients->Count(); )
+    for ( size_t n = 0; n < pClients->size(); )
         // clients will remove themselves from the list
-        delete pClients->GetObject(n);
+        delete pClients->at( n );
 }
 
 //--------------------------------------------------------------------
@@ -1806,9 +1824,9 @@ void SfxViewShell::VisAreaChanged(const Rectangle& /*rVisArea*/)
     if ( !pClients )
         return;
 
-    for (USHORT n=0; n < pClients->Count(); n++)
+    for ( size_t n = 0; n < pClients->size(); n++)
     {
-        SfxInPlaceClient* pIPClient = pClients->GetObject(n);
+        SfxInPlaceClient* pIPClient = pClients->at( n );
         if ( pIPClient->IsObjectInPlaceActive() )
             // client is active, notify client that the VisArea might have changed
             pIPClient->VisAreaChanged();
@@ -1875,8 +1893,8 @@ void SfxViewShell::DiscardClients_Impl()
     if ( !pClients )
         return;
 
-    for (USHORT n=0; n < pClients->Count(); )
-        delete pClients->GetObject(n);
+    for ( size_t n = 0; n < pClients->size(); )
+        delete pClients->at( n );
 }
 
 //--------------------------------------------------------------------
@@ -1992,7 +2010,7 @@ void SfxViewShell::SetController( SfxBaseController* pController )
     pImp->pController = pController;
     pImp->pController->acquire();
     pImp->bControllerSet = TRUE;
-    
+
     // there should be no old listener, but if there is one, it should be disconnected
     if (  pImp->xClipboardListener.is() )
         pImp->xClipboardListener->DisconnectViewShell();


More information about the Libreoffice-commits mailing list