1
/* This file is part of the KDE project
3
Copyright (C) 2010 KO GmbH <boud@kogmbh.com>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License version 2 as published by the Free Software Foundation.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
19
#ifndef KOODFLINENUMBERINGCONFIGURATION_H
20
#define KOODFLINENUMBERINGCONFIGURATION_H
25
#include "KoXmlReader.h"
26
#include "koodf_export.h"
29
class KoOdfNumberDefinition;
32
* Implement section 14.9.1: Line Numbering Configuration.
34
* A document can contain none or one line numbering configuration element
35
* <text:linenumbering-configuration> within the <office:styles> element. If the
36
* element is not present, a default line numbering configuration is used. The default line numbering
37
* may vary on the office application software, but every document saved by an application that
38
* supports line numbering should contain a line numbering configuration element.
40
* The attributes that may be associated with the <text:linenumbering-configuration>
43
* <li> Line numbering enable
49
* <li> Count empty lines
50
* <li> Count line in text boxes
51
* <li> Restart numbering on every page
53
* The following element may be included in the <text:linenumbering-separator> element:
56
class KOODF_EXPORT KoOdfLineNumberingConfiguration : public QObject
61
KoOdfLineNumberingConfiguration();
62
~KoOdfLineNumberingConfiguration();
63
KoOdfLineNumberingConfiguration(const KoOdfLineNumberingConfiguration &other);
64
KoOdfLineNumberingConfiguration &operator=(const KoOdfLineNumberingConfiguration &other);
68
* load the line numbering configuration element
70
void loadOdf(const KoXmlElement &element);
73
* save the line number configuration element
75
void saveOdf(KoXmlWriter * writer) const;
78
* The text:number-lines attribute controls whether or not lines are numbered.
81
void setEnabled(bool enabled);
84
* See section 12.2 for detailed information on number format attributes. The attributes
85
* described in section 12.2 can also be associated with the <text:linenumbering-configuration>
88
KoOdfNumberDefinition numberFormat() const;
89
void setNumberFormat(const KoOdfNumberDefinition &numberFormat);
92
* The text:style-name attribute specifies the text style for all line numbers. The value
93
* of this attribute is the name of the text style that is applied to all line numbers.
95
QString textStyle() const;
96
void setTextStyle(const QString &textStyle);
99
* The text:increment attribute causes line numbers that are a multiple of the given increment to
100
* be numbered. For example, if the increment is 5, only lines number 5, 10, 15, and so on are
103
int increment() const;
104
void setIncrement(int increment);
107
* The text:position attribute determines whether the line numbers are printed on the left, right,
108
* inner, or outer margins.
117
Position position() const;
118
void setPosition(Position position);
121
* The text:offset attribute determines the distance between the line number and the margin.
124
void setOffset(int offset);
127
* The text:count-empty-lines attribute determines whether or not empty lines are included in
128
* the line count. If the value of this attribute is true, empty lines are included in the line count.
130
bool countEmptyLines() const;
131
void setCountEmptyLines(bool countEmptyLines);
134
* The text:count-in-text-boxes attribute determines whether or not text in text boxes is
135
* included in the line count. If the value of this attribute is true, text within text boxes is included in
138
bool countLinesInTextBoxes() const;
139
void setCountLinesInTextBoxes(bool countLinesInTextBoxes);
142
* The text:restart-on-page attribute determines whether or not the line count is reset to 1 at
143
* the start of every page.
145
* If the value of this attribute is true, the line count is reset to 1 at the beginning of every page,
146
* resulting in page -specific numbering of lines. The default value of this attribute is false,
147
* resulting in document-specific numbering of lines.
149
bool restartNumberingOnEveryPage() const;
150
void setRestartNumberingOnEveryPage(bool restartNumberingOnEveryPage);
153
* The <text:linenumbering-separator> element contains the text that is displayed as a
154
* separator. A separator is text that is displayed instead of a line number for lines where no number
157
* This element is contained in the line numbering configuration element. If the element is not
158
* present, no separator is displayed.
160
* The element's text:increment attribute causes the separator to appear on lines that are a
161
* multiple of the given increment. For example, if the increment is 2, only lines 2, 4, 6, and so on get
162
* a separator, provided that no number is displayed already.
164
QString separator() const;
165
void setSeparator(const QString &separator);
167
int separatorIncrement() const;
168
void setSeparatorIncrement(int separatorIncrement);
177
Q_DECLARE_METATYPE(KoOdfLineNumberingConfiguration*)
179
#endif // KOODFLINENUMBERINGCONFIGURATION_H