summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-06-08 15:43:44 -0430
committerPetr Mladek <pmladek@suse.cz>2011-06-10 18:46:33 +0200
commit418e1c560a9c6c68a1918e8a9b95ef276ce78ab1 (patch)
tree0ef56a2b5271405275d20ebcc7bcc3f74968cdf8
parent6614d67510f067daef67cf6e8b704b409e1b4744 (diff)
Replace List for std::vector<sd::FrameView*>.
-rw-r--r--sd/inc/drawdoc.hxx8
-rw-r--r--sd/source/core/drawdoc.cxx18
-rw-r--r--sd/source/filter/ppt/pptin.cxx10
-rw-r--r--sd/source/ui/docshell/docshel2.cxx8
-rw-r--r--sd/source/ui/docshell/docshell.cxx77
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx60
6 files changed, 62 insertions, 119 deletions
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 302a79c3460c..86b2ef85fdfe 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 1551403c82fd..671dbfa0b100 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 7f7b121a2770..20a02db6a50d 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1211,13 +1211,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();
+ pFrameView = new ::sd::FrameView( mpDoc );
+ rViews.push_back( pFrameView );
}
if ( pFrameView )
{
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
index 47340e07ba7c..5f1737cc6c57 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 f2b27c6ac72a..d87363f30b06 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 a382a7aab057..40bf973a4dc7 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 );
}
}
}