LibreOffice Module sd (master) 1
Static Public Member Functions | Static Private Member Functions | List of all members
sd::sidebar::DocumentHelper Class Reference

A collection of methods supporting the handling of master pages. More...

#include <DocumentHelper.hxx>

Static Public Member Functions

static SdPageCopyMasterPageToLocalDocument (SdDrawDocument &rTargetDocument, SdPage *pMasterPage)
 Return a copy of the given master page in the given document. More...
 
static SdPageGetSlideForMasterPage (SdPage const *pMasterPage)
 Return and, when not yet present, create a slide that uses the given master page. More...
 
static void ProvideStyles (SdDrawDocument const &rSourceDocument, SdDrawDocument &rTargetDocument, SdPage const *pPage)
 Copy the styles used by the given page from the source document to the target document. More...
 
static void AssignMasterPageToPageList (SdDrawDocument &rTargetDocument, SdPage *pMasterPage, const std::shared_ptr< std::vector< SdPage * > > &rPageList)
 Assign the given master page to the list of pages. More...
 

Static Private Member Functions

static SdPageAddMasterPage (SdDrawDocument &rTargetDocument, SdPage const *pMasterPage)
 
static SdPageAddMasterPage (SdDrawDocument &rTargetDocument, SdPage const *pMasterPage, sal_uInt16 nInsertionIndex)
 
static SdPageProvideMasterPage (SdDrawDocument &rTargetDocument, SdPage *pMasterPage, const std::shared_ptr< std::vector< SdPage * > > &rpPageList)
 
static void AssignMasterPageToPage (SdPage const *pMasterPage, std::u16string_view rsBaseLayoutName, SdPage *pPage)
 Assign the given master page to the given page. More...
 

Detailed Description

A collection of methods supporting the handling of master pages.

Definition at line 36 of file DocumentHelper.hxx.

Member Function Documentation

◆ AddMasterPage() [1/2]

SdPage * sd::sidebar::DocumentHelper::AddMasterPage ( SdDrawDocument rTargetDocument,
SdPage const *  pMasterPage 
)
staticprivate

◆ AddMasterPage() [2/2]

SdPage * sd::sidebar::DocumentHelper::AddMasterPage ( SdDrawDocument rTargetDocument,
SdPage const *  pMasterPage,
sal_uInt16  nInsertionIndex 
)
staticprivate

◆ AssignMasterPageToPage()

void sd::sidebar::DocumentHelper::AssignMasterPageToPage ( SdPage const *  pMasterPage,
std::u16string_view  rsBaseLayoutName,
SdPage pPage 
)
staticprivate

Assign the given master page to the given page.

In here we have to handle three cases:

Parameters
pMasterPageIn contrast to AssignMasterPageToPageList() this page is assumed to be in the target document, i.e. the same document that pPage is in. The caller will usually call AddMasterPage() to create a clone of a master page in another document to create it.
rsBaseLayoutNameThe layout name of the given master page. It is given so that it has not to be created on every call. It could be generated from the given master page, though.
pPageThe page to which to assign the master page. It can be a slide or a master page itself.
  1. pPage is a normal slide. We can use SetMasterPage to assign the master pages to it.
  2. pPage is a master page that is used by at least one slide. We can assign the master page to these slides.
  3. pPage is a master page that is currently not used by any slide. We can delete that page and add copies of the given master pages instead.

For points 2 and 3 where one master page A is assigned to another B we have to keep in mind that the master page that page A has already been inserted into the target document.

Definition at line 391 of file DocumentHelper.cxx.

References SdDrawDocument::GetDocSh(), SdrPageProperties::GetItemSet(), SdrPage::GetPageNum(), SdDrawDocument::GetSdPage(), SdDrawDocument::GetSdPageCount(), SdrPage::getSdrModelFromSdrPage(), SdrPage::getSdrPageProperties(), SdrPage::IsMasterPage(), SdrPageProperties::PutItem(), SdDrawDocument::RemoveUnnecessaryMasterPages(), SdDrawDocument::SetMasterPage(), Standard, SdrPage::TRG_GetMasterPage(), and SdrPage::TRG_HasMasterPage().

Referenced by AssignMasterPageToPageList().

◆ AssignMasterPageToPageList()

void sd::sidebar::DocumentHelper::AssignMasterPageToPageList ( SdDrawDocument rTargetDocument,
SdPage pMasterPage,
const std::shared_ptr< std::vector< SdPage * > > &  rPageList 
)
static

Assign the given master page to the list of pages.

Parameters
rTargetDocumentThe document that is the owner of the pages in rPageList.
pMasterPageThis master page will usually be a member of the list of all available master pages as provided by the MasterPageContainer.
rPageListThe pages to which to assign the master page. These pages may be slides or master pages themselves.

Definition at line 282 of file DocumentHelper.cxx.

References AssignMasterPageToPage(), SfxUndoManager::EnterListAction(), SdDrawDocument::GetDocSh(), SdPage::GetLayoutName(), SdrPage::IsMasterPage(), SfxUndoManager::LeaveListAction(), nIndex, ProvideMasterPage(), SD_LT_SEPARATOR, and SdResId().

Referenced by sd::sidebar::MasterPagesSelector::AssignMasterPageToPageList().

◆ CopyMasterPageToLocalDocument()

SdPage * sd::sidebar::DocumentHelper::CopyMasterPageToLocalDocument ( SdDrawDocument rTargetDocument,
SdPage pMasterPage 
)
static

◆ GetSlideForMasterPage()

SdPage * sd::sidebar::DocumentHelper::GetSlideForMasterPage ( SdPage const *  pMasterPage)
static

Return and, when not yet present, create a slide that uses the given master page.

Definition at line 155 of file DocumentHelper.cxx.

References SdDrawDocument::GetSdPage(), SdDrawDocument::GetSdPageCount(), SdrPage::getSdrModelFromSdrPage(), Standard, and SdrPage::TRG_GetMasterPage().

Referenced by sd::sidebar::MasterPageDescriptor::UpdatePageObject().

◆ ProvideMasterPage()

SdPage * sd::sidebar::DocumentHelper::ProvideMasterPage ( SdDrawDocument rTargetDocument,
SdPage pMasterPage,
const std::shared_ptr< std::vector< SdPage * > > &  rpPageList 
)
staticprivate

◆ ProvideStyles()

void sd::sidebar::DocumentHelper::ProvideStyles ( SdDrawDocument const &  rSourceDocument,
SdDrawDocument rTargetDocument,
SdPage const *  pPage 
)
static

Copy the styles used by the given page from the source document to the target document.

Definition at line 245 of file DocumentHelper.cxx.

References SfxUndoManager::AddUndoAction(), SdStyleSheetPool::CopyLayoutSheets(), SdDrawDocument::GetDocSh(), SdPage::GetLayoutName(), SdrModel::GetStyleSheetPool(), nIndex, and SD_LT_SEPARATOR.

Referenced by AddMasterPage().


The documentation for this class was generated from the following files: