wxMaxima
Loading...
Searching...
No Matches
pdflayer.h
Go to the documentation of this file.
1
2// Name: pdflayer.h
3// Purpose:
4// Author: Ulrich Telle
5// Created: 2009-07-01
6// Copyright: (c) Ulrich Telle
7// Licence: wxWindows licence
9
11
12#ifndef _PDF_LAYER_H_
13#define _PDF_LAYER_H_
14
15// wxWidgets headers
16#include <wx/dynarray.h>
17#include <wx/string.h>
18
19// wxPdfDocument headers
20#include "wx/pdfdocdef.h"
21
22class WXDLLIMPEXP_FWD_PDFDOC wxPdfDictionary;
23
24class WXDLLIMPEXP_FWD_PDFDOC wxPdfLayer;
25WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxPdfLayer*, wxPdfArrayLayer, class WXDLLIMPEXP_PDFDOC);
26
29{
30 wxPDF_OCG_TYPE_UNKNOWN,
31 wxPDF_OCG_TYPE_LAYER,
32 wxPDF_OCG_TYPE_TITLE,
33 wxPDF_OCG_TYPE_MEMBERSHIP
34};
35
38const int wxPDF_OCG_INTENT_VIEW = 1;
39const int wxPDF_OCG_INTENT_DESIGN = 2;
40
43{
44 wxPDF_OCG_POLICY_ALLON,
45 wxPDF_OCG_POLICY_ANYON,
46 wxPDF_OCG_POLICY_ANYOFF,
47 wxPDF_OCG_POLICY_ALLOFF
48};
49
51
55class WXDLLIMPEXP_PDFDOC wxPdfOcg
56{
57public:
59 wxPdfOcg();
60
62 virtual ~wxPdfOcg();
63
65
68 void SetIndex(int index) { m_index = index; }
69
71
74 int GetIndex() const { return m_index; }
75
77
80 void SetObjIndex(int n) { m_n = n; }
81
83
86 int GetObjIndex() const { return m_n; }
87
89
92 bool IsOk() const;
93
95
98 wxPdfOcgType GetType() const { return m_type; }
99
100protected:
102
103private:
104 int m_index;
105 int m_n;
106};
107
109class WXDLLIMPEXP_PDFDOC wxPdfLayer : public wxPdfOcg
110{
111public:
113
117 wxPdfLayer(const wxString& name);
118
120 virtual ~wxPdfLayer();
121
123
126 wxString GetName() const { return m_name; }
127
129
132 wxString GetTitle() const { return m_title; }
133
135
138 void SetIntent(const unsigned int intent) { m_intent |= intent; };
139
141
144 int GetIntent() const { return m_intent; };
145
147
150 void ClearIntent(const unsigned int intent) { m_intent &= ~intent; };
151
153
157 void SetOn(bool on) { m_on = on; }
158
160
164 bool IsOn() const { return m_on; }
165
167
173 void SetOnPanel(bool onPanel) { m_onPanel = onPanel; }
174
176
180 bool IsOnPanel() const { return m_onPanel; }
181
183
187 bool AddChild(wxPdfLayer* child);
188
190
194 wxPdfLayer* GetParent() const { return m_parent; }
195
197
200 bool HasChildren() const { return !m_children.IsEmpty(); }
201
203
207 wxPdfArrayLayer GetChildren() const { return m_children; }
208
210
219 void SetCreatorInfo(const wxString& creator, const wxString& subtype);
220
222
230 void SetLanguage(const wxString& lang, bool preferred);
231
233
240 void SetExport(bool exportState);
241
243
252 void SetZoom(double min, double max);
253
255
263 void SetPrint(const wxString& subtype, bool printState);
264
266
271 void SetView(bool viewState);
272
274
277 wxPdfDictionary* GetUsage() const { return m_usage; }
278
280
286 static wxPdfLayer* CreateTitle(const wxString& title);
287
288protected:
290 wxPdfLayer(const wxPdfLayer& encoding);
291
293 wxPdfLayer& operator=(const wxPdfLayer& encoding);
294
296 bool SetParent(wxPdfLayer* parent);
297
299 wxPdfDictionary* AllocateUsage();
300
301private:
302 wxString m_name;
303 wxString m_title;
304 int m_intent;
305 bool m_on;
306 bool m_onPanel;
307 wxPdfLayer* m_parent;
308 wxPdfArrayLayer m_children;
309 wxPdfDictionary* m_usage;
310};
311
313class WXDLLIMPEXP_PDFDOC wxPdfLayerMembership : public wxPdfOcg
314{
315public:
318
320 virtual ~wxPdfLayerMembership();
321
323
327 bool AddMember(wxPdfLayer* layer);
328
330
333 wxPdfArrayLayer GetMembers() const;
334
336
343 void SetVisibilityPolicy(wxPdfOcgPolicy policy);
344
346
349 wxPdfOcgPolicy GetVisibilityPolicy() const;
350
351protected:
354
357
358private:
359 wxPdfArrayLayer m_layers;
360 wxPdfOcgPolicy m_policy;
361};
362
364class WXDLLIMPEXP_PDFDOC wxPdfLayerGroup
365{
366public:
369
371 virtual ~wxPdfLayerGroup();
372
374 wxPdfLayerGroup(const wxPdfLayerGroup& layer);
375
377 wxPdfLayerGroup& operator=(const wxPdfLayerGroup& layer);
378
380
384 bool Add(wxPdfLayer* layer);
385
387
390 wxPdfArrayLayer GetGroup() const;
391
392private:
393 wxPdfArrayLayer m_layers;
394};
395
396#endif
Class representing a dictionary object. (For internal use only)
Definition: pdfobjects.h:409
Class for a group of layers with optional content.
Definition: pdflayer.h:365
Class for a layer with optional content.
Definition: pdflayer.h:314
wxPdfLayerMembership & operator=(const wxPdfLayerMembership &layer)
Assignment operator.
wxPdfLayerMembership(const wxPdfLayerMembership &layer)
Copy constructor.
Class for a layer with optional content.
Definition: pdflayer.h:110
wxPdfLayer & operator=(const wxPdfLayer &encoding)
Assignment operator.
void ClearIntent(const unsigned int intent)
Clear Optional Content Group (OCG) Intent.
Definition: pdflayer.h:150
bool HasChildren() const
Check whether the layer has child layers.
Definition: pdflayer.h:200
void SetIntent(const unsigned int intent)
Set Optional Content Group (OCG) Intent.
Definition: pdflayer.h:138
wxString GetName() const
Get the name of the layer.
Definition: pdflayer.h:126
wxPdfArrayLayer GetChildren() const
Get the list of child layers.
Definition: pdflayer.h:207
void SetOnPanel(bool onPanel)
Set the visibility of the layer on the layer panel.
Definition: pdflayer.h:173
wxPdfLayer(const wxPdfLayer &encoding)
Copy constructor.
void SetOn(bool on)
Set the initial visibility of the layer.
Definition: pdflayer.h:157
wxPdfLayer * GetParent() const
Get parent layer.
Definition: pdflayer.h:194
bool IsOn() const
Get the initial visibility of the layer.
Definition: pdflayer.h:164
bool IsOnPanel() const
Get the layer visibility on the layer panel.
Definition: pdflayer.h:180
int GetIntent() const
Get Optional Content Group (OCG) Intent.
Definition: pdflayer.h:144
wxPdfDictionary * GetUsage() const
Get the usage dictionary.
Definition: pdflayer.h:277
wxString GetTitle() const
Get the layer title.
Definition: pdflayer.h:132
Base class for Optional Content Groups (OCG). (For internal use only)
Definition: pdflayer.h:56
int GetIndex() const
Get OCG index.
Definition: pdflayer.h:74
wxPdfOcgType GetType() const
Get OCG type.
Definition: pdflayer.h:98
wxPdfOcgType m_type
Type of OCG.
Definition: pdflayer.h:101
void SetIndex(int index)
Set OCG index.
Definition: pdflayer.h:68
int GetObjIndex() const
Get object index.
Definition: pdflayer.h:86
void SetObjIndex(int n)
Set object index.
Definition: pdflayer.h:80
Compile time switches for the wxPdfDocument component.
wxPdfOcgPolicy
OCG visibility policy.
Definition: pdflayer.h:43
const int wxPDF_OCG_INTENT_DEFAULT
OCG Intent options.
Definition: pdflayer.h:37
wxPdfOcgType
Optional content group types.
Definition: pdflayer.h:29