LibreOffice Module sd (master) 1
MasterPageContainer.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 <vcl/image.hxx>
23
24#include <memory>
25
26class SdPage;
27
28namespace sd::sidebar
29{
30class MasterPageDescriptor;
31class MasterPageContainerChangeEvent;
32
49{
50public:
51 typedef int Token;
52 static const Token NIL_TOKEN = -1;
53
56
59
61 {
63 LARGE
64 };
71 void SetPreviewSize(PreviewSize eSize);
72
76
79 Size const& GetPreviewSizePixel() const;
80
82 {
87 };
89
96 bool RequestPreview(Token aToken);
97
102 {
103 MASTERPAGE, // Master page of a document.
104 TEMPLATE, // First page of a template file.
105 DEFAULT, // Empty master page with default style.
106 UNKNOWN
107 };
108
115 Token PutMasterPage(const std::shared_ptr<MasterPageDescriptor>& rDescriptor);
116 void AcquireToken(Token aToken);
117 void ReleaseToken(Token aToken);
118
122 int GetTokenCount() const;
123
126 bool HasToken(Token aToken) const;
127
131 Token GetTokenForIndex(int nIndex);
132
133 Token GetTokenForURL(const OUString& sURL);
134 Token GetTokenForStyleName(const OUString& sStyleName);
135 Token GetTokenForPageObject(const SdPage* pPage);
136
137 OUString GetURLForToken(Token aToken);
138 OUString GetPageNameForToken(Token aToken);
139 OUString GetStyleNameForToken(Token aToken);
140 SdPage* GetPageObjectForToken(Token aToken, bool bLoad);
142 sal_Int32 GetTemplateIndexForToken(Token aToken);
143 std::shared_ptr<MasterPageDescriptor> GetDescriptorForToken(Token aToken);
144
145 void InvalidatePreview(Token aToken);
146
160
161private:
162 class Implementation;
163 std::shared_ptr<Implementation> mpImpl;
165};
166
174{
175public:
176 enum class EventType
177 {
178 // A master page was added to the container.
180 // A master page was removed from the container.
182 // The preview of a master page has changed.
183 PREVIEW_CHANGED,
184 // The size of a preview has changed.
186 // Some of the data stored for a master page has changed.
187 DATA_CHANGED,
188 // The TemplateIndex of a master page has changed.
189 INDEX_CHANGED,
191
192 // Token of the container entry whose data changed or which was added or
193 // removed.
195};
196
197} // end of namespace sd::sidebar
198
199/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
For some changes to the set of master pages in a MasterPageContainer or to the data stored for each m...
enum sd::sidebar::MasterPageContainerChangeEvent::EventType meEventType
This container manages the master pages used by the MasterPagesSelector controls.
sal_Int32 GetTemplateIndexForToken(Token aToken)
Token PutMasterPage(const std::shared_ptr< MasterPageDescriptor > &rDescriptor)
Put the master page identified and described by the given parameters into the container.
void RemoveChangeListener(const Link< MasterPageContainerChangeEvent &, void > &rLink)
std::shared_ptr< Implementation > mpImpl
void SetPreviewSize(PreviewSize eSize)
There are two different preview sizes, a small one and a large one.
int GetTokenCount() const
This and the GetTokenForIndex() methods can be used to iterate over all members of the container.
Image GetPreviewForToken(Token aToken)
Return a preview for the specified token.
Size const & GetPreviewSizePixel() const
Return the preview size in pixels.
Token GetTokenForStyleName(const OUString &sStyleName)
Token GetTokenForURL(const OUString &sURL)
OUString GetPageNameForToken(Token aToken)
Token GetTokenForPageObject(const SdPage *pPage)
SdPage * GetPageObjectForToken(Token aToken, bool bLoad)
PreviewState GetPreviewState(Token aToken)
std::shared_ptr< MasterPageDescriptor > GetDescriptorForToken(Token aToken)
Token GetTokenForIndex(int nIndex)
Return a token for an index in the range 0 <= index < GetTokenCount().
bool HasToken(Token aToken) const
Determine whether the container has a member for the given token.
void AddChangeListener(const Link< MasterPageContainerChangeEvent &, void > &rLink)
bool RequestPreview(Token aToken)
This method is typically called for entries in the container for which GetPreviewState() returns OS_C...
Origin
Each entry of the container is either the first page of a template document or is a master page of an...
PreviewSize GetPreviewSize() const
Returns the preview size.
OUString GetStyleNameForToken(Token aToken)
SIZE_CHANGED