File indexing completed on 2024-05-19 04:44:32

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
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  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #ifndef KREPORTITEMFIELD_H
0019 #define KREPORTITEMFIELD_H
0020 
0021 #include "KReportItemBase.h"
0022 
0023 #include <KProperty>
0024 
0025 class QDomNode;
0026 
0027 namespace Scripting
0028 {
0029 class Field;
0030 }
0031 
0032 class KReportItemField : public KReportItemBase
0033 {
0034 Q_OBJECT
0035 public:
0036     KReportItemField();
0037     explicit KReportItemField(const QDomNode & element);
0038     ~KReportItemField() override;
0039 
0040     QString typeName() const override;
0041     int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
0042 
0043 protected:
0044     KProperty * m_horizontalAlignment;
0045     KProperty * m_verticalAlignment;
0046     KProperty * m_font;
0047     //KProperty * m_trackTotal;
0048     //KProperty * m_trackBuiltinFormat;
0049     //KProperty * _useSubTotal;
0050     //KProperty * _trackTotalFormat;
0051     KProperty * m_foregroundColor;
0052     KProperty * m_backgroundColor;
0053     KProperty* m_backgroundOpacity;
0054     KProperty* m_lineColor;
0055     KProperty* m_lineWeight;
0056     KProperty* m_lineStyle;
0057     KProperty* m_wordWrap;
0058     KProperty* m_canGrow;
0059     KProperty* m_itemValue;
0060 
0061     //bool builtinFormat;
0062     //QString format;
0063 
0064     QStringList fieldNames(const QString &);
0065 
0066     KReportLineStyle lineStyle() const;
0067     KReportTextStyleData textStyle() const;
0068 
0069     int textFlags() const;
0070 
0071     QFont font() const {
0072         return m_font->value().value<QFont>();
0073     }
0074 
0075 private:
0076     void createProperties() override;
0077 
0078     friend class Scripting::Field;
0079 };
0080 
0081 #endif