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  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
249  explicit LayerTree(FS_HANDLE handle = NULL);
250 };
251 
255 class LayerPrintData FS_FINAL : public Object{
256  public:
267  this->subtype = subtype;
268  this->print_state = print_state;
269  }
270 
273  :print_state(LayerTree::e_StateUndefined) {
274  }
275 
282  subtype = data.subtype;
283  print_state = data.print_state;
284  }
285 
294  subtype = data.subtype;
295  print_state = data.print_state;
296  return (*this);
297  }
298 
311  this->subtype = subtype;
312  this->print_state = print_state;
313  }
314 
317 
326 };
327 
335 class LayerContext FS_FINAL : public Base {
336  public:
342  typedef enum _UsageType {
344  e_UsageView = 0x0000,
346  e_UsageDesign = 0x0001,
348  e_UsagePrint = 0x0002,
350  e_UsageExport = 0x0003,
352  e_UsageZoom = 0x0004
353  } UsageType;
354 
355 
363  explicit LayerContext(const PDFDoc& document, UsageType usage_type);
364 
370  LayerContext(const LayerContext& other);
378  LayerContext& operator = (const LayerContext& other);
379 
387  bool operator == (const LayerContext& other) const;
395  bool operator != (const LayerContext& other) const;
397  ~LayerContext();
405  bool IsEmpty() const;
406 
425  bool Reset();
433  bool CopyStates(const LayerContext& source_context);
442  bool MergeStates(const LayerContext& source_context);
450  bool IsVisible(const LayerNode& layer);
459  bool SetVisible(const LayerNode& layer, bool is_visible);
460 
461  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
462  explicit LayerContext(FS_HANDLE handle = NULL);
463 };
464 
488 class LayerNode FS_FINAL : public Base{
489  public:
495  LayerNode(const LayerNode& other);
503  LayerNode& operator = (const LayerNode& other);
504 
512  bool operator == (const LayerNode& other) const;
520  bool operator != (const LayerNode& other) const;
521 
529  bool IsEmpty() const;
530 
532  ~LayerNode();
533 
539  int GetChildrenCount();
548  LayerNode GetChild(int index);
557  bool RemoveChild(int index);
558 
573  bool MoveTo(LayerNode parent_layer_node, int index);
574 
587  LayerNode AddChild(int index, const wchar_t* name, bool has_Layer);
588 
594  WString GetName();
595 
602  bool IsLocked();
603 
610  bool HasLayer();
611 
628  bool HasIntent(const char* intent);
629 
642  bool IsInPage(const PDFPage& page);
643 
655 
667 
678 
689 
701  bool SetName(const wchar_t* name);
702 
714  bool SetDefaultVisible(bool is_visible);
715 
736 
756 
776  bool SetPrintUsage(const LayerPrintData& data);
777 
789  bool SetZoomUsage(const LayerZoomData& data);
790 
803 
816  bool AddGraphicsObject(const PDFPage& page, graphics::GraphicsObject* graphicsobject);
817 
831  bool RemoveGraphicsObject(graphics::GraphicsObject* graphics_object);
832 
847  bool RemoveUsage(LayerContext::UsageType usage_type);
848 
858 
868 
869  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
870  explicit LayerNode(FS_HANDLE handle = NULL);
871 };
872 } // namespace pdf
873 } // namespace foxit
874 #endif // FS_PDFLAYER_H_
875 
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:310
用于表示文档设计器的图稿结构组织。
Definition: fs_pdflayer.h:346
String subtype
指定图层控制的内容类型的字符串。
Definition: fs_pdflayer.h:316
LayerTree::UsageState GetExportUsage()
获取导出用途的状态。
用于缩放。
Definition: fs_pdflayer.h:352
用于查看器。
Definition: fs_pdflayer.h:344
bool operator==(const LayerTree &other) const
等于运算符。
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
状态为未定义。
Definition: fs_pdflayer.h:138
Definition: fs_annot.h:1586
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:281
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:255
bool SetPrintUsage(const LayerPrintData &data)
设置图层打印用途的数据。
LayerNodeArray GetOCGsByPageIndex(int page_index)
获取在指定页面上找到的OCG对象数组。
Definition: fs_pdfdoc.h:768
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:342
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:266
Definition: fs_pdfpage.h:417
LayerPrintData & operator=(const LayerPrintData &data)
赋值运算符。
Definition: fs_pdflayer.h:293
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
通用定义和类的头文件。
状态为关闭。
Definition: fs_pdflayer.h:134
Definition: fs_basictypes.h:465
Definition: fs_pdflayer.h:335
bool IsLocked()
检查当前图层节点是否被锁定。
LayerContext & operator=(const LayerContext &other)
赋值运算符。
foxit::pdf::annots::AnnotArray GetAnnots()
获取与当前图层节点相关的注释数组。
LayerTree::UsageState print_state
图层用途状态,指示从查看器应用程序打印文档时 组应设置为该状态。
Definition: fs_pdflayer.h:325
bool operator !=(const LayerNode &other) const
不等于运算符。
Definition: fs_pdflayer.h:488
用于导出。
Definition: fs_pdflayer.h:350
Definition: fs_pdfobject.h:848
bool IsEmpty() const
检查当前对象是否为空。
objects::PDFDictionary * GetDict() const
获取当前对象的PDF字典。
LayerNode GetChild(int index)
Get a child node.
Foxit命名空间。
Definition: fs_pdf3d.h:26
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:348
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:272
WString GetName()
获取当前图层节点的名称。
bool SetViewUsage(LayerTree::UsageState state)
设置查看用途的状态。
bool IsEmpty() const
检查当前对象是否为空。
bool RemoveChild(int index)
Remove a child node by index.
LayerTree::UsageState GetViewUsage()
获取查看用途的状态。