[poppler] 3 commits - CMakeLists.txt poppler/Catalog.cc poppler/Catalog.h poppler/Makefile.am poppler/ViewerPreferences.cc poppler/ViewerPreferences.h

Carlos Garcia Campos carlosgc at gnome.org
Tue Mar 29 00:30:06 PDT 2011


Excerpts from pino's message of lun mar 28 23:21:07 +0200 2011:
>  CMakeLists.txt               |    2 
>  poppler/Catalog.cc           |   23 ++++++++++
>  poppler/Catalog.h            |    4 +
>  poppler/Makefile.am          |    2 
>  poppler/ViewerPreferences.cc |   97 +++++++++++++++++++++++++++++++++++++++++++
>  poppler/ViewerPreferences.h  |   62 +++++++++++++++++++++++++++
>  6 files changed, 190 insertions(+)

I think there should be a way to know whether the key is present in
the ViewerPreferences preferences dictionary, so that viewers could
follow the prefs only when they are present, and use their own, instead of the
default values, when not present. 

  
> +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);

It seems you are passing the catalog dict, instead of the
ViewerPreferences dict.

> +    catDict.free();
> +  }

I think we could do someting similar to what we do for annots in
Page. In Catalog constructor get the ViewerPreferences object and
check it's valid (it's a dict object at
least). This way Catalog::getViewerPreferences() already has the
viewer prefs dict to create ViewerPreferences object. I think we
shouldn't accept a NULL dict in ViewerPreferences() and return NULL
in Catalog::getViewerPreferences() when there are no preferences at
all, so that viewers know the document doesn't contain any prefs.

> +  return viewerPreferences;
> +}
> +
>  Object *Catalog::getNames()
>  {
>    if (names.isNone())

Regards, 
-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20110329/aa97a63b/attachment.pgp>


More information about the poppler mailing list