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



From 811e66c084d35f80dd61cf5367a383523c407bdb Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sat, 4 Jun 2011 10:46:37 -0430
Subject: [PATCH 1/4] Replace List with std::vector<NavDocInfo>.

---
 sd/source/ui/dlg/navigatr.cxx |   32 ++++++++++----------------------
 sd/source/ui/inc/navigatr.hxx |    2 +-
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index edee709..c5f8345 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -97,7 +97,6 @@ SdNavigatorWin::SdNavigatorWin(
 
     mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings );
     mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings );
-    mpDocList = new List();
 
     ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
 
@@ -156,13 +155,6 @@ SdNavigatorWin::~SdNavigatorWin()
 {
     delete mpNavigatorCtrlItem;
     delete mpPageNameCtrlItem;
-
-    // Liste der DocInfos loeschen
-    long nCount = mpDocList->Count();
-    while( nCount-- )
-        delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 );
-
-    delete mpDocList;
 }
 
 // -----------------------------------------------------------------------
@@ -695,9 +687,7 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName )
         maLbDocs.Clear();
 
         // Liste der DocInfos loeschen
-        long nCount = mpDocList->Count();
-        while( nCount-- )
-            delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 );
+         maDocList.clear();
 
         if( mbDocImported )
             maLbDocs.InsertEntry( aStr, 0 );
@@ -710,15 +700,15 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName )
             ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, pSfxDocShell );
             if( pDocShell  && !pDocShell->IsInDestruction() && ( pDocShell->GetCreateMode() != 
SFX_CREATE_MODE_EMBEDDED ) )
             {
-                NavDocInfo* pInfo = new NavDocInfo();
-                pInfo->mpDocShell = pDocShell;
+                NavDocInfo aInfo ;
+                aInfo.mpDocShell = pDocShell;
 
                 SfxMedium *pMedium = pDocShell->GetMedium();
                 aStr = pMedium ? pMedium->GetName() : String();
                 if( aStr.Len() )
-                    pInfo->SetName();
+                    aInfo.SetName();
                 else
-                    pInfo->SetName( sal_False );
+                    aInfo.SetName( sal_False );
                 // z.Z. wird wieder der Name der Shell genommen (also ohne Pfad)
                 // da Koose es als Fehler ansieht, wenn er Pfad in URL-Notation
                 // angezeigt wird!
@@ -727,11 +717,11 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName )
                 maLbDocs.InsertEntry( aStr, LISTBOX_APPEND );
 
                 if( pDocShell == pCurrentDocShell )
-                    pInfo->SetActive();
+                    aInfo.SetActive();
                 else
-                    pInfo->SetActive( sal_False );
+                    aInfo.SetActive( sal_False );
 
-                mpDocList->Insert( pInfo, LIST_APPEND );
+                maDocList.push_back( aInfo );
             }
             pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0 , sal_False );
         }
@@ -762,7 +752,7 @@ sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool b
 
 NavDocInfo* SdNavigatorWin::GetDocInfo()
 {
-    long nPos = maLbDocs.GetSelectEntryPos();
+    sal_uInt32 nPos = maLbDocs.GetSelectEntryPos();
 
     if( mbDocImported )
     {
@@ -773,9 +763,7 @@ NavDocInfo* SdNavigatorWin::GetDocInfo()
         nPos--;
     }
 
-    NavDocInfo* pInfo = (NavDocInfo*)mpDocList->GetObject( nPos );
-
-    return( pInfo );
+    return nPos < maDocList.size() ? &(maDocList[ nPos ]) : NULL;
 }
 
 /*************************************************************************
diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx
index a7950f0..6ea8cc5 100644
--- a/sd/source/ui/inc/navigatr.hxx
+++ b/sd/source/ui/inc/navigatr.hxx
@@ -128,7 +128,7 @@ private:
     sal_Bool                                           mbDocImported;
     String                                             maDropFileName;
     NavigatorDragType                  meDragType;
-    List*                                              mpDocList;
+    std::vector<NavDocInfo>            maDocList;
     SfxBindings*                               mpBindings;
     SdNavigatorControllerItem* mpNavigatorCtrlItem;
     SdPageNameControllerItem*  mpPageNameCtrlItem;
-- 
1.7.3.4

From 55a20e82b0fb602a8e005bfc527d3369f4a7e845 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sun, 5 Jun 2011 09:18:31 -0430
Subject: [PATCH 2/4] Replace List for std::vector<String>.

---
 sd/source/filter/ppt/pptin.cxx |   56 ++++++++++++++++++----------------------
 sd/source/filter/ppt/pptin.hxx |    2 +-
 2 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 1f982cf..b5c339d 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -239,8 +239,6 @@ ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage
 
 ImplSdPPTImport::~ImplSdPPTImport()
 {
-    for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
-        delete (String*)pPtr;
     delete pStData;
 }
 
@@ -356,22 +354,19 @@ sal_Bool ImplSdPPTImport::Import()
                                 {
                                     if ( !aPropItem.Read( aUString, nType, sal_False ) )
                                         break;
-                                    String* pString = new String( aUString );
-                                    if ( pString->EqualsAscii( "No Slide Title" ))
-                                        *pString = String();
+
+                                    String aString( aUString );
+                                    if ( aString.EqualsAscii( "No Slide Title" ))
+                                        aString = String();
                                     else
                                     {
-                                        void* pPtr;
-                                        for ( pPtr = maSlideNameList.First(); pPtr; pPtr = 
maSlideNameList.Next() )
-                                        {
-                                            if ( *((String*)pPtr ) == *pString )
-                                            {
-                                                *pString = String();
-                                                break;
-                                            }
-                                        }
+                                        std::vector<String>::const_iterator pIter =
+                                                
std::find(maSlideNameList.begin(),maSlideNameList.end(),aString);
+
+                                        if (pIter != maSlideNameList.end())
+                                            aString = String();
                                     }
-                                    maSlideNameList.Insert( pString, LIST_APPEND );
+                                    maSlideNameList.push_back( aString );
                                 }
                             }
                         }
@@ -478,17 +473,16 @@ sal_Bool ImplSdPPTImport::Import()
                                             }
                                             if ( !bSucceeded )
                                             {   // second pass, searching for a SlideName
+                                                String aToken( aString.GetToken( nToken, 
(sal_Unicode)',' ) );
                                                 for ( nToken = 0; nToken < nTokenCount; nToken++ )
                                                 {
-                                                    String aToken( aString.GetToken( nToken, 
(sal_Unicode)',' ) );
-                                                    for ( void* pPtr = maSlideNameList.First(); 
pPtr; pPtr = maSlideNameList.Next() )
+                                                    std::vector<String>::const_iterator pIter =
+                                                            
std::find(maSlideNameList.begin(),maSlideNameList.end(),aToken);
+
+                                                    if (pIter != maSlideNameList.end())
                                                     {
-                                                        if ( *(String*)pPtr == aToken )
-                                                        {
-                                                            nPageNumber = 
maSlideNameList.GetCurPos();
-                                                            bSucceeded = sal_True;
-                                                            break;
-                                                        }
+                                                        nPageNumber = pIter - 
maSlideNameList.begin();
+                                                        bSucceeded = sal_True;
                                                     }
                                                 }
                                             }
@@ -510,8 +504,8 @@ sal_Bool ImplSdPPTImport::Import()
                                             }
                                             if ( bSucceeded )
                                             {
-                                                if ( nPageNumber < maSlideNameList.Count() )
-                                                    pHyperlink->aConvSubString = 
*(String*)maSlideNameList.GetObject( nPageNumber );
+                                                if ( nPageNumber < maSlideNameList.size() )
+                                                    pHyperlink->aConvSubString = maSlideNameList[ 
nPageNumber ];
                                                 if ( !pHyperlink->aConvSubString.Len() )
                                                 {
                                                     pHyperlink->aConvSubString = String( SdResId( 
STR_PAGE ) );
@@ -1203,16 +1197,16 @@ sal_Bool ImplSdPPTImport::Import()
     }
 
     sal_uInt32 nSlideCount = GetPageCount();
-    for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.Count() ); i++ )
+    for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.size() ); i++ )
     {
         SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
-        String* pName = (String*)maSlideNameList.GetObject( i );
-        if ( pPage && pName )
+        String &aName = maSlideNameList[ i ];
+        if ( pPage )
         {
-            if ( pName->Len() )
-                pPage->SetName( *pName );
+            if ( aName.Len() )
+                pPage->SetName( aName );
             else
-                *pName = pPage->GetName();
+                aName = pPage->GetName();
         }
     }
     if ( mbDocumentFound )
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
index 361d4f1..2947c5c 100644
--- a/sd/source/filter/ppt/pptin.hxx
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -61,7 +61,7 @@ class ImplSdPPTImport : public SdrPowerPointImport
     SvStorage&         mrStorage;
 //     SvStream*               mpPicStream;
     DffRecordHeader    maDocHd;
-    List                       maSlideNameList;
+    std::vector<String> maSlideNameList;
     sal_Bool                   mbDocumentFound;
     sal_uInt32         mnFilterOptions;
     SdDrawDocument*    mpDoc;
-- 
1.7.3.4

From c715096d39402b7aa01918a282c20df6ac0b32cf Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sun, 5 Jun 2011 10:42:37 -0430
Subject: [PATCH 3/4] Replace List for std::vector<rtl::OUString>.

---
 sd/source/filter/eppt/eppt.cxx   |   46 +++++++++++++------------------------
 sd/source/filter/eppt/eppt.hxx   |    2 +-
 sd/source/filter/eppt/epptso.cxx |   27 ++++++++++++----------
 3 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 4973b25..c45dbe7 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -456,8 +456,6 @@ PPTWriter::~PPTWriter()
     while( aStyleSheetIter < maStyleSheetList.end() )
         delete *aStyleSheetIter++;
 
-    for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
-        delete (::rtl::OUString*)pPtr;
     for ( pPtr = maHyperlink.First(); pPtr; pPtr = maHyperlink.Next() )
         delete (EPPTHyperlink*)pPtr;
     for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() )
@@ -751,13 +749,9 @@ sal_Bool PPTWriter::ImplCreateDocument()
             aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
 
         if ( aXName.is() )
-        {
-            ::rtl::OUString aStr = aXName->getName();
-            ::rtl::OUString *pUStr = new ::rtl::OUString( aStr );
-            maSlideNameList.Insert( pUStr, LIST_APPEND );
-        }
+            maSlideNameList.push_back( aXName->getName() );
         else
-            maSlideNameList.Insert( new ::rtl::OUString(), LIST_APPEND );
+            maSlideNameList.push_back( ::rtl::OUString() );
     }
     mpPptEscherEx->CloseContainer();    // EPP_SlideListWithText
 
@@ -813,21 +807,18 @@ sal_Bool PPTWriter::ImplCreateDocument()
                 {
                     if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) 
) ) )
                     {
+                        nStartSlide = 0;
                         ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() );
-                        ::rtl::OUString* pStr;
-                        for ( pStr = (::rtl::OUString*)maSlideNameList.First(); pStr;
-                                    pStr = (::rtl::OUString*)maSlideNameList.Next(), nStartSlide++ 
)
+
+                        std::vector<rtl::OUString>::const_iterator pIter = std::find(
+                                    maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
+
+                        if (pIter != maSlideNameList.end())
                         {
-                            if ( *pStr == aSlideName )
-                            {
-                                nStartSlide++;
-                                nFlags |= 4;
-                                nEndSlide = (sal_uInt16)mnPages;
-                                break;
-                            }
+                            nStartSlide++;
+                            nFlags |= 4;
+                            nEndSlide = (sal_uInt16)mnPages;
                         }
-                        if ( !pStr )
-                            nStartSlide = 0;
                     }
                 }
 
@@ -924,16 +915,11 @@ sal_Bool PPTWriter::ImplCreateDocument()
                                                         {
                                                             ::rtl::OUString aSlideName( 
aXName->getName() );
                                                             sal_uInt32 nPageNumber = 0;
-                                                            for ( ::rtl::OUString* pSlideName = 
(::rtl::OUString*)maSlideNameList.First();
-                                                                pSlideName;
-                                                                pSlideName = 
(::rtl::OUString*)maSlideNameList.Next(), nPageNumber++ )
-                                                            {
-                                                                if ( *pSlideName == aSlideName )
-                                                                {
-                                                                    *mpStrm << (sal_uInt32)( 
nPageNumber + 0x100 ); // unique slide id
-                                                                    break;
-                                                                }
-                                                            }
+                                                            
std::vector<rtl::OUString>::const_iterator pIter = std::find(
+                                                                        
maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
+
+                                                            if (pIter != maSlideNameList.end())
+                                                                *mpStrm << (sal_uInt32)( 
nPageNumber + 0x100 ); // unique slide id
                                                         }
                                                     }
                                                 }
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index 8ff33e6..a3284bd 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -179,7 +179,7 @@ class PPTWriter : public PPTWriterBase, public PPTExBulletProvider
         sal_uInt32                      mnLatestStatValue;
 
         EscherGraphicProvider*          mpGraphicProvider;
-        List                            maSlideNameList;
+        std::vector<rtl::OUString>      maSlideNameList;
 
         ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText >             
mXText;             // TextRef des globalen Text
         ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >             
mXCursor;
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 49335bd..8c68895 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1216,16 +1216,18 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, 
sal_u
                             {
                                 String aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', 
INetURLObject::DECODE_WITH_CHARSET ) );
                                 aPage.Erase( 0, 1 );
-                                for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr 
= (String*)maSlideNameList.Next(), nPageIndex++ )
+
+                                rtl::OUString aUPage(aPage);
+                                std::vector<rtl::OUString>::const_iterator pIter = std::find(
+                                            maSlideNameList.begin(),maSlideNameList.end(),aUPage);
+
+                                if ( pIter != maSlideNameList.end() )
                                 {
-                                    if ( *pStr == aPage )
-                                    {
-                                        aPageUrl = UniString::CreateFromInt32( 256 + nPageIndex );
-                                        aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," 
) ) );
-                                        aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) 
);
-                                        aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( 
",Slide " ) ) );
-                                        aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) 
);
-                                    }
+                                    aPageUrl = UniString::CreateFromInt32( 256 + nPageIndex );
+                                    aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) 
);
+                                    aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
+                                    aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide 
" ) ) );
+                                    aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
                                 }
                             }
                             sal_uInt32 nHyperId;
@@ -2034,11 +2036,12 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, 
::com::sun::star::presentat
         {
             if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
             {
-                String  aBookmark( *(::rtl::OUString*)mAny.getValue() );
+                rtl::OUString  aBookmark( *(::rtl::OUString*)mAny.getValue() );
                 sal_uInt32 nIndex = 0;
-                for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = 
(String*)maSlideNameList.Next(), nIndex++ )
+                std::vector<rtl::OUString>::const_iterator pIter;
+                for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, 
nIndex++ )
                 {
-                    if ( *pStr == aBookmark )
+                    if ( *pIter == aBookmark )
                     {
                         // Bookmark ist ein link zu einer Dokumentseite
                         nAction = 4;
-- 
1.7.3.4

From 7504fd49010bc6cf0194ec3bc2f3288f389845d1 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Wed, 8 Jun 2011 15:43:44 -0430
Subject: [PATCH] Replace List for std::vector<sd::FrameView*>.

---
 sd/inc/drawdoc.hxx                 |    8 ++--
 sd/source/core/drawdoc.cxx         |   18 +-------
 sd/source/filter/ppt/pptin.cxx     |   10 +---
 sd/source/ui/docshell/docshel2.cxx |    8 ++--
 sd/source/ui/docshell/docshell.cxx |   77 ++++++++++++-----------------------
 sd/source/ui/unoidl/unomodel.cxx   |   60 ++++++++++------------------
 6 files changed, 62 insertions(+), 119 deletions(-)

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index ad9e72e..8938ede 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -111,6 +111,7 @@ SV_DECL_REF(DrawDocShell)
 class DrawDocShell;
 class UndoManager;
 class ShapeList;
+class FrameView;
 }
 
 class ImpDrawPageListWatcher;
@@ -167,7 +168,7 @@ private:
     Timer*              mpOnlineSpellingTimer;
     sd::ShapeList*             mpOnlineSpellingList;
     SvxSearchItem*      mpOnlineSearchItem;
-    List*               mpFrameViewList;
+    std::vector<sd::FrameView*> maFrameViewList;
     List*               mpCustomShowList;
     ::sd::DrawDocShell* mpDocSh;
     SdTransferable *    mpCreatingTransferable;
@@ -407,7 +408,7 @@ public:
 
     sal_uLong               GetLinkCount();
 
-    List*               GetFrameViewList() const { return mpFrameViewList; }
+    std::vector<sd::FrameView*>& GetFrameViewList() { return maFrameViewList; }
     SD_DLLPUBLIC List*  GetCustomShowList(sal_Bool bCreate = sal_False);
                         
     void                NbcSetChanged(sal_Bool bFlag = sal_True);
@@ -426,8 +427,7 @@ public:
     sal_Bool                IsNewOrLoadCompleted() const {return mbNewOrLoadCompleted; }
 
     ::sd::FrameView* GetFrameView(sal_uLong nPos) {
-        return static_cast< ::sd::FrameView*>(
-            mpFrameViewList->GetObject(nPos));}
+        return nPos < maFrameViewList.size() ? maFrameViewList[nPos] : NULL; }
 
     /** deprecated*/
     SdAnimationInfo*    GetAnimationInfo(SdrObject* pObject) const;
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 40e5e55..d49e4d1 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -156,7 +156,6 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
 , mpOnlineSpellingTimer(NULL)
 , mpOnlineSpellingList(NULL)
 , mpOnlineSearchItem(NULL)
-, mpFrameViewList( new List() )
 , mpCustomShowList(NULL)
 , mpDocSh(static_cast< ::sd::DrawDocShell*>(pDrDocSh))
 , mpCreatingTransferable( NULL )
@@ -412,20 +411,9 @@ SdDrawDocument::~SdDrawDocument()
         pLinkManager = NULL;
     }
 
-    ::sd::FrameView* pFrameView = NULL;
-
-    for (sal_uLong i = 0; i < mpFrameViewList->Count(); i++)
-    {
-        // Ggf. FrameViews loeschen
-        pFrameView =
-            static_cast< ::sd::FrameView*>(mpFrameViewList->GetObject(i));
-
-        if (pFrameView)
-            delete pFrameView;
-    }
-
-    delete mpFrameViewList;
-    mpFrameViewList = NULL;
+    std::vector<sd::FrameView*>::iterator pIter;
+    for ( pIter = maFrameViewList.begin(); pIter != maFrameViewList.end(); ++pIter )
+        delete *pIter;
 
     if (mpCustomShowList)
     {
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 1f982cf..cef42cc 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1223,13 +1223,9 @@ sal_Bool ImplSdPPTImport::Import()
             ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 );
             if ( !pFrameView )
             {
-                List* pFrameViewList = mpDoc->GetFrameViewList();
-                if ( pFrameViewList )
-                {
-                    pFrameView = new ::sd::FrameView( mpDoc );
-                    if ( pFrameView )
-                        pFrameViewList->Insert( pFrameView );
-                }
+                std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
+
+                rViews.push_back( new ::sd::FrameView( mpDoc ) );
             }
             if ( pFrameView )
             {
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
index de12c38..82f261e 100644
--- a/sd/source/ui/docshell/docshel2.cxx
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -79,11 +79,11 @@ void DrawDocShell::Draw(OutputDevice* pOut, const JobSetup&, sal_uInt16 nAspect)
 
     SdPage* pSelectedPage = NULL;
 
-    List* pFrameViewList = mpDoc->GetFrameViewList();
-    if( pFrameViewList && pFrameViewList->Count() )
+    const std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
+    if( !rViews.empty() )
     {
-        FrameView* pFrameView = (FrameView*)pFrameViewList->GetObject(0);
-        if( pFrameView && pFrameView->GetPageKind() == PK_STANDARD )
+        sd::FrameView* pFrameView = rViews[0];
+        if( pFrameView->GetPageKind() == PK_STANDARD )
         {
             sal_uInt16 nSelectedPage = pFrameView->GetSelectedPage();
             pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD);
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index 33b6b64..58479bb 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -348,44 +348,32 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
 
 void DrawDocShell::InPlaceActivate( sal_Bool bActive )
 {
+    ViewShell* pViewSh = NULL;
+    SfxViewShell* pSfxViewSh = NULL;
+    SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
+    std::vector<FrameView*> &rViews = mpDoc->GetFrameViewList();
+
     if( !bActive )
     {
-        FrameView* pFrameView = NULL;
-        List* pFrameViewList = mpDoc->GetFrameViewList();
-
-        DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
-        if( pFrameViewList )
-        {
-            sal_uInt32 i;
-            for ( i = 0; i < pFrameViewList->Count(); i++)
-            {
-                // Ggf. FrameViews loeschen
-                pFrameView = (FrameView*) pFrameViewList->GetObject(i);
+        std::vector<FrameView*>::iterator pIter;
+        for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter )
+            delete *pIter;
 
-                if (pFrameView)
-                    delete pFrameView;
-            }
-
-            pFrameViewList->Clear();
+        rViews.clear();
 
-            ViewShell* pViewSh = NULL;
-            SfxViewShell* pSfxViewSh = NULL;
-            SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
+        while (pSfxViewFrame)
+        {
+            // Anzahl FrameViews ermitteln
+            pSfxViewSh = pSfxViewFrame->GetViewShell();
+            pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
 
-            while (pSfxViewFrame)
+            if ( pViewSh && pViewSh->GetFrameView() )
             {
-                // Anzahl FrameViews ermitteln
-                pSfxViewSh = pSfxViewFrame->GetViewShell();
-                pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
-
-                if ( pViewSh && pViewSh->GetFrameView() )
-                {
-                    pViewSh->WriteFrameViewData();
-                    pFrameViewList->Insert( new FrameView( mpDoc, pViewSh->GetFrameView() ) );
-                }
-
-                pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
+                pViewSh->WriteFrameViewData();
+                rViews.push_back( new FrameView( mpDoc, pViewSh->GetFrameView() ) );
             }
+
+            pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
         }
     }
 
@@ -393,29 +381,18 @@ void DrawDocShell::InPlaceActivate( sal_Bool bActive )
 
     if( bActive )
     {
-        List* pFrameViewList = mpDoc->GetFrameViewList();
-
-        DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
-        if( pFrameViewList )
+        for( sal_uInt32 i = 0; pSfxViewFrame && (i < rViews.size()); i++ )
         {
-            ViewShell* pViewSh = NULL;
-            SfxViewShell* pSfxViewSh = NULL;
-            SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
+            // Anzahl FrameViews ermitteln
+            pSfxViewSh = pSfxViewFrame->GetViewShell();
+            pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
 
-            sal_uInt32 i;
-            for( i = 0; pSfxViewFrame && (i < pFrameViewList->Count()); i++ )
+            if ( pViewSh )
             {
-                // Anzahl FrameViews ermitteln
-                pSfxViewSh = pSfxViewFrame->GetViewShell();
-                pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
-
-                if ( pViewSh )
-                {
-                    pViewSh->ReadFrameViewData( (FrameView*)pFrameViewList->GetObject(i) );
-                }
-
-                pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
+                pViewSh->ReadFrameViewData( rViews[ i ] );
             }
+
+            pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
         }
     }
 }
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 3a8d4dc..6ecbaa9 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -618,9 +618,9 @@ uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewD
 
     if( !xRet.is() )
     {
-        List* pFrameViewList = mpDoc->GetFrameViewList();
+        const std::vector<sd::FrameView*> &rList = mpDoc->GetFrameViewList();
 
-        if( pFrameViewList && pFrameViewList->Count() )
+        if( !rList.empty() )
         {
             xRet = uno::Reference < container::XIndexAccess 
::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"))));
 
@@ -629,19 +629,13 @@ uno::Reference < container::XIndexAccess > SAL_CALL 
SdXImpressDocument::getViewD
             DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" );
             if( xCont.is() )
             {
-                sal_uInt32 i;
-                for( i = 0; i < pFrameViewList->Count(); i++ )
+                for( sal_uInt32 i = 0, n = rList.size(); i < n; i++ )
                 {
-                    ::sd::FrameView* pFrameView =
-                          static_cast< ::sd::FrameView*>(
-                              pFrameViewList->GetObject(i));
+                    ::sd::FrameView* pFrameView = rList[ i ];
 
-                    if(pFrameView)
-                    {
-                        uno::Sequence< beans::PropertyValue > aSeq;
-                        pFrameView->WriteUserDataSequence( aSeq );
-                        xCont->insertByIndex( i, uno::makeAny( aSeq ) );
-                    }
+                    uno::Sequence< beans::PropertyValue > aSeq;
+                    pFrameView->WriteUserDataSequence( aSeq );
+                    xCont->insertByIndex( i, uno::makeAny( aSeq ) );
                 }
             }
         }
@@ -662,36 +656,24 @@ void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < 
container:
     {
         const sal_Int32 nCount = xData->getCount();
 
-        List* pFrameViewList = mpDoc->GetFrameViewList();
-
-        DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
-        if( pFrameViewList )
-        {
-            ::sd::FrameView* pFrameView;
+        std::vector<sd::FrameView*>::iterator pIter;
+        std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
 
-            sal_uInt32 i;
-            for ( i = 0; i < pFrameViewList->Count(); i++)
-            {
-                // Ggf. FrameViews loeschen
-                pFrameView = static_cast< ::sd::FrameView*>(
-                    pFrameViewList->GetObject(i));
+        for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter )
+            delete *pIter;
 
-                if (pFrameView)
-                    delete pFrameView;
-            }
+        rViews.clear();
 
-            pFrameViewList->Clear();
-
-            uno::Sequence< beans::PropertyValue > aSeq;
-            sal_Int32 nIndex;
-            for( nIndex = 0; nIndex < nCount; nIndex++ )
+        ::sd::FrameView* pFrameView;
+        uno::Sequence< beans::PropertyValue > aSeq;
+        for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+        {
+            if( xData->getByIndex( nIndex ) >>= aSeq )
             {
-                if( xData->getByIndex( nIndex ) >>= aSeq )
-                {
-                    pFrameView = new ::sd::FrameView( mpDoc );
-                    pFrameView->ReadUserDataSequence( aSeq );
-                    pFrameViewList->Insert( pFrameView );
-                }
+                pFrameView = new ::sd::FrameView( mpDoc );
+
+                pFrameView->ReadUserDataSequence( aSeq );
+                rViews.push_back( pFrameView );
             }
         }
     }
-- 
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.