[Libreoffice-commits] .: sd/inc sd/source
Joseph Powers
jpowers at kemper.freedesktop.org
Fri Mar 4 21:54:33 PST 2011
sd/inc/stlpool.hxx | 3 ++-
sd/source/core/drawdoc.cxx | 17 +++++++++--------
sd/source/core/sdpage2.cxx | 19 ++++++++++---------
sd/source/core/stlpool.cxx | 33 ++++++++++++++++++++++-----------
4 files changed, 43 insertions(+), 29 deletions(-)
New commits:
commit f9c0b40160b5081c16613d7ea592e42db0be437c
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Fri Mar 4 21:49:59 2011 -0800
Remove usage of List container.
diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx
index b1eb448..bbf4ff8 100644
--- a/sd/inc/stlpool.hxx
+++ b/sd/inc/stlpool.hxx
@@ -50,6 +50,7 @@
class SdStyleSheet;
class SdDrawDocument;
class SdPage;
+class SfxStyleSheetBase;
typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
@@ -71,7 +72,7 @@ public:
SfxStyleSheetBase* GetTitleSheet(const String& rLayoutName);
// Caller muss Liste loeschen
- List* CreateOutlineSheetList(const String& rLayoutName);
+ void CreateOutlineSheetList(const String& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
/** creates all layout style sheets for the givin layout name if they
don't exist yet.
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index af94e5d..5162659 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -752,9 +752,10 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool
String aName = pPage->GetLayoutName();
aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ));
- List* pOutlineList = pSPool->CreateOutlineSheetList(aName);
- SfxStyleSheet* pTitleSheet = (SfxStyleSheet*)
- pSPool->GetTitleSheet(aName);
+ std::vector<SfxStyleSheetBase*> aOutlineList;
+ pSPool->CreateOutlineSheetList(aName,aOutlineList);
+
+ SfxStyleSheet* pTitleSheet = (SfxStyleSheet*)pSPool->GetTitleSheet(aName);
SdrObject* pObj = rPresentationShapes.getNextShape(0);
@@ -781,14 +782,16 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool
if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW )
pOPO->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT );
- for (USHORT nSheet = 0; nSheet < 10; nSheet++)
+ std::vector<SfxStyleSheetBase*>::iterator iter;
+ for (iter = aOutlineList.begin(); iter != aOutlineList.end(); ++iter)
{
- SfxStyleSheet* pSheet = (SfxStyleSheet*)pOutlineList->GetObject(nSheet);
+ SfxStyleSheet* pSheet = reinterpret_cast<SfxStyleSheet*>(*iter);
+
if (pSheet)
{
pObj->StartListening(*pSheet);
- if( nSheet == 0)
+ if( iter == aOutlineList.begin())
// Textrahmen hoert auf StyleSheet der Ebene1
pObj->NbcSetStyleSheet(pSheet, TRUE);
}
@@ -812,8 +815,6 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool
pObj = rPresentationShapes.getNextShape(pObj);
}
-
- delete pOutlineList;
}
}
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 5bdc96c..4ce39c3 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -42,7 +42,6 @@
#include <svl/urihelper.hxx>
#include <editeng/xmlcnitm.hxx>
#include <svx/svditer.hxx>
-#include <tools/list.hxx>
#include "sdresid.hxx"
#include "sdpage.hxx"
@@ -283,15 +282,17 @@ void SdPage::EndListenOutlineText()
DBG_ASSERT(pSPool, "StyleSheetPool nicht gefunden");
String aTrueLayoutName(maLayoutName);
aTrueLayoutName.Erase( aTrueLayoutName.SearchAscii( SD_LT_SEPARATOR ));
- List* pOutlineStyles = pSPool->CreateOutlineSheetList(aTrueLayoutName);
- for (SfxStyleSheet* pSheet = (SfxStyleSheet*)pOutlineStyles->First();
- pSheet;
- pSheet = (SfxStyleSheet*)pOutlineStyles->Next())
- {
- pOutlineTextObj->EndListening(*pSheet);
- }
- delete pOutlineStyles;
+ SfxStyleSheet *pSheet = NULL;
+ std::vector<SfxStyleSheetBase*> aOutlineStyles;
+ pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles);
+
+ std::vector<SfxStyleSheetBase*>::iterator iter;
+ for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter)
+ {
+ pSheet = reinterpret_cast<SfxStyleSheet*>(*iter);
+ pOutlineTextObj->EndListening(*pSheet);
+ }
}
}
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 77654bc..9ff94f2 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -149,21 +149,22 @@ SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(const String& rLayoutName)
|*
\************************************************************************/
-List* SdStyleSheetPool::CreateOutlineSheetList (const String& rLayoutName)
+void SdStyleSheetPool::CreateOutlineSheetList (const String& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles)
{
String aName(rLayoutName);
aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
aName += String(SdResId(STR_LAYOUT_OUTLINE));
- List* pList = new List;
+
for (USHORT nSheet = 1; nSheet < 10; nSheet++)
{
String aFullName(aName);
aFullName.Append( sal_Unicode( ' ' ));
aFullName.Append( String::CreateFromInt32( (sal_Int32)nSheet ));
SfxStyleSheetBase* pSheet = Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
- pList->Insert(pSheet, LIST_APPEND);
+
+ if (pSheet)
+ rOutlineStyles.push_back(pSheet);
}
- return pList;
}
/*************************************************************************
@@ -677,18 +678,28 @@ void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetP
}
// Sonderbehandlung fuer Gliederungsvorlagen: Parentbeziehungen aufbauen
- List* pOutlineSheets = CreateOutlineSheetList(rLayoutName);
- SfxStyleSheetBase* pParent = (SfxStyleSheetBase*)pOutlineSheets->First();
- pSheet = (SfxStyleSheetBase*)pOutlineSheets->Next();
- while (pSheet)
+ std::vector<SfxStyleSheetBase*> aOutlineSheets;
+ CreateOutlineSheetList(rLayoutName,aOutlineSheets);
+
+ std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
+
+ SfxStyleSheetBase* pParent = *it;
+ ++it;
+
+ while (it != aOutlineSheets.end())
{
- // kein Parent?
+ pSheet = *it;
+
+ if (!pSheet)
+ break;
+
if (pSheet->GetParent().Len() == 0)
pSheet->SetParent(pParent->GetName());
+
pParent = pSheet;
- pSheet = (SfxStyleSheetBase*)pOutlineSheets->Next();
+
+ ++it;
}
- delete pOutlineSheets;
}
/*************************************************************************
More information about the Libreoffice-commits
mailing list