]> git.lyx.org Git - lyx.git/blob - src/PDFOptions.h
PDFOptions: patch by Pavel to store the settings when the user switches hyperref...
[lyx.git] / src / PDFOptions.h
1 // -*- C++ -*-
2 /**
3  * \file src/PDFOptions.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Pavel Sanda
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef PDFOPTIONS_H
13 #define PDFOPTIONS_H
14
15 #include "support/docstream.h"
16
17 namespace lyx {
18
19 class Lexer;
20
21 /// Options for PDF generation
22
23 /*
24   Possible cleanups, left for next fileformat change:
25   
26   - bookmarksopenlevel is stored in .lyx as string; 
27     after change to spinbox it would be appropriate
28     change to int.
29   - store_options flag can be completely replaced by
30     function store_options() doing essentialy the same
31     as empty() now.
32 */
33
34 class PDFOptions {
35 public:
36         ///
37         PDFOptions() { clear(); }
38         /// check whether user added any settings for hyperref
39         bool empty() const;
40         /// output to lyx header
41         void writeFile(std::ostream &) const;
42         /// output to tex header
43         void writeLaTeX(odocstringstream &) const;
44         /// read tokens from lyx header
45         std::string readToken(Lexer &lex, std::string const & token);
46         /// keep implicit hyperref settings
47         void clear();
48
49         ///
50         bool use_hyperref;
51         ///
52         std::string title;
53         ///
54         std::string author;
55         ///
56         std::string subject;
57         ///
58         std::string keywords;
59         /**
60                 * A set of Acrobat bookmarks are written, in a manner similar to the
61                 * table of contents.
62                 * bookmarks         boolean true
63                 */
64         bool bookmarks;
65         /**
66                 * If Acrobat bookmarks are requested, include section numbers.
67                 * bookmarksnumbered    boolean false
68                 */
69         bool bookmarksnumbered;
70         /**
71                 * If Acrobat bookmarks are requested, show them with all the subtrees
72                 * expanded.
73                 * bookmarksopen     boolean false
74                 */
75         bool bookmarksopen;
76         /**
77                 * Level (\maxdimen) to which bookmarks are open
78                 * bookmarksopenlevel    parameter
79                 */
80         int bookmarksopenlevel;
81         /**
82                 * Allows link text to break across lines.
83                 * breaklinks        boolean false
84                 */
85         bool breaklinks;
86         /**
87                 * The style of box around links; defaults to a box with lines of 1pt
88                 * thickness, but the colorlinks option resets it to produce no border.
89                 * pdfborder              "0 0 1" / "0 0 0"
90                 * Note that the color of link borders can be specified only as 3
91                 * numbers in the range 0..1, giving an RGB color.
92                 * You cannot use colors defined in TEX.
93                 *
94                 * We represent here only the last bit, there is no semantics in the
95                 * first two. Morover the aim is not to represent the whole pdfborder,
96                 * but just to deny the ugly boxes around pdf links.
97                 */
98         bool pdfborder;
99         /**
100                 * colorlinks        boolean false
101                 */
102         bool colorlinks;
103         /**
104                 * Adds backlink text to the end of each item in the bibliography,
105                 * as a list of section numbers.
106                 * This can only work properly if there is a blank line after each
107                 * \bibitem.
108                 * backref        boolean false
109                 */
110         bool backref;
111         /**
112                 * Adds backlink text to the end of each item in the bibliography,
113                 * as a list of page numbers.
114                 * pagebackref       boolean false
115                 */
116         bool pagebackref;
117         /**
118                 * Determines how the file is opening in Acrobat;
119                 * the possibilities are None, UseThumbs (show thumbnails), UseOutlines
120                 * (show bookmarks), and FullScreen.
121                 * If no mode if explicitly chosen, but the bookmarks option is set,
122                 * UseOutlines is used.
123                 * pagemode          text    empty
124                 *
125                 * We currently implement only FullScreen, but all modes can be saved
126                 * here, lyx format & latex writer is prepared.
127                 * The only thing needed in such a case is wider Settings
128                 * dialog -> PDFOptions.pagemode .
129                 */
130         std::string pagemode;
131         ///latex string
132         static const std::string pagemode_fullscreen;
133         /**
134                 * Additional parameters for hyperref given from user.
135                 */
136         std::string quoted_options;
137         /**
138                 * Possible syntax check of users additional parameters here.
139                 */
140         std::string quoted_options_get() const;
141         
142         
143         /**
144                 * Flag indicating whether user made some input into PDF preferences.
145                 * We want to save options, when user decide to switch off PDF support
146                 * for a while.
147                 */
148         bool store_options;
149 };
150
151 } // namespace lyx
152
153 #endif // PDFOPTIONS_H