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