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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to