Foxit PDF SDK
fs_compliancecommon.h
浏览该文件的文档.
1 
15 #ifndef FS_COMPLIANCEENGINE_H_
16 #define FS_COMPLIANCEENGINE_H_
17 
18 #include "common/fs_common.h"
19 
25 namespace foxit {
29 namespace addon {
33 namespace compliance {
34 class ResultInformation;
35 class ProgressCallback;
38 class Preflight;
39 
49 class ComplianceEngine FS_FINAL : public Object{
50  public:
56  typedef enum _ViewOrPrintCondition {
68 
69 
100  static ErrorCode Initialize(const wchar_t* compliance_resource_folder_path, const char* compliance_engine_unlockcode);
101 
109  static void Release();
110 
111 #if !defined(_MAC_JAVA_)
112 
133 
142  static void ReleaseThreadContext();
143 #endif
144 
156  static void SetTempFolderPath(const wchar_t* temp_folder_path);
157 
167  static void EnableHandleTransparency(bool enable_handle_transparency);
168 
185  static void SetLanguage(const char* language);
186 };
187 
193  public:
199  virtual void Release() = 0;
200 
209  virtual void UpdateCurrentStateData(int current_rate, const WString& current_state_string) = 0;
210 
211  protected:
212  ~ProgressCallback() {}
213 };
214 
216 class PreflightSettingData FS_FINAL : public Object{
217  public:
223  typedef enum _LibraryType {
230  } LibraryType;
231 
237  typedef enum _OperateType {
244  } OperateType;
245 
246 
249  : preflight_key(L"")
251  , src_pdf_path(L"")
252  , saved_pdf_path(L"")
253  , first_page_index(0)
254  , last_page_index(-1) {}
255 
273  this->preflight_key = preflight_key;
274  this->operate_type = operate_type;
275  this->src_pdf_path = src_pdf_path;
276  this->saved_pdf_path = saved_pdf_path;
277  this->first_page_index = first_page_index;
278  this->last_page_index = last_page_index;
279  }
280 
290  operate_type = data.operate_type;
291  src_pdf_path = data.src_pdf_path;
295  return (*this);
296  }
297 
300 
307 
310 
313 
316 
323 };
324 
326 class PreflightReportSettingData FS_FINAL : public Object{
327  public:
333  typedef enum _ReportFileFormatType {
343 
349  typedef enum _ProblemsHighlightMethod {
355 
356 
360  , to_generate_overview(true)
361  , to_highlight_problems(true)
363  , report_file_path(L"") {}
364 
381  ProblemsHighlightMethod problem_highlight_method, const wchar_t* report_file_path) {
382  this->report_file_format_type = report_file_format_type;
383  this->to_generate_overview = to_generate_overview;
384  this->to_highlight_problems = to_highlight_problems;
385  this->problems_highlight_method = problem_highlight_method;
386  this->report_file_path = report_file_path;
387  }
388 
402  return (*this);
403  }
404 
410 
413 
416 
423 
426 };
427 
430  public:
436  virtual void Release() = 0;
437 
448  virtual WString GetGroupItemLocalName(const WString& key) = 0;
449 
461  virtual WString GetGroupItemLocalComment(const WString& key) = 0;
462 
463  protected:
465 };
466 
470 class Preflight FS_FINAL : public Base {
471  public:
473  Preflight();
474 
475  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
476  explicit Preflight(FS_HANDLE handle);
477 
479  ~Preflight();
480 
486  Preflight(const Preflight& other);
487 
495  Preflight& operator = (const Preflight& other);
496 
504  bool operator == (const Preflight& other) const;
505 
513  bool operator != (const Preflight& other) const;
514 
522  bool IsEmpty() const;
523 
535 
543  StringArray GetItemKeysArray(const String& group_name);
544 
553  ResultInformation Analyze(const PreflightSettingData& preflight_setting_data, ProgressCallback* progress_callback = NULL);
554 
563  ResultInformation AnalyzeAndFixup(const PreflightSettingData& preflight_setting_data, ProgressCallback* progress_callback = NULL);
564 
576  bool GenerateXMLReport(const wchar_t* xml_report_file_path, ProgressCallback* progress_callback = NULL);
577 
588  bool GenerateReport(const PreflightReportSettingData& preflight_report_setting_data, ProgressCallback* progress_callback = NULL);
589 
597  bool CanFixup(const String& item_key);
598 
611 
621  WString GetGroupItemName(const String& key);
622 
632  WString GetGroupItemComment(const String& key);
633 };
634 
638 class FixupData : public Object {
639  public:
645  typedef enum _FixupState {
652  } FixupState;
653 
654 
657  : used_count(0)
659 
665  FixupData(const FixupData& other)
666  : used_count(other.used_count)
667  , state(other.state)
668  , name(other.name)
669  , comment(other.comment)
670  , reasons(other.reasons) {}
671 
679  FixupData& operator = (const FixupData& other) {
680  used_count = other.used_count;
681  state = other.state;
682  name = other.name;
683  comment = other.comment;
684  reasons = other.reasons;
685  return *this;
686  }
687 
695  bool operator == (const FixupData& other) const {
696  bool is_equal = (used_count == other.used_count && state == other.state &&
697  name == other.name && comment == other.comment);
698  if (is_equal) {
699  for (int i=0; i<(int)reasons.GetSize(); i++) {
700  if (reasons[i] != other.reasons[i]) {
701  is_equal = false;
702  break;
703  }
704  }
705  }
706  return is_equal;
707  }
708 
716  bool operator != (const FixupData& other) const {
717  return !((*this) == other);
718  }
719 
733 };
734 
738 class HitData : public Object {
739  public:
745  typedef enum _CheckSeverity {
752  } CheckSeverity;
753 
754 
757  : triggered_count(0)
759  , page_index(-1){}
760 
766  HitData(const HitData& other)
768  , severity(other.severity)
769  , name(other.name)
770  , comment(other.comment)
771  , dict_key(other.dict_key)
773  , page_index(other.page_index) {}
774 
782  HitData& operator = (const HitData& other) {
784  severity = other.severity;
785  name = other.name;
786  comment = other.comment;
787  dict_key = other.dict_key;
789  page_index = other.page_index;
790  return *this;
791  }
792 
800  bool operator == (const HitData& other) const {
801  bool is_equal = (triggered_count == other.triggered_count && severity == other.severity &&
802  name == other.name && comment == other.comment && page_index == other.page_index && dict_key == other.dict_key);
803  if (is_equal) {
804  for (int i=0; i<(int)trigger_values.GetSize(); i++) {
805  if (trigger_values[i] != other.trigger_values[i]) {
806  is_equal = false;
807  break;
808  }
809  }
810  }
811  return is_equal;
812  }
813 
821  bool operator != (const HitData& other) const {
822  return !((*this) == other);
823  }
824 
842 };
843 
848 class ResultInformation FS_FINAL : public Base {
849  public:
852  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
853  explicit ResultInformation(FS_HANDLE handle);
861  ResultInformation(const ResultInformation& other);
862 
878  bool operator == (const ResultInformation& other) const;
879 
887  bool operator != (const ResultInformation& other) const;
888 
896  bool IsEmpty() const;
897 
905  int GetFixupDataCount() const;
916  FixupData GetFixupData(int index) const;
917 
925  int GetHitDataCount() const;
926 
937  HitData GetHitData(int index) const;
938 };
939 } // namespace compliance/**
940 } // namespace addon
941 } // namespace foxit
942 
943 #endif // FS_COMPLIANCEENGINE_H_
virtual void Release()=0
用于释放当前回调对象本身的回调函数。
LibraryType
预检库类型的枚举。
Definition: fs_compliancecommon.h:223
PreflightReportSettingData()
构造函数。
Definition: fs_compliancecommon.h:358
FixupData & operator=(const FixupData &other)
赋值操作符。
Definition: fs_compliancecommon.h:679
错误严重性。
Definition: fs_compliancecommon.h:751
报告文件格式类型:XML。
Definition: fs_compliancecommon.h:337
bool operator !=(const HitData &other) const
不相等操作符。
Definition: fs_compliancecommon.h:821
void SetPreflightGroupLocalCallback(PreflightGroupLocalCallback *callback)
为预检组项设置本地化名称和注释回调。
int page_index
页面索引,从0开始。-1表示当前命中数据在文档级别被命中。
Definition: fs_compliancecommon.h:841
bool to_generate_overview
是否生成概述。true表示生成概述,false表示不生成。
Definition: fs_compliancecommon.h:412
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
预检库类型:Foxit。
Definition: fs_compliancecommon.h:225
WString GetGroupItemName(const String &key)
通过密钥获取组项的名称。
HitData GetHitData(int index) const
获取命中数据。
int first_page_index
要分析或修复的第一页的索引,从0开始。默认值:0。
Definition: fs_compliancecommon.h:315
bool CanFixup(const String &item_key)
检查项目密钥是否可以修复。
Definition: fs_basictypes.h:227
Definition: fs_compliancecommon.h:848
FixupData GetFixupData(int index) const
获取修复数据。
uint32 triggered_count
表示在文档验证或转换过程中当前数据的命中操作被触发的次数。
Definition: fs_compliancecommon.h:826
ReportFileFormatType
预检报告文件格式类型的枚举。
Definition: fs_compliancecommon.h:333
FixupData()
构造函数。
Definition: fs_compliancecommon.h:656
修复成功。
Definition: fs_compliancecommon.h:647
StringArray GetItemKeysArray(const String &group_name)
使用特定组名获取项目密钥数组。
WStringArray trigger_values
触发值数组。触发值的数量不超过triggered_count。
Definition: fs_compliancecommon.h:839
bool GenerateReport(const PreflightReportSettingData &preflight_report_setting_data, ProgressCallback *progress_callback=0)
在分析或修复后生成报告。
CheckSeverity severity
当前命中数据的检查严重性。请参考从 HitData::e_CheckSeverityInfo 开始的值, 这应该是这些值之一。
Definition: fs_compliancecommon.h:831
宽字符串类
Definition: fx_string.h:1457
HitData & operator=(const HitData &other)
赋值操作符。
Definition: fs_compliancecommon.h:782
Definition: fs_compliancecommon.h:738
int GetHitDataCount() const
获取命中数据的数量。
查看或打印条件:Japan Color 2001 Coated。
Definition: fs_compliancecommon.h:64
Definition: fs_compliancecommon.h:216
通过透明遮罩高亮显示问题。
Definition: fs_compliancecommon.h:351
PreflightSettingData(const wchar_t *preflight_key, OperateType operate_type, const wchar_t *src_pdf_path, const wchar_t *saved_pdf_path, int first_page_index, int last_page_index)
带参数的构造函数。
Definition: fs_compliancecommon.h:271
ViewOrPrintCondition
查看或打印条件的枚举。
Definition: fs_compliancecommon.h:56
HitData()
构造函数。
Definition: fs_compliancecommon.h:756
Definition: fs_compliancecommon.h:326
PreflightReportSettingData & operator=(const PreflightReportSettingData &data)
赋值操作符。
Definition: fs_compliancecommon.h:396
HitData(const HitData &other)
带另一个命中数据对象的构造函数。
Definition: fs_compliancecommon.h:766
FixupState state
修复状态。请参考从 FixupData::e_FixupStateSuccess 开始的值, 这应该是这些值之一。
Definition: fs_compliancecommon.h:726
WStringArray reasons
修复原因。这可能是空数组。原因的数量不会超过used_times。
Definition: fs_compliancecommon.h:732
virtual void UpdateCurrentStateData(int current_rate, const WString &current_state_string)=0
用于向用户更新当前进度状态数据的回调函数,以便用户可以更新其进度条。
int GetFixupDataCount() const
获取修复数据的数量。
预检库类型:印前、颜色和透明度。
Definition: fs_compliancecommon.h:229
bool operator==(const ResultInformation &other) const
相等操作符。
bool IsEmpty() const
检查当前对象是否为空。
WString comment
命中规则注释,用于解释规则的更多详细信息。
Definition: fs_compliancecommon.h:835
FixupData(const FixupData &other)
带另一个修复数据对象的构造函数。
Definition: fs_compliancecommon.h:665
bool operator==(const FixupData &other) const
相等操作符。
Definition: fs_compliancecommon.h:695
static void EnableHandleTransparency(bool enable_handle_transparency)
设置标志以决定是否启用透明度处理。
FixupState
修复数据状态的枚举。
Definition: fs_compliancecommon.h:645
Definition: fs_compliancecommon.h:192
WString name
修复规则名称。
Definition: fs_compliancecommon.h:728
ErrorCode
错误代码的枚举。
Definition: fs_basictypes.h:236
int last_page_index
要分析或修复的最后一页的索引。如果这是-1,那意味着 源PDF文件的所有页面都将被分析,并且 参数first_page_index将被忽略。默认值:-1。
Definition: fs_compliancecommon.h:322
bool operator==(const Preflight &other) const
相等操作符。
bool operator==(const HitData &other) const
相等操作符。
Definition: fs_compliancecommon.h:800
操作类型:单项修复。
Definition: fs_compliancecommon.h:243
查看或打印条件:PSO Coated v3 (ECI)。
Definition: fs_compliancecommon.h:66
static void SetTempFolderPath(const wchar_t *temp_folder_path)
为合规性引擎设置临时文件夹。
查看或打印条件:ISO Coated v2 (ECI)。
Definition: fs_compliancecommon.h:62
操作类型:单项检查。
Definition: fs_compliancecommon.h:241
Definition: fs_compliancecommon.h:49
修复失败。
Definition: fs_compliancecommon.h:649
查看或打印条件:自动。
Definition: fs_compliancecommon.h:58
bool operator !=(const ResultInformation &other) const
不相等操作符。
virtual WString GetGroupItemLocalComment(const WString &key)=0
通过密钥获取组项的本地注释。
Definition: fs_compliancecommon.h:429
报告文件格式类型:HTML。
Definition: fs_compliancecommon.h:341
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:195
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
通用定义和类的头文件。
WString comment
修复规则注释,用于解释规则的更多详细信息。
Definition: fs_compliancecommon.h:730
bool operator !=(const FixupData &other) const
不相等操作符。
Definition: fs_compliancecommon.h:716
ResultInformation AnalyzeAndFixup(const PreflightSettingData &preflight_setting_data, ProgressCallback *progress_callback=0)
分析并修复PDF文件。
bool operator !=(const Preflight &other) const
不相等操作符。
信息严重性。
Definition: fs_compliancecommon.h:747
警告严重性。
Definition: fs_compliancecommon.h:749
PreflightSettingData & operator=(const PreflightSettingData &data)
赋值操作符。
Definition: fs_compliancecommon.h:288
uint32 used_count
表示转换过程中当前数据的修复操作调用次数。
Definition: fs_compliancecommon.h:721
Definition: fs_basictypes.h:471
Definition: fs_basictypes.h:229
ResultInformation Analyze(const PreflightSettingData &preflight_setting_data, ProgressCallback *progress_callback=0)
分析PDF文件。
OperateType
预检操作类型的枚举。
Definition: fs_compliancecommon.h:237
static void Release()
释放合规性引擎。
WString dict_key
命中规则字典。
Definition: fs_compliancecommon.h:837
CheckSeverity
命中数据检查严重性的枚举。
Definition: fs_compliancecommon.h:745
WString name
命中规则名称。
Definition: fs_compliancecommon.h:833
WString src_pdf_path
要分析和修复的源PDF文件的完整路径。
Definition: fs_compliancecommon.h:309
Preflight & operator=(const Preflight &other)
赋值操作符。
Foxit 命名空间。
Definition: fs_accessibility.h:28
StringArray GetGroupNamesArray(const PreflightSettingData::LibraryType &library_type, const PreflightSettingData::OperateType &operate_type)
获取与库类型和操作类型对应的所有组名数组。
ProblemsHighlightMethod problems_highlight_method
高亮显示问题的方法。仅当to_highlight_problems为true且report_file_format_type 为 PreflightReportSettingData::e_Report...
Definition: fs_compliancecommon.h:422
字节字符串类
Definition: fx_string.h:317
static void ReleaseThreadContext()
释放线程的合规性上下文。
size_t GetSize() const
获取当前数组中元素的大小。
WString GetGroupItemComment(const String &key)
通过密钥获取组项的注释。
bool IsEmpty() const
检查当前对象是否为空。
报告文件格式类型:TXT 和 TEXT。
Definition: fs_compliancecommon.h:339
预检库类型:标准。
Definition: fs_compliancecommon.h:227
报告文件格式类型:PDF。
Definition: fs_compliancecommon.h:335
static ErrorCode Initialize(const wchar_t *compliance_resource_folder_path, const char *compliance_engine_unlockcode)
初始化合规性引擎。
操作类型:配置文件。
Definition: fs_compliancecommon.h:239
static void SetLanguage(const char *language)
为合规性引擎设置语言。
ResultInformation & operator=(const ResultInformation &other)
赋值操作符。
#define NULL
空指针值。
Definition: fx_system.h:792
PreflightReportSettingData(ReportFileFormatType report_file_format_type, bool to_generate_overview, bool to_highlight_problems, ProblemsHighlightMethod problem_highlight_method, const wchar_t *report_file_path)
带参数的构造函数。
Definition: fs_compliancecommon.h:380
bool GenerateXMLReport(const wchar_t *xml_report_file_path, ProgressCallback *progress_callback=0)
在分析或修复后生成XML报告。
OperateType operate_type
预检操作类型。 请参考从 PreflightSettingData::e_OperateTypeProfiles 开始的值, 这应该是这些值之一。
Definition: fs_compliancecommon.h:306
ReportFileFormatType report_file_format_type
报告文件格式类型。 请参考从 PreflightReportSettingData::e_ReportFileFormatTypePdf 开始的值, 这应该是这些值之一。
Definition: fs_compliancecommon.h:409
virtual WString GetGroupItemLocalName(const WString &key)=0
通过密钥获取组项的本地名称。
修复不需要。
Definition: fs_compliancecommon.h:651
virtual void Release()=0
用于释放当前回调对象本身的回调函数。
PreflightSettingData()
构造函数。
Definition: fs_compliancecommon.h:248
通过图层高亮显示问题。
Definition: fs_compliancecommon.h:353
WString report_file_path
报告文件的完整路径。这不应该是空字符串。
Definition: fs_compliancecommon.h:425
Definition: fs_compliancecommon.h:638
ProblemsHighlightMethod
预检问题高亮方法的枚举。
Definition: fs_compliancecommon.h:349
static ErrorCode InitializeThreadContext()
为新线程初始化合规性上下文。
Definition: fs_compliancecommon.h:470
查看或打印条件:Coated GRACoL 2006。
Definition: fs_compliancecommon.h:60
WString saved_pdf_path
保存由预检分析和修复过程生成的PDF文件的完整路径。
Definition: fs_compliancecommon.h:312
bool to_highlight_problems
是否高亮显示问题。true表示高亮显示问题,false表示不高亮。
Definition: fs_compliancecommon.h:415
WString preflight_key
预检密钥。通过 Preflight::GetItemKeysArray 检索可用密钥。
Definition: fs_compliancecommon.h:299