File indexing completed on 2024-05-19 04:44:33
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 KReportItemLabel_H 0019 #define KReportItemLabel_H 0020 0021 #include "KReportItemBase.h" 0022 0023 #include <KProperty> 0024 0025 class QDomNode; 0026 0027 namespace Scripting 0028 { 0029 class Label; 0030 } 0031 0032 /** 0033 */ 0034 class KReportItemLabel : public KReportItemBase 0035 { 0036 Q_OBJECT 0037 public: 0038 KReportItemLabel(); 0039 explicit KReportItemLabel(const QDomNode & element); 0040 ~KReportItemLabel() override; 0041 0042 QString typeName() const override; 0043 int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override; 0044 0045 protected: 0046 0047 KProperty *m_text; 0048 KProperty *m_horizontalAlignment; 0049 KProperty *m_verticalAlignment; 0050 KProperty *m_font; 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 0058 QString text() const; 0059 QFont font() const { 0060 return m_font->value().value<QFont>(); 0061 } 0062 Qt::Alignment textFlags() const; 0063 void setText(const QString&); 0064 KReportTextStyleData textStyle() const; 0065 KReportLineStyle lineStyle() const; 0066 0067 private: 0068 void createProperties() override; 0069 0070 friend class Scripting::Label; 0071 }; 0072 #endif