Warning, file /office/calligra/libs/odf/KoOdfLineNumberingConfiguration.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2010 KO GmbH <boud@kogmbh.com> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License version 2 as published by the Free Software Foundation. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 #ifndef KOODFLINENUMBERINGCONFIGURATION_H 0020 #define KOODFLINENUMBERINGCONFIGURATION_H 0021 0022 #include <QMetaType> 0023 #include <QObject> 0024 0025 #include "KoXmlReader.h" 0026 #include "koodf_export.h" 0027 0028 class KoXmlWriter; 0029 class KoOdfNumberDefinition; 0030 0031 /** 0032 * Implement section 14.9.1: Line Numbering Configuration. 0033 * 0034 * A document can contain none or one line numbering configuration element 0035 * <text:linenumbering-configuration> within the <office:styles> element. If the 0036 * element is not present, a default line numbering configuration is used. The default line numbering 0037 * may vary on the office application software, but every document saved by an application that 0038 * supports line numbering should contain a line numbering configuration element. 0039 * 0040 * The attributes that may be associated with the <text:linenumbering-configuration> 0041 * element are: 0042 * <ul> 0043 * <li> Line numbering enable 0044 * <li> Number format 0045 * <li> Text style 0046 * <li> Increment 0047 * <li> Position 0048 * <li> Offset 0049 * <li> Count empty lines 0050 * <li> Count line in text boxes 0051 * <li> Restart numbering on every page 0052 * </ul> 0053 * The following element may be included in the <text:linenumbering-separator> element: 0054 * <li> Separator 0055 */ 0056 class KOODF_EXPORT KoOdfLineNumberingConfiguration : public QObject 0057 { 0058 Q_OBJECT 0059 public: 0060 0061 KoOdfLineNumberingConfiguration(); 0062 ~KoOdfLineNumberingConfiguration() override; 0063 KoOdfLineNumberingConfiguration(const KoOdfLineNumberingConfiguration &other); 0064 KoOdfLineNumberingConfiguration &operator=(const KoOdfLineNumberingConfiguration &other); 0065 0066 0067 /** 0068 * load the line numbering configuration element 0069 */ 0070 void loadOdf(const KoXmlElement &element); 0071 0072 /** 0073 * save the line number configuration element 0074 */ 0075 void saveOdf(KoXmlWriter * writer) const; 0076 0077 /** 0078 * The text:number-lines attribute controls whether or not lines are numbered. 0079 */ 0080 bool enabled() const; 0081 void setEnabled(bool enabled); 0082 0083 /** 0084 * See section 12.2 for detailed information on number format attributes. The attributes 0085 * described in section 12.2 can also be associated with the <text:linenumbering-configuration> 0086 * element. 0087 */ 0088 KoOdfNumberDefinition numberFormat() const; 0089 void setNumberFormat(const KoOdfNumberDefinition &numberFormat); 0090 0091 /** 0092 * The text:style-name attribute specifies the text style for all line numbers. The value 0093 * of this attribute is the name of the text style that is applied to all line numbers. 0094 */ 0095 QString textStyle() const; 0096 void setTextStyle(const QString &textStyle); 0097 0098 /** 0099 * The text:increment attribute causes line numbers that are a multiple of the given increment to 0100 * be numbered. For example, if the increment is 5, only lines number 5, 10, 15, and so on are 0101 * numbered. 0102 */ 0103 int increment() const; 0104 void setIncrement(int increment); 0105 0106 /** 0107 * The text:position attribute determines whether the line numbers are printed on the left, right, 0108 * inner, or outer margins. 0109 */ 0110 enum Position { 0111 Left, 0112 Right, 0113 Inner, 0114 Outer 0115 }; 0116 0117 Position position() const; 0118 void setPosition(Position position); 0119 0120 /** 0121 * The text:offset attribute determines the distance between the line number and the margin. 0122 */ 0123 int offset() const; 0124 void setOffset(int offset); 0125 0126 /** 0127 * The text:count-empty-lines attribute determines whether or not empty lines are included in 0128 * the line count. If the value of this attribute is true, empty lines are included in the line count. 0129 */ 0130 bool countEmptyLines() const; 0131 void setCountEmptyLines(bool countEmptyLines); 0132 0133 /** 0134 * The text:count-in-text-boxes attribute determines whether or not text in text boxes is 0135 * included in the line count. If the value of this attribute is true, text within text boxes is included in 0136 * the line count. 0137 */ 0138 bool countLinesInTextBoxes() const; 0139 void setCountLinesInTextBoxes(bool countLinesInTextBoxes); 0140 0141 /** 0142 * The text:restart-on-page attribute determines whether or not the line count is reset to 1 at 0143 * the start of every page. 0144 * 0145 * If the value of this attribute is true, the line count is reset to 1 at the beginning of every page, 0146 * resulting in page -specific numbering of lines. The default value of this attribute is false, 0147 * resulting in document-specific numbering of lines. 0148 */ 0149 bool restartNumberingOnEveryPage() const; 0150 void setRestartNumberingOnEveryPage(bool restartNumberingOnEveryPage); 0151 0152 /** 0153 * The <text:linenumbering-separator> element contains the text that is displayed as a 0154 * separator. A separator is text that is displayed instead of a line number for lines where no number 0155 * is displayed. 0156 * 0157 * This element is contained in the line numbering configuration element. If the element is not 0158 * present, no separator is displayed. 0159 * 0160 * The element's text:increment attribute causes the separator to appear on lines that are a 0161 * multiple of the given increment. For example, if the increment is 2, only lines 2, 4, 6, and so on get 0162 * a separator, provided that no number is displayed already. 0163 */ 0164 QString separator() const; 0165 void setSeparator(const QString &separator); 0166 0167 int separatorIncrement() const; 0168 void setSeparatorIncrement(int separatorIncrement); 0169 0170 private: 0171 0172 class Private; 0173 Private * const d; 0174 0175 }; 0176 0177 Q_DECLARE_METATYPE(KoOdfLineNumberingConfiguration*) 0178 0179 #endif // KOODFLINENUMBERINGCONFIGURATION_H