source: trunk/libdjvu/DjVmNav.h @ 15

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

needed libs update

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