[Libreoffice-commits] .: 4 commits - sd/inc sd/source
Petr Mladek
pmladek at kemper.freedesktop.org
Fri Jun 10 08:04:26 PDT 2011
sd/inc/drawdoc.hxx | 8 +--
sd/source/core/drawdoc.cxx | 18 +-------
sd/source/filter/eppt/eppt.cxx | 45 +++++++--------------
sd/source/filter/eppt/eppt.hxx | 2
sd/source/filter/eppt/epptso.cxx | 28 +++++++------
sd/source/filter/ppt/pptin.cxx | 64 ++++++++++++------------------
sd/source/filter/ppt/pptin.hxx | 2
sd/source/ui/dlg/navigatr.cxx | 32 ++++-----------
sd/source/ui/docshell/docshel2.cxx | 8 +--
sd/source/ui/docshell/docshell.cxx | 77 ++++++++++++-------------------------
sd/source/ui/inc/navigatr.hxx | 2
sd/source/ui/unoidl/unomodel.cxx | 60 ++++++++++------------------
12 files changed, 131 insertions(+), 215 deletions(-)
New commits:
commit 9b6527a74baf90dff6a65a5cd5361daba8779ac1
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Jun 5 10:42:37 2011 -0430
Replace List for std::vector<rtl::OUString>.
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 4973b25..b996d20 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
@@ -814,20 +808,16 @@ sal_Bool PPTWriter::ImplCreateDocument()
if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) )
{
::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 = pIter - maSlideNameList.begin() + 1;
+ nFlags |= 4;
+ nEndSlide = (sal_uInt16)mnPages;
}
- if ( !pStr )
- nStartSlide = 0;
}
}
@@ -923,16 +913,13 @@ sal_Bool PPTWriter::ImplCreateDocument()
if ( aXName.is() )
{
::rtl::OUString aSlideName( aXName->getName() );
- sal_uInt32 nPageNumber = 0;
- for ( ::rtl::OUString* pSlideName = (::rtl::OUString*)maSlideNameList.First();
- pSlideName;
- pSlideName = (::rtl::OUString*)maSlideNameList.Next(), nPageNumber++ )
+ std::vector<rtl::OUString>::const_iterator pIter = std::find(
+ maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
+
+ if (pIter != maSlideNameList.end())
{
- if ( *pSlideName == aSlideName )
- {
- *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id
- break;
- }
+ sal_uInt32 nPageNumber = pIter - maSlideNameList.begin();
+ *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..14ac239 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1216,16 +1216,19 @@ 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 ) );
- }
+ nPageIndex = pIter - maSlideNameList.begin();
+ 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 +2037,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;
commit d722f519ad278b715d32a121d78409707cd8b12a
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Jun 5 09:18:31 2011 -0430
Replace List for std::vector<String>.
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 4b404f7..6f0bf23 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;
}
@@ -344,22 +342,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 );
}
}
}
@@ -469,14 +464,13 @@ sal_Bool ImplSdPPTImport::Import()
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;
}
}
}
@@ -498,8 +492,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 ) );
@@ -1191,16 +1185,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;
commit 4ad79ee8fe80be4b7795c797b820b798da4a1891
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Jun 8 15:43:44 2011 -0430
Replace List for std::vector<sd::FrameView*>.
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index c7bfd8c..7b8d164 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 5b7ba44..4b404f7 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 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 );
}
}
}
commit e1811329389d5505175f47a9a23d0d5cb1121fc7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sat Jun 4 10:46:37 2011 -0430
Replace List with std::vector<NavDocInfo>.
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;
More information about the Libreoffice-commits
mailing list