fs_pdflayer.h
Go to the documentation of this file.
1 
15 #ifndef FS_PDFLAYER_H_
16 #define FS_PDFLAYER_H_
17 
18 #include "common/fs_common.h"
19 #include "pdf/fs_pdfdoc.h"
20 #include "pdf/fs_pdfpage.h"
22 
28 namespace foxit {
32 namespace pdf {
33 // forward declaration
34 class LayerPrintData;
35 class LayerNode;
36 
38 FSDK_DEFINE_ARRAY(LayerNodeArray, LayerNode)
39 
40 
43 class LayerZoomData FS_FINAL : public Object {
44  public:
47  : min_factor(0)
48  , max_factor(0) {}
49 
58  LayerZoomData(float min_factor, float max_factor) {
59  this->min_factor = min_factor;
60  this->max_factor = max_factor;
61  }
62 
69  min_factor = data.min_factor;
70  max_factor = data.max_factor;
71  }
72 
80  LayerZoomData &operator = (const LayerZoomData& data) {
81  min_factor = data.min_factor;
82  max_factor = data.max_factor;
83  return (*this);
84  }
85 
96  void Set(float min_factor, float max_factor) {
97  this->min_factor = min_factor;
98  this->max_factor = max_factor;
99  }
100 
105  float min_factor;
110  float max_factor;
111 };
112 
121 class LayerTree FS_FINAL : public Base {
122  public:
128  typedef enum _UsageState {
130  e_StateON = 0x0000,
132  e_StateOFF = 0x0001,
137  } UsageState;
138 
139 
149  explicit LayerTree(const PDFDoc& document);
155  LayerTree(const LayerTree& other);
163  LayerTree& operator = (const LayerTree& other);
164 
172  bool operator == (const LayerTree& other) const;
180  bool operator != (const LayerTree& other) const;
181 
189  bool IsEmpty() const;
191  ~LayerTree();
192 
204  bool SetBaseState(UsageState state);
205 
215 
224 
232  objects::PDFArray* GetOCGs() const;
233 
234  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
235  explicit LayerTree(FS_HANDLE handle = NULL);
236 };
237 
245 class LayerContext FS_FINAL : public Base {
246  public:
252  typedef enum _UsageType {
254  e_UsageView = 0x0000,
256  e_UsageDesign = 0x0001,
258  e_UsagePrint = 0x0002,
260  e_UsageExport = 0x0003,
262  e_UsageZoom = 0x0004
263  } UsageType;
264 
265 
273  explicit LayerContext(const PDFDoc& document, UsageType usage_type);
274 
280  LayerContext(const LayerContext& other);
288  LayerContext& operator = (const LayerContext& other);
289 
297  bool operator == (const LayerContext& other) const;
305  bool operator != (const LayerContext& other) const;
307  ~LayerContext();
315  bool IsEmpty() const;
316 
335  bool Reset();
343  bool CopyStates(const LayerContext& source_context);
352  bool MergeStates(const LayerContext& source_context);
361  bool IsVisible(const LayerNode& layer);
371  bool SetVisible(const LayerNode& layer, bool is_visible);
372 
373  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
374  explicit LayerContext(FS_HANDLE handle = NULL);
375 };
376 
401 class LayerNode FS_FINAL : public Base{
402  public:
408  LayerNode(const LayerNode& other);
416  LayerNode& operator = (const LayerNode& other);
417 
425  bool operator == (const LayerNode& other) const;
433  bool operator != (const LayerNode& other) const;
434 
442  bool IsEmpty() const;
444  ~LayerNode();
445 
451  int GetChildrenCount();
460  LayerNode GetChild(int index);
469  bool RemoveChild(int index);
484  bool MoveTo(LayerNode parent_layer_node, int index);
497  LayerNode AddChild(int index, const wchar_t* name, bool has_Layer);
503  WString GetName();
510  bool HasLayer();
527  bool HasIntent(const char* intent);
540  bool IsInPage(const PDFPage& page);
594  bool SetName(const wchar_t* name);
606  bool SetDefaultVisible(bool is_visible);
665  bool SetPrintUsage(const LayerPrintData& data);
677  bool SetZoomUsage(const LayerZoomData& data);
678 
691 
704  bool AddGraphicsObject(const PDFPage& page, graphics::GraphicsObject* graphicsobject);
718  bool RemoveGraphicsObject(graphics::GraphicsObject* graphics_object);
733  bool RemoveUsage(LayerContext::UsageType usage_type);
734 
735  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
736  explicit LayerNode(FS_HANDLE handle = NULL);
737 };
738 
742 class LayerPrintData FS_FINAL : public Object {
743  public:
754  this->subtype = subtype;
755  this->print_state = print_state;
756  }
757 
760  :print_state(LayerTree::e_StateUndefined) {
761  }
762 
769  subtype = data.subtype;
770  print_state = data.print_state;
771  }
772 
781  subtype = data.subtype;
782  print_state = data.print_state;
783  return (*this);
784  }
797  this->subtype = subtype;
798  this->print_state = print_state;
799  }
800 
811 };
812 } // namespace pdf
813 } // namespace foxit
814 #endif // FS_PDFLAYER_H_
815 
Definition: fs_pdfgraphicsobject.h:153
LayerNode GetRootNode()
Get the root layer node.
UsageState
Enumeration for PDF layer base state.
Definition: fs_pdflayer.h:128
bool Reset()
Reset current layer context, back to the initialized state.
void Set(const String &subtype, LayerTree::UsageState print_state)
Set value.
Definition: fs_pdflayer.h:796
Use for representing a document designer's structural organization of artwork.
Definition: fs_pdflayer.h:256
String subtype
A string that specifies the kind of content controlled by a layer.
Definition: fs_pdflayer.h:802
LayerTree::UsageState GetExportUsage()
Get the state for exporting usage.
Use for zooming.
Definition: fs_pdflayer.h:262
Use for a viewer.
Definition: fs_pdflayer.h:254
bool operator==(const LayerTree &other) const
Equal operator.
CFX_Object Object
Object type.
Definition: fs_basictypes.h:216
The state is undefined.
Definition: fs_pdflayer.h:136
LayerTree(const PDFDoc &document)
Constructor, from a PDF document.
bool operator!=(const LayerContext &other) const
Not equal operator.
~LayerTree()
Destructor.
The state is unchanged.
Definition: fs_pdflayer.h:134
Header file for PDF document related definitions and classes.
bool SetZoomUsage(const LayerZoomData &data)
Set data for layer zooming usage.
bool CopyStates(const LayerContext &source_context)
Copy states from another layer context.
LayerNode AddChild(int index, const wchar_t *name, bool has_Layer)
Add a new layer node as a child for current layer node.
bool SetExportUsage(LayerTree::UsageState state)
Set state for exporting usage.
LayerNode(const LayerNode &other)
Constructor, with another LayerNode object.
LayerPrintData(const LayerPrintData &data)
Constructor, with another LayerPrintData object.
Definition: fs_pdflayer.h:768
graphics::GraphicsObjectArray GetGraphicsObjects(const PDFPage &page)
Get all graphics objects related to the layer which is associated with current layer node.
WIDE STRING CLASS.
Definition: fx_string.h:1463
objects::PDFArray * GetOCGs() const
Get the "OCGs" PDF array from current object.
Definition: fs_pdflayer.h:38
bool SetName(const wchar_t *name)
Set the name of current layer node.
Definition: fs_pdflayer.h:742
bool SetPrintUsage(const LayerPrintData &data)
Set data for layer printing usage.
Definition: fs_pdfdoc.h:338
objects::PDFDictionary * GetDict() const
Get the dictionary of current object.
~LayerContext()
Destructor.
bool SetBaseState(UsageState state)
Set the base state for all layers in the default configuration.
Definition: fs_pdflayer.h:121
LayerZoomData()
Constructor.
Definition: fs_pdflayer.h:46
bool operator!=(const LayerTree &other) const
Not equal operator.
Definition: fs_pdflayer.h:43
LayerContext(const PDFDoc &document, UsageType usage_type)
Constructor, based on a PDF document and specified layer usage type.
bool operator==(const LayerNode &other) const
Equal operator.
PDFDoc GetDocument()
Get the related PDF document.
bool RemoveUsage(LayerContext::UsageType usage_type)
Remove a kind of usage property.
UsageType
Enumeration for PDF layer usage type.
Definition: fs_pdflayer.h:252
LayerNode & operator=(const LayerNode &other)
Assign operator.
LayerZoomData(float min_factor, float max_factor)
Constructor, with parameters.
Definition: fs_pdflayer.h:58
int GetChildrenCount()
Get the count of children nodes.
bool AddGraphicsObject(const PDFPage &page, graphics::GraphicsObject *graphicsobject)
Add a graphics object to current layer node.
bool SetVisible(const LayerNode &layer, bool is_visible)
Set the visibility of a specified layer node in current layer context.
bool RemoveGraphicsObject(graphics::GraphicsObject *graphics_object)
Remove a graphics object from current layer node.
bool MoveTo(LayerNode parent_layer_node, int index)
Move current layer node to be one of the children of another layer node.
LayerZoomData(const LayerZoomData &data)
Constructor, with another LayerZoomData object.
Definition: fs_pdflayer.h:68
float max_factor
The magnification factor below which the group should be ON. A negative number means no magnification...
Definition: fs_pdflayer.h:110
bool IsVisible(const LayerNode &layer)
Check if a specified layer node is visible in current layer context.
float min_factor
The minimum recommended magnification factor at which the group should be ON. A negative number means...
Definition: fs_pdflayer.h:105
UsageType GetUsageType()
Get the layer usage type for rendering.
LayerPrintData GetPrintUsage()
Get the data for printing usage.
LayerZoomData GetZoomUsage()
Get the data for zooming usage.
Definition: fx_basic.h:1246
bool operator!=(const LayerNode &other) const
Not equal operator.
LayerPrintData(const String &subtype, LayerTree::UsageState print_state)
Constructor, with parameters.
Definition: fs_pdflayer.h:753
Definition: fs_pdfpage.h:306
LayerPrintData & operator=(const LayerPrintData &data)
Assign operator.
Definition: fs_pdflayer.h:780
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
Header file for common definitions and classes.
The state is OFF.
Definition: fs_pdflayer.h:132
Definition: fs_basictypes.h:333
Definition: fs_pdflayer.h:245
LayerContext & operator=(const LayerContext &other)
Assign operator.
Header file for PDF page related definitions and classes.
LayerTree::UsageState print_state
Layer usage state, indicating that the group should be set to that state when the document is printed...
Definition: fs_pdflayer.h:810
Definition: fs_pdflayer.h:401
Use for exporting.
Definition: fs_pdflayer.h:260
Definition: fs_pdfobject.h:762
bool IsEmpty() const
Check whether current object is empty or not.
LayerNode GetChild(int index)
Get a child node.
Foxit namespace.
Definition: fs_connectedpdf.h:26
bool IsEmpty() const
Check whether current object is empty or not.
bool HasLayer()
Check if current layer node is associated with a layer.
The state is ON.
Definition: fs_pdflayer.h:130
~LayerNode()
Destructor.
BYTE STRING CLASS.
Definition: fx_string.h:317
void Set(float min_factor, float max_factor)
Set value.
Definition: fs_pdflayer.h:96
Use for printing.
Definition: fs_pdflayer.h:258
bool IsInPage(const PDFPage &page)
Check if current layer node is in a specified PDF page.
bool SetDefaultVisible(bool is_visible)
Set default visibility.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
Header file for PDF graphics object related definitions and classes.
bool operator==(const LayerContext &other) const
Equal operator.
LayerTree & operator=(const LayerTree &other)
Assign operator.
bool MergeStates(const LayerContext &source_context)
Merge states from another layer context.
Definition: fs_pdfobject.h:574
bool HasIntent(const char *intent)
Check if current layer node has a specified intent.
LayerPrintData()
Constructor.
Definition: fs_pdflayer.h:759
WString GetName()
Get the name of current layer node.
bool SetViewUsage(LayerTree::UsageState state)
Set state for viewing usage.
bool IsEmpty() const
Check whether current object is empty or not.
bool RemoveChild(int index)
Remove a child node by index.
LayerTree::UsageState GetViewUsage()
Get the state for viewing usage.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.