Warning, file /office/calligra/libs/odf/KoColumns.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    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
0003    Copyright 2002, 2003 David Faure <faure@kde.org>
0004    Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
0005    Copyright 2007 Thomas Zander <zander@kde.org>
0006    Copyright 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
0007 
0008    This library is free software; you can redistribute it and/or
0009    modify it under the terms of the GNU Library General Public
0010    License as published by the Free Software Foundation; either
0011    version 2 of the License, or (at your option) any later version.
0012 
0013    This library is distributed in the hope that it will be useful,
0014    but WITHOUT ANY WARRANTY; without even the implied warranty of
0015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016    Library General Public License for more details.
0017 
0018    You should have received a copy of the GNU Library General Public License
0019    along with this library; see the file COPYING.LIB.  If not, write to
0020    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0021  * Boston, MA 02110-1301, USA.
0022 */
0023 
0024 #ifndef KOCOLUMNS_H
0025 #define KOCOLUMNS_H
0026 
0027 #include "koodf_export.h"
0028 
0029 #include <QtGlobal>
0030 #include <QColor>
0031 #include <QVector>
0032 
0033 class KoGenStyle;
0034 class KoXmlElement;
0035 
0036 
0037 /** structure for columns */
0038 struct KoColumns {
0039     enum SeparatorVerticalAlignment {
0040         AlignTop = Qt::AlignTop,
0041         AlignVCenter = Qt::AlignVCenter,
0042         AlignBottom = Qt::AlignBottom
0043     };
0044 
0045     enum SeparatorStyle {
0046         None = Qt::NoPen,
0047         Solid = Qt::SolidLine,
0048         Dashed = Qt::DashLine,
0049         Dotted = Qt::DotLine,
0050         DotDashed = Qt::DashDotLine
0051     };
0052 
0053     struct ColumnDatum
0054     {
0055         /** Left indent in points */
0056         qreal leftMargin;
0057         /** Right indent in points */
0058         qreal rightMargin;
0059         /** Top indent in points */
0060         qreal topMargin;
0061         /** Bottom indent in points */
0062         qreal bottomMargin;
0063 
0064         /** The relative width */
0065         int relativeWidth;
0066 
0067         ColumnDatum() {}
0068         ColumnDatum(qreal lm, qreal rm, qreal tm, qreal bm, int rw)
0069         : leftMargin(lm), rightMargin(rm), topMargin(tm), bottomMargin(bm), relativeWidth(rw) {}
0070 
0071         bool operator==(const KoColumns::ColumnDatum &rhs) const
0072         {
0073             return
0074                 (leftMargin == rhs.leftMargin) &&
0075                 (rightMargin == rhs.rightMargin) &&
0076                 (topMargin == rhs.topMargin) &&
0077                 (bottomMargin == rhs.bottomMargin) &&
0078                 (relativeWidth == rhs.relativeWidth);
0079         }
0080     };
0081 
0082     /** Number of columns */
0083     int count;
0084 
0085     /** Spacing between columns in points */
0086     qreal gapWidth;
0087 
0088     SeparatorStyle separatorStyle;
0089     QColor separatorColor;
0090     SeparatorVerticalAlignment separatorVerticalAlignment;
0091     /** Width in pt */
0092     qreal separatorWidth;
0093     /** Height in percent. Default is 100% */
0094     unsigned int separatorHeight;
0095 
0096     /** data about the individual columns if there  */
0097     QVector<ColumnDatum> columnData;
0098 
0099     /**
0100      * Construct a columns with the default column count 1,
0101      * default margins (2 cm), and portrait orientation.
0102      */
0103     KOODF_EXPORT KoColumns();
0104 
0105     KOODF_EXPORT void reset();
0106     KOODF_EXPORT bool operator==(const KoColumns &l) const;
0107     KOODF_EXPORT bool operator!=(const KoColumns &l) const;
0108 
0109     /**
0110      * Save this columns to ODF.
0111      */
0112     KOODF_EXPORT void saveOdf(KoGenStyle &style) const;
0113 
0114     /**
0115      * Load this columns from ODF
0116      */
0117     KOODF_EXPORT void loadOdf(const KoXmlElement &style);
0118 
0119     qreal totalRelativeWidth() const
0120     {
0121         qreal result = 0.0;
0122         foreach(const ColumnDatum &c, columnData) {
0123             result += c.relativeWidth;
0124         }
0125         return result;
0126     }
0127 
0128     KOODF_EXPORT static const char * separatorStyleString(KoColumns::SeparatorStyle separatorStyle);
0129     KOODF_EXPORT static const char * separatorVerticalAlignmentString(KoColumns::SeparatorVerticalAlignment separatorVerticalAlignment);
0130     KOODF_EXPORT static KoColumns::SeparatorVerticalAlignment parseSeparatorVerticalAlignment(const QString &value);
0131     KOODF_EXPORT static QColor parseSeparatorColor(const QString &value);
0132     KOODF_EXPORT static int parseSeparatorHeight(const QString &value);
0133     KOODF_EXPORT static KoColumns::SeparatorStyle parseSeparatorStyle(const QString &value);
0134     KOODF_EXPORT static int parseRelativeWidth(const QString &value);
0135 };
0136 
0137 Q_DECLARE_TYPEINFO(KoColumns::ColumnDatum, Q_MOVABLE_TYPE);
0138 
0139 #endif /* KOCOLUMNS_H */
0140