[Libreoffice-commits] .: cui/source

Joseph Powers jpowers at kemper.freedesktop.org
Fri Jun 10 08:40:35 PDT 2011


 cui/source/inc/cuitabline.hxx  |    7 +++++--
 cui/source/tabpages/tpline.cxx |   27 +++++++++++++++++----------
 2 files changed, 22 insertions(+), 12 deletions(-)

New commits:
commit 4508f1b150b852488949b59a9bda37815d1ba044
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Fri Jun 10 08:38:30 2011 -0700

    Replace List with std::vector< SvxBmpItemInfo* >

diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 0980114..3952b9f 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -102,6 +102,9 @@ public:
 |*
 \************************************************************************/
 
+class SvxBmpItemInfo;
+typedef ::std::vector< SvxBmpItemInfo* > SvxBmpItemInfoList;
+
 class SvxLineTabPage : public SvxTabPage
 {
     using TabPage::ActivatePage;
@@ -149,7 +152,7 @@ private:
     MetricField         aSymbolHeightMF;
     CheckBox            aSymbolRatioCB;
     std::vector<String> aGrfNames;
-    List                aGrfBrushItems;
+    SvxBmpItemInfoList  aGrfBrushItems;
     String              sNumCharFmtName;
     sal_Bool            bLastWidthModified;
     Size                aSymbolLastSize;
@@ -386,7 +389,7 @@ private:
     ChangeType*         pnLineEndListState;
     sal_uInt16*         pPageType;
     sal_uInt16*         pDlgType;
-    sal_uInt16*         pPosLineEndLb;
+    sal_uInt16*             pPosLineEndLb;
 
 #ifdef _SVX_TPLNEEND_CXX
     DECL_LINK( ClickAddHdl_Impl, void * );
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 9a8becc..ee1b0a3 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -168,9 +168,9 @@ SvxLineTabPage::SvxLineTabPage
     aTsbCenterEnd.SetAccessibleName(String(CUI_RES( STR_CENTER_END ) ) );
 
     FreeResource();
-    
+
     aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
-    
+
     // diese Page braucht ExchangeSupport
     SetExchangeSupport();
 
@@ -266,12 +266,11 @@ SvxLineTabPage::~SvxLineTabPage()
     if(pSymbolList)
         delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
 
-    SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
-    while( pInfo )
+    for ( size_t i = 0, n = aGrfBrushItems.size(); i < n; ++i )
     {
+        SvxBmpItemInfo* pInfo = aGrfBrushItems[ i ];
         delete pInfo->pBrushItem;
         delete pInfo;
-        pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
     }
 }
 void SvxLineTabPage::Construct()
@@ -1485,7 +1484,11 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
             SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
             pInfo->pBrushItem = pBrushItem;
             pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
-            aGrfBrushItems.Insert(pInfo, i);
+            if ( i < aGrfBrushItems.size() ) {
+                aGrfBrushItems.insert( aGrfBrushItems.begin() + i, pInfo );
+            } else {
+                aGrfBrushItems.push_back( pInfo );
+            }
             const Graphic* pGraphic = pBrushItem->GetGraphic();
 
             if(pGraphic)
@@ -1564,7 +1567,11 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
             SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
             pInfo->pBrushItem = pBrushItem;
             pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
-            aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
+            if ( (size_t)(nNumMenuGalleryItems + i) < aGrfBrushItems.size() ) {
+                aGrfBrushItems.insert( aGrfBrushItems.begin() + nNumMenuGalleryItems + i, pInfo );
+            } else {
+                aGrfBrushItems.push_back( pInfo );
+            }
 
             Size aSize(aBitmap.GetSizePixel());
             if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
@@ -1596,9 +1603,9 @@ IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
     PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
 
     SvxBmpItemInfo* pBmpInfo = 0;
-    for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
+    for ( size_t i = 0; i < pThis->aGrfBrushItems.size(); i++ )
     {
-        SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
+        SvxBmpItemInfo* pInfo = pThis->aGrfBrushItems[ i ];
         if( pInfo->pBrushItem == pItem )
         {
             pBmpInfo = pInfo; break;
@@ -1650,7 +1657,7 @@ IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
             nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
             bResetSize = sal_True;
         }
-        SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
+        SvxBmpItemInfo* pInfo = aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ];
         pGraphic = pInfo->pBrushItem->GetGraphic();
     }
     else switch(nItemId)


More information about the Libreoffice-commits mailing list