[Libreoffice-commits] .: 12 commits - sd/inc sd/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Apr 11 08:47:31 PDT 2012
sd/inc/sdabstdlg.hxx | 4
sd/source/core/drawdoc3.cxx | 179 +++++++++++++++--------------------------
sd/source/ui/dlg/inspagob.cxx | 20 ++++
sd/source/ui/dlg/sddlgfact.cxx | 6 +
sd/source/ui/dlg/sddlgfact.hxx | 1
sd/source/ui/dlg/sdtreelb.cxx | 15 +++
sd/source/ui/inc/View.hxx | 15 +++
sd/source/ui/inc/inspagob.hxx | 11 ++
sd/source/ui/inc/sdtreelb.hxx | 11 ++
sd/source/ui/view/sdview2.cxx | 62 ++++++++++++++
10 files changed, 213 insertions(+), 111 deletions(-)
New commits:
commit 09fa378e11cec924f9cd2b95d0eedb2599fa088e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Apr 11 16:14:08 2012 +0100
this can be a reference surely
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index fe6b48a..91a0570 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -336,12 +336,12 @@ void SdDrawDocument::IterateBookmarkPages( SdDrawDocument* pBookmarkDoc, List* p
class InsertBookmarkAsPage_FindDuplicateLayouts : public SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
{
public:
- InsertBookmarkAsPage_FindDuplicateLayouts( std::vector<rtl::OUString> *pLayoutsToTransfer )
- : mpLayoutsToTransfer(pLayoutsToTransfer) {}
+ InsertBookmarkAsPage_FindDuplicateLayouts( std::vector<rtl::OUString> &rLayoutsToTransfer )
+ : mrLayoutsToTransfer(rLayoutsToTransfer) {}
virtual ~InsertBookmarkAsPage_FindDuplicateLayouts() {};
virtual void operator()( SdDrawDocument&, SdPage* );
private:
- std::vector<rtl::OUString> *mpLayoutsToTransfer;
+ std::vector<rtl::OUString> &mrLayoutsToTransfer;
};
void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc, SdPage* pBMMPage )
@@ -355,9 +355,9 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
rtl::OUString aLayout(aFullNameLayout);
std::vector<rtl::OUString>::const_iterator pIter =
- find(mpLayoutsToTransfer->begin(),mpLayoutsToTransfer->end(),aLayout);
+ find(mrLayoutsToTransfer.begin(), mrLayoutsToTransfer.end(),aLayout);
- bool bFound = pIter != mpLayoutsToTransfer->end();
+ bool bFound = pIter != mrLayoutsToTransfer.end();
const sal_uInt16 nMPageCount = rDoc.GetMasterPageCount();
for (sal_uInt16 nMPage = 0; nMPage < nMPageCount && !bFound; nMPage++)
@@ -376,7 +376,7 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
}
if (!bFound)
- mpLayoutsToTransfer->push_back(aLayout);
+ mrLayoutsToTransfer.push_back(aLayout);
}
/** Just add one page to the container given to the constructor.
@@ -514,7 +514,7 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
// Refactored copy'n'pasted layout name collection into IterateBookmarkPages
//
std::vector<rtl::OUString> aLayoutsToTransfer;
- InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( &aLayoutsToTransfer );
+ InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( aLayoutsToTransfer );
IterateBookmarkPages( pBookmarkDoc, pBookmarkList, nBMSdPageCount, aSearchFunctor );
commit 5c3b81d21d163d89ea95c2ca0c23b467b6537025
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Apr 11 16:07:00 2012 +0100
drop unused members
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 0ec3a1e..fe6b48a 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -336,18 +336,12 @@ void SdDrawDocument::IterateBookmarkPages( SdDrawDocument* pBookmarkDoc, List* p
class InsertBookmarkAsPage_FindDuplicateLayouts : public SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
{
public:
- InsertBookmarkAsPage_FindDuplicateLayouts( std::vector<rtl::OUString> *pLayoutsToTransfer,
- SdDrawDocument* pBookmarkDoc,
- List* pBookmarkList, sal_uInt16 nBMSdPageCount ) :
- mpLayoutsToTransfer(pLayoutsToTransfer), mpBookmarkDoc(pBookmarkDoc),
- mpBookmarkList(pBookmarkList), mnBMSdPageCount(nBMSdPageCount) {}
+ InsertBookmarkAsPage_FindDuplicateLayouts( std::vector<rtl::OUString> *pLayoutsToTransfer )
+ : mpLayoutsToTransfer(pLayoutsToTransfer) {}
virtual ~InsertBookmarkAsPage_FindDuplicateLayouts() {};
virtual void operator()( SdDrawDocument&, SdPage* );
private:
std::vector<rtl::OUString> *mpLayoutsToTransfer;
- SdDrawDocument* mpBookmarkDoc;
- List* mpBookmarkList;
- sal_uInt16 mnBMSdPageCount;
};
void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc, SdPage* pBMMPage )
@@ -520,8 +514,7 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
// Refactored copy'n'pasted layout name collection into IterateBookmarkPages
//
std::vector<rtl::OUString> aLayoutsToTransfer;
- InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( &aLayoutsToTransfer, pBookmarkDoc,
- pBookmarkList, nBMSdPageCount );
+ InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( &aLayoutsToTransfer );
IterateBookmarkPages( pBookmarkDoc, pBookmarkList, nBMSdPageCount, aSearchFunctor );
commit 74d2ed1ace67a83bbfa97de7ac96bfd43888ee3a
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Mar 27 12:18:13 2012 -0430
Replace deprecated List with std::vector<StyleReplaceData>.
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 8a95289..0ec3a1e 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1431,7 +1431,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
if (pSourceDoc)
{
- List* pReplList = NULL;
+ std::vector<StyleReplaceData> aReplList; // Liste fuer ersetzte StyleSheets
sal_Bool bLayoutReloaded = sal_False; // Wurde ex. Layout wieder geladen?
/*********************************************************************
@@ -1512,9 +1512,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
pSourceStyleSheetPool->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->SetSearchMask(SD_STYLE_FAMILY_MASTERPAGE);
- pReplList = new List; // Liste fuer ersetzte StyleSheets
SdStyleSheetVector aCreatedStyles; // Liste fuer erzeugte StyleSheets
-
SfxStyleSheetBase* pHisSheet = pSourceStyleSheetPool->First();
while (pHisSheet)
@@ -1553,17 +1551,17 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
aCreatedStyles.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pMySheet ) ) );
}
- StyleReplaceData* pReplData = new StyleReplaceData;
- pReplData->nNewFamily = pMySheet->GetFamily();
- pReplData->nFamily = pMySheet->GetFamily();
- pReplData->aNewName = pMySheet->GetName();
+ StyleReplaceData aReplData;
+ aReplData.nNewFamily = pMySheet->GetFamily();
+ aReplData.nFamily = pMySheet->GetFamily();
+ aReplData.aNewName = pMySheet->GetName();
String aTemp(pMySheet->GetName());
sal_uInt16 nPos = aTemp.SearchAscii( SD_LT_SEPARATOR );
aTemp.Erase(0, nPos);
aTemp.Insert(aOldLayoutName, 0);
- pReplData->aName = aTemp;
- pReplList->Insert(pReplData, LIST_APPEND);
+ aReplData.aName = aTemp;
+ aReplList.push_back(aReplData);
}
pHisSheet = (SfxStyleSheet*) pSourceStyleSheetPool->Next();
@@ -1574,12 +1572,11 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
// Vorlagen wieder aufbauen
if(!aCreatedStyles.empty())
{
- StyleReplaceData* pRData = (StyleReplaceData*)pReplList->First();
-
- while (pRData)
+ std::vector<StyleReplaceData>::iterator pRDataIter;
+ for ( pRDataIter = aReplList.begin(); pRDataIter != aReplList.end(); ++pRDataIter )
{
- SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(pRData->aName);
- SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(pRData->aNewName);
+ SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(pRDataIter->aName);
+ SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(pRDataIter->aNewName);
if (pSOld && pSNew)
{
@@ -1588,21 +1585,18 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
if (rParentOfOld.Len() > 0 && rParentOfNew.Len() == 0)
{
-
- for (sal_uLong i = 0; i < pReplList->Count(); i++)
+ std::vector<StyleReplaceData>::iterator pRDIter;
+ for ( pRDIter = aReplList.begin(); pRDIter != aReplList.end(); ++pRDIter )
{
- StyleReplaceData* pRD = (StyleReplaceData*)pReplList->
- GetObject(i);
- if ((pRD->aName == rParentOfOld) && (pRD->aName != pRD->aNewName))
+ if ((pRDIter->aName == rParentOfOld) && (pRDIter->aName != pRDIter->aNewName))
{
- String aParentOfNew(pRD->aNewName);
+ String aParentOfNew(pRDIter->aNewName);
pSNew->SetParent(aParentOfNew);
break;
}
}
}
}
- pRData = (StyleReplaceData*) pReplList->Next();
}
// ab jetzt beim Suchen alle beachten
@@ -1742,16 +1736,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
pNotesMaster->SetOrientation( rOldNotesMaster.GetOrientation() );
pNotesMaster->SetAutoLayout(pNotesMaster->GetAutoLayout());
- // Liste der ersetzten Vorlagen mit Inhalt loeschen
- StyleReplaceData* pReplData = (StyleReplaceData*)pReplList->First();
- while (pReplData)
- {
- delete pReplData;
- pReplData = (StyleReplaceData*)pReplList->Next();
- }
- delete pReplList;
-
-
if( (pSourceDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) &&
(GetDocumentType() == DOCUMENT_TYPE_DRAW) )
{
@@ -1852,7 +1836,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
/*********************************************************************
|* Liste der betroffenen Standard- und Notizseiten erstellen
\********************************************************************/
- List* pPageList = new List;
+ std::vector<SdPage*> aPageList;
if (bMaster)
{
for (sal_uInt16 nPage = 1; nPage < GetPageCount(); nPage++)
@@ -1861,25 +1845,24 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
const String s(pPage->GetLayoutName());
if(s == aOldPageLayoutName)
{
- pPageList->Insert(pPage, LIST_APPEND);
+ aPageList.push_back(pPage);
}
}
}
else
{
- pPageList->Insert(pSelectedPage, LIST_APPEND);
- pPageList->Insert(pNotes, LIST_APPEND);
+ aPageList.push_back(pSelectedPage);
+ aPageList.push_back(pNotes);
}
/*********************************************************************
|* An den betroffenen Seiten Praesentations- und Autolayout setzen
\********************************************************************/
- pPage = (SdPage*)pPageList->First();
- while(pPage)
+ for ( std::vector<SdPage*>::iterator pIter = aPageList.begin(); pIter != aPageList.end(); ++pIter )
{
- AutoLayout eOldAutoLayout = pPage->GetAutoLayout();
+ AutoLayout eOldAutoLayout = (*pIter)->GetAutoLayout();
AutoLayout eNewAutoLayout =
- pPage->GetPageKind() == PK_STANDARD ? AUTOLAYOUT_NONE : AUTOLAYOUT_NOTES;
+ (*pIter)->GetPageKind() == PK_STANDARD ? AUTOLAYOUT_NONE : AUTOLAYOUT_NOTES;
if( bUndo )
{
@@ -1887,18 +1870,13 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
new SdPresentationLayoutUndoAction
(this, aOldLayoutName, aName,
eOldAutoLayout, eNewAutoLayout, sal_True,
- pPage);
+ *pIter);
pUndoMgr->AddUndoAction(pPLUndoAction);
}
- pPage->SetPresentationLayout(aName);
- pPage->SetAutoLayout(eNewAutoLayout);
-
- pPage = (SdPage*)pPageList->Next();
+ (*pIter)->SetPresentationLayout(aName);
+ (*pIter)->SetAutoLayout(eNewAutoLayout);
}
-
- // Seitenliste loeschen
- delete pPageList;
}
/*********************************************************************
commit 839cb94a2bd9dfadb6a7e11a97f0540a78f79b6b
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Mar 27 11:38:34 2012 -0430
Replace deprecated List for std::vector<SdPage*>.
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 5693d47..8a95289 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1664,12 +1664,12 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
}
// Liste mit Seiten fuellen
- List* pPageList = new List;
+ std::vector<SdPage*> aPageList;
// #98456, this has to be removed according to CL (KA 07/08/2002)
// #109884# but we need them again to restore the styles of the presentation objects while undo
- pPageList->Insert(pMaster, LIST_APPEND);
- pPageList->Insert(pNotesMaster, LIST_APPEND);
+ aPageList.push_back(pMaster);
+ aPageList.push_back(pNotesMaster);
if (bMaster || bLayoutReloaded)
{
@@ -1679,21 +1679,20 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
String aTest = pPage->GetLayoutName();
if (aTest == aOldPageLayoutName)
{
- pPageList->Insert(pPage, LIST_APPEND);
+ aPageList.push_back(pPage);
}
}
}
else
{
- pPageList->Insert(pSelectedPage, LIST_APPEND);
- pPageList->Insert(pNotes, LIST_APPEND);
+ aPageList.push_back(pSelectedPage);
+ aPageList.push_back(pNotes);
}
- pPage = (SdPage*)pPageList->First();
- while (pPage)
+ for (std::vector<SdPage*>::iterator pIter = aPageList.begin(); pIter != aPageList.end(); ++pIter)
{
- AutoLayout eAutoLayout = pPage->GetAutoLayout();
+ AutoLayout eAutoLayout = (*pIter)->GetAutoLayout();
if( bUndo )
{
@@ -1702,15 +1701,12 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
(this,
pPage->IsMasterPage() ? aLayoutName : aOldLayoutName,
aLayoutName,
- eAutoLayout, eAutoLayout, sal_False, pPage);
+ eAutoLayout, eAutoLayout, sal_False, *pIter);
pUndoMgr->AddUndoAction(pPLUndoAction);
}
- pPage->SetPresentationLayout(aLayoutName);
- pPage->SetAutoLayout(eAutoLayout);
-
- pPage = (SdPage*)pPageList->Next();
+ (*pIter)->SetPresentationLayout(aLayoutName);
+ (*pIter)->SetAutoLayout(eAutoLayout);
}
- delete pPageList;
/*********************************************************************
|* Neue Masterpages angleichen
commit 2ea6cc6a70c569f38d4feb7f402709b38055970f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Apr 11 15:14:45 2012 +0100
fix misleading variable name prefix notation
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 354389a..5693d47 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -580,19 +580,19 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
for (nBMSdPage=0; nBMSdPage < nBMSdPageCount; nBMSdPage++)
{
SdPage* pBMPage = pBookmarkDoc->GetSdPage(nBMSdPage, PK_STANDARD);
- String pName( pBMPage->GetName() );
+ String sName( pBMPage->GetName() );
sal_Bool bIsMasterPage;
if (bLink)
{
// Es werden sich die Namen aller Seiten gemerkt
- aNameMap.insert(std::make_pair(nBMSdPage,pName));
+ aNameMap.insert(std::make_pair(nBMSdPage,sName));
}
// Have to check for duplicate names here, too
// don't change name if source and dest model are the same!
if( pBookmarkDoc != this &&
- GetPageByName(pName, bIsMasterPage ) != SDRPAGE_NOTFOUND )
+ GetPageByName(sName, bIsMasterPage ) != SDRPAGE_NOTFOUND )
{
// delay renaming *after* pages are copied (might destroy source otherwise)
aRenameSet.insert(nBMSdPage);
commit b5f44caaed5b89e6d620ca2bc421af8c922bc0b8
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Mar 27 11:31:42 2012 -0430
Replace deprecated List class for std::map<sal_uInt16,rtl::OUString>.
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 65e47e7..354389a 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -573,9 +573,9 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
sal_uInt16 nActualInsertPos = nInsertPos;
- List aNameList;
- std::set<sal_uInt16> aRenameSet;
sal_uInt16 nBMSdPage;
+ std::set<sal_uInt16> aRenameSet;
+ std::map<sal_uInt16,rtl::OUString> aNameMap;
for (nBMSdPage=0; nBMSdPage < nBMSdPageCount; nBMSdPage++)
{
@@ -586,7 +586,7 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
if (bLink)
{
// Es werden sich die Namen aller Seiten gemerkt
- aNameList.Insert(new String(pName), nBMSdPage);
+ aNameMap.insert(std::make_pair(nBMSdPage,pName));
}
// Have to check for duplicate names here, too
@@ -612,7 +612,6 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
{
SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
SdPage* pNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
- String* pName = (String*) aNameList.GetObject(nBMSdPage);
// delay renaming *after* pages are copied (might destroy source otherwise)
if( aRenameSet.find(nBMSdPage) != aRenameSet.end() )
@@ -625,10 +624,11 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
if (bLink)
{
+ String aName(aNameMap[nBMSdPage]);
+
// Nun werden die Link-Namen zusammengestellt
pPage->SetFileName(aBookmarkName);
- pPage->SetBookmarkName(*(pName));
- delete pName;
+ pPage->SetBookmarkName(aName);
pPage->SetModel(this);
}
commit 30fee1f94d67e53312f8d5ca72627882eb408664
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Mar 27 11:29:42 2012 -0430
Remove usage of List in InsertBookmarkAsPage_FindDuplicateLayouts.
Use vector<rtl::OUString> instead of deprecated List class.
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index d78a8af..65e47e7 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -336,14 +336,15 @@ void SdDrawDocument::IterateBookmarkPages( SdDrawDocument* pBookmarkDoc, List* p
class InsertBookmarkAsPage_FindDuplicateLayouts : public SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
{
public:
- InsertBookmarkAsPage_FindDuplicateLayouts( List* pLayoutsToTransfer, SdDrawDocument* pBookmarkDoc,
+ InsertBookmarkAsPage_FindDuplicateLayouts( std::vector<rtl::OUString> *pLayoutsToTransfer,
+ SdDrawDocument* pBookmarkDoc,
List* pBookmarkList, sal_uInt16 nBMSdPageCount ) :
mpLayoutsToTransfer(pLayoutsToTransfer), mpBookmarkDoc(pBookmarkDoc),
mpBookmarkList(pBookmarkList), mnBMSdPageCount(nBMSdPageCount) {}
virtual ~InsertBookmarkAsPage_FindDuplicateLayouts() {};
virtual void operator()( SdDrawDocument&, SdPage* );
private:
- List* mpLayoutsToTransfer;
+ std::vector<rtl::OUString> *mpLayoutsToTransfer;
SdDrawDocument* mpBookmarkDoc;
List* mpBookmarkList;
sal_uInt16 mnBMSdPageCount;
@@ -354,20 +355,15 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
// now check for duplicate masterpage and layout names
// ===================================================
- String sFullLayoutName( pBMMPage->GetLayoutName() );
- String* pLayout = new String(sFullLayoutName);
- pLayout->Erase( pLayout->SearchAscii( SD_LT_SEPARATOR ));
+ String aFullNameLayout( pBMMPage->GetLayoutName() );
+ aFullNameLayout.Erase( aFullNameLayout.SearchAscii( SD_LT_SEPARATOR ));
- String* pTest = (String*) mpLayoutsToTransfer->First();
- sal_Bool bFound = sal_False;
+ rtl::OUString aLayout(aFullNameLayout);
- while (pTest && !bFound) // found yet?
- {
- if (*pLayout == *pTest)
- bFound = sal_True;
- else
- pTest = (String*)mpLayoutsToTransfer->Next();
- }
+ std::vector<rtl::OUString>::const_iterator pIter =
+ find(mpLayoutsToTransfer->begin(),mpLayoutsToTransfer->end(),aLayout);
+
+ bool bFound = pIter != mpLayoutsToTransfer->end();
const sal_uInt16 nMPageCount = rDoc.GetMasterPageCount();
for (sal_uInt16 nMPage = 0; nMPage < nMPageCount && !bFound; nMPage++)
@@ -376,17 +372,17 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
* Gibt es die Layouts schon im Dokument?
**************************************************************/
SdPage* pTestPage = (SdPage*) rDoc.GetMasterPage(nMPage);
- String aTest(pTestPage->GetLayoutName());
- aTest.Erase( aTest.SearchAscii( SD_LT_SEPARATOR ));
+ String aFullTest(pTestPage->GetLayoutName());
+ aFullTest.Erase( aFullTest.SearchAscii( SD_LT_SEPARATOR ));
+
+ rtl::OUString aTest(aFullTest);
- if (aTest == *pLayout)
- bFound = sal_True;
+ if (aTest == aLayout)
+ bFound = true;
}
if (!bFound)
- mpLayoutsToTransfer->Insert(pLayout, LIST_APPEND);
- else
- delete pLayout;
+ mpLayoutsToTransfer->push_back(aLayout);
}
/** Just add one page to the container given to the constructor.
@@ -520,12 +516,11 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_INSERTPAGES)), String());
}
- List* pLayoutsToTransfer = new List;
-
//
// Refactored copy'n'pasted layout name collection into IterateBookmarkPages
//
- InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( pLayoutsToTransfer, pBookmarkDoc,
+ std::vector<rtl::OUString> aLayoutsToTransfer;
+ InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( &aLayoutsToTransfer, pBookmarkDoc,
pBookmarkList, nBMSdPageCount );
IterateBookmarkPages( pBookmarkDoc, pBookmarkList, nBMSdPageCount, aSearchFunctor );
@@ -535,18 +530,19 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
**************************************************************************/
SdStyleSheetPool* pBookmarkStyleSheetPool =
(SdStyleSheetPool*) pBookmarkDoc->GetStyleSheetPool();
- String* pLayout = (String*) pLayoutsToTransfer->First();
// Wenn Vorlagen kopiert werden muessen, dann muessen auch die
// MasterPages kopiert werden!
- if( pLayout )
+ if( !aLayoutsToTransfer.empty() )
bMergeMasterPages = sal_True;
- while (pLayout)
+ std::vector<rtl::OUString>::const_iterator pIter;
+ for ( pIter = aLayoutsToTransfer.begin(); pIter != aLayoutsToTransfer.end(); ++pIter )
{
SdStyleSheetVector aCreatedStyles;
+ String layoutName = *pIter;
- ((SdStyleSheetPool*)GetStyleSheetPool())->CopyLayoutSheets(*pLayout, *pBookmarkStyleSheetPool,aCreatedStyles);
+ ((SdStyleSheetPool*)GetStyleSheetPool())->CopyLayoutSheets(layoutName, *pBookmarkStyleSheetPool,aCreatedStyles);
if(!aCreatedStyles.empty())
{
@@ -556,14 +552,8 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
pUndoMgr->AddUndoAction(pMovStyles);
}
}
-
- delete pLayout;
-
- pLayout = (String*)pLayoutsToTransfer->Next();
}
- delete pLayoutsToTransfer;
-
/**************************************************************************
* Dokument einfuegen
**************************************************************************/
commit bb455be919554a412bc95d9a9e196bdeed106237
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Apr 11 14:56:41 2012 +0100
use a String through-out in order that logic via CheckPageName is unchanged
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 9ed7b3d..a30d114 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -1013,11 +1013,10 @@ bool View::GetExchangeList (std::vector<rtl::OUString> &rExchangeList,
std::vector<rtl::OUString>::const_iterator pIter;
for ( pIter = rBookmarkList.begin(); bNameOK && pIter != rBookmarkList.end(); ++pIter )
{
- String tmp = *pIter; ///TODO: remove when CreateSvxNameDialog uses OUString!!
- rtl::OUString aNewName = *pIter;
+ String aNewName = *pIter;
if( nType == 0 || nType == 2 )
- bNameOK = mpDocSh->CheckPageName(mpViewSh->GetActiveWindow(), tmp);
+ bNameOK = mpDocSh->CheckPageName(mpViewSh->GetActiveWindow(), aNewName);
if( bNameOK && ( nType == 1 || nType == 2 ) )
{
@@ -1030,7 +1029,7 @@ bool View::GetExchangeList (std::vector<rtl::OUString> &rExchangeList,
AbstractSvxNameDialog* pDlg = 0;
if (pFact)
- pDlg = pFact->CreateSvxNameDialog( mpViewSh->GetActiveWindow(), tmp, aDesc );
+ pDlg = pFact->CreateSvxNameDialog( mpViewSh->GetActiveWindow(), aNewName, aDesc );
if( pDlg )
{
@@ -1041,9 +1040,9 @@ bool View::GetExchangeList (std::vector<rtl::OUString> &rExchangeList,
while( !bNameOK && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( tmp );
+ pDlg->GetName( aNewName );
- if( !mrDoc.GetObj( tmp ) )
+ if( !mrDoc.GetObj( aNewName ) )
bNameOK = true;
}
@@ -1052,7 +1051,7 @@ bool View::GetExchangeList (std::vector<rtl::OUString> &rExchangeList,
}
}
- bListIdentical = (*pIter == aNewName);
+ bListIdentical = pIter->equals(aNewName);
rExchangeList.push_back(aNewName);
}
commit 5b47338f50395e9697c14af1d98ac9081e611e16
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Mar 25 16:31:29 2012 -0430
Overload View::GetExchangeList to use vector instead of List.
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 3e71252..99901a5 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -168,6 +168,21 @@ public:
sal_Bool GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType );
+ /*************************************************************************
+ |*
+ |* Rueckgabeparameter:
+ |* pExchangeList == NULL -> Namen sind alle eindeutig
+ |* bNameOK == sal_False -> Benutzer hat abgebrochen
+ |* nType == 0 -> Seiten
+ |* nType == 1 -> Objekte
+ |* nType == 2 -> Seiten + Objekte
+ |*
+ \************************************************************************/
+
+ bool GetExchangeList( std::vector<rtl::OUString> &rExchangeList,
+ std::vector<rtl::OUString> &rBookmarkList,
+ const sal_uInt16 nType );
+
virtual void onAccessibilityOptionsChanged();
virtual SdrModel* GetMarkedObjModel() const;
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 2a62767..9ed7b3d 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -1001,6 +1001,69 @@ sal_Bool View::GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_
return( bNameOK );
}
+bool View::GetExchangeList (std::vector<rtl::OUString> &rExchangeList,
+ std::vector<rtl::OUString> &rBookmarkList,
+ const sal_uInt16 nType)
+{
+ assert(rExchangeList.empty());
+
+ bool bListIdentical = true; // BookmarkList und ExchangeList sind gleich
+ bool bNameOK = true; // Name ist eindeutig
+
+ std::vector<rtl::OUString>::const_iterator pIter;
+ for ( pIter = rBookmarkList.begin(); bNameOK && pIter != rBookmarkList.end(); ++pIter )
+ {
+ String tmp = *pIter; ///TODO: remove when CreateSvxNameDialog uses OUString!!
+ rtl::OUString aNewName = *pIter;
+
+ if( nType == 0 || nType == 2 )
+ bNameOK = mpDocSh->CheckPageName(mpViewSh->GetActiveWindow(), tmp);
+
+ if( bNameOK && ( nType == 1 || nType == 2 ) )
+ {
+ if( mrDoc.GetObj( aNewName ) )
+ {
+ rtl::OUString aTitle( ResId::toString(SdResId( STR_TITLE_NAMEGROUP ) ) ) ;
+ rtl::OUString aDesc( ResId::toString(SdResId( STR_DESC_NAMEGROUP ) ) );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxNameDialog* pDlg = 0;
+
+ if (pFact)
+ pDlg = pFact->CreateSvxNameDialog( mpViewSh->GetActiveWindow(), tmp, aDesc );
+
+ if( pDlg )
+ {
+ pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_OBJECT );
+
+ bNameOK = false;
+ pDlg->SetText( aTitle );
+
+ while( !bNameOK && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( tmp );
+
+ if( !mrDoc.GetObj( tmp ) )
+ bNameOK = true;
+ }
+
+ delete pDlg;
+ }
+ }
+ }
+
+ bListIdentical = (*pIter == aNewName);
+
+ rExchangeList.push_back(aNewName);
+ }
+
+ // ExchangeList ist mit BookmarkList identisch
+ if( !rExchangeList.empty() && bListIdentical )
+ rExchangeList.clear();
+
+ return bNameOK;
+}
+
typedef std::vector< std::pair< sal_uInt32, sal_uInt32 > > PathSurrogateVector;
typedef std::vector< SdrObject* > SdrObjectVector;
commit 656f560585e96b697ce6955cff30b1064a79c2c4
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Mar 25 16:27:08 2012 -0430
Overload AbstractSdInsertPagesObjsDlg::GetList.
- Use vector instead of deprecated List class.
- Use OUString instead of String.
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index 8d3e6c0..8a78929 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -30,7 +30,10 @@
// include ---------------------------------------------------------------
+#include <vector>
+
#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
#include <tools/solar.h>
#include <tools/string.hxx>
#include <sfx2/sfxdlg.hxx>
@@ -137,6 +140,7 @@ class AbstractSdInsertPagesObjsDlg : public VclAbstractDialog //add for SdInser
public:
virtual ::Window* GetWindow() = 0; //this method is added for return a ::Window type pointer
virtual List* GetList( sal_uInt16 nType ) = 0;
+ virtual void GetList ( const sal_uInt16 nType, std::vector<rtl::OUString> &rEntries ) = 0;
virtual sal_Bool IsLink() = 0;
virtual sal_Bool IsRemoveUnnessesaryMasterPages() const = 0;
};
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 7133599..9837d70 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -286,6 +286,12 @@ List* AbstractSdInsertPagesObjsDlg_Impl::GetList( sal_uInt16 nType )
{
return pDlg->GetList( nType );
}
+
+void AbstractSdInsertPagesObjsDlg_Impl::GetList (const sal_uInt16 nType, std::vector<rtl::OUString> &rEntries)
+{
+ pDlg->GetList(nType,rEntries);
+}
+
sal_Bool AbstractSdInsertPagesObjsDlg_Impl::IsLink()
{
return pDlg->IsLink();
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 829932f..db5c9c9 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -188,6 +188,7 @@ class AbstractSdInsertPagesObjsDlg_Impl : public AbstractSdInsertPagesObjsDlg
DECL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl,SdInsertPagesObjsDlg)
virtual ::Window * GetWindow(); //this method is added for return a Window type pointer
virtual List* GetList( sal_uInt16 nType );
+ virtual void GetList ( const sal_uInt16 nType, std::vector<rtl::OUString> &rEntries);
virtual sal_Bool IsLink();
virtual sal_Bool IsRemoveUnnessesaryMasterPages() const;
};
commit 70263d2e6166f8ea171e1871d9896325c7d8efdf
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Mar 25 11:24:05 2012 -0430
Overload SdInsertPagesObjsDlg::GetList.
To return selected entries to a vector instead to a deprecated List structure.
diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx
index 4387afe..f9770fd 100644
--- a/sd/source/ui/dlg/inspagob.cxx
+++ b/sd/source/ui/dlg/inspagob.cxx
@@ -142,6 +142,26 @@ List* SdInsertPagesObjsDlg::GetList( sal_uInt16 nType )
return( aLbTree.GetSelectEntryList( nType ) );
}
+void SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType, std::vector<rtl::OUString> &rEntries )
+{
+ // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL
+ // zurueckgegeben werden
+ if( pMedium )
+ {
+ // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind
+ // (Wenn gesamtes Dokument ausgewaehlt wurde)
+ aLbTree.GetBookmarkDoc();
+
+ // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist,
+ // wird das gesamte Dokument (und nicht mehr!) eingefuegt.
+ if( aLbTree.GetSelectionCount() == 0 ||
+ ( aLbTree.IsSelected( aLbTree.First() ) ) )
+ return;
+ }
+
+ aLbTree.GetSelectEntryList( nType,rEntries );
+}
+
/*************************************************************************
|*
|* Ist Verknuepfung gechecked
diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx
index 7a112df..c6d2f49 100644
--- a/sd/source/ui/inc/inspagob.hxx
+++ b/sd/source/ui/inc/inspagob.hxx
@@ -62,6 +62,17 @@ public:
~SdInsertPagesObjsDlg();
List* GetList( sal_uInt16 nType );
+
+ /*************************************************************************
+ |*
+ |* Liefert die Liste zurueck
+ |* nType == 0 -> Seiten
+ |* nType == 1 -> Objekte
+ |*
+ \************************************************************************/
+
+ void GetList ( const sal_uInt16 nType, std::vector<rtl::OUString> &rEntries);
+
sal_Bool IsLink();
sal_Bool IsRemoveUnnessesaryMasterPages() const;
};
commit 8c67fd76ab34edb69df7ae321930bcd2b4181cd1
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Mar 25 11:10:34 2012 -0430
Overload SdPageObjsTLB::GetSelectEntryList.
To return selected entries to a vector instead to a deprecated
List structure.
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 7132739..492c44c 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -693,6 +693,21 @@ List* SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth )
return( pList );
}
+void SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth, std::vector<rtl::OUString> &rEntries ) const
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+
+ while( pEntry )
+ {
+ sal_uInt16 nListDepth = GetModel()->GetDepth( pEntry );
+
+ if( nListDepth == nDepth )
+ rEntries.push_back(GetEntryText(pEntry));
+
+ pEntry = NextSelected( pEntry );
+ }
+}
+
/*************************************************************************
|*
|* Eintraege werden erst auf Anforderung (Doppelklick) eingefuegt
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 1c9d5b5..509fbbd 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -207,6 +207,17 @@ public:
sal_Bool SelectEntry( const String& rName );
String GetSelectEntry();
List* GetSelectEntryList( sal_uInt16 nDepth );
+
+ /*************************************************************************
+ |*
+ |* Selektierte Eintrage zurueckgeben
+ |* nDepth == 0 -> Seiten
+ |* nDepth == 1 -> Objekte
+ |*
+ \************************************************************************/
+
+ void GetSelectEntryList (sal_uInt16 nDepth, std::vector<rtl::OUString> &rEntries) const;
+
SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = NULL);
::sd::DrawDocShell* GetDropDocSh() { return(mpDropDocSh); }
More information about the Libreoffice-commits
mailing list