LibreOffice Module svx (master) 1
svdlayer.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#ifndef INCLUDED_SVX_SVDLAYER_HXX
21#define INCLUDED_SVX_SVDLAYER_HXX
22
23#include <svx/svdsob.hxx>
24#include <svx/svdtypes.hxx>
25#include <svx/svxdllapi.h>
26#include <memory>
27#include <vector>
28
56class SdrModel;
57
59{
60 friend class SdrLayerAdmin;
61
62 OUString maName;
63 OUString maTitle;
64 OUString maDescription;
65 SdrModel* pModel; // For broadcasting
66 bool mbVisibleODF; // corresponds to ODF draw:display
67 bool mbPrintableODF; // corresponds to ODF draw:display
68 bool mbLockedODF; // corresponds to ODF draw:protected
70
71 SdrLayer(SdrLayerID nNewID, OUString aNewName);
72
73public:
74 bool operator==(const SdrLayer& rCmpLayer) const;
75
76 void SetName(const OUString& rNewName);
77 const OUString& GetName() const { return maName; }
78
79 void SetTitle(const OUString& rTitle) { maTitle = rTitle; }
80 const OUString& GetTitle() const { return maTitle; }
81
82 void SetDescription(const OUString& rDesc) { maDescription = rDesc; }
83 const OUString& GetDescription() const { return maDescription; }
84
85 void SetVisibleODF(bool bVisibleODF) { mbVisibleODF = bVisibleODF; }
86 bool IsVisibleODF() const { return mbVisibleODF; }
87
88 void SetPrintableODF(bool bPrintableODF) { mbPrintableODF = bPrintableODF; }
89 bool IsPrintableODF() const { return mbPrintableODF; }
90
91 void SetLockedODF(bool bLockedODF) { mbLockedODF = bLockedODF; }
92 bool IsLockedODF() const { return mbLockedODF; }
93
94 SdrLayerID GetID() const { return nID; }
95 void SetModel(SdrModel* pNewModel) { pModel=pNewModel; }
96};
97
98#define SDRLAYER_MAXCOUNT 255
99#define SDRLAYERPOS_NOTFOUND 0xffff
100
101// When Changing the layer data you currently have to set the Modify flag manually
103friend class SdrView;
104friend class SdrModel;
105friend class SdrPage;
106
107 std::vector<std::unique_ptr<SdrLayer>> maLayers;
108 SdrLayerAdmin* pParent; // The page's admin knows the doc's admin
109 SdrModel* pModel; // For broadcasting
111 // Find a LayerID which is not in use yet. If all have been used up,
112 // we return 0.
113 // If you want to play safe, check GetLayerCount()<SDRLAYER_MAXCOUNT
114 // first, else all are given away already.
115 SdrLayerID GetUniqueLayerID() const;
116 void Broadcast() const;
117public:
118 explicit SdrLayerAdmin(SdrLayerAdmin* pNewParent=nullptr);
119 SdrLayerAdmin(const SdrLayerAdmin& rSrcLayerAdmin);
121 SdrLayerAdmin& operator=(const SdrLayerAdmin& rSrcLayerAdmin);
122
123 void SetModel(SdrModel* pNewModel);
124
125 void InsertLayer(std::unique_ptr<SdrLayer> pLayer, sal_uInt16 nPos);
126 std::unique_ptr<SdrLayer> RemoveLayer(sal_uInt16 nPos);
127
128 // Delete all layers
129 void ClearLayers();
130
131 // New layer is created and inserted
132 SdrLayer* NewLayer(const OUString& rName, sal_uInt16 nPos=0xFFFF);
133
134 // Iterate over all layers
135 sal_uInt16 GetLayerCount() const { return sal_uInt16(maLayers.size()); }
136
137 SdrLayer* GetLayer(sal_uInt16 i) { return maLayers[i].get(); }
138 const SdrLayer* GetLayer(sal_uInt16 i) const { return maLayers[i].get(); }
139
140 sal_uInt16 GetLayerPos(const SdrLayer* pLayer) const;
141
142 SdrLayer* GetLayer(const OUString& rName);
143 const SdrLayer* GetLayer(const OUString& rName) const;
144 SdrLayerID GetLayerID(const OUString& rName) const;
145 SdrLayer* GetLayerPerID(SdrLayerID nID) { return const_cast<SdrLayer*>(const_cast<const SdrLayerAdmin*>(this)->GetLayerPerID(nID)); }
146 const SdrLayer* GetLayerPerID(SdrLayerID nID) const;
147
148 void SetControlLayerName(const OUString& rNewName);
149 const OUString& GetControlLayerName() const { return maControlLayerName; }
150
151 // Removes all elements in rOutSet and then adds all IDs of layers from member aLayer
152 // that fulfill the criterion visible, printable, or locked respectively.
153 void getVisibleLayersODF( SdrLayerIDSet& rOutSet) const;
154 void getPrintableLayersODF( SdrLayerIDSet& rOutSet) const;
155 void getLockedLayersODF( SdrLayerIDSet& rOutSet) const;
156
157 // Generates a bitfield for settings.xml from the SdrLayerIDSet.
158 // Output is a UNO sequence of BYTE (which is 'short' in API).
159 void QueryValue(const SdrLayerIDSet& rViewLayerSet, css::uno::Any& rAny);
160};
161
162#endif // INCLUDED_SVX_SVDLAYER_HXX
163
164/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString maName
OUString maControlLayerName
Definition: svdlayer.hxx:110
const SdrLayer * GetLayer(sal_uInt16 i) const
Definition: svdlayer.hxx:138
std::vector< std::unique_ptr< SdrLayer > > maLayers
Definition: svdlayer.hxx:107
const OUString & GetControlLayerName() const
Definition: svdlayer.hxx:149
SdrModel * pModel
Definition: svdlayer.hxx:109
SdrLayerAdmin * pParent
Definition: svdlayer.hxx:108
sal_uInt16 GetLayerCount() const
Definition: svdlayer.hxx:135
SdrLayer * GetLayerPerID(SdrLayerID nID)
Definition: svdlayer.hxx:145
SdrLayer * GetLayer(sal_uInt16 i)
Definition: svdlayer.hxx:137
SdrLayerID GetID() const
Definition: svdlayer.hxx:94
bool IsLockedODF() const
Definition: svdlayer.hxx:92
bool mbVisibleODF
Definition: svdlayer.hxx:66
const OUString & GetTitle() const
Definition: svdlayer.hxx:80
void SetPrintableODF(bool bPrintableODF)
Definition: svdlayer.hxx:88
bool mbPrintableODF
Definition: svdlayer.hxx:67
OUString maTitle
Definition: svdlayer.hxx:63
const OUString & GetName() const
Definition: svdlayer.hxx:77
SdrLayerID nID
Definition: svdlayer.hxx:69
void SetVisibleODF(bool bVisibleODF)
Definition: svdlayer.hxx:85
const OUString & GetDescription() const
Definition: svdlayer.hxx:83
bool IsVisibleODF() const
Definition: svdlayer.hxx:86
bool mbLockedODF
Definition: svdlayer.hxx:68
void SetModel(SdrModel *pNewModel)
Definition: svdlayer.hxx:95
void SetDescription(const OUString &rDesc)
Definition: svdlayer.hxx:82
OUString maName
Definition: svdlayer.hxx:62
bool IsPrintableODF() const
Definition: svdlayer.hxx:89
SdrModel * pModel
Definition: svdlayer.hxx:65
OUString maDescription
Definition: svdlayer.hxx:64
void SetTitle(const OUString &rTitle)
Definition: svdlayer.hxx:79
void SetLockedODF(bool bLockedODF)
Definition: svdlayer.hxx:91
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
SdrPage & operator=(const SdrPage &)=delete
OUString maTitle
int i
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)