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