summaryrefslogtreecommitdiff
path: root/sd/source/core/drawdoc3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/core/drawdoc3.cxx')
-rw-r--r--sd/source/core/drawdoc3.cxx892
1 files changed, 3 insertions, 889 deletions
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index d75ef2075b4d..63ce713db394 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -129,79 +129,6 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
\************************************************************************/
void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBookmarkDoc,
- List* pBookmarkList, sal_uInt16 nBMSdPageCount,
- InsertBookmarkAsPage_FindDuplicateLayouts& rPageIterator )
-{
- //
- // Refactored copy'n'pasted layout name collection from InsertBookmarkAsPage
- //
- int nPos, nEndPos;
-
- if( !pBookmarkList )
- {
- // no list? whole source document
- nEndPos = nBMSdPageCount;
- }
- else
- {
- // bookmark list? number of entries
- nEndPos = pBookmarkList->Count();
- }
-
- SdPage* pBMPage;
-
- // iterate over number of pages to insert
- for (nPos = 0; nPos < nEndPos; ++nPos)
- {
- // the master page associated to the nPos'th page to insert
- SdPage* pBMMPage = NULL;
-
- if( !pBookmarkList )
- {
- // simply take master page of nPos'th page in source document
- pBMMPage = (SdPage*)(&(pBookmarkDoc->GetSdPage((sal_uInt16)nPos, PK_STANDARD)->TRG_GetMasterPage()));
- }
- else
- {
- // fetch nPos'th entry from bookmark list, and determine master page
- String aBMPgName (*(String*) pBookmarkList->GetObject(nPos));
- sal_Bool bIsMasterPage;
-
- sal_uInt16 nBMPage = pBookmarkDoc->GetPageByName( aBMPgName, bIsMasterPage );
-
- if (nBMPage != SDRPAGE_NOTFOUND)
- {
- pBMPage = (SdPage*) pBookmarkDoc->GetPage(nBMPage);
- }
- else
- {
- pBMPage = NULL;
- }
-
- // enforce that bookmarked page is a standard page and not already a master page
- if (pBMPage && pBMPage->GetPageKind()==PK_STANDARD && !pBMPage->IsMasterPage())
- {
- const sal_uInt16 nBMSdPage = (nBMPage - 1) / 2;
- pBMMPage = (SdPage*) (&(pBookmarkDoc->GetSdPage(nBMSdPage, PK_STANDARD)->TRG_GetMasterPage()));
- }
- }
-
- // successfully determined valid (bookmarked) page?
- if( pBMMPage )
- {
- // yes, call functor
- rPageIterator( rDoc, pBMMPage );
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Fuegt ein Bookmark als Seite ein
-|*
-\************************************************************************/
-
-void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBookmarkDoc,
const std::vector<rtl::OUString> &rBookmarkList, sal_uInt16 nBMSdPageCount,
InsertBookmarkAsPage_FindDuplicateLayouts& rPageIterator )
{
@@ -366,78 +293,6 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(const String& rBookmarkFile)
\************************************************************************/
sal_Bool SdDrawDocument::InsertBookmark(
- List* pBookmarkList, // Liste der Namen der einzufuegenden Bookmarks
- List* pExchangeList, // Liste der zu verwendenen Namen
- sal_Bool bLink, // Bookmarks sollen als Verknuepfung eingefuegt werden
- sal_Bool bReplace, // Aktuellen Seiten (Standard&Notiz) werden ersetzt
- sal_uInt16 nInsertPos, // Einfuegeposition fuer Seiten
- sal_Bool bNoDialogs, // Keine Dialoge anzeigen
- ::sd::DrawDocShell* pBookmarkDocSh, // Wenn gesetzt, so ist dieses das Source-Dokument
- sal_Bool bCopy, // Seiten werden kopiert
- Point* pObjPos) // Einfuegeposition fuer Objekte
-{
- sal_Bool bOK = sal_True;
- sal_Bool bInsertPages = sal_False;
-
- if (!pBookmarkList)
- {
- /**********************************************************************
- * Alle Seiten werden eingefuegt
- **********************************************************************/
- bInsertPages = sal_True;
- }
- else
- {
- SdDrawDocument* pBookmarkDoc = NULL;
- String aBookmarkName;
-
- if (pBookmarkDocSh)
- {
- pBookmarkDoc = pBookmarkDocSh->GetDoc();
- aBookmarkName = pBookmarkDocSh->GetMedium()->GetName();
- }
- else if ( mxBookmarkDocShRef.Is() )
- {
- pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
- aBookmarkName = maBookmarkFile;
- }
- else
- bOK = sal_False;
-
- for (sal_uInt16 nPos = 0; bOK && ( nPos < pBookmarkList->Count() ) && !bInsertPages; nPos++)
- {
- /******************************************************************
- * Gibt es in der Bookmark-Liste einen Seitennamen?
- ******************************************************************/
- String aBMPgName (*(String*) pBookmarkList->GetObject(nPos));
- sal_Bool bIsMasterPage;
-
- if( pBookmarkDoc->GetPageByName( aBMPgName, bIsMasterPage ) != SDRPAGE_NOTFOUND )
- {
- // Seite gefunden
- bInsertPages = sal_True;
- }
- }
- }
-
- if ( bOK && bInsertPages )
- {
- // Zuerst werden alle Seiten-Bookmarks eingefuegt
- bOK = InsertBookmarkAsPage(pBookmarkList, pExchangeList, bLink, bReplace,
- nInsertPos, bNoDialogs, pBookmarkDocSh, bCopy, sal_True, sal_False);
- }
-
- if ( bOK && pBookmarkList )
- {
- // Es werden alle Objekt-Bookmarks eingefuegt
- bOK = InsertBookmarkAsObject(pBookmarkList, pExchangeList, bLink,
- pBookmarkDocSh, pObjPos);
- }
-
- return bOK;
-}
-
-sal_Bool SdDrawDocument::InsertBookmark(
const std::vector<rtl::OUString> &rBookmarkList, // Liste der Namen der einzufuegenden Bookmarks
std::vector<rtl::OUString> &rExchangeList, // Liste der zu verwendenen Namen
sal_Bool bLink, // Bookmarks sollen als Verknuepfung eingefuegt werden
@@ -513,560 +368,6 @@ sal_Bool SdDrawDocument::InsertBookmark(
}
sal_Bool SdDrawDocument::InsertBookmarkAsPage(
- List* pBookmarkList,
- List* pExchangeList, // Liste der zu verwendenen Namen
- sal_Bool bLink,
- sal_Bool bReplace,
- sal_uInt16 nInsertPos,
- sal_Bool bNoDialogs,
- ::sd::DrawDocShell* pBookmarkDocSh,
- sal_Bool bCopy,
- sal_Bool bMergeMasterPages,
- sal_Bool bPreservePageNames)
-{
- sal_Bool bOK = sal_True;
- sal_Bool bContinue = sal_True;
- sal_Bool bScaleObjects = sal_False;
- sal_uInt16 nReplacedStandardPages = 0;
-
- SdDrawDocument* pBookmarkDoc = NULL;
- String aBookmarkName;
-
- if (pBookmarkDocSh)
- {
- pBookmarkDoc = pBookmarkDocSh->GetDoc();
-
- if (pBookmarkDocSh->GetMedium())
- {
- aBookmarkName = pBookmarkDocSh->GetMedium()->GetName();
- }
- }
- else if ( mxBookmarkDocShRef.Is() )
- {
- pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
- aBookmarkName = maBookmarkFile;
- }
- else
- {
- return sal_False;
- }
-
- const sal_uInt16 nSdPageCount = GetSdPageCount(PK_STANDARD);
- const sal_uInt16 nBMSdPageCount = pBookmarkDoc->GetSdPageCount(PK_STANDARD);
- const sal_uInt16 nMPageCount = GetMasterPageCount();
-
- if (nSdPageCount==0 || nBMSdPageCount==0 || nMPageCount==0)
- {
- bContinue = bOK = sal_False;
- return(bContinue);
- }
-
- // Store the size and some other properties of the first page and notes
- // page so that inserted pages can be properly scaled even when inserted
- // before the first page.
- // Note that the pointers are used later on as general page pointers.
- SdPage* pRefPage = GetSdPage(0, PK_STANDARD);
- Size aSize(pRefPage->GetSize());
- sal_Int32 nLeft = pRefPage->GetLftBorder();
- sal_Int32 nRight = pRefPage->GetRgtBorder();
- sal_Int32 nUpper = pRefPage->GetUppBorder();
- sal_Int32 nLower = pRefPage->GetLwrBorder();
- Orientation eOrient = pRefPage->GetOrientation();
-
- SdPage* pNPage = GetSdPage(0, PK_NOTES);
- Size aNSize(GetSdPage(0, PK_NOTES)->GetSize());
- sal_Int32 nNLeft = pNPage->GetLftBorder();
- sal_Int32 nNRight = pNPage->GetRgtBorder();
- sal_Int32 nNUpper = pNPage->GetUppBorder();
- sal_Int32 nNLower = pNPage->GetLwrBorder();
- Orientation eNOrient = pRefPage->GetOrientation();
-
- // Seitengroesse und -raender an die Werte der letzten
- // Seiten anpassen?
- pRefPage = GetSdPage(nSdPageCount - 1, PK_STANDARD);
-
- if( bNoDialogs )
- {
- if( !pBookmarkList )
- bScaleObjects = pRefPage->IsScaleObjects();
- else
- bScaleObjects = sal_True;
- }
- else
- {
- SdPage* pBMPage = pBookmarkDoc->GetSdPage(0,PK_STANDARD);
-
- if (pBMPage->GetSize() != pRefPage->GetSize() ||
- pBMPage->GetLftBorder() != pRefPage->GetLftBorder() ||
- pBMPage->GetRgtBorder() != pRefPage->GetRgtBorder() ||
- pBMPage->GetUppBorder() != pRefPage->GetUppBorder() ||
- pBMPage->GetLwrBorder() != pRefPage->GetLwrBorder())
- {
- String aStr(SdResId(STR_SCALE_OBJECTS));
- sal_uInt16 nBut = QueryBox( NULL, WB_YES_NO_CANCEL, aStr).Execute();
-
- bScaleObjects = nBut == RET_YES;
- bContinue = nBut != RET_CANCEL;
-
- if (!bContinue)
- {
- return(bContinue);
- }
- }
- }
-
-
- /**************************************************************************
- |* Die benoetigten Praesentations-StyleSheets ermitteln und vor
- |* den Seiten transferieren, sonst verlieren die Textobjekte
- |* beim Transfer den Bezug zur Vorlage
- \*************************************************************************/
- ::svl::IUndoManager* pUndoMgr = NULL;
- if( mpDocSh )
- {
- pUndoMgr = mpDocSh->GetUndoManager();
- pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_INSERTPAGES)), String());
- }
-
- //
- // Refactored copy'n'pasted layout name collection into IterateBookmarkPages
- //
- std::vector<rtl::OUString> aLayoutsToTransfer;
- InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( aLayoutsToTransfer );
- lcl_IterateBookmarkPages( *this, pBookmarkDoc, pBookmarkList, nBMSdPageCount, aSearchFunctor );
-
-
- /**************************************************************************
- * Die tatsaechlich benoetigten Vorlagen kopieren
- **************************************************************************/
- SdStyleSheetPool* pBookmarkStyleSheetPool =
- (SdStyleSheetPool*) pBookmarkDoc->GetStyleSheetPool();
-
- // Wenn Vorlagen kopiert werden muessen, dann muessen auch die
- // MasterPages kopiert werden!
- if( !aLayoutsToTransfer.empty() )
- bMergeMasterPages = sal_True;
-
- std::vector<rtl::OUString>::const_iterator pIter;
- for ( pIter = aLayoutsToTransfer.begin(); pIter != aLayoutsToTransfer.end(); ++pIter )
- {
- SdStyleSheetVector aCreatedStyles;
- String layoutName = *pIter;
-
- ((SdStyleSheetPool*)GetStyleSheetPool())->CopyLayoutSheets(layoutName, *pBookmarkStyleSheetPool,aCreatedStyles);
-
- if(!aCreatedStyles.empty())
- {
- if( pUndoMgr )
- {
- SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction(this, aCreatedStyles, sal_True);
- pUndoMgr->AddUndoAction(pMovStyles);
- }
- }
- }
-
- /**************************************************************************
- * Dokument einfuegen
- **************************************************************************/
-
- const bool bUndo = IsUndoEnabled();
-
- if( bUndo )
- BegUndo(String(SdResId(STR_UNDO_INSERTPAGES)));
-
- if (!pBookmarkList)
- {
- if (nInsertPos >= GetPageCount())
- {
- // Seiten werden hinten angefuegt
- nInsertPos = GetPageCount();
- }
-
- sal_uInt16 nActualInsertPos = nInsertPos;
-
- sal_uInt16 nBMSdPage;
- std::set<sal_uInt16> aRenameSet;
- std::map<sal_uInt16,rtl::OUString> aNameMap;
-
- for (nBMSdPage=0; nBMSdPage < nBMSdPageCount; nBMSdPage++)
- {
- SdPage* pBMPage = pBookmarkDoc->GetSdPage(nBMSdPage, PK_STANDARD);
- String sName( pBMPage->GetName() );
- sal_Bool bIsMasterPage;
-
- if (bLink)
- {
- // Es werden sich die Namen aller Seiten gemerkt
- 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(sName, bIsMasterPage ) != SDRPAGE_NOTFOUND )
- {
- // delay renaming *after* pages are copied (might destroy source otherwise)
- aRenameSet.insert(nBMSdPage);
- }
- }
-
- Merge(*pBookmarkDoc,
- 1, // Nicht die Handzettelseite
- 0xFFFF, // Aber alle anderen
- nActualInsertPos, // An Position einfuegen
- bMergeMasterPages, // MasterPages mitnehmen
- sal_False, // Aber nur die benoetigten MasterPages
- sal_True, // Undo-Aktion erzeugen
- bCopy); // Seiten kopieren (oder mergen)
-
- for (nBMSdPage=0; nBMSdPage < nBMSdPageCount; nBMSdPage++)
- {
- SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
- SdPage* pNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
-
- // delay renaming *after* pages are copied (might destroy source otherwise)
- if( aRenameSet.find(nBMSdPage) != aRenameSet.end() )
- {
- // Seitenname schon vorhanden -> Defaultname
- // fuer Standard & Notizseite
- pPage->SetName(String());
- pNotesPage->SetName(String());
- }
-
- if (bLink)
- {
- String aName(aNameMap[nBMSdPage]);
-
- // Nun werden die Link-Namen zusammengestellt
- pPage->SetFileName(aBookmarkName);
- pPage->SetBookmarkName(aName);
- pPage->SetModel(this);
- }
-
- nActualInsertPos += 2;
- }
- }
- else
- {
- /**********************************************************************
- * Ausgewaehlte Seiten einfuegen
- **********************************************************************/
- SdPage* pBMPage;
-
- if (nInsertPos >= GetPageCount())
- {
- // Seiten werden hinten angefuegt
- bReplace = sal_False;
- nInsertPos = GetPageCount();
- }
-
- sal_uInt16 nActualInsertPos = nInsertPos;
-
- // Collect the bookmarked pages.
- ::std::vector<SdPage*> aBookmarkedPages (pBookmarkList->Count(), NULL);
- for (sal_uInt16 nPos = 0; nPos < pBookmarkList->Count(); nPos++)
- {
- String aPgName(*(String*) pBookmarkList->GetObject(nPos));
- sal_Bool bIsMasterPage;
- sal_uInt16 nBMPage = pBookmarkDoc->GetPageByName( aPgName, bIsMasterPage );
-
- if (nBMPage != SDRPAGE_NOTFOUND)
- {
- aBookmarkedPages[nPos] = dynamic_cast<SdPage*>(pBookmarkDoc->GetPage(nBMPage));
- }
- }
-
- for (sal_uInt16 nPos = 0; nPos < pBookmarkList->Count(); nPos++)
- {
- pBMPage = aBookmarkedPages[nPos];
- sal_uInt16 nBMPage = pBMPage!=NULL ? pBMPage->GetPageNum() : SDRPAGE_NOTFOUND;
-
- if (pBMPage && pBMPage->GetPageKind()==PK_STANDARD && !pBMPage->IsMasterPage())
- {
- /**************************************************************
- * Es muss eine StandardSeite sein
- **************************************************************/
- sal_Bool bMustRename = sal_False;
-
- // delay renaming *after* pages are copied (might destroy source otherwise)
- // don't change name if source and dest model are the same!
- // avoid renaming if replacing the same page
- String aPgName(*(String*) pBookmarkList->GetObject(nPos));
- sal_Bool bIsMasterPage;
- sal_uInt16 nPageSameName = GetPageByName(aPgName, bIsMasterPage);
- if( pBookmarkDoc != this &&
- nPageSameName != SDRPAGE_NOTFOUND &&
- ( !bReplace ||
- nPageSameName != nActualInsertPos ) )
- {
- bMustRename = sal_True;
- }
-
- SdPage* pBookmarkPage = pBMPage;
- if (bReplace )
- {
- ReplacePageInCustomShows( dynamic_cast< SdPage* >( GetPage( nActualInsertPos ) ), pBookmarkPage );
- }
-
- Merge(*pBookmarkDoc,
- nBMPage, // Von Seite (Standard)
- nBMPage+1, // Bis Seite (Notizen)
- nActualInsertPos, // An Position einfuegen
- bMergeMasterPages, // MasterPages mitnehmen
- sal_False, // Aber nur die benoetigten MasterPages
- sal_True, // Undo-Aktion erzeugen
- bCopy); // Seiten kopieren (oder mergen)
-
- if( bReplace )
- {
- if( GetPage( nActualInsertPos ) != pBookmarkPage )
- {
- // bookmark page was not moved but cloned, so update custom shows again
- ReplacePageInCustomShows( pBookmarkPage, dynamic_cast< SdPage* >( GetPage( nActualInsertPos ) ) );
- }
- }
-
- if( bMustRename )
- {
- // Seitenname schon vorhanden -> Defaultname
- // fuer Standard & Notizseite
- SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
- pPage->SetName(String());
- SdPage* pNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
- pNotesPage->SetName(String());
- }
-
- if (bLink)
- {
- SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
- pPage->SetFileName(aBookmarkName);
- pPage->SetBookmarkName(aPgName);
- pPage->SetModel(this);
- }
-
- if (bReplace)
- {
- // Seite & Notizseite ausfuegen
- const sal_uInt16 nDestPageNum(nActualInsertPos + 2);
- SdPage* pStandardPage = 0L;
-
- if(nDestPageNum < GetPageCount())
- {
- pStandardPage = (SdPage*)GetPage(nDestPageNum);
- }
-
- if (pStandardPage)
- {
- if( bPreservePageNames )
- {
- // Take old slide names for inserted pages
- SdPage* pPage = (SdPage*) GetPage(nActualInsertPos);
- pPage->SetName( pStandardPage->GetRealName() );
- }
-
- if( bUndo )
- AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pStandardPage));
-
- RemovePage(nDestPageNum);
-
- if( !bUndo )
- delete pStandardPage;
- }
-
- SdPage* pNotesPage = 0L;
-
- if(nDestPageNum < GetPageCount())
- {
- pNotesPage = (SdPage*)GetPage(nDestPageNum);
- }
-
- if (pNotesPage)
- {
- if( bPreservePageNames )
- {
- // Take old slide names for inserted pages
- SdPage* pNewNotesPage = (SdPage*) GetPage(nActualInsertPos+1);
- if( pNewNotesPage )
- pNewNotesPage->SetName( pStandardPage->GetRealName() );
- }
-
- if( bUndo )
- AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
-
- RemovePage(nDestPageNum);
-
- if( !bUndo )
- delete pNotesPage;
- }
-
- nReplacedStandardPages++;
- }
-
- nActualInsertPos += 2;
- }
- }
- }
-
-
- /**************************************************************************
- |* Dabei sind evtl. zu viele Masterpages ruebergekommen, da die
- |* DrawingEngine gleiche Praesentationslayouts nicht erkennen kann.
- |* Ueberzaehlige MasterPages entfernen.
- \*************************************************************************/
- sal_uInt16 nNewMPageCount = GetMasterPageCount();
-
- // rueckwaerts, damit Nummern nicht durcheinander geraten
- for (sal_uInt16 nPage = nNewMPageCount - 1; nPage >= nMPageCount; nPage--)
- {
- pRefPage = (SdPage*) GetMasterPage(nPage);
- String aMPLayout(pRefPage->GetLayoutName());
- PageKind eKind = pRefPage->GetPageKind();
-
- // gibt's den schon?
- for (sal_uInt16 nTest = 0; nTest < nMPageCount; nTest++)
- {
- SdPage* pTest = (SdPage*) GetMasterPage(nTest);
- String aTest(pTest->GetLayoutName());
-
- // nInsertPos > 2 is always true when inserting into non-empty models
- if ( nInsertPos > 2 &&
- aTest == aMPLayout &&
- eKind == pTest->GetPageKind() )
- {
- if( bUndo )
- AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pRefPage));
-
- RemoveMasterPage(nPage);
-
- if( !bUndo )
- delete pRefPage;
- nNewMPageCount--;
- break;
- }
- }
- }
-
- // nInsertPos > 2 is always true when inserting into non-empty models
- if (nInsertPos > 0)
- {
- sal_uInt16 nSdPageStart = (nInsertPos - 1) / 2;
- sal_uInt16 nSdPageEnd = GetSdPageCount(PK_STANDARD) - nSdPageCount +
- nSdPageStart - 1;
- const bool bRemoveEmptyPresObj = pBookmarkDoc &&
- (pBookmarkDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) &&
- (GetDocumentType() == DOCUMENT_TYPE_DRAW);
-
- if( bReplace )
- {
- nSdPageEnd = nSdPageStart + nReplacedStandardPages - 1;
- }
-
- for (sal_uInt16 nSdPage = nSdPageStart; nSdPage <= nSdPageEnd; nSdPage++)
- {
- pRefPage = GetSdPage(nSdPage, PK_STANDARD);
-
- if (pExchangeList)
- {
- // Zuverwendener Name aus Exchange-Liste holen
- if (pExchangeList->GetCurObject())
- {
- String aExchangeName (*(String*) pExchangeList->GetCurObject());
- pRefPage->SetName(aExchangeName);
- SdrHint aHint(HINT_PAGEORDERCHG);
- aHint.SetPage(pRefPage);
- Broadcast(aHint);
- SdPage* pNewNotesPage = GetSdPage(nSdPage, PK_NOTES);
- pNewNotesPage->SetName(aExchangeName);
- aHint.SetPage(pNewNotesPage);
- Broadcast(aHint);
- }
-
- pExchangeList->Next();
- }
-
- String aLayout(pRefPage->GetLayoutName());
- aLayout.Erase(aLayout.SearchAscii( SD_LT_SEPARATOR ));
-
- // update layout and referred master page
- pRefPage->SetPresentationLayout(aLayout);
- if( bUndo )
- AddUndo( GetSdrUndoFactory().CreateUndoPageChangeMasterPage( *pRefPage ) );
-
- if (bScaleObjects)
- {
- Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
- pRefPage->ScaleObjects(aSize, aBorderRect, sal_True);
- }
- pRefPage->SetSize(aSize);
- pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
- pRefPage->SetOrientation( eOrient );
-
- if( bRemoveEmptyPresObj )
- pRefPage->RemoveEmptyPresentationObjects();
-
- pRefPage = GetSdPage(nSdPage, PK_NOTES);
-
- // update layout and referred master page
- pRefPage->SetPresentationLayout(aLayout);
- if( bUndo )
- AddUndo( GetSdrUndoFactory().CreateUndoPageChangeMasterPage( *pRefPage ) );
-
- if (bScaleObjects)
- {
- Rectangle aBorderRect(nNLeft, nNUpper, nNRight, nNLower);
- pRefPage->ScaleObjects(aNSize, aBorderRect, sal_True);
- }
-
- pRefPage->SetSize(aNSize);
- pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
- pRefPage->SetOrientation( eNOrient );
-
- if( bRemoveEmptyPresObj )
- pRefPage->RemoveEmptyPresentationObjects();
- }
-
- for (sal_uInt16 nPage = nMPageCount; nPage < nNewMPageCount; nPage++)
- {
- pRefPage = (SdPage*) GetMasterPage(nPage);
- if (pRefPage->GetPageKind() == PK_STANDARD)
- {
- if (bScaleObjects)
- {
- Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
- pRefPage->ScaleObjects(aSize, aBorderRect, sal_True);
- }
- pRefPage->SetSize(aSize);
- pRefPage->SetBorder(nLeft, nUpper, nRight, nLower);
- pRefPage->SetOrientation( eOrient );
- }
- else // kann nur noch NOTES sein
- {
- if (bScaleObjects)
- {
- Rectangle aBorderRect(nNLeft, nNUpper, nNRight, nNLower);
- pRefPage->ScaleObjects(aNSize, aBorderRect, sal_True);
- }
- pRefPage->SetSize(aNSize);
- pRefPage->SetBorder(nNLeft, nNUpper, nNRight, nNLower);
- pRefPage->SetOrientation( eNOrient );
- }
-
- if( bRemoveEmptyPresObj )
- pRefPage->RemoveEmptyPresentationObjects();
- }
- }
-
- // Make absolutely sure no double masterpages are there
- RemoveUnnecessaryMasterPages(NULL, sal_True, sal_True);
-
- if( bUndo )
- EndUndo();
- pUndoMgr->LeaveListAction();
-
- return bContinue;
-}
-
-sal_Bool SdDrawDocument::InsertBookmarkAsPage(
const std::vector<rtl::OUString> &rBookmarkList,
std::vector<rtl::OUString> &rExchangeList, // Liste der zu verwendenen Namen
sal_Bool bLink,
@@ -1245,19 +546,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);
@@ -1628,193 +929,6 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
\************************************************************************/
sal_Bool SdDrawDocument::InsertBookmarkAsObject(
- List* pBookmarkList,
- List* pExchangeList, // Liste der zu verwendenen Namen
- sal_Bool /* bLink */,
- ::sd::DrawDocShell* pBookmarkDocSh,
- Point* pObjPos)
-{
- sal_Bool bOK = sal_True;
- sal_Bool bOLEObjFound = sal_False;
- ::sd::View* pBMView = NULL;
-
- SdDrawDocument* pBookmarkDoc = NULL;
- String aBookmarkName;
-
- if (pBookmarkDocSh)
- {
- pBookmarkDoc = pBookmarkDocSh->GetDoc();
-
- if (pBookmarkDocSh->GetMedium())
- {
- aBookmarkName = pBookmarkDocSh->GetMedium()->GetName();
- }
- }
- else if ( mxBookmarkDocShRef.Is() )
- {
- pBookmarkDoc = mxBookmarkDocShRef->GetDoc();
- aBookmarkName = maBookmarkFile;
- }
- else
- {
- return sal_False;
- }
-
- if (!pBookmarkList)
- {
- pBMView = new ::sd::View(*pBookmarkDoc, (OutputDevice*) NULL);
- pBMView->EndListening(*pBookmarkDoc);
- pBMView->MarkAll();
- }
- else
- {
- SdrPage* pPage;
- SdrPageView* pPV;
-
- for (sal_uInt16 nPos = 0; nPos < pBookmarkList->Count(); nPos++)
- {
- /******************************************************************
- * Namen der Bookmarks aus Liste holen
- ******************************************************************/
- String aBMName (*(String*) pBookmarkList->GetObject(nPos));
-
- SdrObject* pObj = pBookmarkDoc->GetObj(aBMName);
-
- if (pObj)
- {
- // Objekt gefunden
-
- if (pObj->GetObjInventor() == SdrInventor &&
- pObj->GetObjIdentifier() == OBJ_OLE2)
- {
- bOLEObjFound = sal_True;
- }
-
- if (!pBMView)
- {
- // View erstmalig erzeugen
- pBMView = new ::sd::View(*pBookmarkDoc, (OutputDevice*) NULL);
- pBMView->EndListening(*pBookmarkDoc);
- }
-
- pPage = pObj->GetPage();
-
- if (pPage->IsMasterPage())
- {
- pPV = pBMView->ShowSdrPage(pBMView->GetModel()->GetMasterPage(pPage->GetPageNum()));
- }
- else
- {
- pPV = pBMView->GetSdrPageView();
- if( !pPV || (pPV->GetPage() != pPage))
- pPV = pBMView->ShowSdrPage(pPage);
- }
-
- pBMView->MarkObj(pObj, pPV, sal_False);
- }
- }
- }
-
- if (pBMView)
- {
- /**********************************************************************
- * Selektierte Objekte einfuegen
- **********************************************************************/
- ::sd::View* pView = new ::sd::View(*this, (OutputDevice*) NULL);
- pView->EndListening(*this);
-
- // Seite bestimmen, auf der die Objekte eingefuegt werden sollen
- SdrPage* pPage = GetSdPage(0, PK_STANDARD);
-
- if (mpDocSh)
- {
- ::sd::ViewShell* pViewSh = mpDocSh->GetViewShell();
-
- if (pViewSh)
- {
- // Welche Seite wird denn aktuell angezeigt?
- SdrPageView* pPV = pViewSh->GetView()->GetSdrPageView();
-
- if (pPV)
- {
- pPage = pPV->GetPage();
- }
- else if (pViewSh->GetActualPage())
- {
- pPage = pViewSh->GetActualPage();
- }
- }
- }
-
- Point aObjPos;
-
- if (pObjPos)
- {
- aObjPos = *pObjPos;
- }
- else
- {
- aObjPos = Rectangle(Point(), pPage->GetSize()).Center();
- }
-
- sal_uLong nCountBefore = 0;
-
- if (pExchangeList)
- {
- // OrdNums sortieren und Anzahl Objekte vor dem Einfuegen bestimmen
- pPage->RecalcObjOrdNums();
- nCountBefore = pPage->GetObjCount();
- }
-
- if (bOLEObjFound)
- pBMView->GetDoc().SetAllocDocSh(sal_True);
-
- SdDrawDocument* pTmpDoc = (SdDrawDocument*) pBMView->GetAllMarkedModel();
- bOK = pView->Paste(*pTmpDoc, aObjPos, pPage);
-
- if (bOLEObjFound)
- pBMView->GetDoc().SetAllocDocSh(sal_False);
-
- if (!bOLEObjFound)
- delete pTmpDoc; // Wird ansonsten von der DocShell zerstoert
-
- delete pView;
-
- if (pExchangeList)
- {
- // Anzahl Objekte nach dem Einfuegen bestimmen
- sal_uLong nCount = pPage->GetObjCount();
-
- for (sal_uLong nObj = nCountBefore; nObj < nCount; nObj++)
- {
- // Zuverwendener Name aus Exchange-Liste holen
- if (pExchangeList->GetCurObject())
- {
- String aExchangeName (*(String*) pExchangeList->GetCurObject());
-
- if (pPage->GetObj(nObj))
- {
- pPage->GetObj(nObj)->SetName(aExchangeName);
- }
- }
-
- pExchangeList->Next();
- }
- }
- }
-
- delete pBMView;
-
- return bOK;
-}
-
-/*************************************************************************
-|*
-|* Fuegt ein Bookmark als Objekt ein
-|*
-\************************************************************************/
-
-sal_Bool SdDrawDocument::InsertBookmarkAsObject(
const std::vector<rtl::OUString> &rBookmarkList,
std::vector<rtl::OUString> &rExchangeList, // Liste der zu verwendenen Namen
sal_Bool /* bLink */,