if(pUndoManager->GetRedoActionCount() != 0)
{ // If another view created the first undo action, prevent redoing it from this view. const SfxUndoAction* pAction = pUndoManager->GetRedoAction(); if (pAction->GetViewShellId() != GetViewShellBase().GetViewShellId())
{
rSet.Put(SfxUInt32Item(SID_REDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)));
} else
{ // Set the necessary string like in // sfx2/source/view/viewfrm.cxx ver 1.23 ln 1081 ff.
OUString aTmp = SvtResId(STR_REDO) + pUndoManager->GetRedoActionComment();
rSet.Put(SfxStringItem(SID_REDO, aTmp));
}
} else
{
rSet.DisableItem(SID_REDO);
}
}
/** This method consists basically of three parts: 1.ProcesstheargumentsoftheSFXrequest. 2.Usethemodeltocreateanewpageorduplicateanexistingone. 3.Updatethetabcontrolandswitchtothenewpage.
*/
SdPage* ViewShell::CreateOrDuplicatePage (
SfxRequest& rRequest,
PageKind ePageKind,
SdPage* pPage, const sal_Int32 nInsertPosition)
{
sal_uInt16 nSId = rRequest.GetSlot();
SdDrawDocument* pDocument = GetDoc();
SdrLayerAdmin& rLayerAdmin = pDocument->GetLayerAdmin();
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
SdrLayerIDSet aVisibleLayers; // Determine the page from which to copy some values, such as layers, // size, master page, to the new page. This is usually the given page. // When the given page is NULL then use the first page of the document.
SdPage* pTemplatePage = pPage; if (pTemplatePage == nullptr)
pTemplatePage = pDocument->GetSdPage(0, ePageKind); if (pTemplatePage != nullptr && pTemplatePage->TRG_HasMasterPage())
aVisibleLayers = pTemplatePage->TRG_GetMasterPageVisibleLayers(); else
aVisibleLayers.SetAll();
// 1. Process the arguments. const SfxItemSet* pArgs = rRequest.GetArgs(); const SfxUInt16Item* pInsertPos = rRequest.GetArg<SfxUInt16Item>(ID_INSERT_POS);
if (! pArgs || (pArgs->Count() == 1 && pInsertPos))
{ // AutoLayouts must be ready
pDocument->StopWorkStartupDelay();
// Use the layouts of the previous page and notes page as template. if (pTemplatePage != nullptr)
{
eStandardLayout = pTemplatePage->GetAutoLayout(); if( eStandardLayout == AUTOLAYOUT_TITLE )
eStandardLayout = AUTOLAYOUT_TITLE_CONTENT;
// 2. Create a new page or duplicate an existing one.
View* pDrView = GetView(); constbool bUndo = pDrView && pDrView->IsUndoEnabled(); if( bUndo && GetDoc()->GetDocumentType() == DocumentType::Draw)
pDrView->BegUndo(SdResId(STR_INSERT_PAGE_DRAW)); elseif (bUndo)
pDrView->BegUndo(SdResId(STR_INSERTPAGE));
sal_uInt16 nNewPageIndex = 0xffff; switch (nSId)
{ case SID_INSERTPAGE: case SID_INSERTPAGE_QUICK: case SID_INSERT_MASTER_PAGE: // There are three cases. a) pPage is not NULL: we use it as a // template and create a new slide behind it. b) pPage is NULL // but the document is not empty: we use the first slide/notes // page as template, create a new slide after it and move it // then to the head of the document. c) pPage is NULL and the // document is empty: We use CreateFirstPages to create the // first page of the document. if (pPage == nullptr) if (pTemplatePage == nullptr)
{
pDocument->CreateFirstPages();
nNewPageIndex = 0;
} else
{ // Create a new page with the first page as template and // insert it after the first page.
nNewPageIndex = pDocument->CreatePage (
pTemplatePage,
ePageKind,
aStandardPageName,
aNotesPageName,
eStandardLayout,
eNotesLayout,
bIsPageBack,
bIsPageObj,
nInsertPosition); // Select exactly the new page.
sal_uInt16 nPageCount (pDocument->GetSdPageCount(ePageKind)); for (sal_uInt16 i=0; i<nPageCount; i++)
{
pDocument->GetSdPage(i, PageKind::Standard)->SetSelected(
i == nNewPageIndex);
pDocument->GetSdPage(i, PageKind::Notes)->SetSelected(
i == nNewPageIndex);
} // Move the selected page to the head of the document
pDocument->MoveSelectedPages (sal_uInt16(-1));
nNewPageIndex = 0;
} else
nNewPageIndex = pDocument->CreatePage (
pPage,
ePageKind,
aStandardPageName,
aNotesPageName,
eStandardLayout,
eNotesLayout,
bIsPageBack,
bIsPageObj,
pInsertPos ? (pInsertPos->GetValue()*2)+1 : nInsertPosition); break;
case SID_DUPLICATE_PAGE: // Duplication makes no sense when pPage is NULL. if (pPage != nullptr)
nNewPageIndex = pDocument->DuplicatePage (
pPage,
ePageKind,
aStandardPageName,
aNotesPageName,
bIsPageBack,
bIsPageObj,
pInsertPos ? (pInsertPos->GetValue()*2)+1 : nInsertPosition); break;
default:
SAL_INFO("sd", "wrong slot id given to CreateOrDuplicatePage"); // Try to handle another slot id gracefully.
}
SdPage* pNewPage = nullptr; if(nNewPageIndex != 0xffff)
pNewPage = pDocument->GetSdPage(nNewPageIndex, PageKind::Standard);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.