2025-06-23 18:01:09 +08:00
|
|
|
|
#ifndef CCSREPORTTEMPLATE_H
|
2025-06-23 10:41:33 +08:00
|
|
|
|
#define CCSREPORTTEMPLATE_H
|
|
|
|
|
|
|
|
|
|
#include <QTextCharFormat>
|
|
|
|
|
#include "ccstemplatebase.h"
|
|
|
|
|
#include "ccstemplateband.h"
|
|
|
|
|
#include "ccstemplateitem.h"
|
|
|
|
|
namespace CCS_Report {
|
|
|
|
|
class CoverWrapper;
|
|
|
|
|
class Report;
|
|
|
|
|
class Table;
|
|
|
|
|
class TableDynamic;
|
|
|
|
|
class CoverFormat;
|
|
|
|
|
class ParagraphFormat;
|
|
|
|
|
class Paragraph;
|
|
|
|
|
class Text;
|
|
|
|
|
class TableGroup;
|
|
|
|
|
|
|
|
|
|
class BandFormat:public BaseFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
BandFormat():BaseFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
BandFormat(int left,int top,int bottom,int right ):BaseFormat(left,top,bottom,right)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
BandFormat(BandFormat& band):BaseFormat(band)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 封面属性定义
|
|
|
|
|
/// </summary>
|
|
|
|
|
class CoverFormat:public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CoverFormat():BandFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
CoverFormat(int left,int top,int bottom,int right):BandFormat(left,top,bottom,right){}
|
|
|
|
|
CoverFormat(CoverFormat& format):BandFormat(format)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 封面类定义
|
|
|
|
|
/// </summary>
|
|
|
|
|
class CoverWrapper:public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CoverWrapper(CoverFormat& format,QObject* parent=0):BaseBand(format,parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new CoverFormat(format);
|
|
|
|
|
m_Type = bandtype::Cover;
|
|
|
|
|
}
|
|
|
|
|
CoverWrapper(QObject* parent=0):BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new CoverFormat();
|
|
|
|
|
m_Type = bandtype::Cover;
|
|
|
|
|
}
|
|
|
|
|
~CoverWrapper()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页眉属性定义
|
|
|
|
|
/// </summary>
|
|
|
|
|
class HeaderFormat:public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
HeaderFormat():BandFormat()
|
|
|
|
|
{
|
|
|
|
|
m_penLine = QPen();
|
|
|
|
|
m_penLine.setStyle(Qt::NoPen);
|
|
|
|
|
}
|
|
|
|
|
HeaderFormat(int left,int top,int bottom,int right):BandFormat(left,top,bottom,right)
|
|
|
|
|
{
|
|
|
|
|
m_penLine = QPen();
|
|
|
|
|
m_penLine.setStyle(Qt::NoPen);
|
|
|
|
|
}
|
|
|
|
|
HeaderFormat(HeaderFormat & format):BandFormat(format)
|
|
|
|
|
{
|
|
|
|
|
m_penLine = format.m_penLine;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页眉横线
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
inline QPen showline() const {return m_penLine;}
|
|
|
|
|
inline void SetShowLine(const QPen& flag){m_penLine = flag;}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPen m_penLine; //横线
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Band页眉属性定义
|
|
|
|
|
/// </summary>
|
|
|
|
|
class HeaderWrapper:public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
HeaderWrapper(HeaderFormat& format,QObject* parent=0):BaseBand(format,parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new HeaderFormat(format);
|
|
|
|
|
m_Type = bandtype::Header;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
HeaderWrapper(QObject* parent=0):BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new HeaderFormat();
|
|
|
|
|
m_Type = bandtype::Header;
|
|
|
|
|
}
|
|
|
|
|
HeaderWrapper(const HeaderWrapper& header):BaseBand(header)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Header;
|
|
|
|
|
|
|
|
|
|
m_Format = new HeaderFormat(*(static_cast<HeaderFormat*>(header.m_Format)));
|
|
|
|
|
foreach (BaseItem* item, header.m_listItem) {
|
|
|
|
|
if (item->elementType() == CCS_Report::BaseItem::classtype::Table)
|
|
|
|
|
{
|
|
|
|
|
m_listItem.append(new Table(*(static_cast<Table*>(item))));
|
|
|
|
|
}else if (item->elementType() == CCS_Report::BaseItem::classtype::TableDynamic)
|
|
|
|
|
{
|
|
|
|
|
m_listItem.append(new TableDynamic(*(static_cast<TableDynamic*>(item))));
|
|
|
|
|
}else if (item->elementType() == CCS_Report::BaseItem::classtype::TableGroup)
|
|
|
|
|
{
|
|
|
|
|
m_listItem.append(new TableGroup(*(static_cast<TableGroup*>(item))));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
~HeaderWrapper()
|
|
|
|
|
{ }
|
|
|
|
|
HeaderFormat* headerFormat()
|
|
|
|
|
{
|
|
|
|
|
return dynamic_cast<HeaderFormat*>(m_Format);
|
|
|
|
|
}
|
|
|
|
|
void SetMargin(const int left,const int top,const int right,const int bottom)
|
|
|
|
|
{
|
|
|
|
|
dynamic_cast<HeaderFormat*>(m_Format)->SetMargin(left,top,right,bottom);
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Band页脚属性定义
|
|
|
|
|
/// </summary>
|
|
|
|
|
class FooterFormat:public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FooterFormat():BandFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
m_penLine = QPen();
|
|
|
|
|
m_penLine.setStyle(Qt::NoPen);
|
|
|
|
|
}
|
|
|
|
|
FooterFormat(int left,int top,int right,int bottom):BandFormat(left,top,right,bottom)
|
|
|
|
|
{
|
|
|
|
|
m_penLine = QPen();;
|
|
|
|
|
}
|
|
|
|
|
FooterFormat(FooterFormat& format):BandFormat(format)
|
|
|
|
|
{
|
|
|
|
|
m_penLine = format.m_penLine;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页脚横线
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
inline QPen showline() const {return m_penLine;}
|
|
|
|
|
inline void SetShowLine(const QPen& flag){m_penLine = flag;}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPen m_penLine; //横线
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Band 页脚类
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
class FooterWrapper:public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FooterWrapper(FooterFormat& format,QObject* parent=0):BaseBand(format,parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new FooterFormat(format);
|
|
|
|
|
m_Type = bandtype::Footer;
|
|
|
|
|
}
|
|
|
|
|
FooterWrapper(QObject* parent=0):BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new FooterFormat();
|
|
|
|
|
m_Type = bandtype::Footer;
|
|
|
|
|
}
|
|
|
|
|
FooterWrapper(const FooterWrapper& foot):BaseBand(foot)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Footer;
|
|
|
|
|
|
|
|
|
|
m_Format = new FooterFormat(*(static_cast<FooterFormat*>(foot.m_Format)));
|
|
|
|
|
foreach (BaseItem* item, foot.m_listItem) {
|
|
|
|
|
if (item->elementType() == CCS_Report::BaseItem::classtype::Table)
|
|
|
|
|
{
|
|
|
|
|
m_listItem.append(new Table(*(static_cast<Table*>(item))));
|
|
|
|
|
}else if (item->elementType() == CCS_Report::BaseItem::classtype::TableDynamic)
|
|
|
|
|
{
|
|
|
|
|
m_listItem.append(new TableDynamic(*(static_cast<TableDynamic*>(item))));
|
|
|
|
|
}else if (item->elementType() == CCS_Report::BaseItem::classtype::TableGroup)
|
|
|
|
|
{
|
|
|
|
|
m_listItem.append(new TableGroup(*(static_cast<TableGroup*>(item))));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
~FooterWrapper()
|
|
|
|
|
{}
|
|
|
|
|
FooterFormat* footerFormat()
|
|
|
|
|
{
|
|
|
|
|
return dynamic_cast<FooterFormat*>(m_Format);
|
|
|
|
|
}
|
|
|
|
|
void SetMargin(const int left,const int top,const int right,const int bottom)
|
|
|
|
|
{
|
|
|
|
|
dynamic_cast<FooterFormat*>(m_Format)->SetMargin(left,top,right,bottom);
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
class DirectoryFormat:public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DirectoryFormat():BandFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
DirectoryFormat(int left,int top,int right,int bottom):BandFormat(left,top,right,bottom)
|
|
|
|
|
{}
|
|
|
|
|
DirectoryFormat(DirectoryFormat& format):BandFormat(format)
|
|
|
|
|
{}
|
|
|
|
|
private:
|
|
|
|
|
int m_iCreateType; //目录生成方式 =0 自动 =1 手动
|
|
|
|
|
};
|
|
|
|
|
class DirectoryWrapper:public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DirectoryWrapper(DirectoryFormat& format,QObject* parent=0):BaseBand(format,parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new DirectoryFormat(format);
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Type = bandtype::Directory;
|
|
|
|
|
}
|
|
|
|
|
DirectoryWrapper(QObject* parent=0):BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Directory;
|
|
|
|
|
m_Format = new DirectoryFormat();
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
}
|
|
|
|
|
~DirectoryWrapper()
|
|
|
|
|
{
|
|
|
|
|
if (!m_Header)
|
|
|
|
|
{
|
|
|
|
|
delete m_Header;
|
|
|
|
|
}
|
|
|
|
|
if (!m_Footer)
|
|
|
|
|
{
|
|
|
|
|
delete m_Footer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加页眉【暂未用】
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="header"></param>
|
|
|
|
|
void AddHeader(HeaderWrapper& header)
|
|
|
|
|
{
|
|
|
|
|
m_Header = new HeaderWrapper(header);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加页脚【暂未用】
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="footer"></param>
|
|
|
|
|
void AddFooter(FooterWrapper& footer)
|
|
|
|
|
{
|
|
|
|
|
m_Footer = new FooterWrapper(footer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HeaderWrapper* header() const
|
|
|
|
|
{
|
|
|
|
|
return m_Header;
|
|
|
|
|
}
|
|
|
|
|
FooterWrapper* footer() const
|
|
|
|
|
{
|
|
|
|
|
return m_Footer;
|
|
|
|
|
}
|
|
|
|
|
// void SetHeader(HeaderWrapper* header){m_header = header;}
|
|
|
|
|
// void SetFooter(FooterWrapper* footer){m_footer = footer;}
|
|
|
|
|
private:
|
|
|
|
|
HeaderWrapper* m_Header;
|
|
|
|
|
FooterWrapper* m_Footer;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 【暂时未用】
|
|
|
|
|
/// </summary>
|
|
|
|
|
class AppendixFormat:public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
AppendixFormat():BandFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
AppendixFormat(int left,int top,int right,int bottom):BandFormat(left,top,right,bottom)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_bContent; //是否和正文在同一页还是另起新页输出;缺省是另起新页输出
|
|
|
|
|
};
|
|
|
|
|
class AppendixWrapper:public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
AppendixWrapper(AppendixFormat& format,QObject* parent=0):BaseBand(format,parent)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Appendix;
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Format = new AppendixFormat(format);
|
|
|
|
|
}
|
|
|
|
|
AppendixWrapper(QObject* parent=0):BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Appendix;
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Format = new AppendixFormat();
|
|
|
|
|
}
|
|
|
|
|
~AppendixWrapper()
|
|
|
|
|
{
|
|
|
|
|
if (!m_Header)
|
|
|
|
|
{
|
|
|
|
|
delete m_Header;
|
|
|
|
|
}
|
|
|
|
|
if (!m_Footer)
|
|
|
|
|
{
|
|
|
|
|
delete m_Footer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void AddHeader(HeaderWrapper& header)
|
|
|
|
|
{
|
|
|
|
|
m_Header = new HeaderWrapper(header);
|
|
|
|
|
}
|
|
|
|
|
void AddFooter(FooterWrapper& footer)
|
|
|
|
|
{
|
|
|
|
|
m_Footer = new FooterWrapper(footer);
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
HeaderWrapper* m_Header;
|
|
|
|
|
FooterWrapper* m_Footer;
|
|
|
|
|
};
|
|
|
|
|
class ContentFormat:public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ContentFormat():BandFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ContentFormat(int left,int top,int right,int bottom):BandFormat(left,top,right,bottom)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
class ContentWrapper:public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ContentWrapper(ContentFormat& format,QObject* parent=0):BaseBand(format,parent)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Content;
|
|
|
|
|
m_Format = new ContentFormat(format);
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Footer = nullptr;
|
|
|
|
|
}
|
|
|
|
|
ContentWrapper(QObject* parent=0):BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Type = bandtype::Content;
|
|
|
|
|
m_Format = new ContentFormat();
|
|
|
|
|
m_Header = nullptr;
|
|
|
|
|
m_Footer = nullptr;
|
|
|
|
|
}
|
|
|
|
|
~ContentWrapper()
|
|
|
|
|
{
|
|
|
|
|
if (!m_Header)
|
|
|
|
|
{
|
|
|
|
|
delete m_Header;
|
|
|
|
|
}
|
|
|
|
|
if (!m_Footer)
|
|
|
|
|
{
|
|
|
|
|
delete m_Footer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void AddHeader(HeaderWrapper& header)
|
|
|
|
|
{
|
|
|
|
|
m_Header = new HeaderWrapper(header);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void AddFooter(FooterWrapper& footer)
|
|
|
|
|
{
|
|
|
|
|
m_Footer= new FooterWrapper(footer);
|
|
|
|
|
}
|
|
|
|
|
HeaderWrapper* header() const
|
|
|
|
|
{
|
|
|
|
|
return m_Header;
|
|
|
|
|
}
|
|
|
|
|
FooterWrapper* footer() const
|
|
|
|
|
{
|
|
|
|
|
return m_Footer;
|
|
|
|
|
}
|
|
|
|
|
void SetMargin(const int left,const int top,const int right,const int bottom)
|
|
|
|
|
{
|
|
|
|
|
dynamic_cast<ContentFormat*>(m_Format)->SetMargin(left,top,right,bottom);
|
|
|
|
|
}
|
|
|
|
|
/* void SetHeader(HeaderWrapper* header){m_header = header;}
|
|
|
|
|
void SetFooter(FooterWrapper* footer){m_footer = footer;}*/
|
|
|
|
|
private:
|
|
|
|
|
HeaderWrapper* m_Header;
|
|
|
|
|
FooterWrapper* m_Footer;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 水印属性
|
|
|
|
|
/// </summary>
|
|
|
|
|
class WaterFormat :public BandFormat
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
WaterFormat() :BandFormat()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
WaterFormat(int left, int top, int bottom, int right) :BandFormat(left, top, bottom, right) {}
|
|
|
|
|
WaterFormat(CoverFormat& format) :BandFormat(format)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 水印
|
|
|
|
|
/// </summary>
|
|
|
|
|
class WaterWrapper :public BaseBand
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
WaterWrapper(WaterFormat& format, QObject* parent = 0) :BaseBand(format, parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new WaterFormat(format);
|
|
|
|
|
m_Type = bandtype::Water;
|
|
|
|
|
}
|
|
|
|
|
WaterWrapper(QObject* parent = 0) :BaseBand(parent)
|
|
|
|
|
{
|
|
|
|
|
m_Format = new WaterFormat();
|
|
|
|
|
m_Type = bandtype::Water;
|
|
|
|
|
}
|
|
|
|
|
~WaterWrapper()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 报告类,包含若干个Band,每个类型的Band仅出现0次或者1次;
|
|
|
|
|
/// Band包括:封面(cover)、目录(directory)、内容(content)、页眉(header)、页脚(footer)、水印(water)、【附录()未用】
|
|
|
|
|
/// </summary>
|
|
|
|
|
class Report:public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_FLAGS(Elements)
|
|
|
|
|
Q_ENUMS(Element)
|
|
|
|
|
Q_FLAGS(Frames)
|
|
|
|
|
Q_ENUMS(Frame)
|
|
|
|
|
public:
|
|
|
|
|
Report(QFont font = QFont("宋体"))
|
|
|
|
|
{
|
|
|
|
|
// ccsReport = new CCS_Report::CCSReport();
|
|
|
|
|
// m_mapBand.insert("header",new HeaderWrapper(this));
|
|
|
|
|
m_mapBand.insert("cover",new CoverWrapper(this));
|
|
|
|
|
//m_mapBand.insert("footer",new FooterWrapper(this));
|
|
|
|
|
m_mapBand.insert("dir",new DirectoryWrapper(this));
|
|
|
|
|
m_mapBand.insert("content",new ContentWrapper(this));
|
|
|
|
|
m_mapBand.insert("appendix",new AppendixWrapper(this));
|
|
|
|
|
m_mapBand.insert("water", new WaterWrapper(this));
|
|
|
|
|
// m_Headers.append(new HeaderWrapper(this));
|
|
|
|
|
// m_Footers.append(new FooterWrapper(this));
|
|
|
|
|
|
|
|
|
|
// dynamic_cast<ContentWrapper*>(m_mapBand.value("content"))->SetHeader(m_Headers[0]);
|
|
|
|
|
// dynamic_cast<ContentWrapper*>(m_mapBand.value("content"))->SetFooter(m_Footers[0]);
|
|
|
|
|
|
|
|
|
|
m_defaultFont = font;
|
|
|
|
|
m_eFrame = 0; //无边框
|
|
|
|
|
m_qFrameTop = 0;
|
|
|
|
|
m_qFrameBottom = 0;
|
|
|
|
|
m_qFrameLeft = 0;
|
|
|
|
|
m_qFrameRight = 0;
|
|
|
|
|
m_margin = QMargins();
|
|
|
|
|
m_bShowBorder = false;
|
|
|
|
|
m_bHasDirectory = true;
|
|
|
|
|
m_iDirOrient = CCSReportType::Portrait;
|
|
|
|
|
m_numberstyle = CCSReportType::NoteNumberStyleArabic;
|
|
|
|
|
|
|
|
|
|
m_strWaterPath="";
|
|
|
|
|
m_sizeWater=QSize();
|
|
|
|
|
m_iWaterOpacity = 100;
|
|
|
|
|
m_iWaterAngle = 0;
|
|
|
|
|
m_iWaterShowType = 0; //=0居中、=1平铺
|
|
|
|
|
m_strWaterInfo = "";
|
|
|
|
|
m_iPosition = 0;
|
|
|
|
|
}
|
|
|
|
|
~Report()
|
|
|
|
|
{
|
|
|
|
|
for(auto& item:m_mapBand)
|
|
|
|
|
{
|
|
|
|
|
delete item;
|
|
|
|
|
}
|
|
|
|
|
// for(auto&item:m_Headers)
|
|
|
|
|
// {
|
|
|
|
|
// delete item;
|
|
|
|
|
// }
|
|
|
|
|
// for (auto&item:m_Footers)
|
|
|
|
|
// {
|
|
|
|
|
// delete item;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
void SetDefaultFont(QFont font);
|
|
|
|
|
QFont defaultfont(){return m_defaultFont;}
|
|
|
|
|
|
|
|
|
|
CoverWrapper* Cover() {return dynamic_cast<CoverWrapper*>(m_mapBand.value("cover"));}
|
|
|
|
|
//HeaderWrapper* Header() {return dynamic_cast<HeaderWrapper*>(m_mapBand.value("header"));}
|
|
|
|
|
//FooterWrapper* Footer() {return dynamic_cast<FooterWrapper*>(m_mapBand.value("footer"));}
|
|
|
|
|
DirectoryWrapper* Directory() {return dynamic_cast<DirectoryWrapper*>(m_mapBand.value("dir"));}
|
|
|
|
|
ContentWrapper* Content() {return dynamic_cast<ContentWrapper*>(m_mapBand.value("content"));}
|
|
|
|
|
WaterWrapper* Water() {return dynamic_cast<WaterWrapper*>(m_mapBand.value("water"));}
|
|
|
|
|
void SetContent(ContentWrapper* wrapper)
|
|
|
|
|
{
|
|
|
|
|
if (m_mapBand.contains("content"))
|
|
|
|
|
{
|
|
|
|
|
delete m_mapBand["content"];
|
|
|
|
|
m_mapBand.remove("content");
|
|
|
|
|
m_mapBand.insert("content",wrapper);
|
|
|
|
|
wrapper->setParent(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AppendixWrapper* Appendix(){return dynamic_cast<AppendixWrapper*>(m_mapBand.value("appendix"));}
|
|
|
|
|
|
|
|
|
|
// QList<HeaderWrapper*> Headers() {return m_Headers;}
|
|
|
|
|
// QList<FooterWrapper*> Footers() {return m_Footers;}
|
|
|
|
|
// HeaderWrapper* Header(int index=0)
|
|
|
|
|
// {
|
|
|
|
|
// if (m_Headers.count()> index)
|
|
|
|
|
// return m_Headers[index];
|
|
|
|
|
// else
|
|
|
|
|
// return 0;
|
|
|
|
|
// }
|
|
|
|
|
// FooterWrapper* Footer(int index=0)
|
|
|
|
|
// {
|
|
|
|
|
// if (m_Footers.count()> index)
|
|
|
|
|
// return m_Footers[index];
|
|
|
|
|
// else
|
|
|
|
|
// return 0;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
enum Frame {DrawLeft = 0,
|
|
|
|
|
DrawRight = 1,
|
|
|
|
|
DrawTop = 2,
|
|
|
|
|
DrawBottom = 4
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Q_ENUM(Frame)
|
|
|
|
|
Q_DECLARE_FLAGS(Frames, Frame)
|
|
|
|
|
Q_FLAG(Frames)
|
|
|
|
|
QHash<QString,BaseBand*>& bandItem(){
|
|
|
|
|
return m_mapBand;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置报告页面边框的属性
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
int frame() const {return m_eFrame;}
|
|
|
|
|
qreal framewidth() const {return m_qFrameWidth;}
|
|
|
|
|
QColor framecolor() const {return m_FrameColor;}
|
|
|
|
|
qreal frametop() const {return m_qFrameTop;}
|
|
|
|
|
qreal framebottom() const {return m_qFrameBottom;}
|
|
|
|
|
qreal frameleft() const {return m_qFrameLeft;}
|
|
|
|
|
qreal frameright() const {return m_qFrameRight;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetIsFrame(const int & frame) {m_eFrame = frame;}
|
|
|
|
|
void SetFrameWidth(const qreal & width){m_qFrameWidth = width;}
|
|
|
|
|
void SetFrameColor(const QColor& color){m_FrameColor = color;}
|
|
|
|
|
void SetFrameTop(const qreal &top){m_qFrameTop = top;}
|
|
|
|
|
void SetFrameBottom(const qreal &bottom){m_qFrameBottom = bottom;}
|
|
|
|
|
void SetFrameLeft(const qreal &left){m_qFrameLeft = left;}
|
|
|
|
|
void SetFrameRight(const qreal &right){m_qFrameRight = right;}
|
|
|
|
|
void SetFrame(const qreal &top,const qreal &bottom,const qreal &left,const qreal &right)
|
|
|
|
|
{
|
|
|
|
|
m_qFrameTop = top;
|
|
|
|
|
m_qFrameBottom = bottom;
|
|
|
|
|
m_qFrameLeft = left;
|
|
|
|
|
m_qFrameRight = right;
|
|
|
|
|
}
|
|
|
|
|
void SetFrame(const qreal &top,const qreal &bottom,const qreal &left,const qreal &right,const qreal &width,const QColor &color )
|
|
|
|
|
{
|
|
|
|
|
m_qFrameTop = top;
|
|
|
|
|
m_qFrameBottom = bottom;
|
|
|
|
|
m_qFrameLeft = left;
|
|
|
|
|
m_qFrameRight = right;
|
|
|
|
|
m_qFrameWidth = width;
|
|
|
|
|
m_FrameColor = color;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置报告的页边距
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
QMargins reportmargin() {return m_margin;}
|
|
|
|
|
void SetReportMargin(QMargins margin){
|
|
|
|
|
m_margin = margin;
|
|
|
|
|
}
|
|
|
|
|
bool showborder() { return m_bShowBorder; }
|
|
|
|
|
void SetShowBorder(bool value) { m_bShowBorder = value; }
|
|
|
|
|
bool hasdirctory() { return m_bHasDirectory; }
|
|
|
|
|
void SetHasDirectory(bool value) { m_bHasDirectory = value; }
|
|
|
|
|
int dirOrient() { return m_iDirOrient; }
|
|
|
|
|
void SetDirOrient(int value) { m_iDirOrient = value; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 【未用】
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
CCSReportType::NoteNumberStyle numberstyle(){return m_numberstyle;}
|
|
|
|
|
void SetNumberStyle(CCSReportType::NoteNumberStyle style) {m_numberstyle = style;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 后续关于水印的方法函数【未用】
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
QString waterpath(){return m_strWaterPath;}
|
|
|
|
|
void SetWaterPath(QString path){m_strWaterPath = path;}
|
|
|
|
|
|
|
|
|
|
QSize watersize() {return m_sizeWater;}
|
|
|
|
|
void SetWaterSize(QSize& size){m_sizeWater = size;}
|
|
|
|
|
|
|
|
|
|
int wateropacity(){return m_iWaterOpacity;}
|
|
|
|
|
void SetWaterOpacity(int value){m_iWaterOpacity = value;}
|
|
|
|
|
int waterangle(){return m_iWaterAngle;}
|
|
|
|
|
void SetWaterAngle(int value){m_iWaterAngle = value;}
|
|
|
|
|
int watershowtype(){return m_iWaterShowType;}
|
|
|
|
|
void SetWaterShowType(int value){m_iWaterShowType = value;}
|
|
|
|
|
|
|
|
|
|
QString waterinfo(){return m_strWaterInfo;}
|
|
|
|
|
void SetWaterInfo(QString value){m_strWaterInfo = value;}
|
|
|
|
|
|
|
|
|
|
int waterposition(){return m_iPosition;}
|
|
|
|
|
void SetWaterPosition(int value){m_iPosition = value;}
|
|
|
|
|
|
|
|
|
|
void SetWaterInfos(QString path,QString info="",int position =0,int opacity=100,int angle=0,int showtype=0,QSize size=QSize())
|
|
|
|
|
{
|
|
|
|
|
m_strWaterPath = path;
|
|
|
|
|
m_iWaterOpacity = opacity;
|
|
|
|
|
m_iWaterAngle = angle;
|
|
|
|
|
m_iWaterShowType = showtype;
|
|
|
|
|
m_sizeWater = size;
|
|
|
|
|
m_strWaterInfo = info;
|
|
|
|
|
m_iPosition = position;
|
|
|
|
|
}
|
|
|
|
|
// void SetContentHeader(const int& index=0)
|
|
|
|
|
// {
|
|
|
|
|
// dynamic_cast<ContentWrapper*>(m_mapBand.value("content"))->SetHeader(m_Headers[index]);
|
|
|
|
|
// }
|
|
|
|
|
// void SetContentFooter(const int& index)
|
|
|
|
|
// {
|
|
|
|
|
// dynamic_cast<ContentWrapper*>(m_mapBand.value("content"))->SetFooter(m_Footers[index]);
|
|
|
|
|
// }
|
|
|
|
|
// void SetDirectoryHeader(const int& index=0)
|
|
|
|
|
// {
|
|
|
|
|
// dynamic_cast<DirectoryWrapper*>(m_mapBand.value("dir"))->SetHeader(m_Headers[index]);
|
|
|
|
|
// }
|
|
|
|
|
// void SetDirectoryFooter(const int& index)
|
|
|
|
|
// {
|
|
|
|
|
// dynamic_cast<DirectoryWrapper*>(m_mapBand.value("dir"))->SetFooter(m_Footers[index]);
|
|
|
|
|
// }
|
|
|
|
|
private:
|
|
|
|
|
QHash<QString,BaseBand*> m_mapBand;
|
|
|
|
|
// QList<HeaderWrapper*> m_Headers;
|
|
|
|
|
// QList<FooterWrapper*> m_Footers;
|
|
|
|
|
//边框的设定
|
|
|
|
|
int m_eFrame; //边框的显示
|
|
|
|
|
int m_eUnit;
|
|
|
|
|
qreal m_qFrameWidth; //边框宽度
|
|
|
|
|
qreal m_qFrameTop;//边框位置 距上、距下、距左、距右
|
|
|
|
|
qreal m_qFrameBottom;
|
|
|
|
|
qreal m_qFrameLeft;
|
|
|
|
|
qreal m_qFrameRight;
|
|
|
|
|
QMargins m_margin;
|
|
|
|
|
QColor m_FrameColor; //边框颜色
|
|
|
|
|
QFont m_defaultFont;
|
|
|
|
|
CCSReportType::NoteNumberStyle m_numberstyle;
|
|
|
|
|
bool m_bShowBorder;
|
|
|
|
|
bool m_bHasDirectory;
|
|
|
|
|
int m_iDirOrient; //目录的方向 =0 横向 =1 纵向 2022/8/24 添加
|
|
|
|
|
|
|
|
|
|
//水印 以下属性【作废】
|
|
|
|
|
QString m_strWaterPath;
|
|
|
|
|
QSize m_sizeWater;
|
|
|
|
|
int m_iWaterOpacity;
|
|
|
|
|
int m_iWaterAngle; //逆时针角度
|
|
|
|
|
int m_iWaterShowType; //居中、平铺
|
|
|
|
|
QString m_strWaterInfo; //水印附加信息,
|
|
|
|
|
int m_iPosition; //水印叠加位置 =0 图层之下 =1 图层之上 假设只有2层
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Report::Frames)
|
|
|
|
|
}
|
|
|
|
|
#endif // CCSREPORTTEMPLATE_H
|