LibreOffice Module sd (master) 1
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
sd::sidebar::MasterPageDescriptor Class Reference

A collection of data that is stored for every master page in the MasterpageContainer. More...

#include <MasterPageDescriptor.hxx>

Collaboration diagram for sd::sidebar::MasterPageDescriptor:
[legend]

Classes

class  AllComparator
 
class  PageObjectComparator
 
class  StyleNameComparator
 
class  URLComparator
 

Public Types

enum  URLClassification {
  URLCLASS_USER ,
  URLCLASS_LAYOUT ,
  URLCLASS_PRESENTATION ,
  URLCLASS_OTHER ,
  URLCLASS_UNKNOWN ,
  URLCLASS_UNDETERMINED
}
 

Public Member Functions

 MasterPageDescriptor (MasterPageContainer::Origin eOrigin, const sal_Int32 nTemplateIndex, std::u16string_view rURL, OUString sPageName, OUString sStyleName, const bool bIsPrecious, std::shared_ptr< PageObjectProvider > pPageObjectProvider, std::shared_ptr< PreviewProvider > pPreviewProvider)
 
void SetToken (MasterPageContainer::Token aToken)
 
::std::unique_ptr< std::vector< MasterPageContainerChangeEvent::EventType > > Update (const MasterPageDescriptor &rDescriptor)
 Update the called MasterPageDescriptor object with values from the given one. More...
 
const ImageGetPreview (MasterPageContainer::PreviewSize ePreviewSize) const
 This convenience method returns either a small or a large preview, depending on the given size specifier. More...
 
bool UpdatePreview (sal_Int32 nCostThreshold, const Size &rSmallSize, const Size &rLargeSize, ::sd::PreviewRenderer &rRenderer)
 Use the PreviewProvider to get access to a preview of the master page. More...
 
int UpdatePageObject (sal_Int32 nCostThreshold, SdDrawDocument *pDocument)
 Use the PageObjectProvider to get access to the master page object. More...
 
URLClassification GetURLClassification ()
 

Public Attributes

MasterPageContainer::Token maToken
 The Token under which the MasterPageContainer gives access to the object. More...
 
MasterPageContainer::Origin meOrigin
 A rough specification of the origin of the master page. More...
 
OUString msURL
 The URL is not empty for master pages loaded from a template document. More...
 
OUString msPageName
 Taken from the title of the template file. More...
 
OUString msStyleName
 Taken from the master page object. More...
 
const bool mbIsPrecious
 
SdPagempMasterPage
 The actual master page. More...
 
SdPagempSlide
 A slide that uses the master page. More...
 
Image maSmallPreview
 A small (the default size) preview of the master page. More...
 
Image maLargePreview
 A large preview of the master page. More...
 
std::shared_ptr< PreviewProvidermpPreviewProvider
 The preview provider. More...
 
std::shared_ptr< PageObjectProvidermpPageObjectProvider
 The master page provider. More...
 
sal_Int32 mnTemplateIndex
 This index represents the order in which templates are provided via the TemplateScanner. More...
 
URLClassification meURLClassification
 
sal_Int32 mnUseCount
 

Detailed Description

A collection of data that is stored for every master page in the MasterpageContainer.

Definition at line 39 of file MasterPageDescriptor.hxx.

Member Enumeration Documentation

◆ URLClassification

Enumerator
URLCLASS_USER 
URLCLASS_LAYOUT 
URLCLASS_PRESENTATION 
URLCLASS_OTHER 
URLCLASS_UNKNOWN 
URLCLASS_UNDETERMINED 

Definition at line 131 of file MasterPageDescriptor.hxx.

Constructor & Destructor Documentation

◆ MasterPageDescriptor()

sd::sidebar::MasterPageDescriptor::MasterPageDescriptor ( MasterPageContainer::Origin  eOrigin,
const sal_Int32  nTemplateIndex,
std::u16string_view  rURL,
OUString  sPageName,
OUString  sStyleName,
const bool  bIsPrecious,
std::shared_ptr< PageObjectProvider pPageObjectProvider,
std::shared_ptr< PreviewProvider pPreviewProvider 
)

Definition at line 35 of file MasterPageDescriptor.cxx.

References mnUseCount.

Member Function Documentation

◆ GetPreview()

const Image & sd::sidebar::MasterPageDescriptor::GetPreview ( MasterPageContainer::PreviewSize  ePreviewSize) const

This convenience method returns either a small or a large preview, depending on the given size specifier.

Note that the previews are not created when they are not present.

Returns
The returned preview may be empty.

Definition at line 65 of file MasterPageDescriptor.cxx.

References maLargePreview, maSmallPreview, and sd::sidebar::MasterPageContainer::SMALL.

◆ GetURLClassification()

MasterPageDescriptor::URLClassification sd::sidebar::MasterPageDescriptor::GetURLClassification ( )

◆ SetToken()

void sd::sidebar::MasterPageDescriptor::SetToken ( MasterPageContainer::Token  aToken)

Definition at line 60 of file MasterPageDescriptor.cxx.

References maToken.

◆ Update()

std::unique_ptr< std::vector< MasterPageContainerChangeEvent::EventType > > sd::sidebar::MasterPageDescriptor::Update ( const MasterPageDescriptor rDescriptor)

Update the called MasterPageDescriptor object with values from the given one.

Only those values are updated that have default values in the called object and that have non-default values in the given one.

Returns
Returns a list of event types for which event notifications have to be sent to listeners. The list may be empty or NULL.

Definition at line 74 of file MasterPageDescriptor.cxx.

References sd::sidebar::MasterPageContainerChangeEvent::DATA_CHANGED, sd::sidebar::MasterPageContainerChangeEvent::INDEX_CHANGED, meOrigin, mnTemplateIndex, mpPageObjectProvider, mpPreviewProvider, msPageName, msStyleName, msURL, sd::sidebar::MasterPageContainerChangeEvent::PREVIEW_CHANGED, and sd::sidebar::MasterPageContainer::UNKNOWN.

◆ UpdatePageObject()

int sd::sidebar::MasterPageDescriptor::UpdatePageObject ( sal_Int32  nCostThreshold,
SdDrawDocument pDocument 
)

Use the PageObjectProvider to get access to the master page object.

Note that this is only done, when either bForce is <TRUE> or the PreviewProvider::GetCostIndex() returns 0.

Parameters
nCostThresholdWhen this is zero or positive then the page object is created only when the page object provider has a cost equal to or smaller than this threshold. A negative value forces the page object be created, regardless of the cost.
pDocumentThis document of the MasterPageContainer may be used to create a page object with or store one in.
Returns
When the master page object is successfully provided then 1 is returned, on no change then a 0 is provided, on a masterpage-error a -1 is provided.

Definition at line 140 of file MasterPageDescriptor.cxx.

References sd::sidebar::DocumentHelper::CopyMasterPageToLocalDocument(), SdPage::GetName(), sd::sidebar::DocumentHelper::GetSlideForMasterPage(), maLargePreview, maSmallPreview, sd::sidebar::MasterPageContainer::MASTERPAGE, mbIsPrecious, meOrigin, mpMasterPage, mpPageObjectProvider, mpPreviewProvider, mpSlide, msPageName, msStyleName, SAL_WARN, and SdPage::SetPrecious().

◆ UpdatePreview()

bool sd::sidebar::MasterPageDescriptor::UpdatePreview ( sal_Int32  nCostThreshold,
const Size rSmallSize,
const Size rLargeSize,
::sd::PreviewRenderer rRenderer 
)

Use the PreviewProvider to get access to a preview of the master page.

Note that this is only done, when either bForce is <TRUE> or the PreviewProvider::GetCostIndex() returns 0.

The small preview is created by scaling the large one, not by calling PreviewProvider::operator() a second time.

It is the responsibility of the caller to call UpdatePageObject() before calling this method when the PreviewProvider can only work when the master page object is present, i.e. its NeedsPageObject() method returns <TRUE>.

Parameters
nCostThresholdWhen this is zero or positive then the preview is created only when the preview provider has a cost equal to or smaller than this threshold. A negative value forces the preview to be created, regardless of the cost.
rSmallSizeSize of the small preview.
rLargeSizeSize of the large preview.
rRendererA PreviewRenderer object that may be used to create a preview.
Returns
When the previews are successfully provided then <TRUE> is returned.

Definition at line 192 of file MasterPageDescriptor.cxx.

References Image::GetBitmapEx(), Image::GetSizePixel(), maLargePreview, maSmallPreview, mpMasterPage, mpPreviewProvider, mpSlide, sd::PreviewRenderer::ScaleBitmap(), and Size::Width().

Member Data Documentation

◆ maLargePreview

Image sd::sidebar::MasterPageDescriptor::maLargePreview

A large preview of the master page.

May be empty. When this larger preview is not empty then the smaller one is not empty, too.

Definition at line 183 of file MasterPageDescriptor.hxx.

Referenced by GetPreview(), UpdatePageObject(), and UpdatePreview().

◆ maSmallPreview

Image sd::sidebar::MasterPageDescriptor::maSmallPreview

A small (the default size) preview of the master page.

May be empty. When this smaller preview is not empty then the larger one is not empty, too.

Definition at line 178 of file MasterPageDescriptor.hxx.

Referenced by GetPreview(), UpdatePageObject(), and UpdatePreview().

◆ maToken

MasterPageContainer::Token sd::sidebar::MasterPageDescriptor::maToken

The Token under which the MasterPageContainer gives access to the object.

Definition at line 145 of file MasterPageDescriptor.hxx.

Referenced by SetToken().

◆ mbIsPrecious

const bool sd::sidebar::MasterPageDescriptor::mbIsPrecious

Definition at line 164 of file MasterPageDescriptor.hxx.

Referenced by UpdatePageObject().

◆ meOrigin

MasterPageContainer::Origin sd::sidebar::MasterPageDescriptor::meOrigin

A rough specification of the origin of the master page.

Definition at line 149 of file MasterPageDescriptor.hxx.

Referenced by Update(), and UpdatePageObject().

◆ meURLClassification

URLClassification sd::sidebar::MasterPageDescriptor::meURLClassification

Definition at line 201 of file MasterPageDescriptor.hxx.

Referenced by GetURLClassification().

◆ mnTemplateIndex

sal_Int32 sd::sidebar::MasterPageDescriptor::mnTemplateIndex

This index represents the order in which templates are provided via the TemplateScanner.

It defines the order in which the entries in the AllMasterPagesSelector are displayed. The default value is -1.

Definition at line 199 of file MasterPageDescriptor.hxx.

Referenced by Update().

◆ mnUseCount

sal_Int32 sd::sidebar::MasterPageDescriptor::mnUseCount

Definition at line 203 of file MasterPageDescriptor.hxx.

◆ mpMasterPage

SdPage* sd::sidebar::MasterPageDescriptor::mpMasterPage

◆ mpPageObjectProvider

std::shared_ptr<PageObjectProvider> sd::sidebar::MasterPageDescriptor::mpPageObjectProvider

The master page provider.

May be empty. May be replaced during the lifetime of a MasterPageDescriptor object.

Definition at line 193 of file MasterPageDescriptor.hxx.

Referenced by Update(), and UpdatePageObject().

◆ mpPreviewProvider

std::shared_ptr<PreviewProvider> sd::sidebar::MasterPageDescriptor::mpPreviewProvider

The preview provider.

May be empty. May be replaced during the lifetime of a MasterPageDescriptor object.

Definition at line 188 of file MasterPageDescriptor.hxx.

Referenced by Update(), UpdatePageObject(), and UpdatePreview().

◆ mpSlide

SdPage* sd::sidebar::MasterPageDescriptor::mpSlide

A slide that uses the master page.

Definition at line 172 of file MasterPageDescriptor.hxx.

Referenced by UpdatePageObject(), and UpdatePreview().

◆ msPageName

OUString sd::sidebar::MasterPageDescriptor::msPageName

Taken from the title of the template file.

Definition at line 158 of file MasterPageDescriptor.hxx.

Referenced by Update(), and UpdatePageObject().

◆ msStyleName

OUString sd::sidebar::MasterPageDescriptor::msStyleName

Taken from the master page object.

Definition at line 162 of file MasterPageDescriptor.hxx.

Referenced by sd::sidebar::MasterPageDescriptor::StyleNameComparator::operator()(), Update(), and UpdatePageObject().

◆ msURL

OUString sd::sidebar::MasterPageDescriptor::msURL

The URL is not empty for master pages loaded from a template document.

Definition at line 154 of file MasterPageDescriptor.hxx.

Referenced by GetURLClassification(), sd::sidebar::MasterPageDescriptor::URLComparator::operator()(), and Update().


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