void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
{
sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PageKind::Standard); // Remember the names of the master pages that have been inserted to // avoid double insertion.
::std::set<OUString> aMasterPageNames; for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
{
SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PageKind::Standard); if (pMasterPage == nullptr) continue;
// Use the name of the master page to avoid duplicate entries.
OUString sName (pMasterPage->GetName()); if (!aMasterPageNames.insert(sName).second) continue;
// Look up the master page in the container and, when it is not yet // in it, insert it.
MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage); if (aToken == MasterPageContainer::NIL_TOKEN)
{
SharedMasterPageDescriptor pDescriptor = std::make_shared<MasterPageDescriptor>(
MasterPageContainer::MASTERPAGE,
nIndex,
OUString(),
pMasterPage->GetName(),
OUString(),
pMasterPage->IsPrecious(),
std::make_shared<ExistingPageProvider>(pMasterPage),
std::make_shared<PagePreviewProvider>());
aToken = mpContainer->PutMasterPage(pDescriptor);
}
void CurrentMasterPagesSelector::UpdateSelection()
{ // Iterate over all pages and for the selected ones put the name of // their master page into a set.
sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PageKind::Standard);
::std::set<OUString> aNames;
sal_uInt16 nIndex; bool bLoop (true); for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++)
{
SdPage* pPage = mrDocument.GetSdPage (nIndex, PageKind::Standard); if (pPage != nullptr && pPage->IsSelected())
{ if ( ! pPage->TRG_HasMasterPage())
{ // One of the pages has no master page. This is an // indicator for that this method is called in the middle of // a document change and that the model is not in a valid // state. Therefore we stop update the selection and wait // for another call to UpdateSelection when the model is // valid again.
bLoop = false;
} else
{
SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
assert(dynamic_cast<SdPage*>(&rMasterPage));
aNames.insert(static_cast<SdPage&>(rMasterPage).GetName());
}
}
}
}
void CurrentMasterPagesSelector::ExecuteCommand(const OUString &rIdent)
{ if (rIdent == "delete")
{ // Check once again that the master page can safely be deleted, // i.e. is not used.
SdPage* pMasterPage = GetSelectedMasterPage(); if (pMasterPage != nullptr
&& mrDocument.GetMasterPageUserCount(pMasterPage) == 0)
{ // Removing the precious flag so that the following call to // RemoveUnnecessaryMasterPages() will remove this master page.
pMasterPage->SetPrecious(false);
mrDocument.RemoveUnnecessaryMasterPages(pMasterPage);
}
} else
MasterPagesSelector::ExecuteCommand(rIdent);
}
void CurrentMasterPagesSelector::ProcessPopupMenu(weld::Menu& rMenu)
{ // Disable the delete entry when there is only one master page. if (mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0)
rMenu.set_sensitive(u"delete"_ustr, false);
IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener,
sd::tools::EventMultiplexerEvent&, rEvent, void)
{ switch (rEvent.meEventId)
{ case EventMultiplexerEventId::CurrentPageChanged: case EventMultiplexerEventId::EditModeNormal: case EventMultiplexerEventId::EditModeMaster: case EventMultiplexerEventId::SlideSortedSelection:
UpdateSelection(); break;
case EventMultiplexerEventId::PageOrder: // This is tricky. If a master page is removed, moved, or // added we have to wait until both the notes master page // and the standard master page have been removed, moved, // or added. We do this by looking at the number of master // pages which has to be odd in the consistent state (the // handout master page is always present). If the number is // even we ignore the hint. if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1)
MasterPagesSelector::Fill(); break;
case EventMultiplexerEventId::ShapeChanged: case EventMultiplexerEventId::ShapeInserted: case EventMultiplexerEventId::ShapeRemoved:
InvalidatePreview(static_cast<const SdPage*>(rEvent.mpUserData)); break; default: break;
}
}
¤ 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.0.12Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
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.