]> git.lyx.org Git - lyx.git/blob - src/ParagraphParameters.h
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / ParagraphParameters.h
1 // -*- C++ -*-
2 /**
3  * \file ParagraphParameters.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Angus Leeming
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef PARAGRAPHPARAMETERS_H
15 #define PARAGRAPHPARAMETERS_H
16
17 #include "LayoutEnums.h"
18 #include "Spacing.h"
19
20 #include "support/types.h"
21 #include "support/strfwd.h"
22 #include "support/Length.h"
23
24
25 namespace lyx {
26
27 class Layout;
28 class Paragraph;
29
30 namespace support { class Lexer; }
31
32
33 ///
34 class ParagraphParameters {
35 public:
36         ///
37         ParagraphParameters();
38         ///
39         void clear();
40         ///
41         bool sameLayout(ParagraphParameters const &) const;
42         ///
43         Spacing const & spacing() const;
44         ///
45         void spacing(Spacing const &);
46         ///
47         bool noindent() const;
48         ///
49         void noindent(bool);
50         ///
51         LyXAlignment align() const;
52         ///
53         void align(LyXAlignment);
54         ///
55         depth_type depth() const;
56         ///
57         void depth(depth_type);
58         ///
59         bool startOfAppendix() const;
60         ///
61         void startOfAppendix(bool);
62         ///
63         bool appendix() const;
64         ///
65         void appendix(bool);
66         ///
67         docstring const & labelString() const;
68         ///
69         void labelString(docstring const &);
70         ///
71         docstring const & labelWidthString() const;
72         ///
73         void labelWidthString(docstring const &);
74         ///
75         Length const & leftIndent() const;
76         ///
77         void leftIndent(Length const &);
78
79         /// read the parameters from a string
80         void read (std::string const & str, bool merge = true);
81
82         /// read the parameters from a lex
83         void read(support::Lexer & lex, bool merge = true);
84
85         ///
86         void apply(ParagraphParameters const & params, Layout const & layout);
87
88         // It would be nice to have a working version of this method, so that
89         // getStatus() could return information about what was possible.
90         // bool canApply(ParagraphParameters const & params, Layout const & layout)
91         //      { return true; }
92
93         /// write out the parameters to a stream
94         void write(std::ostream & os) const;
95
96 private:
97         ///
98         Spacing spacing_;
99         ///
100         bool noindent_;
101         ///
102         bool start_of_appendix_;
103         ///
104         bool appendix_;
105         ///
106         LyXAlignment align_;
107         ///
108         depth_type depth_;
109         ///
110         docstring labelstring_;
111         ///
112         docstring labelwidthstring_;
113         ///
114         Length leftindent_;
115 };
116
117
118
119 /** Generate a string \param data from \param par's ParagraphParameters.
120     The function also generates some additional info needed by the
121     Paragraph dialog.
122  */
123 void params2string(Paragraph const & par, std::string & data);
124
125
126 } // namespace lyx
127
128 #endif