[poppler] 2 commits - poppler/Catalog.cc poppler/ViewerPreferences.cc poppler/ViewerPreferences.h
Pino Toscano
pino at kemper.freedesktop.org
Tue Mar 29 02:08:00 PDT 2011
poppler/Catalog.cc | 1 +
poppler/ViewerPreferences.cc | 24 ++++++++++++++++++++++++
poppler/ViewerPreferences.h | 14 ++++++++++++++
3 files changed, 39 insertions(+)
New commits:
commit 74ec81d66d4d5bc45cccc4aa8794df1c517f2d74
Author: Pino Toscano <pino at kde.org>
Date: Tue Mar 29 11:07:36 2011 +0200
viewer preferences: read PrintScaling and Duplex
diff --git a/poppler/ViewerPreferences.cc b/poppler/ViewerPreferences.cc
index bf78db8..cba8d0a 100644
--- a/poppler/ViewerPreferences.cc
+++ b/poppler/ViewerPreferences.cc
@@ -74,6 +74,28 @@ ViewerPreferences::ViewerPreferences(Dict *prefDict)
}
}
obj.free();
+
+ if (prefDict->lookup("PrintScaling", &obj)->isName()) {
+ const char *ps = obj.getName();
+ if (!strcmp(ps, "None")) {
+ printScaling = printScalingNone;
+ } else if (!strcmp(ps, "AppDefault")) {
+ printScaling = printScalingAppDefault;
+ }
+ }
+ obj.free();
+
+ if (prefDict->lookup("Duplex", &obj)->isName()) {
+ const char *d = obj.getName();
+ if (!strcmp(d, "Simplex")) {
+ duplex = duplexSimplex;
+ } else if (!strcmp(d, "DuplexFlipShortEdge")) {
+ duplex = duplexDuplexFlipShortEdge;
+ } else if (!strcmp(d, "DuplexFlipLongEdge")) {
+ duplex = duplexDuplexFlipLongEdge;
+ }
+ }
+ obj.free();
}
ViewerPreferences::~ViewerPreferences()
@@ -90,4 +112,6 @@ void ViewerPreferences::init()
displayDocTitle = gFalse;
nonFullScreenPageMode = nfpmUseNone;
direction = directionL2R;
+ printScaling = printScalingAppDefault;
+ duplex = duplexNone;
}
diff --git a/poppler/ViewerPreferences.h b/poppler/ViewerPreferences.h
index 147e999..ecc5fa3 100644
--- a/poppler/ViewerPreferences.h
+++ b/poppler/ViewerPreferences.h
@@ -32,6 +32,16 @@ public:
directionL2R,
directionR2L
};
+ enum PrintScaling {
+ printScalingNone,
+ printScalingAppDefault
+ };
+ enum Duplex {
+ duplexNone,
+ duplexSimplex,
+ duplexDuplexFlipShortEdge,
+ duplexDuplexFlipLongEdge
+ };
ViewerPreferences(Dict *prefDict);
~ViewerPreferences();
@@ -44,6 +54,8 @@ public:
GBool getDisplayDocTitle() const { return displayDocTitle; }
NonFullScreenPageMode getNonFullScreenPageMode() const { return nonFullScreenPageMode; }
Direction getDirection() const { return direction; }
+ PrintScaling getPrintScaling() const { return printScaling; }
+ Duplex getDuplex() const { return duplex; }
private:
@@ -57,6 +69,8 @@ private:
GBool displayDocTitle;
NonFullScreenPageMode nonFullScreenPageMode;
Direction direction;
+ PrintScaling printScaling;
+ Duplex duplex;
};
#endif
commit b41bcd484dd7a93a339270926c57caa524059d8f
Author: Pino Toscano <pino at kde.org>
Date: Tue Mar 29 10:58:46 2011 +0200
free the viewerPreferences Object
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index cb41e92..174fd51 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -170,6 +170,7 @@ Catalog::~Catalog() {
structTreeRoot.free();
outline.free();
acroForm.free();
+ viewerPreferences.free();
}
GooString *Catalog::readMetadata() {
More information about the poppler
mailing list