Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Persch
poppler
Commits
aa864c87
Commit
aa864c87
authored
Nov 14, 2018
by
Albert Astals Cid
Committed by
Albert Astals Cid
Nov 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save an incRef/decRef when creating FormField
parent
f846c9a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
poppler/Form.cc
poppler/Form.cc
+19
-19
poppler/Form.h
poppler/Form.h
+6
-6
No files found.
poppler/Form.cc
View file @
aa864c87
...
...
@@ -608,11 +608,11 @@ void FormWidgetSignature::updateWidgetAppearance()
// FormField
//========================================================================
FormField
::
FormField
(
PDFDoc
*
docA
,
Object
*
aobj
,
const
Ref
aref
,
FormField
*
parentA
,
std
::
set
<
int
>
*
usedParents
,
FormFieldType
ty
)
FormField
::
FormField
(
PDFDoc
*
docA
,
Object
&&
aobj
,
const
Ref
aref
,
FormField
*
parentA
,
std
::
set
<
int
>
*
usedParents
,
FormFieldType
ty
)
{
doc
=
docA
;
xref
=
doc
->
getXRef
();
obj
=
aobj
->
copy
(
);
obj
=
std
::
move
(
aobj
);
Dict
*
dict
=
obj
.
getDict
();
ref
.
num
=
ref
.
gen
=
0
;
type
=
ty
;
...
...
@@ -664,7 +664,7 @@ FormField::FormField(PDFDoc *docA, Object *aobj, const Ref aref, FormField *pare
numChildren
++
;
children
=
(
FormField
**
)
greallocn
(
children
,
numChildren
,
sizeof
(
FormField
*
));
children
[
numChildren
-
1
]
=
Form
::
createFieldFromDict
(
&
childObj
,
doc
,
ref
,
this
,
&
usedParentsAux
);
children
[
numChildren
-
1
]
=
Form
::
createFieldFromDict
(
std
::
move
(
childObj
)
,
doc
,
ref
,
this
,
&
usedParentsAux
);
}
else
{
obj2
=
childObj
.
dictLookup
(
"Subtype"
);
if
(
obj2
.
isName
(
"Widget"
))
{
...
...
@@ -966,8 +966,8 @@ void FormField::setReadOnly (bool value)
//------------------------------------------------------------------------
// FormFieldButton
//------------------------------------------------------------------------
FormFieldButton
::
FormFieldButton
(
PDFDoc
*
docA
,
Object
*
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
aobj
,
ref
,
parent
,
usedParents
,
formButton
)
FormFieldButton
::
FormFieldButton
(
PDFDoc
*
docA
,
Object
&&
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
std
::
move
(
aobj
)
,
ref
,
parent
,
usedParents
,
formButton
)
{
Dict
*
dict
=
obj
.
getDict
();
active_child
=
-
1
;
...
...
@@ -1133,8 +1133,8 @@ FormFieldButton::~FormFieldButton()
//------------------------------------------------------------------------
// FormFieldText
//------------------------------------------------------------------------
FormFieldText
::
FormFieldText
(
PDFDoc
*
docA
,
Object
*
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
aobj
,
ref
,
parent
,
usedParents
,
formText
)
FormFieldText
::
FormFieldText
(
PDFDoc
*
docA
,
Object
&&
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
std
::
move
(
aobj
)
,
ref
,
parent
,
usedParents
,
formText
)
{
Dict
*
dict
=
obj
.
getDict
();
Object
obj1
;
...
...
@@ -1296,8 +1296,8 @@ int FormFieldText::parseDA(GooList* daToks)
//------------------------------------------------------------------------
// FormFieldChoice
//------------------------------------------------------------------------
FormFieldChoice
::
FormFieldChoice
(
PDFDoc
*
docA
,
Object
*
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
aobj
,
ref
,
parent
,
usedParents
,
formChoice
)
FormFieldChoice
::
FormFieldChoice
(
PDFDoc
*
docA
,
Object
&&
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
std
::
move
(
aobj
)
,
ref
,
parent
,
usedParents
,
formChoice
)
{
numChoices
=
0
;
choices
=
nullptr
;
...
...
@@ -1588,8 +1588,8 @@ const GooString *FormFieldChoice::getSelectedChoice() const {
//------------------------------------------------------------------------
// FormFieldSignature
//------------------------------------------------------------------------
FormFieldSignature
::
FormFieldSignature
(
PDFDoc
*
docA
,
Object
*
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
dict
,
ref
,
parent
,
usedParents
,
formSignature
),
FormFieldSignature
::
FormFieldSignature
(
PDFDoc
*
docA
,
Object
&&
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
:
FormField
(
docA
,
std
::
move
(
dict
)
,
ref
,
parent
,
usedParents
,
formSignature
),
signature_type
(
adbe_pkcs7_detached
),
signature
(
nullptr
),
signature_info
(
nullptr
)
{
...
...
@@ -1835,7 +1835,7 @@ Form::Form(PDFDoc *docA, Object* acroFormA)
}
std
::
set
<
int
>
usedParents
;
rootFields
[
numFields
++
]
=
createFieldFromDict
(
&
obj2
,
doc
,
oref
.
getRef
(),
nullptr
,
&
usedParents
);
rootFields
[
numFields
++
]
=
createFieldFromDict
(
std
::
move
(
obj2
)
,
doc
,
oref
.
getRef
(),
nullptr
,
&
usedParents
);
}
}
else
{
...
...
@@ -1898,21 +1898,21 @@ Object Form::fieldLookup(Dict *field, const char *key) {
return
::
fieldLookup
(
field
,
key
,
&
usedParents
);
}
FormField
*
Form
::
createFieldFromDict
(
Object
*
obj
,
PDFDoc
*
docA
,
const
Ref
pref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
FormField
*
Form
::
createFieldFromDict
(
Object
&&
obj
,
PDFDoc
*
docA
,
const
Ref
pref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
)
{
FormField
*
field
;
Object
obj2
=
Form
::
fieldLookup
(
obj
->
getDict
(),
"FT"
);
const
Object
obj2
=
Form
::
fieldLookup
(
obj
.
getDict
(),
"FT"
);
if
(
obj2
.
isName
(
"Btn"
))
{
field
=
new
FormFieldButton
(
docA
,
obj
,
pref
,
parent
,
usedParents
);
field
=
new
FormFieldButton
(
docA
,
std
::
move
(
obj
)
,
pref
,
parent
,
usedParents
);
}
else
if
(
obj2
.
isName
(
"Tx"
))
{
field
=
new
FormFieldText
(
docA
,
obj
,
pref
,
parent
,
usedParents
);
field
=
new
FormFieldText
(
docA
,
std
::
move
(
obj
)
,
pref
,
parent
,
usedParents
);
}
else
if
(
obj2
.
isName
(
"Ch"
))
{
field
=
new
FormFieldChoice
(
docA
,
obj
,
pref
,
parent
,
usedParents
);
field
=
new
FormFieldChoice
(
docA
,
std
::
move
(
obj
)
,
pref
,
parent
,
usedParents
);
}
else
if
(
obj2
.
isName
(
"Sig"
))
{
field
=
new
FormFieldSignature
(
docA
,
obj
,
pref
,
parent
,
usedParents
);
field
=
new
FormFieldSignature
(
docA
,
std
::
move
(
obj
)
,
pref
,
parent
,
usedParents
);
}
else
{
//we don't have an FT entry => non-terminal field
field
=
new
FormField
(
docA
,
obj
,
pref
,
parent
,
usedParents
);
field
=
new
FormField
(
docA
,
std
::
move
(
obj
)
,
pref
,
parent
,
usedParents
);
}
return
field
;
...
...
poppler/Form.h
View file @
aa864c87
...
...
@@ -287,7 +287,7 @@ public:
class
FormField
{
public:
FormField
(
PDFDoc
*
docA
,
Object
*
aobj
,
const
Ref
aref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
,
FormFieldType
t
=
formUndef
);
FormField
(
PDFDoc
*
docA
,
Object
&&
aobj
,
const
Ref
aref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
,
FormFieldType
t
=
formUndef
);
virtual
~
FormField
();
...
...
@@ -359,7 +359,7 @@ private:
class
FormFieldButton
:
public
FormField
{
public:
FormFieldButton
(
PDFDoc
*
docA
,
Object
*
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
FormFieldButton
(
PDFDoc
*
docA
,
Object
&&
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
FormButtonType
getButtonType
()
const
{
return
btype
;
}
...
...
@@ -403,7 +403,7 @@ protected:
class
FormFieldText
:
public
FormField
{
public:
FormFieldText
(
PDFDoc
*
docA
,
Object
*
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
FormFieldText
(
PDFDoc
*
docA
,
Object
&&
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
const
GooString
*
getContent
()
const
{
return
content
;
}
void
setContentCopy
(
const
GooString
*
new_content
);
...
...
@@ -448,7 +448,7 @@ protected:
class
FormFieldChoice
:
public
FormField
{
public:
FormFieldChoice
(
PDFDoc
*
docA
,
Object
*
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
FormFieldChoice
(
PDFDoc
*
docA
,
Object
&&
aobj
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
~
FormFieldChoice
();
...
...
@@ -516,7 +516,7 @@ protected:
class
FormFieldSignature
:
public
FormField
{
friend
class
FormWidgetSignature
;
public:
FormFieldSignature
(
PDFDoc
*
docA
,
Object
*
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
FormFieldSignature
(
PDFDoc
*
docA
,
Object
&&
dict
,
const
Ref
ref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
// Use -1 for now as validationTime
SignatureInfo
*
validateSignature
(
bool
doVerifyCert
,
bool
forceRevalidation
,
time_t
validationTime
);
...
...
@@ -557,7 +557,7 @@ public:
/* Creates a new Field of the type specified in obj's dict.
used in Form::Form and FormField::FormField */
static
FormField
*
createFieldFromDict
(
Object
*
obj
,
PDFDoc
*
docA
,
const
Ref
aref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
static
FormField
*
createFieldFromDict
(
Object
&&
obj
,
PDFDoc
*
docA
,
const
Ref
aref
,
FormField
*
parent
,
std
::
set
<
int
>
*
usedParents
);
Object
*
getObj
()
const
{
return
acroForm
;
}
bool
getNeedAppearances
()
const
{
return
needAppearances
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment