Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Attatched the respective patch file

On Wed, Jun 15, 2011 at 7:39 PM, Rafael Dominguez <venccsralph@gmail.com>wrote:

Theres a assertion i didnt include in the patch, but now been thinking
about it and maybe we should include it just in case we forget to include an
action.

From 8cafc607d507502692b3781ae6a6ba53b3b925b8 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sun, 12 Jun 2011 19:27:05 -0430
Subject: [PATCH 4/9] Replace List with std::vector<com::sun::star::presentation::ClickAction>.

---
 sd/source/ui/dlg/tpaction.cxx |   42 ++++++++++++++++++++--------------------
 sd/source/ui/inc/tpaction.hxx |    2 +-
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index ecfc89c..b4e9341 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -170,7 +170,6 @@ SdTPAction::SdTPAction( Window* pWindow, const SfxItemSet& rInAttrs ) :
 
 SdTPAction::~SdTPAction()
 {
-    delete pCurrentActions;
 }
 
 // -----------------------------------------------------------------------
@@ -267,25 +266,24 @@ void SdTPAction::Construct()
         }
     }
 
-    pCurrentActions = new List;
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NONE, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PREVPAGE, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NEXTPAGE, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_FIRSTPAGE, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_LASTPAGE, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_BOOKMARK, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_DOCUMENT, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_SOUND, LIST_APPEND);
+    maCurrentActions.push_back( presentation::ClickAction_NONE );
+    maCurrentActions.push_back( presentation::ClickAction_PREVPAGE );
+    maCurrentActions.push_back( presentation::ClickAction_NEXTPAGE );
+    maCurrentActions.push_back( presentation::ClickAction_FIRSTPAGE );
+    maCurrentActions.push_back( presentation::ClickAction_LASTPAGE );
+    maCurrentActions.push_back( presentation::ClickAction_BOOKMARK );
+    maCurrentActions.push_back( presentation::ClickAction_DOCUMENT );
+    maCurrentActions.push_back( presentation::ClickAction_SOUND );
     if( bOLEAction && aLbOLEAction.GetEntryCount() )
-        pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_VERB, LIST_APPEND );
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PROGRAM, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_MACRO, LIST_APPEND);
-    pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_STOPPRESENTATION, 
LIST_APPEND);
+        maCurrentActions.push_back( presentation::ClickAction_VERB );
+    maCurrentActions.push_back( presentation::ClickAction_PROGRAM );
+    maCurrentActions.push_back( presentation::ClickAction_MACRO );
+    maCurrentActions.push_back( presentation::ClickAction_STOPPRESENTATION );
 
     // Action-Listbox fuellen
-    for (sal_uLong nAction = 0; nAction < pCurrentActions->Count(); nAction++)
+    for (size_t nAction = 0, n = maCurrentActions.size(); nAction < n; nAction++)
     {
-        sal_uInt16 nRId = 
GetClickActionSdResId((presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject(nAction));
+        sal_uInt16 nRId = GetClickActionSdResId( maCurrentActions[ nAction ] );
         aLbAction.InsertEntry( String( SdResId( nRId ) ) );
     }
 
@@ -753,8 +751,8 @@ presentation::ClickAction SdTPAction::GetActualClickAction()
     presentation::ClickAction eCA = presentation::ClickAction_NONE;
     sal_uInt16 nPos = aLbAction.GetSelectEntryPos();
 
-    if (nPos != LISTBOX_ENTRY_NOTFOUND)
-        eCA = (presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject((sal_uLong)nPos);
+    if (nPos != LISTBOX_ENTRY_NOTFOUND && nPos < maCurrentActions.size())
+        eCA = maCurrentActions[ nPos ];
     return( eCA );
 }
 
@@ -762,9 +760,11 @@ presentation::ClickAction SdTPAction::GetActualClickAction()
 
 void SdTPAction::SetActualClickAction( presentation::ClickAction eCA )
 {
-    sal_uInt16 nPos = (sal_uInt16)pCurrentActions->GetPos((void*)(sal_uLong)eCA);
-    DBG_ASSERT(nPos != 0xffff, "unbekannte Interaktion");
-    aLbAction.SelectEntryPos(nPos);
+    std::vector<com::sun::star::presentation::ClickAction>::const_iterator pIter =
+            std::find(maCurrentActions.begin(),maCurrentActions.end(),eCA);
+
+    if ( pIter != maCurrentActions.end() )
+        aLbAction.SelectEntryPos( pIter-maCurrentActions.begin() );
 }
 
 //------------------------------------------------------------------------
diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx
index 116d815..c18fc8b 100644
--- a/sd/source/ui/inc/tpaction.hxx
+++ b/sd/source/ui/inc/tpaction.hxx
@@ -97,7 +97,7 @@ private:
     XColorTable*                   pColTab;
                             
     sal_Bool                               bTreeUpdated;
-    List*                          pCurrentActions;
+    std::vector<com::sun::star::presentation::ClickAction> maCurrentActions;
     String                                 aLastFile;
     ::std::vector< long >   aVerbVector;
 
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.