mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
AP - N/R/D
This commit is contained in:
@ -31,7 +31,6 @@
|
||||
#include "UTF8.h"
|
||||
#include "PDF417Barcode.h"
|
||||
#include "AcroForm.h"
|
||||
#include "GlobalParams.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
@ -563,11 +562,6 @@ void AcroForm::draw(int pageNum, Gfx *gfx, GBool printing) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fields->getLength(); ++i) {
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
int formField = globalParams->getDrawFormField();
|
||||
if (formField >= 0 && formField != i)
|
||||
continue;
|
||||
#endif
|
||||
((AcroFormField *)fields->get(i))->draw(pageNum, gfx, printing);
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1097,8 @@ void AcroFormField::draw(int pageNum, Gfx *gfx, GBool printing) {
|
||||
}
|
||||
|
||||
void AcroFormField::drawAnnot(int pageNum, Gfx *gfx, GBool printing,
|
||||
Object *annotRef, Object *annotObj) {
|
||||
Object *annotRef, Object *annotObj,
|
||||
const char* AP, const char* AS, GBool hide) {
|
||||
Object obj1, obj2;
|
||||
double xMin, yMin, xMax, yMax, t;
|
||||
int annotFlags;
|
||||
@ -1129,8 +1124,7 @@ void AcroFormField::drawAnnot(int pageNum, Gfx *gfx, GBool printing,
|
||||
annotFlags = 0;
|
||||
}
|
||||
obj1.free();
|
||||
if (globalParams->getDrawFormField() < 0 &&
|
||||
((annotFlags & annotFlagHidden) ||
|
||||
if (hide && ((annotFlags & annotFlagHidden) ||
|
||||
(printing && !(annotFlags & annotFlagPrint)) ||
|
||||
(!printing && (annotFlags & annotFlagNoView)))) {
|
||||
return;
|
||||
@ -1197,7 +1191,7 @@ void AcroFormField::drawAnnot(int pageNum, Gfx *gfx, GBool printing,
|
||||
xMin, yMin, xMax, yMax);
|
||||
} else {
|
||||
drawExistingAppearance(gfx, annotObj->getDict(),
|
||||
xMin, yMin, xMax, yMax);
|
||||
xMin, yMin, xMax, yMax, AP, AS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1205,15 +1199,20 @@ void AcroFormField::drawAnnot(int pageNum, Gfx *gfx, GBool printing,
|
||||
// attached to this field.
|
||||
void AcroFormField::drawExistingAppearance(Gfx *gfx, Dict *annot,
|
||||
double xMin, double yMin,
|
||||
double xMax, double yMax) {
|
||||
double xMax, double yMax,
|
||||
const char* AP, const char* AS) {
|
||||
Object apObj, asObj, appearance, obj1;
|
||||
|
||||
//----- get the appearance stream
|
||||
|
||||
if (annot->lookup("AP", &apObj)->isDict()) {
|
||||
apObj.dictLookup("N", &obj1);
|
||||
if (!strcmp("MK", AP) && annot->lookup("MK", &apObj)->isDict()) {
|
||||
apObj.dictLookupNF(AS, &appearance);
|
||||
} else if (annot->lookup("AP", &apObj)->isDict()) {
|
||||
apObj.dictLookup(AP, &obj1);
|
||||
if (obj1.isDict()) {
|
||||
if (annot->lookup("AS", &asObj)->isName()) {
|
||||
if (AS) {
|
||||
obj1.dictLookupNF(AS, &appearance);
|
||||
} else if (annot->lookup("AS", &asObj)->isName()) {
|
||||
obj1.dictLookupNF(asObj.getName(), &appearance);
|
||||
} else if (obj1.dictGetLength() == 1) {
|
||||
obj1.dictGetValNF(0, &appearance);
|
||||
@ -1222,7 +1221,7 @@ void AcroFormField::drawExistingAppearance(Gfx *gfx, Dict *annot,
|
||||
}
|
||||
asObj.free();
|
||||
} else {
|
||||
apObj.dictLookupNF("N", &appearance);
|
||||
apObj.dictLookupNF(AP ? AP : "N", &appearance);
|
||||
}
|
||||
obj1.free();
|
||||
}
|
||||
|
||||
@ -100,6 +100,9 @@ public:
|
||||
Object *getParentRef(Object *parent);
|
||||
Object *fieldLookup(const char *key, Object *obj);
|
||||
GBool getTypeFromParent() { return typeFromParent; }
|
||||
void drawAnnot(int pageNum, Gfx *gfx, GBool printing,
|
||||
Object *annotRef, Object *annotObj,
|
||||
const char* AP = "N", const char* AS = 0, GBool hide = gTrue);
|
||||
|
||||
private:
|
||||
|
||||
@ -108,11 +111,10 @@ private:
|
||||
Guint flagsA, GBool typeFromParentA, XFAField *xfaFieldA);
|
||||
Ref findFontName(char *fontTag);
|
||||
void draw(int pageNum, Gfx *gfx, GBool printing);
|
||||
void drawAnnot(int pageNum, Gfx *gfx, GBool printing,
|
||||
Object *annotRef, Object *annotObj);
|
||||
void drawExistingAppearance(Gfx *gfx, Dict *annot,
|
||||
double xMin, double yMin,
|
||||
double xMax, double yMax);
|
||||
double xMax, double yMax,
|
||||
const char* AP, const char* AS);
|
||||
void drawNewAppearance(Gfx *gfx, Dict *annot,
|
||||
double xMin, double yMin,
|
||||
double xMax, double yMax);
|
||||
|
||||
@ -734,7 +734,6 @@ GlobalParams::GlobalParams(const char *cfgFileName) {
|
||||
enablePathSimplification = gFalse;
|
||||
drawAnnotations = gTrue;
|
||||
drawFormFields = gTrue;
|
||||
drawContent = gTrue;
|
||||
overprintPreview = gFalse;
|
||||
paperColor = new GString("#ffffff");
|
||||
matteColor = new GString("#808080");
|
||||
@ -754,7 +753,6 @@ GlobalParams::GlobalParams(const char *cfgFileName) {
|
||||
printCommands = gFalse;
|
||||
errQuiet = gFalse;
|
||||
debugLogFile = NULL;
|
||||
drawFormField = -1;
|
||||
|
||||
cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
|
||||
unicodeToUnicodeCache =
|
||||
@ -3160,23 +3158,7 @@ GBool GlobalParams::getDrawFormFields() {
|
||||
return draw;
|
||||
}
|
||||
|
||||
GBool GlobalParams::getDrawContent() {
|
||||
GBool draw;
|
||||
|
||||
lockGlobalParams;
|
||||
draw = drawContent;
|
||||
unlockGlobalParams;
|
||||
return draw;
|
||||
}
|
||||
|
||||
int GlobalParams::getDrawFormField() {
|
||||
int formField;
|
||||
|
||||
lockGlobalParams;
|
||||
formField = drawFormField;
|
||||
unlockGlobalParams;
|
||||
return formField;
|
||||
}
|
||||
|
||||
GString *GlobalParams::getPaperColor() {
|
||||
GString *s;
|
||||
@ -3722,30 +3704,12 @@ void GlobalParams::setScreenWhiteThreshold(double thresh) {
|
||||
unlockGlobalParams;
|
||||
}
|
||||
|
||||
void GlobalParams::setDrawAnnotations(GBool draw) {
|
||||
lockGlobalParams;
|
||||
drawAnnotations = draw;
|
||||
unlockGlobalParams;
|
||||
}
|
||||
|
||||
void GlobalParams::setDrawFormFields(GBool draw) {
|
||||
lockGlobalParams;
|
||||
drawFormFields = draw;
|
||||
unlockGlobalParams;
|
||||
}
|
||||
|
||||
void GlobalParams::setDrawContent(GBool draw) {
|
||||
lockGlobalParams;
|
||||
drawContent = draw;
|
||||
unlockGlobalParams;
|
||||
}
|
||||
|
||||
void GlobalParams::setDrawFormField(int formField) {
|
||||
lockGlobalParams;
|
||||
drawFormField = formField;
|
||||
unlockGlobalParams;
|
||||
}
|
||||
|
||||
void GlobalParams::setOverprintPreview(GBool preview) {
|
||||
lockGlobalParams;
|
||||
overprintPreview = preview;
|
||||
|
||||
@ -325,8 +325,6 @@ public:
|
||||
GBool getEnablePathSimplification();
|
||||
GBool getDrawAnnotations();
|
||||
GBool getDrawFormFields();
|
||||
GBool getDrawContent();
|
||||
int getDrawFormField();
|
||||
GBool getOverprintPreview() { return overprintPreview; }
|
||||
GString *getPaperColor();
|
||||
GString *getMatteColor();
|
||||
@ -393,10 +391,7 @@ public:
|
||||
void setScreenGamma(double gamma);
|
||||
void setScreenBlackThreshold(double thresh);
|
||||
void setScreenWhiteThreshold(double thresh);
|
||||
void setDrawAnnotations(GBool draw);
|
||||
void setDrawFormFields(GBool draw);
|
||||
void setDrawContent(GBool draw);
|
||||
void setDrawFormField(int formField);
|
||||
void setOverprintPreview(GBool preview);
|
||||
void setMapNumericCharNames(GBool map);
|
||||
void setMapUnknownCharNames(GBool map);
|
||||
@ -574,7 +569,6 @@ private:
|
||||
enablePathSimplification;
|
||||
GBool drawAnnotations; // draw annotations or not
|
||||
GBool drawFormFields; // draw form fields or not
|
||||
GBool drawContent; // draw content or not
|
||||
GBool overprintPreview; // enable overprint preview
|
||||
GString *paperColor; // paper (page background) color
|
||||
GString *matteColor; // matte (background outside of page) color
|
||||
@ -596,7 +590,6 @@ private:
|
||||
GBool printCommands; // print the drawing commands
|
||||
GBool errQuiet; // suppress error messages?
|
||||
GString *debugLogFile; // path for debug log file
|
||||
int drawFormField;
|
||||
|
||||
CharCodeToUnicodeCache *cidToUnicodeCache;
|
||||
CharCodeToUnicodeCache *unicodeToUnicodeCache;
|
||||
|
||||
@ -373,8 +373,7 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
|
||||
contents.fetch(xref, &obj);
|
||||
if (!obj.isNull()) {
|
||||
gfx->saveState();
|
||||
if (globalParams->getDrawContent())
|
||||
gfx->display(&contents);
|
||||
gfx->display(&contents);
|
||||
gfx->endOfPage();
|
||||
}
|
||||
obj.free();
|
||||
|
||||
Reference in New Issue
Block a user