]> git.lyx.org Git - lyx.git/blob - src/ParagraphParameters.h
a2722660be87cf00edd846a9fa75e88fb8e312f8
[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 "support/std_string.h"
18 #include "ShareContainer.h"
19 #include "layout.h"
20
21 #include "ParameterStruct.h"
22
23 #include <iosfwd>
24
25 class VSpace;
26 class Spacing;
27 class LyXLex;
28 class Paragraph;
29
30
31 ///
32 class ParagraphParameters {
33 public:
34         ///
35         ParagraphParameters();
36         ///
37         void clear();
38         ///
39         bool sameLayout(ParagraphParameters const &) const;
40         ///
41         VSpace const & spaceTop() const;
42         ///
43         void spaceTop(VSpace const &);
44         ///
45         VSpace const & spaceBottom() const;
46         ///
47         void spaceBottom(VSpace const &);
48         ///
49         Spacing const & spacing() const;
50         ///
51         void spacing(Spacing const &);
52         ///
53         bool noindent() const;
54         ///
55         void noindent(bool);
56         ///
57         bool lineTop() const;
58         ///
59         void lineTop(bool);
60         ///
61         bool lineBottom() const;
62         ///
63         void lineBottom(bool);
64         ///
65         bool pagebreakTop() const;
66         ///
67         void pagebreakTop(bool);
68         ///
69         bool pagebreakBottom() const;
70         ///
71         void pagebreakBottom(bool);
72         ///
73         LyXAlignment align() const;
74         ///
75         void align(LyXAlignment);
76         ///
77         typedef lyx::depth_type depth_type;
78         ///
79         depth_type depth() const;
80         ///
81         void depth(depth_type);
82         ///
83         bool startOfAppendix() const;
84         ///
85         void startOfAppendix(bool);
86         ///
87         bool appendix() const;
88         ///
89         void appendix(bool);
90         ///
91         string const & labelString() const;
92         ///
93         void labelString(string const &);
94         ///
95         string const & labelWidthString() const;
96         ///
97         void labelWidthString(string const &);
98         ///
99         LyXLength const & leftIndent() const;
100         ///
101         void leftIndent(LyXLength const &);
102
103         /// read the parameters from a lex
104         void read(LyXLex & lex);
105
106         /// write out the parameters to a stream
107         void write(std::ostream & os) const;
108
109 private:
110         ///
111         void set_from_struct(ParameterStruct const &);
112         ///
113         boost::shared_ptr<ParameterStruct> param;
114         ///
115         static ShareContainer<ParameterStruct> container;
116 };
117
118
119 inline
120 ParagraphParameters::depth_type ParagraphParameters::depth() const
121 {
122         return param->depth;
123 }
124
125
126 /** Generate a string \param data from \param par's ParagraphParameters.
127     The function also generates some additional info needed by the
128     Paragraph dialog.
129  */
130 void params2string(Paragraph const & par, string & data);
131
132 /** Given \param data, an encoding of the ParagraphParameters generated
133     in the Paragraph dialog, this function sets the current paragraph
134     appropriately.
135  */
136 void setParagraphParams(BufferView & bv, string const & data);
137
138 #endif