Foxit PDF SDK
fs_compliancecommon.h
Go to the documentation of this file.
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 
102  static ErrorCode Initialize(const wchar_t* compliance_resource_folder_path, const char* compliance_engine_unlockcode);
103 
112  static void Release();
113 
114 #if !defined(_MAC_JAVA_)
115 
137 
147  static void ReleaseThreadContext();
148 #endif
149 
162  static void SetTempFolderPath(const wchar_t* temp_folder_path);
163 
180  static void SetLanguage(const char* language);
181 };
182 
188  public:
194  virtual void Release() = 0;
195 
204  virtual void UpdateCurrentStateData(int current_rate, const WString& current_state_string) = 0;
205 
206  protected:
207  ~ProgressCallback() {}
208 };
209 
211 class PreflightSettingData FS_FINAL : public Object{
212  public:
218  typedef enum _LibraryType {
225  } LibraryType;
226 
232  typedef enum _OperateType {
239  } OperateType;
240 
241 
244  : preflight_key(L"")
246  , src_pdf_path(L"")
247  , saved_pdf_path(L"")
248  , first_page_index(0)
249  , last_page_index(-1) {}
250 
268  this->preflight_key = preflight_key;
269  this->operate_type = operate_type;
270  this->src_pdf_path = src_pdf_path;
271  this->saved_pdf_path = saved_pdf_path;
272  this->first_page_index = first_page_index;
273  this->last_page_index = last_page_index;
274  }
275 
285  operate_type = data.operate_type;
286  src_pdf_path = data.src_pdf_path;
290  return (*this);
291  }
292 
295 
302 
305 
308 
311 
318 };
319 
321 class PreflightReportSettingData FS_FINAL : public Object{
322  public:
328  typedef enum _ReportFileFormatType {
338 
344  typedef enum _ProblemsHighlightMethod {
350 
351 
355  , to_generate_overview(true)
356  , to_highlight_problems(true)
358  , report_file_path(L"") {}
359 
375  ProblemsHighlightMethod problem_highlight_method, const wchar_t* report_file_path) {
376  this->report_file_format_type = report_file_format_type;
377  this->to_generate_overview = to_generate_overview;
378  this->to_highlight_problems = to_highlight_problems;
379  this->problems_highlight_method = problem_highlight_method;
380  this->report_file_path = report_file_path;
381  }
382 
396  return (*this);
397  }
398 
404 
407 
410 
417 
420 };
421 
425 class Preflight FS_FINAL : public Base {
426  public:
428  Preflight();
429 
430  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
431  explicit Preflight(FS_HANDLE handle);
432 
434  ~Preflight();
435 
441  Preflight(const Preflight& other);
442 
450  Preflight& operator = (const Preflight& other);
451 
459  bool operator == (const Preflight& other) const;
460 
468  bool operator != (const Preflight& other) const;
469 
477  bool IsEmpty() const;
478 
492 
500  StringArray GetItemKeysArray(const String& group_name);
501 
510  void Analyze(const PreflightSettingData& preflight_setting_data, ProgressCallback* progress_callback = NULL);
511 
520  void AnalyzeAndFixup(const PreflightSettingData& preflight_setting_data, ProgressCallback* progress_callback = NULL);
521 
530  bool GenerateReport(const PreflightReportSettingData& preflight_report_setting_data, ProgressCallback* progress_callback = NULL);
531 
539  bool CanFixup(const String& item_key);
540 };
541 
545 class FixupData : public Object {
546  public:
552  typedef enum _FixupState {
559  } FixupState;
560 
561 
564  : used_count(0)
566 
572  FixupData(const FixupData& other)
573  : used_count(other.used_count)
574  , state(other.state)
575  , name(other.name)
576  , comment(other.comment)
577  , reasons(other.reasons) {}
578 
586  FixupData& operator = (const FixupData& other) {
587  used_count = other.used_count;
588  state = other.state;
589  name = other.name;
590  comment = other.comment;
591  reasons = other.reasons;
592  return *this;
593  }
594 
602  bool operator == (const FixupData& other) const {
603  bool is_equal = (used_count == other.used_count && state == other.state &&
604  name == other.name && comment == other.comment);
605  if (is_equal) {
606  for (int i=0; i<(int)reasons.GetSize(); i++) {
607  if (reasons[i] != other.reasons[i]) {
608  is_equal = false;
609  break;
610  }
611  }
612  }
613  return is_equal;
614  }
615 
623  bool operator != (const FixupData& other) const {
624  return !((*this) == other);
625  }
626 
640 };
641 
645 class HitData : public Object {
646  public:
652  typedef enum _CheckSeverity {
659  } CheckSeverity;
660 
661 
664  : triggered_count(0)
666  , page_index(-1){}
667 
673  HitData(const HitData& other)
675  , severity(other.severity)
676  , name(other.name)
677  , comment(other.comment)
679  , page_index(other.page_index) {}
680 
688  HitData& operator = (const HitData& other) {
690  severity = other.severity;
691  name = other.name;
692  comment = other.comment;
694  page_index = other.page_index;
695  return *this;
696  }
697 
705  bool operator == (const HitData& other) const {
706  bool is_equal = (triggered_count == other.triggered_count && severity == other.severity &&
707  name == other.name && comment == other.comment && page_index == other.page_index);
708  if (is_equal) {
709  for (int i=0; i<(int)trigger_values.GetSize(); i++) {
710  if (trigger_values[i] != other.trigger_values[i]) {
711  is_equal = false;
712  break;
713  }
714  }
715  }
716  return is_equal;
717  }
718 
726  bool operator != (const HitData& other) const {
727  return !((*this) == other);
728  }
729 
745 };
746 
751 class ResultInformation FS_FINAL : public Base {
752  public:
755  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
756  explicit ResultInformation(FS_HANDLE handle);
764  ResultInformation(const ResultInformation& other);
765 
781  bool operator == (const ResultInformation& other) const;
782 
790  bool operator != (const ResultInformation& other) const;
791 
799  bool IsEmpty() const;
800 
806  int GetFixupDataCount() const;
815  FixupData GetFixupData(int index) const;
816 
822  int GetHitDataCount() const;
823 
832  HitData GetHitData(int index) const;
833 };
834 } // namespace compliance/**
835 } // namespace addon
836 } // namespace foxit
837 
838 #endif // FS_COMPLIANCEENGINE_H_
virtual void Release()=0
A callback function used to release current callback object itself.
LibraryType
Enumeration for the preflight library type.
Definition: fs_compliancecommon.h:218
PreflightReportSettingData()
Constructor.
Definition: fs_compliancecommon.h:353
FixupData & operator=(const FixupData &other)
Assign operator.
Definition: fs_compliancecommon.h:586
Error severity.
Definition: fs_compliancecommon.h:658
Report file format type: XML.
Definition: fs_compliancecommon.h:332
bool operator !=(const HitData &other) const
Not equal operator.
Definition: fs_compliancecommon.h:726
int page_index
Page index, starting from 0. -1 means current hit data was hit in document level.
Definition: fs_compliancecommon.h:744
bool to_generate_overview
Whether to generate overview or not. true menas to generate overview, false means not.
Definition: fs_compliancecommon.h:406
CFX_Object Object
Object type.
Definition: fs_basictypes.h:221
Preflight library type: Foxit.
Definition: fs_compliancecommon.h:220
HitData GetHitData(int index) const
Get a hit data.
int first_page_index
Index of the first page to be analyzed or fixed, staring from 0. Default value: 0.
Definition: fs_compliancecommon.h:310
bool CanFixup(const String &item_key)
Check whether the item key can be fixuped or not.
Definition: fs_basictypes.h:228
Definition: fs_compliancecommon.h:751
FixupData GetFixupData(int index) const
Get a fixup data.
uint32 triggered_count
Represents how many times the hit operation for current data has been triggered during verifying or c...
Definition: fs_compliancecommon.h:731
ReportFileFormatType
Enumeration for the preflight report file format type.
Definition: fs_compliancecommon.h:328
FixupData()
Constructor.
Definition: fs_compliancecommon.h:563
A fixup succeeded.
Definition: fs_compliancecommon.h:554
StringArray GetItemKeysArray(const String &group_name)
Get item keys array with the specific group name.
WStringArray trigger_values
Array of trigger values. The count of triggered values is no more then triggered_count.
Definition: fs_compliancecommon.h:742
bool GenerateReport(const PreflightReportSettingData &preflight_report_setting_data, ProgressCallback *progress_callback=0)
Generate report after analyzing or fixing.
CheckSeverity severity
The check severity of current hit data. Please refer to values starting from HitData::e_CheckSeverity...
Definition: fs_compliancecommon.h:736
WIDE STRING CLASS.
Definition: fx_string.h:1461
HitData & operator=(const HitData &other)
Assign operator.
Definition: fs_compliancecommon.h:688
Definition: fs_compliancecommon.h:645
int GetHitDataCount() const
Get count of hit data.
Viewing or printing condition:Japan Color 2001 Coated.
Definition: fs_compliancecommon.h:64
Definition: fs_compliancecommon.h:211
Problems highlighted by transparent masks.
Definition: fs_compliancecommon.h:346
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)
Constructor, with parameters.
Definition: fs_compliancecommon.h:266
ViewOrPrintCondition
Enumeration for viewing or printing condition.
Definition: fs_compliancecommon.h:56
HitData()
Constructor.
Definition: fs_compliancecommon.h:663
Definition: fs_compliancecommon.h:321
PreflightReportSettingData & operator=(const PreflightReportSettingData &data)
Assign operator.
Definition: fs_compliancecommon.h:390
HitData(const HitData &other)
Constructor, with another hit data object.
Definition: fs_compliancecommon.h:673
FixupState state
Fixup state. Please refer to values starting from FixupData::e_FixupStateSuccess and this should be o...
Definition: fs_compliancecommon.h:633
WStringArray reasons
Fixup reasons. This may be an empty array. The count of reasons is no more then used_times.
Definition: fs_compliancecommon.h:639
virtual void UpdateCurrentStateData(int current_rate, const WString &current_state_string)=0
A callback function used to update current progress state data to user in order that user can update ...
int GetFixupDataCount() const
Get count of fixup data.
Preflight library type: Prepress,Color and Transparency.
Definition: fs_compliancecommon.h:224
bool operator==(const ResultInformation &other) const
Equal operator.
bool IsEmpty() const
Check whether current object is empty or not.
WString comment
Hit rule comment to explain more details about the rule.
Definition: fs_compliancecommon.h:740
FixupData(const FixupData &other)
Constructor, with another fixup data object.
Definition: fs_compliancecommon.h:572
bool operator==(const FixupData &other) const
Equal operator.
Definition: fs_compliancecommon.h:602
FixupState
Enumeration for the state of a fixup data.
Definition: fs_compliancecommon.h:552
Definition: fs_compliancecommon.h:187
WString name
Fixup rule name.
Definition: fs_compliancecommon.h:635
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:237
int last_page_index
Index of the last page to be verified. If this is -1, that means all the pages of the source PDF file...
Definition: fs_compliancecommon.h:317
bool operator==(const Preflight &other) const
Equal operator.
bool operator==(const HitData &other) const
Equal operator.
Definition: fs_compliancecommon.h:705
Opearte type: single fixups.
Definition: fs_compliancecommon.h:238
Viewing or printing condition: PSO Coated v3 (ECI).
Definition: fs_compliancecommon.h:66
static void SetTempFolderPath(const wchar_t *temp_folder_path)
Set a temp folder for compliance engine.
Viewing or printing condition:ISO Coated v2 (ECI).
Definition: fs_compliancecommon.h:62
Opearte type: single checks.
Definition: fs_compliancecommon.h:236
Definition: fs_compliancecommon.h:49
A fixup failed.
Definition: fs_compliancecommon.h:556
Viewing or printing condition: Auto.
Definition: fs_compliancecommon.h:58
bool operator !=(const ResultInformation &other) const
Not equal operator.
Report file format type: HTML.
Definition: fs_compliancecommon.h:336
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
Header file for common definitions and classes.
WString comment
Fixup rule comment to explain more details about the rule.
Definition: fs_compliancecommon.h:637
bool operator !=(const FixupData &other) const
Not equal operator.
Definition: fs_compliancecommon.h:623
bool operator !=(const Preflight &other) const
Not equal operator.
Info severity.
Definition: fs_compliancecommon.h:654
Warning severity.
Definition: fs_compliancecommon.h:656
PreflightSettingData & operator=(const PreflightSettingData &data)
Assign operator.
Definition: fs_compliancecommon.h:283
uint32 used_count
Represents how many times the fixup operation for current data has been triggered during converting p...
Definition: fs_compliancecommon.h:628
Definition: fs_basictypes.h:443
void Analyze(const PreflightSettingData &preflight_setting_data, ProgressCallback *progress_callback=0)
Analyze a PDF file.
Definition: fs_basictypes.h:230
OperateType
Enumeration for the preflight operate type.
Definition: fs_compliancecommon.h:232
static void Release()
Release compliance engine.
CheckSeverity
Enumeration for check severity of a hit data.
Definition: fs_compliancecommon.h:652
WString name
Hit rule name.
Definition: fs_compliancecommon.h:738
WString src_pdf_path
A complete path of source PDF file to be analyze and fix.
Definition: fs_compliancecommon.h:304
Preflight & operator=(const Preflight &other)
Assign operator.
Foxit namespace.
Definition: fs_pdf3d.h:27
void AnalyzeAndFixup(const PreflightSettingData &preflight_setting_data, ProgressCallback *progress_callback=0)
Analyze and fixup a PDF file.
StringArray GetGroupNamesArray(const PreflightSettingData::LibraryType &library_type, const PreflightSettingData::OperateType &operate_type)
Get all group names array corresponding to the library type and operation type.
ProblemsHighlightMethod problems_highlight_method
The method highlight problems. This parameter is only useful when to_highlight_problems is true and r...
Definition: fs_compliancecommon.h:416
BYTE STRING CLASS.
Definition: fx_string.h:317
static void ReleaseThreadContext()
Release compliance context of the thread.
size_t GetSize() const
Get the size of elements in current array.
bool IsEmpty() const
Check whether current object is empty or not.
Report file format type: TXT & TEXT.
Definition: fs_compliancecommon.h:334
Preflight library type: Standards.
Definition: fs_compliancecommon.h:222
Report file format type: PDF.
Definition: fs_compliancecommon.h:330
static ErrorCode Initialize(const wchar_t *compliance_resource_folder_path, const char *compliance_engine_unlockcode)
Initialize compliance engine.
Opearte type: profiles.
Definition: fs_compliancecommon.h:234
static void SetLanguage(const char *language)
Set language for compliance engine.
ResultInformation & operator=(const ResultInformation &other)
Assign operator.
#define NULL
The null-pointer value.
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)
Constructor, with parameters.
Definition: fs_compliancecommon.h:374
OperateType operate_type
The preflight operate type. Please refer to values starting from PreflightSettingData::e_OperateTypeP...
Definition: fs_compliancecommon.h:301
ReportFileFormatType report_file_format_type
The report file format type. Please refer to values starting from PreflightReportSettingData::e_Repor...
Definition: fs_compliancecommon.h:403
A fixup was not required.
Definition: fs_compliancecommon.h:558
PreflightSettingData()
Constructor.
Definition: fs_compliancecommon.h:243
Problems highlighted by layers.
Definition: fs_compliancecommon.h:348
WString report_file_path
A complete path for report file. This should not be an empty string.
Definition: fs_compliancecommon.h:419
Definition: fs_compliancecommon.h:545
ProblemsHighlightMethod
Enumeration for the highlight method for preflight problems.
Definition: fs_compliancecommon.h:344
static ErrorCode InitializeThreadContext()
Initialize compliance context for a new thread.
Definition: fs_compliancecommon.h:425
Viewing or printing condition:Coated GRACoL 2006.
Definition: fs_compliancecommon.h:60
WString saved_pdf_path
A complete path for saving the analyze and fix PDF file. Only use to analyze and fix.
Definition: fs_compliancecommon.h:307
bool to_highlight_problems
Whether to highlight problems or not. true menas to highlight problems, false means not.
Definition: fs_compliancecommon.h:409
WString preflight_key
The preflight key. It can be retrieved by Preflight::GetItemKeysArray.
Definition: fs_compliancecommon.h:294