Warning, file /office/calligra/libs/odf/KoOdfNumberDefinition.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 Boudewijn Rempt
0004    Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License version 2 as published by the Free Software Foundation.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019  */
0020 #ifndef KOODFNUMBERDEFINITION_H
0021 #define KOODFNUMBERDEFINITION_H
0022 
0023 #include "KoXmlReader.h"
0024 #include "koodf_export.h"
0025 
0026 class KoXmlWriter;
0027 
0028 /**
0029  * Load and save the ODF numbering scheme according to section 12.
0030  *
0031  * The OpenDocument number format consists of three parts:
0032  * • Prefix – the text that is displayed before the number
0033  * • Display format specification, for example, A, B, C, or 1, 2, 3
0034  * • Suffix – the text that is displayed after the number
0035  */
0036 class KOODF_EXPORT KoOdfNumberDefinition
0037 {
0038 public:
0039     explicit KoOdfNumberDefinition();
0040     ~KoOdfNumberDefinition();
0041     KoOdfNumberDefinition(const KoOdfNumberDefinition &other);
0042     KoOdfNumberDefinition &operator=(const KoOdfNumberDefinition &other);
0043 
0044     /**
0045      * load the number definition element
0046      */
0047     void loadOdf(const KoXmlElement &element);
0048 
0049     /**
0050      * save the number definition element
0051      */
0052     void saveOdf(KoXmlWriter *writer) const;
0053 
0054     /**
0055      * create a string representation of the specified number.
0056      */
0057     QString formattedNumber(int number, KoOdfNumberDefinition *defaultDefinition = 0) const;
0058 
0059     /**
0060      * The style:num-prefix and style:num-suffix attributes specify what to display before and
0061      * after the number.
0062      *
0063      * If the prefix and suffix do not contain alphanumeric characters, an [XSLT] format attribute can
0064      * be created from the OpenDocument attributes by concatenating the values of the style:num-
0065      * prefix, style:num-format, and style:num-suffix attributes.
0066      */
0067     QString prefix() const;
0068     void setPrefix(const QString &prefix);
0069 
0070     QString suffix() const;
0071     void setSuffix(const QString &suffix);
0072 
0073 
0074     /**
0075      * The style:num-format attribute specifies the format of the number in the same way as the
0076      * [XSLT] format attribute. The number styles supported are as follows:
0077      * • Numeric: 1, 2, 3, ...
0078      * • Alphabetic: a, b, c, ... or A, B, C, ...
0079      * • Roman: i, ii, iii, iv, ... or I, II, III, IV,...
0080      *
0081      * The value of this attribute can be "1", "a", "A", "i", or "I". For some
0082      * elements, the attribute value also can be empty. In this case, no number
0083      * is displayed.
0084      */
0085     enum FormatSpecification {
0086         Numeric,
0087         AlphabeticLowerCase,
0088         AlphabeticUpperCase,
0089         RomanLowerCase,
0090         RomanUpperCase,
0091         ArabicAlphabet,
0092         Thai,
0093         Abjad,
0094         AbjadMinor,
0095         Tibetan,
0096         Telugu,
0097         Tamil,
0098         Oriya,
0099         Malayalam,
0100         Kannada,
0101         Gurumukhi,
0102         Gujarati,
0103         Bengali,
0104         Empty
0105     };
0106 
0107     FormatSpecification formatSpecification() const;
0108     void setFormatSpecification(FormatSpecification formatSpecification);
0109     static QStringList userFormatDescriptions();
0110 
0111     /**
0112      * Letter synchronization
0113      *
0114      * If letters are used in alphabetical order for numbering, there are two ways to process overflows
0115      * within a digit, as follows:
0116      *  •  A new digit is inserted. Its start value is A, and it is incremented every time an overflow occurs
0117      * in the following digit. The numbering sequence in this case is something like a,b,c, ..., z, aa,
0118      * ab, ac, ...,az, ba, ..., and so on.
0119      *  • A new digit is inserted that always has the same value as the following digit. The numbering
0120      * sequence in this case is something like a, b, c, ..., z, aa, bb, cc, ..., zz, aaa, ..., and so on. This
0121      * is called letter synchronization.
0122      *
0123      * The style:num-letter-sync specifies whether letter synchronization shall take place.
0124      */
0125     bool letterSynchronization() const;
0126     void setLetterSynchronization(bool letterSynchronization);
0127 
0128 private:
0129 
0130     class Private;
0131     Private * const d;
0132 
0133 
0134 };
0135 
0136 #endif // KOODFNUMBERDEFINITION_H