LibreOffice Module sd (master) 1
|
A collection of data that is stored for every master page in the MasterpageContainer. More...
#include <MasterPageDescriptor.hxx>
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 Image & | GetPreview (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 |
SdPage * | mpMasterPage |
The actual master page. More... | |
SdPage * | mpSlide |
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< PreviewProvider > | mpPreviewProvider |
The preview provider. More... | |
std::shared_ptr< PageObjectProvider > | mpPageObjectProvider |
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 |
A collection of data that is stored for every master page in the MasterpageContainer.
Definition at line 39 of file MasterPageDescriptor.hxx.
Enumerator | |
---|---|
URLCLASS_USER | |
URLCLASS_LAYOUT | |
URLCLASS_PRESENTATION | |
URLCLASS_OTHER | |
URLCLASS_UNKNOWN | |
URLCLASS_UNDETERMINED |
Definition at line 131 of file MasterPageDescriptor.hxx.
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.
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.
Definition at line 65 of file MasterPageDescriptor.cxx.
References maLargePreview, maSmallPreview, and sd::sidebar::MasterPageContainer::SMALL.
MasterPageDescriptor::URLClassification sd::sidebar::MasterPageDescriptor::GetURLClassification | ( | ) |
Definition at line 233 of file MasterPageDescriptor.cxx.
References meURLClassification, msURL, URLCLASS_LAYOUT, URLCLASS_OTHER, URLCLASS_PRESENTATION, URLCLASS_UNDETERMINED, URLCLASS_UNKNOWN, and URLCLASS_USER.
void sd::sidebar::MasterPageDescriptor::SetToken | ( | MasterPageContainer::Token | aToken | ) |
Definition at line 60 of file MasterPageDescriptor.cxx.
References maToken.
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.
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.
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.
nCostThreshold | When 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. |
pDocument | This document of the MasterPageContainer may be used to create a page object with or store one in. |
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().
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>.
nCostThreshold | When 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. |
rSmallSize | Size of the small preview. |
rLargeSize | Size of the large preview. |
rRenderer | A PreviewRenderer object that may be used to create a preview. |
Definition at line 192 of file MasterPageDescriptor.cxx.
References Image::GetBitmapEx(), Image::GetSizePixel(), maLargePreview, maSmallPreview, mpMasterPage, mpPreviewProvider, mpSlide, sd::PreviewRenderer::ScaleBitmap(), and Size::Width().
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().
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().
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().
const bool sd::sidebar::MasterPageDescriptor::mbIsPrecious |
Definition at line 164 of file MasterPageDescriptor.hxx.
Referenced by UpdatePageObject().
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().
URLClassification sd::sidebar::MasterPageDescriptor::meURLClassification |
Definition at line 201 of file MasterPageDescriptor.hxx.
Referenced by GetURLClassification().
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().
sal_Int32 sd::sidebar::MasterPageDescriptor::mnUseCount |
Definition at line 203 of file MasterPageDescriptor.hxx.
SdPage* sd::sidebar::MasterPageDescriptor::mpMasterPage |
The actual master page.
Definition at line 168 of file MasterPageDescriptor.hxx.
Referenced by sd::sidebar::MasterPageDescriptor::PageObjectComparator::operator()(), UpdatePageObject(), and UpdatePreview().
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().
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().
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().
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().
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().
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().