LibreOffice Module sd (master) 1
|
This container manages the master pages used by the MasterPagesSelector controls. More...
#include <MasterPageContainer.hxx>
Classes | |
class | Implementation |
Inner implementation class of the MasterPageContainer. More... | |
Public Types | |
enum | PreviewSize { SMALL , LARGE } |
enum | PreviewState { PS_AVAILABLE , PS_CREATABLE , PS_PREPARING , PS_NOT_AVAILABLE } |
enum | Origin { MASTERPAGE , TEMPLATE , DEFAULT , UNKNOWN } |
Each entry of the container is either the first page of a template document or is a master page of an Impress document. More... | |
typedef int | Token |
Public Member Functions | |
MasterPageContainer () | |
~MasterPageContainer () | |
void | AddChangeListener (const Link< MasterPageContainerChangeEvent &, void > &rLink) |
void | RemoveChangeListener (const Link< MasterPageContainerChangeEvent &, void > &rLink) |
void | SetPreviewSize (PreviewSize eSize) |
There are two different preview sizes, a small one and a large one. More... | |
PreviewSize | GetPreviewSize () const |
Returns the preview size. More... | |
Size const & | GetPreviewSizePixel () const |
Return the preview size in pixels. More... | |
PreviewState | GetPreviewState (Token aToken) |
bool | RequestPreview (Token aToken) |
This method is typically called for entries in the container for which GetPreviewState() returns OS_CREATABLE. More... | |
Token | PutMasterPage (const std::shared_ptr< MasterPageDescriptor > &rDescriptor) |
Put the master page identified and described by the given parameters into the container. More... | |
void | AcquireToken (Token aToken) |
void | ReleaseToken (Token aToken) |
int | GetTokenCount () const |
This and the GetTokenForIndex() methods can be used to iterate over all members of the container. More... | |
bool | HasToken (Token aToken) const |
Determine whether the container has a member for the given token. More... | |
Token | GetTokenForIndex (int nIndex) |
Return a token for an index in the range 0 <= index < GetTokenCount(). More... | |
Token | GetTokenForURL (const OUString &sURL) |
Token | GetTokenForStyleName (const OUString &sStyleName) |
Token | GetTokenForPageObject (const SdPage *pPage) |
OUString | GetURLForToken (Token aToken) |
OUString | GetPageNameForToken (Token aToken) |
OUString | GetStyleNameForToken (Token aToken) |
SdPage * | GetPageObjectForToken (Token aToken, bool bLoad) |
Origin | GetOriginForToken (Token aToken) |
sal_Int32 | GetTemplateIndexForToken (Token aToken) |
std::shared_ptr< MasterPageDescriptor > | GetDescriptorForToken (Token aToken) |
void | InvalidatePreview (Token aToken) |
Image | GetPreviewForToken (Token aToken) |
Return a preview for the specified token. More... | |
Static Public Attributes | |
static const Token | NIL_TOKEN = -1 |
Private Attributes | |
std::shared_ptr< Implementation > | mpImpl |
PreviewSize | mePreviewSize |
This container manages the master pages used by the MasterPagesSelector controls.
It uses internally a singleton implementation object. Therefore, all MasterPageContainer object operator on the same set of master pages. Each MasterPageContainer, however, has its own PreviewSize value and thus can independently switch between large and small previews.
The container maintains its own document to store master page objects.
For each master page container stores its URL, preview bitmap, page name, and, if available, the page object.
Entries are accessed via a Token, which is mostly a numerical index but whose values do not necessarily have to be consecutive.
Definition at line 48 of file MasterPageContainer.hxx.
Definition at line 51 of file MasterPageContainer.hxx.
Each entry of the container is either the first page of a template document or is a master page of an Impress document.
Enumerator | |
---|---|
MASTERPAGE | |
TEMPLATE | |
DEFAULT | |
UNKNOWN |
Definition at line 101 of file MasterPageContainer.hxx.
Enumerator | |
---|---|
SMALL | |
LARGE |
Definition at line 60 of file MasterPageContainer.hxx.
Enumerator | |
---|---|
PS_AVAILABLE | |
PS_CREATABLE | |
PS_PREPARING | |
PS_NOT_AVAILABLE |
Definition at line 81 of file MasterPageContainer.hxx.
sd::sidebar::MasterPageContainer::MasterPageContainer | ( | ) |
Definition at line 204 of file MasterPageContainer.cxx.
References mpImpl.
sd::sidebar::MasterPageContainer::~MasterPageContainer | ( | ) |
Definition at line 211 of file MasterPageContainer.cxx.
void sd::sidebar::MasterPageContainer::AcquireToken | ( | Token | aToken | ) |
Definition at line 244 of file MasterPageContainer.cxx.
References mpImpl.
void sd::sidebar::MasterPageContainer::AddChangeListener | ( | const Link< MasterPageContainerChangeEvent &, void > & | rLink | ) |
Definition at line 215 of file MasterPageContainer.cxx.
References mpImpl.
std::shared_ptr< MasterPageDescriptor > sd::sidebar::MasterPageContainer::GetDescriptorForToken | ( | MasterPageContainer::Token | aToken | ) |
Definition at line 440 of file MasterPageContainer.cxx.
References mpImpl.
MasterPageContainer::Origin sd::sidebar::MasterPageContainer::GetOriginForToken | ( | Token | aToken | ) |
Definition at line 418 of file MasterPageContainer.cxx.
OUString sd::sidebar::MasterPageContainer::GetPageNameForToken | ( | MasterPageContainer::Token | aToken | ) |
Definition at line 369 of file MasterPageContainer.cxx.
References mpImpl.
SdPage * sd::sidebar::MasterPageContainer::GetPageObjectForToken | ( | MasterPageContainer::Token | aToken, |
bool | bLoad | ||
) |
Definition at line 393 of file MasterPageContainer.cxx.
References mpImpl.
Image sd::sidebar::MasterPageContainer::GetPreviewForToken | ( | MasterPageContainer::Token | aToken | ) |
Return a preview for the specified token.
When the preview is not present then the PreviewProvider associated with the token is executed only when that is not expensive. It is the responsibility of the caller to call RequestPreview() to do the same (asynchronously) for expensive PreviewProviders. Call GetPreviewState() to find out if that is necessary.
aToken | This token specifies for which master page to return the preview. Tokens are returned for example by the GetTokenFor...() methods. |
Definition at line 453 of file MasterPageContainer.cxx.
References mePreviewSize, and mpImpl.
|
inline |
Returns the preview size.
Definition at line 75 of file MasterPageContainer.hxx.
References mePreviewSize.
Size const & sd::sidebar::MasterPageContainer::GetPreviewSizePixel | ( | ) | const |
Return the preview size in pixels.
Definition at line 233 of file MasterPageContainer.cxx.
References mePreviewSize, and mpImpl.
MasterPageContainer::PreviewState sd::sidebar::MasterPageContainer::GetPreviewState | ( | Token | aToken | ) |
Definition at line 458 of file MasterPageContainer.cxx.
References mpImpl.
Referenced by sd::sidebar::MasterPageContainer::Implementation::GetPreviewForToken().
OUString sd::sidebar::MasterPageContainer::GetStyleNameForToken | ( | MasterPageContainer::Token | aToken | ) |
Definition at line 381 of file MasterPageContainer.cxx.
References mpImpl.
sal_Int32 sd::sidebar::MasterPageContainer::GetTemplateIndexForToken | ( | Token | aToken | ) |
Definition at line 429 of file MasterPageContainer.cxx.
References mpImpl.
int sd::sidebar::MasterPageContainer::GetTokenCount | ( | ) | const |
This and the GetTokenForIndex() methods can be used to iterate over all members of the container.
Definition at line 277 of file MasterPageContainer.cxx.
References mpImpl.
MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForIndex | ( | int | nIndex | ) |
Return a token for an index in the range 0 <= index < GetTokenCount().
Definition at line 291 of file MasterPageContainer.cxx.
References HasToken(), mpImpl, NIL_TOKEN, and nIndex.
MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForPageObject | ( | const SdPage * | pPage | ) |
Definition at line 338 of file MasterPageContainer.cxx.
MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForStyleName | ( | const OUString & | sStyleName | ) |
Definition at line 320 of file MasterPageContainer.cxx.
MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForURL | ( | const OUString & | sURL | ) |
Definition at line 301 of file MasterPageContainer.cxx.
OUString sd::sidebar::MasterPageContainer::GetURLForToken | ( | MasterPageContainer::Token | aToken | ) |
Definition at line 357 of file MasterPageContainer.cxx.
References mpImpl.
bool sd::sidebar::MasterPageContainer::HasToken | ( | Token | aToken | ) | const |
Determine whether the container has a member for the given token.
Definition at line 284 of file MasterPageContainer.cxx.
References mpImpl.
Referenced by GetTokenForIndex().
void sd::sidebar::MasterPageContainer::InvalidatePreview | ( | MasterPageContainer::Token | aToken | ) |
Definition at line 448 of file MasterPageContainer.cxx.
References mpImpl.
MasterPageContainer::Token sd::sidebar::MasterPageContainer::PutMasterPage | ( | const std::shared_ptr< MasterPageDescriptor > & | rDescriptor | ) |
Put the master page identified and described by the given parameters into the container.
When there already is a master page with the given URL, page name, or object pointer (when that is not NULL) then the existing entry is replaced/updated by the given one. Otherwise a new entry is inserted.
Definition at line 238 of file MasterPageContainer.cxx.
References mpImpl.
void sd::sidebar::MasterPageContainer::ReleaseToken | ( | Token | aToken | ) |
Definition at line 253 of file MasterPageContainer.cxx.
References DEFAULT, MASTERPAGE, mpImpl, and TEMPLATE.
void sd::sidebar::MasterPageContainer::RemoveChangeListener | ( | const Link< MasterPageContainerChangeEvent &, void > & | rLink | ) |
Definition at line 220 of file MasterPageContainer.cxx.
References mpImpl.
bool sd::sidebar::MasterPageContainer::RequestPreview | ( | Token | aToken | ) |
This method is typically called for entries in the container for which GetPreviewState() returns OS_CREATABLE.
The creation of the preview is then scheduled to be executed asynchronously at a later point in time. When the preview is available the change listeners will be notified.
Definition at line 463 of file MasterPageContainer.cxx.
References mpImpl.
Referenced by sd::sidebar::MasterPageContainer::Implementation::InvalidatePreview().
void sd::sidebar::MasterPageContainer::SetPreviewSize | ( | PreviewSize | eSize | ) |
There are two different preview sizes, a small one and a large one.
Which one is used by the called container can be changed with this method. When the preview size is changed then all change listeners are notified of this.
Definition at line 225 of file MasterPageContainer.cxx.
References mePreviewSize, mpImpl, NIL_TOKEN, and sd::sidebar::MasterPageContainerChangeEvent::SIZE_CHANGED.
|
private |
Definition at line 164 of file MasterPageContainer.hxx.
Referenced by GetPreviewForToken(), GetPreviewSize(), GetPreviewSizePixel(), and SetPreviewSize().
|
private |
Definition at line 163 of file MasterPageContainer.hxx.
Referenced by AcquireToken(), AddChangeListener(), GetDescriptorForToken(), GetOriginForToken(), GetPageNameForToken(), GetPageObjectForToken(), GetPreviewForToken(), GetPreviewSizePixel(), GetPreviewState(), GetStyleNameForToken(), GetTemplateIndexForToken(), GetTokenCount(), GetTokenForIndex(), GetTokenForPageObject(), GetTokenForStyleName(), GetTokenForURL(), GetURLForToken(), HasToken(), InvalidatePreview(), MasterPageContainer(), PutMasterPage(), ReleaseToken(), RemoveChangeListener(), RequestPreview(), and SetPreviewSize().
|
static |
Definition at line 52 of file MasterPageContainer.hxx.
Referenced by sd::sidebar::RecentlyUsedMasterPages::AddMasterPage(), sd::sidebar::CurrentMasterPagesSelector::Fill(), sd::sidebar::RecentMasterPagesSelector::Fill(), GetTokenForIndex(), sd::sidebar::RecentlyUsedMasterPages::GetTokenForIndex(), GetTokenForPageObject(), GetTokenForStyleName(), GetTokenForURL(), sd::sidebar::MasterPagesSelector::InvalidateItem(), sd::sidebar::MasterPagesSelector::NotifyContainerChangeEvent(), sd::sidebar::MasterPageContainer::Implementation::PutMasterPage(), sd::sidebar::RecentlyUsedMasterPages::ResolveList(), sd::sidebar::MasterPagesSelector::SetItem(), SetPreviewSize(), sd::sidebar::MasterPagesSelector::UpdateItemList(), and sd::sidebar::MasterPageContainer::Implementation::UpdatePreviewSizePixel().