SDFDoc.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------------------
00002 // Copyright (c) 2001-2008 by PDFTron Systems Inc. All Rights Reserved.
00003 // Consult legal.txt regarding legal and license information.
00004 //---------------------------------------------------------------------------------------
00005 
00006 #ifndef   H_CPPSDFDoc
00007 #define   H_CPPSDFDoc
00008 
00009 #include <Common/Matrix2D.h>
00010 #include <Filters/FilterReader.h>
00011 #include <vector>
00012 
00013 namespace pdftron { 
00014         namespace Common {
00015                 struct ProgressMonitor;
00016         }
00017 
00018         namespace SDF {
00019 
00020 
00021 // forward declarations
00022 class Obj; 
00023 class SecurityHandler;
00024 
00068 class SDFDoc
00069 {
00070 public:
00071 
00078          SDFDoc ();
00079 
00088          SDFDoc (const UString& filepath);
00089          SDFDoc (const char* filepath);
00090 
00105          SDFDoc (Filters::Filter stream);
00106 
00120          SDFDoc (const char* buf, ULong buf_size);
00121 
00125          ~SDFDoc ();
00126 
00130          bool IsEncrypted();
00131 
00157          bool InitSecurityHandler (void* custom_data = 0);
00158 
00189          bool InitStdSecurityHandler (const char* password, int password_sz = 0);
00190 
00194          bool IsModified () const; 
00195 
00199          bool IsFullSaveRequired () const;
00200 
00205          Obj GetTrailer ();
00206 
00212          Obj GetObj (const ULong obj_num) const;
00213 
00228          Obj ImportObj (Obj obj, bool deep_copy);
00229 
00244          std::vector<Obj> ImportObjs(const std::vector<Obj>& obj_list);
00245 
00249          ULong XRefSize () const;
00250 
00254          void ClearMarks ();
00255 
00256         enum SaveOptions 
00257         {
00258                 e_incremental   = 0x01,     // Save the document using incremental mode.
00259                 e_remove_unused = 0x02,     // Remove unused objects. Requires full save.
00260                 e_hex_strings   = 0x04,     // Save all string in hexadecimal format.
00261                 e_omit_xref     = 0x08,     // Do not save cross-reference table
00262                 e_linearized    = 0x10      // Save the document in linearized (fast web-view) format. Requires full save.
00263         };
00264 
00287          void Save(const UString& path, ULong flags, Common::ProgressMonitor* progress, const char* header);
00288 
00304          void Save(const char* &out_buf, ULong& out_buf_size, ULong flags, Common::ProgressMonitor* progress, const char* header); 
00305 
00314          const char* GetHeader() const;
00315 
00330          SecurityHandler GetSecurityHandler ();
00331 
00343          void SetSecurityHandler (SecurityHandler handler);
00344 
00348          void RemoveSecurity();
00349 
00350 
00366          void Swap(ULong obj_num1, ULong obj_num2);
00367 
00376          Obj CreateIndirectName(const char* name);
00377          Obj CreateIndirectArray();
00378          Obj CreateIndirectBool(bool value);
00379          Obj CreateIndirectDict();
00380          Obj CreateIndirectNull();
00381          Obj CreateIndirectNumber(double value);
00382          Obj CreateIndirectString(const UChar* value, UInt size);
00383          Obj CreateIndirectString(const UString& str);
00384          Obj CreateIndirectStream(Filters::FilterReader& data, Filters::Filter filter_chain=Filters::Filter());
00385          Obj CreateIndirectStream(const char* data, const ULong data_size, Filters::Filter filter_chain =Filters::Filter());
00386 
00387 
00407          bool IsLinearized() const;
00408 
00415          SDF::Obj GetLinearizationDict() const;
00416 
00423          SDF::Obj GetHintStream() const;
00424 
00430          void Lock();
00431 
00435          void Unlock();
00436 
00440          bool IsLocked();
00441 
00442 
00444         TRN_SDFDoc mp_doc;
00445 private:
00446 
00447         SDFDoc(SDFDoc& other);
00448         SDFDoc& operator=(SDFDoc& other);
00450 };
00451 
00452 
00453         };      // namespace SDF
00454 };      // namespace pdftron
00455 
00456 
00457 #include <Impl/SDFDoc.inl>
00458 #endif
00459 

© 2002-2008 PDFTron Systems Inc.