Foxit PDF SDK

fs_compare.h
Go to the documentation of this file.
1
15 #ifndef FS_COMPARE_H_
16 #define FS_COMPARE_H_
17
18 #include "common/fs_common.h"
19 #include "pdf/fs_pdfdoc.h"
20 #include "pdf/fs_pdfpage.h"
21
27 namespace foxit {
31 namespace addon {
35 namespace comparison {
37 class CompareResultInfo FS_FINAL : public Object {
38 public:
44 typedef enum _CompareResultType {
46 e_CompareResultTypeNone = -1,
48 e_CompareResultTypeDeleteText = 0,
50 e_CompareResultTypeInsertText = 1,
52 e_CompareResultTypeReplaceText = 2,
54 e_CompareResultTypeDeleteImage = 6,
56 e_CompareResultTypeInsertImage = 7,
58 e_CompareResultTypeReplaceImage = 8,
60 e_CompareResultTypeDeletePath = 9,
62 e_CompareResultTypeInsertPath = 10,
64 e_CompareResultTypeReplacePath = 11,
66 e_CompareResultTypeDeleteShading = 12,
68 e_CompareResultTypeInsertShading = 13,
70 e_CompareResultTypeReplaceShading = 14,
72 e_CompareResultTypeDeleteAnnot = 15,
74 e_CompareResultTypeInsertAnnot = 16,
76 e_CompareResultTypeReplaceAnnot = 17,
78 e_CompareResultTypeTextAttriChange = 18
79 } CompareResultType;
80
81
90 CompareResultInfo(CompareResultType type, RectFArray rect_array, WString diff_contents) {
91 this->type = type;
92 this->rect_array = rect_array;
93 this->diff_contents = diff_contents;
94 }
95
97 CompareResultInfo()
98 : type(e_CompareResultTypeNone) {}
99
105 CompareResultInfo(const CompareResultInfo& result_info) {
106 this->type = result_info.type;
107 this->rect_array = result_info.rect_array;
108 this->diff_contents = result_info.diff_contents;
109 }
110
118 CompareResultInfo& operator = (const CompareResultInfo& result_info) {
119 this->type = result_info.type;
120 this->rect_array = result_info.rect_array;
121 this->diff_contents = result_info.diff_contents;
122
123 return *this;
124 }
125
130 CompareResultType type;
131
133 RectFArray rect_array;
134
136 WString diff_contents;
137 };
138
140 FSDK_DEFINE_ARRAY(CompareResultInfoArray, CompareResultInfo)
141
142
148 class CompareResults FS_FINAL : public Object {
149 public:
156 CompareResults(CompareResultInfoArray base_doc_results, CompareResultInfoArray compared_doc_results)
157 : base_doc_results(base_doc_results), compared_doc_results(compared_doc_results) {
158 }
159
161 CompareResults() {}
162
168 CompareResults(const CompareResults& compare_results)
169 : base_doc_results(compare_results.base_doc_results)
170 , compared_doc_results(compare_results.compared_doc_results) {}
171
179 CompareResults& operator = (const CompareResults& compare_results) {
180 base_doc_results = compare_results.base_doc_results;
181 compared_doc_results = compare_results.compared_doc_results;
182
183 return *this;
184 }
185
191 void Clear()
192 {
193 base_doc_results.RemoveAll();
194 compared_doc_results.RemoveAll();
195 }
196
201 CompareResultInfoArray base_doc_results;
202
207 CompareResultInfoArray compared_doc_results;
208 };
209
213 class Comparison FS_FINAL : public Base {
214 public:
220 typedef enum _CompareType {
222 e_CompareTypeAll = 0x00000000,
224 e_CompareTypeText = 0x00000001,
226 e_CompareTypeAnnotation = 0x00000002
227 } CompareType;
228
229
240 explicit Comparison(const pdf::PDFDoc& base_doc, const pdf::PDFDoc& compared_doc);
241
247 Comparison(const Comparison& other);
248
249 // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
250 explicit Comparison(FS_HANDLE handle);
251
253 ~Comparison();
254
262 Comparison& operator = (const Comparison& other);
263
271 bool operator == (const Comparison& other) const;
272
280 bool operator != (const Comparison& other) const;
281
289 bool IsEmpty() const;
290
304 CompareResults DoCompare(int base_page_index, int compared_page_index, foxit::uint32 compare_flags);
305
317 pdf::PDFDoc GenerateComparedDoc(foxit::uint32 compare_flags);
318
333 pdf::PDFDoc GenerateComparedDoc(foxit::uint32 compare_flags, bool is_show_all_layers);
334 };
335 } // namespace comparison
336 } // namespace addon
337 } // namespace foxit
338
339 #endif // FS_COMPARE_H_
340
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeDeleteShading
Result type: delete shading.
Definition: fs_compare.h:66
foxit::addon::comparison::Comparison::operator=
Comparison & operator=(const Comparison &other)
Assign operator.
foxit::FS_HANDLE
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
foxit::addon::comparison::CompareResultInfo
Definition: fs_compare.h:37
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeReplaceImage
Result type: replace image.
Definition: fs_compare.h:58
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeInsertAnnot
Result type: insert annotation.
Definition: fs_compare.h:74
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeInsertText
Result type: insert text.
Definition: fs_compare.h:50
foxit::addon::comparison::Comparison::operator==
bool operator==(const Comparison &other) const
Equal operator.
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeDeleteAnnot
Result type: delete annotation.
Definition: fs_compare.h:72
foxit::Object
CFX_Object Object
Object type.
Definition: fs_basictypes.h:220
foxit::addon::comparison::CompareResultInfo::diff_contents
WString diff_contents
Different contents as compared result.
Definition: fs_compare.h:136
foxit::addon::comparison::CompareResultInfo::type
CompareResultType type
Result type. Please refer to values starting from CompareResultInfo::e_CompareResultTypeNone and this...
Definition: fs_compare.h:130
fs_common.h
Header file for common definitions and classes.
CFX_ArrayTemplate< RectF >
foxit::addon::comparison::CompareResults::CompareResults
CompareResults(CompareResultInfoArray base_doc_results, CompareResultInfoArray compared_doc_results)
Constructor, with parameters.
Definition: fs_compare.h:156
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeReplaceText
Result type: replace text.
Definition: fs_compare.h:52
foxit::addon::comparison::CompareResultInfo::CompareResultType
CompareResultType
Enumeration for compare result type.
Definition: fs_compare.h:44
foxit::addon::comparison::CompareResults::base_doc_results
CompareResultInfoArray base_doc_results
A result information array, which contains all the compared results of a PDF page (which has been com...
Definition: fs_compare.h:201
foxit::addon::comparison::Comparison::e_CompareTypeAnnotation
Compare annotation only.
Definition: fs_compare.h:226
foxit::addon::comparison::Comparison::IsEmpty
bool IsEmpty() const
Check whether current object is empty or not.
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeDeletePath
Result type: delete path.
Definition: fs_compare.h:60
foxit::addon::comparison::CompareResultInfo::rect_array
RectFArray rect_array
Rectangle array which specifies the location of parameter diff_contents in the PDF page to be compare...
Definition: fs_compare.h:133
foxit::addon::comparison::CompareResultInfo::CompareResultInfo
CompareResultInfo(CompareResultType type, RectFArray rect_array, WString diff_contents)
Constructor, with parameters.
Definition: fs_compare.h:90
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeTextAttriChange
(Reserved, not supported yet) Result type: text attribute change.
Definition: fs_compare.h:78
foxit::addon::comparison::Comparison::DoCompare
CompareResults DoCompare(int base_page_index, int compared_page_index, foxit::uint32 compare_flags)
Compare a PDF page of base document with a PDF page in compared document. "base document" and "compar...
foxit::addon::comparison::CompareResults::CompareResults
CompareResults()
Constructor.
Definition: fs_compare.h:161
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeDeleteImage
Result type: delete image.
Definition: fs_compare.h:54
foxit::addon::comparison::Comparison::e_CompareTypeAll
Compare all content. This value should be used alone.
Definition: fs_compare.h:222
foxit::addon::comparison::Comparison::GenerateComparedDoc
pdf::PDFDoc GenerateComparedDoc(foxit::uint32 compare_flags)
Compare the base document with the compared document (which are used to construct current object) and...
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeReplacePath
Result type: replace path.
Definition: fs_compare.h:64
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeReplaceShading
Result type: replace shading.
Definition: fs_compare.h:70
foxit::addon::comparison::CompareResultInfo::operator=
CompareResultInfo & operator=(const CompareResultInfo &result_info)
Assign operator.
Definition: fs_compare.h:118
fs_pdfpage.h
Header file for PDF page related definitions and classes.
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeInsertShading
Result type: insert shading.
Definition: fs_compare.h:68
foxit
Foxit namespace.
Definition: fs_taggedpdf.h:27
foxit::addon::comparison::CompareResults::Clear
void Clear()
Clear all the result information.
Definition: fs_compare.h:191
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeInsertImage
Result type: insert image.
Definition: fs_compare.h:56
fs_pdfdoc.h
Header file for PDF document related definitions and classes.
foxit::addon::comparison::CompareResultInfo::CompareResultInfo
CompareResultInfo()
Constructor.
Definition: fs_compare.h:97
foxit::addon::comparison::CompareResults::CompareResults
CompareResults(const CompareResults &compare_results)
Constructor, with another compare results object.
Definition: fs_compare.h:168
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeDeleteText
Result type: delete text.
Definition: fs_compare.h:48
foxit::addon::comparison::CompareResults::compared_doc_results
CompareResultInfoArray compared_doc_results
A result information array, which contains all the compared results of a PDF page (which has been com...
Definition: fs_compare.h:207
foxit::pdf::PDFDoc
Definition: fs_pdfdoc.h:776
foxit::addon::comparison::CompareResultInfo::CompareResultInfo
CompareResultInfo(const CompareResultInfo &result_info)
Constructor, with another result information object.
Definition: fs_compare.h:105
foxit::addon::comparison::Comparison::CompareType
CompareType
Enumeration for compare type flags.
Definition: fs_compare.h:220
foxit::addon::comparison::Comparison::operator!=
bool operator!=(const Comparison &other) const
Not equal operator.
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeInsertPath
Result type: insert path.
Definition: fs_compare.h:62
foxit::addon::comparison::CompareResults
Definition: fs_compare.h:148
CFX_WideString
WIDE STRING CLASS.
Definition: fx_string.h:1461
foxit::addon::comparison::Comparison
Definition: fs_compare.h:213
foxit::addon::comparison::Comparison::~Comparison
~Comparison()
Destructor.
foxit::addon::comparison::Comparison::Comparison
Comparison(const pdf::PDFDoc &base_doc, const pdf::PDFDoc &compared_doc)
Constructor, from PDF document object.
foxit::addon::comparison::Comparison::e_CompareTypeText
Compare text only.
Definition: fs_compare.h:224
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeReplaceAnnot
Result type: replace annotation.
Definition: fs_compare.h:76
foxit::uint32
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:195
foxit::addon::comparison::CompareResultInfo::e_CompareResultTypeNone
Result type: unsupported or invalid.
Definition: fs_compare.h:46
foxit::addon::comparison::CompareResultInfoArray
Definition: fs_compare.h:140
foxit::Base
Definition: fs_basictypes.h:451