LibreOffice Module sd (master) 1
MasterPagesSelector.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <map>
23#include <memory>
25#include "PreviewValueSet.hxx"
28
29#include <osl/mutex.hxx>
30
31namespace com::sun::star::ui { class XSidebar; }
32class MouseEvent;
33class SdDrawDocument;
34class SdPage;
35
36namespace sd {
37class ViewShellBase;
38}
39
40namespace sd::sidebar {
41
46 , public sfx2::sidebar::ILayoutableWindow
47{
48public:
50 weld::Widget* pParent,
51 SdDrawDocument& rDocument,
52 ViewShellBase& rBase,
53 std::shared_ptr<MasterPageContainer> pContainer,
54 css::uno::Reference<css::ui::XSidebar> xSidebar,
55 const OUString& rUIFileName,
56 const OUString& rValueSetName);
57 virtual ~MasterPagesSelector() override;
58
59 virtual void LateInit();
60
61 sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
62
67 void ClearPageSet();
68
69 void SetHelpId( const OUString& aId );
70
79 void InvalidatePreview (const SdPage* pPage);
80
81 void UpdateAllPreviews();
82
83 void ShowContextMenu(const Point* pPos);
84
85 // ILayoutableWindow
86 virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override;
87
88protected:
89 mutable ::osl::Mutex maMutex;
90 std::shared_ptr<MasterPageContainer> mpContainer;
91
92 std::unique_ptr<PreviewValueSet> mxPreviewValueSet;
93 std::unique_ptr<weld::CustomWeld> mxPreviewValueSetWin;
94
97
99
104 void AssignMasterPageToAllSlides (SdPage* pMasterPage);
105
111 void AssignMasterPageToSelectedSlides (SdPage* pMasterPage);
112
113 virtual void AssignMasterPageToPageList (
114 SdPage* pMasterPage,
115 const std::shared_ptr<std::vector<SdPage*>>& rPageList);
116
118
119 typedef ::std::pair<int, MasterPageContainer::Token> UserData;
120 UserData* GetUserData (int nIndex) const;
121 void SetUserData (int nIndex, std::unique_ptr<UserData> pData);
122
123 sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const;
124 typedef ::std::vector<MasterPageContainer::Token> ItemList;
125 void UpdateItemList (::std::unique_ptr<ItemList> && pList);
126 void Clear();
131
132 // For every item in the ValueSet we store its associated token. This
133 // allows a faster access and easier change tracking.
135 typedef ::std::map<MasterPageContainer::Token,sal_Int32> TokenToValueSetIndex;
137
142 void UpdateLocks (const ItemList& rItemList);
143
144 void Fill();
145 virtual void Fill (ItemList& rItemList) = 0;
146
151 virtual OUString GetContextMenuUIFile() const;
152
153 virtual void ProcessPopupMenu(weld::Menu& rMenu);
154 virtual void ExecuteCommand(const OUString& rIdent);
155
156private:
157 css::uno::Reference<css::ui::XSidebar> mxSidebar;
158
163 DECL_LINK(ClickHandler, ValueSet*, void);
164 DECL_LINK(ContextMenuHandler, const Point*, void);
165 DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent&, void);
166
167 void SetItem (
168 sal_uInt16 nIndex,
171 sal_uInt16 nIndex,
174 sal_uInt16 nIndex,
176};
177
178} // end of namespace sd::sidebar
179
180/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
For some changes to the set of master pages in a MasterPageContainer or to the data stored for each m...
Base class of a menu that lets the user select from a list of templates or designs that are loaded fr...
void InvalidateItem(MasterPageContainer::Token aToken)
Invalidate the specified item so that on the next Fill() this item is updated.
void SetItem(sal_uInt16 nIndex, MasterPageContainer::Token aToken)
DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent &, void)
virtual OUString GetContextMenuUIFile() const
Give derived classes the opportunity to provide their own context menu.
std::unique_ptr< PreviewValueSet > mxPreviewValueSet
virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 nWidth) override
DECL_LINK(ContextMenuHandler, const Point *, void)
css::uno::Reference< css::ui::XSidebar > mxSidebar
::std::pair< int, MasterPageContainer::Token > UserData
void SetUserData(int nIndex, std::unique_ptr< UserData > pData)
virtual void AssignMasterPageToPageList(SdPage *pMasterPage, const std::shared_ptr< std::vector< SdPage * > > &rPageList)
void ShowContextMenu(const Point *pPos)
DECL_LINK(ClickHandler, ValueSet *, void)
The offset between ValueSet index and MasterPageContainer::Token last seen.
void RemoveTokenToIndexEntry(sal_uInt16 nIndex, MasterPageContainer::Token aToken)
void AssignMasterPageToSelectedSlides(SdPage *pMasterPage)
Assign the given master page to all slides that are selected in a slide sorter that is displayed in t...
void UpdateItemList(::std::unique_ptr< ItemList > &&pList)
void InvalidatePreview(const SdPage *pPage)
Mark the preview that belongs to the given index as not up-to-date anymore with respect to page conte...
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)
void AddTokenToIndexEntry(sal_uInt16 nIndex, MasterPageContainer::Token aToken)
void SetHelpId(const OUString &aId)
void ClearPageSet()
Make the selector empty.
virtual void ExecuteCommand(const OUString &rIdent)
virtual void ProcessPopupMenu(weld::Menu &rMenu)
std::unique_ptr< weld::CustomWeld > mxPreviewValueSetWin
void AssignMasterPageToAllSlides(SdPage *pMasterPage)
Assign the given master page to all slides of the document.
std::shared_ptr< MasterPageContainer > mpContainer
virtual void Fill(ItemList &rItemList)=0
::std::map< MasterPageContainer::Token, sal_Int32 > TokenToValueSetIndex
sal_Int32 GetIndexForToken(MasterPageContainer::Token aToken) const
void UpdateLocks(const ItemList &rItemList)
Lock master pages in the given list and release locks that were previously acquired.
sal_Int32 GetPreferredHeight(sal_Int32 nWidth)
virtual void NotifyContainerChangeEvent(const MasterPageContainerChangeEvent &rEvent)
::std::vector< MasterPageContainer::Token > ItemList
UserData * GetUserData(int nIndex) const