LibreOffice Module sd (master) 1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
sd::sidebar::MasterPagesSelector Class Referenceabstract

Base class of a menu that lets the user select from a list of templates or designs that are loaded from files. More...

#include <MasterPagesSelector.hxx>

Inheritance diagram for sd::sidebar::MasterPagesSelector:
[legend]
Collaboration diagram for sd::sidebar::MasterPagesSelector:
[legend]

Public Member Functions

 MasterPagesSelector (weld::Widget *pParent, SdDrawDocument &rDocument, ViewShellBase &rBase, std::shared_ptr< MasterPageContainer > pContainer, css::uno::Reference< css::ui::XSidebar > xSidebar, const OUString &rUIFileName, const OUString &rValueSetName)
 
virtual ~MasterPagesSelector () override
 
virtual void LateInit ()
 
sal_Int32 GetPreferredHeight (sal_Int32 nWidth)
 
void ClearPageSet ()
 Make the selector empty. More...
 
void SetHelpId (const OUString &aId)
 
void InvalidatePreview (const SdPage *pPage)
 Mark the preview that belongs to the given index as not up-to-date anymore with respect to page content or preview size. More...
 
void UpdateAllPreviews ()
 
void ShowContextMenu (const Point *pPos)
 
virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override
 
- Public Member Functions inherited from PanelLayout
 PanelLayout (weld::Widget *pParent, const OUString &rID, const OUString &rUIXMLDescription)
 
void SetPanel (sfx2::sidebar::Panel *pPanel)
 
virtual ~PanelLayout ()
 
Size get_preferred_size () const
 
void queue_resize ()
 

Protected Types

typedef ::std::pair< int, MasterPageContainer::TokenUserData
 
typedef ::std::vector< MasterPageContainer::TokenItemList
 
typedef ::std::map< MasterPageContainer::Token, sal_Int32 > TokenToValueSetIndex
 

Protected Member Functions

SdPageGetSelectedMasterPage ()
 
void AssignMasterPageToAllSlides (SdPage *pMasterPage)
 Assign the given master page to all slides of the document. More...
 
void AssignMasterPageToSelectedSlides (SdPage *pMasterPage)
 Assign the given master page to all slides that are selected in a slide sorter that is displayed in the lef or center pane. More...
 
virtual void AssignMasterPageToPageList (SdPage *pMasterPage, const std::shared_ptr< std::vector< SdPage * > > &rPageList)
 
virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent &rEvent)
 
UserDataGetUserData (int nIndex) const
 
void SetUserData (int nIndex, std::unique_ptr< UserData > pData)
 
sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const
 
void UpdateItemList (::std::unique_ptr< ItemList > &&pList)
 
void Clear ()
 
void InvalidateItem (MasterPageContainer::Token aToken)
 Invalidate the specified item so that on the next Fill() this item is updated. More...
 
void UpdateLocks (const ItemList &rItemList)
 Lock master pages in the given list and release locks that were previously acquired. More...
 
void Fill ()
 
virtual void Fill (ItemList &rItemList)=0
 
virtual OUString GetContextMenuUIFile () const
 Give derived classes the opportunity to provide their own context menu. More...
 
virtual void ProcessPopupMenu (weld::Menu &rMenu)
 
virtual void ExecuteCommand (const OUString &rIdent)
 
- Protected Member Functions inherited from PanelLayout
virtual void DataChanged (const DataChangedEvent &rEvent)
 
virtual void DumpAsPropertyTree (tools::JsonWriter &)
 
virtual weld::WindowGetFrameWeld () const
 

Protected Attributes

mutable::osl::Mutex maMutex
 
std::shared_ptr< MasterPageContainermpContainer
 
std::unique_ptr< PreviewValueSetmxPreviewValueSet
 
std::unique_ptr< weld::CustomWeldmxPreviewValueSetWin
 
SdDrawDocumentmrDocument
 
ViewShellBasemrBase
 
ItemList maCurrentItemList
 
TokenToValueSetIndex maTokenToValueSetIndex
 
ItemList maLockedMasterPages
 
- Protected Attributes inherited from PanelLayout
std::unique_ptr< weld::Builderm_xBuilder
 
std::unique_ptr< weld::Containerm_xContainer
 
sfx2::sidebar::Panelm_pPanel
 

Private Member Functions

 DECL_LINK (ClickHandler, ValueSet *, void)
 The offset between ValueSet index and MasterPageContainer::Token last seen. More...
 
 DECL_LINK (ContextMenuHandler, const Point *, void)
 
 DECL_LINK (ContainerChangeListener, MasterPageContainerChangeEvent &, void)
 
void SetItem (sal_uInt16 nIndex, MasterPageContainer::Token aToken)
 
void AddTokenToIndexEntry (sal_uInt16 nIndex, MasterPageContainer::Token aToken)
 
void RemoveTokenToIndexEntry (sal_uInt16 nIndex, MasterPageContainer::Token aToken)
 

Private Attributes

css::uno::Reference< css::ui::XSidebar > mxSidebar
 

Detailed Description

Base class of a menu that lets the user select from a list of templates or designs that are loaded from files.

Definition at line 45 of file MasterPagesSelector.hxx.

Member Typedef Documentation

◆ ItemList

Definition at line 124 of file MasterPagesSelector.hxx.

◆ TokenToValueSetIndex

Definition at line 135 of file MasterPagesSelector.hxx.

◆ UserData

Definition at line 119 of file MasterPagesSelector.hxx.

Constructor & Destructor Documentation

◆ MasterPagesSelector()

sd::sidebar::MasterPagesSelector::MasterPagesSelector ( weld::Widget pParent,
SdDrawDocument rDocument,
ViewShellBase rBase,
std::shared_ptr< MasterPageContainer pContainer,
css::uno::Reference< css::ui::XSidebar >  xSidebar,
const OUString &  rUIFileName,
const OUString &  rValueSetName 
)

◆ ~MasterPagesSelector()

sd::sidebar::MasterPagesSelector::~MasterPagesSelector ( )
overridevirtual

Member Function Documentation

◆ AddTokenToIndexEntry()

void sd::sidebar::MasterPagesSelector::AddTokenToIndexEntry ( sal_uInt16  nIndex,
MasterPageContainer::Token  aToken 
)
private

Definition at line 459 of file MasterPagesSelector.cxx.

References maMutex, maTokenToValueSetIndex, and nIndex.

Referenced by SetItem().

◆ AssignMasterPageToAllSlides()

void sd::sidebar::MasterPagesSelector::AssignMasterPageToAllSlides ( SdPage pMasterPage)
protected

Assign the given master page to all slides of the document.

Assemble a list of all slides of the document and pass it to AssignMasterPageToPageList().

Parameters
pMasterPageThe master page to assign to all slides.

Definition at line 290 of file MasterPagesSelector.cxx.

References AssignMasterPageToPageList(), SdPage::GetLayoutName(), SdDrawDocument::GetSdPage(), SdDrawDocument::GetSdPageCount(), mrDocument, and Standard.

Referenced by ExecuteCommand().

◆ AssignMasterPageToPageList()

void sd::sidebar::MasterPagesSelector::AssignMasterPageToPageList ( SdPage pMasterPage,
const std::shared_ptr< std::vector< SdPage * > > &  rPageList 
)
protectedvirtual

◆ AssignMasterPageToSelectedSlides()

void sd::sidebar::MasterPagesSelector::AssignMasterPageToSelectedSlides ( SdPage pMasterPage)
protected

Assign the given master page to all slides that are selected in a slide sorter that is displayed in the lef or center pane.

Assemble a list of the currently selected slides (selected in a visible slide sorter) and pass it to AssignMasterPageToPageList().

When both panes display a slide sorter then the one in the center pane is used.

Definition at line 320 of file MasterPagesSelector.cxx.

References AssignMasterPageToPageList(), and mrBase.

Referenced by ExecuteCommand().

◆ Clear()

void sd::sidebar::MasterPagesSelector::Clear ( )
protected

Definition at line 558 of file MasterPagesSelector.cxx.

References ClearPageSet(), and maMutex.

Referenced by ~MasterPagesSelector().

◆ ClearPageSet()

void sd::sidebar::MasterPagesSelector::ClearPageSet ( )

Make the selector empty.

This method clear the value set from any entries. Override this method to add functionality, especially to destroy objects set as data items at the value set.

Definition at line 528 of file MasterPagesSelector.cxx.

References GetUserData(), maMutex, mxPreviewValueSet, nIndex, and pData.

Referenced by Clear().

◆ DECL_LINK() [1/3]

sd::sidebar::MasterPagesSelector::DECL_LINK ( ClickHandler  ,
ValueSet ,
void   
)
private

The offset between ValueSet index and MasterPageContainer::Token last seen.

This value is used heuristically to speed up the lookup of an index for a token.

◆ DECL_LINK() [2/3]

sd::sidebar::MasterPagesSelector::DECL_LINK ( ContainerChangeListener  ,
MasterPageContainerChangeEvent ,
void   
)
private

◆ DECL_LINK() [3/3]

sd::sidebar::MasterPagesSelector::DECL_LINK ( ContextMenuHandler  ,
const Point ,
void   
)
private

◆ ExecuteCommand()

void sd::sidebar::MasterPagesSelector::ExecuteCommand ( const OUString &  rIdent)
protectedvirtual

◆ Fill() [1/2]

void sd::sidebar::MasterPagesSelector::Fill ( )
protected

◆ Fill() [2/2]

virtual void sd::sidebar::MasterPagesSelector::Fill ( ItemList rItemList)
protectedpure virtual

◆ GetContextMenuUIFile()

OUString sd::sidebar::MasterPagesSelector::GetContextMenuUIFile ( ) const
protectedvirtual

Give derived classes the opportunity to provide their own context menu.

If they do then they probably have to provide their own Execute() and GetState() methods as well.

Reimplemented in sd::sidebar::CurrentMasterPagesSelector.

Definition at line 144 of file MasterPagesSelector.cxx.

Referenced by ShowContextMenu().

◆ GetHeightForWidth()

css::ui::LayoutSize sd::sidebar::MasterPagesSelector::GetHeightForWidth ( const sal_Int32  nWidth)
overridevirtual

Definition at line 612 of file MasterPagesSelector.cxx.

References GetPreferredHeight().

◆ GetIndexForToken()

sal_Int32 sd::sidebar::MasterPagesSelector::GetIndexForToken ( MasterPageContainer::Token  aToken) const
protected

Definition at line 547 of file MasterPagesSelector.cxx.

References maMutex, and maTokenToValueSetIndex.

Referenced by NotifyContainerChangeEvent(), and RemoveTokenToIndexEntry().

◆ GetPreferredHeight()

sal_Int32 sd::sidebar::MasterPagesSelector::GetPreferredHeight ( sal_Int32  nWidth)

Definition at line 103 of file MasterPagesSelector.cxx.

References maMutex, and mxPreviewValueSet.

Referenced by GetHeightForWidth().

◆ GetSelectedMasterPage()

SdPage * sd::sidebar::MasterPagesSelector::GetSelectedMasterPage ( )
protected

◆ GetUserData()

MasterPagesSelector::UserData * sd::sidebar::MasterPagesSelector::GetUserData ( int  nIndex) const
protected

◆ InvalidateItem()

void sd::sidebar::MasterPagesSelector::InvalidateItem ( MasterPageContainer::Token  aToken)
protected

Invalidate the specified item so that on the next Fill() this item is updated.

Definition at line 565 of file MasterPagesSelector.cxx.

References maCurrentItemList, maMutex, and sd::sidebar::MasterPageContainer::NIL_TOKEN.

Referenced by NotifyContainerChangeEvent().

◆ InvalidatePreview()

void sd::sidebar::MasterPagesSelector::InvalidatePreview ( const SdPage pPage)

Mark the preview that belongs to the given index as not up-to-date anymore with respect to page content or preview size.

The implementation of this method will either sunchronously or asynchronously call UpdatePreview().

Parameters
nIndexIndex into the value set control that is used for displaying the previews.

Definition at line 488 of file MasterPagesSelector.cxx.

References GetUserData(), maMutex, mpContainer, mxPreviewValueSet, nIndex, and pData.

◆ LateInit()

void sd::sidebar::MasterPagesSelector::LateInit ( )
virtual

◆ NotifyContainerChangeEvent()

void sd::sidebar::MasterPagesSelector::NotifyContainerChangeEvent ( const MasterPageContainerChangeEvent rEvent)
protectedvirtual

◆ ProcessPopupMenu()

void sd::sidebar::MasterPagesSelector::ProcessPopupMenu ( weld::Menu rMenu)
protectedvirtual

◆ RemoveTokenToIndexEntry()

void sd::sidebar::MasterPagesSelector::RemoveTokenToIndexEntry ( sal_uInt16  nIndex,
MasterPageContainer::Token  aToken 
)
private

Definition at line 468 of file MasterPagesSelector.cxx.

References GetIndexForToken(), GetUserData(), maMutex, maTokenToValueSetIndex, nIndex, and pData.

Referenced by SetItem().

◆ SetHelpId()

void sd::sidebar::MasterPagesSelector::SetHelpId ( const OUString &  aId)

Definition at line 540 of file MasterPagesSelector.cxx.

References maMutex, and mxPreviewValueSet.

◆ SetItem()

void sd::sidebar::MasterPagesSelector::SetItem ( sal_uInt16  nIndex,
MasterPageContainer::Token  aToken 
)
private

◆ SetUserData()

void sd::sidebar::MasterPagesSelector::SetUserData ( int  nIndex,
std::unique_ptr< UserData pData 
)
protected

Definition at line 405 of file MasterPagesSelector.cxx.

References GetUserData(), maMutex, mxPreviewValueSet, nIndex, and pData.

Referenced by SetItem().

◆ ShowContextMenu()

void sd::sidebar::MasterPagesSelector::ShowContextMenu ( const Point pPos)

◆ UpdateAllPreviews()

void sd::sidebar::MasterPagesSelector::UpdateAllPreviews ( )

◆ UpdateItemList()

void sd::sidebar::MasterPagesSelector::UpdateItemList ( ::std::unique_ptr< ItemList > &&  pList)
protected

◆ UpdateLocks()

void sd::sidebar::MasterPagesSelector::UpdateLocks ( const ItemList rItemList)
protected

Lock master pages in the given list and release locks that were previously acquired.

Definition at line 110 of file MasterPagesSelector.cxx.

References maLockedMasterPages, and mpContainer.

Referenced by Fill(), and ~MasterPagesSelector().

Member Data Documentation

◆ maCurrentItemList

ItemList sd::sidebar::MasterPagesSelector::maCurrentItemList
protected

Definition at line 134 of file MasterPagesSelector.hxx.

Referenced by InvalidateItem(), and UpdateItemList().

◆ maLockedMasterPages

ItemList sd::sidebar::MasterPagesSelector::maLockedMasterPages
protected

Definition at line 138 of file MasterPagesSelector.hxx.

Referenced by UpdateLocks().

◆ maMutex

mutable::osl::Mutex sd::sidebar::MasterPagesSelector::maMutex
protected

◆ maTokenToValueSetIndex

TokenToValueSetIndex sd::sidebar::MasterPagesSelector::maTokenToValueSetIndex
protected

◆ mpContainer

std::shared_ptr<MasterPageContainer> sd::sidebar::MasterPagesSelector::mpContainer
protected

◆ mrBase

ViewShellBase& sd::sidebar::MasterPagesSelector::mrBase
protected

◆ mrDocument

SdDrawDocument& sd::sidebar::MasterPagesSelector::mrDocument
protected

◆ mxPreviewValueSet

std::unique_ptr<PreviewValueSet> sd::sidebar::MasterPagesSelector::mxPreviewValueSet
protected

◆ mxPreviewValueSetWin

std::unique_ptr<weld::CustomWeld> sd::sidebar::MasterPagesSelector::mxPreviewValueSetWin
protected

Definition at line 93 of file MasterPagesSelector.hxx.

Referenced by ~MasterPagesSelector().

◆ mxSidebar

css::uno::Reference<css::ui::XSidebar> sd::sidebar::MasterPagesSelector::mxSidebar
private

Definition at line 157 of file MasterPagesSelector.hxx.

Referenced by ExecuteCommand(), and UpdateItemList().


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