--- poppler/Form.cc +++ poppler/Form.cc @@ -463,12 +463,11 @@ // FormField //======================================================================== -FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parentA, std::set *usedParents, FormFieldType ty) +FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parentA, FormFieldType ty) { doc = docA; xref = doc->getXRef(); obj = aobj->copy(); - Dict* dict = obj.getDict(); ref.num = ref.gen = 0; type = ty; parent = parentA; @@ -483,7 +482,11 @@ hasQuadding = gFalse; ref = aref; +} +void FormField::init(std::set *usedParents) +{ + Dict* dict = obj.getDict(); //childs Object obj1 = dict->lookup("Kids"); if (obj1.isArray()) { @@ -803,9 +806,15 @@ //------------------------------------------------------------------------ // FormFieldButton //------------------------------------------------------------------------ -FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set *usedParents) - : FormField(docA, aobj, ref, parent, usedParents, formButton) +FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent) + : FormField(docA, aobj, ref, parent, formButton) { +} + +void FormFieldButton::init(std::set *usedParents) +{ + FormField::init(usedParents); + Dict* dict = obj.getDict(); active_child = -1; noAllOff = false; @@ -983,9 +992,15 @@ //------------------------------------------------------------------------ // FormFieldText //------------------------------------------------------------------------ -FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set *usedParents) - : FormField(docA, aobj, ref, parent, usedParents, formText) +FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent) + : FormField(docA, aobj, ref, parent, formText) { +} + +void FormFieldText::init(std::set *usedParents) +{ + FormField::init(usedParents); + Dict* dict = obj.getDict(); Object obj1; content = NULL; @@ -1076,9 +1091,15 @@ //------------------------------------------------------------------------ // FormFieldChoice //------------------------------------------------------------------------ -FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set *usedParents) - : FormField(docA, aobj, ref, parent, usedParents, formChoice) +FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent) + : FormField(docA, aobj, ref, parent, formChoice) { +} + +void FormFieldChoice::init(std::set *usedParents) +{ + FormField::init(usedParents); + numChoices = 0; choices = NULL; editedChoice = NULL; @@ -1379,11 +1400,17 @@ //------------------------------------------------------------------------ // FormFieldSignature //------------------------------------------------------------------------ -FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents) - : FormField(docA, dict, ref, parent, usedParents, formSignature), +FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent) + : FormField(docA, dict, ref, parent, formSignature), signature_type(adbe_pkcs7_detached), signature(nullptr), signature_info(nullptr) { +} + +void FormFieldSignature::init(std::set *usedParents) +{ + FormField::init(usedParents); + signature = NULL; signature_info = new SignatureInfo(); @@ -1691,15 +1718,15 @@ Object obj2 = Form::fieldLookup(obj->getDict (), "FT"); if (obj2.isName("Btn")) { - field = new FormFieldButton(docA, obj, pref, parent, usedParents); + field = FormFieldButton::create(docA, obj, pref, parent, usedParents); } else if (obj2.isName("Tx")) { - field = new FormFieldText(docA, obj, pref, parent, usedParents); + field = FormFieldText::create(docA, obj, pref, parent, usedParents); } else if (obj2.isName("Ch")) { - field = new FormFieldChoice(docA, obj, pref, parent, usedParents); + field = FormFieldChoice::create(docA, obj, pref, parent, usedParents); } else if (obj2.isName("Sig")) { - field = new FormFieldSignature(docA, obj, pref, parent, usedParents); + field = FormFieldSignature::create(docA, obj, pref, parent, usedParents); } else { //we don't have an FT entry => non-terminal field - field = new FormField(docA, obj, pref, parent, usedParents); + field = FormField::create(docA, obj, pref, parent, usedParents); } return field; --- poppler/Form.h +++ poppler/Form.h @@ -264,8 +264,16 @@ //------------------------------------------------------------------------ class FormField { -public: - FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, std::set *usedParents, FormFieldType t=formUndef); +protected: + FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, FormFieldType t); + void init(std::set *usedParents); +public: + static FormField *create(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, std::set *usedParents, FormFieldType t=formUndef) + { + FormField *f = new FormField(docA, aobj, aref, parent, t); + f->init(usedParents); + return f; + } virtual ~FormField(); @@ -338,8 +346,16 @@ //------------------------------------------------------------------------ class FormFieldButton: public FormField { -public: - FormFieldButton(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents); +private: + FormFieldButton(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent); + void init(std::set *usedParents); +public: + static FormFieldButton *create(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents) + { + FormFieldButton *f = new FormFieldButton(docA, dict, ref, parent); + f->init(usedParents); + return f; + } FormButtonType getButtonType () { return btype; } @@ -384,8 +400,16 @@ //------------------------------------------------------------------------ class FormFieldText: public FormField { -public: - FormFieldText(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents); +private: + FormFieldText(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent); + void init(std::set *usedParents); +public: + static FormFieldText *create(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents) + { + FormFieldText *f = new FormFieldText(docA, dict, ref, parent); + f->init(usedParents); + return f; + } GooString* getContent () { return content; } GooString* getContentCopy (); @@ -422,8 +446,16 @@ //------------------------------------------------------------------------ class FormFieldChoice: public FormField { -public: - FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set *usedParents); +private: + FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent); + void init(std::set *usedParents); +public: + static FormFieldChoice *create(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set *usedParents) + { + FormFieldChoice *f = new FormFieldChoice(docA, aobj, ref, parent); + f->init(usedParents); + return f; + } ~FormFieldChoice(); @@ -491,8 +523,16 @@ class FormFieldSignature: public FormField { friend class FormWidgetSignature; -public: - FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents); +private: + FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent); + void init(std::set *usedParents); +public: + static FormFieldSignature *create(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set *usedParents) + { + FormFieldSignature *f = new FormFieldSignature(docA, dict, ref, parent); + f->init(usedParents); + return f; + } // Use -1 for now as validationTime SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime); --- poppler/XRef.cc +++ poppler/XRef.cc @@ -293,6 +293,7 @@ xRefStream = gFalse; scannedSpecialFlags = gFalse; encrypted = gFalse; + encAlgorithm = cryptRC4; permFlags = defPermFlags; ownerPasswordOk = gFalse; rootNum = -1; /suse-4.0.3 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff