OptionalContent.h 1.75 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
//========================================================================
//
// OptionalContent.h
//
// Copyright 2007 Brad Hards <bradh@kde.org>
//
// Released under the GPL (version 2, or later, at your option)
//
//========================================================================

#ifndef OPTIONALCONTENT_H
#define OPTIONALCONTENT_H

#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif

#include "Object.h"
#include "CharTypes.h"

class GooString;
class GooList;
class XRef;

class OptionalContentGroup; 

//------------------------------------------------------------------------

class OCGs {
public:

  OCGs(Object *ocgObject, XRef *xref);
  ~OCGs();

35 36 37
  // Is OCGS valid?
  GBool isOk() { return ok; }
  
38 39 40 41 42 43 44 45 46 47 48
  bool hasOCGs();
  GooList *getOCGs() const { return optionalContentGroups; }

  OptionalContentGroup* findOcgByRef( const Ref &ref);

  Array* getOrderArray() const { return m_orderArray; }
  Array* getRBGroupsArray() const { return m_rBGroupsArray; }

  bool optContentIsVisible( Object *dictRef );

private:
49 50
  GBool ok;
  
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
  bool allOn( Array *ocgArray );
  bool allOff( Array *ocgArray );
  bool anyOn( Array *ocgArray );
  bool anyOff( Array *ocgArray );

  GooList *optionalContentGroups;

  Array *m_orderArray;
  Array *m_rBGroupsArray;
  XRef *m_xref;
};

//------------------------------------------------------------------------

class OptionalContentGroup {
public:
  enum State { On, Off };

  OptionalContentGroup(Dict *dict, XRef *xrefA);

  OptionalContentGroup(GooString *label);

  ~OptionalContentGroup();

  GooString* name() const;

  Ref ref() const;
  void setRef(const Ref ref);

  State state() { return m_state; };
  void setState(State state) { m_state = state; };

private:
  XRef *xref;
  GooString *m_name;
  Ref m_ref;
  State m_state;  
};

#endif