]> git.lyx.org Git - lyx.git/blob - src/ParagraphParameters.h
07601e9e33faf415d75a3498f57a2239298315eb
[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 Lexer;
29 class Paragraph;
30
31
32 ///
33 class ParagraphParameters {
34 public:
35         ///
36         ParagraphParameters();
37         ///
38         void clear();
39         ///
40         bool sameLayout(ParagraphParameters const &) const;
41         ///
42         Spacing const & spacing() const;
43         ///
44         void spacing(Spacing const &);
45         ///
46         bool noindent() const;
47         ///
48         void noindent(bool);
49         ///
50         LyXAlignment align() const;
51         ///
52         void align(LyXAlignment);
53         ///
54         depth_type depth() const;
55         ///
56         void depth(depth_type);
57         ///
58         bool startOfAppendix() const;
59         ///
60         void startOfAppendix(bool);
61         ///
62         bool appendix() const;
63         ///
64         void appendix(bool);
65         ///
66         docstring const & labelString() const;
67         ///
68         void labelString(docstring const &);
69         ///
70         docstring const & labelWidthString() const;
71         ///
72         void labelWidthString(docstring const &);
73         ///
74         Length const & leftIndent() const;
75         ///
76         void leftIndent(Length const &);
77
78         /// read the parameters from a string
79         void read (std::string const & str, bool merge = true);
80
81         /// read the parameters from a lex
82         void read(Lexer & lex, bool merge = true);
83
84         ///
85         void apply(ParagraphParameters const & params, Layout const & layout);
86
87         // It would be nice to have a working version of this method, so that
88         // getStatus() could return information about what was possible.
89         // bool canApply(ParagraphParameters const & params, Layout const & layout)
90         //      { return true; }
91
92         /// write out the parameters to a stream
93         void write(std::ostream & os) const;
94
95 private:
96         ///
97         Spacing spacing_;
98         ///
99         bool noindent_;
100         ///
101         bool start_of_appendix_;
102         ///
103         bool appendix_;
104         ///
105         LyXAlignment align_;
106         ///
107         depth_type depth_;
108         ///
109         docstring labelstring_;
110         ///
111         docstring labelwidthstring_;
112         ///
113         Length leftindent_;
114 };
115
116
117
118 /** Generate a string \param data from \param par's ParagraphParameters.
119     The function also generates some additional info needed by the
120     Paragraph dialog.
121  */
122 void params2string(Paragraph const & par, std::string & data);
123
124
125 } // namespace lyx
126
127 #endif