Commit 9fa9ac35 authored by Pino Toscano's avatar Pino Toscano

add skeleton for ViewerPreferences

a small class for handling the ViewerPreferences dictionary of a Catalog,
created on demand and in any occasion (so defaults are in one place only)
parent c6081f0b
......@@ -269,6 +269,7 @@ set(poppler_SRCS
poppler/StdinCachedFile.cc
poppler/StdinPDFDocBuilder.cc
poppler/Sound.cc
poppler/ViewerPreferences.cc
poppler/XpdfPluginAPI.cc
poppler/Movie.cc
poppler/Rendition.cc
......@@ -413,6 +414,7 @@ if(ENABLE_XPDF_HEADERS)
poppler/UnicodeCClassTables.h
poppler/UnicodeCompTables.h
poppler/UnicodeDecompTables.h
poppler/ViewerPreferences.h
poppler/XRef.h
poppler/CharTypes.h
poppler/CompactFontTables.h
......
......@@ -50,6 +50,7 @@
#include "Catalog.h"
#include "Form.h"
#include "OptionalContent.h"
#include "ViewerPreferences.h"
//------------------------------------------------------------------------
// Catalog
......@@ -75,6 +76,7 @@ Catalog::Catalog(XRef *xrefA) {
destNameTree = NULL;
embeddedFileNameTree = NULL;
jsNameTree = NULL;
viewerPreferences = NULL;
pagesList = NULL;
pagesRefList = NULL;
......@@ -160,6 +162,7 @@ Catalog::~Catalog() {
delete pageLabelInfo;
delete form;
delete optContent;
delete viewerPreferences;
metadata.free();
structTreeRoot.free();
outline.free();
......@@ -961,6 +964,26 @@ Form *Catalog::getForm()
return form;
}
ViewerPreferences *Catalog::getViewerPreferences()
{
if (!viewerPreferences) {
Object catDict;
Dict *d = NULL;
xref->getCatalog(&catDict);
if (catDict.isDict()) {
d = catDict.getDict();
} else {
error(-1, "Catalog object is wrong type (%s)", catDict.getTypeName());
}
viewerPreferences = new ViewerPreferences(d);
catDict.free();
}
return viewerPreferences;
}
Object *Catalog::getNames()
{
if (names.isNone())
......
......@@ -44,6 +44,7 @@ class LinkDest;
class PageLabelInfo;
class Form;
class OCGs;
class ViewerPreferences;
//------------------------------------------------------------------------
// NameTree
......@@ -202,6 +203,8 @@ public:
Form* getForm();
ViewerPreferences *getViewerPreferences();
enum PageMode {
pageModeNone,
pageModeOutlines,
......@@ -240,6 +243,7 @@ private:
std::vector<PageAttrs *> *attrsList;
std::vector<int> *kidsIdxList;
Form *form;
ViewerPreferences *viewerPreferences;
int numPages; // number of pages
int pagesSize; // size of pages array
Object dests; // named destination dictionary
......
......@@ -236,6 +236,7 @@ poppler_include_HEADERS = \
UnicodeCClassTables.h \
UnicodeCompTables.h \
UnicodeDecompTables.h \
ViewerPreferences.h \
XRef.h \
CharTypes.h \
CompactFontTables.h \
......@@ -310,6 +311,7 @@ libpoppler_la_SOURCES = \
strtok_r.cpp \
UnicodeMap.cc \
UnicodeTypeTable.cc \
ViewerPreferences.cc \
XRef.cc \
PSOutputDev.cc \
TextOutputDev.cc \
......
//========================================================================
//
// ViewerPreferences.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2011 Pino Toscano <pino@kde.org>
//
//========================================================================
#include <config.h>
#include "ViewerPreferences.h"
#include "Object.h"
#include "Dict.h"
ViewerPreferences::ViewerPreferences(Dict *prefDict)
{
init();
}
ViewerPreferences::~ViewerPreferences()
{
}
void ViewerPreferences::init()
{
}
//========================================================================
//
// ViewerPreferences.h
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2011 Pino Toscano <pino@kde.org>
//
//========================================================================
#ifndef VIEWERPREFERENCES_H
#define VIEWERPREFERENCES_H
#include "goo/gtypes.h"
class Dict;
//------------------------------------------------------------------------
// Hints
//------------------------------------------------------------------------
class ViewerPreferences {
public:
ViewerPreferences(Dict *prefDict);
~ViewerPreferences();
private:
void init();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment