LibreOffice Module sd (master) 1
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
sd::sidebar::MasterPageContainer Class Referencefinal

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)
 
SdPageGetPageObjectForToken (Token aToken, bool bLoad)
 
Origin GetOriginForToken (Token aToken)
 
sal_Int32 GetTemplateIndexForToken (Token aToken)
 
std::shared_ptr< MasterPageDescriptorGetDescriptorForToken (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< ImplementationmpImpl
 
PreviewSize mePreviewSize
 

Detailed Description

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.

Member Typedef Documentation

◆ Token

Definition at line 51 of file MasterPageContainer.hxx.

Member Enumeration Documentation

◆ Origin

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.

◆ PreviewSize

Enumerator
SMALL 
LARGE 

Definition at line 60 of file MasterPageContainer.hxx.

◆ PreviewState

Enumerator
PS_AVAILABLE 
PS_CREATABLE 
PS_PREPARING 
PS_NOT_AVAILABLE 

Definition at line 81 of file MasterPageContainer.hxx.

Constructor & Destructor Documentation

◆ MasterPageContainer()

sd::sidebar::MasterPageContainer::MasterPageContainer ( )

Definition at line 204 of file MasterPageContainer.cxx.

References mpImpl.

◆ ~MasterPageContainer()

sd::sidebar::MasterPageContainer::~MasterPageContainer ( )

Definition at line 211 of file MasterPageContainer.cxx.

Member Function Documentation

◆ AcquireToken()

void sd::sidebar::MasterPageContainer::AcquireToken ( Token  aToken)

Definition at line 244 of file MasterPageContainer.cxx.

References mpImpl.

◆ AddChangeListener()

void sd::sidebar::MasterPageContainer::AddChangeListener ( const Link< MasterPageContainerChangeEvent &, void > &  rLink)

Definition at line 215 of file MasterPageContainer.cxx.

References mpImpl.

◆ GetDescriptorForToken()

std::shared_ptr< MasterPageDescriptor > sd::sidebar::MasterPageContainer::GetDescriptorForToken ( MasterPageContainer::Token  aToken)

Definition at line 440 of file MasterPageContainer.cxx.

References mpImpl.

◆ GetOriginForToken()

MasterPageContainer::Origin sd::sidebar::MasterPageContainer::GetOriginForToken ( Token  aToken)

Definition at line 418 of file MasterPageContainer.cxx.

References mpImpl, and UNKNOWN.

◆ GetPageNameForToken()

OUString sd::sidebar::MasterPageContainer::GetPageNameForToken ( MasterPageContainer::Token  aToken)

Definition at line 369 of file MasterPageContainer.cxx.

References mpImpl.

◆ GetPageObjectForToken()

SdPage * sd::sidebar::MasterPageContainer::GetPageObjectForToken ( MasterPageContainer::Token  aToken,
bool  bLoad 
)

Definition at line 393 of file MasterPageContainer.cxx.

References mpImpl.

◆ GetPreviewForToken()

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.

Parameters
aTokenThis token specifies for which master page to return the preview. Tokens are returned for example by the GetTokenFor...() methods.
Returns
The returned image is the requested preview or a substitution.

Definition at line 453 of file MasterPageContainer.cxx.

References mePreviewSize, and mpImpl.

◆ GetPreviewSize()

PreviewSize sd::sidebar::MasterPageContainer::GetPreviewSize ( ) const
inline

Returns the preview size.

Definition at line 75 of file MasterPageContainer.hxx.

References mePreviewSize.

◆ GetPreviewSizePixel()

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.

◆ GetPreviewState()

MasterPageContainer::PreviewState sd::sidebar::MasterPageContainer::GetPreviewState ( Token  aToken)

◆ GetStyleNameForToken()

OUString sd::sidebar::MasterPageContainer::GetStyleNameForToken ( MasterPageContainer::Token  aToken)

Definition at line 381 of file MasterPageContainer.cxx.

References mpImpl.

◆ GetTemplateIndexForToken()

sal_Int32 sd::sidebar::MasterPageContainer::GetTemplateIndexForToken ( Token  aToken)

Definition at line 429 of file MasterPageContainer.cxx.

References mpImpl.

◆ GetTokenCount()

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.

◆ GetTokenForIndex()

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.

◆ GetTokenForPageObject()

MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForPageObject ( const SdPage pPage)

Definition at line 338 of file MasterPageContainer.cxx.

References mpImpl, and NIL_TOKEN.

◆ GetTokenForStyleName()

MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForStyleName ( const OUString &  sStyleName)

Definition at line 320 of file MasterPageContainer.cxx.

References mpImpl, and NIL_TOKEN.

◆ GetTokenForURL()

MasterPageContainer::Token sd::sidebar::MasterPageContainer::GetTokenForURL ( const OUString &  sURL)

Definition at line 301 of file MasterPageContainer.cxx.

References mpImpl, and NIL_TOKEN.

◆ GetURLForToken()

OUString sd::sidebar::MasterPageContainer::GetURLForToken ( MasterPageContainer::Token  aToken)

Definition at line 357 of file MasterPageContainer.cxx.

References mpImpl.

◆ HasToken()

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().

◆ InvalidatePreview()

void sd::sidebar::MasterPageContainer::InvalidatePreview ( MasterPageContainer::Token  aToken)

Definition at line 448 of file MasterPageContainer.cxx.

References mpImpl.

◆ PutMasterPage()

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.

◆ ReleaseToken()

void sd::sidebar::MasterPageContainer::ReleaseToken ( Token  aToken)

Definition at line 253 of file MasterPageContainer.cxx.

References DEFAULT, MASTERPAGE, mpImpl, and TEMPLATE.

◆ RemoveChangeListener()

void sd::sidebar::MasterPageContainer::RemoveChangeListener ( const Link< MasterPageContainerChangeEvent &, void > &  rLink)

Definition at line 220 of file MasterPageContainer.cxx.

References mpImpl.

◆ RequestPreview()

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().

◆ SetPreviewSize()

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.

Member Data Documentation

◆ mePreviewSize

PreviewSize sd::sidebar::MasterPageContainer::mePreviewSize
private

◆ mpImpl

std::shared_ptr<Implementation> sd::sidebar::MasterPageContainer::mpImpl
private

◆ NIL_TOKEN

const Token sd::sidebar::MasterPageContainer::NIL_TOKEN = -1
static

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