[Libreoffice-commits] .: sw/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue Mar 1 08:40:06 PST 2011


 sw/source/ui/docvw/romenu.cxx |   41 ++++++++++++++++-------------------------
 sw/source/ui/docvw/romenu.hxx |    5 ++++-
 2 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit b78da5977b262b858d51a6a2ef99bf249b863913
Author: npcdoom <venccsralph at gmail.com>
Date:   Sat Feb 26 15:56:18 2011 -0430

    Remove deprecated List for std::vector<String>.
    
    Signed-off-by: Luboš Luňák <l.lunak at suse.cz>

diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx
index e24963e..454d24a 100644
--- a/sw/source/ui/docvw/romenu.cxx
+++ b/sw/source/ui/docvw/romenu.cxx
@@ -96,18 +96,10 @@ void GetPreferedExtension( String &rExt, const Graphic &rGrf )
 
 SwReadOnlyPopup::~SwReadOnlyPopup()
 {
-    String *pDel = (String*)aThemeList.First();
-    while ( pDel )
-    {
-        delete pDel;
-        pDel = (String*)aThemeList.Next();
-    }
     delete pImageMap;
     delete pTargetURL;
 }
 
-
-
 void SwReadOnlyPopup::Check( USHORT nMID, USHORT nSID, SfxDispatcher &rDis )
 {
     SfxPoolItem *_pItem = 0;
@@ -180,22 +172,22 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
         }
     }
 
-    BOOL bEnableGraphicToGallery;
-    if ( TRUE == (bEnableGraphicToGallery = bLink) )
+    bool bEnableGraphicToGallery = bLink;
+    if ( bEnableGraphicToGallery )
     {
-        GalleryExplorer::FillThemeList( aThemeList );
-        if ( aThemeList.Count() )
+        if (GalleryExplorer::FillThemeList( aThemeList ))
         {
             PopupMenu *pMenu = GetPopupMenu(MN_READONLY_GRAPHICTOGALLERY);
             pMenu->CheckItem( MN_READONLY_TOGALLERYLINK,  bGrfToGalleryAsLnk );
             pMenu->CheckItem( MN_READONLY_TOGALLERYCOPY, !bGrfToGalleryAsLnk );
-            for ( USHORT i=0; i < aThemeList.Count(); ++i )
-                pMenu->InsertItem( MN_READONLY_GRAPHICTOGALLERY+i + 3,
-                                   *(String*)aThemeList.GetObject( i ) );
+
+            for (string_const_iterator_t it = aThemeList.begin(); it != aThemeList.end(); ++it)
+                pMenu->InsertItem( MN_READONLY_GRAPHICTOGALLERY+i + 3,*it);
         }
         else
-            bEnableGraphicToGallery = FALSE;
+            bEnableGraphicToGallery = false;
     }
+
     EnableItem( MN_READONLY_GRAPHICTOGALLERY, bEnableGraphicToGallery );
 
     SfxViewFrame * pVFrame = rV.GetViewFrame();
@@ -210,17 +202,18 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
         bEnableBack = TRUE;
         if ( pItem->GetGraphicLink() )
         {
-            if ( !aThemeList.Count() )
+            if ( aThemeList.empty() )
                 GalleryExplorer::FillThemeList( aThemeList );
-            if ( aThemeList.Count() )
+
+            if ( !aThemeList.empty() )
             {
                 PopupMenu *pMenu = GetPopupMenu(MN_READONLY_BACKGROUNDTOGALLERY);
                 pMenu->CheckItem( MN_READONLY_TOGALLERYLINK,  bGrfToGalleryAsLnk );
                 pMenu->CheckItem( MN_READONLY_TOGALLERYCOPY, !bGrfToGalleryAsLnk );
                 bEnableBackGallery = TRUE;
-                for ( USHORT i=0; i < aThemeList.Count(); ++i )
-                    pMenu->InsertItem( MN_READONLY_BACKGROUNDTOGALLERY+i + 3,
-                                       *(String*)aThemeList.GetObject( i ) );
+
+                for (string_const_iterator_t it = aThemeList.begin(); it != aThemeList.end(); ++it)
+                    pMenu->InsertItem( MN_READONLY_GRAPHICTOGALLERY+i + 3,*it);
             }
         }
     }
@@ -310,10 +303,8 @@ void SwReadOnlyPopup::Execute( Window* pWin, USHORT nId )
             sTmp = SaveGraphic( nSaveId );
 
         if ( sTmp.Len() )
-        {
-            String sThemeName( *(String*)aThemeList.GetObject( nId ));
-            GalleryExplorer::InsertURL( sThemeName, sTmp );
-        }
+            GalleryExplorer::InsertURL( aThemeList[nId], sTmp );
+
         return;
     }
 
diff --git a/sw/source/ui/docvw/romenu.hxx b/sw/source/ui/docvw/romenu.hxx
index 9ee7b77..860772e 100644
--- a/sw/source/ui/docvw/romenu.hxx
+++ b/sw/source/ui/docvw/romenu.hxx
@@ -41,6 +41,9 @@ class INetImage;
 
 class SwReadOnlyPopup : public PopupMenu
 {
+    typedef std::vector<String>::iterator theme_iterator_t;
+    typedef std::vector<String>::const_iterator theme_const_iterator_t;
+
           SwView &rView;
     const SvxBrushItem *pItem;
     const Point &rDocPos;
@@ -49,7 +52,7 @@ class SwReadOnlyPopup : public PopupMenu
                 sTargetFrameName,
                 sDescription,
                 sGrfName;
-    List		aThemeList;
+    std::vector<String> aThemeList;
     BOOL 		bGrfToGalleryAsLnk;
     ImageMap*	pImageMap;
     INetImage*	pTargetURL;


More information about the Libreoffice-commits mailing list