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

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 KREPORTITEMTEXT_H
0019 #define KREPORTITEMTEXT_H
0020 
0021 #include "KReportItemBase.h"
0022 
0023 #include <KProperty>
0024 
0025 class QDomNode;
0026 
0027 namespace Scripting
0028 {
0029 class Text;
0030 
0031 }
0032 /**
0033 */
0034 class KReportItemText : public KReportItemBase
0035 {
0036 Q_OBJECT
0037 public:
0038     KReportItemText();
0039     explicit KReportItemText(const QDomNode & element);
0040     ~KReportItemText() 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     KProperty* m_horizontalAlignment;
0047     KProperty* m_verticalAlignment;
0048     KProperty* m_font;
0049     KProperty* m_foregroundColor;
0050     KProperty* m_backgroundColor;
0051     KProperty* m_backgroundOpacity;
0052     KProperty* m_lineColor;
0053     KProperty* m_lineWeight;
0054     KProperty* m_lineStyle;
0055     KProperty* m_itemValue;
0056 
0057 
0058     qreal m_bottomPadding;
0059 
0060     Qt::Alignment textFlags() const;
0061     QFont font() const {
0062         return m_font->value().value<QFont>();
0063     }
0064 
0065     void setBottomPadding(qreal bp);
0066     qreal bottomPadding() const;
0067 
0068 
0069     KReportTextStyleData textStyle() const;
0070     KReportLineStyle lineStyle() const;
0071 
0072 private:
0073     void createProperties() override;
0074 
0075     friend class Scripting::Text;
0076 };
0077 
0078 #endif