[Libreoffice-commits] .: 3 commits - cui/source

Joseph Powers jpowers at kemper.freedesktop.org
Sun May 8 06:38:56 PDT 2011


 cui/source/inc/cuitabline.hxx    |    4 +-
 cui/source/inc/numpages.hxx      |    6 ++-
 cui/source/tabpages/numpages.cxx |   68 +++++++++++++++++----------------------
 cui/source/tabpages/tpline.cxx   |   30 ++++++-----------
 4 files changed, 50 insertions(+), 58 deletions(-)

New commits:
commit 4e3d8d25cbf4b3de3af987c838cd468c01cac850
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri May 6 23:11:46 2011 -0430

    Remove deprecated List in SvxLineTabPage for std::vector<String>.

diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index a611adc..2d26b64 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -29,6 +29,8 @@
 #define _CUI_TAB_LINE_HXX
 
 // include ---------------------------------------------------------------
+#include <vector>
+
 #include <svx/tabline.hxx>
 /*************************************************************************
 |*
@@ -146,7 +148,7 @@ private:
     FixedText			aSymbolHeightFT;
     MetricField			aSymbolHeightMF;
     CheckBox			aSymbolRatioCB;
-    List				aGrfNames;
+    std::vector<String> aGrfNames;
     List				aGrfBrushItems;
     String				sNumCharFmtName;
     sal_Bool				bLastWidthModified;
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 1d8da92..9a8becc 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -266,12 +266,6 @@ SvxLineTabPage::~SvxLineTabPage()
     if(pSymbolList)
         delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
 
-    String* pStr = (String*)aGrfNames.First();
-    while( pStr )
-    {
-        delete pStr;
-        pStr = (String*)aGrfNames.Next();
-    }
     SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
     while( pInfo )
     {
@@ -1474,19 +1468,18 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
 
         PopupMenu* pPopup = new PopupMenu;
         String aEmptyStr;
-
-        nNumMenuGalleryItems=aGrfNames.Count();
-        for(long i = 0; i < nNumMenuGalleryItems; i++)
+        const String *pUIName = NULL;
+        sal_uInt32 i = 0;
+        for(std::vector<String>::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i)
         {
-            const String* pGrfName = (const String*)aGrfNames.GetObject(i);
-            const String* pUIName = pGrfName;
+            pUIName = &(*it);
 
             // convert URL encodings to UI characters (eg %20 for spaces)
             String aPhysicalName;
-            if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
+            if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *it, aPhysicalName ))
                 pUIName = &aPhysicalName;
 
-            SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
+            SvxBrushItem* pBrushItem = new SvxBrushItem(*it, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
             pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
 
             SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
@@ -1519,7 +1512,8 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
             }
         }
         aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
-        if(!aGrfNames.Count())
+
+        if(aGrfNames.empty())
             aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False);
     }
 
@@ -1546,8 +1540,7 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
             if(pObj==NULL)
                 break;
             pObj=pObj->Clone();
-            String *pStr=new String();
-            aGrfNames.Insert(pStr,LIST_APPEND);
+            aGrfNames.push_back(aEmptyStr);
             pPage->NbcInsertObject(pObj);
             pView->MarkObj(pObj,pPageView);
             if(pSymbolAttr)
@@ -1583,10 +1576,11 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
                 aBitmap.Scale(nScale, nScale);
             }
             Image aImage(aBitmap);
-            pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
+            pPopup->InsertItem(pInfo->nItemId,aEmptyStr,aImage);
         }
         aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
-        if(!aGrfNames.Count())
+
+        if(aGrfNames.empty())
             aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False);
 
         delete pView;
commit f507f73c02b2e4628f33a5ec6dc776df53632973
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri May 6 22:59:11 2011 -0430

    Remove deprecated List in SvxNumOptionsTabPage for std::vector<String>.

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index d1b41c2..ed77d96 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -301,7 +301,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
     sal_Bool 				bHTMLMode 			: 1;
     sal_Bool				bMenuButtonInitialized : 1;
 
-    List				aGrfNames;
+    std::vector<String> aGrfNames;
     Font            	aActBulletFont;
     String				sBullet;
     String				sStartWith;
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 66d8f0e..5b69c4d 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1193,12 +1193,6 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent,
 SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
 {
     delete aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
-    String* pStr = (String*)aGrfNames.First();
-    while( pStr )
-    {
-        delete pStr;
-        pStr = (String*)aGrfNames.Next();
-    }
     delete pActNum;
     delete pPreviewWIN;
     delete pSaveNum;
@@ -1959,12 +1953,16 @@ IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
 
     if(MN_GALLERY_ENTRY <= nItemId )
     {
-        aGrfName = *((String*)aGrfNames.GetObject( nItemId - MN_GALLERY_ENTRY));
-        Graphic aGraphic;
-        if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - MN_GALLERY_ENTRY, &aGraphic))
+        sal_uInt16 idx = nItemId - MN_GALLERY_ENTRY;
+        if (idx < aGrfNames.size())
         {
-            aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
-            bSucc = sal_True;
+            aGrfName = aGrfNames[idx];
+            Graphic aGraphic;
+            if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, idx, &aGraphic))
+            {
+                aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
+                bSucc = sal_True;
+            }
         }
     }
     else
@@ -2031,20 +2029,22 @@ IMPL_LINK( SvxNumOptionsTabPage, PopupActivateHdl_Impl, Menu *, EMPTYARG )
         bMenuButtonInitialized = sal_True;
         EnterWait();
         PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
-        GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
-        if(aGrfNames.Count())
+
+        if(GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
         {
             pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC ));
-            String aEmptyStr;
             GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
 
-            for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++)
+            Graphic aGraphic;
+            String sGrfName;
+            std::vector<String>::const_iterator it = aGrfNames.begin();
+            for(sal_uInt16 i = 0; it != aGrfNames.end(); ++it, ++i)
             {
-                Graphic aGraphic;
-                String sGrfName = *(const String*)aGrfNames.GetObject(i);
+                sGrfName = *it;
                 INetURLObject aObj(sGrfName);
                 if(aObj.GetProtocol() == INET_PROT_FILE)
                     sGrfName = aObj.PathToFileName();
+
                 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
                 {
                     Bitmap aBitmap(aGraphic.GetBitmap());
commit 3282dbf2e34231eec6d7bed0bbbd232dff19ccd3
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri May 6 22:45:19 2011 -0430

    Remove deprecated List in SvxBitmapPickTabPage for std::vector<String>.

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index a374a3f..d1b41c2 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -30,6 +30,8 @@
 
 // include ---------------------------------------------------------------
 
+#include <vector>
+
 #include <sfx2/tabdlg.hxx>
 #include <vcl/group.hxx>
 #include <vcl/fixed.hxx>
@@ -206,7 +208,7 @@ class SvxBitmapPickTabPage : public SfxTabPage
     FixedText			aErrorText;
     CheckBox			aLinkedCB;
 
-    List				aGrfNames;
+    std::vector<String> aGrfNames;
     String				sNumCharFmtName;
 
     SvxNumRule* 		pActNum;
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index f4a87d8..66d8f0e 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -846,16 +846,20 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
     // Grafiknamen ermitteln
     GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
     pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP    );
-    for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++)
+
+    sal_uInt16 i = 0;
+    for(std::vector<String>::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i)
     {
         pExamplesVS->InsertItem( i + 1, i);
-        String* pGrfNm = (String*) aGrfNames.GetObject(i);
-        INetURLObject aObj(*pGrfNm);
+
+        INetURLObject aObj(*it);
         if(aObj.GetProtocol() == INET_PROT_FILE)
-            *pGrfNm = aObj.PathToFileName();
-        pExamplesVS->SetItemText( i + 1, *pGrfNm );
+            *it = aObj.PathToFileName();
+
+        pExamplesVS->SetItemText( i + 1, *it );
     }
-    if(!aGrfNames.Count())
+
+    if(aGrfNames.empty())
     {
         aErrorText.Show();
     }
@@ -870,12 +874,6 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
 
 SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
 {
-    String* pStr = (String*)aGrfNames.First();
-    while( pStr )
-    {
-        delete pStr;
-        pStr = (String*)aGrfNames.Next();
-    }
     delete pExamplesVS;
     delete pActNum;
     delete pSaveNum;
@@ -911,7 +909,7 @@ void  SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
         pExamplesVS->SetNoSelection();
     }
     // ersten Eintrag vorselektieren
-    if(aGrfNames.Count() &&
+    if(!aGrfNames.empty() &&
         (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)))
     {
         pExamplesVS->SelectItem(1);
@@ -931,7 +929,7 @@ int  SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet)
 
 sal_Bool  SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet )
 {
-    if ( !aGrfNames.Count() )
+    if ( aGrfNames.empty() )
     {
         return sal_False;
     }
@@ -990,10 +988,6 @@ IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
         bModified = sal_True;
         sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1;
 
-        String* pGrfName = 0;
-        if(aGrfNames.Count() > nIdx)
-            pGrfName = (String*)aGrfNames.GetObject(nIdx);
-
         sal_uInt16 nMask = 1;
         String aEmptyStr;
         sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP;
@@ -1018,8 +1012,8 @@ IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
                     SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
                     aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
                 }
-                else if(pGrfName)
-                    aFmt.SetGraphic( *pGrfName );
+                else if(aGrfNames.size() > nIdx)
+                    aFmt.SetGraphic( aGrfNames[nIdx] );
                 pActNum->SetLevel(i, aFmt);
             }
             nMask <<= 1 ;


More information about the Libreoffice-commits mailing list