Foxit PDF SDK
fs_pdflayer.h
浏览该文件的文档.
1 
15 #ifndef FS_PDFLAYER_H_
16 #define FS_PDFLAYER_H_
17 
18 #include "common/fs_common.h"
20 
26 namespace foxit {
30 namespace pdf {
31 // forward declaration
32 class PDFDoc;
33 class PDFPage;
34 class LayerPrintData;
35 class LayerNode;
36 namespace annots {
37 class AnnotArray;
38 }
39 
41 FSDK_DEFINE_ARRAY(LayerNodeArray, LayerNode)
42 
43 
46 class LayerZoomData FS_FINAL : public Object {
47  public:
50  : min_factor(0)
51  , max_factor(0) {}
52 
61  LayerZoomData(float min_factor, float max_factor) {
62  this->min_factor = min_factor;
63  this->max_factor = max_factor;
64  }
65 
72  min_factor = data.min_factor;
73  max_factor = data.max_factor;
74  }
75 
83  LayerZoomData &operator = (const LayerZoomData& data) {
84  min_factor = data.min_factor;
85  max_factor = data.max_factor;
86  return (*this);
87  }
88 
99  void Set(float min_factor, float max_factor) {
100  this->min_factor = min_factor;
101  this->max_factor = max_factor;
102  }
103 
108  float min_factor;
113  float max_factor;
114 };
115 
123 class LayerTree FS_FINAL : public Base {
124  public:
130  typedef enum _UsageState {
132  e_StateON = 0x0000,
134  e_StateOFF = 0x0001,
139  } UsageState;
140 
141 
151  explicit LayerTree(const PDFDoc& document);
157  LayerTree(const LayerTree& other);
165  LayerTree& operator = (const LayerTree& other);
166 
174  bool operator == (const LayerTree& other) const;
182  bool operator != (const LayerTree& other) const;
183 
191  bool IsEmpty() const;
192 
194  ~LayerTree();
195 
207  bool SetBaseState(UsageState state);
208 
218 
227 
236  objects::PDFArray* GetOCGs() const;
237 
246  LayerNodeArray GetOCGsByPageIndex(int page_index);
247 
248 #ifndef __EMSCRIPTEN_RENDER__
249  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
250  explicit LayerTree(FS_HANDLE handle = NULL);
251 #endif
252 };
253 
257 class LayerPrintData FS_FINAL : public Object{
258  public:
269  this->subtype = subtype;
270  this->print_state = print_state;
271  }
272 
275  :print_state(LayerTree::e_StateUndefined) {
276  }
277 
284  subtype = data.subtype;
285  print_state = data.print_state;
286  }
287 
296  subtype = data.subtype;
297  print_state = data.print_state;
298  return (*this);
299  }
300 
313  this->subtype = subtype;
314  this->print_state = print_state;
315  }
316 
319 
328 };
329 
337 class LayerContext FS_FINAL : public Base {
338  public:
344  typedef enum _UsageType {
346  e_UsageView = 0x0000,
348  e_UsageDesign = 0x0001,
350  e_UsagePrint = 0x0002,
352  e_UsageExport = 0x0003,
354  e_UsageZoom = 0x0004
355  } UsageType;
356 
357 
365  explicit LayerContext(const PDFDoc& document, UsageType usage_type);
366 
372  LayerContext(const LayerContext& other);
380  LayerContext& operator = (const LayerContext& other);
381 
389  bool operator == (const LayerContext& other) const;
397  bool operator != (const LayerContext& other) const;
399  ~LayerContext();
407  bool IsEmpty() const;
408 
427  bool Reset();
435  bool CopyStates(const LayerContext& source_context);
444  bool MergeStates(const LayerContext& source_context);
452  bool IsVisible(const LayerNode& layer);
461  bool SetVisible(const LayerNode& layer, bool is_visible);
462 #ifndef __EMSCRIPTEN_RENDER__
463  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
464  explicit LayerContext(FS_HANDLE handle = NULL);
465 #endif
466 };
467 
491 class LayerNode FS_FINAL : public Base{
492  public:
498  LayerNode(const LayerNode& other);
506  LayerNode& operator = (const LayerNode& other);
507 
515  bool operator == (const LayerNode& other) const;
523  bool operator != (const LayerNode& other) const;
524 
532  bool IsEmpty() const;
533 
535  ~LayerNode();
536 
542  int GetChildrenCount();
551  LayerNode GetChild(int index);
560  bool RemoveChild(int index);
561 
576  bool MoveTo(LayerNode parent_layer_node, int index);
577 
590  LayerNode AddChild(int index, const wchar_t* name, bool has_Layer);
591 
597  WString GetName();
598 
605  bool IsLocked();
606 
613  bool HasLayer();
614 
631  bool HasIntent(const char* intent);
632 
645  bool IsInPage(const PDFPage& page);
646 
658 
670 
681 
692 
704  bool SetName(const wchar_t* name);
705 
717  bool SetDefaultVisible(bool is_visible);
718 
739 
759 
779  bool SetPrintUsage(const LayerPrintData& data);
780 
792  bool SetZoomUsage(const LayerZoomData& data);
793 
806 
819  bool AddGraphicsObject(const PDFPage& page, graphics::GraphicsObject* graphicsobject);
820 
834  bool RemoveGraphicsObject(graphics::GraphicsObject* graphics_object);
835 
850  bool RemoveUsage(LayerContext::UsageType usage_type);
851 
861 
871 
872 #ifndef __EMSCRIPTEN_RENDER__
873  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
874  explicit LayerNode(FS_HANDLE handle = NULL);
875 #endif
876 };
877 } // namespace pdf
878 } // namespace foxit
879 #endif // FS_PDFLAYER_H_
880 
Definition: fs_pdfgraphicsobject.h:232
LayerNode GetRootNode()
获取根图层节点。
UsageState
PDF图层基础状态的枚举。
Definition: fs_pdflayer.h:130
bool Reset()
重置当前图层上下文,返回到初始化状态。
void Set(const String &subtype, LayerTree::UsageState print_state)
设置值。
Definition: fs_pdflayer.h:312
用于表示文档设计器的图稿结构组织。
Definition: fs_pdflayer.h:348
String subtype
指定图层控制的内容类型的字符串。
Definition: fs_pdflayer.h:318
LayerTree::UsageState GetExportUsage()
获取导出用途的状态。
用于缩放。
Definition: fs_pdflayer.h:354
用于查看器。
Definition: fs_pdflayer.h:346
bool operator==(const LayerTree &other) const
等于运算符。
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:221
状态为未定义。
Definition: fs_pdflayer.h:138
Definition: fs_annot.h:1583
LayerTree(const PDFDoc &document)
从PDF文档构造的构造函数。
~LayerTree()
析构函数。
状态为未改变。
Definition: fs_pdflayer.h:136
bool SetZoomUsage(const LayerZoomData &data)
设置图层缩放用途的数据。
bool CopyStates(const LayerContext &source_context)
从另一个图层上下文复制状态。
LayerNode AddChild(int index, const wchar_t *name, bool has_Layer)
为当前图层节点添加一个新的图层节点作为子节点。
bool SetExportUsage(LayerTree::UsageState state)
设置导出用途的状态。
LayerNode(const LayerNode &other)
拷贝构造函数。
LayerPrintData(const LayerPrintData &data)
拷贝构造函数。
Definition: fs_pdflayer.h:283
graphics::GraphicsObjectArray GetGraphicsObjects(const PDFPage &page)
获取与当前图层节点关联的图层相关的所有图形对象。
bool operator !=(const LayerTree &other) const
不等于运算符。
宽字符串类
Definition: fx_string.h:1457
objects::PDFArray * GetOCGs() const
从当前对象获取"OCGs" PDF数组。
Definition: fs_pdflayer.h:41
bool SetName(const wchar_t *name)
设置当前图层节点的名称。
Definition: fs_pdflayer.h:257
bool SetPrintUsage(const LayerPrintData &data)
设置图层打印用途的数据。
LayerNodeArray GetOCGsByPageIndex(int page_index)
获取在指定页面上找到的OCG对象数组。
Definition: fs_pdfdoc.h:771
objects::PDFDictionary * GetDict() const
获取当前对象的字典。
~LayerContext()
析构函数。
bool SetBaseState(UsageState state)
为默认配置中的所有图层设置基础状态。
Definition: fs_pdflayer.h:123
LayerZoomData()
构造函数。
Definition: fs_pdflayer.h:49
Definition: fs_pdflayer.h:46
LayerContext(const PDFDoc &document, UsageType usage_type)
基于PDF文档和指定图层用途类型的构造函数。
bool operator==(const LayerNode &other) const
等于运算符。
PDFDoc GetDocument()
获取相关的PDF文档。
bool RemoveUsage(LayerContext::UsageType usage_type)
移除一种用途属性。
UsageType
PDF图层用途类型的枚举。
Definition: fs_pdflayer.h:344
LayerNode & operator=(const LayerNode &other)
赋值运算符。
LayerZoomData(float min_factor, float max_factor)
带参数的构造函数。
Definition: fs_pdflayer.h:61
int GetChildrenCount()
Get the count of children nodes.
bool AddGraphicsObject(const PDFPage &page, graphics::GraphicsObject *graphicsobject)
向当前图层节点添加图形对象。
bool SetVisible(const LayerNode &layer, bool is_visible)
在当前图层上下文中设置指定图层节点的可见性。
bool RemoveGraphicsObject(graphics::GraphicsObject *graphics_object)
从当前图层节点移除图形对象。
bool MoveTo(LayerNode parent_layer_node, int index)
将当前图层节点移动为另一个图层节点的子节点。
LayerZoomData(const LayerZoomData &data)
拷贝构造函数。
Definition: fs_pdflayer.h:71
float max_factor
组应该为开启状态的放大倍数下限。 负数表示没有放大缩放倍数。
Definition: fs_pdflayer.h:113
bool IsVisible(const LayerNode &layer)
检查指定图层节点在当前图层上下文中是否可见。
float min_factor
组应该为开启状态的最小推荐放大倍数。 负数表示没有最小缩放倍数。
Definition: fs_pdflayer.h:108
UsageType GetUsageType()
获取用于渲染的图层用途类型。
LayerPrintData GetPrintUsage()
获取打印用途的数据。
LayerZoomData GetZoomUsage()
获取缩放用途的数据。
Definition: fx_basic.h:1278
LayerPrintData(const String &subtype, LayerTree::UsageState print_state)
带参数的构造函数。
Definition: fs_pdflayer.h:268
Definition: fs_pdfpage.h:421
LayerPrintData & operator=(const LayerPrintData &data)
赋值运算符。
Definition: fs_pdflayer.h:295
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:214
通用定义和类的头文件。
状态为关闭。
Definition: fs_pdflayer.h:134
Definition: fs_basictypes.h:449
Definition: fs_pdflayer.h:337
bool IsLocked()
检查当前图层节点是否被锁定。
LayerContext & operator=(const LayerContext &other)
赋值运算符。
foxit::pdf::annots::AnnotArray GetAnnots()
获取与当前图层节点相关的注释数组。
LayerTree::UsageState print_state
图层用途状态,指示从查看器应用程序打印文档时 组应设置为该状态。
Definition: fs_pdflayer.h:327
bool operator !=(const LayerNode &other) const
不等于运算符。
Definition: fs_pdflayer.h:491
用于导出。
Definition: fs_pdflayer.h:352
Definition: fs_pdfobject.h:848
bool IsEmpty() const
检查当前对象是否为空。
objects::PDFDictionary * GetDict() const
获取当前对象的PDF字典。
LayerNode GetChild(int index)
Get a child node.
Foxit命名空间。
Definition: fs_taggedpdf.h:27
bool IsEmpty() const
检查当前对象是否为空。
bool HasLayer()
检查当前图层节点是否与图层关联。
状态为开启。
Definition: fs_pdflayer.h:132
~LayerNode()
析构函数。
字节字符串类
Definition: fx_string.h:317
void Set(float min_factor, float max_factor)
设置值。
Definition: fs_pdflayer.h:99
用于打印。
Definition: fs_pdflayer.h:350
bool IsInPage(const PDFPage &page)
检查当前图层节点是否在指定的PDF页面中。
bool SetDefaultVisible(bool is_visible)
设置默认可见性。
#define NULL
空指针值。
Definition: fx_system.h:792
PDF图形对象相关定义和类的头文件。
bool operator==(const LayerContext &other) const
等于运算符。
LayerTree & operator=(const LayerTree &other)
赋值运算符。
bool MergeStates(const LayerContext &source_context)
从另一个图层上下文合并状态。
Definition: fs_pdfobject.h:639
bool operator !=(const LayerContext &other) const
不等于运算符。
bool HasIntent(const char *intent)
检查当前图层节点是否具有指定的意图。
LayerPrintData()
构造函数。
Definition: fs_pdflayer.h:274
WString GetName()
获取当前图层节点的名称。
bool SetViewUsage(LayerTree::UsageState state)
设置查看用途的状态。
bool IsEmpty() const
检查当前对象是否为空。
bool RemoveChild(int index)
Remove a child node by index.
LayerTree::UsageState GetViewUsage()
获取查看用途的状态。