1 /*************************************************************************** 2 * This file is part of the Lime Report project * 3 * Copyright (C) 2015 by Alexander Arin * 4 * arin_a@bk.ru * 5 * * 6 ** GNU General Public License Usage ** 7 * * 8 * This library is free software: you can redistribute it and/or modify * 9 * it under the terms of the GNU General Public License as published by * 10 * the Free Software Foundation, either version 3 of the License, or * 11 * (at your option) any later version. * 12 * You should have received a copy of the GNU General Public License * 13 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 14 * * 15 ** GNU Lesser General Public License ** 16 * * 17 * This library is free software: you can redistribute it and/or modify * 18 * it under the terms of the GNU Lesser General Public License as * 19 * published by the Free Software Foundation, either version 3 of the * 20 * License, or (at your option) any later version. * 21 * You should have received a copy of the GNU Lesser General Public * 22 * License along with this library. * 23 * If not, see <http://www.gnu.org/licenses/>. * 24 * * 25 * This library is distributed in the hope that it will be useful, * 26 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 28 * GNU General Public License for more details. * 29 ****************************************************************************/ 30 #ifndef LRDATABAND_H 31 #define LRDATABAND_H 32 33 #include "lrbanddesignintf.h" 34 #include "lrbasedesignintf.h" 35 #include <QObject> 36 37 namespace LimeReport{ 38 39 class DataBand : public DataBandDesignIntf 40 { 41 Q_OBJECT 42 Q_PROPERTY(bool keepSubdetailTogether READ tryToKeepTogether WRITE setTryToKeepTogether) 43 Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable ) 44 Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether) 45 Q_PROPERTY(bool sliceLastRow READ sliceLastRow WRITE setSliceLastRow) 46 Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) 47 Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) 48 Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage) 49 Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage) 50 Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) 51 Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor) 52 public: 53 DataBand(QObject* owner = 0, QGraphicsItem* parent=0); 54 bool isUnique() const; isData()55 bool isData() const {return true;} 56 protected: 57 QColor bandColor() const; 58 void preparePopUpMenu(QMenu &menu); 59 void processPopUpAction(QAction *action); 60 private: 61 BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); 62 }; 63 64 class DataHeaderBand : public BandDesignIntf 65 { 66 Q_OBJECT 67 Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) 68 Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) 69 Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) 70 Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) 71 Q_PROPERTY(bool repeatOnEachRow READ repeatOnEachRow WRITE setRepeatOnEachRow) 72 public: 73 DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0); isUnique()74 bool isUnique() const {return false;} isHeader()75 bool isHeader() const {return true;} bandColor()76 QColor bandColor() const {return QColor(Qt::darkGreen);} 77 protected: 78 void preparePopUpMenu(QMenu &menu); 79 void processPopUpAction(QAction *action); 80 private: 81 BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){ 82 return new DataHeaderBand(owner,parent); 83 } 84 }; 85 86 class DataFooterBand : public BandDesignIntf 87 { 88 Q_OBJECT 89 Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) 90 Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) 91 Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways) 92 public: 93 DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); isUnique()94 bool isUnique() const {return false;} isFooter()95 bool isFooter() const {return true;} bandColor()96 QColor bandColor() const{return QColor(Qt::darkGreen);} 97 protected: 98 void preparePopUpMenu(QMenu &menu); 99 void processPopUpAction(QAction *action); 100 private: 101 BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){ 102 return new DataFooterBand(owner,parent); 103 } 104 }; 105 106 } 107 #endif // LRDATABAND_H 108