00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef SIGNDOCSDK_SIGNDOCDOCUMENT_H_INCLUDED
00026 #define SIGNDOCSDK_SIGNDOCDOCUMENT_H_INCLUDED
00027
00028 #include <stddef.h>
00029 #include <memory>
00030 #include <string>
00031 #include <vector>
00032 #include <stdexcept>
00033 #include "SignDocSDK-c.h"
00034
00035 #ifndef SIGNDOC_PTR
00036
00043 #define SIGNDOC_PTR std::auto_ptr
00044 #endif
00045
00046 struct SPPDF_Document;
00047
00048 namespace de { namespace softpro { namespace doc {
00049
00050 class SignDocChange;
00051 class SignDocSignature;
00052 class SignDocVerificationResult;
00053 class SignECDSA;
00054 class SignPKCS7;
00055 class SignRSA;
00056
00057 #ifdef _MSC_VER
00058 #pragma warning(push)
00059
00060 #pragma warning(disable:4800)
00061 #endif
00062
00067 inline void
00068 SignDoc_throw (SIGNDOC_Exception *aEx)
00069 {
00070 int type = SIGNDOC_Exception_getType (aEx);
00071 if (type == SIGNDOC_EXCEPTION_TYPE_BAD_ALLOC)
00072 throw (std::bad_alloc ());
00073 std::string msg;
00074 const char *text = SIGNDOC_Exception_getText (aEx);
00075 if (text != NULL)
00076 msg = text;
00077 SIGNDOC_Exception_delete (aEx);
00078 #if defined (SPOOC_EXCEPTION_H__) || defined (SPOOC_EXCEPTION_H_INCLUDED_)
00079 switch (type)
00080 {
00081 case SIGNDOC_EXCEPTION_TYPE_SPOOC_IO:
00082 throw spooc::IOError (msg);
00083 case SIGNDOC_EXCEPTION_TYPE_SPOOC_ENCODING_ERROR:
00084 throw spooc::EncodingError (msg);
00085 case SIGNDOC_EXCEPTION_TYPE_SPOOC_GENERIC:
00086 throw spooc::Exception (msg);
00087 default:
00088 throw std::runtime_error (msg);
00089 }
00090 #else
00091 throw std::runtime_error (msg);
00092 #endif
00093 }
00094
00099 inline void
00100 SIGNDOC_catch (SIGNDOC_Exception **aEx, std::exception &aInput)
00101 {
00102 *aEx = SIGNDOC_Exception_new (SIGNDOC_EXCEPTION_TYPE_GENERIC,
00103 aInput.what ());
00104 }
00105
00110 inline SignDocVerificationResult *
00111 makeSignDocVerificationResult (SIGNDOC_VerificationResult *aP);
00112
00113 inline void assignArray (std::vector<unsigned char> &aDst,
00114 SIGNDOC_ByteArray *aSrc)
00115 {
00116 unsigned n = 0;
00117 if (aSrc != NULL)
00118 n = SIGNDOC_ByteArray_count (aSrc);
00119 if (n == 0)
00120 aDst.clear ();
00121 else
00122 {
00123 const unsigned char *p = SIGNDOC_ByteArray_data (aSrc);
00124 aDst.assign (p, p + n);
00125 }
00126 }
00127
00132 inline void assignArray (std::vector<std::vector<unsigned char> > &aDst,
00133 SIGNDOC_ByteArrayArray *aSrc)
00134 {
00135 unsigned n = SIGNDOC_ByteArrayArray_count (aSrc);
00136 aDst.resize (n);
00137 for (unsigned i = 0; i < n; ++i)
00138 assignArray (aDst[i], SIGNDOC_ByteArrayArray_at (aSrc, i));
00139 }
00140
00145 inline void assignArray (std::vector<std::string> &aDst,
00146 SIGNDOC_StringArray *aSrc)
00147 {
00148 unsigned n = SIGNDOC_StringArray_count (aSrc);
00149 aDst.resize (n);
00150 for (unsigned i = 0; i < n; ++i)
00151 aDst[i] = SIGNDOC_StringArray_at (aSrc, i);
00152 }
00153
00154
00155
00163 class InputStream
00164 {
00165 public:
00171 InputStream (SIGNDOC_InputStream *aImpl) : p (aImpl) { }
00172
00176 virtual ~InputStream ()
00177 {
00178 SIGNDOC_InputStream_delete (p);
00179 }
00180
00196 virtual int read (void *aDst, int aLen) = 0;
00197
00204 virtual void close () = 0;
00205
00214 virtual void seek (int aPos) = 0;
00215
00224 virtual int tell () const = 0;
00225
00238 virtual int getAvailable () = 0;
00239
00244 SIGNDOC_InputStream *getImpl () { return p; }
00245
00246 protected:
00250 SIGNDOC_InputStream *p;
00251
00252 private:
00256 InputStream (const InputStream &);
00257
00261 InputStream &operator= (const InputStream &);
00262 };
00263
00269 class UserInputStream : public InputStream
00270 {
00271 public:
00275 UserInputStream ()
00276 : InputStream (NULL)
00277 {
00278 SIGNDOC_Exception *ex = NULL;
00279 p = SIGNDOC_UserInputStream_new (&ex, this,
00280 closeC, readC, seekC, tellC,
00281 getAvailableC);
00282 if (ex != NULL) SignDoc_throw (ex);
00283 }
00284
00285 private:
00289 static void SDCAPI closeC (SIGNDOC_Exception **aEx,
00290 void *aClosure)
00291 {
00292 *aEx = NULL;
00293 try
00294 {
00295 reinterpret_cast<UserInputStream*>(aClosure)->close ();
00296 }
00297 catch (std::exception &e)
00298 {
00299 SIGNDOC_catch (aEx, e);
00300 }
00301 }
00302
00306 static int SDCAPI readC (SIGNDOC_Exception **aEx,
00307 void *aClosure,
00308 void *aDst, int aLen)
00309 {
00310 *aEx = NULL;
00311 try
00312 {
00313 return reinterpret_cast<UserInputStream*>(aClosure)->read (aDst, aLen);
00314 }
00315 catch (std::exception &e)
00316 {
00317 SIGNDOC_catch (aEx, e);
00318 return 0;
00319 }
00320 }
00321
00325 static void SDCAPI seekC (SIGNDOC_Exception **aEx,
00326 void *aClosure,
00327 int aPos)
00328 {
00329 *aEx = NULL;
00330 try
00331 {
00332 return reinterpret_cast<UserInputStream*>(aClosure)->seek (aPos);
00333 }
00334 catch (std::exception &e)
00335 {
00336 SIGNDOC_catch (aEx, e);
00337 }
00338 }
00339
00343 static int SDCAPI tellC (SIGNDOC_Exception **aEx,
00344 const void *aClosure)
00345 {
00346 *aEx = NULL;
00347 try
00348 {
00349 return reinterpret_cast<const UserInputStream*>(aClosure)->tell ();
00350 }
00351 catch (std::exception &e)
00352 {
00353 SIGNDOC_catch (aEx, e);
00354 return 0;
00355 }
00356 }
00357
00361 static int SDCAPI getAvailableC (SIGNDOC_Exception **aEx,
00362 void *aClosure)
00363 {
00364 *aEx = NULL;
00365 try
00366 {
00367 return reinterpret_cast<UserInputStream*>(aClosure)->getAvailable ();
00368 }
00369 catch (std::exception &e)
00370 {
00371 SIGNDOC_catch (aEx, e);
00372 return 0;
00373 }
00374 }
00375 };
00376
00380 class LibraryInputStream : public InputStream
00381 {
00382 public:
00388 LibraryInputStream (SIGNDOC_InputStream *aImpl)
00389 : InputStream (aImpl) { }
00390
00391 virtual int read (void *aDst, int aLen)
00392 {
00393 SIGNDOC_Exception *ex = NULL;
00394 int r = SIGNDOC_InputStream_read (&ex, p, aDst, aLen);
00395 if (ex != NULL) SignDoc_throw (ex);
00396 return r;
00397 }
00398
00399 virtual void close ()
00400 {
00401 SIGNDOC_Exception *ex = NULL;
00402 SIGNDOC_InputStream_close (&ex, p);
00403 if (ex != NULL) SignDoc_throw (ex);
00404 }
00405
00406 virtual void seek (int aPos)
00407 {
00408 SIGNDOC_Exception *ex = NULL;
00409 SIGNDOC_InputStream_seek (&ex, p, aPos);
00410 if (ex != NULL) SignDoc_throw (ex);
00411 }
00412
00413 virtual int tell () const
00414 {
00415 SIGNDOC_Exception *ex = NULL;
00416 int r = SIGNDOC_InputStream_tell (&ex, p);
00417 if (ex != NULL) SignDoc_throw (ex);
00418 return r;
00419 }
00420
00421 virtual int getAvailable ()
00422 {
00423 SIGNDOC_Exception *ex = NULL;
00424 int r = SIGNDOC_InputStream_getAvailable (&ex, p);
00425 if (ex != NULL) SignDoc_throw (ex);
00426 return r;
00427 }
00428 };
00429
00430 #if defined (SPOOC_INPUTSTREAM_H__) || defined (SPOOC_INPUTSTREAM_H_INCLUDED_)
00431
00432 class Spooc1InputStream : public spooc::InputStream
00433 {
00434 public:
00435 Spooc1InputStream (de::softpro::doc::InputStream &aStream)
00436 : mStream (aStream) { }
00437 virtual int read (void *aDst, int aLen) { return mStream.read (aDst, aLen); }
00438 virtual void close () { mStream.close (); }
00439 virtual void seek (int aPos) { mStream.seek (aPos); }
00440 virtual int tell () const { return mStream.tell (); }
00441 virtual int avail () { return mStream.getAvailable (); }
00442 private:
00443 de::softpro::doc::InputStream &mStream;
00444 };
00445
00446 class Spooc2InputStream : public UserInputStream
00447 {
00448 public:
00449 Spooc2InputStream (spooc::InputStream &aStream)
00450 : mStream (aStream) { }
00451 virtual int read (void *aDst, int aLen) { return mStream.read (aDst, aLen); }
00452 virtual void close () { mStream.close (); }
00453 virtual void seek (int aPos) { mStream.seek (aPos); }
00454 virtual int tell () const { return mStream.tell (); }
00455 virtual int getAvailable () { return mStream.avail (); }
00456 private:
00457 spooc::InputStream &mStream;
00458 };
00459
00460 #endif
00461
00462
00463
00470 class FileInputStream : public LibraryInputStream
00471 {
00472 public:
00478 FileInputStream (FILE *aFile)
00479 : LibraryInputStream (NULL)
00480 {
00481 SIGNDOC_Exception *ex = NULL;
00482 p = SIGNDOC_FileInputStream_newWithFile (&ex, aFile);
00483 if (ex != NULL) SignDoc_throw (ex);
00484 };
00485
00493 FileInputStream (FILE *aFile, const char *aPath)
00494 : LibraryInputStream (NULL)
00495 {
00496 SIGNDOC_Exception *ex = NULL;
00497 p = SIGNDOC_FileInputStream_newWithFileAndPath (&ex, aFile, aPath);
00498 if (ex != NULL) SignDoc_throw (ex);
00499 };
00500
00508 FileInputStream (const char *aPath)
00509 : LibraryInputStream (NULL)
00510 {
00511 SIGNDOC_Exception *ex = NULL;
00512 p = SIGNDOC_FileInputStream_newWithPath (&ex, aPath);
00513 if (ex != NULL) SignDoc_throw (ex);
00514 };
00515
00523 FileInputStream (const wchar_t *aPath)
00524 : LibraryInputStream (NULL)
00525 {
00526 SIGNDOC_Exception *ex = NULL;
00527 p = SIGNDOC_FileInputStream_newWithPathW (&ex, aPath);
00528 if (ex != NULL) SignDoc_throw (ex);
00529 };
00530 };
00531
00532
00533
00537 class MemoryInputStream : public LibraryInputStream
00538 {
00539 public:
00550 MemoryInputStream (const unsigned char *aSrc, size_t aLen)
00551 : LibraryInputStream (NULL)
00552 {
00553 SIGNDOC_Exception *ex = NULL;
00554 p = SIGNDOC_MemoryInputStream_new (&ex, aSrc, aLen);
00555 if (ex != NULL) SignDoc_throw (ex);
00556 };
00557 };
00558
00559
00560
00568 class OutputStream
00569 {
00570 public:
00576 OutputStream (SIGNDOC_OutputStream *aImpl) : p (aImpl) { }
00577
00581 virtual ~OutputStream ()
00582 {
00583 SIGNDOC_OutputStream_delete (p);
00584 }
00585
00597 virtual void close () = 0;
00598
00607 virtual void flush () = 0;
00608
00617 virtual void seek (int aPos) = 0;
00618
00627 virtual int tell () const = 0;
00628
00637 virtual void write (const void *aSrc, int aLen) = 0;
00638
00643 SIGNDOC_OutputStream *getImpl () { return p; }
00644
00645 protected:
00649 SIGNDOC_OutputStream *p;
00650
00651 private:
00655 OutputStream (const OutputStream &);
00656
00660 OutputStream &operator= (const OutputStream &);
00661 };
00662
00668 class UserOutputStream : public OutputStream
00669 {
00670 public:
00674 UserOutputStream ()
00675 : OutputStream (NULL)
00676 {
00677 SIGNDOC_Exception *ex = NULL;
00678 p = SIGNDOC_UserOutputStream_new (&ex, this,
00679 closeC, flushC, writeC, seekC,
00680 tellC);
00681 if (ex != NULL) SignDoc_throw (ex);
00682 }
00683
00684 private:
00688 static void SDCAPI closeC (SIGNDOC_Exception **aEx,
00689 void *aClosure)
00690 {
00691 *aEx = NULL;
00692 try
00693 {
00694 reinterpret_cast<UserOutputStream*>(aClosure)->close ();
00695 }
00696 catch (std::exception &e)
00697 {
00698 SIGNDOC_catch (aEx, e);
00699 }
00700 }
00701
00705 static void SDCAPI flushC (SIGNDOC_Exception **aEx,
00706 void *aClosure)
00707 {
00708 *aEx = NULL;
00709 try
00710 {
00711 reinterpret_cast<UserOutputStream*>(aClosure)->flush ();
00712 }
00713 catch (std::exception &e)
00714 {
00715 SIGNDOC_catch (aEx, e);
00716 }
00717 }
00718
00722 static void SDCAPI writeC (SIGNDOC_Exception **aEx,
00723 void *aClosure,
00724 const void *aSrc, int aLen)
00725 {
00726 *aEx = NULL;
00727 try
00728 {
00729 reinterpret_cast<UserOutputStream*>(aClosure)->write (aSrc, aLen);
00730 }
00731 catch (std::exception &e)
00732 {
00733 SIGNDOC_catch (aEx, e);
00734 }
00735 }
00736
00740 static void SDCAPI seekC (SIGNDOC_Exception **aEx,
00741 void *aClosure,
00742 int aPos)
00743 {
00744 *aEx = NULL;
00745 try
00746 {
00747 return reinterpret_cast<UserOutputStream*>(aClosure)->seek (aPos);
00748 }
00749 catch (std::exception &e)
00750 {
00751 SIGNDOC_catch (aEx, e);
00752 }
00753 }
00754
00758 static int SDCAPI tellC (SIGNDOC_Exception **aEx,
00759 const void *aClosure)
00760 {
00761 *aEx = NULL;
00762 try
00763 {
00764 return reinterpret_cast<const UserOutputStream*>(aClosure)->tell ();
00765 }
00766 catch (std::exception &e)
00767 {
00768 SIGNDOC_catch (aEx, e);
00769 return 0;
00770 }
00771 }
00772 };
00773
00777 class LibraryOutputStream : public OutputStream
00778 {
00779 public:
00785 LibraryOutputStream (SIGNDOC_OutputStream *aImpl)
00786 : OutputStream (aImpl) { }
00787
00788 virtual void close ()
00789 {
00790 SIGNDOC_Exception *ex = NULL;
00791 SIGNDOC_OutputStream_close (&ex, p);
00792 if (ex != NULL) SignDoc_throw (ex);
00793 }
00794
00795 virtual void flush ()
00796 {
00797 SIGNDOC_Exception *ex = NULL;
00798 SIGNDOC_OutputStream_flush (&ex, p);
00799 if (ex != NULL) SignDoc_throw (ex);
00800 }
00801
00802 virtual void write (const void *aSrc, int aLen)
00803 {
00804 SIGNDOC_Exception *ex = NULL;
00805 SIGNDOC_OutputStream_write (&ex, p, aSrc, aLen);
00806 if (ex != NULL) SignDoc_throw (ex);
00807 }
00808
00809 virtual void seek (int aPos)
00810 {
00811 SIGNDOC_Exception *ex = NULL;
00812 SIGNDOC_OutputStream_seek (&ex, p, aPos);
00813 if (ex != NULL) SignDoc_throw (ex);
00814 }
00815
00816 virtual int tell () const
00817 {
00818 SIGNDOC_Exception *ex = NULL;
00819 int r = SIGNDOC_OutputStream_tell (&ex, p);
00820 if (ex != NULL) SignDoc_throw (ex);
00821 return r;
00822 }
00823 };
00824
00825 #if defined (SPOOC_OUTPUTSTREAM_H__) || defined (SPOOC_OUTPUTSTREAM_H_INCLUDED_)
00826
00827 class Spooc1OutputStream : public spooc::OutputStream
00828 {
00829 public:
00830 Spooc1OutputStream (de::softpro::doc::OutputStream &aStream)
00831 : mStream (aStream) { }
00832 virtual void close () { mStream.close (); }
00833 virtual void flush () { mStream.flush (); }
00834 virtual void write (const void *aSrc, int aLen) { mStream.write (aSrc, aLen); }
00835 virtual void seek (int aPos) { mStream.seek (aPos); }
00836 virtual int tell () const { return mStream.tell (); }
00837 private:
00838 de::softpro::doc::OutputStream &mStream;
00839 };
00840
00841 class Spooc2OutputStream : public UserOutputStream
00842 {
00843 public:
00844 Spooc2OutputStream (spooc::OutputStream &aStream)
00845 : mStream (aStream) { }
00846 ~Spooc2OutputStream () { }
00847 virtual void close () { mStream.close (); }
00848 virtual void flush () { mStream.flush (); }
00849 virtual void write (const void *aSrc, int aLen) { mStream.write (aSrc, aLen); }
00850 virtual void seek (int aPos) { mStream.seek (aPos); }
00851 virtual int tell () const { return mStream.tell (); }
00852 private:
00853 spooc::OutputStream &mStream;
00854 };
00855
00856 #endif
00857
00858
00859
00866 class FileOutputStream : public LibraryOutputStream
00867 {
00868 public:
00874 FileOutputStream (FILE *aFile)
00875 : LibraryOutputStream (NULL)
00876 {
00877 SIGNDOC_Exception *ex = NULL;
00878 p = SIGNDOC_FileOutputStream_newWithFile (&ex, aFile);
00879 if (ex != NULL) SignDoc_throw (ex);
00880 };
00881
00889 FileOutputStream (FILE *aFile, const char *aPath)
00890 : LibraryOutputStream (NULL)
00891 {
00892 SIGNDOC_Exception *ex = NULL;
00893 p = SIGNDOC_FileOutputStream_newWithFileAndPath (&ex, aFile, aPath);
00894 if (ex != NULL) SignDoc_throw (ex);
00895 };
00896
00905 FileOutputStream (const char *aPath)
00906 : LibraryOutputStream (NULL)
00907 {
00908 SIGNDOC_Exception *ex = NULL;
00909 p = SIGNDOC_FileOutputStream_newWithPath (&ex, aPath);
00910 if (ex != NULL) SignDoc_throw (ex);
00911 };
00912
00921 FileOutputStream (const wchar_t *aPath)
00922 : LibraryOutputStream (NULL)
00923 {
00924 SIGNDOC_Exception *ex = NULL;
00925 p = SIGNDOC_FileOutputStream_newWithPathW (&ex, aPath);
00926 if (ex != NULL) SignDoc_throw (ex);
00927 };
00928 };
00929
00930
00931
00936 class MemoryOutputStream : public LibraryOutputStream
00937 {
00938 public:
00942 MemoryOutputStream ()
00943 : LibraryOutputStream (NULL)
00944 {
00945 SIGNDOC_Exception *ex = NULL;
00946 p = SIGNDOC_MemoryOutputStream_new (&ex);
00947 if (ex != NULL) SignDoc_throw (ex);
00948 };
00949
00958 const unsigned char *data ()
00959 {
00960 SIGNDOC_Exception *ex = NULL;
00961 const unsigned char *r = SIGNDOC_MemoryOutputStream_data (&ex, p);
00962 if (ex != NULL) SignDoc_throw (ex);
00963 return r;
00964 }
00965
00969 size_t length ()
00970 {
00971 SIGNDOC_Exception *ex = NULL;
00972 size_t r = SIGNDOC_MemoryOutputStream_length (&ex, p);
00973 if (ex != NULL) SignDoc_throw (ex);
00974 return r;
00975 }
00976
00984 void clear ()
00985 {
00986 SIGNDOC_Exception *ex = NULL;
00987 SIGNDOC_MemoryOutputStream_clear (&ex, p);
00988 if (ex != NULL) SignDoc_throw (ex);
00989 }
00990 };
00994 enum Encoding
00995 {
00996 enc_native,
00997 enc_utf_8,
00998 enc_latin_1
00999 };
01000
01004
01005 class Point
01006 {
01007 public:
01013 Point ()
01014 : mX (0), mY (0)
01015 {
01016 }
01017
01024 Point (double aX, double aY)
01025 : mX (aX), mY (aY)
01026 {
01027 }
01028
01034 Point (const Point &aSrc)
01035 : mX (aSrc.mX), mY (aSrc.mY)
01036 {
01037 }
01038
01042 ~Point ()
01043 {
01044 }
01045
01052 void set (double aX, double aY)
01053 {
01054 SIGNDOC_Point_setXY ((SIGNDOC_Point*)this, aX, aY);
01055 }
01056
01057 public:
01061 double mX;
01062
01066 double mY;
01067 };
01068
01075
01076 class Rect
01077 {
01078 public:
01084 Rect ()
01085 : mX1 (0), mY1 (0), mX2 (0), mY2 (0)
01086 {
01087 }
01088
01097 Rect (double aX1, double aY1, double aX2, double aY2)
01098 : mX1 (aX1), mY1 (aY1), mX2 (aX2), mY2 (aY2)
01099 {
01100 }
01101
01107 Rect (const Rect &aSrc)
01108 : mX1 (aSrc.mX1), mY1 (aSrc.mY1), mX2 (aSrc.mX2), mY2 (aSrc.mY2)
01109 {
01110 }
01111
01115 ~Rect ()
01116 {
01117 }
01118
01127 void get (double &aX1, double &aY1, double &aX2, double &aY2) const
01128 {
01129 SIGNDOC_Rect_get ((const SIGNDOC_Rect*)this, &aX1, &aY1, &aX2, &aY2);
01130 }
01131
01140 void set (double aX1, double aY1, double aX2, double aY2)
01141 {
01142 SIGNDOC_Rect_setXY ((SIGNDOC_Rect*)this, aX1, aY1, aX2, aY2);
01143 }
01144
01150 double getWidth () const
01151 {
01152 return SIGNDOC_Rect_getWidth ((const SIGNDOC_Rect*)this);
01153 }
01154
01160 double getHeight () const
01161 {
01162 return SIGNDOC_Rect_getHeight ((const SIGNDOC_Rect*)this);
01163 }
01164
01172 void normalize ()
01173 {
01174 SIGNDOC_Rect_normalize ((SIGNDOC_Rect*)this);
01175 }
01176
01182 void scale (double aFactor)
01183 {
01184 SIGNDOC_Rect_scale ((SIGNDOC_Rect*)this, aFactor);
01185 }
01186
01195 void scale (double aFactorX, double aFactorY)
01196 {
01197 SIGNDOC_Rect_scaleXY ((SIGNDOC_Rect*)this, aFactorX, aFactorY);
01198 }
01199
01206 double getX1 () const
01207 {
01208 return mX1;
01209 }
01210
01217 double getY1 () const
01218 {
01219 return mY1;
01220 }
01221
01228 double getX2 () const
01229 {
01230 return mX2;
01231 }
01232
01239 double getY2 () const
01240 {
01241 return mY2;
01242 }
01243
01244 public:
01248 double mX1;
01249
01253 double mY1;
01254
01258 double mX2;
01259
01263 double mY2;
01264 };
01265
01269 class TimeStamper
01270 {
01271 public:
01275 enum StampResult
01276 {
01280 sr_ok,
01281
01285 sr_invalid_input,
01286
01290 sr_timeout,
01291
01295 sr_stopped,
01296
01300 sr_tcp_error,
01301
01305 sr_ssl_error,
01306
01310 sr_http_error,
01311
01316 sr_server_error,
01317
01321 sr_invalid_response
01322 };
01323
01327 enum StampFlags
01328 {
01334 sf_dont_check_revocation = 0x01,
01335
01339 sf_dont_hash = 0x02
01340 };
01341
01342 public:
01349 const char *getHashAlgorithm () const
01350 {
01351 return SIGNDOC_TimeStamper_getHashAlgorithm (p);
01352 }
01353
01360 const char *getFallbackHashAlgorithm () const
01361 {
01362 return SIGNDOC_TimeStamper_getFallbackHashAlgorithm (p);
01363 }
01364
01396 StampResult stamp (const unsigned char *aHashPtr, size_t aHashSize,
01397 unsigned aRandomNonceSize, int aFlags,
01398 std::vector<unsigned char> &aOutput, int &aStatus,
01399 unsigned &aFailureInfo)
01400 {
01401 SIGNDOC_Exception *ex = NULL;
01402 SIGNDOC_ByteArray *tempOutput = NULL;
01403 StampResult r;
01404 try
01405 {
01406 tempOutput = SIGNDOC_ByteArray_new (&ex);
01407 if (ex != NULL) SignDoc_throw (ex);
01408 r = (StampResult)SIGNDOC_TimeStamper_stamp (&ex, p, aHashPtr, aHashSize, aRandomNonceSize, aFlags, tempOutput, &aStatus, &aFailureInfo);
01409 assignArray (aOutput, tempOutput);
01410 }
01411 catch (...)
01412 {
01413 if (tempOutput != NULL)
01414 SIGNDOC_ByteArray_delete (tempOutput);
01415 throw;
01416 }
01417 if (tempOutput != NULL)
01418 SIGNDOC_ByteArray_delete (tempOutput);
01419 if (ex != NULL) SignDoc_throw (ex);
01420 return r;
01421 }
01422
01429 void stop ()
01430 {
01431 SIGNDOC_TimeStamper_stop (p);
01432 }
01433
01444 const char *getErrorMessage () const
01445 {
01446 return SIGNDOC_TimeStamper_getErrorMessage (p);
01447 }
01448
01449 protected:
01450 public:
01454 ~TimeStamper ()
01455 {
01456 }
01461 TimeStamper (SIGNDOC_TimeStamper *aP) : p (aP) { }
01462
01467 SIGNDOC_TimeStamper *getImpl () { return p; }
01468
01473 const SIGNDOC_TimeStamper *getImpl () const { return p; }
01474
01475 private:
01476 SIGNDOC_TimeStamper *p;
01477 };
01478
01484 class Source
01485 {
01486 public:
01492 Source (struct SIGNDOC_Source *aImpl)
01493 : p (aImpl) { }
01494
01498 virtual ~Source () { }
01499
01510 int fetch (const void *&aPtr, int aMaxSize)
01511 {
01512 struct SIGNDOC_Exception *ex = NULL;
01513 int r = SIGNDOC_Source_fetch (&ex, p, &aPtr, aMaxSize);
01514 if (ex != NULL) SignDoc_throw (ex);
01515 return r;
01516 }
01517
01518 private:
01519 SIGNDOC_Source *p;
01520 };
01521
01530 class SignPKCS7
01531 {
01532 public:
01536 enum HashAlgorithm
01537 {
01538 ha_none,
01539 ha_sha1,
01540 ha_sha256,
01541 ha_md5,
01542 ha_sha384,
01543 ha_sha512,
01544 ha_ripemd160,
01545 ha_sha224
01546 };
01547
01551 SignPKCS7 ()
01552 : p (NULL), mBadAlloc (false)
01553 {
01554 struct SIGNDOC_Exception *ex = NULL;
01555 p = SIGNDOC_SignPKCS7_new (&ex, this, signC, getSignatureSizeC,
01556 getSubjectCommonNameC, getErrorMessageC);
01557 if (ex != NULL) SignDoc_throw (ex);
01558 }
01559
01566 virtual ~SignPKCS7 ()
01567 {
01568 SIGNDOC_SignPKCS7_delete (p);
01569 }
01570
01592 virtual bool sign (Source &aSource, bool aDetached,
01593 HashAlgorithm aHashAlgorithm,
01594 TimeStamper *aTimeStamper,
01595 std::vector<unsigned char> &aOutput) = 0;
01596
01617 virtual size_t getSignatureSize (bool aDetached,
01618 HashAlgorithm aHashAlgorithm) = 0;
01619
01629 virtual bool getSubjectCommonName (std::string &aOutput) const = 0;
01630
01645 virtual const char *getErrorMessage () const = 0;
01646
01651 SIGNDOC_SignPKCS7 *getImpl () { return p; }
01652
01653 private:
01654 static SIGNDOC_Boolean SDCAPI
01655 signC (void *aClosure, struct SIGNDOC_Source *aSource,
01656 SIGNDOC_Boolean aDetached, int aHashAlgorithm,
01657 struct SIGNDOC_TimeStamper *aTimeStamper,
01658 struct SIGNDOC_ByteArray *aOutput)
01659 {
01660 SignPKCS7 *s = static_cast<SignPKCS7*>(aClosure);
01661 s->mBadAlloc = false;
01662 try
01663 {
01664 SIGNDOC_ByteArray_clear (aOutput);
01665 std::vector<unsigned char> output;
01666 Source src (aSource);
01667 TimeStamper ts (aTimeStamper);
01668 bool ok = s->sign (src, aDetached, (HashAlgorithm)aHashAlgorithm,
01669 (aTimeStamper != NULL) ? &ts : NULL,
01670 output);
01671 if (ok)
01672 assignByteArray (aOutput, output);
01673 return ok;
01674 }
01675 catch (std::bad_alloc &)
01676 {
01677 s->mBadAlloc = true;
01678 return SIGNDOC_FALSE;
01679 }
01680 }
01681
01682 static size_t SDCAPI
01683 getSignatureSizeC (void *aClosure, SIGNDOC_Boolean aDetached,
01684 int aHashAlgorithm)
01685 {
01686 SignPKCS7 *s = static_cast<SignPKCS7*>(aClosure);
01687 s->mBadAlloc = false;
01688 try
01689 {
01690 return s->getSignatureSize (aDetached, (HashAlgorithm)aHashAlgorithm);
01691 }
01692 catch (std::bad_alloc &)
01693 {
01694 s->mBadAlloc = true;
01695 return 0;
01696 }
01697 }
01698
01699 static SIGNDOC_Boolean SDCAPI
01700 getSubjectCommonNameC (void *aClosure, char **aOutput)
01701 {
01702 SignPKCS7 *s = static_cast<SignPKCS7*>(aClosure);
01703 s->mBadAlloc = false;
01704 try
01705 {
01706 *aOutput = NULL;
01707 std::string output;
01708 bool ok = s->getSubjectCommonName (output);
01709 if (ok)
01710 assignString (aOutput, output);
01711 return ok;
01712 }
01713 catch (std::bad_alloc &)
01714 {
01715 s->mBadAlloc = true;
01716 return SIGNDOC_FALSE;
01717 }
01718 }
01719
01720 static const char * SDCAPI
01721 getErrorMessageC (void *aClosure)
01722 {
01723 SignPKCS7 *s = static_cast<SignPKCS7*>(aClosure);
01724 if (s->mBadAlloc)
01725 return "out of memory";
01726 try
01727 {
01728 return s->getErrorMessage ();
01729 }
01730 catch (std::bad_alloc &)
01731 {
01732 s->mBadAlloc = true;
01733 return "out of memory";
01734 }
01735 }
01736
01737 static void assignByteArray (SIGNDOC_ByteArray *aOutput,
01738 const std::vector<unsigned char> &aInput)
01739 {
01740 if (aInput.empty ())
01741 SIGNDOC_ByteArray_clear (aOutput);
01742 else
01743 {
01744 struct SIGNDOC_Exception *ex = NULL;
01745 SIGNDOC_ByteArray_set (&ex, aOutput,
01746 &aInput[0], aInput.size ());
01747 if (ex != NULL) SignDoc_throw (ex);
01748 }
01749 }
01750
01751 static void assignString (char **aOutput, const std::string &aInput)
01752 {
01753 struct SIGNDOC_Exception *ex = NULL;
01754 *aOutput = SIGNDOC_strdup (&ex, aInput.c_str ());
01755 if (ex != NULL) SignDoc_throw (ex);
01756 }
01757
01758 private:
01759 SIGNDOC_SignPKCS7 *p;
01760 bool mBadAlloc;
01761 };
01762
01768 class SignRSA
01769 {
01770 public:
01774 enum Version
01775 {
01779 v_1_5,
01780
01789 v_2_0_salt0,
01790
01800 v_2_0_salt32,
01801
01805 v_2_0 = v_2_0_salt0
01806 };
01807
01811 enum HashAlgorithm
01812 {
01816 ha_sha1 = 1,
01817
01821 ha_sha256 = 2,
01822
01826 ha_sha384 = 3,
01827
01831 ha_sha512 = 4,
01832
01836 ha_ripemd160 = 5
01837 };
01838
01839 public:
01843 SignRSA ()
01844 : p (NULL), mBadAlloc (false)
01845 {
01846 struct SIGNDOC_Exception *ex = NULL;
01847 p = SIGNDOC_SignRSA_new (&ex, this, signC, getSignatureSizeC,
01848 getSigningCertificateC,
01849 getCertificateCountC, getCertificateC,
01850 getErrorMessageC);
01851 if (ex != NULL) SignDoc_throw (ex);
01852 }
01853
01859 virtual ~SignRSA ()
01860 {
01861 SIGNDOC_SignRSA_delete (p);
01862 }
01863
01878 virtual bool sign (Source &aSource,
01879 Version aVersion, HashAlgorithm aHashAlgorithm,
01880 std::vector<unsigned char> &aOutput) = 0;
01881
01890 virtual int getSignatureSize () = 0;
01891
01902 virtual bool getSigningCertificate (std::vector<unsigned char> &aOutput) const = 0;
01903
01909 virtual int getCertificateCount () const = 0;
01910
01923 virtual bool getCertificate (int aIndex,
01924 std::vector<unsigned char> &aOutput) const = 0;
01925
01938 virtual const char *getErrorMessage () const = 0;
01939
01944 SIGNDOC_SignRSA *getImpl () { return p; }
01945
01946 private:
01947 static SIGNDOC_Boolean SDCAPI
01948 signC (void *aClosure, struct SIGNDOC_Source *aSource,
01949 int aVersion, int aHashAlgorithm,
01950 struct SIGNDOC_ByteArray *aOutput)
01951 {
01952 SignRSA *s = static_cast<SignRSA*>(aClosure);
01953 s->mBadAlloc = false;
01954 try
01955 {
01956 std::vector<unsigned char> output;
01957 Source src (aSource);
01958 bool ok = s->sign (src, (Version)aVersion,
01959 (HashAlgorithm)aHashAlgorithm, output);
01960 if (ok)
01961 assignByteArray (aOutput, output);
01962 return ok;
01963 }
01964 catch (std::bad_alloc &)
01965 {
01966 s->mBadAlloc = true;
01967 return SIGNDOC_FALSE;
01968 }
01969 }
01970
01971 static int SDCAPI
01972 getSignatureSizeC (void *aClosure)
01973 {
01974 SignRSA *s = static_cast<SignRSA*>(aClosure);
01975 s->mBadAlloc = false;
01976 try
01977 {
01978 return s->getSignatureSize ();
01979 }
01980 catch (std::bad_alloc &)
01981 {
01982 s->mBadAlloc = true;
01983 return -1;
01984 }
01985 }
01986
01987 static SIGNDOC_Boolean SDCAPI
01988 getSigningCertificateC (const void *aClosure,
01989 struct SIGNDOC_ByteArray *aOutput)
01990 {
01991 const SignRSA *s = static_cast<const SignRSA*>(aClosure);
01992 s->mBadAlloc = false;
01993 try
01994 {
01995 std::vector<unsigned char> output;
01996 bool ok = s->getSigningCertificate (output);
01997 if (ok)
01998 assignByteArray (aOutput, output);
01999 return ok;
02000 }
02001 catch (std::bad_alloc &)
02002 {
02003 s->mBadAlloc = true;
02004 return SIGNDOC_FALSE;
02005 }
02006 }
02007
02008 static int SDCAPI
02009 getCertificateCountC (const void *aClosure)
02010 {
02011 const SignRSA *s = static_cast<const SignRSA*>(aClosure);
02012 s->mBadAlloc = false;
02013 try
02014 {
02015 return s->getCertificateCount ();
02016 }
02017 catch (std::bad_alloc &)
02018 {
02019 s->mBadAlloc = true;
02020 return 0;
02021 }
02022 }
02023
02024 static SIGNDOC_Boolean SDCAPI
02025 getCertificateC (const void *aClosure, int aIndex,
02026 struct SIGNDOC_ByteArray *aOutput)
02027 {
02028 const SignRSA *s = static_cast<const SignRSA*>(aClosure);
02029 s->mBadAlloc = false;
02030 try
02031 {
02032 std::vector<unsigned char> output;
02033 bool ok = s->getCertificate (aIndex, output);
02034 if (ok)
02035 assignByteArray (aOutput, output);
02036 return ok;
02037 }
02038 catch (std::bad_alloc &)
02039 {
02040 s->mBadAlloc = true;
02041 return SIGNDOC_FALSE;
02042 }
02043 }
02044
02045 static const char * SDCAPI
02046 getErrorMessageC (const void *aClosure)
02047 {
02048 const SignRSA *s = static_cast<const SignRSA*>(aClosure);
02049 if (s->mBadAlloc)
02050 return "out of memory";
02051 try
02052 {
02053 return s->getErrorMessage ();
02054 }
02055 catch (std::bad_alloc &)
02056 {
02057 s->mBadAlloc = true;
02058 return "out of memory";
02059 }
02060 }
02061
02062 static void assignByteArray (SIGNDOC_ByteArray *aOutput,
02063 const std::vector<unsigned char> &aInput)
02064 {
02065 if (aInput.empty ())
02066 SIGNDOC_ByteArray_clear (aOutput);
02067 else
02068 {
02069 struct SIGNDOC_Exception *ex = NULL;
02070 SIGNDOC_ByteArray_set (&ex, aOutput,
02071 &aInput[0], aInput.size ());
02072 if (ex != NULL) SignDoc_throw (ex);
02073 }
02074 }
02075
02076 private:
02077 SIGNDOC_SignRSA *p;
02078 mutable bool mBadAlloc;
02079 };
02080
02086 class SignECDSA
02087 {
02088 public:
02092 enum HashAlgorithm
02093 {
02097 ha_sha1 = 1,
02098
02102 ha_sha256 = 2,
02103
02107 ha_sha384 = 3,
02108
02112 ha_sha512 = 4,
02113
02117 ha_sha224 = 7
02118 };
02119
02120 public:
02124 SignECDSA ()
02125 : p (NULL), mBadAlloc (false)
02126 {
02127 struct SIGNDOC_Exception *ex = NULL;
02128 p = SIGNDOC_SignECDSA_new (&ex, this, signC, getSignatureSizeC,
02129 getSigningCertificateC,
02130 getCertificateCountC, getCertificateC,
02131 getErrorMessageC);
02132 if (ex != NULL) SignDoc_throw (ex);
02133 }
02134
02140 virtual ~SignECDSA ()
02141 {
02142 SIGNDOC_SignECDSA_delete (p);
02143 }
02144
02158 virtual bool sign (Source &aSource, HashAlgorithm aHashAlgorithm,
02159 std::vector<unsigned char> &aOutput) = 0;
02160
02168 virtual int getSignatureSize () = 0;
02169
02180 virtual bool getSigningCertificate (std::vector<unsigned char> &aOutput) const = 0;
02181
02187 virtual int getCertificateCount () const = 0;
02188
02201 virtual bool getCertificate (int aIndex,
02202 std::vector<unsigned char> &aOutput) const = 0;
02203
02216 virtual const char *getErrorMessage () const = 0;
02217
02222 SIGNDOC_SignECDSA *getImpl () { return p; }
02223
02224 private:
02225 static SIGNDOC_Boolean SDCAPI
02226 signC (void *aClosure, struct SIGNDOC_Source *aSource, int aHashAlgorithm,
02227 struct SIGNDOC_ByteArray *aOutput)
02228 {
02229 SignECDSA *s = static_cast<SignECDSA*>(aClosure);
02230 s->mBadAlloc = false;
02231 try
02232 {
02233 std::vector<unsigned char> output;
02234 Source src (aSource);
02235 bool ok = s->sign (src, (HashAlgorithm)aHashAlgorithm, output);
02236 if (ok)
02237 assignByteArray (aOutput, output);
02238 return ok;
02239 }
02240 catch (std::bad_alloc &)
02241 {
02242 s->mBadAlloc = true;
02243 return SIGNDOC_FALSE;
02244 }
02245 }
02246
02247 static int SDCAPI
02248 getSignatureSizeC (void *aClosure)
02249 {
02250 SignECDSA *s = static_cast<SignECDSA*>(aClosure);
02251 s->mBadAlloc = false;
02252 try
02253 {
02254 return s->getSignatureSize ();
02255 }
02256 catch (std::bad_alloc &)
02257 {
02258 s->mBadAlloc = true;
02259 return -1;
02260 }
02261 }
02262
02263 static SIGNDOC_Boolean SDCAPI
02264 getSigningCertificateC (const void *aClosure,
02265 struct SIGNDOC_ByteArray *aOutput)
02266 {
02267 const SignECDSA *s = static_cast<const SignECDSA*>(aClosure);
02268 s->mBadAlloc = false;
02269 try
02270 {
02271 std::vector<unsigned char> output;
02272 bool ok = s->getSigningCertificate (output);
02273 if (ok)
02274 assignByteArray (aOutput, output);
02275 return ok;
02276 }
02277 catch (std::bad_alloc &)
02278 {
02279 s->mBadAlloc = true;
02280 return SIGNDOC_FALSE;
02281 }
02282 }
02283
02284 static int SDCAPI
02285 getCertificateCountC (const void *aClosure)
02286 {
02287 const SignECDSA *s = static_cast<const SignECDSA*>(aClosure);
02288 s->mBadAlloc = false;
02289 try
02290 {
02291 return s->getCertificateCount ();
02292 }
02293 catch (std::bad_alloc &)
02294 {
02295 s->mBadAlloc = true;
02296 return 0;
02297 }
02298 }
02299
02300 static SIGNDOC_Boolean SDCAPI
02301 getCertificateC (const void *aClosure, int aIndex,
02302 struct SIGNDOC_ByteArray *aOutput)
02303 {
02304 const SignECDSA *s = static_cast<const SignECDSA*>(aClosure);
02305 s->mBadAlloc = false;
02306 try
02307 {
02308 std::vector<unsigned char> output;
02309 bool ok = s->getCertificate (aIndex, output);
02310 if (ok)
02311 assignByteArray (aOutput, output);
02312 return ok;
02313 }
02314 catch (std::bad_alloc &)
02315 {
02316 s->mBadAlloc = true;
02317 return SIGNDOC_FALSE;
02318 }
02319 }
02320
02321 static const char * SDCAPI
02322 getErrorMessageC (const void *aClosure)
02323 {
02324 const SignECDSA *s = static_cast<const SignECDSA*>(aClosure);
02325 if (s->mBadAlloc)
02326 return "out of memory";
02327 try
02328 {
02329 return s->getErrorMessage ();
02330 }
02331 catch (std::bad_alloc &)
02332 {
02333 s->mBadAlloc = true;
02334 return "out of memory";
02335 }
02336 }
02337
02338 static void assignByteArray (SIGNDOC_ByteArray *aOutput,
02339 const std::vector<unsigned char> &aInput)
02340 {
02341 if (aInput.empty ())
02342 SIGNDOC_ByteArray_clear (aOutput);
02343 else
02344 {
02345 struct SIGNDOC_Exception *ex = NULL;
02346 SIGNDOC_ByteArray_set (&ex, aOutput,
02347 &aInput[0], aInput.size ());
02348 if (ex != NULL) SignDoc_throw (ex);
02349 }
02350 }
02351
02352 private:
02353 SIGNDOC_SignECDSA *p;
02354 mutable bool mBadAlloc;
02355 };
02356
02365 class SignDocColor
02366 {
02367 public:
02368 enum Type
02369 {
02373 t_gray,
02374
02378 t_rgb
02379 };
02380
02381 public:
02385 ~SignDocColor ()
02386 {
02387 SIGNDOC_Color_delete (p);
02388 }
02389
02395 SignDocColor *clone () const
02396 {
02397 SIGNDOC_Exception *ex = NULL;
02398 SIGNDOC_Color *r;
02399 r = SIGNDOC_Color_clone (&ex, p);
02400 if (ex != NULL) SignDoc_throw (ex);
02401 if (r == NULL)
02402 return NULL;
02403 try
02404 {
02405 return new SignDocColor (r);
02406 }
02407 catch (...)
02408 {
02409 SIGNDOC_Color_delete (r);
02410 throw;
02411 }
02412 }
02413
02419 Type getType () const
02420 {
02421 return (Type)SIGNDOC_Color_getType (p);
02422 }
02423
02429 unsigned getNumberOfComponents () const
02430 {
02431 return SIGNDOC_Color_getNumberOfComponents (p);
02432 }
02433
02443 unsigned char getComponent (unsigned aIndex) const
02444 {
02445 return SIGNDOC_Color_getComponent (p, aIndex);
02446 }
02447
02454 unsigned char getIntensity () const
02455 {
02456 return SIGNDOC_Color_getIntensity (p);
02457 }
02458
02465 unsigned char getRed () const
02466 {
02467 return SIGNDOC_Color_getRed (p);
02468 }
02469
02476 unsigned char getGreen () const
02477 {
02478 return SIGNDOC_Color_getGreen (p);
02479 }
02480
02487 unsigned char getBlue () const
02488 {
02489 return SIGNDOC_Color_getBlue (p);
02490 }
02491
02500 static SignDocColor *createGray (unsigned char aIntensity)
02501 {
02502 SIGNDOC_Exception *ex = NULL;
02503 SIGNDOC_Color *r;
02504 r = SIGNDOC_Color_createGray (&ex, aIntensity);
02505 if (ex != NULL) SignDoc_throw (ex);
02506 if (r == NULL)
02507 return NULL;
02508 try
02509 {
02510 return new SignDocColor (r);
02511 }
02512 catch (...)
02513 {
02514 SIGNDOC_Color_delete (r);
02515 throw;
02516 }
02517 }
02518
02531 static SignDocColor *createRGB (unsigned char aRed, unsigned char aGreen,
02532 unsigned char aBlue)
02533 {
02534 SIGNDOC_Exception *ex = NULL;
02535 SIGNDOC_Color *r;
02536 r = SIGNDOC_Color_createRGB (&ex, aRed, aGreen, aBlue);
02537 if (ex != NULL) SignDoc_throw (ex);
02538 if (r == NULL)
02539 return NULL;
02540 try
02541 {
02542 return new SignDocColor (r);
02543 }
02544 catch (...)
02545 {
02546 SIGNDOC_Color_delete (r);
02547 throw;
02548 }
02549 }
02550
02551 private:
02557 SignDocColor ();
02558
02564
02565 SignDocColor (const SignDocColor &);
02566
02572 SignDocColor &operator= (const SignDocColor &);
02573
02574 public:
02579 SignDocColor (SIGNDOC_Color *aP) : p (aP) { }
02580
02585 SIGNDOC_Color *getImpl () { return p; }
02586
02591 const SIGNDOC_Color *getImpl () const { return p; }
02592
02597 void setImpl (SIGNDOC_Color *aP) { SIGNDOC_Color_delete (p); p = aP; }
02598
02599 private:
02600 SIGNDOC_Color *p;
02601 };
02602
02617 class SignDocTextFieldAttributes
02618 {
02619 public:
02620
02621 public:
02625 SignDocTextFieldAttributes ()
02626 : p (NULL)
02627 {
02628 SIGNDOC_Exception *ex = NULL;
02629 p = SIGNDOC_TextFieldAttributes_new (&ex);
02630 if (ex != NULL) SignDoc_throw (ex);
02631 }
02632
02638 SignDocTextFieldAttributes (const SignDocTextFieldAttributes &aSource)
02639 : p (NULL)
02640 {
02641 SIGNDOC_Exception *ex = NULL;
02642 p = SIGNDOC_TextFieldAttributes_clone (&ex, aSource.getImpl ());
02643 if (ex != NULL) SignDoc_throw (ex);
02644 }
02645
02649 ~SignDocTextFieldAttributes ()
02650 {
02651 SIGNDOC_TextFieldAttributes_delete (p);
02652 }
02653
02659 SignDocTextFieldAttributes &operator= (const SignDocTextFieldAttributes &aSource)
02660 {
02661 SIGNDOC_Exception *ex = NULL;
02662 SIGNDOC_TextFieldAttributes_assign (&ex, p, aSource.getImpl ());
02663 if (ex != NULL) SignDoc_throw (ex);
02664 return *this;
02665 }
02666
02672 void swap (SignDocTextFieldAttributes &aOther)
02673 {
02674 std::swap (p, aOther.p);
02675 }
02676
02692 bool isSet () const
02693 {
02694 SIGNDOC_Exception *ex = NULL;
02695 bool r;
02696 r = (bool)SIGNDOC_TextFieldAttributes_isSet (&ex, p);
02697 if (ex != NULL) SignDoc_throw (ex);
02698 return r;
02699 }
02700
02712 bool isValid () const
02713 {
02714 SIGNDOC_Exception *ex = NULL;
02715 bool r;
02716 r = (bool)SIGNDOC_TextFieldAttributes_isValid (&ex, p);
02717 if (ex != NULL) SignDoc_throw (ex);
02718 return r;
02719 }
02720
02726 void clear ()
02727 {
02728 SIGNDOC_Exception *ex = NULL;
02729 SIGNDOC_TextFieldAttributes_clear (&ex, p);
02730 if (ex != NULL) SignDoc_throw (ex);
02731 }
02732
02744 std::string getFontName (Encoding aEncoding) const
02745 {
02746 SIGNDOC_Exception *ex = NULL;
02747 std::string r;
02748 char *s = SIGNDOC_TextFieldAttributes_getFontName (&ex, p, aEncoding);
02749 if (ex != NULL) SignDoc_throw (ex);
02750 try
02751 {
02752 r = s;
02753 }
02754 catch (...)
02755 {
02756 SIGNDOC_free (s);
02757 throw;
02758 }
02759 SIGNDOC_free (s);
02760 return r;
02761 }
02762
02781 void setFontName (Encoding aEncoding, const std::string &aFontName)
02782 {
02783 SIGNDOC_Exception *ex = NULL;
02784 SIGNDOC_TextFieldAttributes_setFontName (&ex, p, aEncoding, aFontName.c_str ());
02785 if (ex != NULL) SignDoc_throw (ex);
02786 }
02787
02801 std::string getFontResourceName (Encoding aEncoding) const
02802 {
02803 SIGNDOC_Exception *ex = NULL;
02804 std::string r;
02805 char *s = SIGNDOC_TextFieldAttributes_getFontResourceName (&ex, p, aEncoding);
02806 if (ex != NULL) SignDoc_throw (ex);
02807 try
02808 {
02809 r = s;
02810 }
02811 catch (...)
02812 {
02813 SIGNDOC_free (s);
02814 throw;
02815 }
02816 SIGNDOC_free (s);
02817 return r;
02818 }
02819
02831 double getFontSize () const
02832 {
02833 SIGNDOC_Exception *ex = NULL;
02834 double r;
02835 r = SIGNDOC_TextFieldAttributes_getFontSize (&ex, p);
02836 if (ex != NULL) SignDoc_throw (ex);
02837 return r;
02838 }
02839
02853 void setFontSize (double aFontSize)
02854 {
02855 SIGNDOC_Exception *ex = NULL;
02856 SIGNDOC_TextFieldAttributes_setFontSize (&ex, p, aFontSize);
02857 if (ex != NULL) SignDoc_throw (ex);
02858 }
02859
02871 SignDocColor *getTextColor () const
02872 {
02873 SIGNDOC_Exception *ex = NULL;
02874 SIGNDOC_Color *r;
02875 r = SIGNDOC_TextFieldAttributes_getTextColor (&ex, p);
02876 if (ex != NULL) SignDoc_throw (ex);
02877 if (r == NULL)
02878 return NULL;
02879 try
02880 {
02881 return new SignDocColor (r);
02882 }
02883 catch (...)
02884 {
02885 SIGNDOC_Color_delete (r);
02886 throw;
02887 }
02888 }
02889
02895 void setTextColor (const SignDocColor &aTextColor)
02896 {
02897 SIGNDOC_Exception *ex = NULL;
02898 SIGNDOC_TextFieldAttributes_setTextColor (&ex, p, aTextColor.getImpl ());
02899 if (ex != NULL) SignDoc_throw (ex);
02900 }
02901
02917 std::string getRest (Encoding aEncoding) const
02918 {
02919 SIGNDOC_Exception *ex = NULL;
02920 std::string r;
02921 char *s = SIGNDOC_TextFieldAttributes_getRest (&ex, p, aEncoding);
02922 if (ex != NULL) SignDoc_throw (ex);
02923 try
02924 {
02925 r = s;
02926 }
02927 catch (...)
02928 {
02929 SIGNDOC_free (s);
02930 throw;
02931 }
02932 SIGNDOC_free (s);
02933 return r;
02934 }
02935
02945 void setRest (Encoding aEncoding, const std::string &aInput)
02946 {
02947 SIGNDOC_Exception *ex = NULL;
02948 SIGNDOC_TextFieldAttributes_setRest (&ex, p, aEncoding, aInput.c_str ());
02949 if (ex != NULL) SignDoc_throw (ex);
02950 }
02951
02952 private:
02953 public:
02958 SignDocTextFieldAttributes (SIGNDOC_TextFieldAttributes *aP) : p (aP) { }
02959
02964 SIGNDOC_TextFieldAttributes *getImpl () { return p; }
02965
02970 const SIGNDOC_TextFieldAttributes *getImpl () const { return p; }
02971
02976 void setImpl (SIGNDOC_TextFieldAttributes *aP) { SIGNDOC_TextFieldAttributes_delete (p); p = aP; }
02977
02978 private:
02979 SIGNDOC_TextFieldAttributes *p;
02980 };
02981
03305 class SignDocField
03306 {
03307 public:
03308
03309 public:
03315 enum Type
03316 {
03317 t_unknown,
03318 t_pushbutton,
03319 t_check_box,
03320 t_radio_button,
03321 t_text,
03322 t_list_box,
03323 t_signature_digsig,
03324 t_signature_signdoc,
03325 t_combo_box
03326 };
03327
03377 enum Flag
03378 {
03379 f_ReadOnly = 1 << 0,
03380 f_Required = 1 << 1,
03381 f_NoExport = 1 << 2,
03382 f_NoToggleToOff = 1 << 3,
03383 f_Radio = 1 << 4,
03384 f_Pushbutton = 1 << 5,
03385 f_RadiosInUnison = 1 << 6,
03386
03396 f_MultiLine = 1 << 7,
03397
03398 f_Password = 1 << 8,
03399 f_FileSelect = 1 << 9,
03400 f_DoNotSpellCheck = 1 << 10,
03401 f_DoNotScroll = 1 << 11,
03402 f_Comb = 1 << 12,
03403 f_RichText = 1 << 13,
03404 f_Combo = 1 << 14,
03405 f_Edit = 1 << 15,
03406 f_Sort = 1 << 16,
03407 f_MultiSelect = 1 << 17,
03408 f_CommitOnSelChange = 1 << 18,
03409 f_SinglePage = 1 << 28,
03410 f_EnableAddAfterSigning = 1 << 29,
03411 f_Invisible = 1 << 30
03412 };
03413
03423 enum WidgetFlag
03424 {
03425 wf_Invisible = 1 << (1 - 1),
03426 wf_Hidden = 1 << (2 - 1),
03427 wf_Print = 1 << (3 - 1),
03428 wf_NoZoom = 1 << (4 - 1),
03429 wf_NoRotate = 1 << (5 - 1),
03430 wf_NoView = 1 << (6 - 1),
03431 wf_ReadOnly = 1 << (7 - 1),
03432 wf_Locked = 1 << (8 - 1),
03433 wf_ToggleNoView = 1 << (9 - 1),
03434 wf_LockedContents = 1 << (10 - 1)
03435 };
03436
03442 enum Justification
03443 {
03444 j_none,
03445 j_left,
03446 j_center,
03447 j_right
03448 };
03449
03455 enum BorderStyle
03456 {
03457 bos_other,
03458 bos_solid,
03459 bos_dashed,
03460 bos_beveled,
03461 bos_inset,
03462 bos_underline
03463 };
03464
03470 enum ButtonStyle
03471 {
03472 bus_default,
03473 bus_other,
03474 bus_check_mark,
03475 bus_cross,
03476 bus_star,
03477 bus_circle,
03478 bus_square,
03479 bus_diamond
03480 };
03481
03487 enum LockType
03488 {
03489 lt_na,
03490 lt_none,
03491 lt_all,
03492 lt_include,
03493 lt_exclude
03494 };
03495
03499 enum SignatureType
03500 {
03501 st_not_a_signature_field,
03502 st_not_signed,
03503 st_approval,
03504 st_certification,
03505 st_document_time_stamp
03506 };
03507
03513 enum CertSeedValueFlag
03514 {
03515 csvf_SubjectCert = 0x01,
03516 csvf_IssuerCert = 0x02,
03517 csvf_Policy = 0x04,
03518 csvf_SubjectDN = 0x08,
03519 csvf_KeyUsage = 0x20,
03520 csvf_URL = 0x40
03521 };
03522
03523 public:
03529 SignDocField ()
03530 : p (NULL)
03531 {
03532 SIGNDOC_Exception *ex = NULL;
03533 p = SIGNDOC_Field_new (&ex);
03534 if (ex != NULL) SignDoc_throw (ex);
03535 }
03536
03542 SignDocField (const SignDocField &aSource)
03543 : p (NULL)
03544 {
03545 SIGNDOC_Exception *ex = NULL;
03546 p = SIGNDOC_Field_clone (&ex, aSource.getImpl ());
03547 if (ex != NULL) SignDoc_throw (ex);
03548 }
03549
03553 ~SignDocField ()
03554 {
03555 SIGNDOC_Field_delete (p);
03556 }
03557
03563 SignDocField &operator= (const SignDocField &aSource)
03564 {
03565 SIGNDOC_Exception *ex = NULL;
03566 SIGNDOC_Field_assign (&ex, p, aSource.getImpl ());
03567 if (ex != NULL) SignDoc_throw (ex);
03568 return *this;
03569 }
03570
03576 void swap (SignDocField &aOther)
03577 {
03578 std::swap (p, aOther.p);
03579 }
03580
03593 std::string getName (Encoding aEncoding) const
03594 {
03595 SIGNDOC_Exception *ex = NULL;
03596 std::string r;
03597 char *s = SIGNDOC_Field_getName (&ex, p, aEncoding);
03598 if (ex != NULL) SignDoc_throw (ex);
03599 try
03600 {
03601 r = s;
03602 }
03603 catch (...)
03604 {
03605 SIGNDOC_free (s);
03606 throw;
03607 }
03608 SIGNDOC_free (s);
03609 return r;
03610 }
03611
03618 const char *getNameUTF8 () const
03619 {
03620 SIGNDOC_Exception *ex = NULL;
03621 const char *r;
03622 r = SIGNDOC_Field_getNameUTF8 (&ex, p);
03623 if (ex != NULL) SignDoc_throw (ex);
03624 return r;
03625 }
03626
03648 void setName (Encoding aEncoding, const std::string &aName)
03649 {
03650 SIGNDOC_Exception *ex = NULL;
03651 SIGNDOC_Field_setName (&ex, p, aEncoding, aName.c_str ());
03652 if (ex != NULL) SignDoc_throw (ex);
03653 }
03654
03671 void setName (const wchar_t *aName)
03672 {
03673 SIGNDOC_Exception *ex = NULL;
03674 SIGNDOC_Field_setNameW (&ex, p, aName);
03675 if (ex != NULL) SignDoc_throw (ex);
03676 }
03677
03695 std::string getAlternateName (Encoding aEncoding) const
03696 {
03697 SIGNDOC_Exception *ex = NULL;
03698 std::string r;
03699 char *s = SIGNDOC_Field_getAlternateName (&ex, p, aEncoding);
03700 if (ex != NULL) SignDoc_throw (ex);
03701 try
03702 {
03703 r = s;
03704 }
03705 catch (...)
03706 {
03707 SIGNDOC_free (s);
03708 throw;
03709 }
03710 SIGNDOC_free (s);
03711 return r;
03712 }
03713
03731 void setAlternateName (Encoding aEncoding, const std::string &aName)
03732 {
03733 SIGNDOC_Exception *ex = NULL;
03734 SIGNDOC_Field_setAlternateName (&ex, p, aEncoding, aName.c_str ());
03735 if (ex != NULL) SignDoc_throw (ex);
03736 }
03737
03754 std::string getMappingName (Encoding aEncoding) const
03755 {
03756 SIGNDOC_Exception *ex = NULL;
03757 std::string r;
03758 char *s = SIGNDOC_Field_getMappingName (&ex, p, aEncoding);
03759 if (ex != NULL) SignDoc_throw (ex);
03760 try
03761 {
03762 r = s;
03763 }
03764 catch (...)
03765 {
03766 SIGNDOC_free (s);
03767 throw;
03768 }
03769 SIGNDOC_free (s);
03770 return r;
03771 }
03772
03789 void setMappingName (Encoding aEncoding, const std::string &aName)
03790 {
03791 SIGNDOC_Exception *ex = NULL;
03792 SIGNDOC_Field_setMappingName (&ex, p, aEncoding, aName.c_str ());
03793 if (ex != NULL) SignDoc_throw (ex);
03794 }
03795
03807 int getValueCount () const
03808 {
03809 SIGNDOC_Exception *ex = NULL;
03810 int r;
03811 r = SIGNDOC_Field_getValueCount (&ex, p);
03812 if (ex != NULL) SignDoc_throw (ex);
03813 return r;
03814 }
03815
03836 std::string getValue (Encoding aEncoding, int aIndex) const
03837 {
03838 SIGNDOC_Exception *ex = NULL;
03839 std::string r;
03840 char *s = SIGNDOC_Field_getValue (&ex, p, aEncoding, aIndex);
03841 if (ex != NULL) SignDoc_throw (ex);
03842 try
03843 {
03844 r = s;
03845 }
03846 catch (...)
03847 {
03848 SIGNDOC_free (s);
03849 throw;
03850 }
03851 SIGNDOC_free (s);
03852 return r;
03853 }
03854
03873 const char *getValueUTF8 (int aIndex) const
03874 {
03875 SIGNDOC_Exception *ex = NULL;
03876 const char *r;
03877 r = SIGNDOC_Field_getValueUTF8 (&ex, p, aIndex);
03878 if (ex != NULL) SignDoc_throw (ex);
03879 return r;
03880 }
03881
03890 void clearValues ()
03891 {
03892 SIGNDOC_Exception *ex = NULL;
03893 SIGNDOC_Field_clearValues (&ex, p);
03894 if (ex != NULL) SignDoc_throw (ex);
03895 }
03896
03921 void addValue (Encoding aEncoding, const std::string &aValue)
03922 {
03923 SIGNDOC_Exception *ex = NULL;
03924 SIGNDOC_Field_addValue (&ex, p, aEncoding, aValue.c_str ());
03925 if (ex != NULL) SignDoc_throw (ex);
03926 }
03927
03956 bool setValue (int aIndex, Encoding aEncoding, const std::string &aValue)
03957 {
03958 SIGNDOC_Exception *ex = NULL;
03959 bool r;
03960 r = (bool)SIGNDOC_Field_setValueByIndex (&ex, p, aIndex, aEncoding, aValue.c_str ());
03961 if (ex != NULL) SignDoc_throw (ex);
03962 return r;
03963 }
03964
03992 void setValue (Encoding aEncoding, const std::string &aValue)
03993 {
03994 SIGNDOC_Exception *ex = NULL;
03995 SIGNDOC_Field_setValue (&ex, p, aEncoding, aValue.c_str ());
03996 if (ex != NULL) SignDoc_throw (ex);
03997 }
03998
04010 bool removeValue (int aIndex)
04011 {
04012 SIGNDOC_Exception *ex = NULL;
04013 bool r;
04014 r = (bool)SIGNDOC_Field_removeValue (&ex, p, aIndex);
04015 if (ex != NULL) SignDoc_throw (ex);
04016 return r;
04017 }
04018
04046 int getValueIndex () const
04047 {
04048 SIGNDOC_Exception *ex = NULL;
04049 int r;
04050 r = SIGNDOC_Field_getValueIndex (&ex, p);
04051 if (ex != NULL) SignDoc_throw (ex);
04052 return r;
04053 }
04054
04107 void setValueIndex (int aIndex)
04108 {
04109 SIGNDOC_Exception *ex = NULL;
04110 SIGNDOC_Field_setValueIndex (&ex, p, aIndex);
04111 if (ex != NULL) SignDoc_throw (ex);
04112 }
04113
04135 bool clickButton (int aIndex)
04136 {
04137 SIGNDOC_Exception *ex = NULL;
04138 bool r;
04139 r = (bool)SIGNDOC_Field_clickButton (&ex, p, aIndex);
04140 if (ex != NULL) SignDoc_throw (ex);
04141 return r;
04142 }
04143
04155 int getChoiceCount () const
04156 {
04157 SIGNDOC_Exception *ex = NULL;
04158 int r;
04159 r = SIGNDOC_Field_getChoiceCount (&ex, p);
04160 if (ex != NULL) SignDoc_throw (ex);
04161 return r;
04162 }
04163
04187 std::string getChoiceValue (Encoding aEncoding, int aIndex) const
04188 {
04189 SIGNDOC_Exception *ex = NULL;
04190 std::string r;
04191 char *s = SIGNDOC_Field_getChoiceValue (&ex, p, aEncoding, aIndex);
04192 if (ex != NULL) SignDoc_throw (ex);
04193 try
04194 {
04195 r = s;
04196 }
04197 catch (...)
04198 {
04199 SIGNDOC_free (s);
04200 throw;
04201 }
04202 SIGNDOC_free (s);
04203 return r;
04204 }
04205
04228 const char *getChoiceValueUTF8 (int aIndex) const
04229 {
04230 SIGNDOC_Exception *ex = NULL;
04231 const char *r;
04232 r = SIGNDOC_Field_getChoiceValueUTF8 (&ex, p, aIndex);
04233 if (ex != NULL) SignDoc_throw (ex);
04234 return r;
04235 }
04236
04260 std::string getChoiceExport (Encoding aEncoding, int aIndex) const
04261 {
04262 SIGNDOC_Exception *ex = NULL;
04263 std::string r;
04264 char *s = SIGNDOC_Field_getChoiceExport (&ex, p, aEncoding, aIndex);
04265 if (ex != NULL) SignDoc_throw (ex);
04266 try
04267 {
04268 r = s;
04269 }
04270 catch (...)
04271 {
04272 SIGNDOC_free (s);
04273 throw;
04274 }
04275 SIGNDOC_free (s);
04276 return r;
04277 }
04278
04301 const char *getChoiceExportUTF8 (int aIndex) const
04302 {
04303 SIGNDOC_Exception *ex = NULL;
04304 const char *r;
04305 r = SIGNDOC_Field_getChoiceExportUTF8 (&ex, p, aIndex);
04306 if (ex != NULL) SignDoc_throw (ex);
04307 return r;
04308 }
04309
04317 void clearChoices ()
04318 {
04319 SIGNDOC_Exception *ex = NULL;
04320 SIGNDOC_Field_clearChoices (&ex, p);
04321 if (ex != NULL) SignDoc_throw (ex);
04322 }
04323
04342 void addChoice (Encoding aEncoding, const std::string &aValue)
04343 {
04344 SIGNDOC_Exception *ex = NULL;
04345 SIGNDOC_Field_addChoice (&ex, p, aEncoding, aValue.c_str ());
04346 if (ex != NULL) SignDoc_throw (ex);
04347 }
04348
04366 void addChoice (Encoding aEncoding, const std::string &aValue,
04367 const std::string &aExport)
04368 {
04369 SIGNDOC_Exception *ex = NULL;
04370 SIGNDOC_Field_addChoiceWithExport (&ex, p, aEncoding, aValue.c_str (), aExport.c_str ());
04371 if (ex != NULL) SignDoc_throw (ex);
04372 }
04373
04397 bool setChoice (int aIndex, Encoding aEncoding, const std::string &aValue)
04398 {
04399 SIGNDOC_Exception *ex = NULL;
04400 bool r;
04401 r = (bool)SIGNDOC_Field_setChoice (&ex, p, aIndex, aEncoding, aValue.c_str ());
04402 if (ex != NULL) SignDoc_throw (ex);
04403 return r;
04404 }
04405
04428 bool setChoice (int aIndex, Encoding aEncoding, const std::string &aValue,
04429 const std::string &aExport)
04430 {
04431 SIGNDOC_Exception *ex = NULL;
04432 bool r;
04433 r = (bool)SIGNDOC_Field_setChoiceWithExport (&ex, p, aIndex, aEncoding, aValue.c_str (), aExport.c_str ());
04434 if (ex != NULL) SignDoc_throw (ex);
04435 return r;
04436 }
04437
04447 bool removeChoice (int aIndex)
04448 {
04449 SIGNDOC_Exception *ex = NULL;
04450 bool r;
04451 r = (bool)SIGNDOC_Field_removeChoice (&ex, p, aIndex);
04452 if (ex != NULL) SignDoc_throw (ex);
04453 return r;
04454 }
04455
04465 Type getType () const
04466 {
04467 SIGNDOC_Exception *ex = NULL;
04468 Type r;
04469 r = (Type)SIGNDOC_Field_getType (&ex, p);
04470 if (ex != NULL) SignDoc_throw (ex);
04471 return r;
04472 }
04473
04485 void setType (Type aType)
04486 {
04487 SIGNDOC_Exception *ex = NULL;
04488 SIGNDOC_Field_setType (&ex, p, aType);
04489 if (ex != NULL) SignDoc_throw (ex);
04490 }
04491
04506 int getFlags () const
04507 {
04508 SIGNDOC_Exception *ex = NULL;
04509 int r;
04510 r = SIGNDOC_Field_getFlags (&ex, p);
04511 if (ex != NULL) SignDoc_throw (ex);
04512 return r;
04513 }
04514
04525 void setFlags (int aFlags)
04526 {
04527 SIGNDOC_Exception *ex = NULL;
04528 SIGNDOC_Field_setFlags (&ex, p, aFlags);
04529 if (ex != NULL) SignDoc_throw (ex);
04530 }
04531
04544 SignatureType getSignatureType () const
04545 {
04546 SIGNDOC_Exception *ex = NULL;
04547 SignatureType r;
04548 r = (SignatureType)SIGNDOC_Field_getSignatureType (&ex, p);
04549 if (ex != NULL) SignDoc_throw (ex);
04550 return r;
04551 }
04552
04572 int getDocMDP () const
04573 {
04574 SIGNDOC_Exception *ex = NULL;
04575 int r;
04576 r = SIGNDOC_Field_getDocMDP (&ex, p);
04577 if (ex != NULL) SignDoc_throw (ex);
04578 return r;
04579 }
04580
04594 bool isSigned () const
04595 {
04596 SIGNDOC_Exception *ex = NULL;
04597 bool r;
04598 r = (bool)SIGNDOC_Field_isSigned (&ex, p);
04599 if (ex != NULL) SignDoc_throw (ex);
04600 return r;
04601 }
04602
04620 bool isCurrentlyClearable () const
04621 {
04622 SIGNDOC_Exception *ex = NULL;
04623 bool r;
04624 r = (bool)SIGNDOC_Field_isCurrentlyClearable (&ex, p);
04625 if (ex != NULL) SignDoc_throw (ex);
04626 return r;
04627 }
04628
04640 int getMaxLen () const
04641 {
04642 SIGNDOC_Exception *ex = NULL;
04643 int r;
04644 r = SIGNDOC_Field_getMaxLen (&ex, p);
04645 if (ex != NULL) SignDoc_throw (ex);
04646 return r;
04647 }
04648
04657 void setMaxLen (int aMaxLen)
04658 {
04659 SIGNDOC_Exception *ex = NULL;
04660 SIGNDOC_Field_setMaxLen (&ex, p, aMaxLen);
04661 if (ex != NULL) SignDoc_throw (ex);
04662 }
04663
04675 int getTopIndex () const
04676 {
04677 SIGNDOC_Exception *ex = NULL;
04678 int r;
04679 r = SIGNDOC_Field_getTopIndex (&ex, p);
04680 if (ex != NULL) SignDoc_throw (ex);
04681 return r;
04682 }
04683
04695 void setTopIndex (int aTopIndex)
04696 {
04697 SIGNDOC_Exception *ex = NULL;
04698 SIGNDOC_Field_setTopIndex (&ex, p, aTopIndex);
04699 if (ex != NULL) SignDoc_throw (ex);
04700 }
04701
04714 int getWidget () const
04715 {
04716 SIGNDOC_Exception *ex = NULL;
04717 int r;
04718 r = SIGNDOC_Field_getWidget (&ex, p);
04719 if (ex != NULL) SignDoc_throw (ex);
04720 return r;
04721 }
04722
04733 int getWidgetCount () const
04734 {
04735 SIGNDOC_Exception *ex = NULL;
04736 int r;
04737 r = SIGNDOC_Field_getWidgetCount (&ex, p);
04738 if (ex != NULL) SignDoc_throw (ex);
04739 return r;
04740 }
04741
04761 bool selectWidget (int aIndex)
04762 {
04763 SIGNDOC_Exception *ex = NULL;
04764 bool r;
04765 r = (bool)SIGNDOC_Field_selectWidget (&ex, p, aIndex);
04766 if (ex != NULL) SignDoc_throw (ex);
04767 return r;
04768 }
04769
04785 bool addWidget ()
04786 {
04787 SIGNDOC_Exception *ex = NULL;
04788 bool r;
04789 r = (bool)SIGNDOC_Field_addWidget (&ex, p);
04790 if (ex != NULL) SignDoc_throw (ex);
04791 return r;
04792 }
04793
04814 bool insertWidget (int aIndex)
04815 {
04816 SIGNDOC_Exception *ex = NULL;
04817 bool r;
04818 r = (bool)SIGNDOC_Field_insertWidget (&ex, p, aIndex);
04819 if (ex != NULL) SignDoc_throw (ex);
04820 return r;
04821 }
04822
04848 bool removeWidget (int aIndex)
04849 {
04850 SIGNDOC_Exception *ex = NULL;
04851 bool r;
04852 r = (bool)SIGNDOC_Field_removeWidget (&ex, p, aIndex);
04853 if (ex != NULL) SignDoc_throw (ex);
04854 return r;
04855 }
04856
04869 int getWidgetFlags () const
04870 {
04871 SIGNDOC_Exception *ex = NULL;
04872 int r;
04873 r = SIGNDOC_Field_getWidgetFlags (&ex, p);
04874 if (ex != NULL) SignDoc_throw (ex);
04875 return r;
04876 }
04877
04890 void setWidgetFlags (int aFlags)
04891 {
04892 SIGNDOC_Exception *ex = NULL;
04893 SIGNDOC_Field_setWidgetFlags (&ex, p, aFlags);
04894 if (ex != NULL) SignDoc_throw (ex);
04895 }
04896
04908 int getPage () const
04909 {
04910 SIGNDOC_Exception *ex = NULL;
04911 int r;
04912 r = SIGNDOC_Field_getPage (&ex, p);
04913 if (ex != NULL) SignDoc_throw (ex);
04914 return r;
04915 }
04916
04933 void setPage (int aPage)
04934 {
04935 SIGNDOC_Exception *ex = NULL;
04936 SIGNDOC_Field_setPage (&ex, p, aPage);
04937 if (ex != NULL) SignDoc_throw (ex);
04938 }
04939
04950 double getLeft () const
04951 {
04952 SIGNDOC_Exception *ex = NULL;
04953 double r;
04954 r = SIGNDOC_Field_getLeft (&ex, p);
04955 if (ex != NULL) SignDoc_throw (ex);
04956 return r;
04957 }
04958
04969 void setLeft (double aLeft)
04970 {
04971 SIGNDOC_Exception *ex = NULL;
04972 SIGNDOC_Field_setLeft (&ex, p, aLeft);
04973 if (ex != NULL) SignDoc_throw (ex);
04974 }
04975
04986 double getBottom () const
04987 {
04988 SIGNDOC_Exception *ex = NULL;
04989 double r;
04990 r = SIGNDOC_Field_getBottom (&ex, p);
04991 if (ex != NULL) SignDoc_throw (ex);
04992 return r;
04993 }
04994
05005 void setBottom (double aBottom)
05006 {
05007 SIGNDOC_Exception *ex = NULL;
05008 SIGNDOC_Field_setBottom (&ex, p, aBottom);
05009 if (ex != NULL) SignDoc_throw (ex);
05010 }
05011
05024 double getRight () const
05025 {
05026 SIGNDOC_Exception *ex = NULL;
05027 double r;
05028 r = SIGNDOC_Field_getRight (&ex, p);
05029 if (ex != NULL) SignDoc_throw (ex);
05030 return r;
05031 }
05032
05045 void setRight (double aRight)
05046 {
05047 SIGNDOC_Exception *ex = NULL;
05048 SIGNDOC_Field_setRight (&ex, p, aRight);
05049 if (ex != NULL) SignDoc_throw (ex);
05050 }
05051
05064 double getTop () const
05065 {
05066 SIGNDOC_Exception *ex = NULL;
05067 double r;
05068 r = SIGNDOC_Field_getTop (&ex, p);
05069 if (ex != NULL) SignDoc_throw (ex);
05070 return r;
05071 }
05072
05085 void setTop (double aTop)
05086 {
05087 SIGNDOC_Exception *ex = NULL;
05088 SIGNDOC_Field_setTop (&ex, p, aTop);
05089 if (ex != NULL) SignDoc_throw (ex);
05090 }
05091
05113 std::string getButtonValue (Encoding aEncoding) const
05114 {
05115 SIGNDOC_Exception *ex = NULL;
05116 std::string r;
05117 char *s = SIGNDOC_Field_getButtonValue (&ex, p, aEncoding);
05118 if (ex != NULL) SignDoc_throw (ex);
05119 try
05120 {
05121 r = s;
05122 }
05123 catch (...)
05124 {
05125 SIGNDOC_free (s);
05126 throw;
05127 }
05128 SIGNDOC_free (s);
05129 return r;
05130 }
05131
05145 const char *getButtonValueUTF8 () const
05146 {
05147 SIGNDOC_Exception *ex = NULL;
05148 const char *r;
05149 r = SIGNDOC_Field_getButtonValueUTF8 (&ex, p);
05150 if (ex != NULL) SignDoc_throw (ex);
05151 return r;
05152 }
05153
05178 void setButtonValue (Encoding aEncoding, const std::string &aValue)
05179 {
05180 SIGNDOC_Exception *ex = NULL;
05181 SIGNDOC_Field_setButtonValue (&ex, p, aEncoding, aValue.c_str ());
05182 if (ex != NULL) SignDoc_throw (ex);
05183 }
05184
05195 Justification getJustification () const
05196 {
05197 SIGNDOC_Exception *ex = NULL;
05198 Justification r;
05199 r = (Justification)SIGNDOC_Field_getJustification (&ex, p);
05200 if (ex != NULL) SignDoc_throw (ex);
05201 return r;
05202 }
05203
05217 void setJustification (Justification aJustification)
05218 {
05219 SIGNDOC_Exception *ex = NULL;
05220 SIGNDOC_Field_setJustification (&ex, p, aJustification);
05221 if (ex != NULL) SignDoc_throw (ex);
05222 }
05223
05237 int getRotation () const
05238 {
05239 SIGNDOC_Exception *ex = NULL;
05240 int r;
05241 r = SIGNDOC_Field_getRotation (&ex, p);
05242 if (ex != NULL) SignDoc_throw (ex);
05243 return r;
05244 }
05245
05261 void setRotation (int aRotation)
05262 {
05263 SIGNDOC_Exception *ex = NULL;
05264 SIGNDOC_Field_setRotation (&ex, p, aRotation);
05265 if (ex != NULL) SignDoc_throw (ex);
05266 }
05267
05283 bool getTextFieldAttributes (SignDocTextFieldAttributes &aOutput) const
05284 {
05285 SIGNDOC_Exception *ex = NULL;
05286 bool r;
05287 r = (bool)SIGNDOC_Field_getTextFieldAttributes (&ex, p, aOutput.getImpl ());
05288 if (ex != NULL) SignDoc_throw (ex);
05289 return r;
05290 }
05291
05330 bool setTextFieldAttributes (const SignDocTextFieldAttributes &aInput)
05331 {
05332 SIGNDOC_Exception *ex = NULL;
05333 bool r;
05334 r = (bool)SIGNDOC_Field_setTextFieldAttributes (&ex, p, aInput.getImpl ());
05335 if (ex != NULL) SignDoc_throw (ex);
05336 return r;
05337 }
05338
05351 SignDocColor *getBackgroundColor () const
05352 {
05353 SIGNDOC_Exception *ex = NULL;
05354 SIGNDOC_Color *r;
05355 r = SIGNDOC_Field_getBackgroundColor (&ex, p);
05356 if (ex != NULL) SignDoc_throw (ex);
05357 if (r == NULL)
05358 return NULL;
05359 try
05360 {
05361 return new SignDocColor (r);
05362 }
05363 catch (...)
05364 {
05365 SIGNDOC_Color_delete (r);
05366 throw;
05367 }
05368 }
05369
05382 void setBackgroundColor (const SignDocColor *aColor)
05383 {
05384 SIGNDOC_Exception *ex = NULL;
05385 SIGNDOC_Field_setBackgroundColor (&ex, p, aColor == NULL ? NULL : aColor->getImpl ());
05386 if (ex != NULL) SignDoc_throw (ex);
05387 }
05388
05402 SignDocColor *getBorderColor () const
05403 {
05404 SIGNDOC_Exception *ex = NULL;
05405 SIGNDOC_Color *r;
05406 r = SIGNDOC_Field_getBorderColor (&ex, p);
05407 if (ex != NULL) SignDoc_throw (ex);
05408 if (r == NULL)
05409 return NULL;
05410 try
05411 {
05412 return new SignDocColor (r);
05413 }
05414 catch (...)
05415 {
05416 SIGNDOC_Color_delete (r);
05417 throw;
05418 }
05419 }
05420
05440 void setBorderColor (const SignDocColor *aColor)
05441 {
05442 SIGNDOC_Exception *ex = NULL;
05443 SIGNDOC_Field_setBorderColor (&ex, p, aColor == NULL ? NULL : aColor->getImpl ());
05444 if (ex != NULL) SignDoc_throw (ex);
05445 }
05446
05456 double getBorderWidth () const
05457 {
05458 SIGNDOC_Exception *ex = NULL;
05459 double r;
05460 r = SIGNDOC_Field_getBorderWidth (&ex, p);
05461 if (ex != NULL) SignDoc_throw (ex);
05462 return r;
05463 }
05464
05476 void setBorderWidth (double aWidth)
05477 {
05478 SIGNDOC_Exception *ex = NULL;
05479 SIGNDOC_Field_setBorderWidth (&ex, p, aWidth);
05480 if (ex != NULL) SignDoc_throw (ex);
05481 }
05482
05492 BorderStyle getBorderStyle () const
05493 {
05494 SIGNDOC_Exception *ex = NULL;
05495 BorderStyle r;
05496 r = (BorderStyle)SIGNDOC_Field_getBorderStyle (&ex, p);
05497 if (ex != NULL) SignDoc_throw (ex);
05498 return r;
05499 }
05500
05514 void setBorderStyle (BorderStyle aStyle)
05515 {
05516 SIGNDOC_Exception *ex = NULL;
05517 SIGNDOC_Field_setBorderStyle (&ex, p, aStyle);
05518 if (ex != NULL) SignDoc_throw (ex);
05519 }
05520
05531 ButtonStyle getButtonStyle () const
05532 {
05533 SIGNDOC_Exception *ex = NULL;
05534 ButtonStyle r;
05535 r = (ButtonStyle)SIGNDOC_Field_getButtonStyle (&ex, p);
05536 if (ex != NULL) SignDoc_throw (ex);
05537 return r;
05538 }
05539
05553 void setButtonStyle (ButtonStyle aStyle)
05554 {
05555 SIGNDOC_Exception *ex = NULL;
05556 SIGNDOC_Field_setButtonStyle (&ex, p, aStyle);
05557 if (ex != NULL) SignDoc_throw (ex);
05558 }
05559
05570 LockType getLockType () const
05571 {
05572 SIGNDOC_Exception *ex = NULL;
05573 LockType r;
05574 r = (LockType)SIGNDOC_Field_getLockType (&ex, p);
05575 if (ex != NULL) SignDoc_throw (ex);
05576 return r;
05577 }
05578
05589 void setLockType (LockType aLockType)
05590 {
05591 SIGNDOC_Exception *ex = NULL;
05592 SIGNDOC_Field_setLockType (&ex, p, aLockType);
05593 if (ex != NULL) SignDoc_throw (ex);
05594 }
05595
05603 int getLockFieldCount () const
05604 {
05605 SIGNDOC_Exception *ex = NULL;
05606 int r;
05607 r = SIGNDOC_Field_getLockFieldCount (&ex, p);
05608 if (ex != NULL) SignDoc_throw (ex);
05609 return r;
05610 }
05611
05626 std::string getLockField (Encoding aEncoding, int aIndex) const
05627 {
05628 SIGNDOC_Exception *ex = NULL;
05629 std::string r;
05630 char *s = SIGNDOC_Field_getLockField (&ex, p, aEncoding, aIndex);
05631 if (ex != NULL) SignDoc_throw (ex);
05632 try
05633 {
05634 r = s;
05635 }
05636 catch (...)
05637 {
05638 SIGNDOC_free (s);
05639 throw;
05640 }
05641 SIGNDOC_free (s);
05642 return r;
05643 }
05644
05657 const char *getLockFieldUTF8 (int aIndex) const
05658 {
05659 SIGNDOC_Exception *ex = NULL;
05660 const char *r;
05661 r = SIGNDOC_Field_getLockFieldUTF8 (&ex, p, aIndex);
05662 if (ex != NULL) SignDoc_throw (ex);
05663 return r;
05664 }
05665
05673 void clearLockFields ()
05674 {
05675 SIGNDOC_Exception *ex = NULL;
05676 SIGNDOC_Field_clearLockFields (&ex, p);
05677 if (ex != NULL) SignDoc_throw (ex);
05678 }
05679
05692 void addLockField (Encoding aEncoding, const std::string &aName)
05693 {
05694 SIGNDOC_Exception *ex = NULL;
05695 SIGNDOC_Field_addLockField (&ex, p, aEncoding, aName.c_str ());
05696 if (ex != NULL) SignDoc_throw (ex);
05697 }
05698
05716 bool setLockField (int aIndex, Encoding aEncoding, const std::string &aName)
05717 {
05718 SIGNDOC_Exception *ex = NULL;
05719 bool r;
05720 r = (bool)SIGNDOC_Field_setLockFieldByIndex (&ex, p, aIndex, aEncoding, aName.c_str ());
05721 if (ex != NULL) SignDoc_throw (ex);
05722 return r;
05723 }
05724
05741 void setLockField (Encoding aEncoding, const std::string &aName)
05742 {
05743 SIGNDOC_Exception *ex = NULL;
05744 SIGNDOC_Field_setLockField (&ex, p, aEncoding, aName.c_str ());
05745 if (ex != NULL) SignDoc_throw (ex);
05746 }
05747
05757 bool removeLockField (int aIndex)
05758 {
05759 SIGNDOC_Exception *ex = NULL;
05760 bool r;
05761 r = (bool)SIGNDOC_Field_removeLockField (&ex, p, aIndex);
05762 if (ex != NULL) SignDoc_throw (ex);
05763 return r;
05764 }
05765
05780 int getLockMDP () const
05781 {
05782 SIGNDOC_Exception *ex = NULL;
05783 int r;
05784 r = SIGNDOC_Field_getLockMDP (&ex, p);
05785 if (ex != NULL) SignDoc_throw (ex);
05786 return r;
05787 }
05788
05803 void setLockMDP (int aMDP)
05804 {
05805 SIGNDOC_Exception *ex = NULL;
05806 SIGNDOC_Field_setLockMDP (&ex, p, aMDP);
05807 if (ex != NULL) SignDoc_throw (ex);
05808 }
05809
05820 unsigned getCertSeedValueFlags () const
05821 {
05822 SIGNDOC_Exception *ex = NULL;
05823 unsigned r;
05824 r = SIGNDOC_Field_getCertSeedValueFlags (&ex, p);
05825 if (ex != NULL) SignDoc_throw (ex);
05826 return r;
05827 }
05828
05840 void setCertSeedValueFlags (unsigned aFlags)
05841 {
05842 SIGNDOC_Exception *ex = NULL;
05843 SIGNDOC_Field_setCertSeedValueFlags (&ex, p, aFlags);
05844 if (ex != NULL) SignDoc_throw (ex);
05845 }
05846
05855 int getCertSeedValueSubjectDNCount () const
05856 {
05857 SIGNDOC_Exception *ex = NULL;
05858 int r;
05859 r = SIGNDOC_Field_getCertSeedValueSubjectDNCount (&ex, p);
05860 if (ex != NULL) SignDoc_throw (ex);
05861 return r;
05862 }
05863
05883 std::string getCertSeedValueSubjectDN (Encoding aEncoding, int aIndex) const
05884 {
05885 SIGNDOC_Exception *ex = NULL;
05886 std::string r;
05887 char *s = SIGNDOC_Field_getCertSeedValueSubjectDN (&ex, p, aEncoding, aIndex);
05888 if (ex != NULL) SignDoc_throw (ex);
05889 try
05890 {
05891 r = s;
05892 }
05893 catch (...)
05894 {
05895 SIGNDOC_free (s);
05896 throw;
05897 }
05898 SIGNDOC_free (s);
05899 return r;
05900 }
05901
05921 const char *getCertSeedValueSubjectDNUTF8 (int aIndex) const
05922 {
05923 SIGNDOC_Exception *ex = NULL;
05924 const char *r;
05925 r = SIGNDOC_Field_getCertSeedValueSubjectDNUTF8 (&ex, p, aIndex);
05926 if (ex != NULL) SignDoc_throw (ex);
05927 return r;
05928 }
05929
05940 void clearCertSeedValueSubjectDNs ()
05941 {
05942 SIGNDOC_Exception *ex = NULL;
05943 SIGNDOC_Field_clearCertSeedValueSubjectDNs (&ex, p);
05944 if (ex != NULL) SignDoc_throw (ex);
05945 }
05946
05967 bool addCertSeedValueSubjectDN (Encoding aEncoding, const std::string &aName)
05968 {
05969 SIGNDOC_Exception *ex = NULL;
05970 bool r;
05971 r = (bool)SIGNDOC_Field_addCertSeedValueSubjectDN (&ex, p, aEncoding, aName.c_str ());
05972 if (ex != NULL) SignDoc_throw (ex);
05973 return r;
05974 }
05975
06000 bool setCertSeedValueSubjectDN (int aIndex, Encoding aEncoding,
06001 const std::string &aName)
06002 {
06003 SIGNDOC_Exception *ex = NULL;
06004 bool r;
06005 r = (bool)SIGNDOC_Field_setCertSeedValueSubjectDNByIndex (&ex, p, aIndex, aEncoding, aName.c_str ());
06006 if (ex != NULL) SignDoc_throw (ex);
06007 return r;
06008 }
06009
06034 bool setCertSeedValueSubjectDN (Encoding aEncoding, const std::string &aName)
06035 {
06036 SIGNDOC_Exception *ex = NULL;
06037 bool r;
06038 r = (bool)SIGNDOC_Field_setCertSeedValueSubjectDN (&ex, p, aEncoding, aName.c_str ());
06039 if (ex != NULL) SignDoc_throw (ex);
06040 return r;
06041 }
06042
06055 bool removeCertSeedValueSubjectDN (int aIndex)
06056 {
06057 SIGNDOC_Exception *ex = NULL;
06058 bool r;
06059 r = (bool)SIGNDOC_Field_removeCertSeedValueSubjectDN (&ex, p, aIndex);
06060 if (ex != NULL) SignDoc_throw (ex);
06061 return r;
06062 }
06063
06074 int getCertSeedValueSubjectCertificateCount () const
06075 {
06076 SIGNDOC_Exception *ex = NULL;
06077 int r;
06078 r = SIGNDOC_Field_getCertSeedValueSubjectCertificateCount (&ex, p);
06079 if (ex != NULL) SignDoc_throw (ex);
06080 return r;
06081 }
06082
06095 bool getCertSeedValueSubjectCertificate (int aIndex,
06096 std::vector<unsigned char> &aOutput) const
06097 {
06098 SIGNDOC_Exception *ex = NULL;
06099 SIGNDOC_ByteArray *tempOutput = NULL;
06100 bool r;
06101 try
06102 {
06103 tempOutput = SIGNDOC_ByteArray_new (&ex);
06104 if (ex != NULL) SignDoc_throw (ex);
06105 r = (bool)SIGNDOC_Field_getCertSeedValueSubjectCertificate (&ex, p, aIndex, tempOutput);
06106 assignArray (aOutput, tempOutput);
06107 }
06108 catch (...)
06109 {
06110 if (tempOutput != NULL)
06111 SIGNDOC_ByteArray_delete (tempOutput);
06112 throw;
06113 }
06114 if (tempOutput != NULL)
06115 SIGNDOC_ByteArray_delete (tempOutput);
06116 if (ex != NULL) SignDoc_throw (ex);
06117 return r;
06118 }
06119
06129 void clearCertSeedValueSubjectCertificates ()
06130 {
06131 SIGNDOC_Exception *ex = NULL;
06132 SIGNDOC_Field_clearCertSeedValueSubjectCertificates (&ex, p);
06133 if (ex != NULL) SignDoc_throw (ex);
06134 }
06135
06147 void addCertSeedValueSubjectCertificate (const void *aPtr, size_t aSize)
06148 {
06149 SIGNDOC_Exception *ex = NULL;
06150 SIGNDOC_Field_addCertSeedValueSubjectCertificate (&ex, p, aPtr, aSize);
06151 if (ex != NULL) SignDoc_throw (ex);
06152 }
06153
06170 bool setCertSeedValueSubjectCertificate (int aIndex, const void *aPtr,
06171 size_t aSize)
06172 {
06173 SIGNDOC_Exception *ex = NULL;
06174 bool r;
06175 r = (bool)SIGNDOC_Field_setCertSeedValueSubjectCertificateByIndex (&ex, p, aIndex, aPtr, aSize);
06176 if (ex != NULL) SignDoc_throw (ex);
06177 return r;
06178 }
06179
06194 void setCertSeedValueSubjectCertificate (const void *aPtr, size_t aSize)
06195 {
06196 SIGNDOC_Exception *ex = NULL;
06197 SIGNDOC_Field_setCertSeedValueSubjectCertificate (&ex, p, aPtr, aSize);
06198 if (ex != NULL) SignDoc_throw (ex);
06199 }
06200
06214 bool removeCertSeedValueSubjectCertificate (int aIndex)
06215 {
06216 SIGNDOC_Exception *ex = NULL;
06217 bool r;
06218 r = (bool)SIGNDOC_Field_removeCertSeedValueSubjectCertificate (&ex, p, aIndex);
06219 if (ex != NULL) SignDoc_throw (ex);
06220 return r;
06221 }
06222
06233 int getCertSeedValueIssuerCertificateCount () const
06234 {
06235 SIGNDOC_Exception *ex = NULL;
06236 int r;
06237 r = SIGNDOC_Field_getCertSeedValueIssuerCertificateCount (&ex, p);
06238 if (ex != NULL) SignDoc_throw (ex);
06239 return r;
06240 }
06241
06254 bool getCertSeedValueIssuerCertificate (int aIndex,
06255 std::vector<unsigned char> &aOutput) const
06256 {
06257 SIGNDOC_Exception *ex = NULL;
06258 SIGNDOC_ByteArray *tempOutput = NULL;
06259 bool r;
06260 try
06261 {
06262 tempOutput = SIGNDOC_ByteArray_new (&ex);
06263 if (ex != NULL) SignDoc_throw (ex);
06264 r = (bool)SIGNDOC_Field_getCertSeedValueIssuerCertificate (&ex, p, aIndex, tempOutput);
06265 assignArray (aOutput, tempOutput);
06266 }
06267 catch (...)
06268 {
06269 if (tempOutput != NULL)
06270 SIGNDOC_ByteArray_delete (tempOutput);
06271 throw;
06272 }
06273 if (tempOutput != NULL)
06274 SIGNDOC_ByteArray_delete (tempOutput);
06275 if (ex != NULL) SignDoc_throw (ex);
06276 return r;
06277 }
06278
06288 void clearCertSeedValueIssuerCertificates ()
06289 {
06290 SIGNDOC_Exception *ex = NULL;
06291 SIGNDOC_Field_clearCertSeedValueIssuerCertificates (&ex, p);
06292 if (ex != NULL) SignDoc_throw (ex);
06293 }
06294
06306 void addCertSeedValueIssuerCertificate (const void *aPtr, size_t aSize)
06307 {
06308 SIGNDOC_Exception *ex = NULL;
06309 SIGNDOC_Field_addCertSeedValueIssuerCertificate (&ex, p, aPtr, aSize);
06310 if (ex != NULL) SignDoc_throw (ex);
06311 }
06312
06329 bool setCertSeedValueIssuerCertificate (int aIndex, const void *aPtr,
06330 size_t aSize)
06331 {
06332 SIGNDOC_Exception *ex = NULL;
06333 bool r;
06334 r = (bool)SIGNDOC_Field_setCertSeedValueIssuerCertificateByIndex (&ex, p, aIndex, aPtr, aSize);
06335 if (ex != NULL) SignDoc_throw (ex);
06336 return r;
06337 }
06338
06353 void setCertSeedValueIssuerCertificate (const void *aPtr, size_t aSize)
06354 {
06355 SIGNDOC_Exception *ex = NULL;
06356 SIGNDOC_Field_setCertSeedValueIssuerCertificate (&ex, p, aPtr, aSize);
06357 if (ex != NULL) SignDoc_throw (ex);
06358 }
06359
06373 bool removeCertSeedValueIssuerCertificate (int aIndex)
06374 {
06375 SIGNDOC_Exception *ex = NULL;
06376 bool r;
06377 r = (bool)SIGNDOC_Field_removeCertSeedValueIssuerCertificate (&ex, p, aIndex);
06378 if (ex != NULL) SignDoc_throw (ex);
06379 return r;
06380 }
06381
06391 int getCertSeedValuePolicyCount () const
06392 {
06393 SIGNDOC_Exception *ex = NULL;
06394 int r;
06395 r = SIGNDOC_Field_getCertSeedValuePolicyCount (&ex, p);
06396 if (ex != NULL) SignDoc_throw (ex);
06397 return r;
06398 }
06399
06418 std::string getCertSeedValuePolicy (Encoding aEncoding, int aIndex) const
06419 {
06420 SIGNDOC_Exception *ex = NULL;
06421 std::string r;
06422 char *s = SIGNDOC_Field_getCertSeedValuePolicy (&ex, p, aEncoding, aIndex);
06423 if (ex != NULL) SignDoc_throw (ex);
06424 try
06425 {
06426 r = s;
06427 }
06428 catch (...)
06429 {
06430 SIGNDOC_free (s);
06431 throw;
06432 }
06433 SIGNDOC_free (s);
06434 return r;
06435 }
06436
06454 const char *getCertSeedValuePolicyUTF8 (int aIndex) const
06455 {
06456 SIGNDOC_Exception *ex = NULL;
06457 const char *r;
06458 r = SIGNDOC_Field_getCertSeedValuePolicyUTF8 (&ex, p, aIndex);
06459 if (ex != NULL) SignDoc_throw (ex);
06460 return r;
06461 }
06462
06472 void clearCertSeedValuePolicies ()
06473 {
06474 SIGNDOC_Exception *ex = NULL;
06475 SIGNDOC_Field_clearCertSeedValuePolicies (&ex, p);
06476 if (ex != NULL) SignDoc_throw (ex);
06477 }
06478
06495 void addCertSeedValuePolicy (Encoding aEncoding, const std::string &aOID)
06496 {
06497 SIGNDOC_Exception *ex = NULL;
06498 SIGNDOC_Field_addCertSeedValuePolicy (&ex, p, aEncoding, aOID.c_str ());
06499 if (ex != NULL) SignDoc_throw (ex);
06500 }
06501
06523 bool setCertSeedValuePolicy (int aIndex, Encoding aEncoding,
06524 const std::string &aOID)
06525 {
06526 SIGNDOC_Exception *ex = NULL;
06527 bool r;
06528 r = (bool)SIGNDOC_Field_setCertSeedValuePolicyByIndex (&ex, p, aIndex, aEncoding, aOID.c_str ());
06529 if (ex != NULL) SignDoc_throw (ex);
06530 return r;
06531 }
06532
06553 void setCertSeedValuePolicy (Encoding aEncoding, const std::string &aOID)
06554 {
06555 SIGNDOC_Exception *ex = NULL;
06556 SIGNDOC_Field_setCertSeedValuePolicy (&ex, p, aEncoding, aOID.c_str ());
06557 if (ex != NULL) SignDoc_throw (ex);
06558 }
06559
06571 bool removeCertSeedValuePolicy (int aIndex)
06572 {
06573 SIGNDOC_Exception *ex = NULL;
06574 bool r;
06575 r = (bool)SIGNDOC_Field_removeCertSeedValuePolicy (&ex, p, aIndex);
06576 if (ex != NULL) SignDoc_throw (ex);
06577 return r;
06578 }
06579
06596 std::string getSeedValueTimeStampServerURL (Encoding aEncoding) const
06597 {
06598 SIGNDOC_Exception *ex = NULL;
06599 std::string r;
06600 char *s = SIGNDOC_Field_getSeedValueTimeStampServerURL (&ex, p, aEncoding);
06601 if (ex != NULL) SignDoc_throw (ex);
06602 try
06603 {
06604 r = s;
06605 }
06606 catch (...)
06607 {
06608 SIGNDOC_free (s);
06609 throw;
06610 }
06611 SIGNDOC_free (s);
06612 return r;
06613 }
06614
06629 bool getSeedValueTimeStampRequired () const
06630 {
06631 SIGNDOC_Exception *ex = NULL;
06632 bool r;
06633 r = (bool)SIGNDOC_Field_getSeedValueTimeStampRequired (&ex, p);
06634 if (ex != NULL) SignDoc_throw (ex);
06635 return r;
06636 }
06637
06659 bool setSeedValueTimeStamp (Encoding aEncoding, const std::string &aURL,
06660 bool aRequired)
06661 {
06662 SIGNDOC_Exception *ex = NULL;
06663 bool r;
06664 r = (bool)SIGNDOC_Field_setSeedValueTimeStamp (&ex, p, aEncoding, aURL.c_str (), aRequired);
06665 if (ex != NULL) SignDoc_throw (ex);
06666 return r;
06667 }
06668
06686 std::string getSeedValueFilter (Encoding aEncoding) const
06687 {
06688 SIGNDOC_Exception *ex = NULL;
06689 std::string r;
06690 char *s = SIGNDOC_Field_getSeedValueFilter (&ex, p, aEncoding);
06691 if (ex != NULL) SignDoc_throw (ex);
06692 try
06693 {
06694 r = s;
06695 }
06696 catch (...)
06697 {
06698 SIGNDOC_free (s);
06699 throw;
06700 }
06701 SIGNDOC_free (s);
06702 return r;
06703 }
06704
06720 bool getSeedValueFilterRequired () const
06721 {
06722 SIGNDOC_Exception *ex = NULL;
06723 bool r;
06724 r = (bool)SIGNDOC_Field_getSeedValueFilterRequired (&ex, p);
06725 if (ex != NULL) SignDoc_throw (ex);
06726 return r;
06727 }
06728
06751 bool setSeedValueFilter (Encoding aEncoding, const std::string &aFilter,
06752 bool aRequired)
06753 {
06754 SIGNDOC_Exception *ex = NULL;
06755 bool r;
06756 r = (bool)SIGNDOC_Field_setSeedValueFilter (&ex, p, aEncoding, aFilter.c_str (), aRequired);
06757 if (ex != NULL) SignDoc_throw (ex);
06758 return r;
06759 }
06760
06770 int getSeedValueSubFilterCount () const
06771 {
06772 SIGNDOC_Exception *ex = NULL;
06773 int r;
06774 r = SIGNDOC_Field_getSeedValueSubFilterCount (&ex, p);
06775 if (ex != NULL) SignDoc_throw (ex);
06776 return r;
06777 }
06778
06802 std::string getSeedValueSubFilter (Encoding aEncoding, int aIndex) const
06803 {
06804 SIGNDOC_Exception *ex = NULL;
06805 std::string r;
06806 char *s = SIGNDOC_Field_getSeedValueSubFilter (&ex, p, aEncoding, aIndex);
06807 if (ex != NULL) SignDoc_throw (ex);
06808 try
06809 {
06810 r = s;
06811 }
06812 catch (...)
06813 {
06814 SIGNDOC_free (s);
06815 throw;
06816 }
06817 SIGNDOC_free (s);
06818 return r;
06819 }
06820
06835 bool getSeedValueSubFilterRequired () const
06836 {
06837 SIGNDOC_Exception *ex = NULL;
06838 bool r;
06839 r = (bool)SIGNDOC_Field_getSeedValueSubFilterRequired (&ex, p);
06840 if (ex != NULL) SignDoc_throw (ex);
06841 return r;
06842 }
06843
06857 void setSeedValueSubFilterRequired (bool aRequired) const
06858 {
06859 SIGNDOC_Exception *ex = NULL;
06860 SIGNDOC_Field_setSeedValueSubFilterRequired (&ex, p, aRequired);
06861 if (ex != NULL) SignDoc_throw (ex);
06862 }
06863
06879 const char *getSeedValueSubFilterUTF8 (int aIndex) const
06880 {
06881 SIGNDOC_Exception *ex = NULL;
06882 const char *r;
06883 r = SIGNDOC_Field_getSeedValueSubFilterUTF8 (&ex, p, aIndex);
06884 if (ex != NULL) SignDoc_throw (ex);
06885 return r;
06886 }
06887
06897 void clearSeedValueSubFilters ()
06898 {
06899 SIGNDOC_Exception *ex = NULL;
06900 SIGNDOC_Field_clearSeedValueSubFilters (&ex, p);
06901 if (ex != NULL) SignDoc_throw (ex);
06902 }
06903
06918 void addSeedValueSubFilter (Encoding aEncoding,
06919 const std::string &aSubFilter)
06920 {
06921 SIGNDOC_Exception *ex = NULL;
06922 SIGNDOC_Field_addSeedValueSubFilter (&ex, p, aEncoding, aSubFilter.c_str ());
06923 if (ex != NULL) SignDoc_throw (ex);
06924 }
06925
06945 bool setSeedValueSubFilter (int aIndex, Encoding aEncoding,
06946 const std::string &aSubFilter)
06947 {
06948 SIGNDOC_Exception *ex = NULL;
06949 bool r;
06950 r = (bool)SIGNDOC_Field_setSeedValueSubFilterByIndex (&ex, p, aIndex, aEncoding, aSubFilter.c_str ());
06951 if (ex != NULL) SignDoc_throw (ex);
06952 return r;
06953 }
06954
06974 void setSeedValueSubFilter (Encoding aEncoding,
06975 const std::string &aSubFilter)
06976 {
06977 SIGNDOC_Exception *ex = NULL;
06978 SIGNDOC_Field_setSeedValueSubFilter (&ex, p, aEncoding, aSubFilter.c_str ());
06979 if (ex != NULL) SignDoc_throw (ex);
06980 }
06981
06994 bool removeSeedValueSubFilter (int aIndex)
06995 {
06996 SIGNDOC_Exception *ex = NULL;
06997 bool r;
06998 r = (bool)SIGNDOC_Field_removeSeedValueSubFilter (&ex, p, aIndex);
06999 if (ex != NULL) SignDoc_throw (ex);
07000 return r;
07001 }
07002
07012 int getSeedValueDigestMethodCount () const
07013 {
07014 SIGNDOC_Exception *ex = NULL;
07015 int r;
07016 r = SIGNDOC_Field_getSeedValueDigestMethodCount (&ex, p);
07017 if (ex != NULL) SignDoc_throw (ex);
07018 return r;
07019 }
07020
07052 std::string getSeedValueDigestMethod (Encoding aEncoding, int aIndex) const
07053 {
07054 SIGNDOC_Exception *ex = NULL;
07055 std::string r;
07056 char *s = SIGNDOC_Field_getSeedValueDigestMethod (&ex, p, aEncoding, aIndex);
07057 if (ex != NULL) SignDoc_throw (ex);
07058 try
07059 {
07060 r = s;
07061 }
07062 catch (...)
07063 {
07064 SIGNDOC_free (s);
07065 throw;
07066 }
07067 SIGNDOC_free (s);
07068 return r;
07069 }
07070
07085 bool getSeedValueDigestMethodRequired () const
07086 {
07087 SIGNDOC_Exception *ex = NULL;
07088 bool r;
07089 r = (bool)SIGNDOC_Field_getSeedValueDigestMethodRequired (&ex, p);
07090 if (ex != NULL) SignDoc_throw (ex);
07091 return r;
07092 }
07093
07107 void setSeedValueDigestMethodRequired (bool aRequired) const
07108 {
07109 SIGNDOC_Exception *ex = NULL;
07110 SIGNDOC_Field_setSeedValueDigestMethodRequired (&ex, p, aRequired);
07111 if (ex != NULL) SignDoc_throw (ex);
07112 }
07113
07129 const char *getSeedValueDigestMethodUTF8 (int aIndex) const
07130 {
07131 SIGNDOC_Exception *ex = NULL;
07132 const char *r;
07133 r = SIGNDOC_Field_getSeedValueDigestMethodUTF8 (&ex, p, aIndex);
07134 if (ex != NULL) SignDoc_throw (ex);
07135 return r;
07136 }
07137
07147 void clearSeedValueDigestMethods ()
07148 {
07149 SIGNDOC_Exception *ex = NULL;
07150 SIGNDOC_Field_clearSeedValueDigestMethods (&ex, p);
07151 if (ex != NULL) SignDoc_throw (ex);
07152 }
07153
07168 void addSeedValueDigestMethod (Encoding aEncoding,
07169 const std::string &aDigestMethod)
07170 {
07171 SIGNDOC_Exception *ex = NULL;
07172 SIGNDOC_Field_addSeedValueDigestMethod (&ex, p, aEncoding, aDigestMethod.c_str ());
07173 if (ex != NULL) SignDoc_throw (ex);
07174 }
07175
07195 bool setSeedValueDigestMethod (int aIndex, Encoding aEncoding,
07196 const std::string &aDigestMethod)
07197 {
07198 SIGNDOC_Exception *ex = NULL;
07199 bool r;
07200 r = (bool)SIGNDOC_Field_setSeedValueDigestMethodByIndex (&ex, p, aIndex, aEncoding, aDigestMethod.c_str ());
07201 if (ex != NULL) SignDoc_throw (ex);
07202 return r;
07203 }
07204
07224 void setSeedValueDigestMethod (Encoding aEncoding,
07225 const std::string &aDigestMethod)
07226 {
07227 SIGNDOC_Exception *ex = NULL;
07228 SIGNDOC_Field_setSeedValueDigestMethod (&ex, p, aEncoding, aDigestMethod.c_str ());
07229 if (ex != NULL) SignDoc_throw (ex);
07230 }
07231
07244 bool removeSeedValueDigestMethod (int aIndex)
07245 {
07246 SIGNDOC_Exception *ex = NULL;
07247 bool r;
07248 r = (bool)SIGNDOC_Field_removeSeedValueDigestMethod (&ex, p, aIndex);
07249 if (ex != NULL) SignDoc_throw (ex);
07250 return r;
07251 }
07252
07266 bool getSeedValueAddRevInfo () const
07267 {
07268 SIGNDOC_Exception *ex = NULL;
07269 bool r;
07270 r = (bool)SIGNDOC_Field_getSeedValueAddRevInfo (&ex, p);
07271 if (ex != NULL) SignDoc_throw (ex);
07272 return r;
07273 }
07274
07290 void setSeedValueAddRevInfo (bool aAddRevInfo)
07291 {
07292 SIGNDOC_Exception *ex = NULL;
07293 SIGNDOC_Field_setSeedValueAddRevInfo (&ex, p, aAddRevInfo);
07294 if (ex != NULL) SignDoc_throw (ex);
07295 }
07296
07314 int getSeedValueMDP () const
07315 {
07316 SIGNDOC_Exception *ex = NULL;
07317 int r;
07318 r = SIGNDOC_Field_getSeedValueMDP (&ex, p);
07319 if (ex != NULL) SignDoc_throw (ex);
07320 return r;
07321 }
07322
07345 bool setSeedValueMDP (int aMDP)
07346 {
07347 SIGNDOC_Exception *ex = NULL;
07348 bool r;
07349 r = (bool)SIGNDOC_Field_setSeedValueMDP (&ex, p, aMDP);
07350 if (ex != NULL) SignDoc_throw (ex);
07351 return r;
07352 }
07353
07366 SignDocColor *getEmptyFieldColor () const
07367 {
07368 SIGNDOC_Exception *ex = NULL;
07369 SIGNDOC_Color *r;
07370 r = SIGNDOC_Field_getEmptyFieldColor (&ex, p);
07371 if (ex != NULL) SignDoc_throw (ex);
07372 if (r == NULL)
07373 return NULL;
07374 try
07375 {
07376 return new SignDocColor (r);
07377 }
07378 catch (...)
07379 {
07380 SIGNDOC_Color_delete (r);
07381 throw;
07382 }
07383 }
07384
07396 void setEmptyFieldColor (const SignDocColor &aColor)
07397 {
07398 SIGNDOC_Exception *ex = NULL;
07399 SIGNDOC_Field_setEmptyFieldColor (&ex, p, aColor.getImpl ());
07400 if (ex != NULL) SignDoc_throw (ex);
07401 }
07402
07403 private:
07404 public:
07409 SignDocField (SIGNDOC_Field *aP) : p (aP) { }
07410
07415 SIGNDOC_Field *getImpl () { return p; }
07416
07421 const SIGNDOC_Field *getImpl () const { return p; }
07422
07427 void setImpl (SIGNDOC_Field *aP) { SIGNDOC_Field_delete (p); p = aP; }
07428
07429 private:
07430 SIGNDOC_Field *p;
07431 };
07432
07437 inline void assignArray (std::vector<SignDocField> &aDst,
07438 SIGNDOC_FieldArray *aSrc)
07439 {
07440 aDst.clear ();
07441 unsigned n = SIGNDOC_FieldArray_count (aSrc);
07442 if (aSrc == NULL)
07443 return;
07444 aDst.resize (n);
07445 for (unsigned i = 0; i < n; ++i)
07446 {
07447 SIGNDOC_Exception *ex = NULL;
07448 SIGNDOC_Field *p = SIGNDOC_Field_clone (&ex, SIGNDOC_FieldArray_at (aSrc, i));
07449 if (ex != NULL) SignDoc_throw (ex);
07450 aDst[i].setImpl (p);
07451 }
07452 }
07453
07894 class SignDocSignatureParameters
07895 {
07896 public:
07905 enum Method
07906 {
07921 m_default,
07922
07928 m_digsig_pkcs1,
07929
07933 m_digsig_pkcs7_detached,
07934
07935
07936
07937
07938 m_digsig_pkcs7_sha1,
07939
07940
07941
07942
07943 m_hash,
07944
07945
07946
07947
07948 m_digsig_cades_detached,
07949
07950
07951
07952
07953 m_digsig_cades_rfc3161
07954 };
07955
07972 enum DetachedHashAlgorithm
07973 {
07985 dha_default,
07986
07987 dha_sha1,
07988 dha_sha256,
07989 dha_sha384,
07990 dha_sha512,
07991 dha_ripemd160,
07992 dha_sha224
07993 };
07994
08000 enum AddCertificates
08001 {
08010 ac_all,
08011
08019 ac_none,
08020
08029 ac_trusted
08030 };
08031
08037 enum AddRevocationInfo
08038 {
08047 ari_add = 0x01
08048 };
08049
08055 enum RemoveXFA
08056 {
08064 rx_always,
08065
08073 rx_if_allowed,
08074
08081 rx_never
08082 };
08083
08094 enum TimeStampHashAlgorithm
08095 {
08112 tsha_default,
08113
08114 tsha_sha1,
08115 tsha_sha256,
08116 tsha_sha384,
08117 tsha_sha512
08118 };
08119
08127 enum Optimize
08128 {
08129 o_optimize,
08130 o_dont_optimize
08131 };
08132
08146 enum PDFAButtons
08147 {
08159 pb_freeze,
08160
08168 pb_dont_freeze,
08169
08184 pb_auto
08185 };
08186
08194 enum CertificateSigningAlgorithm
08195 {
08196 csa_sha1_rsa,
08197 csa_md5_rsa,
08198 csa_sha256_rsa,
08199 csa_sha384_rsa,
08200 csa_sha512_rsa,
08201 csa_ripemd160_rsa,
08202 csa_ecdsa_sha1,
08203 csa_ecdsa_sha224,
08204 csa_ecdsa_sha256,
08205 csa_ecdsa_sha384,
08206 csa_ecdsa_sha512
08207 };
08208
08214 enum RSASignatureScheme
08215 {
08223 rss_pkcs1,
08224
08238 rss_pss
08239 };
08240
08250 enum BiometricEncryption
08251 {
08260 be_rsa,
08261
08265 be_fixed,
08266
08272 be_binary,
08273
08279 be_passphrase,
08280
08290 be_dont_store
08291 };
08292
08301 enum BiometricHashLocation
08302 {
08314 bhl_attr,
08315
08323 bhl_contents
08324 };
08325
08332 enum HAlignment
08333 {
08337 ha_left,
08338
08342 ha_center,
08343
08347 ha_right,
08348
08355 ha_justify,
08356
08361 ha_auto,
08362
08366 ha_default = -1
08367 };
08368
08375 enum VAlignment
08376 {
08380 va_top,
08381
08385 va_center,
08386
08390 va_bottom
08391 };
08392
08398 enum TextPosition
08399 {
08400 tp_overlay,
08401 tp_below,
08402 tp_underlay,
08403 tp_right_of,
08404 tp_above,
08405 tp_left_of
08406 };
08407
08413 enum ValueType
08414 {
08415 vt_abs,
08416 vt_field_height,
08417 vt_field_width
08418 };
08419
08425 enum TextItem
08426 {
08427 ti_signer,
08428 ti_sign_time,
08429 ti_comment,
08430 ti_adviser,
08431 ti_contact_info,
08432 ti_location,
08433 ti_reason,
08434 ti_text1,
08435 ti_text2,
08436 ti_text3,
08437 ti_text4,
08438 ti_text5,
08439 ti_text6,
08440 ti_text7,
08441 ti_text8,
08442 ti_text9
08443 };
08444
08460 enum TextGroup
08461 {
08462 tg_master,
08463 tg_slave
08464 };
08465
08469 enum TextItemDirection
08470 {
08474 tid_ltr = 0x1000,
08475
08479 tid_rtl = 0x2000,
08480
08491 tid_default_ltr = 0x4000,
08492
08503 tid_default_rtl = 0x8000
08504 };
08505
08516 enum IgnoreSeedValues
08517 {
08531 isv_SubFilter = 0x01,
08532
08547 isv_DigestMethod = 0x02
08548 };
08549
08557 enum CertificateSelectionFlags
08558 {
08569 csf_software = 0x01,
08570
08581 csf_hardware = 0x02,
08582
08583 csf_use_certificate_seed_values = 0x10,
08584 csf_ask_if_ambiguous = 0x20,
08585 csf_never_ask = 0x40,
08586 csf_create_self_signed = 0x80
08587 };
08588
08598 enum RenderSignatureFlags
08599 {
08603 rsf_bw = 0x01,
08604
08608 rsf_gray = 0x02,
08609
08613 rsf_antialias = 0x04,
08614
08627 rsf_limit_size = 0x08
08628 };
08629
08646 enum ImageTransparency
08647 {
08653 it_opaque,
08654
08663 it_brightest
08664 };
08665
08669 enum ReturnCode
08670 {
08671 rc_ok,
08672 rc_unknown,
08673 rc_not_supported,
08674 rc_invalid_value
08675 };
08676
08685 enum ParameterState
08686 {
08687 ps_set,
08688 ps_missing,
08689 ps_supported,
08690 ps_ignored,
08691 ps_not_supported,
08692 ps_unknown
08693 };
08694
08695 public:
08702 SignDocSignatureParameters ()
08703 : p (NULL)
08704 {
08705 }
08706
08713 ~SignDocSignatureParameters ()
08714 {
08715 SIGNDOC_SignatureParameters_delete (p);
08716 }
08717
08725 ParameterState getState (const std::string &aName)
08726 {
08727 SIGNDOC_Exception *ex = NULL;
08728 ParameterState r;
08729 r = (ParameterState)SIGNDOC_SignatureParameters_getState (&ex, p, aName.c_str ());
08730 if (ex != NULL) SignDoc_throw (ex);
08731 return r;
08732 }
08733
09049 ReturnCode setString (Encoding aEncoding, const std::string &aName,
09050 const std::string &aValue)
09051 {
09052 SIGNDOC_Exception *ex = NULL;
09053 ReturnCode r;
09054 r = (ReturnCode)SIGNDOC_SignatureParameters_setString (&ex, p, aEncoding, aName.c_str (), aValue.c_str ());
09055 if (ex != NULL) SignDoc_throw (ex);
09056 return r;
09057 }
09058
09070 ReturnCode setString (const std::string &aName, const wchar_t *aValue)
09071 {
09072 SIGNDOC_Exception *ex = NULL;
09073 ReturnCode r;
09074 r = (ReturnCode)SIGNDOC_SignatureParameters_setStringW (&ex, p, aName.c_str (), aValue);
09075 if (ex != NULL) SignDoc_throw (ex);
09076 return r;
09077 }
09078
09402 ReturnCode setInteger (const std::string &aName, int aValue)
09403 {
09404 SIGNDOC_Exception *ex = NULL;
09405 ReturnCode r;
09406 r = (ReturnCode)SIGNDOC_SignatureParameters_setInteger (&ex, p, aName.c_str (), aValue);
09407 if (ex != NULL) SignDoc_throw (ex);
09408 return r;
09409 }
09410
09544 ReturnCode setBlob (const std::string &aName, const unsigned char *aData,
09545 size_t aSize)
09546 {
09547 SIGNDOC_Exception *ex = NULL;
09548 ReturnCode r;
09549 r = (ReturnCode)SIGNDOC_SignatureParameters_setBlob (&ex, p, aName.c_str (), aData, aSize);
09550 if (ex != NULL) SignDoc_throw (ex);
09551 return r;
09552 }
09553
09610 ReturnCode setLength (const std::string &aName, ValueType aType,
09611 double aValue)
09612 {
09613 SIGNDOC_Exception *ex = NULL;
09614 ReturnCode r;
09615 r = (ReturnCode)SIGNDOC_SignatureParameters_setLength (&ex, p, aName.c_str (), aType, aValue);
09616 if (ex != NULL) SignDoc_throw (ex);
09617 return r;
09618 }
09619
09644 ReturnCode setColor (const std::string &aName, const SignDocColor &aValue)
09645 {
09646 SIGNDOC_Exception *ex = NULL;
09647 ReturnCode r;
09648 r = (ReturnCode)SIGNDOC_SignatureParameters_setColor (&ex, p, aName.c_str (), aValue.getImpl ());
09649 if (ex != NULL) SignDoc_throw (ex);
09650 return r;
09651 }
09652
09677 ReturnCode addTextItem (TextItem aItem, TextGroup aGroup)
09678 {
09679 SIGNDOC_Exception *ex = NULL;
09680 ReturnCode r;
09681 r = (ReturnCode)SIGNDOC_SignatureParameters_addTextItem (&ex, p, aItem, aGroup);
09682 if (ex != NULL) SignDoc_throw (ex);
09683 return r;
09684 }
09685
09716 ReturnCode addTextItem2 (TextItem aItem, TextGroup aGroup,
09717 HAlignment aHAlignment, int aDirection)
09718 {
09719 SIGNDOC_Exception *ex = NULL;
09720 ReturnCode r;
09721 r = (ReturnCode)SIGNDOC_SignatureParameters_addTextItem2 (&ex, p, aItem, aGroup, aHAlignment, aDirection);
09722 if (ex != NULL) SignDoc_throw (ex);
09723 return r;
09724 }
09725
09738 ReturnCode clearTextItems ()
09739 {
09740 SIGNDOC_Exception *ex = NULL;
09741 ReturnCode r;
09742 r = (ReturnCode)SIGNDOC_SignatureParameters_clearTextItems (&ex, p);
09743 if (ex != NULL) SignDoc_throw (ex);
09744 return r;
09745 }
09746
09767 ReturnCode setTextItemDirection (TextItem aItem, HAlignment aHAlignment,
09768 int aDirection)
09769 {
09770 SIGNDOC_Exception *ex = NULL;
09771 ReturnCode r;
09772 r = (ReturnCode)SIGNDOC_SignatureParameters_setTextItemDirection (&ex, p, aItem, aHAlignment, aDirection);
09773 if (ex != NULL) SignDoc_throw (ex);
09774 return r;
09775 }
09776
09819 ReturnCode setPKCS7 (SignPKCS7 *aPKCS7)
09820 {
09821 SIGNDOC_Exception *ex = NULL;
09822 ReturnCode r;
09823 r = (ReturnCode)SIGNDOC_SignatureParameters_setPKCS7 (&ex, p, aPKCS7 == NULL ? NULL : aPKCS7->getImpl ());
09824 if (ex != NULL) SignDoc_throw (ex);
09825 return r;
09826 }
09827
09857 ReturnCode setRSA (SignRSA *aRSA)
09858 {
09859 SIGNDOC_Exception *ex = NULL;
09860 ReturnCode r;
09861 r = (ReturnCode)SIGNDOC_SignatureParameters_setRSA (&ex, p, aRSA == NULL ? NULL : aRSA->getImpl ());
09862 if (ex != NULL) SignDoc_throw (ex);
09863 return r;
09864 }
09865
09895 ReturnCode setECDSA (SignECDSA *aECDSA)
09896 {
09897 SIGNDOC_Exception *ex = NULL;
09898 ReturnCode r;
09899 r = (ReturnCode)SIGNDOC_SignatureParameters_setECDSA (&ex, p, aECDSA == NULL ? NULL : aECDSA->getImpl ());
09900 if (ex != NULL) SignDoc_throw (ex);
09901 return r;
09902 }
09903
09912 int getAvailableMethods ()
09913 {
09914 SIGNDOC_Exception *ex = NULL;
09915 int r;
09916 r = SIGNDOC_SignatureParameters_getAvailableMethods (&ex, p);
09917 if (ex != NULL) SignDoc_throw (ex);
09918 return r;
09919 }
09920
09933 ReturnCode getTemplate (std::vector<unsigned char> &aOutput)
09934 {
09935 SIGNDOC_Exception *ex = NULL;
09936 SIGNDOC_ByteArray *tempOutput = NULL;
09937 ReturnCode r;
09938 try
09939 {
09940 tempOutput = SIGNDOC_ByteArray_new (&ex);
09941 if (ex != NULL) SignDoc_throw (ex);
09942 r = (ReturnCode)SIGNDOC_SignatureParameters_getTemplate (&ex, p, tempOutput);
09943 assignArray (aOutput, tempOutput);
09944 }
09945 catch (...)
09946 {
09947 if (tempOutput != NULL)
09948 SIGNDOC_ByteArray_delete (tempOutput);
09949 throw;
09950 }
09951 if (tempOutput != NULL)
09952 SIGNDOC_ByteArray_delete (tempOutput);
09953 if (ex != NULL) SignDoc_throw (ex);
09954 return r;
09955 }
09956
09970 const char *getErrorMessage (Encoding aEncoding) const
09971 {
09972 SIGNDOC_Exception *ex = NULL;
09973 const char *r;
09974 r = SIGNDOC_SignatureParameters_getErrorMessage (&ex, p, aEncoding);
09975 if (ex != NULL) SignDoc_throw (ex);
09976 return r;
09977 }
09978
09990 const wchar_t *getErrorMessageW () const
09991 {
09992 SIGNDOC_Exception *ex = NULL;
09993 const wchar_t *r;
09994 r = SIGNDOC_SignatureParameters_getErrorMessageW (&ex, p);
09995 if (ex != NULL) SignDoc_throw (ex);
09996 return r;
09997 }
09998
09999 private:
10003 SignDocSignatureParameters (const SignDocSignatureParameters &);
10004
10008 SignDocSignatureParameters &operator= (const SignDocSignatureParameters &);
10009 public:
10014 SignDocSignatureParameters (SIGNDOC_SignatureParameters *aP) : p (aP) { }
10015
10020 SIGNDOC_SignatureParameters *getImpl () { return p; }
10021
10026 const SIGNDOC_SignatureParameters *getImpl () const { return p; }
10027
10032 void setImpl (SIGNDOC_SignatureParameters *aP) { SIGNDOC_SignatureParameters_delete (p); p = aP; }
10033
10034 private:
10035 SIGNDOC_SignatureParameters *p;
10036 };
10037
10046 class SignDocProperty
10047 {
10048 public:
10049
10050 public:
10054 enum Type
10055 {
10056 t_string,
10057 t_integer,
10058 t_boolean
10059 };
10060
10061 public:
10065 SignDocProperty ()
10066 : p (NULL)
10067 {
10068 SIGNDOC_Exception *ex = NULL;
10069 p = SIGNDOC_Property_new (&ex);
10070 if (ex != NULL) SignDoc_throw (ex);
10071 }
10072
10078 SignDocProperty (const SignDocProperty &aSource)
10079 : p (NULL)
10080 {
10081 SIGNDOC_Exception *ex = NULL;
10082 p = SIGNDOC_Property_clone (&ex, aSource.getImpl ());
10083 if (ex != NULL) SignDoc_throw (ex);
10084 }
10085
10089 ~SignDocProperty ()
10090 {
10091 SIGNDOC_Property_delete (p);
10092 }
10093
10099 void swap (SignDocProperty &aOther)
10100 {
10101 std::swap (p, aOther.p);
10102 }
10103
10119 std::string getName (Encoding aEncoding) const
10120 {
10121 SIGNDOC_Exception *ex = NULL;
10122 std::string r;
10123 char *s = SIGNDOC_Property_getName (&ex, p, aEncoding);
10124 if (ex != NULL) SignDoc_throw (ex);
10125 try
10126 {
10127 r = s;
10128 }
10129 catch (...)
10130 {
10131 SIGNDOC_free (s);
10132 throw;
10133 }
10134 SIGNDOC_free (s);
10135 return r;
10136 }
10137
10149 const char *getNameUTF8 () const
10150 {
10151 SIGNDOC_Exception *ex = NULL;
10152 const char *r;
10153 r = SIGNDOC_Property_getNameUTF8 (&ex, p);
10154 if (ex != NULL) SignDoc_throw (ex);
10155 return r;
10156 }
10157
10163 Type getType () const
10164 {
10165 SIGNDOC_Exception *ex = NULL;
10166 Type r;
10167 r = (Type)SIGNDOC_Property_getType (&ex, p);
10168 if (ex != NULL) SignDoc_throw (ex);
10169 return r;
10170 }
10171
10172 private:
10173 public:
10178 SignDocProperty (SIGNDOC_Property *aP) : p (aP) { }
10179
10184 SIGNDOC_Property *getImpl () { return p; }
10185
10190 const SIGNDOC_Property *getImpl () const { return p; }
10191
10196 void setImpl (SIGNDOC_Property *aP) { SIGNDOC_Property_delete (p); p = aP; }
10197
10198 private:
10199 SIGNDOC_Property *p;
10200 };
10201
10206 inline void assignArray (std::vector<SignDocProperty> &aDst,
10207 SIGNDOC_PropertyArray *aSrc)
10208 {
10209 aDst.clear ();
10210 unsigned n = SIGNDOC_PropertyArray_count (aSrc);
10211 if (aSrc == NULL)
10212 return;
10213 aDst.resize (n);
10214 for (unsigned i = 0; i < n; ++i)
10215 {
10216 SIGNDOC_Exception *ex = NULL;
10217 SIGNDOC_Property *p = SIGNDOC_Property_clone (&ex, SIGNDOC_PropertyArray_at (aSrc, i));
10218 if (ex != NULL) SignDoc_throw (ex);
10219 aDst[i].setImpl (p);
10220 }
10221 }
10222
10230 class SignDocAnnotation
10231 {
10232 public:
10238 enum Type
10239 {
10240 t_unknown,
10241 t_line,
10242 t_scribble,
10243 t_freetext
10244 };
10245
10249 enum LineEnding
10250 {
10251 le_unknown,
10252 le_none,
10253 le_arrow
10254 };
10255
10259 enum HAlignment
10260 {
10264 ha_left,
10265
10269 ha_center,
10270
10274 ha_right
10275 };
10276
10280 enum Flags
10281 {
10290 f_auto_alignment = 0x200,
10291
10303 f_ltr = 0x1000,
10304
10324 f_rtl = 0x2000,
10325
10352 f_default_ltr = 0x4000,
10353
10380 f_default_rtl = 0x8000
10381 };
10382
10386 enum ReturnCode
10387 {
10388 rc_ok,
10389 rc_not_supported,
10390 rc_invalid_value,
10391 rc_not_available
10392 };
10393
10394 protected:
10398 SignDocAnnotation ()
10399 : p (NULL)
10400 {
10401 }
10402
10403 public:
10407 ~SignDocAnnotation ()
10408 {
10409 SIGNDOC_Annotation_delete (p);
10410 }
10411
10417 Type getType () const
10418 {
10419 SIGNDOC_Exception *ex = NULL;
10420 Type r;
10421 r = (Type)SIGNDOC_Annotation_getType (&ex, p);
10422 if (ex != NULL) SignDoc_throw (ex);
10423 return r;
10424 }
10425
10434 std::string getName (Encoding aEncoding) const
10435 {
10436 SIGNDOC_Exception *ex = NULL;
10437 std::string r;
10438 char *s = SIGNDOC_Annotation_getName (&ex, p, aEncoding);
10439 if (ex != NULL) SignDoc_throw (ex);
10440 try
10441 {
10442 r = s;
10443 }
10444 catch (...)
10445 {
10446 SIGNDOC_free (s);
10447 throw;
10448 }
10449 SIGNDOC_free (s);
10450 return r;
10451 }
10452
10462 int getPage () const
10463 {
10464 SIGNDOC_Exception *ex = NULL;
10465 int r;
10466 r = SIGNDOC_Annotation_getPage (&ex, p);
10467 if (ex != NULL) SignDoc_throw (ex);
10468 return r;
10469 }
10470
10482 ReturnCode getBoundingBox (Rect &aOutput) const
10483 {
10484 SIGNDOC_Exception *ex = NULL;
10485 ReturnCode r;
10486 r = (ReturnCode)SIGNDOC_Annotation_getBoundingBox (&ex, p, (SIGNDOC_Rect*)&aOutput);
10487 if (ex != NULL) SignDoc_throw (ex);
10488 return r;
10489 }
10490
10503 ReturnCode setName (Encoding aEncoding, const std::string &aName)
10504 {
10505 SIGNDOC_Exception *ex = NULL;
10506 ReturnCode r;
10507 r = (ReturnCode)SIGNDOC_Annotation_setName (&ex, p, aEncoding, aName.c_str ());
10508 if (ex != NULL) SignDoc_throw (ex);
10509 return r;
10510 }
10511
10523 ReturnCode setName (const wchar_t *aName)
10524 {
10525 SIGNDOC_Exception *ex = NULL;
10526 ReturnCode r;
10527 r = (ReturnCode)SIGNDOC_Annotation_setNameW (&ex, p, aName);
10528 if (ex != NULL) SignDoc_throw (ex);
10529 return r;
10530 }
10531
10543 ReturnCode setLineEnding (LineEnding aStart, LineEnding aEnd)
10544 {
10545 SIGNDOC_Exception *ex = NULL;
10546 ReturnCode r;
10547 r = (ReturnCode)SIGNDOC_Annotation_setLineEnding (&ex, p, aStart, aEnd);
10548 if (ex != NULL) SignDoc_throw (ex);
10549 return r;
10550 }
10551
10564 ReturnCode setColor (const SignDocColor &aColor)
10565 {
10566 SIGNDOC_Exception *ex = NULL;
10567 ReturnCode r;
10568 r = (ReturnCode)SIGNDOC_Annotation_setColor (&ex, p, aColor.getImpl ());
10569 if (ex != NULL) SignDoc_throw (ex);
10570 return r;
10571 }
10572
10584 ReturnCode setBackgroundColor (const SignDocColor &aColor)
10585 {
10586 SIGNDOC_Exception *ex = NULL;
10587 ReturnCode r;
10588 r = (ReturnCode)SIGNDOC_Annotation_setBackgroundColor (&ex, p, aColor.getImpl ());
10589 if (ex != NULL) SignDoc_throw (ex);
10590 return r;
10591 }
10592
10606 ReturnCode setBorderColor (const SignDocColor &aColor)
10607 {
10608 SIGNDOC_Exception *ex = NULL;
10609 ReturnCode r;
10610 r = (ReturnCode)SIGNDOC_Annotation_setBorderColor (&ex, p, aColor.getImpl ());
10611 if (ex != NULL) SignDoc_throw (ex);
10612 return r;
10613 }
10614
10628 ReturnCode setOpacity (double aOpacity)
10629 {
10630 SIGNDOC_Exception *ex = NULL;
10631 ReturnCode r;
10632 r = (ReturnCode)SIGNDOC_Annotation_setOpacity (&ex, p, aOpacity);
10633 if (ex != NULL) SignDoc_throw (ex);
10634 return r;
10635 }
10636
10647 ReturnCode setLineWidthInPoints (double aWidth)
10648 {
10649 SIGNDOC_Exception *ex = NULL;
10650 ReturnCode r;
10651 r = (ReturnCode)SIGNDOC_Annotation_setLineWidthInPoints (&ex, p, aWidth);
10652 if (ex != NULL) SignDoc_throw (ex);
10653 return r;
10654 }
10655
10669 ReturnCode setBorderLineWidthInPoints (double aWidth)
10670 {
10671 SIGNDOC_Exception *ex = NULL;
10672 ReturnCode r;
10673 r = (ReturnCode)SIGNDOC_Annotation_setBorderLineWidthInPoints (&ex, p, aWidth);
10674 if (ex != NULL) SignDoc_throw (ex);
10675 return r;
10676 }
10677
10689 ReturnCode newStroke ()
10690 {
10691 SIGNDOC_Exception *ex = NULL;
10692 ReturnCode r;
10693 r = (ReturnCode)SIGNDOC_Annotation_newStroke (&ex, p);
10694 if (ex != NULL) SignDoc_throw (ex);
10695 return r;
10696 }
10697
10712 ReturnCode addPoint (const Point &aPoint)
10713 {
10714 SIGNDOC_Exception *ex = NULL;
10715 ReturnCode r;
10716 r = (ReturnCode)SIGNDOC_Annotation_addPoint (&ex, p, (const SIGNDOC_Point*)&aPoint);
10717 if (ex != NULL) SignDoc_throw (ex);
10718 return r;
10719 }
10720
10736 ReturnCode addPoint (double aX, double aY)
10737 {
10738 SIGNDOC_Exception *ex = NULL;
10739 ReturnCode r;
10740 r = (ReturnCode)SIGNDOC_Annotation_addPointXY (&ex, p, aX, aY);
10741 if (ex != NULL) SignDoc_throw (ex);
10742 return r;
10743 }
10744
10780 ReturnCode setPlainText (Encoding aEncoding, const std::string &aText,
10781 const std::string &aFont, double aFontSize,
10782 HAlignment aHAlignment)
10783 {
10784 SIGNDOC_Exception *ex = NULL;
10785 ReturnCode r;
10786 r = (ReturnCode)SIGNDOC_Annotation_setPlainText (&ex, p, aEncoding, aText.c_str (), aFont.c_str (), aFontSize, aHAlignment);
10787 if (ex != NULL) SignDoc_throw (ex);
10788 return r;
10789 }
10790
10805 ReturnCode getPlainText (Encoding aEncoding, std::string &aText)
10806 {
10807 SIGNDOC_Exception *ex = NULL;
10808 char *tempText = NULL;
10809 ReturnCode r;
10810 try
10811 {
10812 r = (ReturnCode)SIGNDOC_Annotation_getPlainText (&ex, p, aEncoding, &tempText);
10813 if (tempText != NULL)
10814 aText = tempText;
10815 }
10816 catch (...)
10817 {
10818 SIGNDOC_free (tempText);
10819 throw;
10820 }
10821 SIGNDOC_free (tempText);
10822 if (ex != NULL) SignDoc_throw (ex);
10823 return r;
10824 }
10825
10842 ReturnCode getFont (Encoding aEncoding, std::string &aFont,
10843 double &aFontSize)
10844 {
10845 SIGNDOC_Exception *ex = NULL;
10846 char *tempFont = NULL;
10847 ReturnCode r;
10848 try
10849 {
10850 r = (ReturnCode)SIGNDOC_Annotation_getFont (&ex, p, aEncoding, &tempFont, &aFontSize);
10851 if (tempFont != NULL)
10852 aFont = tempFont;
10853 }
10854 catch (...)
10855 {
10856 SIGNDOC_free (tempFont);
10857 throw;
10858 }
10859 SIGNDOC_free (tempFont);
10860 if (ex != NULL) SignDoc_throw (ex);
10861 return r;
10862 }
10863
10874 ReturnCode setFlags (int aFlags)
10875 {
10876 SIGNDOC_Exception *ex = NULL;
10877 ReturnCode r;
10878 r = (ReturnCode)SIGNDOC_Annotation_setFlags (&ex, p, aFlags);
10879 if (ex != NULL) SignDoc_throw (ex);
10880 return r;
10881 }
10886 SignDocAnnotation (SIGNDOC_Annotation *aP) : p (aP) { }
10887
10892 SIGNDOC_Annotation *getImpl () { return p; }
10893
10898 const SIGNDOC_Annotation *getImpl () const { return p; }
10899
10904 void setImpl (SIGNDOC_Annotation *aP) { SIGNDOC_Annotation_delete (p); p = aP; }
10905
10906 private:
10907 SIGNDOC_Annotation *p;
10908 };
10909
10915 class SignDocCharacterPosition
10916 {
10917 public:
10918 int mPage;
10919 Point mRef;
10920 Rect mBox;
10921 };
10922
10926 class SignDocFindTextPosition
10927 {
10928 public:
10929 SignDocCharacterPosition mFirst;
10930 SignDocCharacterPosition mLast;
10931 };
10932
10937 inline void assignArray (std::vector<SignDocFindTextPosition> &aDst,
10938 SIGNDOC_FindTextPositionArray *aSrc)
10939 {
10940 if (aSrc == NULL)
10941 aDst.clear ();
10942 else
10943 {
10944 unsigned n = SIGNDOC_FindTextPositionArray_count (aSrc);
10945 aDst.resize (n);
10946 for (unsigned i = 0; i < n; ++i)
10947 aDst[i] = *(const SignDocFindTextPosition*)SIGNDOC_FindTextPositionArray_at (aSrc, i);
10948 }
10949 }
10950
10954 class SignDocRenderParameters
10955 {
10956 public:
10960 enum Interlacing
10961 {
10965 i_off,
10966
10972 i_on
10973 };
10974
10978 enum Quality
10979 {
10983 q_low,
10984
10988 q_high
10989 };
10990
10994 enum PixelFormat
10995 {
10999 pf_default,
11000
11004 pf_bw
11005 };
11006
11013 enum Compression
11014 {
11015 c_default,
11016 c_none,
11017 c_group4,
11018 c_lzw,
11019 c_rle,
11020 c_zip
11021 };
11022
11028 enum DecorationState
11029 {
11030 ds_auto,
11031 ds_empty,
11032 ds_ok,
11033 ds_problem,
11034 ds_broken
11035 };
11036
11037 public:
11041 SignDocRenderParameters ()
11042 : p (NULL)
11043 {
11044 SIGNDOC_Exception *ex = NULL;
11045 p = SIGNDOC_RenderParameters_new (&ex);
11046 if (ex != NULL) SignDoc_throw (ex);
11047 }
11048
11054 SignDocRenderParameters (const SignDocRenderParameters &aSource)
11055 : p (NULL)
11056 {
11057 SIGNDOC_Exception *ex = NULL;
11058 p = SIGNDOC_RenderParameters_clone (&ex, aSource.getImpl ());
11059 if (ex != NULL) SignDoc_throw (ex);
11060 }
11061
11065 ~SignDocRenderParameters ()
11066 {
11067 SIGNDOC_RenderParameters_delete (p);
11068 }
11069
11075 SignDocRenderParameters &operator= (const SignDocRenderParameters &aSource)
11076 {
11077 SIGNDOC_Exception *ex = NULL;
11078 SIGNDOC_RenderParameters_assign (&ex, p, aSource.getImpl ());
11079 if (ex != NULL) SignDoc_throw (ex);
11080 return *this;
11081 }
11082
11095 bool setPage (int aPage)
11096 {
11097 SIGNDOC_Exception *ex = NULL;
11098 bool r;
11099 r = (bool)SIGNDOC_RenderParameters_setPage (&ex, p, aPage);
11100 if (ex != NULL) SignDoc_throw (ex);
11101 return r;
11102 }
11103
11116 bool getPage (int &aPage) const
11117 {
11118 SIGNDOC_Exception *ex = NULL;
11119 bool r;
11120 r = (bool)SIGNDOC_RenderParameters_getPage (&ex, p, &aPage);
11121 if (ex != NULL) SignDoc_throw (ex);
11122 return r;
11123 }
11124
11144 bool setPages (int aFirst, int aLast)
11145 {
11146 SIGNDOC_Exception *ex = NULL;
11147 bool r;
11148 r = (bool)SIGNDOC_RenderParameters_setPages (&ex, p, aFirst, aLast);
11149 if (ex != NULL) SignDoc_throw (ex);
11150 return r;
11151 }
11152
11168 bool getPages (int &aFirst, int &aLast) const
11169 {
11170 SIGNDOC_Exception *ex = NULL;
11171 bool r;
11172 r = (bool)SIGNDOC_RenderParameters_getPages (&ex, p, &aFirst, &aLast);
11173 if (ex != NULL) SignDoc_throw (ex);
11174 return r;
11175 }
11176
11193 bool setResolution (double aResX, double aResY)
11194 {
11195 SIGNDOC_Exception *ex = NULL;
11196 bool r;
11197 r = (bool)SIGNDOC_RenderParameters_setResolution (&ex, p, aResX, aResY);
11198 if (ex != NULL) SignDoc_throw (ex);
11199 return r;
11200 }
11201
11212 bool getResolution (double &aResX, double &aResY) const
11213 {
11214 SIGNDOC_Exception *ex = NULL;
11215 bool r;
11216 r = (bool)SIGNDOC_RenderParameters_getResolution (&ex, p, &aResX, &aResY);
11217 if (ex != NULL) SignDoc_throw (ex);
11218 return r;
11219 }
11220
11234 bool setZoom (double aZoom)
11235 {
11236 SIGNDOC_Exception *ex = NULL;
11237 bool r;
11238 r = (bool)SIGNDOC_RenderParameters_setZoom (&ex, p, aZoom);
11239 if (ex != NULL) SignDoc_throw (ex);
11240 return r;
11241 }
11242
11257 bool getZoom (double &aZoom) const
11258 {
11259 SIGNDOC_Exception *ex = NULL;
11260 bool r;
11261 r = (bool)SIGNDOC_RenderParameters_getZoom (&ex, p, &aZoom);
11262 if (ex != NULL) SignDoc_throw (ex);
11263 return r;
11264 }
11265
11279 bool fitWidth (int aWidth)
11280 {
11281 SIGNDOC_Exception *ex = NULL;
11282 bool r;
11283 r = (bool)SIGNDOC_RenderParameters_fitWidth (&ex, p, aWidth);
11284 if (ex != NULL) SignDoc_throw (ex);
11285 return r;
11286 }
11287
11298 bool getFitWidth (int &aWidth) const
11299 {
11300 SIGNDOC_Exception *ex = NULL;
11301 bool r;
11302 r = (bool)SIGNDOC_RenderParameters_getFitWidth (&ex, p, &aWidth);
11303 if (ex != NULL) SignDoc_throw (ex);
11304 return r;
11305 }
11306
11320 bool fitHeight (int aHeight)
11321 {
11322 SIGNDOC_Exception *ex = NULL;
11323 bool r;
11324 r = (bool)SIGNDOC_RenderParameters_fitHeight (&ex, p, aHeight);
11325 if (ex != NULL) SignDoc_throw (ex);
11326 return r;
11327 }
11328
11339 bool getFitHeight (int &aHeight) const
11340 {
11341 SIGNDOC_Exception *ex = NULL;
11342 bool r;
11343 r = (bool)SIGNDOC_RenderParameters_getFitHeight (&ex, p, &aHeight);
11344 if (ex != NULL) SignDoc_throw (ex);
11345 return r;
11346 }
11347
11364 bool fitRect (int aWidth, int aHeight)
11365 {
11366 SIGNDOC_Exception *ex = NULL;
11367 bool r;
11368 r = (bool)SIGNDOC_RenderParameters_fitRect (&ex, p, aWidth, aHeight);
11369 if (ex != NULL) SignDoc_throw (ex);
11370 return r;
11371 }
11372
11384 bool getFitRect (int &aWidth, int &aHeight) const
11385 {
11386 SIGNDOC_Exception *ex = NULL;
11387 bool r;
11388 r = (bool)SIGNDOC_RenderParameters_getFitRect (&ex, p, &aWidth, &aHeight);
11389 if (ex != NULL) SignDoc_throw (ex);
11390 return r;
11391 }
11392
11407 bool setFormat (const std::string &aFormat)
11408 {
11409 SIGNDOC_Exception *ex = NULL;
11410 bool r;
11411 r = (bool)SIGNDOC_RenderParameters_setFormat (&ex, p, aFormat.c_str ());
11412 if (ex != NULL) SignDoc_throw (ex);
11413 return r;
11414 }
11415
11426 bool getFormat (std::string &aFormat) const
11427 {
11428 SIGNDOC_Exception *ex = NULL;
11429 char *tempFormat = NULL;
11430 bool r;
11431 try
11432 {
11433 r = (bool)SIGNDOC_RenderParameters_getFormat (&ex, p, &tempFormat);
11434 if (tempFormat != NULL)
11435 aFormat = tempFormat;
11436 }
11437 catch (...)
11438 {
11439 SIGNDOC_free (tempFormat);
11440 throw;
11441 }
11442 SIGNDOC_free (tempFormat);
11443 if (ex != NULL) SignDoc_throw (ex);
11444 return r;
11445 }
11446
11459 bool setInterlacing (Interlacing aInterlacing)
11460 {
11461 SIGNDOC_Exception *ex = NULL;
11462 bool r;
11463 r = (bool)SIGNDOC_RenderParameters_setInterlacing (&ex, p, aInterlacing);
11464 if (ex != NULL) SignDoc_throw (ex);
11465 return r;
11466 }
11467
11478 bool getInterlacing (Interlacing &aInterlacing) const
11479 {
11480 SIGNDOC_Exception *ex = NULL;
11481 int tempInterlacing = 0;
11482 bool r;
11483 try
11484 {
11485 r = (bool)SIGNDOC_RenderParameters_getInterlacing (&ex, p, &tempInterlacing);
11486 aInterlacing = (Interlacing )tempInterlacing;
11487 }
11488 catch (...)
11489 {
11490 throw;
11491 }
11492 if (ex != NULL) SignDoc_throw (ex);
11493 return r;
11494 }
11495
11508 bool setQuality (Quality aQuality)
11509 {
11510 SIGNDOC_Exception *ex = NULL;
11511 bool r;
11512 r = (bool)SIGNDOC_RenderParameters_setQuality (&ex, p, aQuality);
11513 if (ex != NULL) SignDoc_throw (ex);
11514 return r;
11515 }
11516
11526 bool getQuality (Quality &aQuality) const
11527 {
11528 SIGNDOC_Exception *ex = NULL;
11529 int tempQuality = 0;
11530 bool r;
11531 try
11532 {
11533 r = (bool)SIGNDOC_RenderParameters_getQuality (&ex, p, &tempQuality);
11534 aQuality = (Quality )tempQuality;
11535 }
11536 catch (...)
11537 {
11538 throw;
11539 }
11540 if (ex != NULL) SignDoc_throw (ex);
11541 return r;
11542 }
11543
11555 bool setPixelFormat (PixelFormat aPixelFormat)
11556 {
11557 SIGNDOC_Exception *ex = NULL;
11558 bool r;
11559 r = (bool)SIGNDOC_RenderParameters_setPixelFormat (&ex, p, aPixelFormat);
11560 if (ex != NULL) SignDoc_throw (ex);
11561 return r;
11562 }
11563
11573 bool getPixelFormat (PixelFormat &aPixelFormat) const
11574 {
11575 SIGNDOC_Exception *ex = NULL;
11576 int tempPixelFormat = 0;
11577 bool r;
11578 try
11579 {
11580 r = (bool)SIGNDOC_RenderParameters_getPixelFormat (&ex, p, &tempPixelFormat);
11581 aPixelFormat = (PixelFormat )tempPixelFormat;
11582 }
11583 catch (...)
11584 {
11585 throw;
11586 }
11587 if (ex != NULL) SignDoc_throw (ex);
11588 return r;
11589 }
11590
11602 bool setCompression (Compression aCompression)
11603 {
11604 SIGNDOC_Exception *ex = NULL;
11605 bool r;
11606 r = (bool)SIGNDOC_RenderParameters_setCompression (&ex, p, aCompression);
11607 if (ex != NULL) SignDoc_throw (ex);
11608 return r;
11609 }
11610
11620 bool getCompression (Compression &aCompression) const
11621 {
11622 SIGNDOC_Exception *ex = NULL;
11623 int tempCompression = 0;
11624 bool r;
11625 try
11626 {
11627 r = (bool)SIGNDOC_RenderParameters_getCompression (&ex, p, &tempCompression);
11628 aCompression = (Compression )tempCompression;
11629 }
11630 catch (...)
11631 {
11632 throw;
11633 }
11634 if (ex != NULL) SignDoc_throw (ex);
11635 return r;
11636 }
11637
11676 bool setDecorations (bool aDecorations)
11677 {
11678 SIGNDOC_Exception *ex = NULL;
11679 bool r;
11680 r = (bool)SIGNDOC_RenderParameters_setDecorations (&ex, p, aDecorations);
11681 if (ex != NULL) SignDoc_throw (ex);
11682 return r;
11683 }
11684
11694 bool getDecorations (bool &aDecorations) const
11695 {
11696 SIGNDOC_Exception *ex = NULL;
11697 SIGNDOC_Boolean tempDecorations = 0;
11698 bool r;
11699 try
11700 {
11701 r = (bool)SIGNDOC_RenderParameters_getDecorations (&ex, p, &tempDecorations);
11702 aDecorations = (bool )tempDecorations;
11703 }
11704 catch (...)
11705 {
11706 throw;
11707 }
11708 if (ex != NULL) SignDoc_throw (ex);
11709 return r;
11710 }
11711
11732 bool setDecorationState (Encoding aEncoding, const std::string &aName,
11733 DecorationState aDecorationState)
11734 {
11735 SIGNDOC_Exception *ex = NULL;
11736 bool r;
11737 r = (bool)SIGNDOC_RenderParameters_setDecorationState (&ex, p, aEncoding, aName.c_str (), aDecorationState);
11738 if (ex != NULL) SignDoc_throw (ex);
11739 return r;
11740 }
11741
11761 bool setDecorationState (const wchar_t *aName,
11762 DecorationState aDecorationState)
11763 {
11764 SIGNDOC_Exception *ex = NULL;
11765 bool r;
11766 r = (bool)SIGNDOC_RenderParameters_setDecorationStateW (&ex, p, aName, aDecorationState);
11767 if (ex != NULL) SignDoc_throw (ex);
11768 return r;
11769 }
11770
11785 bool getDecorationState (Encoding aEncoding, const std::string &aName,
11786 DecorationState &aDecorationState) const
11787 {
11788 SIGNDOC_Exception *ex = NULL;
11789 int tempDecorationState = 0;
11790 bool r;
11791 try
11792 {
11793 r = (bool)SIGNDOC_RenderParameters_getDecorationState (&ex, p, aEncoding, aName.c_str (), &tempDecorationState);
11794 aDecorationState = (DecorationState )tempDecorationState;
11795 }
11796 catch (...)
11797 {
11798 throw;
11799 }
11800 if (ex != NULL) SignDoc_throw (ex);
11801 return r;
11802 }
11803
11817 bool getDecorationState (const wchar_t *aName,
11818 DecorationState &aDecorationState) const
11819 {
11820 SIGNDOC_Exception *ex = NULL;
11821 int tempDecorationState = 0;
11822 bool r;
11823 try
11824 {
11825 r = (bool)SIGNDOC_RenderParameters_getDecorationStateW (&ex, p, aName, &tempDecorationState);
11826 aDecorationState = (DecorationState )tempDecorationState;
11827 }
11828 catch (...)
11829 {
11830 throw;
11831 }
11832 if (ex != NULL) SignDoc_throw (ex);
11833 return r;
11834 }
11835
11848 bool setPrint (bool aPrint)
11849 {
11850 SIGNDOC_Exception *ex = NULL;
11851 bool r;
11852 r = (bool)SIGNDOC_RenderParameters_setPrint (&ex, p, aPrint);
11853 if (ex != NULL) SignDoc_throw (ex);
11854 return r;
11855 }
11856
11866 bool getPrint (bool &aPrint) const
11867 {
11868 SIGNDOC_Exception *ex = NULL;
11869 SIGNDOC_Boolean tempPrint = 0;
11870 bool r;
11871 try
11872 {
11873 r = (bool)SIGNDOC_RenderParameters_getPrint (&ex, p, &tempPrint);
11874 aPrint = (bool )tempPrint;
11875 }
11876 catch (...)
11877 {
11878 throw;
11879 }
11880 if (ex != NULL) SignDoc_throw (ex);
11881 return r;
11882 }
11883
11897 bool setModificationState (bool aCheck)
11898 {
11899 SIGNDOC_Exception *ex = NULL;
11900 bool r;
11901 r = (bool)SIGNDOC_RenderParameters_setModificationState (&ex, p, aCheck);
11902 if (ex != NULL) SignDoc_throw (ex);
11903 return r;
11904 }
11905
11915 bool getModificationState (bool &aCheck) const
11916 {
11917 SIGNDOC_Exception *ex = NULL;
11918 SIGNDOC_Boolean tempCheck = 0;
11919 bool r;
11920 try
11921 {
11922 r = (bool)SIGNDOC_RenderParameters_getModificationState (&ex, p, &tempCheck);
11923 aCheck = (bool )tempCheck;
11924 }
11925 catch (...)
11926 {
11927 throw;
11928 }
11929 if (ex != NULL) SignDoc_throw (ex);
11930 return r;
11931 }
11932
11940 bool operator== (const SignDocRenderParameters &aRHS) const
11941 {
11942 SIGNDOC_Exception *ex = NULL;
11943 bool r;
11944 r = (bool)SIGNDOC_RenderParameters_equals (&ex, p, aRHS.getImpl ());
11945 if (ex != NULL) SignDoc_throw (ex);
11946 return r;
11947 }
11948
11949 private:
11950 public:
11955 SignDocRenderParameters (SIGNDOC_RenderParameters *aP) : p (aP) { }
11956
11961 SIGNDOC_RenderParameters *getImpl () { return p; }
11962
11967 const SIGNDOC_RenderParameters *getImpl () const { return p; }
11968
11973 void setImpl (SIGNDOC_RenderParameters *aP) { SIGNDOC_RenderParameters_delete (p); p = aP; }
11974
11975 private:
11976 SIGNDOC_RenderParameters *p;
11977 };
11978
11985 class SignDocRenderOutput
11986 {
11987 public:
11991 int mWidth;
11992
11996 int mHeight;
11997 };
11998
12002 class SignDocAttachment
12003 {
12004 public:
12005
12006 public:
12010 SignDocAttachment ()
12011 : p (NULL)
12012 {
12013 SIGNDOC_Exception *ex = NULL;
12014 p = SIGNDOC_Attachment_new (&ex);
12015 if (ex != NULL) SignDoc_throw (ex);
12016 }
12017
12023 SignDocAttachment (const SignDocAttachment &aSource)
12024 : p (NULL)
12025 {
12026 SIGNDOC_Exception *ex = NULL;
12027 p = SIGNDOC_Attachment_clone (&ex, aSource.getImpl ());
12028 if (ex != NULL) SignDoc_throw (ex);
12029 }
12030
12034 ~SignDocAttachment ()
12035 {
12036 SIGNDOC_Attachment_delete (p);
12037 }
12038
12044 SignDocAttachment &operator= (const SignDocAttachment &aSource)
12045 {
12046 SIGNDOC_Exception *ex = NULL;
12047 SIGNDOC_Attachment_assign (&ex, p, aSource.getImpl ());
12048 if (ex != NULL) SignDoc_throw (ex);
12049 return *this;
12050 }
12051
12057 void swap (SignDocAttachment &aOther)
12058 {
12059 std::swap (p, aOther.p);
12060 }
12061
12074 std::string getName (Encoding aEncoding) const
12075 {
12076 SIGNDOC_Exception *ex = NULL;
12077 std::string r;
12078 char *s = SIGNDOC_Attachment_getName (&ex, p, aEncoding);
12079 if (ex != NULL) SignDoc_throw (ex);
12080 try
12081 {
12082 r = s;
12083 }
12084 catch (...)
12085 {
12086 SIGNDOC_free (s);
12087 throw;
12088 }
12089 SIGNDOC_free (s);
12090 return r;
12091 }
12092
12101 const char *getNameUTF8 () const
12102 {
12103 SIGNDOC_Exception *ex = NULL;
12104 const char *r;
12105 r = SIGNDOC_Attachment_getNameUTF8 (&ex, p);
12106 if (ex != NULL) SignDoc_throw (ex);
12107 return r;
12108 }
12109
12122 std::string getFileName (Encoding aEncoding) const
12123 {
12124 SIGNDOC_Exception *ex = NULL;
12125 std::string r;
12126 char *s = SIGNDOC_Attachment_getFileName (&ex, p, aEncoding);
12127 if (ex != NULL) SignDoc_throw (ex);
12128 try
12129 {
12130 r = s;
12131 }
12132 catch (...)
12133 {
12134 SIGNDOC_free (s);
12135 throw;
12136 }
12137 SIGNDOC_free (s);
12138 return r;
12139 }
12140
12149 const char *getFileNameUTF8 () const
12150 {
12151 SIGNDOC_Exception *ex = NULL;
12152 const char *r;
12153 r = SIGNDOC_Attachment_getFileNameUTF8 (&ex, p);
12154 if (ex != NULL) SignDoc_throw (ex);
12155 return r;
12156 }
12157
12172 std::string getDescription (Encoding aEncoding) const
12173 {
12174 SIGNDOC_Exception *ex = NULL;
12175 std::string r;
12176 char *s = SIGNDOC_Attachment_getDescription (&ex, p, aEncoding);
12177 if (ex != NULL) SignDoc_throw (ex);
12178 try
12179 {
12180 r = s;
12181 }
12182 catch (...)
12183 {
12184 SIGNDOC_free (s);
12185 throw;
12186 }
12187 SIGNDOC_free (s);
12188 return r;
12189 }
12190
12201 const char *getDescriptionUTF8 () const
12202 {
12203 SIGNDOC_Exception *ex = NULL;
12204 const char *r;
12205 r = SIGNDOC_Attachment_getDescriptionUTF8 (&ex, p);
12206 if (ex != NULL) SignDoc_throw (ex);
12207 return r;
12208 }
12209
12220 int getSize () const
12221 {
12222 SIGNDOC_Exception *ex = NULL;
12223 int r;
12224 r = SIGNDOC_Attachment_getSize (&ex, p);
12225 if (ex != NULL) SignDoc_throw (ex);
12226 return r;
12227 }
12228
12236 int getCompressedSize () const
12237 {
12238 SIGNDOC_Exception *ex = NULL;
12239 int r;
12240 r = SIGNDOC_Attachment_getCompressedSize (&ex, p);
12241 if (ex != NULL) SignDoc_throw (ex);
12242 return r;
12243 }
12244
12253 const char *getType () const
12254 {
12255 SIGNDOC_Exception *ex = NULL;
12256 const char *r;
12257 r = SIGNDOC_Attachment_getType (&ex, p);
12258 if (ex != NULL) SignDoc_throw (ex);
12259 return r;
12260 }
12261
12281 const char *getCreationTime () const
12282 {
12283 SIGNDOC_Exception *ex = NULL;
12284 const char *r;
12285 r = SIGNDOC_Attachment_getCreationTime (&ex, p);
12286 if (ex != NULL) SignDoc_throw (ex);
12287 return r;
12288 }
12289
12310 const char *getModificationTime () const
12311 {
12312 SIGNDOC_Exception *ex = NULL;
12313 const char *r;
12314 r = SIGNDOC_Attachment_getModificationTime (&ex, p);
12315 if (ex != NULL) SignDoc_throw (ex);
12316 return r;
12317 }
12318
12319 private:
12320 public:
12325 SignDocAttachment (SIGNDOC_Attachment *aP) : p (aP) { }
12326
12331 SIGNDOC_Attachment *getImpl () { return p; }
12332
12337 const SIGNDOC_Attachment *getImpl () const { return p; }
12338
12343 void setImpl (SIGNDOC_Attachment *aP) { SIGNDOC_Attachment_delete (p); p = aP; }
12344
12345 private:
12346 SIGNDOC_Attachment *p;
12347 };
12348
12357 class SignDocWatermark
12358 {
12359 public:
12360
12364 enum Justification
12365 {
12366 j_left, j_center, j_right
12367 };
12368
12372 enum Location
12373 {
12374 l_overlay,
12375 l_underlay
12376 };
12377
12381 enum HAlignment
12382 {
12386 ha_left,
12387
12391 ha_center,
12392
12396 ha_right
12397 };
12398
12402 enum VAlignment
12403 {
12407 va_top,
12408
12412 va_center,
12413
12417 va_bottom
12418 };
12419
12423 enum Flags
12424 {
12434 f_ltr = 0x1000,
12435
12445 f_rtl = 0x2000,
12446
12463 f_default_ltr = 0x4000,
12464
12481 f_default_rtl = 0x8000
12482 };
12483
12484 public:
12490 SignDocWatermark ()
12491 : p (NULL)
12492 {
12493 SIGNDOC_Exception *ex = NULL;
12494 p = SIGNDOC_Watermark_new (&ex);
12495 if (ex != NULL) SignDoc_throw (ex);
12496 }
12497
12503 SignDocWatermark (const SignDocWatermark &aSource)
12504 : p (NULL)
12505 {
12506 SIGNDOC_Exception *ex = NULL;
12507 p = SIGNDOC_Watermark_clone (&ex, aSource.getImpl ());
12508 if (ex != NULL) SignDoc_throw (ex);
12509 }
12510
12514 ~SignDocWatermark ()
12515 {
12516 SIGNDOC_Watermark_delete (p);
12517 }
12518
12524 SignDocWatermark &operator= (const SignDocWatermark &aSource)
12525 {
12526 SIGNDOC_Exception *ex = NULL;
12527 SIGNDOC_Watermark_assign (&ex, p, aSource.getImpl ());
12528 if (ex != NULL) SignDoc_throw (ex);
12529 return *this;
12530 }
12531
12537 void swap (SignDocWatermark &aOther)
12538 {
12539 std::swap (p, aOther.p);
12540 }
12541
12545 void clear ()
12546 {
12547 SIGNDOC_Exception *ex = NULL;
12548 SIGNDOC_Watermark_clear (&ex, p);
12549 if (ex != NULL) SignDoc_throw (ex);
12550 }
12551
12572 void setText (Encoding aEncoding, const std::string &aText)
12573 {
12574 SIGNDOC_Exception *ex = NULL;
12575 SIGNDOC_Watermark_setText (&ex, p, aEncoding, aText.c_str ());
12576 if (ex != NULL) SignDoc_throw (ex);
12577 }
12578
12593 void setFontName (Encoding aEncoding, const std::string &aFontName)
12594 {
12595 SIGNDOC_Exception *ex = NULL;
12596 SIGNDOC_Watermark_setFontName (&ex, p, aEncoding, aFontName.c_str ());
12597 if (ex != NULL) SignDoc_throw (ex);
12598 }
12599
12609 void setFontSize (double aFontSize)
12610 {
12611 SIGNDOC_Exception *ex = NULL;
12612 SIGNDOC_Watermark_setFontSize (&ex, p, aFontSize);
12613 if (ex != NULL) SignDoc_throw (ex);
12614 }
12615
12623 void setTextColor (const SignDocColor &aTextColor)
12624 {
12625 SIGNDOC_Exception *ex = NULL;
12626 SIGNDOC_Watermark_setTextColor (&ex, p, aTextColor.getImpl ());
12627 if (ex != NULL) SignDoc_throw (ex);
12628 }
12629
12642 void setJustification (Justification aJustification)
12643 {
12644 SIGNDOC_Exception *ex = NULL;
12645 SIGNDOC_Watermark_setJustification (&ex, p, aJustification);
12646 if (ex != NULL) SignDoc_throw (ex);
12647 }
12648
12658 void setRotation (double aRotation)
12659 {
12660 SIGNDOC_Exception *ex = NULL;
12661 SIGNDOC_Watermark_setRotation (&ex, p, aRotation);
12662 if (ex != NULL) SignDoc_throw (ex);
12663 }
12664
12675 void setOpacity (double aOpacity)
12676 {
12677 SIGNDOC_Exception *ex = NULL;
12678 SIGNDOC_Watermark_setOpacity (&ex, p, aOpacity);
12679 if (ex != NULL) SignDoc_throw (ex);
12680 }
12681
12691 void setScale (double aScale)
12692 {
12693 SIGNDOC_Exception *ex = NULL;
12694 SIGNDOC_Watermark_setScale (&ex, p, aScale);
12695 if (ex != NULL) SignDoc_throw (ex);
12696 }
12697
12708 void setLocation (Location aLocation)
12709 {
12710 SIGNDOC_Exception *ex = NULL;
12711 SIGNDOC_Watermark_setLocation (&ex, p, aLocation);
12712 if (ex != NULL) SignDoc_throw (ex);
12713 }
12714
12734 void setHorizontalPosition (HAlignment aAlignment, double aDistance)
12735 {
12736 SIGNDOC_Exception *ex = NULL;
12737 SIGNDOC_Watermark_setHorizontalPosition (&ex, p, aAlignment, aDistance);
12738 if (ex != NULL) SignDoc_throw (ex);
12739 }
12740
12759 void setVerticalPosition (VAlignment aAlignment, double aDistance)
12760 {
12761 SIGNDOC_Exception *ex = NULL;
12762 SIGNDOC_Watermark_setVerticalPosition (&ex, p, aAlignment, aDistance);
12763 if (ex != NULL) SignDoc_throw (ex);
12764 }
12765
12775 void setFirstPage (int aPage)
12776 {
12777 SIGNDOC_Exception *ex = NULL;
12778 SIGNDOC_Watermark_setFirstPage (&ex, p, aPage);
12779 if (ex != NULL) SignDoc_throw (ex);
12780 }
12781
12792 void setLastPage (int aPage)
12793 {
12794 SIGNDOC_Exception *ex = NULL;
12795 SIGNDOC_Watermark_setLastPage (&ex, p, aPage);
12796 if (ex != NULL) SignDoc_throw (ex);
12797 }
12798
12810 void setPageIncrement (int aIncr)
12811 {
12812 SIGNDOC_Exception *ex = NULL;
12813 SIGNDOC_Watermark_setPageIncrement (&ex, p, aIncr);
12814 if (ex != NULL) SignDoc_throw (ex);
12815 }
12816
12826 void setFlags (int aFlags)
12827 {
12828 SIGNDOC_Exception *ex = NULL;
12829 SIGNDOC_Watermark_setFlags (&ex, p, aFlags);
12830 if (ex != NULL) SignDoc_throw (ex);
12831 }
12832
12833 private:
12834 public:
12839 SignDocWatermark (SIGNDOC_Watermark *aP) : p (aP) { }
12840
12845 SIGNDOC_Watermark *getImpl () { return p; }
12846
12851 const SIGNDOC_Watermark *getImpl () const { return p; }
12852
12857 void setImpl (SIGNDOC_Watermark *aP) { SIGNDOC_Watermark_delete (p); p = aP; }
12858
12859 private:
12860 SIGNDOC_Watermark *p;
12861 };
12862
12910 class SignDocVerificationParameters
12911 {
12912 public:
12918 enum CertificateChainVerificationPolicy
12919 {
12925 ccvp_dont_verify,
12926
12933 ccvp_accept_self_signed,
12934
12942 ccvp_accept_self_signed_with_bio,
12943
12956 ccvp_accept_self_signed_with_rsa_bio,
12957
12964 ccvp_require_trusted_root
12965 };
12966
12973 enum CertificateRevocationVerificationPolicy
12974 {
12980 crvp_dont_check,
12981
12986 crvp_offline,
12987
12992 crvp_online
12993 };
12994
13000 enum VerificationFlags
13001 {
13005 vf_check_revocation = 0x01,
13006
13014 vf_use_crl_only = 0x02,
13015
13023 vf_use_ocsp_only = 0x04,
13024
13033 vf_offline = 0x08,
13034
13047 vf_enforce_next_update = 0x10,
13048
13061 vf_enforce_ocsp_signer = 0x20,
13062
13070 vf_online = 0x40,
13071
13082 vf_no_ocsp_nonce = 0x80,
13083
13095 vf_crl_first = 0x100,
13096
13114 vf_ignore_no_revocation = 0x200
13115 };
13116
13122 enum VerificationModel
13123 {
13130 vm_minimal,
13131
13140 vm_chain,
13141
13147 vm_modified_shell,
13148
13160 vm_shell
13161 };
13162
13166 enum ReturnCode
13167 {
13168 rc_ok,
13169 rc_unknown,
13170 rc_not_supported,
13171 rc_invalid_value
13172 };
13173
13174 public:
13182 SignDocVerificationParameters ()
13183 : p (NULL)
13184 {
13185 SIGNDOC_Exception *ex = NULL;
13186 p = SIGNDOC_VerificationParameters_new (&ex);
13187 if (ex != NULL) SignDoc_throw (ex);
13188 }
13189
13195 SignDocVerificationParameters (const SignDocVerificationParameters &aSource)
13196 : p (NULL)
13197 {
13198 SIGNDOC_Exception *ex = NULL;
13199 p = SIGNDOC_VerificationParameters_clone (&ex, aSource.getImpl ());
13200 if (ex != NULL) SignDoc_throw (ex);
13201 }
13202
13206 ~SignDocVerificationParameters ()
13207 {
13208 SIGNDOC_VerificationParameters_delete (p);
13209 }
13210
13216 SignDocVerificationParameters &operator= (const SignDocVerificationParameters &aSource)
13217 {
13218 SIGNDOC_Exception *ex = NULL;
13219 SIGNDOC_VerificationParameters_assign (&ex, p, aSource.getImpl ());
13220 if (ex != NULL) SignDoc_throw (ex);
13221 return *this;
13222 }
13223
13231 bool operator== (const SignDocVerificationParameters &aRHS) const
13232 {
13233 SIGNDOC_Exception *ex = NULL;
13234 bool r;
13235 r = (bool)SIGNDOC_VerificationParameters_equals (&ex, p, aRHS.getImpl ());
13236 if (ex != NULL) SignDoc_throw (ex);
13237 return r;
13238 }
13239
13246 void setForUpdateDSS ()
13247 {
13248 SIGNDOC_Exception *ex = NULL;
13249 SIGNDOC_VerificationParameters_setForUpdateDSS (&ex, p);
13250 if (ex != NULL) SignDoc_throw (ex);
13251 }
13252
13280 ReturnCode setString (Encoding aEncoding, const std::string &aName,
13281 const std::string &aValue)
13282 {
13283 SIGNDOC_Exception *ex = NULL;
13284 ReturnCode r;
13285 r = (ReturnCode)SIGNDOC_VerificationParameters_setString (&ex, p, aEncoding, aName.c_str (), aValue.c_str ());
13286 if (ex != NULL) SignDoc_throw (ex);
13287 return r;
13288 }
13289
13301 ReturnCode setString (const std::string &aName, const wchar_t *aValue)
13302 {
13303 SIGNDOC_Exception *ex = NULL;
13304 ReturnCode r;
13305 r = (ReturnCode)SIGNDOC_VerificationParameters_setStringW (&ex, p, aName.c_str (), aValue);
13306 if (ex != NULL) SignDoc_throw (ex);
13307 return r;
13308 }
13309
13385 ReturnCode setInteger (const std::string &aName, int aValue)
13386 {
13387 SIGNDOC_Exception *ex = NULL;
13388 ReturnCode r;
13389 r = (ReturnCode)SIGNDOC_VerificationParameters_setInteger (&ex, p, aName.c_str (), aValue);
13390 if (ex != NULL) SignDoc_throw (ex);
13391 return r;
13392 }
13393
13416 ReturnCode setBlob (const std::string &aName, const unsigned char *aData,
13417 size_t aSize)
13418 {
13419 SIGNDOC_Exception *ex = NULL;
13420 ReturnCode r;
13421 r = (ReturnCode)SIGNDOC_VerificationParameters_setBlob (&ex, p, aName.c_str (), aData, aSize);
13422 if (ex != NULL) SignDoc_throw (ex);
13423 return r;
13424 }
13425
13439 const char *getErrorMessage (Encoding aEncoding) const
13440 {
13441 SIGNDOC_Exception *ex = NULL;
13442 const char *r;
13443 r = SIGNDOC_VerificationParameters_getErrorMessage (&ex, p, aEncoding);
13444 if (ex != NULL) SignDoc_throw (ex);
13445 return r;
13446 }
13447
13459 const wchar_t *getErrorMessageW () const
13460 {
13461 SIGNDOC_Exception *ex = NULL;
13462 const wchar_t *r;
13463 r = SIGNDOC_VerificationParameters_getErrorMessageW (&ex, p);
13464 if (ex != NULL) SignDoc_throw (ex);
13465 return r;
13466 }
13467
13468 private:
13469 public:
13474 SignDocVerificationParameters (SIGNDOC_VerificationParameters *aP) : p (aP) { }
13475
13480 SIGNDOC_VerificationParameters *getImpl () { return p; }
13481
13486 const SIGNDOC_VerificationParameters *getImpl () const { return p; }
13487
13492 void setImpl (SIGNDOC_VerificationParameters *aP) { SIGNDOC_VerificationParameters_delete (p); p = aP; }
13493
13494 private:
13495 SIGNDOC_VerificationParameters *p;
13496 };
13497
13503 class SignDocChange
13504 {
13505 public:
13511 enum Type
13512 {
13520 t_other,
13521
13530 t_field_added,
13531
13540 t_field_removed,
13541
13550 t_field_modified,
13551
13560 t_field_filled_in,
13561
13570 t_annotation_added,
13571
13580 t_annotation_removed,
13581
13590 t_annotation_modified,
13591
13598 t_attachment_added,
13599
13606 t_attachment_removed,
13607
13614 t_attachment_modified,
13615
13622 t_page_added,
13623
13630 t_page_removed,
13631
13637 t_page_modified
13638 };
13639
13640 public:
13644 ~SignDocChange ()
13645 {
13646 SIGNDOC_Change_delete (p);
13647 }
13648
13654 Type getType () const
13655 {
13656 SIGNDOC_Exception *ex = NULL;
13657 Type r;
13658 r = (Type)SIGNDOC_Change_getType (&ex, p);
13659 if (ex != NULL) SignDoc_throw (ex);
13660 return r;
13661 }
13662
13680 std::string getName (Encoding aEncoding) const
13681 {
13682 SIGNDOC_Exception *ex = NULL;
13683 std::string r;
13684 char *s = SIGNDOC_Change_getName (&ex, p, aEncoding);
13685 if (ex != NULL) SignDoc_throw (ex);
13686 try
13687 {
13688 r = s;
13689 }
13690 catch (...)
13691 {
13692 SIGNDOC_free (s);
13693 throw;
13694 }
13695 SIGNDOC_free (s);
13696 return r;
13697 }
13698
13716 const char *getNameUTF8 () const
13717 {
13718 SIGNDOC_Exception *ex = NULL;
13719 const char *r;
13720 r = SIGNDOC_Change_getNameUTF8 (&ex, p);
13721 if (ex != NULL) SignDoc_throw (ex);
13722 return r;
13723 }
13724
13737 int getPage () const
13738 {
13739 SIGNDOC_Exception *ex = NULL;
13740 int r;
13741 r = SIGNDOC_Change_getPage (&ex, p);
13742 if (ex != NULL) SignDoc_throw (ex);
13743 return r;
13744 }
13745
13752 SignDocField::Type getFieldType () const
13753 {
13754 SIGNDOC_Exception *ex = NULL;
13755 SignDocField::Type r;
13756 r = (SignDocField::Type)SIGNDOC_Change_getFieldType (&ex, p);
13757 if (ex != NULL) SignDoc_throw (ex);
13758 return r;
13759 }
13760
13768 const char *getAnnotationType () const
13769 {
13770 SIGNDOC_Exception *ex = NULL;
13771 const char *r;
13772 r = SIGNDOC_Change_getAnnotationType (&ex, p);
13773 if (ex != NULL) SignDoc_throw (ex);
13774 return r;
13775 }
13776
13777 protected:
13783 SignDocChange ()
13784 : p (NULL)
13785 {
13786 }
13787
13788 public:
13793 SignDocChange (SIGNDOC_Change *aP) : p (aP) { }
13794
13799 SIGNDOC_Change *getImpl () { return p; }
13800
13805 const SIGNDOC_Change *getImpl () const { return p; }
13806
13811 void setImpl (SIGNDOC_Change *aP) { SIGNDOC_Change_delete (p); p = aP; }
13812
13813 private:
13814 SIGNDOC_Change *p;
13815 };
13816
13824 class SignDocSignature
13825 {
13826 public:
13830 ~SignDocSignature ()
13831 {
13832 SIGNDOC_Signature_delete (p);
13833 }
13834
13847 std::string getFieldName (Encoding aEncoding) const
13848 {
13849 SIGNDOC_Exception *ex = NULL;
13850 std::string r;
13851 char *s = SIGNDOC_Signature_getFieldName (&ex, p, aEncoding);
13852 if (ex != NULL) SignDoc_throw (ex);
13853 try
13854 {
13855 r = s;
13856 }
13857 catch (...)
13858 {
13859 SIGNDOC_free (s);
13860 throw;
13861 }
13862 SIGNDOC_free (s);
13863 return r;
13864 }
13865
13874 const char *getFieldNameUTF8 () const
13875 {
13876 SIGNDOC_Exception *ex = NULL;
13877 const char *r;
13878 r = SIGNDOC_Signature_getFieldNameUTF8 (&ex, p);
13879 if (ex != NULL) SignDoc_throw (ex);
13880 return r;
13881 }
13882
13888 int getFieldPage () const
13889 {
13890 SIGNDOC_Exception *ex = NULL;
13891 int r;
13892 r = SIGNDOC_Signature_getFieldPage (&ex, p);
13893 if (ex != NULL) SignDoc_throw (ex);
13894 return r;
13895 }
13896
13903 SignDocField::SignatureType getSignatureType () const
13904 {
13905 SIGNDOC_Exception *ex = NULL;
13906 SignDocField::SignatureType r;
13907 r = (SignDocField::SignatureType)SIGNDOC_Signature_getSignatureType (&ex, p);
13908 if (ex != NULL) SignDoc_throw (ex);
13909 return r;
13910 }
13911
13929 int getClearedIndex () const
13930 {
13931 SIGNDOC_Exception *ex = NULL;
13932 int r;
13933 r = SIGNDOC_Signature_getClearedIndex (&ex, p);
13934 if (ex != NULL) SignDoc_throw (ex);
13935 return r;
13936 }
13937
13955 int getDocMDP () const
13956 {
13957 SIGNDOC_Exception *ex = NULL;
13958 int r;
13959 r = SIGNDOC_Signature_getDocMDP (&ex, p);
13960 if (ex != NULL) SignDoc_throw (ex);
13961 return r;
13962 }
13963
13981 int getLockMDP () const
13982 {
13983 SIGNDOC_Exception *ex = NULL;
13984 int r;
13985 r = SIGNDOC_Signature_getLockMDP (&ex, p);
13986 if (ex != NULL) SignDoc_throw (ex);
13987 return r;
13988 }
13989
13998 bool getSigningCertificate (std::vector<unsigned char> &aOutput) const
13999 {
14000 SIGNDOC_Exception *ex = NULL;
14001 SIGNDOC_ByteArray *tempOutput = NULL;
14002 bool r;
14003 try
14004 {
14005 tempOutput = SIGNDOC_ByteArray_new (&ex);
14006 if (ex != NULL) SignDoc_throw (ex);
14007 r = (bool)SIGNDOC_Signature_getSigningCertificate (&ex, p, tempOutput);
14008 assignArray (aOutput, tempOutput);
14009 }
14010 catch (...)
14011 {
14012 if (tempOutput != NULL)
14013 SIGNDOC_ByteArray_delete (tempOutput);
14014 throw;
14015 }
14016 if (tempOutput != NULL)
14017 SIGNDOC_ByteArray_delete (tempOutput);
14018 if (ex != NULL) SignDoc_throw (ex);
14019 return r;
14020 }
14021
14034 std::string getSignerCommonName (Encoding aEncoding) const
14035 {
14036 SIGNDOC_Exception *ex = NULL;
14037 std::string r;
14038 char *s = SIGNDOC_Signature_getSignerCommonName (&ex, p, aEncoding);
14039 if (ex != NULL) SignDoc_throw (ex);
14040 try
14041 {
14042 r = s;
14043 }
14044 catch (...)
14045 {
14046 SIGNDOC_free (s);
14047 throw;
14048 }
14049 SIGNDOC_free (s);
14050 return r;
14051 }
14052
14062 const char *getSignerCommonNameUTF8 () const
14063 {
14064 SIGNDOC_Exception *ex = NULL;
14065 const char *r;
14066 r = SIGNDOC_Signature_getSignerCommonNameUTF8 (&ex, p);
14067 if (ex != NULL) SignDoc_throw (ex);
14068 return r;
14069 }
14070
14083 std::string getSignerEmail (Encoding aEncoding) const
14084 {
14085 SIGNDOC_Exception *ex = NULL;
14086 std::string r;
14087 char *s = SIGNDOC_Signature_getSignerEmail (&ex, p, aEncoding);
14088 if (ex != NULL) SignDoc_throw (ex);
14089 try
14090 {
14091 r = s;
14092 }
14093 catch (...)
14094 {
14095 SIGNDOC_free (s);
14096 throw;
14097 }
14098 SIGNDOC_free (s);
14099 return r;
14100 }
14101
14111 const char *getSignerEmailUTF8 () const
14112 {
14113 SIGNDOC_Exception *ex = NULL;
14114 const char *r;
14115 r = SIGNDOC_Signature_getSignerEmailUTF8 (&ex, p);
14116 if (ex != NULL) SignDoc_throw (ex);
14117 return r;
14118 }
14119
14130 const char *getTimeStamp () const
14131 {
14132 SIGNDOC_Exception *ex = NULL;
14133 const char *r;
14134 r = SIGNDOC_Signature_getTimeStamp (&ex, p);
14135 if (ex != NULL) SignDoc_throw (ex);
14136 return r;
14137 }
14138
14159 int getChangeCount () const
14160 {
14161 SIGNDOC_Exception *ex = NULL;
14162 int r;
14163 r = SIGNDOC_Signature_getChangeCount (&ex, p);
14164 if (ex != NULL) SignDoc_throw (ex);
14165 return r;
14166 }
14167
14180 bool getChange (int aIndex, SIGNDOC_PTR<SignDocChange> &aOutput) const
14181 {
14182 SIGNDOC_Exception *ex = NULL;
14183 SIGNDOC_Change *tempOutput = NULL;
14184 aOutput.reset ((SignDocChange*)NULL);
14185 bool r;
14186 try
14187 {
14188 r = (bool)SIGNDOC_Signature_getChange (&ex, p, aIndex, &tempOutput);
14189 if (tempOutput != NULL)
14190 {
14191 aOutput.reset (new SignDocChange (tempOutput));
14192 tempOutput = NULL;
14193 }
14194 }
14195 catch (...)
14196 {
14197 if (tempOutput != NULL)
14198 SIGNDOC_Change_delete (tempOutput);
14199 throw;
14200 }
14201 if (tempOutput != NULL)
14202 SIGNDOC_Change_delete (tempOutput);
14203 if (ex != NULL) SignDoc_throw (ex);
14204 return r;
14205 }
14206
14219 int getBiometricEncryption () const
14220 {
14221 SIGNDOC_Exception *ex = NULL;
14222 int r;
14223 r = SIGNDOC_Signature_getBiometricEncryption (&ex, p);
14224 if (ex != NULL) SignDoc_throw (ex);
14225 return r;
14226 }
14227
14228 protected:
14234 SignDocSignature ()
14235 : p (NULL)
14236 {
14237 }
14238
14239 private:
14243
14244 SignDocSignature (const SignDocSignature &);
14245
14249 SignDocSignature &operator= (const SignDocSignature &);
14250 public:
14255 SignDocSignature (SIGNDOC_Signature *aP) : p (aP) { }
14256
14261 SIGNDOC_Signature *getImpl () { return p; }
14262
14267 const SIGNDOC_Signature *getImpl () const { return p; }
14268
14273 void setImpl (SIGNDOC_Signature *aP) { SIGNDOC_Signature_delete (p); p = aP; }
14274
14275 private:
14276 SIGNDOC_Signature *p;
14277 };
14278
14442 class SignDocDocument
14443 {
14444 public:
14448 enum DocumentType
14449 {
14450 dt_unknown,
14451 dt_pdf,
14452 dt_tiff,
14453 dt_other,
14454 dt_fdf
14455 };
14456
14460 enum SaveFlags
14461 {
14467 sf_incremental = 0x01,
14468
14474 sf_remove_unused = 0x02,
14475
14486 sf_linearized = 0x04,
14487
14493 sf_pdf_1_4 = 0x08,
14494
14519 sf_pdfa_buttons = 0x10,
14520
14530 sf_auto_incremental = 0x20
14531 };
14532
14536 enum CopyToStreamFlags
14537 {
14543 ctsf_unsaved = 0x01
14544 };
14545
14550 enum SetFieldFlags
14551 {
14563 sff_font_fail = 0x01,
14564
14580 sff_move = 0x08,
14581
14599 sff_keep_ap = 0x10,
14600
14621 sff_update_ap = 0x20,
14622
14644 sff_fit_height_only = 0x40,
14645
14656 sff_force_border_width = 0x80,
14657
14664 sff_dont_break_lines = 0x100,
14665
14675 sff_auto_alignment = 0x200,
14676
14688 sff_ltr = 0x1000,
14689
14709 sff_rtl = 0x2000,
14710
14737 sff_default_ltr = 0x4000,
14738
14765 sff_default_rtl = 0x8000
14766 };
14767
14771 enum FlattenFieldsFlags
14772 {
14776 fff_include_signature_unsigned = 0x01,
14777
14781 fff_include_signature_signed = 0x02,
14782
14786 fff_include_hidden = 0x04,
14787
14798 fff_keep_structure = 0x08
14799 };
14800
14804 enum FlattenAnnotationsFlags
14805 {
14809 faf_include_hidden = 0x04,
14810
14821 faf_keep_structure = 0x08
14822 };
14823
14827 enum FindTextFlags
14828 {
14829 ftf_ignore_hspace = 0x0001,
14830 ftf_ignore_hyphenation = 0x0002,
14831 ftf_ignore_sequence = 0x0004
14832 };
14833
14837 enum ExportFlags
14838 {
14839 e_top = 0x01
14840 };
14841
14845 enum ImportFlags
14846 {
14847 i_atomic = 0x01
14848 };
14849
14855 enum ImportImageFlags
14856 {
14860 ii_keep_aspect_ratio = 0x01,
14861
14889 ii_brightest_transparent = 0x02
14890 };
14891
14895 enum KeepOrRemove
14896 {
14897 kor_keep,
14898 kor_remove
14899 };
14900
14906 enum ReturnCode
14907 {
14908 rc_ok,
14909 rc_invalid_argument,
14910 rc_field_not_found,
14911 rc_invalid_profile,
14912 rc_invalid_image,
14913 rc_type_mismatch,
14914 rc_font_not_found,
14915 rc_no_datablock,
14916 rc_not_supported,
14917 rc_io_error,
14918 rc_not_verified,
14919 rc_property_not_found,
14920 rc_page_not_found,
14921 rc_wrong_collection,
14922 rc_field_exists,
14923 rc_license_error,
14924 rc_unexpected_error,
14925 rc_cancelled,
14926 rc_no_biometric_data,
14927 rc_parameter_not_set,
14928 rc_field_not_signed,
14929 rc_invalid_signature,
14930 rc_annotation_not_found,
14931 rc_attachment_not_found,
14932 rc_attachment_exists,
14933 rc_no_certificate,
14934 rc_ambiguous_certificate,
14935 rc_not_allowed
14936 };
14937
14941 enum CheckAttachmentResult
14942 {
14943 car_match,
14944 car_no_checksum,
14945 car_mismatch
14946 };
14947
14951 enum HAlignment
14952 {
14956 ha_left,
14957
14961 ha_center,
14962
14966 ha_right,
14967
14973 ha_do_not_uses_this,
14974
14979 ha_auto
14980 };
14981
14985 enum VAlignment
14986 {
14990 va_top,
14991
14995 va_center,
14996
15000 va_bottom
15001 };
15002
15006 enum AddTextRectFlags
15007 {
15028 atrf_compat = 0x01,
15029
15039 atrf_ltr = 0x1000,
15040
15052 atrf_rtl = 0x2000,
15053
15072 atrf_default_ltr = 0x4000,
15073
15092 atrf_default_rtl = 0x8000
15093 };
15094
15100 enum Flags
15101 {
15118 f_relax_byte_range = 0x01,
15119
15139 f_ambiguous_button_value_empty = 0x02,
15140
15151 f_use_dss_only = 0x04,
15152
15158 f_no_kerning_for_standard_fonts = 0x08,
15159
15180 f_prevent_breaking_tagged_pdf = 0x10
15181 };
15182
15186 enum ShootInFootFlags
15187 {
15194 siff_allow_breaking_signatures = 0x01,
15195
15201 siff_allow_breaking_permissions = 0x02,
15202
15208 siff_allow_invalid_certificate = 0x04,
15209
15222 siff_allow_non_standard_external_fonts = 0x08,
15223
15236 siff_assume_ap_not_shared = 0x10,
15237
15251 siff_assume_ap_shared = 0x20,
15252
15260 siff_dont_verify_after_signing = 0x40,
15261
15284 siff_allow_all_curves = 0x80
15285 };
15286
15290 enum UpdateDSSFlags
15291 {
15295 udf_simulate = 0x01,
15296
15302 udf_vri = 0x02
15303 };
15304
15313 SignDocDocument ()
15314 : p (NULL)
15315 {
15316 }
15317
15323 ~SignDocDocument ()
15324 {
15325 SIGNDOC_Document_delete (p);
15326 }
15327
15333 DocumentType getType () const
15334 {
15335 SIGNDOC_Exception *ex = NULL;
15336 DocumentType r;
15337 r = (DocumentType)SIGNDOC_Document_getType (&ex, p);
15338 if (ex != NULL) SignDoc_throw (ex);
15339 return r;
15340 }
15341
15349 int getPageCount () const
15350 {
15351 SIGNDOC_Exception *ex = NULL;
15352 int r;
15353 r = SIGNDOC_Document_getPageCount (&ex, p);
15354 if (ex != NULL) SignDoc_throw (ex);
15355 return r;
15356 }
15357
15396 ReturnCode createSignatureParameters (Encoding aEncoding,
15397 const std::string &aFieldName,
15398 const std::string &aProfile,
15399 SIGNDOC_PTR<SignDocSignatureParameters> &aOutput)
15400 {
15401 SIGNDOC_Exception *ex = NULL;
15402 SIGNDOC_SignatureParameters *tempOutput = NULL;
15403 aOutput.reset ((SignDocSignatureParameters*)NULL);
15404 ReturnCode r;
15405 try
15406 {
15407 r = (ReturnCode)SIGNDOC_Document_createSignatureParameters (&ex, p, aEncoding, aFieldName.c_str (), aProfile.c_str (), &tempOutput);
15408 if (tempOutput != NULL)
15409 {
15410 aOutput.reset (new SignDocSignatureParameters (tempOutput));
15411 tempOutput = NULL;
15412 }
15413 }
15414 catch (...)
15415 {
15416 if (tempOutput != NULL)
15417 SIGNDOC_SignatureParameters_delete (tempOutput);
15418 throw;
15419 }
15420 if (tempOutput != NULL)
15421 SIGNDOC_SignatureParameters_delete (tempOutput);
15422 if (ex != NULL) SignDoc_throw (ex);
15423 return r;
15424 }
15425
15462 ReturnCode createSignatureParameters (const wchar_t *aFieldName,
15463 const wchar_t *aProfile,
15464 SIGNDOC_PTR<SignDocSignatureParameters> &aOutput)
15465 {
15466 SIGNDOC_Exception *ex = NULL;
15467 SIGNDOC_SignatureParameters *tempOutput = NULL;
15468 aOutput.reset ((SignDocSignatureParameters*)NULL);
15469 ReturnCode r;
15470 try
15471 {
15472 r = (ReturnCode)SIGNDOC_Document_createSignatureParametersW (&ex, p, aFieldName, aProfile, &tempOutput);
15473 if (tempOutput != NULL)
15474 {
15475 aOutput.reset (new SignDocSignatureParameters (tempOutput));
15476 tempOutput = NULL;
15477 }
15478 }
15479 catch (...)
15480 {
15481 if (tempOutput != NULL)
15482 SIGNDOC_SignatureParameters_delete (tempOutput);
15483 throw;
15484 }
15485 if (tempOutput != NULL)
15486 SIGNDOC_SignatureParameters_delete (tempOutput);
15487 if (ex != NULL) SignDoc_throw (ex);
15488 return r;
15489 }
15490
15510 ReturnCode createSignatureParametersForTimeStamp (SIGNDOC_PTR<SignDocSignatureParameters> &aOutput)
15511 {
15512 SIGNDOC_Exception *ex = NULL;
15513 SIGNDOC_SignatureParameters *tempOutput = NULL;
15514 aOutput.reset ((SignDocSignatureParameters*)NULL);
15515 ReturnCode r;
15516 try
15517 {
15518 r = (ReturnCode)SIGNDOC_Document_createSignatureParametersForTimeStamp (&ex, p, &tempOutput);
15519 if (tempOutput != NULL)
15520 {
15521 aOutput.reset (new SignDocSignatureParameters (tempOutput));
15522 tempOutput = NULL;
15523 }
15524 }
15525 catch (...)
15526 {
15527 if (tempOutput != NULL)
15528 SIGNDOC_SignatureParameters_delete (tempOutput);
15529 throw;
15530 }
15531 if (tempOutput != NULL)
15532 SIGNDOC_SignatureParameters_delete (tempOutput);
15533 if (ex != NULL) SignDoc_throw (ex);
15534 return r;
15535 }
15536
15552 ReturnCode getProfiles (Encoding aEncoding, const std::string &aFieldName,
15553 std::vector<std::string> &aOutput)
15554 {
15555 SIGNDOC_Exception *ex = NULL;
15556 SIGNDOC_StringArray *tempOutput = NULL;
15557 ReturnCode r;
15558 try
15559 {
15560 tempOutput = SIGNDOC_StringArray_new (&ex);
15561 if (ex != NULL) SignDoc_throw (ex);
15562 r = (ReturnCode)SIGNDOC_Document_getProfiles (&ex, p, aEncoding, aFieldName.c_str (), tempOutput);
15563 assignArray (aOutput, tempOutput);
15564 }
15565 catch (...)
15566 {
15567 if (tempOutput != NULL)
15568 SIGNDOC_StringArray_delete (tempOutput);
15569 throw;
15570 }
15571 if (tempOutput != NULL)
15572 SIGNDOC_StringArray_delete (tempOutput);
15573 if (ex != NULL) SignDoc_throw (ex);
15574 return r;
15575 }
15576
15637 ReturnCode addSignature (SignDocSignatureParameters *aSignatureParameters,
15638 const SignDocVerificationParameters *aVerificationParameters)
15639 {
15640 SIGNDOC_Exception *ex = NULL;
15641 ReturnCode r;
15642 r = (ReturnCode)SIGNDOC_Document_addSignature (&ex, p, aSignatureParameters == NULL ? NULL : aSignatureParameters->getImpl (), aVerificationParameters == NULL ? NULL : aVerificationParameters->getImpl ());
15643 if (ex != NULL) SignDoc_throw (ex);
15644 return r;
15645 }
15646
15664 ReturnCode getLastTimestamp (std::string &aTime)
15665 {
15666 SIGNDOC_Exception *ex = NULL;
15667 char *tempTime = NULL;
15668 ReturnCode r;
15669 try
15670 {
15671 r = (ReturnCode)SIGNDOC_Document_getLastTimestamp (&ex, p, &tempTime);
15672 if (tempTime != NULL)
15673 aTime = tempTime;
15674 }
15675 catch (...)
15676 {
15677 SIGNDOC_free (tempTime);
15678 throw;
15679 }
15680 SIGNDOC_free (tempTime);
15681 if (ex != NULL) SignDoc_throw (ex);
15682 return r;
15683 }
15684
15699 ReturnCode getPathname (Encoding aEncoding, std::string &aPath)
15700 {
15701 SIGNDOC_Exception *ex = NULL;
15702 char *tempPath = NULL;
15703 ReturnCode r;
15704 try
15705 {
15706 r = (ReturnCode)SIGNDOC_Document_getPathname (&ex, p, aEncoding, &tempPath);
15707 if (tempPath != NULL)
15708 aPath = tempPath;
15709 }
15710 catch (...)
15711 {
15712 SIGNDOC_free (tempPath);
15713 throw;
15714 }
15715 SIGNDOC_free (tempPath);
15716 if (ex != NULL) SignDoc_throw (ex);
15717 return r;
15718 }
15719
15731 int getAvailableMethods ()
15732 {
15733 SIGNDOC_Exception *ex = NULL;
15734 int r;
15735 r = SIGNDOC_Document_getAvailableMethods (&ex, p);
15736 if (ex != NULL) SignDoc_throw (ex);
15737 return r;
15738 }
15739
15749 int getSignatureCount ()
15750 {
15751 SIGNDOC_Exception *ex = NULL;
15752 int r;
15753 r = SIGNDOC_Document_getSignatureCount (&ex, p);
15754 if (ex != NULL) SignDoc_throw (ex);
15755 return r;
15756 }
15757
15777 ReturnCode getSignature (int aIndex, SIGNDOC_PTR<SignDocSignature> &aOutput)
15778 {
15779 SIGNDOC_Exception *ex = NULL;
15780 SIGNDOC_Signature *tempOutput = NULL;
15781 aOutput.reset ((SignDocSignature*)NULL);
15782 ReturnCode r;
15783 try
15784 {
15785 r = (ReturnCode)SIGNDOC_Document_getSignature (&ex, p, aIndex, &tempOutput);
15786 if (tempOutput != NULL)
15787 {
15788 aOutput.reset (new SignDocSignature (tempOutput));
15789 tempOutput = NULL;
15790 }
15791 }
15792 catch (...)
15793 {
15794 if (tempOutput != NULL)
15795 SIGNDOC_Signature_delete (tempOutput);
15796 throw;
15797 }
15798 if (tempOutput != NULL)
15799 SIGNDOC_Signature_delete (tempOutput);
15800 if (ex != NULL) SignDoc_throw (ex);
15801 return r;
15802 }
15803
15821 ReturnCode verifySignature (Encoding aEncoding,
15822 const std::string &aFieldName,
15823 SIGNDOC_PTR<SignDocVerificationResult> &aOutput)
15824 {
15825 SIGNDOC_Exception *ex = NULL;
15826 SIGNDOC_VerificationResult *tempOutput = NULL;
15827 aOutput.reset ((SignDocVerificationResult*)NULL);
15828 ReturnCode r;
15829 try
15830 {
15831 r = (ReturnCode)SIGNDOC_Document_verifySignature (&ex, p, aEncoding, aFieldName.c_str (), &tempOutput);
15832 if (tempOutput != NULL)
15833 {
15834 aOutput.reset (makeSignDocVerificationResult (tempOutput));
15835 tempOutput = NULL;
15836 }
15837 }
15838 catch (...)
15839 {
15840 if (tempOutput != NULL)
15841 SIGNDOC_VerificationResult_delete (tempOutput);
15842 throw;
15843 }
15844 if (tempOutput != NULL)
15845 SIGNDOC_VerificationResult_delete (tempOutput);
15846 if (ex != NULL) SignDoc_throw (ex);
15847 return r;
15848 }
15849
15865 ReturnCode verifySignature (const wchar_t *aFieldName,
15866 SIGNDOC_PTR<SignDocVerificationResult> &aOutput)
15867 {
15868 SIGNDOC_Exception *ex = NULL;
15869 SIGNDOC_VerificationResult *tempOutput = NULL;
15870 aOutput.reset ((SignDocVerificationResult*)NULL);
15871 ReturnCode r;
15872 try
15873 {
15874 r = (ReturnCode)SIGNDOC_Document_verifySignatureW (&ex, p, aFieldName, &tempOutput);
15875 if (tempOutput != NULL)
15876 {
15877 aOutput.reset (makeSignDocVerificationResult (tempOutput));
15878 tempOutput = NULL;
15879 }
15880 }
15881 catch (...)
15882 {
15883 if (tempOutput != NULL)
15884 SIGNDOC_VerificationResult_delete (tempOutput);
15885 throw;
15886 }
15887 if (tempOutput != NULL)
15888 SIGNDOC_VerificationResult_delete (tempOutput);
15889 if (ex != NULL) SignDoc_throw (ex);
15890 return r;
15891 }
15892
15920 ReturnCode verifySignature2 (const SignDocSignature &aSignature,
15921 SIGNDOC_PTR<SignDocVerificationResult> &aOutput)
15922 {
15923 SIGNDOC_Exception *ex = NULL;
15924 SIGNDOC_VerificationResult *tempOutput = NULL;
15925 aOutput.reset ((SignDocVerificationResult*)NULL);
15926 ReturnCode r;
15927 try
15928 {
15929 r = (ReturnCode)SIGNDOC_Document_verifySignature2 (&ex, p, aSignature.getImpl (), &tempOutput);
15930 if (tempOutput != NULL)
15931 {
15932 aOutput.reset (makeSignDocVerificationResult (tempOutput));
15933 tempOutput = NULL;
15934 }
15935 }
15936 catch (...)
15937 {
15938 if (tempOutput != NULL)
15939 SIGNDOC_VerificationResult_delete (tempOutput);
15940 throw;
15941 }
15942 if (tempOutput != NULL)
15943 SIGNDOC_VerificationResult_delete (tempOutput);
15944 if (ex != NULL) SignDoc_throw (ex);
15945 return r;
15946 }
15947
15962 ReturnCode clearSignature (Encoding aEncoding, const std::string &aFieldName)
15963 {
15964 SIGNDOC_Exception *ex = NULL;
15965 ReturnCode r;
15966 r = (ReturnCode)SIGNDOC_Document_clearSignature (&ex, p, aEncoding, aFieldName.c_str ());
15967 if (ex != NULL) SignDoc_throw (ex);
15968 return r;
15969 }
15970
15980 ReturnCode clearAllSignatures ()
15981 {
15982 SIGNDOC_Exception *ex = NULL;
15983 ReturnCode r;
15984 r = (ReturnCode)SIGNDOC_Document_clearAllSignatures (&ex, p);
15985 if (ex != NULL) SignDoc_throw (ex);
15986 return r;
15987 }
15988
15998 ReturnCode clearApprovalSignatures ()
15999 {
16000 SIGNDOC_Exception *ex = NULL;
16001 ReturnCode r;
16002 r = (ReturnCode)SIGNDOC_Document_clearApprovalSignatures (&ex, p);
16003 if (ex != NULL) SignDoc_throw (ex);
16004 return r;
16005 }
16006
16039 ReturnCode updateDSS (const SignDocVerificationParameters *aParameters,
16040 unsigned aFlags, int &aCount)
16041 {
16042 SIGNDOC_Exception *ex = NULL;
16043 ReturnCode r;
16044 r = (ReturnCode)SIGNDOC_Document_updateDSS (&ex, p, aParameters == NULL ? NULL : aParameters->getImpl (), aFlags, &aCount);
16045 if (ex != NULL) SignDoc_throw (ex);
16046 return r;
16047 }
16048
16087 ReturnCode updateDSS2 (Encoding aEncoding, const std::string &aFieldName,
16088 const SignDocVerificationParameters *aParameters,
16089 unsigned aFlags)
16090 {
16091 SIGNDOC_Exception *ex = NULL;
16092 ReturnCode r;
16093 r = (ReturnCode)SIGNDOC_Document_updateDSS2 (&ex, p, aEncoding, aFieldName.c_str (), aParameters == NULL ? NULL : aParameters->getImpl (), aFlags);
16094 if (ex != NULL) SignDoc_throw (ex);
16095 return r;
16096 }
16097
16117 ReturnCode saveToStream (OutputStream &aStream, int aFlags)
16118 {
16119 SIGNDOC_Exception *ex = NULL;
16120 ReturnCode r;
16121 r = (ReturnCode)SIGNDOC_Document_saveToStream (&ex, p, aStream.getImpl (), aFlags);
16122 if (ex != NULL) SignDoc_throw (ex);
16123 return r;
16124 }
16125
16157 ReturnCode saveToFile (Encoding aEncoding, const char *aPath, int aFlags)
16158 {
16159 SIGNDOC_Exception *ex = NULL;
16160 ReturnCode r;
16161 r = (ReturnCode)SIGNDOC_Document_saveToFile (&ex, p, aEncoding, aPath, aFlags);
16162 if (ex != NULL) SignDoc_throw (ex);
16163 return r;
16164 }
16165
16191 ReturnCode saveToFile (const wchar_t *aPath, int aFlags)
16192 {
16193 SIGNDOC_Exception *ex = NULL;
16194 ReturnCode r;
16195 r = (ReturnCode)SIGNDOC_Document_saveToFileW (&ex, p, aPath, aFlags);
16196 if (ex != NULL) SignDoc_throw (ex);
16197 return r;
16198 }
16199
16226 ReturnCode copyToStream (OutputStream &aStream, unsigned aFlags)
16227 {
16228 SIGNDOC_Exception *ex = NULL;
16229 ReturnCode r;
16230 r = (ReturnCode)SIGNDOC_Document_copyToStream (&ex, p, aStream.getImpl (), aFlags);
16231 if (ex != NULL) SignDoc_throw (ex);
16232 return r;
16233 }
16234
16253 ReturnCode copyAsSignedToStream (Encoding aEncoding,
16254 const std::string &aFieldName,
16255 OutputStream &aStream)
16256 {
16257 SIGNDOC_Exception *ex = NULL;
16258 ReturnCode r;
16259 r = (ReturnCode)SIGNDOC_Document_copyAsSignedToStream (&ex, p, aEncoding, aFieldName.c_str (), aStream.getImpl ());
16260 if (ex != NULL) SignDoc_throw (ex);
16261 return r;
16262 }
16263
16279 ReturnCode getSaveToStreamFlags (int &aOutput)
16280 {
16281 SIGNDOC_Exception *ex = NULL;
16282 ReturnCode r;
16283 r = (ReturnCode)SIGNDOC_Document_getSaveToStreamFlags (&ex, p, &aOutput);
16284 if (ex != NULL) SignDoc_throw (ex);
16285 return r;
16286 }
16287
16302 ReturnCode getSaveToFileFlags (int &aOutput)
16303 {
16304 SIGNDOC_Exception *ex = NULL;
16305 ReturnCode r;
16306 r = (ReturnCode)SIGNDOC_Document_getSaveToFileFlags (&ex, p, &aOutput);
16307 if (ex != NULL) SignDoc_throw (ex);
16308 return r;
16309 }
16310
16324 ReturnCode getRequiredSaveToFileFlags (int &aOutput)
16325 {
16326 SIGNDOC_Exception *ex = NULL;
16327 ReturnCode r;
16328 r = (ReturnCode)SIGNDOC_Document_getRequiredSaveToFileFlags (&ex, p, &aOutput);
16329 if (ex != NULL) SignDoc_throw (ex);
16330 return r;
16331 }
16332
16350 ReturnCode getFields (int aTypes, std::vector<SignDocField> &aOutput)
16351 {
16352 SIGNDOC_Exception *ex = NULL;
16353 SIGNDOC_FieldArray *tempOutput = NULL;
16354 ReturnCode r;
16355 try
16356 {
16357 tempOutput = SIGNDOC_FieldArray_new (&ex);
16358 if (ex != NULL) SignDoc_throw (ex);
16359 r = (ReturnCode)SIGNDOC_Document_getFields (&ex, p, aTypes, tempOutput);
16360 assignArray (aOutput, tempOutput);
16361 }
16362 catch (...)
16363 {
16364 if (tempOutput != NULL)
16365 SIGNDOC_FieldArray_delete (tempOutput);
16366 throw;
16367 }
16368 if (tempOutput != NULL)
16369 SIGNDOC_FieldArray_delete (tempOutput);
16370 if (ex != NULL) SignDoc_throw (ex);
16371 return r;
16372 }
16373
16400 ReturnCode getFieldsOfPage (int aPage, int aTypes,
16401 std::vector<SignDocField> &aOutput)
16402 {
16403 SIGNDOC_Exception *ex = NULL;
16404 SIGNDOC_FieldArray *tempOutput = NULL;
16405 ReturnCode r;
16406 try
16407 {
16408 tempOutput = SIGNDOC_FieldArray_new (&ex);
16409 if (ex != NULL) SignDoc_throw (ex);
16410 r = (ReturnCode)SIGNDOC_Document_getFieldsOfPage (&ex, p, aPage, aTypes, tempOutput);
16411 assignArray (aOutput, tempOutput);
16412 }
16413 catch (...)
16414 {
16415 if (tempOutput != NULL)
16416 SIGNDOC_FieldArray_delete (tempOutput);
16417 throw;
16418 }
16419 if (tempOutput != NULL)
16420 SIGNDOC_FieldArray_delete (tempOutput);
16421 if (ex != NULL) SignDoc_throw (ex);
16422 return r;
16423 }
16424
16439 ReturnCode getField (Encoding aEncoding, const std::string &aName,
16440 SignDocField &aOutput)
16441 {
16442 SIGNDOC_Exception *ex = NULL;
16443 ReturnCode r;
16444 r = (ReturnCode)SIGNDOC_Document_getField (&ex, p, aEncoding, aName.c_str (), aOutput.getImpl ());
16445 if (ex != NULL) SignDoc_throw (ex);
16446 return r;
16447 }
16448
16490 ReturnCode setField (SignDocField &aField, unsigned aFlags)
16491 {
16492 SIGNDOC_Exception *ex = NULL;
16493 ReturnCode r;
16494 r = (ReturnCode)SIGNDOC_Document_setField (&ex, p, aField.getImpl (), aFlags);
16495 if (ex != NULL) SignDoc_throw (ex);
16496 return r;
16497 }
16498
16545 ReturnCode addField (SignDocField &aField, unsigned aFlags)
16546 {
16547 SIGNDOC_Exception *ex = NULL;
16548 ReturnCode r;
16549 r = (ReturnCode)SIGNDOC_Document_addField (&ex, p, aField.getImpl (), aFlags);
16550 if (ex != NULL) SignDoc_throw (ex);
16551 return r;
16552 }
16553
16566 ReturnCode removeField (Encoding aEncoding, const std::string &aName)
16567 {
16568 SIGNDOC_Exception *ex = NULL;
16569 ReturnCode r;
16570 r = (ReturnCode)SIGNDOC_Document_removeField (&ex, p, aEncoding, aName.c_str ());
16571 if (ex != NULL) SignDoc_throw (ex);
16572 return r;
16573 }
16574
16602 ReturnCode flattenField (Encoding aEncoding, const std::string &aName,
16603 int aWidget)
16604 {
16605 SIGNDOC_Exception *ex = NULL;
16606 ReturnCode r;
16607 r = (ReturnCode)SIGNDOC_Document_flattenField (&ex, p, aEncoding, aName.c_str (), aWidget);
16608 if (ex != NULL) SignDoc_throw (ex);
16609 return r;
16610 }
16611
16643 ReturnCode flattenFields (int aFirstPage, int aLastPage, unsigned aFlags)
16644 {
16645 SIGNDOC_Exception *ex = NULL;
16646 ReturnCode r;
16647 r = (ReturnCode)SIGNDOC_Document_flattenFields (&ex, p, aFirstPage, aLastPage, aFlags);
16648 if (ex != NULL) SignDoc_throw (ex);
16649 return r;
16650 }
16651
16671 ReturnCode exportFields (OutputStream &aStream, int aFlags)
16672 {
16673 SIGNDOC_Exception *ex = NULL;
16674 ReturnCode r;
16675 r = (ReturnCode)SIGNDOC_Document_exportFields (&ex, p, aStream.getImpl (), aFlags);
16676 if (ex != NULL) SignDoc_throw (ex);
16677 return r;
16678 }
16679
16694 ReturnCode applyFdf (Encoding aEncoding, const char *aPath, unsigned aFlags)
16695 {
16696 SIGNDOC_Exception *ex = NULL;
16697 ReturnCode r;
16698 r = (ReturnCode)SIGNDOC_Document_applyFdf (&ex, p, aEncoding, aPath, aFlags);
16699 if (ex != NULL) SignDoc_throw (ex);
16700 return r;
16701 }
16702
16714 ReturnCode applyFdf (const wchar_t *aPath, unsigned aFlags)
16715 {
16716 SIGNDOC_Exception *ex = NULL;
16717 ReturnCode r;
16718 r = (ReturnCode)SIGNDOC_Document_applyFdfW (&ex, p, aPath, aFlags);
16719 if (ex != NULL) SignDoc_throw (ex);
16720 return r;
16721 }
16722
16732 ReturnCode getTextFieldAttributes (SignDocTextFieldAttributes &aOutput)
16733 {
16734 SIGNDOC_Exception *ex = NULL;
16735 ReturnCode r;
16736 r = (ReturnCode)SIGNDOC_Document_getTextFieldAttributes (&ex, p, aOutput.getImpl ());
16737 if (ex != NULL) SignDoc_throw (ex);
16738 return r;
16739 }
16740
16759 ReturnCode setTextFieldAttributes (SignDocTextFieldAttributes &aData)
16760 {
16761 SIGNDOC_Exception *ex = NULL;
16762 ReturnCode r;
16763 r = (ReturnCode)SIGNDOC_Document_setTextFieldAttributes (&ex, p, aData.getImpl ());
16764 if (ex != NULL) SignDoc_throw (ex);
16765 return r;
16766 }
16767
16837 ReturnCode getProperties (const std::string &aCollection,
16838 std::vector<SignDocProperty> &aOutput)
16839 {
16840 SIGNDOC_Exception *ex = NULL;
16841 SIGNDOC_PropertyArray *tempOutput = NULL;
16842 ReturnCode r;
16843 try
16844 {
16845 tempOutput = SIGNDOC_PropertyArray_new (&ex);
16846 if (ex != NULL) SignDoc_throw (ex);
16847 r = (ReturnCode)SIGNDOC_Document_getProperties (&ex, p, aCollection.c_str (), tempOutput);
16848 assignArray (aOutput, tempOutput);
16849 }
16850 catch (...)
16851 {
16852 if (tempOutput != NULL)
16853 SIGNDOC_PropertyArray_delete (tempOutput);
16854 throw;
16855 }
16856 if (tempOutput != NULL)
16857 SIGNDOC_PropertyArray_delete (tempOutput);
16858 if (ex != NULL) SignDoc_throw (ex);
16859 return r;
16860 }
16861
16878 ReturnCode getIntegerProperty (Encoding aEncoding,
16879 const std::string &aCollection,
16880 const std::string &aName, long &aValue)
16881 {
16882 SIGNDOC_Exception *ex = NULL;
16883 ReturnCode r;
16884 r = (ReturnCode)SIGNDOC_Document_getIntegerProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str (), &aValue);
16885 if (ex != NULL) SignDoc_throw (ex);
16886 return r;
16887 }
16888
16906 ReturnCode getStringProperty (Encoding aEncoding,
16907 const std::string &aCollection,
16908 const std::string &aName, std::string &aValue)
16909 {
16910 SIGNDOC_Exception *ex = NULL;
16911 char *tempValue = NULL;
16912 ReturnCode r;
16913 try
16914 {
16915 r = (ReturnCode)SIGNDOC_Document_getStringProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str (), &tempValue);
16916 if (tempValue != NULL)
16917 aValue = tempValue;
16918 }
16919 catch (...)
16920 {
16921 SIGNDOC_free (tempValue);
16922 throw;
16923 }
16924 SIGNDOC_free (tempValue);
16925 if (ex != NULL) SignDoc_throw (ex);
16926 return r;
16927 }
16928
16945 ReturnCode getBooleanProperty (Encoding aEncoding,
16946 const std::string &aCollection,
16947 const std::string &aName, bool &aValue)
16948 {
16949 SIGNDOC_Exception *ex = NULL;
16950 SIGNDOC_Boolean tempValue = 0;
16951 ReturnCode r;
16952 try
16953 {
16954 r = (ReturnCode)SIGNDOC_Document_getBooleanProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str (), &tempValue);
16955 aValue = (bool )tempValue;
16956 }
16957 catch (...)
16958 {
16959 throw;
16960 }
16961 if (ex != NULL) SignDoc_throw (ex);
16962 return r;
16963 }
16964
16983 ReturnCode setIntegerProperty (Encoding aEncoding,
16984 const std::string &aCollection,
16985 const std::string &aName, long aValue)
16986 {
16987 SIGNDOC_Exception *ex = NULL;
16988 ReturnCode r;
16989 r = (ReturnCode)SIGNDOC_Document_setIntegerProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str (), aValue);
16990 if (ex != NULL) SignDoc_throw (ex);
16991 return r;
16992 }
16993
17013 ReturnCode setStringProperty (Encoding aEncoding,
17014 const std::string &aCollection,
17015 const std::string &aName,
17016 const std::string &aValue)
17017 {
17018 SIGNDOC_Exception *ex = NULL;
17019 ReturnCode r;
17020 r = (ReturnCode)SIGNDOC_Document_setStringProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str (), aValue.c_str ());
17021 if (ex != NULL) SignDoc_throw (ex);
17022 return r;
17023 }
17024
17043 ReturnCode setBooleanProperty (Encoding aEncoding,
17044 const std::string &aCollection,
17045 const std::string &aName, bool aValue)
17046 {
17047 SIGNDOC_Exception *ex = NULL;
17048 ReturnCode r;
17049 r = (ReturnCode)SIGNDOC_Document_setBooleanProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str (), aValue);
17050 if (ex != NULL) SignDoc_throw (ex);
17051 return r;
17052 }
17053
17069 ReturnCode removeProperty (Encoding aEncoding,
17070 const std::string &aCollection,
17071 const std::string &aName)
17072 {
17073 SIGNDOC_Exception *ex = NULL;
17074 ReturnCode r;
17075 r = (ReturnCode)SIGNDOC_Document_removeProperty (&ex, p, aEncoding, aCollection.c_str (), aName.c_str ());
17076 if (ex != NULL) SignDoc_throw (ex);
17077 return r;
17078 }
17079
17100 ReturnCode exportProperties (const std::string &aCollection,
17101 OutputStream &aStream, int aFlags)
17102 {
17103 SIGNDOC_Exception *ex = NULL;
17104 ReturnCode r;
17105 r = (ReturnCode)SIGNDOC_Document_exportProperties (&ex, p, aCollection.c_str (), aStream.getImpl (), aFlags);
17106 if (ex != NULL) SignDoc_throw (ex);
17107 return r;
17108 }
17109
17132 ReturnCode importProperties (const std::string &aCollection,
17133 InputStream &aStream, int aFlags)
17134 {
17135 SIGNDOC_Exception *ex = NULL;
17136 ReturnCode r;
17137 r = (ReturnCode)SIGNDOC_Document_importProperties (&ex, p, aCollection.c_str (), aStream.getImpl (), aFlags);
17138 if (ex != NULL) SignDoc_throw (ex);
17139 return r;
17140 }
17141
17161 ReturnCode getResolution (int aPage, double &aResX, double &aResY)
17162 {
17163 SIGNDOC_Exception *ex = NULL;
17164 ReturnCode r;
17165 r = (ReturnCode)SIGNDOC_Document_getResolution (&ex, p, aPage, &aResX, &aResY);
17166 if (ex != NULL) SignDoc_throw (ex);
17167 return r;
17168 }
17169
17191 ReturnCode getConversionFactors (int aPage, double &aFactorX,
17192 double &aFactorY)
17193 {
17194 SIGNDOC_Exception *ex = NULL;
17195 ReturnCode r;
17196 r = (ReturnCode)SIGNDOC_Document_getConversionFactors (&ex, p, aPage, &aFactorX, &aFactorY);
17197 if (ex != NULL) SignDoc_throw (ex);
17198 return r;
17199 }
17200
17218 ReturnCode getPageSize (int aPage, double &aWidth, double &aHeight)
17219 {
17220 SIGNDOC_Exception *ex = NULL;
17221 ReturnCode r;
17222 r = (ReturnCode)SIGNDOC_Document_getPageSize (&ex, p, aPage, &aWidth, &aHeight);
17223 if (ex != NULL) SignDoc_throw (ex);
17224 return r;
17225 }
17226
17241 ReturnCode getBitsPerPixel (int aPage, int &aBPP)
17242 {
17243 SIGNDOC_Exception *ex = NULL;
17244 ReturnCode r;
17245 r = (ReturnCode)SIGNDOC_Document_getBitsPerPixel (&ex, p, aPage, &aBPP);
17246 if (ex != NULL) SignDoc_throw (ex);
17247 return r;
17248 }
17249
17268 ReturnCode computeZoom (double &aOutput,
17269 const SignDocRenderParameters &aParams)
17270 {
17271 SIGNDOC_Exception *ex = NULL;
17272 ReturnCode r;
17273 r = (ReturnCode)SIGNDOC_Document_computeZoom (&ex, p, &aOutput, aParams.getImpl ());
17274 if (ex != NULL) SignDoc_throw (ex);
17275 return r;
17276 }
17277
17299 ReturnCode convCanvasPointToPagePoint (Point &aPoint,
17300 const SignDocRenderParameters &aParams)
17301 {
17302 SIGNDOC_Exception *ex = NULL;
17303 ReturnCode r;
17304 r = (ReturnCode)SIGNDOC_Document_convCanvasPointToPagePoint (&ex, p, (SIGNDOC_Point*)&aPoint, aParams.getImpl ());
17305 if (ex != NULL) SignDoc_throw (ex);
17306 return r;
17307 }
17308
17329 ReturnCode convPagePointToCanvasPoint (Point &aPoint,
17330 const SignDocRenderParameters &aParams)
17331 {
17332 SIGNDOC_Exception *ex = NULL;
17333 ReturnCode r;
17334 r = (ReturnCode)SIGNDOC_Document_convPagePointToCanvasPoint (&ex, p, (SIGNDOC_Point*)&aPoint, aParams.getImpl ());
17335 if (ex != NULL) SignDoc_throw (ex);
17336 return r;
17337 }
17338
17365 ReturnCode renderPageAsImage (std::vector<unsigned char> &aImage,
17366 SignDocRenderOutput &aOutput,
17367 const SignDocRenderParameters &aRenderParameters,
17368 const SignDocVerificationParameters *aVerificationParameters,
17369 const Rect *aClipRect)
17370 {
17371 SIGNDOC_Exception *ex = NULL;
17372 SIGNDOC_ByteArray *tempImage = NULL;
17373 ReturnCode r;
17374 try
17375 {
17376 tempImage = SIGNDOC_ByteArray_new (&ex);
17377 if (ex != NULL) SignDoc_throw (ex);
17378 r = (ReturnCode)SIGNDOC_Document_renderPageAsImage (&ex, p, tempImage, (SIGNDOC_RenderOutput*)&aOutput, aRenderParameters.getImpl (), aVerificationParameters == NULL ? NULL : aVerificationParameters->getImpl (), (const SIGNDOC_Rect*)aClipRect);
17379 assignArray (aImage, tempImage);
17380 }
17381 catch (...)
17382 {
17383 if (tempImage != NULL)
17384 SIGNDOC_ByteArray_delete (tempImage);
17385 throw;
17386 }
17387 if (tempImage != NULL)
17388 SIGNDOC_ByteArray_delete (tempImage);
17389 if (ex != NULL) SignDoc_throw (ex);
17390 return r;
17391 }
17392
17410 ReturnCode getRenderedSize (SignDocRenderOutput &aOutput,
17411 const SignDocRenderParameters &aRenderParameters)
17412 {
17413 SIGNDOC_Exception *ex = NULL;
17414 ReturnCode r;
17415 r = (ReturnCode)SIGNDOC_Document_getRenderedSize (&ex, p, (SIGNDOC_RenderOutput*)&aOutput, aRenderParameters.getImpl ());
17416 if (ex != NULL) SignDoc_throw (ex);
17417 return r;
17418 }
17419
17436 SignDocAnnotation *createLineAnnotation (const Point &aStart,
17437 const Point &aEnd)
17438 {
17439 SIGNDOC_Exception *ex = NULL;
17440 SIGNDOC_Annotation *r;
17441 r = SIGNDOC_Document_createLineAnnotation (&ex, p, (const SIGNDOC_Point*)&aStart, (const SIGNDOC_Point*)&aEnd);
17442 if (ex != NULL) SignDoc_throw (ex);
17443 if (r == NULL)
17444 return NULL;
17445 try
17446 {
17447 return new SignDocAnnotation (r);
17448 }
17449 catch (...)
17450 {
17451 SIGNDOC_Annotation_delete (r);
17452 throw;
17453 }
17454 }
17455
17473 SignDocAnnotation *createLineAnnotation (double aStartX, double aStartY,
17474 double aEndX, double aEndY)
17475 {
17476 SIGNDOC_Exception *ex = NULL;
17477 SIGNDOC_Annotation *r;
17478 r = SIGNDOC_Document_createLineAnnotationXY (&ex, p, aStartX, aStartY, aEndX, aEndY);
17479 if (ex != NULL) SignDoc_throw (ex);
17480 if (r == NULL)
17481 return NULL;
17482 try
17483 {
17484 return new SignDocAnnotation (r);
17485 }
17486 catch (...)
17487 {
17488 SIGNDOC_Annotation_delete (r);
17489 throw;
17490 }
17491 }
17492
17505 SignDocAnnotation *createScribbleAnnotation ()
17506 {
17507 SIGNDOC_Exception *ex = NULL;
17508 SIGNDOC_Annotation *r;
17509 r = SIGNDOC_Document_createScribbleAnnotation (&ex, p);
17510 if (ex != NULL) SignDoc_throw (ex);
17511 if (r == NULL)
17512 return NULL;
17513 try
17514 {
17515 return new SignDocAnnotation (r);
17516 }
17517 catch (...)
17518 {
17519 SIGNDOC_Annotation_delete (r);
17520 throw;
17521 }
17522 }
17523
17539 SignDocAnnotation *createFreeTextAnnotation (const Point &aLowerLeft,
17540 const Point &aUpperRight)
17541 {
17542 SIGNDOC_Exception *ex = NULL;
17543 SIGNDOC_Annotation *r;
17544 r = SIGNDOC_Document_createFreeTextAnnotation (&ex, p, (const SIGNDOC_Point*)&aLowerLeft, (const SIGNDOC_Point*)&aUpperRight);
17545 if (ex != NULL) SignDoc_throw (ex);
17546 if (r == NULL)
17547 return NULL;
17548 try
17549 {
17550 return new SignDocAnnotation (r);
17551 }
17552 catch (...)
17553 {
17554 SIGNDOC_Annotation_delete (r);
17555 throw;
17556 }
17557 }
17558
17576 SignDocAnnotation *createFreeTextAnnotation (double aX0, double aY0,
17577 double aX1, double aY1)
17578 {
17579 SIGNDOC_Exception *ex = NULL;
17580 SIGNDOC_Annotation *r;
17581 r = SIGNDOC_Document_createFreeTextAnnotationXY (&ex, p, aX0, aY0, aX1, aY1);
17582 if (ex != NULL) SignDoc_throw (ex);
17583 if (r == NULL)
17584 return NULL;
17585 try
17586 {
17587 return new SignDocAnnotation (r);
17588 }
17589 catch (...)
17590 {
17591 SIGNDOC_Annotation_delete (r);
17592 throw;
17593 }
17594 }
17595
17609 ReturnCode addAnnotation (int aPage, const SignDocAnnotation *aAnnot)
17610 {
17611 SIGNDOC_Exception *ex = NULL;
17612 ReturnCode r;
17613 r = (ReturnCode)SIGNDOC_Document_addAnnotation (&ex, p, aPage, aAnnot == NULL ? NULL : aAnnot->getImpl ());
17614 if (ex != NULL) SignDoc_throw (ex);
17615 return r;
17616 }
17617
17632 ReturnCode getAnnotations (Encoding aEncoding, int aPage,
17633 std::vector<std::string> &aOutput)
17634 {
17635 SIGNDOC_Exception *ex = NULL;
17636 SIGNDOC_StringArray *tempOutput = NULL;
17637 ReturnCode r;
17638 try
17639 {
17640 tempOutput = SIGNDOC_StringArray_new (&ex);
17641 if (ex != NULL) SignDoc_throw (ex);
17642 r = (ReturnCode)SIGNDOC_Document_getAnnotations (&ex, p, aEncoding, aPage, tempOutput);
17643 assignArray (aOutput, tempOutput);
17644 }
17645 catch (...)
17646 {
17647 if (tempOutput != NULL)
17648 SIGNDOC_StringArray_delete (tempOutput);
17649 throw;
17650 }
17651 if (tempOutput != NULL)
17652 SIGNDOC_StringArray_delete (tempOutput);
17653 if (ex != NULL) SignDoc_throw (ex);
17654 return r;
17655 }
17656
17673 ReturnCode getAnnotation (Encoding aEncoding, int aPage,
17674 const std::string &aName,
17675 SIGNDOC_PTR<SignDocAnnotation> &aOutput)
17676 {
17677 SIGNDOC_Exception *ex = NULL;
17678 SIGNDOC_Annotation *tempOutput = NULL;
17679 aOutput.reset ((SignDocAnnotation*)NULL);
17680 ReturnCode r;
17681 try
17682 {
17683 r = (ReturnCode)SIGNDOC_Document_getAnnotation (&ex, p, aEncoding, aPage, aName.c_str (), &tempOutput);
17684 if (tempOutput != NULL)
17685 {
17686 aOutput.reset (new SignDocAnnotation (tempOutput));
17687 tempOutput = NULL;
17688 }
17689 }
17690 catch (...)
17691 {
17692 if (tempOutput != NULL)
17693 SIGNDOC_Annotation_delete (tempOutput);
17694 throw;
17695 }
17696 if (tempOutput != NULL)
17697 SIGNDOC_Annotation_delete (tempOutput);
17698 if (ex != NULL) SignDoc_throw (ex);
17699 return r;
17700 }
17701
17714 ReturnCode removeAnnotation (Encoding aEncoding, int aPage,
17715 const std::string &aName)
17716 {
17717 SIGNDOC_Exception *ex = NULL;
17718 ReturnCode r;
17719 r = (ReturnCode)SIGNDOC_Document_removeAnnotation (&ex, p, aEncoding, aPage, aName.c_str ());
17720 if (ex != NULL) SignDoc_throw (ex);
17721 return r;
17722 }
17723
17758 ReturnCode addText (Encoding aEncoding, const std::string &aText, int aPage,
17759 double aX, double aY, const std::string &aFontName,
17760 double aFontSize, const SignDocColor &aTextColor,
17761 double aOpacity, int aFlags)
17762 {
17763 SIGNDOC_Exception *ex = NULL;
17764 ReturnCode r;
17765 r = (ReturnCode)SIGNDOC_Document_addText (&ex, p, aEncoding, aText.c_str (), aPage, aX, aY, aFontName.c_str (), aFontSize, aTextColor.getImpl (), aOpacity, aFlags);
17766 if (ex != NULL) SignDoc_throw (ex);
17767 return r;
17768 }
17769
17805 ReturnCode addTextRect (Encoding aEncoding, const std::string &aText,
17806 int aPage, double aX0, double aY0, double aX1,
17807 double aY1, const std::string &aFontName,
17808 double aFontSize, double aLineSkip,
17809 const SignDocColor &aTextColor, double aOpacity,
17810 HAlignment aHAlignment, VAlignment aVAlignment,
17811 int aFlags)
17812 {
17813 SIGNDOC_Exception *ex = NULL;
17814 ReturnCode r;
17815 r = (ReturnCode)SIGNDOC_Document_addTextRect (&ex, p, aEncoding, aText.c_str (), aPage, aX0, aY0, aX1, aY1, aFontName.c_str (), aFontSize, aLineSkip, aTextColor.getImpl (), aOpacity, aHAlignment, aVAlignment, aFlags);
17816 if (ex != NULL) SignDoc_throw (ex);
17817 return r;
17818 }
17819
17829 ReturnCode addWatermark (const SignDocWatermark &aInput)
17830 {
17831 SIGNDOC_Exception *ex = NULL;
17832 ReturnCode r;
17833 r = (ReturnCode)SIGNDOC_Document_addWatermark (&ex, p, aInput.getImpl ());
17834 if (ex != NULL) SignDoc_throw (ex);
17835 return r;
17836 }
17837
17855 ReturnCode findText (Encoding aEncoding, int aFirstPage, int aLastPage,
17856 const std::string &aText, int aFlags,
17857 std::vector<SignDocFindTextPosition> &aOutput)
17858 {
17859 SIGNDOC_Exception *ex = NULL;
17860 SIGNDOC_FindTextPositionArray *tempOutput = NULL;
17861 ReturnCode r;
17862 try
17863 {
17864 tempOutput = SIGNDOC_FindTextPositionArray_new (&ex);
17865 if (ex != NULL) SignDoc_throw (ex);
17866 r = (ReturnCode)SIGNDOC_Document_findText (&ex, p, aEncoding, aFirstPage, aLastPage, aText.c_str (), aFlags, tempOutput);
17867 assignArray (aOutput, tempOutput);
17868 }
17869 catch (...)
17870 {
17871 if (tempOutput != NULL)
17872 SIGNDOC_FindTextPositionArray_delete (tempOutput);
17873 throw;
17874 }
17875 if (tempOutput != NULL)
17876 SIGNDOC_FindTextPositionArray_delete (tempOutput);
17877 if (ex != NULL) SignDoc_throw (ex);
17878 return r;
17879 }
17880
17907 ReturnCode addAttachmentBlob (Encoding aEncoding, const std::string &aName,
17908 const std::string &aDescription,
17909 const std::string &aType,
17910 const std::string &aModificationTime,
17911 const void *aPtr, size_t aSize, int aFlags)
17912 {
17913 SIGNDOC_Exception *ex = NULL;
17914 ReturnCode r;
17915 r = (ReturnCode)SIGNDOC_Document_addAttachmentBlob (&ex, p, aEncoding, aName.c_str (), aDescription.c_str (), aType.c_str (), aModificationTime.c_str (), aPtr, aSize, aFlags);
17916 if (ex != NULL) SignDoc_throw (ex);
17917 return r;
17918 }
17919
17941 ReturnCode addAttachmentFile (Encoding aEncoding1, const std::string &aName,
17942 const std::string &aDescription,
17943 const std::string &aType, Encoding aEncoding2,
17944 const std::string &aPath, int aFlags)
17945 {
17946 SIGNDOC_Exception *ex = NULL;
17947 ReturnCode r;
17948 r = (ReturnCode)SIGNDOC_Document_addAttachmentFile (&ex, p, aEncoding1, aName.c_str (), aDescription.c_str (), aType.c_str (), aEncoding2, aPath.c_str (), aFlags);
17949 if (ex != NULL) SignDoc_throw (ex);
17950 return r;
17951 }
17952
17965 ReturnCode removeAttachment (Encoding aEncoding, const std::string &aName)
17966 {
17967 SIGNDOC_Exception *ex = NULL;
17968 ReturnCode r;
17969 r = (ReturnCode)SIGNDOC_Document_removeAttachment (&ex, p, aEncoding, aName.c_str ());
17970 if (ex != NULL) SignDoc_throw (ex);
17971 return r;
17972 }
17973
17987 ReturnCode changeAttachmentDescription (Encoding aEncoding,
17988 const std::string &aName,
17989 const std::string &aDescription)
17990 {
17991 SIGNDOC_Exception *ex = NULL;
17992 ReturnCode r;
17993 r = (ReturnCode)SIGNDOC_Document_changeAttachmentDescription (&ex, p, aEncoding, aName.c_str (), aDescription.c_str ());
17994 if (ex != NULL) SignDoc_throw (ex);
17995 return r;
17996 }
17997
18013 ReturnCode getAttachments (Encoding aEncoding,
18014 std::vector<std::string> &aOutput)
18015 {
18016 SIGNDOC_Exception *ex = NULL;
18017 SIGNDOC_StringArray *tempOutput = NULL;
18018 ReturnCode r;
18019 try
18020 {
18021 tempOutput = SIGNDOC_StringArray_new (&ex);
18022 if (ex != NULL) SignDoc_throw (ex);
18023 r = (ReturnCode)SIGNDOC_Document_getAttachments (&ex, p, aEncoding, tempOutput);
18024 assignArray (aOutput, tempOutput);
18025 }
18026 catch (...)
18027 {
18028 if (tempOutput != NULL)
18029 SIGNDOC_StringArray_delete (tempOutput);
18030 throw;
18031 }
18032 if (tempOutput != NULL)
18033 SIGNDOC_StringArray_delete (tempOutput);
18034 if (ex != NULL) SignDoc_throw (ex);
18035 return r;
18036 }
18037
18052 ReturnCode getAttachment (Encoding aEncoding, const std::string &aName,
18053 SignDocAttachment &aOutput)
18054 {
18055 SIGNDOC_Exception *ex = NULL;
18056 ReturnCode r;
18057 r = (ReturnCode)SIGNDOC_Document_getAttachment (&ex, p, aEncoding, aName.c_str (), aOutput.getImpl ());
18058 if (ex != NULL) SignDoc_throw (ex);
18059 return r;
18060 }
18061
18075 ReturnCode checkAttachment (Encoding aEncoding, const std::string &aName,
18076 CheckAttachmentResult &aOutput)
18077 {
18078 SIGNDOC_Exception *ex = NULL;
18079 int tempOutput = 0;
18080 ReturnCode r;
18081 try
18082 {
18083 r = (ReturnCode)SIGNDOC_Document_checkAttachment (&ex, p, aEncoding, aName.c_str (), &tempOutput);
18084 aOutput = (CheckAttachmentResult )tempOutput;
18085 }
18086 catch (...)
18087 {
18088 throw;
18089 }
18090 if (ex != NULL) SignDoc_throw (ex);
18091 return r;
18092 }
18093
18107 ReturnCode getAttachmentBlob (Encoding aEncoding, const std::string &aName,
18108 std::vector<unsigned char> &aOutput)
18109 {
18110 SIGNDOC_Exception *ex = NULL;
18111 SIGNDOC_ByteArray *tempOutput = NULL;
18112 ReturnCode r;
18113 try
18114 {
18115 tempOutput = SIGNDOC_ByteArray_new (&ex);
18116 if (ex != NULL) SignDoc_throw (ex);
18117 r = (ReturnCode)SIGNDOC_Document_getAttachmentBlob (&ex, p, aEncoding, aName.c_str (), tempOutput);
18118 assignArray (aOutput, tempOutput);
18119 }
18120 catch (...)
18121 {
18122 if (tempOutput != NULL)
18123 SIGNDOC_ByteArray_delete (tempOutput);
18124 throw;
18125 }
18126 if (tempOutput != NULL)
18127 SIGNDOC_ByteArray_delete (tempOutput);
18128 if (ex != NULL) SignDoc_throw (ex);
18129 return r;
18130 }
18131
18148 ReturnCode getAttachmentStream (Encoding aEncoding, const std::string &aName,
18149 SIGNDOC_PTR<InputStream> &aOutput)
18150 {
18151 SIGNDOC_Exception *ex = NULL;
18152 SIGNDOC_InputStream *tempOutput = NULL;
18153 aOutput.reset ((InputStream*)NULL);
18154 ReturnCode r;
18155 try
18156 {
18157 r = (ReturnCode)SIGNDOC_Document_getAttachmentStream (&ex, p, aEncoding, aName.c_str (), &tempOutput);
18158 if (tempOutput != NULL)
18159 {
18160 aOutput.reset (new LibraryInputStream (tempOutput));
18161 tempOutput = NULL;
18162 }
18163 }
18164 catch (...)
18165 {
18166 if (tempOutput != NULL)
18167 SIGNDOC_InputStream_delete (tempOutput);
18168 throw;
18169 }
18170 if (tempOutput != NULL)
18171 SIGNDOC_InputStream_delete (tempOutput);
18172 if (ex != NULL) SignDoc_throw (ex);
18173 return r;
18174 }
18175
18191 ReturnCode addPage (int aTargetPage, double aWidth, double aHeight)
18192 {
18193 SIGNDOC_Exception *ex = NULL;
18194 ReturnCode r;
18195 r = (ReturnCode)SIGNDOC_Document_addPage (&ex, p, aTargetPage, aWidth, aHeight);
18196 if (ex != NULL) SignDoc_throw (ex);
18197 return r;
18198 }
18199
18227 ReturnCode importPages (int aTargetPage, SignDocDocument *aSource,
18228 int aSourcePage, int aPageCount, int aFlags)
18229 {
18230 SIGNDOC_Exception *ex = NULL;
18231 ReturnCode r;
18232 r = (ReturnCode)SIGNDOC_Document_importPages (&ex, p, aTargetPage, aSource == NULL ? NULL : aSource->getImpl (), aSourcePage, aPageCount, aFlags);
18233 if (ex != NULL) SignDoc_throw (ex);
18234 return r;
18235 }
18236
18274 ReturnCode importPageFromImageBlob (int aTargetPage,
18275 const unsigned char *aPtr, size_t aSize,
18276 double aZoom, double aWidth,
18277 double aHeight, int aFlags)
18278 {
18279 SIGNDOC_Exception *ex = NULL;
18280 ReturnCode r;
18281 r = (ReturnCode)SIGNDOC_Document_importPageFromImageBlob (&ex, p, aTargetPage, aPtr, aSize, aZoom, aWidth, aHeight, aFlags);
18282 if (ex != NULL) SignDoc_throw (ex);
18283 return r;
18284 }
18285
18321 ReturnCode importPageFromImageFile (int aTargetPage, Encoding aEncoding,
18322 const std::string &aPath, double aZoom,
18323 double aWidth, double aHeight,
18324 int aFlags)
18325 {
18326 SIGNDOC_Exception *ex = NULL;
18327 ReturnCode r;
18328 r = (ReturnCode)SIGNDOC_Document_importPageFromImageFile (&ex, p, aTargetPage, aEncoding, aPath.c_str (), aZoom, aWidth, aHeight, aFlags);
18329 if (ex != NULL) SignDoc_throw (ex);
18330 return r;
18331 }
18332
18372 ReturnCode addImageFromBlob (int aTargetPage, const unsigned char *aPtr,
18373 size_t aSize, double aZoom, double aX,
18374 double aY, double aWidth, double aHeight,
18375 int aFlags)
18376 {
18377 SIGNDOC_Exception *ex = NULL;
18378 ReturnCode r;
18379 r = (ReturnCode)SIGNDOC_Document_addImageFromBlob (&ex, p, aTargetPage, aPtr, aSize, aZoom, aX, aY, aWidth, aHeight, aFlags);
18380 if (ex != NULL) SignDoc_throw (ex);
18381 return r;
18382 }
18383
18421 ReturnCode addImageFromFile (int aTargetPage, Encoding aEncoding,
18422 const std::string &aPath, double aZoom,
18423 double aX, double aY, double aWidth,
18424 double aHeight, int aFlags)
18425 {
18426 SIGNDOC_Exception *ex = NULL;
18427 ReturnCode r;
18428 r = (ReturnCode)SIGNDOC_Document_addImageFromFile (&ex, p, aTargetPage, aEncoding, aPath.c_str (), aZoom, aX, aY, aWidth, aHeight, aFlags);
18429 if (ex != NULL) SignDoc_throw (ex);
18430 return r;
18431 }
18432
18453 ReturnCode removePages (const int *aPagesPtr, int aPagesCount,
18454 KeepOrRemove aMode)
18455 {
18456 SIGNDOC_Exception *ex = NULL;
18457 ReturnCode r;
18458 r = (ReturnCode)SIGNDOC_Document_removePages (&ex, p, aPagesPtr, aPagesCount, aMode);
18459 if (ex != NULL) SignDoc_throw (ex);
18460 return r;
18461 }
18462
18477 ReturnCode setCompatibility (int aMajor, int aMinor)
18478 {
18479 SIGNDOC_Exception *ex = NULL;
18480 ReturnCode r;
18481 r = (ReturnCode)SIGNDOC_Document_setCompatibility (&ex, p, aMajor, aMinor);
18482 if (ex != NULL) SignDoc_throw (ex);
18483 return r;
18484 }
18485
18495 ReturnCode isModified (bool &aModified) const
18496 {
18497 SIGNDOC_Exception *ex = NULL;
18498 SIGNDOC_Boolean tempModified = 0;
18499 ReturnCode r;
18500 try
18501 {
18502 r = (ReturnCode)SIGNDOC_Document_isModified (&ex, p, &tempModified);
18503 aModified = (bool )tempModified;
18504 }
18505 catch (...)
18506 {
18507 throw;
18508 }
18509 if (ex != NULL) SignDoc_throw (ex);
18510 return r;
18511 }
18512
18524 ReturnCode setFlags (unsigned aFlags)
18525 {
18526 SIGNDOC_Exception *ex = NULL;
18527 ReturnCode r;
18528 r = (ReturnCode)SIGNDOC_Document_setFlags (&ex, p, aFlags);
18529 if (ex != NULL) SignDoc_throw (ex);
18530 return r;
18531 }
18532
18540 unsigned getFlags () const
18541 {
18542 SIGNDOC_Exception *ex = NULL;
18543 unsigned r;
18544 r = SIGNDOC_Document_getFlags (&ex, p);
18545 if (ex != NULL) SignDoc_throw (ex);
18546 return r;
18547 }
18548
18566 ReturnCode setCompressionLevel (int aLevel)
18567 {
18568 SIGNDOC_Exception *ex = NULL;
18569 ReturnCode r;
18570 r = (ReturnCode)SIGNDOC_Document_setCompressionLevel (&ex, p, aLevel);
18571 if (ex != NULL) SignDoc_throw (ex);
18572 return r;
18573 }
18574
18594 int getDocMDP () const
18595 {
18596 SIGNDOC_Exception *ex = NULL;
18597 int r;
18598 r = SIGNDOC_Document_getDocMDP (&ex, p);
18599 if (ex != NULL) SignDoc_throw (ex);
18600 return r;
18601 }
18602
18622 int getLockMDP () const
18623 {
18624 SIGNDOC_Exception *ex = NULL;
18625 int r;
18626 r = SIGNDOC_Document_getLockMDP (&ex, p);
18627 if (ex != NULL) SignDoc_throw (ex);
18628 return r;
18629 }
18630
18639 ReturnCode removeDocMDP ()
18640 {
18641 SIGNDOC_Exception *ex = NULL;
18642 ReturnCode r;
18643 r = (ReturnCode)SIGNDOC_Document_removeDocMDP (&ex, p);
18644 if (ex != NULL) SignDoc_throw (ex);
18645 return r;
18646 }
18647
18668 ReturnCode removePermissions (unsigned aFlags)
18669 {
18670 SIGNDOC_Exception *ex = NULL;
18671 ReturnCode r;
18672 r = (ReturnCode)SIGNDOC_Document_removePermissions (&ex, p, aFlags);
18673 if (ex != NULL) SignDoc_throw (ex);
18674 return r;
18675 }
18676
18690 ReturnCode removePDFA (unsigned aFlags)
18691 {
18692 SIGNDOC_Exception *ex = NULL;
18693 ReturnCode r;
18694 r = (ReturnCode)SIGNDOC_Document_removePDFA (&ex, p, aFlags);
18695 if (ex != NULL) SignDoc_throw (ex);
18696 return r;
18697 }
18698
18712 ReturnCode removePDFUA (unsigned aFlags)
18713 {
18714 SIGNDOC_Exception *ex = NULL;
18715 ReturnCode r;
18716 r = (ReturnCode)SIGNDOC_Document_removePDFUA (&ex, p, aFlags);
18717 if (ex != NULL) SignDoc_throw (ex);
18718 return r;
18719 }
18720
18728 ReturnCode removeLogicalStructure (unsigned aFlags)
18729 {
18730 SIGNDOC_Exception *ex = NULL;
18731 ReturnCode r;
18732 r = (ReturnCode)SIGNDOC_Document_removeLogicalStructure (&ex, p, aFlags);
18733 if (ex != NULL) SignDoc_throw (ex);
18734 return r;
18735 }
18736
18754 ReturnCode removeXFA (unsigned aFlags)
18755 {
18756 SIGNDOC_Exception *ex = NULL;
18757 ReturnCode r;
18758 r = (ReturnCode)SIGNDOC_Document_removeXFA (&ex, p, aFlags);
18759 if (ex != NULL) SignDoc_throw (ex);
18760 return r;
18761 }
18762
18778 ReturnCode setShootInFoot (unsigned aFlags)
18779 {
18780 SIGNDOC_Exception *ex = NULL;
18781 ReturnCode r;
18782 r = (ReturnCode)SIGNDOC_Document_setShootInFoot (&ex, p, aFlags);
18783 if (ex != NULL) SignDoc_throw (ex);
18784 return r;
18785 }
18786
18794 unsigned getShootInFoot () const
18795 {
18796 SIGNDOC_Exception *ex = NULL;
18797 unsigned r;
18798 r = SIGNDOC_Document_getShootInFoot (&ex, p);
18799 if (ex != NULL) SignDoc_throw (ex);
18800 return r;
18801 }
18802
18816 const char *getErrorMessage (Encoding aEncoding) const
18817 {
18818 SIGNDOC_Exception *ex = NULL;
18819 const char *r;
18820 r = SIGNDOC_Document_getErrorMessage (&ex, p, aEncoding);
18821 if (ex != NULL) SignDoc_throw (ex);
18822 return r;
18823 }
18824
18836 const wchar_t *getErrorMessageW () const
18837 {
18838 SIGNDOC_Exception *ex = NULL;
18839 const wchar_t *r;
18840 r = SIGNDOC_Document_getErrorMessageW (&ex, p);
18841 if (ex != NULL) SignDoc_throw (ex);
18842 return r;
18843 }
18844
18866 SPPDF_Document *getSPPDFDocument (bool aDestroy)
18867 {
18868 SIGNDOC_Exception *ex = NULL;
18869 SPPDF_Document *r;
18870 r = SIGNDOC_Document_getSPPDFDocument (&ex, p, aDestroy);
18871 if (ex != NULL) SignDoc_throw (ex);
18872 return r;
18873 }
18874
18888 ReturnCode getPageLabel (int aPage, std::string &aOutput)
18889 {
18890 SIGNDOC_Exception *ex = NULL;
18891 char *tempOutput = NULL;
18892 ReturnCode r;
18893 try
18894 {
18895 r = (ReturnCode)SIGNDOC_Document_getPageLabel (&ex, p, aPage, &tempOutput);
18896 if (tempOutput != NULL)
18897 aOutput = tempOutput;
18898 }
18899 catch (...)
18900 {
18901 SIGNDOC_free (tempOutput);
18902 throw;
18903 }
18904 SIGNDOC_free (tempOutput);
18905 if (ex != NULL) SignDoc_throw (ex);
18906 return r;
18907 }
18908
18936 ReturnCode flattenAnnotations (int aFirstPage, int aLastPage,
18937 unsigned aFlags)
18938 {
18939 SIGNDOC_Exception *ex = NULL;
18940 ReturnCode r;
18941 r = (ReturnCode)SIGNDOC_Document_flattenAnnotations (&ex, p, aFirstPage, aLastPage, aFlags);
18942 if (ex != NULL) SignDoc_throw (ex);
18943 return r;
18944 }
18945
18946 private:
18950 SignDocDocument (const SignDocDocument &);
18951
18955 SignDocDocument &operator= (const SignDocDocument &);
18956 public:
18961 SignDocDocument (SIGNDOC_Document *aP) : p (aP) { }
18962
18967 SIGNDOC_Document *getImpl () { return p; }
18968
18973 const SIGNDOC_Document *getImpl () const { return p; }
18974
18979 void setImpl (SIGNDOC_Document *aP) { SIGNDOC_Document_delete (p); p = aP; }
18980
18981 private:
18982 SIGNDOC_Document *p;
18983 };
18984
18988 class SignDocDocumentHandler
18989 {
18990 public:
18996 SignDocDocumentHandler ()
18997 : p (NULL)
18998 {
18999 }
19000
19006 virtual ~SignDocDocumentHandler ()
19007 {
19008 SIGNDOC_DocumentHandler_delete (p);
19009 }
19010
19011 private:
19015 SignDocDocumentHandler (const SignDocDocumentHandler &);
19016
19017 public:
19022 SignDocDocumentHandler (SIGNDOC_DocumentHandler *aP) : p (aP) { }
19023
19028 SIGNDOC_DocumentHandler *getImpl () { return p; }
19029
19034 const SIGNDOC_DocumentHandler *getImpl () const { return p; }
19035
19040 void destroyWithoutImpl () { p = NULL; delete this; }
19041
19046 void setImpl (SIGNDOC_DocumentHandler *aP) { SIGNDOC_DocumentHandler_delete (p); p = aP; }
19047
19048 protected:
19049 SIGNDOC_DocumentHandler *p;
19050 };
19051
19071 class SignDocDocumentLoader
19072 {
19073 public:
19077 enum RemainingDays
19078 {
19082 rd_product,
19083
19087 rd_signing
19088 };
19089
19093 enum Flags
19094 {
19105 f_map_into_memory = 0x01
19106 };
19107
19108 public:
19112 SignDocDocumentLoader ()
19113 : p (NULL)
19114 {
19115 SIGNDOC_Exception *ex = NULL;
19116 p = SIGNDOC_DocumentLoader_new (&ex);
19117 if (ex != NULL) SignDoc_throw (ex);
19118 }
19119
19123 ~SignDocDocumentLoader ()
19124 {
19125 SIGNDOC_DocumentLoader_delete (p);
19126 }
19127
19144 static bool initLicenseManager (int aWho1, int aWho2)
19145 {
19146 SIGNDOC_Exception *ex = NULL;
19147 bool r;
19148 r = (bool)SIGNDOC_DocumentLoader_initLicenseManager (&ex, aWho1, aWho2);
19149 if (ex != NULL) SignDoc_throw (ex);
19150 return r;
19151 }
19152
19172 static bool setLicenseKey (const void *aKeyPtr, size_t aKeySize,
19173 const char *aProduct, const char *aVersion,
19174 const void *aTokenPtr, size_t aTokenSize)
19175 {
19176 SIGNDOC_Exception *ex = NULL;
19177 bool r;
19178 r = (bool)SIGNDOC_DocumentLoader_setLicenseKey (&ex, aKeyPtr, aKeySize, aProduct, aVersion, aTokenPtr, aTokenSize);
19179 if (ex != NULL) SignDoc_throw (ex);
19180 return r;
19181 }
19182
19195 static bool generateLicenseToken (const char *aProduct,
19196 std::vector<unsigned char> &aOutput)
19197 {
19198 SIGNDOC_Exception *ex = NULL;
19199 SIGNDOC_ByteArray *tempOutput = NULL;
19200 bool r;
19201 try
19202 {
19203 tempOutput = SIGNDOC_ByteArray_new (&ex);
19204 if (ex != NULL) SignDoc_throw (ex);
19205 r = (bool)SIGNDOC_DocumentLoader_generateLicenseToken (&ex, aProduct, tempOutput);
19206 assignArray (aOutput, tempOutput);
19207 }
19208 catch (...)
19209 {
19210 if (tempOutput != NULL)
19211 SIGNDOC_ByteArray_delete (tempOutput);
19212 throw;
19213 }
19214 if (tempOutput != NULL)
19215 SIGNDOC_ByteArray_delete (tempOutput);
19216 if (ex != NULL) SignDoc_throw (ex);
19217 return r;
19218 }
19219
19232 static int getRemainingDays (RemainingDays aWhat)
19233 {
19234 SIGNDOC_Exception *ex = NULL;
19235 int r;
19236 r = SIGNDOC_DocumentLoader_getRemainingDays (&ex, aWhat);
19237 if (ex != NULL) SignDoc_throw (ex);
19238 return r;
19239 }
19240
19249 static bool getInstallationCode (std::string &aCode)
19250 {
19251 SIGNDOC_Exception *ex = NULL;
19252 char *tempCode = NULL;
19253 bool r;
19254 try
19255 {
19256 r = (bool)SIGNDOC_DocumentLoader_getInstallationCode (&ex, &tempCode);
19257 if (tempCode != NULL)
19258 aCode = tempCode;
19259 }
19260 catch (...)
19261 {
19262 SIGNDOC_free (tempCode);
19263 throw;
19264 }
19265 SIGNDOC_free (tempCode);
19266 if (ex != NULL) SignDoc_throw (ex);
19267 return r;
19268 }
19269
19281 static bool getVersionNumber (std::string &aVersion)
19282 {
19283 SIGNDOC_Exception *ex = NULL;
19284 char *tempVersion = NULL;
19285 bool r;
19286 try
19287 {
19288 r = (bool)SIGNDOC_DocumentLoader_getVersionNumber (&ex, &tempVersion);
19289 if (tempVersion != NULL)
19290 aVersion = tempVersion;
19291 }
19292 catch (...)
19293 {
19294 SIGNDOC_free (tempVersion);
19295 throw;
19296 }
19297 SIGNDOC_free (tempVersion);
19298 if (ex != NULL) SignDoc_throw (ex);
19299 return r;
19300 }
19301
19315 static bool getComponentVersionNumber (const char *aComponent,
19316 std::string &aVersion)
19317 {
19318 SIGNDOC_Exception *ex = NULL;
19319 char *tempVersion = NULL;
19320 bool r;
19321 try
19322 {
19323 r = (bool)SIGNDOC_DocumentLoader_getComponentVersionNumber (&ex, aComponent, &tempVersion);
19324 if (tempVersion != NULL)
19325 aVersion = tempVersion;
19326 }
19327 catch (...)
19328 {
19329 SIGNDOC_free (tempVersion);
19330 throw;
19331 }
19332 SIGNDOC_free (tempVersion);
19333 if (ex != NULL) SignDoc_throw (ex);
19334 return r;
19335 }
19336
19347 static int getLicenseTextCount ()
19348 {
19349 SIGNDOC_Exception *ex = NULL;
19350 int r;
19351 r = SIGNDOC_DocumentLoader_getLicenseTextCount (&ex);
19352 if (ex != NULL) SignDoc_throw (ex);
19353 return r;
19354 }
19355
19370 static const char *getLicenseText (int aIndex)
19371 {
19372 SIGNDOC_Exception *ex = NULL;
19373 const char *r;
19374 r = SIGNDOC_DocumentLoader_getLicenseText (&ex, aIndex);
19375 if (ex != NULL) SignDoc_throw (ex);
19376 return r;
19377 }
19378
19395 SignDocDocument *loadFromMemory (const unsigned char *aData, size_t aSize,
19396 bool aCopy)
19397 {
19398 SIGNDOC_Exception *ex = NULL;
19399 SIGNDOC_Document *r;
19400 r = SIGNDOC_DocumentLoader_loadFromMemory (&ex, p, aData, aSize, aCopy);
19401 if (ex != NULL) SignDoc_throw (ex);
19402 if (r == NULL)
19403 return NULL;
19404 try
19405 {
19406 return new SignDocDocument (r);
19407 }
19408 catch (...)
19409 {
19410 SIGNDOC_Document_delete (r);
19411 throw;
19412 }
19413 }
19414
19441 SignDocDocument *loadFromFile (Encoding aEncoding, const char *aPath,
19442 bool aWritable)
19443 {
19444 SIGNDOC_Exception *ex = NULL;
19445 SIGNDOC_Document *r;
19446 r = SIGNDOC_DocumentLoader_loadFromFile (&ex, p, aEncoding, aPath, aWritable);
19447 if (ex != NULL) SignDoc_throw (ex);
19448 if (r == NULL)
19449 return NULL;
19450 try
19451 {
19452 return new SignDocDocument (r);
19453 }
19454 catch (...)
19455 {
19456 SIGNDOC_Document_delete (r);
19457 throw;
19458 }
19459 }
19460
19483 SignDocDocument *loadFromFile (const wchar_t *aPath, bool aWritable)
19484 {
19485 SIGNDOC_Exception *ex = NULL;
19486 SIGNDOC_Document *r;
19487 r = SIGNDOC_DocumentLoader_loadFromFileW (&ex, p, aPath, aWritable);
19488 if (ex != NULL) SignDoc_throw (ex);
19489 if (r == NULL)
19490 return NULL;
19491 try
19492 {
19493 return new SignDocDocument (r);
19494 }
19495 catch (...)
19496 {
19497 SIGNDOC_Document_delete (r);
19498 throw;
19499 }
19500 }
19501
19517 SignDocDocument *createPDF (int aMajor, int aMinor)
19518 {
19519 SIGNDOC_Exception *ex = NULL;
19520 SIGNDOC_Document *r;
19521 r = SIGNDOC_DocumentLoader_createPDF (&ex, p, aMajor, aMinor);
19522 if (ex != NULL) SignDoc_throw (ex);
19523 if (r == NULL)
19524 return NULL;
19525 try
19526 {
19527 return new SignDocDocument (r);
19528 }
19529 catch (...)
19530 {
19531 SIGNDOC_Document_delete (r);
19532 throw;
19533 }
19534 }
19535
19565 SignDocDocument *createPDFA (int aMajor, int aMinor,
19566 const char *aConformance,
19567 const unsigned char *aICCPtr, size_t aICCSize)
19568 {
19569 SIGNDOC_Exception *ex = NULL;
19570 SIGNDOC_Document *r;
19571 r = SIGNDOC_DocumentLoader_createPDFA (&ex, p, aMajor, aMinor, aConformance, aICCPtr, aICCSize);
19572 if (ex != NULL) SignDoc_throw (ex);
19573 if (r == NULL)
19574 return NULL;
19575 try
19576 {
19577 return new SignDocDocument (r);
19578 }
19579 catch (...)
19580 {
19581 SIGNDOC_Document_delete (r);
19582 throw;
19583 }
19584 }
19585
19595 SignDocDocument::DocumentType ping (InputStream &aStream)
19596 {
19597 SIGNDOC_Exception *ex = NULL;
19598 SignDocDocument::DocumentType r;
19599 r = (SignDocDocument::DocumentType)SIGNDOC_DocumentLoader_ping (&ex, p, aStream.getImpl ());
19600 if (ex != NULL) SignDoc_throw (ex);
19601 return r;
19602 }
19603
19629 bool loadFontConfigFile (Encoding aEncoding, const char *aPath)
19630 {
19631 SIGNDOC_Exception *ex = NULL;
19632 bool r;
19633 r = (bool)SIGNDOC_DocumentLoader_loadFontConfigFile (&ex, p, aEncoding, aPath);
19634 if (ex != NULL) SignDoc_throw (ex);
19635 return r;
19636 }
19637
19659 bool loadFontConfigFile (const wchar_t *aPath)
19660 {
19661 SIGNDOC_Exception *ex = NULL;
19662 bool r;
19663 r = (bool)SIGNDOC_DocumentLoader_loadFontConfigFileW (&ex, p, aPath);
19664 if (ex != NULL) SignDoc_throw (ex);
19665 return r;
19666 }
19667
19692 bool loadFontConfigEnvironment (const char *aName)
19693 {
19694 SIGNDOC_Exception *ex = NULL;
19695 bool r;
19696 r = (bool)SIGNDOC_DocumentLoader_loadFontConfigEnvironment (&ex, p, aName);
19697 if (ex != NULL) SignDoc_throw (ex);
19698 return r;
19699 }
19700
19732 bool loadFontConfigStream (InputStream &aStream, Encoding aEncoding,
19733 const char *aDirectory)
19734 {
19735 SIGNDOC_Exception *ex = NULL;
19736 bool r;
19737 r = (bool)SIGNDOC_DocumentLoader_loadFontConfigStream (&ex, p, aStream.getImpl (), aEncoding, aDirectory);
19738 if (ex != NULL) SignDoc_throw (ex);
19739 return r;
19740 }
19741
19769 bool loadFontConfigStream (InputStream &aStream, const wchar_t *aDirectory)
19770 {
19771 SIGNDOC_Exception *ex = NULL;
19772 bool r;
19773 r = (bool)SIGNDOC_DocumentLoader_loadFontConfigStreamW (&ex, p, aStream.getImpl (), aDirectory);
19774 if (ex != NULL) SignDoc_throw (ex);
19775 return r;
19776 }
19777
19803 bool loadPdfFontConfigFile (Encoding aEncoding, const char *aPath)
19804 {
19805 SIGNDOC_Exception *ex = NULL;
19806 bool r;
19807 r = (bool)SIGNDOC_DocumentLoader_loadPdfFontConfigFile (&ex, p, aEncoding, aPath);
19808 if (ex != NULL) SignDoc_throw (ex);
19809 return r;
19810 }
19811
19833 bool loadPdfFontConfigFile (const wchar_t *aPath)
19834 {
19835 SIGNDOC_Exception *ex = NULL;
19836 bool r;
19837 r = (bool)SIGNDOC_DocumentLoader_loadPdfFontConfigFileW (&ex, p, aPath);
19838 if (ex != NULL) SignDoc_throw (ex);
19839 return r;
19840 }
19841
19869 bool loadPdfFontConfigEnvironment (const char *aName)
19870 {
19871 SIGNDOC_Exception *ex = NULL;
19872 bool r;
19873 r = (bool)SIGNDOC_DocumentLoader_loadPdfFontConfigEnvironment (&ex, p, aName);
19874 if (ex != NULL) SignDoc_throw (ex);
19875 return r;
19876 }
19877
19909 bool loadPdfFontConfigStream (InputStream &aStream, Encoding aEncoding,
19910 const char *aDirectory)
19911 {
19912 SIGNDOC_Exception *ex = NULL;
19913 bool r;
19914 r = (bool)SIGNDOC_DocumentLoader_loadPdfFontConfigStream (&ex, p, aStream.getImpl (), aEncoding, aDirectory);
19915 if (ex != NULL) SignDoc_throw (ex);
19916 return r;
19917 }
19918
19946 bool loadPdfFontConfigStream (InputStream &aStream,
19947 const wchar_t *aDirectory)
19948 {
19949 SIGNDOC_Exception *ex = NULL;
19950 bool r;
19951 r = (bool)SIGNDOC_DocumentLoader_loadPdfFontConfigStreamW (&ex, p, aStream.getImpl (), aDirectory);
19952 if (ex != NULL) SignDoc_throw (ex);
19953 return r;
19954 }
19955
19972 void getFailedFontFiles (std::vector<std::string> &aOutput)
19973 {
19974 SIGNDOC_Exception *ex = NULL;
19975 SIGNDOC_StringArray *tempOutput = NULL;
19976 try
19977 {
19978 tempOutput = SIGNDOC_StringArray_new (&ex);
19979 if (ex != NULL) SignDoc_throw (ex);
19980 SIGNDOC_DocumentLoader_getFailedFontFiles (&ex, p, tempOutput);
19981 assignArray (aOutput, tempOutput);
19982 }
19983 catch (...)
19984 {
19985 if (tempOutput != NULL)
19986 SIGNDOC_StringArray_delete (tempOutput);
19987 throw;
19988 }
19989 if (tempOutput != NULL)
19990 SIGNDOC_StringArray_delete (tempOutput);
19991 if (ex != NULL) SignDoc_throw (ex);
19992 }
19993
20018 bool loadTrustedCertificatesFromFile (Encoding aEncoding, const char *aPath)
20019 {
20020 SIGNDOC_Exception *ex = NULL;
20021 bool r;
20022 r = (bool)SIGNDOC_DocumentLoader_loadTrustedCertificatesFromFile (&ex, p, aEncoding, aPath);
20023 if (ex != NULL) SignDoc_throw (ex);
20024 return r;
20025 }
20026
20046 bool loadTrustedCertificatesFromFile (const wchar_t *aPath)
20047 {
20048 SIGNDOC_Exception *ex = NULL;
20049 bool r;
20050 r = (bool)SIGNDOC_DocumentLoader_loadTrustedCertificatesFromFileW (&ex, p, aPath);
20051 if (ex != NULL) SignDoc_throw (ex);
20052 return r;
20053 }
20054
20074 bool loadTrustedCertificatesFromStream (InputStream &aStream)
20075 {
20076 SIGNDOC_Exception *ex = NULL;
20077 bool r;
20078 r = (bool)SIGNDOC_DocumentLoader_loadTrustedCertificatesFromStream (&ex, p, aStream.getImpl ());
20079 if (ex != NULL) SignDoc_throw (ex);
20080 return r;
20081 }
20082
20104 bool initLogging (Encoding aEncoding, const char *aLevel,
20105 const char *aPathname)
20106 {
20107 SIGNDOC_Exception *ex = NULL;
20108 bool r;
20109 r = (bool)SIGNDOC_DocumentLoader_initLogging (&ex, p, aEncoding, aLevel, aPathname);
20110 if (ex != NULL) SignDoc_throw (ex);
20111 return r;
20112 }
20113
20128 const char *getErrorMessage (Encoding aEncoding) const
20129 {
20130 SIGNDOC_Exception *ex = NULL;
20131 const char *r;
20132 r = SIGNDOC_DocumentLoader_getErrorMessage (&ex, p, aEncoding);
20133 if (ex != NULL) SignDoc_throw (ex);
20134 return r;
20135 }
20136
20149 const wchar_t *getErrorMessageW () const
20150 {
20151 SIGNDOC_Exception *ex = NULL;
20152 const wchar_t *r;
20153 r = SIGNDOC_DocumentLoader_getErrorMessageW (&ex, p);
20154 if (ex != NULL) SignDoc_throw (ex);
20155 return r;
20156 }
20157
20169 bool registerDocumentHandler (SignDocDocumentHandler *aHandler)
20170 {
20171 SIGNDOC_Exception *ex = NULL;
20172 bool r;
20173 r = (bool)SIGNDOC_DocumentLoader_registerDocumentHandler (&ex, p, aHandler == NULL ? NULL : aHandler->getImpl ());
20174 if (ex == NULL) aHandler->destroyWithoutImpl ();
20175 if (ex != NULL) SignDoc_throw (ex);
20176 return r;
20177 }
20178
20185 void setFlags (unsigned aFlags)
20186 {
20187 SIGNDOC_Exception *ex = NULL;
20188 SIGNDOC_DocumentLoader_setFlags (&ex, p, aFlags);
20189 if (ex != NULL) SignDoc_throw (ex);
20190 }
20191
20192 private:
20196 SignDocDocumentLoader (const SignDocDocumentLoader &);
20197
20201 SignDocDocumentLoader &operator= (const SignDocDocumentLoader &);
20202
20203 private:
20204 public:
20209 SignDocDocumentLoader (SIGNDOC_DocumentLoader *aP) : p (aP) { }
20210
20215 SIGNDOC_DocumentLoader *getImpl () { return p; }
20216
20221 const SIGNDOC_DocumentLoader *getImpl () const { return p; }
20222
20227 void setImpl (SIGNDOC_DocumentLoader *aP) { SIGNDOC_DocumentLoader_delete (p); p = aP; }
20228
20229 private:
20230 SIGNDOC_DocumentLoader *p;
20231 };
20232
20242 class SignDocVerificationResult
20243 {
20244 public:
20250 enum ReturnCode
20251 {
20252 rc_ok = SignDocDocument::rc_ok,
20253 rc_invalid_argument = SignDocDocument::rc_invalid_argument,
20254 rc_not_supported = SignDocDocument::rc_not_supported,
20255 rc_not_verified = SignDocDocument::rc_not_verified,
20256 rc_property_not_found = SignDocDocument::rc_property_not_found,
20257 rc_no_biometric_data = SignDocDocument::rc_no_biometric_data,
20258 rc_unexpected_error = SignDocDocument::rc_unexpected_error
20259 };
20260
20264 enum SignatureState
20265 {
20266 ss_unmodified,
20267 ss_document_extended,
20268 ss_document_modified,
20269 ss_unsupported_signature,
20270 ss_invalid_certificate,
20271 ss_empty
20272 };
20273
20277 enum ModificationState
20278 {
20283 ms_unmodified,
20284
20288 ms_allowed,
20289
20293 ms_prohibited
20294 };
20295
20299 enum TimeStampState
20300 {
20301 tss_valid,
20302 tss_missing,
20303 tss_invalid
20304 };
20305
20310 enum CertificateChainState
20311 {
20312 ccs_ok,
20313 ccs_broken_chain,
20314 ccs_untrusted_root,
20315 ccs_critical_extension,
20316 ccs_not_time_valid,
20317 ccs_path_length,
20318 ccs_invalid,
20319 ccs_error
20320 };
20321
20326 enum CertificateRevocationState
20327 {
20328 crs_ok,
20329 crs_not_checked,
20330 crs_offline,
20331 crs_revoked,
20332 crs_error
20333 };
20334
20335 public:
20339 SignDocVerificationResult ()
20340 : p (NULL)
20341 {
20342 }
20343
20347 ~SignDocVerificationResult ()
20348 {
20349 SIGNDOC_VerificationResult_delete (p);
20350 }
20351
20378 ReturnCode getState (SignatureState &aOutput)
20379 {
20380 SIGNDOC_Exception *ex = NULL;
20381 int tempOutput = 0;
20382 ReturnCode r;
20383 try
20384 {
20385 r = (ReturnCode)SIGNDOC_VerificationResult_getState (&ex, p, &tempOutput);
20386 aOutput = (SignatureState )tempOutput;
20387 }
20388 catch (...)
20389 {
20390 throw;
20391 }
20392 if (ex != NULL) SignDoc_throw (ex);
20393 return r;
20394 }
20395
20418 ReturnCode getModificationState (ModificationState &aOutput)
20419 {
20420 SIGNDOC_Exception *ex = NULL;
20421 int tempOutput = 0;
20422 ReturnCode r;
20423 try
20424 {
20425 r = (ReturnCode)SIGNDOC_VerificationResult_getModificationState (&ex, p, &tempOutput);
20426 aOutput = (ModificationState )tempOutput;
20427 }
20428 catch (...)
20429 {
20430 throw;
20431 }
20432 if (ex != NULL) SignDoc_throw (ex);
20433 return r;
20434 }
20435
20451 ReturnCode getMethod (SignDocSignatureParameters::Method &aOutput)
20452 {
20453 SIGNDOC_Exception *ex = NULL;
20454 int tempOutput = 0;
20455 ReturnCode r;
20456 try
20457 {
20458 r = (ReturnCode)SIGNDOC_VerificationResult_getMethod (&ex, p, &tempOutput);
20459 aOutput = (SignDocSignatureParameters::Method )tempOutput;
20460 }
20461 catch (...)
20462 {
20463 throw;
20464 }
20465 if (ex != NULL) SignDoc_throw (ex);
20466 return r;
20467 }
20468
20486 int getDocMDP ()
20487 {
20488 SIGNDOC_Exception *ex = NULL;
20489 int r;
20490 r = SIGNDOC_VerificationResult_getDocMDP (&ex, p);
20491 if (ex != NULL) SignDoc_throw (ex);
20492 return r;
20493 }
20494
20512 int getLockMDP ()
20513 {
20514 SIGNDOC_Exception *ex = NULL;
20515 int r;
20516 r = SIGNDOC_VerificationResult_getLockMDP (&ex, p);
20517 if (ex != NULL) SignDoc_throw (ex);
20518 return r;
20519 }
20520
20546 ReturnCode getDigestAlgorithm (std::string &aOutput)
20547 {
20548 SIGNDOC_Exception *ex = NULL;
20549 char *tempOutput = NULL;
20550 ReturnCode r;
20551 try
20552 {
20553 r = (ReturnCode)SIGNDOC_VerificationResult_getDigestAlgorithm (&ex, p, &tempOutput);
20554 if (tempOutput != NULL)
20555 aOutput = tempOutput;
20556 }
20557 catch (...)
20558 {
20559 SIGNDOC_free (tempOutput);
20560 throw;
20561 }
20562 SIGNDOC_free (tempOutput);
20563 if (ex != NULL) SignDoc_throw (ex);
20564 return r;
20565 }
20566
20582 ReturnCode getCertificates (std::vector<std::vector<unsigned char> > &aOutput)
20583 {
20584 SIGNDOC_Exception *ex = NULL;
20585 SIGNDOC_ByteArrayArray *tempOutput = NULL;
20586 ReturnCode r;
20587 try
20588 {
20589 tempOutput = SIGNDOC_ByteArrayArray_new (&ex);
20590 if (ex != NULL) SignDoc_throw (ex);
20591 r = (ReturnCode)SIGNDOC_VerificationResult_getCertificates (&ex, p, tempOutput);
20592 assignArray (aOutput, tempOutput);
20593 }
20594 catch (...)
20595 {
20596 if (tempOutput != NULL)
20597 SIGNDOC_ByteArrayArray_delete (tempOutput);
20598 throw;
20599 }
20600 if (tempOutput != NULL)
20601 SIGNDOC_ByteArrayArray_delete (tempOutput);
20602 if (ex != NULL) SignDoc_throw (ex);
20603 return r;
20604 }
20605
20628 ReturnCode verifyCertificateChain (const SignDocVerificationParameters *aParameters,
20629 CertificateChainState &aOutput)
20630 {
20631 SIGNDOC_Exception *ex = NULL;
20632 int tempOutput = 0;
20633 ReturnCode r;
20634 try
20635 {
20636 r = (ReturnCode)SIGNDOC_VerificationResult_verifyCertificateChain (&ex, p, aParameters == NULL ? NULL : aParameters->getImpl (), &tempOutput);
20637 aOutput = (CertificateChainState )tempOutput;
20638 }
20639 catch (...)
20640 {
20641 throw;
20642 }
20643 if (ex != NULL) SignDoc_throw (ex);
20644 return r;
20645 }
20646
20670 ReturnCode getCertificateRevocationState (CertificateRevocationState &aOutput)
20671 {
20672 SIGNDOC_Exception *ex = NULL;
20673 int tempOutput = 0;
20674 ReturnCode r;
20675 try
20676 {
20677 r = (ReturnCode)SIGNDOC_VerificationResult_getCertificateRevocationState (&ex, p, &tempOutput);
20678 aOutput = (CertificateRevocationState )tempOutput;
20679 }
20680 catch (...)
20681 {
20682 throw;
20683 }
20684 if (ex != NULL) SignDoc_throw (ex);
20685 return r;
20686 }
20687
20710 ReturnCode verifyCertificateSimplified (const SignDocVerificationParameters *aParameters)
20711 {
20712 SIGNDOC_Exception *ex = NULL;
20713 ReturnCode r;
20714 r = (ReturnCode)SIGNDOC_VerificationResult_verifyCertificateSimplified (&ex, p, aParameters == NULL ? NULL : aParameters->getImpl ());
20715 if (ex != NULL) SignDoc_throw (ex);
20716 return r;
20717 }
20718
20737 ReturnCode getCertificateChainLength (int &aOutput)
20738 {
20739 SIGNDOC_Exception *ex = NULL;
20740 ReturnCode r;
20741 r = (ReturnCode)SIGNDOC_VerificationResult_getCertificateChainLength (&ex, p, &aOutput);
20742 if (ex != NULL) SignDoc_throw (ex);
20743 return r;
20744 }
20745
20797 ReturnCode getSignatureString (Encoding aEncoding, const std::string &aName,
20798 std::string &aOutput)
20799 {
20800 SIGNDOC_Exception *ex = NULL;
20801 char *tempOutput = NULL;
20802 ReturnCode r;
20803 try
20804 {
20805 r = (ReturnCode)SIGNDOC_VerificationResult_getSignatureString (&ex, p, aEncoding, aName.c_str (), &tempOutput);
20806 if (tempOutput != NULL)
20807 aOutput = tempOutput;
20808 }
20809 catch (...)
20810 {
20811 SIGNDOC_free (tempOutput);
20812 throw;
20813 }
20814 SIGNDOC_free (tempOutput);
20815 if (ex != NULL) SignDoc_throw (ex);
20816 return r;
20817 }
20818
20847 ReturnCode getSignatureBlob (const std::string &aName,
20848 std::vector<unsigned char> &aOutput)
20849 {
20850 SIGNDOC_Exception *ex = NULL;
20851 SIGNDOC_ByteArray *tempOutput = NULL;
20852 ReturnCode r;
20853 try
20854 {
20855 tempOutput = SIGNDOC_ByteArray_new (&ex);
20856 if (ex != NULL) SignDoc_throw (ex);
20857 r = (ReturnCode)SIGNDOC_VerificationResult_getSignatureBlob (&ex, p, aName.c_str (), tempOutput);
20858 assignArray (aOutput, tempOutput);
20859 }
20860 catch (...)
20861 {
20862 if (tempOutput != NULL)
20863 SIGNDOC_ByteArray_delete (tempOutput);
20864 throw;
20865 }
20866 if (tempOutput != NULL)
20867 SIGNDOC_ByteArray_delete (tempOutput);
20868 if (ex != NULL) SignDoc_throw (ex);
20869 return r;
20870 }
20871
20915 ReturnCode getBiometricData (const unsigned char *aKeyPtr, size_t aKeySize,
20916 const wchar_t *aKeyPath,
20917 const char *aPassphrase,
20918 std::vector<unsigned char> &aOutput)
20919 {
20920 SIGNDOC_Exception *ex = NULL;
20921 SIGNDOC_ByteArray *tempOutput = NULL;
20922 ReturnCode r;
20923 try
20924 {
20925 tempOutput = SIGNDOC_ByteArray_new (&ex);
20926 if (ex != NULL) SignDoc_throw (ex);
20927 r = (ReturnCode)SIGNDOC_VerificationResult_getBiometricDataW (&ex, p, aKeyPtr, aKeySize, aKeyPath, aPassphrase, tempOutput);
20928 assignArray (aOutput, tempOutput);
20929 }
20930 catch (...)
20931 {
20932 if (tempOutput != NULL)
20933 SIGNDOC_ByteArray_delete (tempOutput);
20934 throw;
20935 }
20936 if (tempOutput != NULL)
20937 SIGNDOC_ByteArray_delete (tempOutput);
20938 if (ex != NULL) SignDoc_throw (ex);
20939 return r;
20940 }
20941
20987 ReturnCode getBiometricData (Encoding aEncoding,
20988 const unsigned char *aKeyPtr, size_t aKeySize,
20989 const char *aKeyPath, const char *aPassphrase,
20990 std::vector<unsigned char> &aOutput)
20991 {
20992 SIGNDOC_Exception *ex = NULL;
20993 SIGNDOC_ByteArray *tempOutput = NULL;
20994 ReturnCode r;
20995 try
20996 {
20997 tempOutput = SIGNDOC_ByteArray_new (&ex);
20998 if (ex != NULL) SignDoc_throw (ex);
20999 r = (ReturnCode)SIGNDOC_VerificationResult_getBiometricData (&ex, p, aEncoding, aKeyPtr, aKeySize, aKeyPath, aPassphrase, tempOutput);
21000 assignArray (aOutput, tempOutput);
21001 }
21002 catch (...)
21003 {
21004 if (tempOutput != NULL)
21005 SIGNDOC_ByteArray_delete (tempOutput);
21006 throw;
21007 }
21008 if (tempOutput != NULL)
21009 SIGNDOC_ByteArray_delete (tempOutput);
21010 if (ex != NULL) SignDoc_throw (ex);
21011 return r;
21012 }
21013
21077 ReturnCode getEncryptedBiometricData (std::vector<unsigned char> &aOutput)
21078 {
21079 SIGNDOC_Exception *ex = NULL;
21080 SIGNDOC_ByteArray *tempOutput = NULL;
21081 ReturnCode r;
21082 try
21083 {
21084 tempOutput = SIGNDOC_ByteArray_new (&ex);
21085 if (ex != NULL) SignDoc_throw (ex);
21086 r = (ReturnCode)SIGNDOC_VerificationResult_getEncryptedBiometricData (&ex, p, tempOutput);
21087 assignArray (aOutput, tempOutput);
21088 }
21089 catch (...)
21090 {
21091 if (tempOutput != NULL)
21092 SIGNDOC_ByteArray_delete (tempOutput);
21093 throw;
21094 }
21095 if (tempOutput != NULL)
21096 SIGNDOC_ByteArray_delete (tempOutput);
21097 if (ex != NULL) SignDoc_throw (ex);
21098 return r;
21099 }
21100
21114 ReturnCode getBiometricEncryption (SignDocSignatureParameters::BiometricEncryption &aOutput)
21115 {
21116 SIGNDOC_Exception *ex = NULL;
21117 int tempOutput = 0;
21118 ReturnCode r;
21119 try
21120 {
21121 r = (ReturnCode)SIGNDOC_VerificationResult_getBiometricEncryption (&ex, p, &tempOutput);
21122 aOutput = (SignDocSignatureParameters::BiometricEncryption )tempOutput;
21123 }
21124 catch (...)
21125 {
21126 throw;
21127 }
21128 if (ex != NULL) SignDoc_throw (ex);
21129 return r;
21130 }
21131
21148 ReturnCode checkBiometricHash (const unsigned char *aBioPtr, size_t aBioSize,
21149 bool &aOutput)
21150 {
21151 SIGNDOC_Exception *ex = NULL;
21152 SIGNDOC_Boolean tempOutput = 0;
21153 ReturnCode r;
21154 try
21155 {
21156 r = (ReturnCode)SIGNDOC_VerificationResult_checkBiometricHash (&ex, p, aBioPtr, aBioSize, &tempOutput);
21157 aOutput = (bool )tempOutput;
21158 }
21159 catch (...)
21160 {
21161 throw;
21162 }
21163 if (ex != NULL) SignDoc_throw (ex);
21164 return r;
21165 }
21166
21174 ReturnCode getTimeStampState (TimeStampState &aOutput)
21175 {
21176 SIGNDOC_Exception *ex = NULL;
21177 int tempOutput = 0;
21178 ReturnCode r;
21179 try
21180 {
21181 r = (ReturnCode)SIGNDOC_VerificationResult_getTimeStampState (&ex, p, &tempOutput);
21182 aOutput = (TimeStampState )tempOutput;
21183 }
21184 catch (...)
21185 {
21186 throw;
21187 }
21188 if (ex != NULL) SignDoc_throw (ex);
21189 return r;
21190 }
21191
21214 ReturnCode getTimeStampDigestAlgorithm (std::string &aOutput)
21215 {
21216 SIGNDOC_Exception *ex = NULL;
21217 char *tempOutput = NULL;
21218 ReturnCode r;
21219 try
21220 {
21221 r = (ReturnCode)SIGNDOC_VerificationResult_getTimeStampDigestAlgorithm (&ex, p, &tempOutput);
21222 if (tempOutput != NULL)
21223 aOutput = tempOutput;
21224 }
21225 catch (...)
21226 {
21227 SIGNDOC_free (tempOutput);
21228 throw;
21229 }
21230 SIGNDOC_free (tempOutput);
21231 if (ex != NULL) SignDoc_throw (ex);
21232 return r;
21233 }
21234
21253 ReturnCode verifyTimeStampCertificateChain (const SignDocVerificationParameters *aParameters,
21254 CertificateChainState &aOutput)
21255 {
21256 SIGNDOC_Exception *ex = NULL;
21257 int tempOutput = 0;
21258 ReturnCode r;
21259 try
21260 {
21261 r = (ReturnCode)SIGNDOC_VerificationResult_verifyTimeStampCertificateChain (&ex, p, aParameters == NULL ? NULL : aParameters->getImpl (), &tempOutput);
21262 aOutput = (CertificateChainState )tempOutput;
21263 }
21264 catch (...)
21265 {
21266 throw;
21267 }
21268 if (ex != NULL) SignDoc_throw (ex);
21269 return r;
21270 }
21271
21293 ReturnCode getTimeStampCertificateRevocationState (CertificateRevocationState &aOutput)
21294 {
21295 SIGNDOC_Exception *ex = NULL;
21296 int tempOutput = 0;
21297 ReturnCode r;
21298 try
21299 {
21300 r = (ReturnCode)SIGNDOC_VerificationResult_getTimeStampCertificateRevocationState (&ex, p, &tempOutput);
21301 aOutput = (CertificateRevocationState )tempOutput;
21302 }
21303 catch (...)
21304 {
21305 throw;
21306 }
21307 if (ex != NULL) SignDoc_throw (ex);
21308 return r;
21309 }
21310
21339 ReturnCode verifyTimeStampCertificateSimplified (const SignDocVerificationParameters *aParameters)
21340 {
21341 SIGNDOC_Exception *ex = NULL;
21342 ReturnCode r;
21343 r = (ReturnCode)SIGNDOC_VerificationResult_verifyTimeStampCertificateSimplified (&ex, p, aParameters == NULL ? NULL : aParameters->getImpl ());
21344 if (ex != NULL) SignDoc_throw (ex);
21345 return r;
21346 }
21347
21368 ReturnCode getTimeStamp (std::string &aOutput)
21369 {
21370 SIGNDOC_Exception *ex = NULL;
21371 char *tempOutput = NULL;
21372 ReturnCode r;
21373 try
21374 {
21375 r = (ReturnCode)SIGNDOC_VerificationResult_getTimeStamp (&ex, p, &tempOutput);
21376 if (tempOutput != NULL)
21377 aOutput = tempOutput;
21378 }
21379 catch (...)
21380 {
21381 SIGNDOC_free (tempOutput);
21382 throw;
21383 }
21384 SIGNDOC_free (tempOutput);
21385 if (ex != NULL) SignDoc_throw (ex);
21386 return r;
21387 }
21388
21399 ReturnCode getTimeStampCertificates (std::vector<std::vector<unsigned char> > &aOutput)
21400 {
21401 SIGNDOC_Exception *ex = NULL;
21402 SIGNDOC_ByteArrayArray *tempOutput = NULL;
21403 ReturnCode r;
21404 try
21405 {
21406 tempOutput = SIGNDOC_ByteArrayArray_new (&ex);
21407 if (ex != NULL) SignDoc_throw (ex);
21408 r = (ReturnCode)SIGNDOC_VerificationResult_getTimeStampCertificates (&ex, p, tempOutput);
21409 assignArray (aOutput, tempOutput);
21410 }
21411 catch (...)
21412 {
21413 if (tempOutput != NULL)
21414 SIGNDOC_ByteArrayArray_delete (tempOutput);
21415 throw;
21416 }
21417 if (tempOutput != NULL)
21418 SIGNDOC_ByteArrayArray_delete (tempOutput);
21419 if (ex != NULL) SignDoc_throw (ex);
21420 return r;
21421 }
21422
21436 const char *getErrorMessage (Encoding aEncoding) const
21437 {
21438 SIGNDOC_Exception *ex = NULL;
21439 const char *r;
21440 r = SIGNDOC_VerificationResult_getErrorMessage (&ex, p, aEncoding);
21441 if (ex != NULL) SignDoc_throw (ex);
21442 return r;
21443 }
21444
21456 const wchar_t *getErrorMessageW () const
21457 {
21458 SIGNDOC_Exception *ex = NULL;
21459 const wchar_t *r;
21460 r = SIGNDOC_VerificationResult_getErrorMessageW (&ex, p);
21461 if (ex != NULL) SignDoc_throw (ex);
21462 return r;
21463 }
21468 SignDocVerificationResult (SIGNDOC_VerificationResult *aP) : p (aP) { }
21469
21474 SIGNDOC_VerificationResult *getImpl () { return p; }
21475
21480 const SIGNDOC_VerificationResult *getImpl () const { return p; }
21481
21486 void setImpl (SIGNDOC_VerificationResult *aP) { SIGNDOC_VerificationResult_delete (p); p = aP; }
21487
21488 private:
21489 SIGNDOC_VerificationResult *p;
21490 };
21491
21495 class SignDocPdfDocumentHandler : public SignDocDocumentHandler
21496 {
21497 public:
21498
21504 static SignDocDocumentHandler *create ()
21505 {
21506 SIGNDOC_Exception *ex = NULL;
21507 SIGNDOC_DocumentHandler *r;
21508 r = SIGNDOC_PdfDocumentHandler_new (&ex);
21509 if (ex != NULL) SignDoc_throw (ex);
21510 if (r == NULL)
21511 return NULL;
21512 try
21513 {
21514 return new SignDocDocumentHandler (r);
21515 }
21516 catch (...)
21517 {
21518 SIGNDOC_DocumentHandler_delete (r);
21519 throw;
21520 }
21521 }
21522
21523 private:
21528 SignDocPdfDocumentHandler ();
21529
21534 SignDocPdfDocumentHandler (const SIGNDOC_PdfDocumentHandler &);
21535
21540 SignDocPdfDocumentHandler& operator= (const SIGNDOC_PdfDocumentHandler &);
21541 };
21542
21546 class SignDocTiffDocumentHandler : public SignDocDocumentHandler
21547 {
21548 public:
21549
21555 static SignDocDocumentHandler *create ()
21556 {
21557 SIGNDOC_Exception *ex = NULL;
21558 SIGNDOC_DocumentHandler *r;
21559 r = SIGNDOC_TiffDocumentHandler_new (&ex);
21560 if (ex != NULL) SignDoc_throw (ex);
21561 if (r == NULL)
21562 return NULL;
21563 try
21564 {
21565 return new SignDocDocumentHandler (r);
21566 }
21567 catch (...)
21568 {
21569 SIGNDOC_DocumentHandler_delete (r);
21570 throw;
21571 }
21572 }
21573
21574 private:
21579 SignDocTiffDocumentHandler ();
21580
21585 SignDocTiffDocumentHandler (const SIGNDOC_TiffDocumentHandler &);
21586
21591 SignDocTiffDocumentHandler& operator= (const SIGNDOC_TiffDocumentHandler &);
21592 };
21593
21594 inline SignDocVerificationResult *
21595 makeSignDocVerificationResult (SIGNDOC_VerificationResult *aP)
21596 {
21597 if (aP == NULL)
21598 return NULL;
21599 return new SignDocVerificationResult (aP);
21600 }
21601
21602 #ifdef _MSC_VER
21603 #pragma warning(pop)
21604 #endif
21605
21606 }}}
21607
21608 #endif