source: trunk/libdjvu/DjVmNav.h @ 206

Last change on this file since 206 was 206, checked in by Eugene Romanenko, 14 years ago

DJVU plugin: djvulibre updated to version 3.5.19

File size: 5.6 KB
Line 
1//C-  -*- C++ -*-
2//C- -------------------------------------------------------------------
3//C- DjVuLibre-3.5
4//C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
5//C- Copyright (c) 2001  AT&T
6//C-
7//C- This software is subject to, and may be distributed under, the
8//C- GNU General Public License, either Version 2 of the license,
9//C- or (at your option) any later version. The license should have
10//C- accompanied the software or you may obtain a copy of the license
11//C- from the Free Software Foundation at http://www.fsf.org .
12//C-
13//C- This program is distributed in the hope that it will be useful,
14//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
15//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16//C- GNU General Public License for more details.
17//C-
18//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library from
19//C- Lizardtech Software.  Lizardtech Software has authorized us to
20//C- replace the original DjVu(r) Reference Library notice by the following
21//C- text (see doc/lizard2002.djvu and doc/lizardtech2007.djvu):
22//C-
23//C-  ------------------------------------------------------------------
24//C- | DjVu (r) Reference Library (v. 3.5)
25//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
26//C- | The DjVu Reference Library is protected by U.S. Pat. No.
27//C- | 6,058,214 and patents pending.
28//C- |
29//C- | This software is subject to, and may be distributed under, the
30//C- | GNU General Public License, either Version 2 of the license,
31//C- | or (at your option) any later version. The license should have
32//C- | accompanied the software or you may obtain a copy of the license
33//C- | from the Free Software Foundation at http://www.fsf.org .
34//C- |
35//C- | The computer code originally released by LizardTech under this
36//C- | license and unmodified by other parties is deemed "the LIZARDTECH
37//C- | ORIGINAL CODE."  Subject to any third party intellectual property
38//C- | claims, LizardTech grants recipient a worldwide, royalty-free,
39//C- | non-exclusive license to make, use, sell, or otherwise dispose of
40//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the
41//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU
42//C- | General Public License.   This grant only confers the right to
43//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to
44//C- | the extent such infringement is reasonably necessary to enable
45//C- | recipient to make, have made, practice, sell, or otherwise dispose
46//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to
47//C- | any greater extent that may be necessary to utilize further
48//C- | modifications or combinations.
49//C- |
50//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
51//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
52//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
53//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
54//C- +------------------------------------------------------------------
55//
56// $Id: DjVmNav.h,v 1.2 2007/03/25 20:48:29 leonb Exp $
57// $Name: release_3_5_19 $
58
59#ifndef _DJVMNAV_H
60#define _DJVMNAV_H
61#ifdef HAVE_CONFIG_H
62#include "config.h"
63#endif
64#if NEED_GNUG_PRAGMAS
65# pragma interface
66#endif
67
68#include "DjVuGlobal.h"
69#include "GString.h"
70#include "GThreads.h"
71
72#ifdef HAVE_NAMESPACES
73namespace DJVU {
74# ifdef NOT_DEFINED // Just to fool emacs c++ mode
75}
76#endif
77#endif
78
79
80class ByteStream;
81
82/** The NAVM chunk.
83    The optional #"NAVM"# chunk which follows the DIRM chunk describes
84    how the user can navigate the document.
85    This is a list of DjVuBookMarks.
86**/
87
88class DjVmNav : public GPEnabled
89{
90public:
91   /** Class \Ref{DjVmNav::DjVuBookMark} represents a entry in the
92       hierarchy of contents. */
93   class DjVuBookMark;
94 
95   static GP<DjVmNav> create(void);
96      /** Decodes the directory from the specified stream. */
97   void decode(const GP<ByteStream> &stream);
98      /** Encodes the directory into the specified stream. */
99   void encode(const GP<ByteStream> &stream) ;
100   void dump(const GP<ByteStream> &stream) ;
101      /** Return bookmark at zero-based position i */
102   bool getBookMark(GP<DjVuBookMark> &gpBookMark, int i) ;
103   int getBookMarkCount();
104      /** Append the BookMark to the end of the list */
105   void append (const GP<DjVuBookMark> &gpBookMark) ;
106      /** This function will check the given bookmark is valid or not */
107   bool isValidBookmark();
108      /** This function determines if the given count_array is a tree
109          sequence, that is if it fits a tree. */
110   int get_tree(int index, int* count_array, int count_array_size);
111protected:
112   DjVmNav(void) { } ;
113private:
114   GCriticalSection class_lock;
115   GPList<DjVuBookMark> bookmark_list;
116};
117
118/** The DjVuBookMark.
119    Each entry in the Navigation chunk (NAVM) is a bookmark.  A bookmark
120    contains a count of immediate children, a display string and a url.
121**/
122
123class DjVmNav::DjVuBookMark : public GPEnabled
124{
125protected:
126  /** Default constructor. */
127  DjVuBookMark(void);
128public:
129  static GP<DjVuBookMark> create(void);
130  static GP<DjVuBookMark> create(const unsigned short count,
131                                 const GUTF8String &displayname, 
132                                 const GUTF8String &url);
133  void encode(const GP<ByteStream> &stream);
134  void dump(const GP<ByteStream> &stream);
135  void decode(const GP<ByteStream> &stream);
136  int count;               // count of immediate children.
137  GUTF8String displayname; // example:  "Section 3.5 - Encryption"
138  GUTF8String url;         // url, may be blank or relative.
139};
140
141
142#ifdef HAVE_NAMESPACES
143}
144# ifndef NOT_USING_DJVU_NAMESPACE
145using namespace DJVU;
146# endif
147#endif
148#endif
Note: See TracBrowser for help on using the repository browser.