mirror of
https://github.com/fralx/LimeReport.git
synced 2025-09-23 16:39:07 +03:00
Define code style and format all source file using clang-format-14
except those placed in 3rdparty directories.
This commit is contained in:
@@ -3,22 +3,31 @@
|
||||
#include <QObject>
|
||||
namespace LimeReport {
|
||||
|
||||
struct CallbackInfo{
|
||||
enum DataType{IsEmpty, HasNext, ColumnHeaderData, ColumnData, ColumnCount, RowCount};
|
||||
enum ChangePosType{First, Next};
|
||||
struct CallbackInfo {
|
||||
enum DataType {
|
||||
IsEmpty,
|
||||
HasNext,
|
||||
ColumnHeaderData,
|
||||
ColumnData,
|
||||
ColumnCount,
|
||||
RowCount
|
||||
};
|
||||
enum ChangePosType {
|
||||
First,
|
||||
Next
|
||||
};
|
||||
DataType dataType;
|
||||
int index;
|
||||
QString columnName;
|
||||
};
|
||||
|
||||
class ICallbackDatasource :public QObject{
|
||||
class ICallbackDatasource: public QObject {
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void getCallbackData(const LimeReport::CallbackInfo& info, QVariant& data);
|
||||
void changePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRVIRTUALDATASOURCEINTF
|
||||
|
||||
|
@@ -1,14 +1,17 @@
|
||||
#ifndef LRDATASOURCEINTF_H
|
||||
#define LRDATASOURCEINTF_H
|
||||
#include <QSharedPointer>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QSharedPointer>
|
||||
namespace LimeReport {
|
||||
|
||||
class IDataSource {
|
||||
public:
|
||||
enum DatasourceMode{DESIGN_MODE,RENDER_MODE};
|
||||
enum DatasourceMode {
|
||||
DESIGN_MODE,
|
||||
RENDER_MODE
|
||||
};
|
||||
typedef QSharedPointer<IDataSource> Ptr;
|
||||
virtual ~IDataSource() {}
|
||||
virtual ~IDataSource() { }
|
||||
virtual bool next() = 0;
|
||||
virtual bool hasNext() = 0;
|
||||
virtual bool prior() = 0;
|
||||
@@ -18,12 +21,16 @@ public:
|
||||
virtual bool eof() = 0;
|
||||
virtual QVariant data(const QString& columnName) = 0;
|
||||
virtual QVariant dataByRowIndex(const QString& columnName, int rowIndex) = 0;
|
||||
virtual QVariant dataByRowIndex(const QString &columnName, int rowIndex, int roleName) = 0;
|
||||
virtual QVariant dataByRowIndex(const QString &columnName, int rowIndex, const QString &roleName) = 0;
|
||||
virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) = 0;
|
||||
virtual QVariant dataByRowIndex(const QString& columnName, int rowIndex, int roleName) = 0;
|
||||
virtual QVariant dataByRowIndex(const QString& columnName, int rowIndex,
|
||||
const QString& roleName)
|
||||
= 0;
|
||||
virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName,
|
||||
QVariant keyData)
|
||||
= 0;
|
||||
virtual int columnCount() = 0;
|
||||
virtual QString columnNameByIndex(int columnIndex) = 0;
|
||||
virtual QVariant headerData(const QString &columnName, const QString &roleName) = 0;
|
||||
virtual QVariant headerData(const QString& columnName, const QString& roleName) = 0;
|
||||
virtual int columnIndexByName(QString name) = 0;
|
||||
virtual bool isInvalid() const = 0;
|
||||
virtual QString lastError() = 0;
|
||||
@@ -32,8 +39,9 @@ public:
|
||||
|
||||
class IDataSourceHolder {
|
||||
public:
|
||||
virtual ~IDataSourceHolder(){}
|
||||
virtual IDataSource* dataSource(IDataSource::DatasourceMode mode = IDataSource::RENDER_MODE) = 0;
|
||||
virtual ~IDataSourceHolder() { }
|
||||
virtual IDataSource* dataSource(IDataSource::DatasourceMode mode = IDataSource::RENDER_MODE)
|
||||
= 0;
|
||||
virtual QString lastError() const = 0;
|
||||
virtual bool isInvalid() const = 0;
|
||||
virtual bool isOwned() const = 0;
|
||||
@@ -47,5 +55,3 @@ public:
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRDATASOURCEINTF_H
|
||||
|
||||
|
||||
|
@@ -31,34 +31,36 @@
|
||||
#define LRDATASOURCEMANAGERINTF_H
|
||||
|
||||
#include "lrcallbackdatasourceintf.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourceintf.h"
|
||||
#include "lrglobal.h"
|
||||
|
||||
class QVariant;
|
||||
class QString;
|
||||
class QAbstractItemModel;
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class IDbCredentialsProvider{
|
||||
class IDbCredentialsProvider {
|
||||
public:
|
||||
virtual ~IDbCredentialsProvider(){}
|
||||
virtual ~IDbCredentialsProvider() { }
|
||||
virtual QString getUserName(const QString& connectionName) = 0;
|
||||
virtual QString getPassword(const QString& connectionName) = 0;
|
||||
};
|
||||
|
||||
class IDataSourceManager{
|
||||
class IDataSourceManager {
|
||||
public:
|
||||
virtual ~IDataSourceManager(){}
|
||||
virtual ~IDataSourceManager() { }
|
||||
virtual void setReportVariable(const QString& name, const QVariant& value) = 0;
|
||||
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0;
|
||||
virtual void setDefaultDatabasePath(const QString& defaultDatabasePath) = 0;
|
||||
virtual void deleteVariable(const QString& name) = 0;
|
||||
virtual bool containsVariable(const QString& variableName) = 0;
|
||||
virtual QVariant variable(const QString& variableName) = 0;
|
||||
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0;
|
||||
virtual void addCSV(const QString& name, const QString& csvText, const QString& separator, bool firstRowIsHeader) = 0;
|
||||
virtual bool addModel(const QString& name, QAbstractItemModel* model, bool owned) = 0;
|
||||
virtual void addCSV(const QString& name, const QString& csvText, const QString& separator,
|
||||
bool firstRowIsHeader)
|
||||
= 0;
|
||||
virtual void removeModel(const QString& name) = 0;
|
||||
virtual bool containsDatasource(const QString& dataSourceName) = 0;
|
||||
virtual void clearUserVariables()=0;
|
||||
virtual void clearUserVariables() = 0;
|
||||
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
|
||||
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
|
||||
virtual QStringList variableNames() = 0;
|
||||
@@ -69,6 +71,5 @@ public:
|
||||
virtual IDataSourceHolder* dataSourceHolder(const QString& name) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRDATASOURCEMANAGERINTF_H
|
||||
|
||||
|
@@ -27,18 +27,21 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include "lrglobal.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
QString extractClassName(QString className)
|
||||
{
|
||||
int startPos=className.lastIndexOf("::");
|
||||
if(startPos==-1) startPos=0;
|
||||
else startPos+=2;
|
||||
return className.right(className.length()-startPos);
|
||||
int startPos = className.lastIndexOf("::");
|
||||
if (startPos == -1)
|
||||
startPos = 0;
|
||||
else
|
||||
startPos += 2;
|
||||
return className.right(className.length() - startPos);
|
||||
}
|
||||
|
||||
bool ReportSettings::suppressAbsentFieldsAndVarsWarnings() const
|
||||
@@ -46,31 +49,34 @@ bool ReportSettings::suppressAbsentFieldsAndVarsWarnings() const
|
||||
return m_suppressAbsentFieldsAndVarsWarnings;
|
||||
}
|
||||
|
||||
void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings)
|
||||
void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(
|
||||
bool suppressAbsentFieldsAndVarsWarnings)
|
||||
{
|
||||
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
|
||||
}
|
||||
|
||||
QString escapeSimbols(const QString &value)
|
||||
QString escapeSimbols(const QString& value)
|
||||
{
|
||||
QString result = value;
|
||||
result.replace("\"","\\\"");
|
||||
result.replace('\n',"\\n");
|
||||
result.replace("\"", "\\\"");
|
||||
result.replace('\n', "\\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
QString replaceHTMLSymbols(const QString &value)
|
||||
QString replaceHTMLSymbols(const QString& value)
|
||||
{
|
||||
QString result = value;
|
||||
result.replace("<","<");
|
||||
result.replace(">",">");
|
||||
result.replace("<", "<");
|
||||
result.replace(">", ">");
|
||||
return result;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 1))
|
||||
QVector<QString> normalizeCaptures(const QRegExp& reg){
|
||||
QVector<QString> normalizeCaptures(const QRegExp& reg)
|
||||
{
|
||||
#else
|
||||
QVector<QString> normalizeCaptures(const QRegularExpressionMatch ®){
|
||||
QVector<QString> normalizeCaptures(const QRegularExpressionMatch& reg)
|
||||
{
|
||||
#endif
|
||||
QVector<QString> result;
|
||||
foreach (QString cap, reg.capturedTexts()) {
|
||||
@@ -80,13 +86,14 @@ QVector<QString> normalizeCaptures(const QRegularExpressionMatch ®){
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isColorDark(QColor color){
|
||||
qreal darkness = 1-(0.299*color.red() + 0.587*color.green() + 0.114*color.blue())/255;
|
||||
if(darkness<0.5){
|
||||
bool isColorDark(QColor color)
|
||||
{
|
||||
qreal darkness = 1 - (0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255;
|
||||
if (darkness < 0.5) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
@@ -30,23 +30,25 @@
|
||||
#ifndef LRGLOBAL_H
|
||||
#define LRGLOBAL_H
|
||||
#include "qglobal.h"
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QString>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(LIMEREPORT_EXPORTS)
|
||||
# define LIMEREPORT_EXPORT Q_DECL_EXPORT
|
||||
#elif defined (LIMEREPORT_IMPORTS)
|
||||
# define LIMEREPORT_EXPORT Q_DECL_IMPORT
|
||||
#define LIMEREPORT_EXPORT Q_DECL_EXPORT
|
||||
#elif defined(LIMEREPORT_IMPORTS)
|
||||
#define LIMEREPORT_EXPORT Q_DECL_IMPORT
|
||||
#else
|
||||
# define LIMEREPORT_EXPORT /**/
|
||||
#define LIMEREPORT_EXPORT /**/
|
||||
#endif
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define VARIABLE_IS_NOT_USED __attribute__ ((unused))
|
||||
#define VARIABLE_IS_NOT_USED __attribute__((unused))
|
||||
#else
|
||||
#define VARIABLE_IS_NOT_USED
|
||||
#endif
|
||||
@@ -55,12 +57,12 @@ namespace LimeReport {
|
||||
Q_NAMESPACE
|
||||
#endif
|
||||
|
||||
namespace Const{
|
||||
namespace Const {
|
||||
int const DEFAULT_GRID_STEP = 1;
|
||||
int const RESIZE_HANDLE_SIZE = 5;
|
||||
int const SELECTION_PEN_SIZE = 1;
|
||||
int const MINIMUM_ITEM_WIDTH = 2*RESIZE_HANDLE_SIZE;
|
||||
int const MINIMUM_ITEM_HEIGHT = 2*RESIZE_HANDLE_SIZE;
|
||||
int const MINIMUM_ITEM_WIDTH = 2 * RESIZE_HANDLE_SIZE;
|
||||
int const MINIMUM_ITEM_HEIGHT = 2 * RESIZE_HANDLE_SIZE;
|
||||
double const RESIZE_ZONE_OPACITY = 0.5;
|
||||
double const SELECTED_RESIZE_ZONE_OPACITY = 0.6;
|
||||
Qt::GlobalColor const RESIZE_ZONE_COLOR = Qt::green;
|
||||
@@ -80,15 +82,21 @@ namespace Const{
|
||||
const qreal BAND_NAME_TEXT_OPACITY = 0.6;
|
||||
const qreal SELECTION_OPACITY = 0.3;
|
||||
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
|
||||
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*(?:([^\\{\\},]*)|(?:([^\\{\\}]*)\\s*,\\s*([^\\{\\}]*)))\\s*\\}";
|
||||
const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(?:(%1)|(?:(%1)\\s*,\\s*([^\\{\\}]*)))\\s*\\}";
|
||||
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
|
||||
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*..*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))(?:(?:\\s*,\\s*(?:(\\w*)))|(?:))\\)";
|
||||
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*(?:([^\\{\\},]*)|(?:([^\\{\\}]*)\\s*,\\s*([^\\{"
|
||||
"\\}]*)))\\s*\\}";
|
||||
const QString NAMED_VARIABLE_RX
|
||||
= "\\$V\\s*\\{\\s*(?:(%1)|(?:(%1)\\s*,\\s*([^\\{\\}]*)))\\s*\\}";
|
||||
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
|
||||
const QString GROUP_FUNCTION_PARAM_RX
|
||||
= "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*..*\\})|"
|
||||
"(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")"
|
||||
"|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))(?:(?:\\s*,"
|
||||
"\\s*(?:(\\w*)))|(?:))\\)";
|
||||
const int DATASOURCE_INDEX = 3;
|
||||
const int VALUE_INDEX = 2;
|
||||
const int EXPRESSION_ARGUMENT_INDEX = 1;
|
||||
|
||||
const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")";
|
||||
const QString GROUP_FUNCTION_RX = "(%1\\s*" + GROUP_FUNCTION_PARAM_RX + ")";
|
||||
const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)";
|
||||
const int SCENE_MARGIN = 50;
|
||||
const QString FUNCTION_MANAGER_NAME = "LimeReport";
|
||||
@@ -100,104 +108,135 @@ namespace Const{
|
||||
const char SCRIPT_SIGN = 'S';
|
||||
const char FIELD_SIGN = 'D';
|
||||
const char VARIABLE_SIGN = 'V';
|
||||
}
|
||||
QString extractClassName(QString className);
|
||||
QString escapeSimbols(const QString& value);
|
||||
QString replaceHTMLSymbols(const QString &value);
|
||||
} // namespace Const
|
||||
QString extractClassName(QString className);
|
||||
QString escapeSimbols(const QString& value);
|
||||
QString replaceHTMLSymbols(const QString& value);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1)
|
||||
QVector<QString> normalizeCaptures(const QRegularExpressionMatch ®);
|
||||
QVector<QString> normalizeCaptures(const QRegularExpressionMatch& reg);
|
||||
#else
|
||||
QVector<QString> normalizeCaptures(const QRegExp ®);
|
||||
QVector<QString> normalizeCaptures(const QRegExp& reg);
|
||||
#endif
|
||||
bool isColorDark(QColor color);
|
||||
bool isColorDark(QColor color);
|
||||
|
||||
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
enum RenderPass {FirstPass = 1, SecondPass = 2};
|
||||
enum ArrangeType {AsNeeded, Force};
|
||||
enum ScaleType {FitWidth, FitPage, OneToOne, Percents};
|
||||
enum PreviewHint{ShowAllPreviewBars = 0,
|
||||
HidePreviewToolBar = 1,
|
||||
HidePreviewMenuBar = 2,
|
||||
HidePreviewStatusBar = 4,
|
||||
HideAllPreviewBar = 7,
|
||||
PreviewBarsUserSetting = 8};
|
||||
enum ExpandType {
|
||||
EscapeSymbols,
|
||||
NoEscapeSymbols,
|
||||
ReplaceHTMLSymbols
|
||||
};
|
||||
enum RenderPass {
|
||||
FirstPass = 1,
|
||||
SecondPass = 2
|
||||
};
|
||||
enum ArrangeType {
|
||||
AsNeeded,
|
||||
Force
|
||||
};
|
||||
enum ScaleType {
|
||||
FitWidth,
|
||||
FitPage,
|
||||
OneToOne,
|
||||
Percents
|
||||
};
|
||||
enum PreviewHint {
|
||||
ShowAllPreviewBars = 0,
|
||||
HidePreviewToolBar = 1,
|
||||
HidePreviewMenuBar = 2,
|
||||
HidePreviewStatusBar = 4,
|
||||
HideAllPreviewBar = 7,
|
||||
PreviewBarsUserSetting = 8
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
|
||||
Q_FLAGS(PreviewHints)
|
||||
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
|
||||
Q_FLAGS(PreviewHints)
|
||||
|
||||
class LIMEREPORT_EXPORT ReportError : public std::runtime_error{
|
||||
public:
|
||||
ReportError(const QString& message);
|
||||
};
|
||||
class LIMEREPORT_EXPORT ReportError: public std::runtime_error {
|
||||
public:
|
||||
ReportError(const QString& message);
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT ReportSettings{
|
||||
public:
|
||||
class LIMEREPORT_EXPORT ReportSettings {
|
||||
public:
|
||||
#ifdef DEFAULT_ITEM_PADDING
|
||||
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(DEFAULT_ITEM_PADDING){}
|
||||
ReportSettings():
|
||||
m_suppressAbsentFieldsAndVarsWarnings(false),
|
||||
m_baseItemPadding(DEFAULT_ITEM_PADDING)
|
||||
{
|
||||
}
|
||||
#else
|
||||
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(0){}
|
||||
ReportSettings(): m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(0) { }
|
||||
#endif
|
||||
void setDefaultValues(){
|
||||
m_suppressAbsentFieldsAndVarsWarnings = false;
|
||||
void setDefaultValues()
|
||||
{
|
||||
m_suppressAbsentFieldsAndVarsWarnings = false;
|
||||
#ifdef DEFAULT_ITEM_PADDING
|
||||
m_baseItemPadding = DEFAULT_ITEM_PADDING;
|
||||
m_baseItemPadding = DEFAULT_ITEM_PADDING;
|
||||
#else
|
||||
m_baseItemPadding = 0;
|
||||
m_baseItemPadding = 0;
|
||||
#endif
|
||||
}
|
||||
bool suppressAbsentFieldsAndVarsWarnings() const;
|
||||
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
|
||||
int baseItemPadding() const;
|
||||
void setBaseItemPadding(int newBaseTextItemPadding);
|
||||
|
||||
}
|
||||
bool suppressAbsentFieldsAndVarsWarnings() const;
|
||||
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
|
||||
int baseItemPadding() const;
|
||||
void setBaseItemPadding(int newBaseTextItemPadding);
|
||||
private:
|
||||
bool m_suppressAbsentFieldsAndVarsWarnings;
|
||||
int m_baseItemPadding;
|
||||
};
|
||||
private:
|
||||
bool m_suppressAbsentFieldsAndVarsWarnings;
|
||||
int m_baseItemPadding;
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT IExternalPainter{
|
||||
public:
|
||||
virtual void paintByExternalPainter(const QString& objectName, QPainter* painter, const QStyleOptionGraphicsItem* options) = 0;
|
||||
virtual ~IExternalPainter();
|
||||
};
|
||||
class LIMEREPORT_EXPORT IExternalPainter {
|
||||
public:
|
||||
virtual void paintByExternalPainter(const QString& objectName, QPainter* painter,
|
||||
const QStyleOptionGraphicsItem* options)
|
||||
= 0;
|
||||
virtual ~IExternalPainter();
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT IPainterProxy{
|
||||
public:
|
||||
virtual void setExternalPainter(IExternalPainter* externalPainter) = 0;
|
||||
virtual ~IPainterProxy();
|
||||
};
|
||||
class LIMEREPORT_EXPORT IPainterProxy {
|
||||
public:
|
||||
virtual void setExternalPainter(IExternalPainter* externalPainter) = 0;
|
||||
virtual ~IPainterProxy();
|
||||
};
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
||||
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
||||
#else
|
||||
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||
#endif
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1)
|
||||
QRegularExpression getRegEx(QString expression);
|
||||
QRegularExpression getVariableRegEx();
|
||||
QRegularExpression getFieldRegEx();
|
||||
QRegularExpression getScriptRegEx();
|
||||
QRegularExpression getGroupFunctionRegEx(QString functionName);
|
||||
QRegularExpression getGroupFunctionNameRegEx(QString functionName);
|
||||
QRegularExpression getNamedVariableRegEx(QString variableName);
|
||||
QRegularExpression getRegEx(QString expression);
|
||||
QRegularExpression getVariableRegEx();
|
||||
QRegularExpression getFieldRegEx();
|
||||
QRegularExpression getScriptRegEx();
|
||||
QRegularExpression getGroupFunctionRegEx(QString functionName);
|
||||
QRegularExpression getGroupFunctionNameRegEx(QString functionName);
|
||||
QRegularExpression getNamedVariableRegEx(QString variableName);
|
||||
#endif
|
||||
|
||||
|
||||
class LIMEREPORT_EXPORT Enums
|
||||
{
|
||||
public:
|
||||
enum VariableDataType {Undefined, String, Bool, Int, Real, Date, Time, DateTime};
|
||||
#if QT_VERSION >= 0x050500
|
||||
Q_ENUM(VariableDataType)
|
||||
#else
|
||||
Q_ENUMS(VariableDataType)
|
||||
#endif
|
||||
private:
|
||||
Enums(){}
|
||||
Q_GADGET
|
||||
class LIMEREPORT_EXPORT Enums {
|
||||
public:
|
||||
enum VariableDataType {
|
||||
Undefined,
|
||||
String,
|
||||
Bool,
|
||||
Int,
|
||||
Real,
|
||||
Date,
|
||||
Time,
|
||||
DateTime
|
||||
};
|
||||
#if QT_VERSION >= 0x050500
|
||||
Q_ENUM(VariableDataType)
|
||||
#else
|
||||
Q_ENUMS(VariableDataType)
|
||||
#endif
|
||||
private:
|
||||
Enums() { }
|
||||
Q_GADGET
|
||||
};
|
||||
|
||||
typedef Enums::VariableDataType VariableDataType;
|
||||
typedef Enums::VariableDataType VariableDataType;
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
@@ -2,16 +2,16 @@
|
||||
#define LRPREPAREDPAGESINTF_H
|
||||
#include "lrglobal.h"
|
||||
namespace LimeReport {
|
||||
class LIMEREPORT_EXPORT IPreparedPages{
|
||||
class LIMEREPORT_EXPORT IPreparedPages {
|
||||
public:
|
||||
virtual ~IPreparedPages(){};
|
||||
virtual ~IPreparedPages() {};
|
||||
virtual bool loadFromFile(const QString& fileName) = 0;
|
||||
virtual bool loadFromString(const QString data) = 0;
|
||||
virtual bool loadFromByteArray(QByteArray* data) = 0;
|
||||
virtual bool saveToFile(const QString& fileName) = 0;
|
||||
virtual QString saveToString() = 0;
|
||||
virtual QByteArray saveToByteArray() = 0;
|
||||
virtual QString saveToString() = 0;
|
||||
virtual QByteArray saveToByteArray() = 0;
|
||||
virtual void clear() = 0;
|
||||
};
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
#endif // LRPREPAREDPAGESINTF_H
|
||||
|
@@ -1,16 +1,17 @@
|
||||
#ifndef LRPREVIEWREPORTWIDGET_H
|
||||
#define LRPREVIEWREPORTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QPrinter>
|
||||
#include "lrglobal.h"
|
||||
#include "lrpreparedpagesintf.h"
|
||||
|
||||
#include <QPrinter>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
namespace Ui {
|
||||
class PreviewReportWidget;
|
||||
class PreviewReportWidget;
|
||||
}
|
||||
|
||||
class PreviewReportWidgetPrivate;
|
||||
@@ -18,29 +19,30 @@ class ReportEnginePrivate;
|
||||
class ReportEngine;
|
||||
class PageDesignIntf;
|
||||
|
||||
class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget
|
||||
{
|
||||
class LIMEREPORT_EXPORT PreviewReportWidget: public QWidget {
|
||||
Q_OBJECT
|
||||
friend class ReportEnginePrivate;
|
||||
friend class PreviewReportWindow;
|
||||
friend class PreviewReportWidgetPrivate;
|
||||
|
||||
public:
|
||||
explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0);
|
||||
explicit PreviewReportWidget(ReportEngine* report, QWidget* parent = 0);
|
||||
~PreviewReportWidget();
|
||||
QList<QString> aviableExporters();
|
||||
bool exportReport(QString exporterName, const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
|
||||
bool exportReport(QString exporterName,
|
||||
const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
|
||||
ScaleType scaleType() const;
|
||||
int scalePercent() const;
|
||||
void setScaleType(const ScaleType &scaleType, int percent = 0);
|
||||
int scalePercent() const;
|
||||
void setScaleType(const ScaleType& scaleType, int percent = 0);
|
||||
void setPreviewPageBackgroundColor(QColor color);
|
||||
QColor previewPageBackgroundColor();
|
||||
QPrinter *defaultPrinter() const;
|
||||
void setDefaultPrinter(QPrinter *defaultPrinter);
|
||||
QPrinter* defaultPrinter() const;
|
||||
void setDefaultPrinter(QPrinter* defaultPrinter);
|
||||
void startInsertTextItem();
|
||||
void activateItemSelectionMode();
|
||||
void deleteSelectedItems();
|
||||
void activateCurrentPage();
|
||||
void resize(ScaleType scaleType, int percent=0);
|
||||
void resize(ScaleType scaleType, int percent = 0);
|
||||
|
||||
public slots:
|
||||
void refreshPages();
|
||||
@@ -59,8 +61,9 @@ public slots:
|
||||
void setScalePercent(int percent);
|
||||
void fitWidth();
|
||||
void fitPage();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void resizeEvent(QResizeEvent*);
|
||||
signals:
|
||||
void pageChanged(int page);
|
||||
void scalePercentChanged(int percent);
|
||||
@@ -72,20 +75,22 @@ private slots:
|
||||
void reportEngineDestroyed(QObject* object);
|
||||
void slotZoomed(double);
|
||||
void resizeDone();
|
||||
|
||||
private:
|
||||
void initPreview();
|
||||
void setErrorsMesagesVisible(bool visible);
|
||||
void setErrorMessages(const QStringList &value);
|
||||
void setErrorMessages(const QStringList& value);
|
||||
void emitPageSet();
|
||||
|
||||
private:
|
||||
Ui::PreviewReportWidget *ui;
|
||||
Ui::PreviewReportWidget* ui;
|
||||
PreviewReportWidgetPrivate* d_ptr;
|
||||
ScaleType m_scaleType;
|
||||
int m_scalePercent;
|
||||
QTimer m_resizeTimer;
|
||||
QColor m_previewPageBackgroundColor;
|
||||
int m_scalePercent;
|
||||
QTimer m_resizeTimer;
|
||||
QColor m_previewPageBackgroundColor;
|
||||
QPrinter* m_defaultPrinter;
|
||||
void printPages(QPrinter *printer);
|
||||
void printPages(QPrinter* printer);
|
||||
bool m_scaleChanging;
|
||||
};
|
||||
|
||||
|
@@ -1,26 +1,28 @@
|
||||
#ifndef LRRENDERENGINE_H
|
||||
#define LRRENDERENGINE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QPrintDialog>
|
||||
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourcemanagerintf.h"
|
||||
#include "lrscriptenginemanagerintf.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrpreviewreportwidget.h"
|
||||
#include "lrscriptenginemanagerintf.h"
|
||||
|
||||
namespace LimeReport{
|
||||
#include <QObject>
|
||||
#include <QPrintDialog>
|
||||
#include <QSettings>
|
||||
|
||||
class PrintRange{
|
||||
namespace LimeReport {
|
||||
|
||||
class PrintRange {
|
||||
public:
|
||||
int fromPage() const { return m_fromPage;}
|
||||
int toPage() const { return m_toPage;}
|
||||
QPrintDialog::PrintRange rangeType() const { return m_rangeType;}
|
||||
PrintRange(QAbstractPrintDialog::PrintRange rangeType=QPrintDialog::AllPages, int fromPage=0, int toPage=0);
|
||||
void setRangeType(QAbstractPrintDialog::PrintRange rangeType){ m_rangeType=rangeType;}
|
||||
void setFromPage(int fromPage){ m_fromPage = fromPage;}
|
||||
void setToPage(int toPage){ m_toPage = toPage;}
|
||||
int fromPage() const { return m_fromPage; }
|
||||
int toPage() const { return m_toPage; }
|
||||
QPrintDialog::PrintRange rangeType() const { return m_rangeType; }
|
||||
PrintRange(QAbstractPrintDialog::PrintRange rangeType = QPrintDialog::AllPages,
|
||||
int fromPage = 0, int toPage = 0);
|
||||
void setRangeType(QAbstractPrintDialog::PrintRange rangeType) { m_rangeType = rangeType; }
|
||||
void setFromPage(int fromPage) { m_fromPage = fromPage; }
|
||||
void setToPage(int toPage) { m_toPage = toPage; }
|
||||
|
||||
private:
|
||||
QPrintDialog::PrintRange m_rangeType;
|
||||
int m_fromPage;
|
||||
@@ -32,34 +34,36 @@ class PageDesignIntf;
|
||||
class PageItemDesignIntf;
|
||||
class PreviewReportWidget;
|
||||
|
||||
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
|
||||
typedef QList<QSharedPointer<PageItemDesignIntf>> ReportPages;
|
||||
|
||||
class RenderEnginePrivate;
|
||||
|
||||
class LIMEREPORT_EXPORT RenderEngine: public QObject{
|
||||
class LIMEREPORT_EXPORT RenderEngine: public QObject {
|
||||
Q_OBJECT
|
||||
friend class PreviewReportWidget;
|
||||
|
||||
public:
|
||||
static void setSettings(QSettings *value){m_settings=value;}
|
||||
static void setSettings(QSettings* value) { m_settings = value; }
|
||||
|
||||
public:
|
||||
explicit RenderEngine(QObject *parent = 0);
|
||||
explicit RenderEngine(RenderEnginePrivate* dd, QObject *parent = 0);
|
||||
explicit RenderEngine(QObject* parent = 0);
|
||||
explicit RenderEngine(RenderEnginePrivate* dd, QObject* parent = 0);
|
||||
~RenderEngine();
|
||||
bool printReport(QPrinter *printer=0);
|
||||
bool printPages(ReportPages pages, QPrinter *printer);
|
||||
void printToFile(const QString& fileName);
|
||||
PageDesignIntf *createPreviewScene(QObject *parent = 0);
|
||||
bool printToPDF(const QString& fileName);
|
||||
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
|
||||
bool printReport(QPrinter* printer = 0);
|
||||
bool printPages(ReportPages pages, QPrinter* printer);
|
||||
void printToFile(const QString& fileName);
|
||||
PageDesignIntf* createPreviewScene(QObject* parent = 0);
|
||||
bool printToPDF(const QString& fileName);
|
||||
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
|
||||
IDataSourceManager* dataManager();
|
||||
IScriptEngineManager* scriptManager();
|
||||
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
|
||||
bool loadFromByteArray(QByteArray *data);
|
||||
bool loadFromString(const QString& data);
|
||||
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
|
||||
bool loadFromByteArray(QByteArray* data);
|
||||
bool loadFromString(const QString& data);
|
||||
QString reportFileName();
|
||||
void setReportFileName(const QString& fileName);
|
||||
void setReportFileName(const QString& fileName);
|
||||
QString lastError();
|
||||
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||
PreviewReportWidget* createPreviewWidget(QWidget* parent = 0);
|
||||
void setPreviewWindowTitle(const QString& title);
|
||||
void setPreviewWindowIcon(const QIcon& icon);
|
||||
void setResultEditable(bool value);
|
||||
@@ -70,7 +74,7 @@ public:
|
||||
bool setReportLanguage(QLocale::Language language);
|
||||
Qt::LayoutDirection previewLayoutDirection();
|
||||
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
|
||||
QSettings* settings(){ return m_settings;}
|
||||
QSettings* settings() { return m_settings; }
|
||||
signals:
|
||||
void renderStarted();
|
||||
void renderFinished();
|
||||
@@ -78,11 +82,14 @@ signals:
|
||||
void onLoad(bool& loaded);
|
||||
public slots:
|
||||
void cancelRender();
|
||||
|
||||
protected:
|
||||
QObject* d_ptr;
|
||||
|
||||
private:
|
||||
static QSettings* m_settings;
|
||||
void init();
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(RenderEngine)
|
||||
};
|
||||
|
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class ReportDesignWindowInterface: public QMainWindow{
|
||||
class ReportDesignWindowInterface: public QMainWindow {
|
||||
public:
|
||||
ReportDesignWindowInterface(QWidget* parent = 0): QMainWindow(parent){}
|
||||
ReportDesignWindowInterface(QWidget* parent = 0): QMainWindow(parent) { }
|
||||
virtual bool checkNeedToSave() = 0;
|
||||
virtual void showModal() = 0;
|
||||
virtual void showNonModal() = 0;
|
||||
|
@@ -31,61 +31,74 @@
|
||||
#define LRREPORTDESIGNINTF_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QPrintDialog>
|
||||
#include <QSettings>
|
||||
//#include <QJSEngine>
|
||||
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourcemanagerintf.h"
|
||||
#include "lrscriptenginemanagerintf.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrpreparedpagesintf.h"
|
||||
#include "lrpreviewreportwidget.h"
|
||||
#include "lrreportdesignwindowintrerface.h"
|
||||
#include "lrpreparedpagesintf.h"
|
||||
#include "lrscriptenginemanagerintf.h"
|
||||
|
||||
class QPrinter;
|
||||
class QGraphicsScene;
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class PrintRange{
|
||||
class PrintRange {
|
||||
public:
|
||||
int fromPage() const { return m_fromPage;}
|
||||
int toPage() const { return m_toPage;}
|
||||
QPrintDialog::PrintRange rangeType() const { return m_rangeType;}
|
||||
PrintRange(QAbstractPrintDialog::PrintRange rangeType=QPrintDialog::AllPages, int fromPage=0, int toPage=0);
|
||||
void setRangeType(QAbstractPrintDialog::PrintRange rangeType){ m_rangeType=rangeType;}
|
||||
void setFromPage(int fromPage){ m_fromPage = fromPage;}
|
||||
void setToPage(int toPage){ m_toPage = toPage;}
|
||||
int fromPage() const { return m_fromPage; }
|
||||
int toPage() const { return m_toPage; }
|
||||
QPrintDialog::PrintRange rangeType() const { return m_rangeType; }
|
||||
PrintRange(QAbstractPrintDialog::PrintRange rangeType = QPrintDialog::AllPages,
|
||||
int fromPage = 0, int toPage = 0);
|
||||
void setRangeType(QAbstractPrintDialog::PrintRange rangeType) { m_rangeType = rangeType; }
|
||||
void setFromPage(int fromPage) { m_fromPage = fromPage; }
|
||||
void setToPage(int toPage) { m_toPage = toPage; }
|
||||
|
||||
private:
|
||||
QPrintDialog::PrintRange m_rangeType;
|
||||
int m_fromPage;
|
||||
int m_toPage;
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT ItemGeometry{
|
||||
class LIMEREPORT_EXPORT ItemGeometry {
|
||||
public:
|
||||
enum Type{Millimeters, Pixels};
|
||||
ItemGeometry(qreal x, qreal y, qreal width, qreal height, Qt::Alignment anchor, Type type = Millimeters)
|
||||
:m_x(x), m_y(y), m_width(width), m_height(height), m_type(type), m_anchor(anchor){}
|
||||
ItemGeometry(): m_x(0), m_y(0), m_width(0), m_height(0), m_type(Millimeters){}
|
||||
enum Type {
|
||||
Millimeters,
|
||||
Pixels
|
||||
};
|
||||
ItemGeometry(qreal x, qreal y, qreal width, qreal height, Qt::Alignment anchor,
|
||||
Type type = Millimeters):
|
||||
m_x(x),
|
||||
m_y(y),
|
||||
m_width(width),
|
||||
m_height(height),
|
||||
m_type(type),
|
||||
m_anchor(anchor)
|
||||
{
|
||||
}
|
||||
ItemGeometry(): m_x(0), m_y(0), m_width(0), m_height(0), m_type(Millimeters) { }
|
||||
|
||||
qreal x() const;
|
||||
void setX(const qreal &x);
|
||||
void setX(const qreal& x);
|
||||
|
||||
qreal y() const;
|
||||
void setY(const qreal &y);
|
||||
void setY(const qreal& y);
|
||||
|
||||
qreal width() const;
|
||||
void setWidth(const qreal &width);
|
||||
void setWidth(const qreal& width);
|
||||
|
||||
qreal height() const;
|
||||
void setHeight(const qreal &height);
|
||||
void setHeight(const qreal& height);
|
||||
|
||||
Type type() const;
|
||||
void setType(const Type &type);
|
||||
void setType(const Type& type);
|
||||
|
||||
Qt::Alignment anchor() const;
|
||||
void setAnchor(const Qt::Alignment &anchor);
|
||||
void setAnchor(const Qt::Alignment& anchor);
|
||||
|
||||
private:
|
||||
qreal m_x;
|
||||
@@ -96,42 +109,47 @@ private:
|
||||
Qt::Alignment m_anchor;
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT WatermarkSetting{
|
||||
class LIMEREPORT_EXPORT WatermarkSetting {
|
||||
public:
|
||||
WatermarkSetting(const QString& text, const ItemGeometry& geometry, const QFont& font)
|
||||
: m_text(text), m_font(font), m_opacity(50), m_geometry(geometry), m_color(QColor(Qt::black)){}
|
||||
WatermarkSetting(): m_font(QFont()), m_opacity(50), m_geometry(ItemGeometry()){}
|
||||
WatermarkSetting(const QString& text, const ItemGeometry& geometry, const QFont& font):
|
||||
m_text(text),
|
||||
m_font(font),
|
||||
m_opacity(50),
|
||||
m_geometry(geometry),
|
||||
m_color(QColor(Qt::black))
|
||||
{
|
||||
}
|
||||
WatermarkSetting(): m_font(QFont()), m_opacity(50), m_geometry(ItemGeometry()) { }
|
||||
QString text() const;
|
||||
void setText(const QString &text);
|
||||
void setText(const QString& text);
|
||||
|
||||
QFont font() const;
|
||||
void setFont(const QFont &font);
|
||||
void setFont(const QFont& font);
|
||||
|
||||
int opacity() const;
|
||||
void setOpacity(const int &opacity);
|
||||
void setOpacity(const int& opacity);
|
||||
|
||||
ItemGeometry geometry() const;
|
||||
void setGeometry(const ItemGeometry &geometry);
|
||||
void setGeometry(const ItemGeometry& geometry);
|
||||
|
||||
QColor color() const;
|
||||
void setColor(const QColor &color);
|
||||
void setColor(const QColor& color);
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
QFont m_font;
|
||||
int m_opacity;
|
||||
QFont m_font;
|
||||
int m_opacity;
|
||||
ItemGeometry m_geometry;
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
class ItemBuilder{
|
||||
class ItemBuilder {
|
||||
virtual void setProperty(QString name, QVariant value) = 0;
|
||||
virtual QVariant property(QString name) = 0;
|
||||
virtual void setGeometry(ItemGeometry geometry) = 0;
|
||||
virtual ItemGeometry geometry() = 0;
|
||||
virtual ItemGeometry geometry() = 0;
|
||||
};
|
||||
|
||||
|
||||
class DataSourceManager;
|
||||
class ReportEnginePrivate;
|
||||
class PageDesignIntf;
|
||||
@@ -140,47 +158,50 @@ class ReportDesignWidget;
|
||||
class PreviewReportWidget;
|
||||
class PreparedPages;
|
||||
|
||||
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
|
||||
typedef QList<QSharedPointer<PageItemDesignIntf>> ReportPages;
|
||||
|
||||
class LIMEREPORT_EXPORT ReportEngine : public QObject{
|
||||
class LIMEREPORT_EXPORT ReportEngine: public QObject {
|
||||
Q_OBJECT
|
||||
friend class ReportDesignWidget;
|
||||
friend class PreviewReportWidget;
|
||||
friend class TranslationEditor;
|
||||
|
||||
public:
|
||||
static void setSettings(QSettings *value){m_settings=value;}
|
||||
static void setSettings(QSettings* value) { m_settings = value; }
|
||||
|
||||
public:
|
||||
explicit ReportEngine(QObject *parent = 0);
|
||||
explicit ReportEngine(QObject* parent = 0);
|
||||
~ReportEngine();
|
||||
bool printReport(QPrinter *printer=0);
|
||||
bool printReport(QMap<QString, QPrinter*> printers, bool printToAllPrinters = false);
|
||||
bool printPages(ReportPages pages, QPrinter *printer);
|
||||
void printToFile(const QString& fileName);
|
||||
QGraphicsScene* createPreviewScene(QObject *parent = 0);
|
||||
bool printToPDF(const QString& fileName);
|
||||
bool exportReport(QString exporterName, const QString &fileName = "", const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
|
||||
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
|
||||
void previewReport(QPrinter* printer, PreviewHints hints = PreviewBarsUserSetting);
|
||||
void designReport();
|
||||
bool printReport(QPrinter* printer = 0);
|
||||
bool printReport(QMap<QString, QPrinter*> printers, bool printToAllPrinters = false);
|
||||
bool printPages(ReportPages pages, QPrinter* printer);
|
||||
void printToFile(const QString& fileName);
|
||||
QGraphicsScene* createPreviewScene(QObject* parent = 0);
|
||||
bool printToPDF(const QString& fileName);
|
||||
bool exportReport(QString exporterName, const QString& fileName = "",
|
||||
const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
|
||||
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
|
||||
void previewReport(QPrinter* printer, PreviewHints hints = PreviewBarsUserSetting);
|
||||
void designReport();
|
||||
ReportDesignWindowInterface* getDesignerWindow();
|
||||
void setShowProgressDialog(bool value);
|
||||
bool isShowProgressDialog();
|
||||
void setShowProgressDialog(bool value);
|
||||
bool isShowProgressDialog();
|
||||
IDataSourceManager* dataManager();
|
||||
IScriptEngineManager* scriptManager();
|
||||
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
|
||||
bool loadFromByteArray(QByteArray *data);
|
||||
bool loadFromString(const QString& data);
|
||||
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
|
||||
bool loadFromByteArray(QByteArray* data);
|
||||
bool loadFromString(const QString& data);
|
||||
QString reportFileName();
|
||||
void setReportFileName(const QString& fileName);
|
||||
bool saveToFile(const QString& fileName);
|
||||
QByteArray saveToByteArray();
|
||||
void setReportFileName(const QString& fileName);
|
||||
bool saveToFile(const QString& fileName);
|
||||
QByteArray saveToByteArray();
|
||||
QString saveToString();
|
||||
QString lastError();
|
||||
void setCurrentReportsDir(const QString& dirName);
|
||||
bool setDefaultExportDir(const QString& dirName);
|
||||
void setReportName(const QString& name);
|
||||
QString reportName();
|
||||
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||
PreviewReportWidget* createPreviewWidget(QWidget* parent = 0);
|
||||
void setPreviewWindowTitle(const QString& title);
|
||||
void setPreviewWindowIcon(const QIcon& icon);
|
||||
void setPreviewPageBackgroundColor(QColor color);
|
||||
@@ -201,8 +222,8 @@ public:
|
||||
QList<QLocale::Language> designerLanguages();
|
||||
QLocale::Language currentDesignerLanguage();
|
||||
ScaleType previewScaleType();
|
||||
int previewScalePercent();
|
||||
void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0);
|
||||
int previewScalePercent();
|
||||
void setPreviewScaleType(const ScaleType& previewScaleType, int percent = 0);
|
||||
void addWatermark(const WatermarkSetting& watermarkSetting);
|
||||
void clearWatermarks();
|
||||
IPreparedPages* preparedPages();
|
||||
@@ -234,14 +255,17 @@ signals:
|
||||
void currentDefaultDesignerLanguageChanged(QLocale::Language);
|
||||
QLocale::Language getCurrentDefaultDesignerLanguage();
|
||||
|
||||
void externalPaint(const QString& objectName, QPainter* painter, const QStyleOptionGraphicsItem*);
|
||||
void externalPaint(const QString& objectName, QPainter* painter,
|
||||
const QStyleOptionGraphicsItem*);
|
||||
|
||||
public slots:
|
||||
void cancelRender();
|
||||
void cancelPrinting();
|
||||
|
||||
protected:
|
||||
ReportEnginePrivate * const d_ptr;
|
||||
ReportEngine(ReportEnginePrivate &dd, QObject * parent=0);
|
||||
ReportEnginePrivate* const d_ptr;
|
||||
ReportEngine(ReportEnginePrivate& dd, QObject* parent = 0);
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(ReportEngine)
|
||||
static QSettings* m_settings;
|
||||
|
@@ -32,15 +32,15 @@
|
||||
#include "qglobal.h"
|
||||
|
||||
#if QT_VERSION >= 0x050600
|
||||
#ifndef USE_QTSCRIPTENGINE
|
||||
#ifndef USE_QJSENGINE
|
||||
#define USE_QJSENGINE
|
||||
#endif
|
||||
#endif
|
||||
#ifndef USE_QTSCRIPTENGINE
|
||||
#ifndef USE_QJSENGINE
|
||||
#define USE_QJSENGINE
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifndef USE_QTSCRIPTENGINE
|
||||
#define USE_QTSCRIPTENGINE
|
||||
#endif
|
||||
#ifndef USE_QTSCRIPTENGINE
|
||||
#define USE_QTSCRIPTENGINE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
@@ -49,38 +49,38 @@
|
||||
#include <QtScript/QScriptEngine>
|
||||
#endif
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
typedef QJSEngine ScriptEngineType;
|
||||
typedef QJSValue ScriptValueType;
|
||||
template <typename T>
|
||||
static inline QJSValue getJSValue(QJSEngine &e, T *p)
|
||||
{
|
||||
QJSValue res = e.newQObject(p);
|
||||
QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership);
|
||||
return res;
|
||||
}
|
||||
typedef QJSEngine ScriptEngineType;
|
||||
typedef QJSValue ScriptValueType;
|
||||
template <typename T> static inline QJSValue getJSValue(QJSEngine& e, T* p)
|
||||
{
|
||||
QJSValue res = e.newQObject(p);
|
||||
QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership);
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
typedef QScriptEngine ScriptEngineType;
|
||||
typedef QScriptValue ScriptValueType;
|
||||
typedef QScriptEngine ScriptEngineType;
|
||||
typedef QScriptValue ScriptValueType;
|
||||
#endif
|
||||
|
||||
class IScriptEngineManager{
|
||||
class IScriptEngineManager {
|
||||
public:
|
||||
virtual ScriptEngineType* scriptEngine() = 0;
|
||||
#ifdef USE_QTSCRIPTENGINE
|
||||
virtual bool addFunction(const QString& name, ScriptEngineType::FunctionSignature function,
|
||||
const QString& category="", const QString& description="") = 0;
|
||||
const QString& category = "", const QString& description = "")
|
||||
= 0;
|
||||
#endif
|
||||
virtual bool addFunction(const QString &name, const QString& script,
|
||||
const QString &category="", const QString &description="") = 0;
|
||||
virtual bool addFunction(const QString& name, const QString& script,
|
||||
const QString& category = "", const QString& description = "")
|
||||
= 0;
|
||||
virtual const QString& lastError() const = 0;
|
||||
virtual ScriptValueType moveQObjectToScript(QObject* object, const QString objectName) = 0;
|
||||
virtual ~IScriptEngineManager(){}
|
||||
|
||||
virtual ~IScriptEngineManager() { }
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRSCRIPTENGINEMANAGERINTF_H
|
||||
|
Reference in New Issue
Block a user