mirror of
https://github.com/fralx/LimeReport.git
synced 2025-11-25 08:28:06 +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:
@@ -29,20 +29,19 @@
|
||||
****************************************************************************/
|
||||
#ifndef LRTEXTITEM_H
|
||||
#define LRTEXTITEM_H
|
||||
#include "lritemdesignintf.h"
|
||||
#include "lrpageinitintf.h"
|
||||
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QtGui>
|
||||
#include <QLabel>
|
||||
#include <QTextDocument>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "lritemdesignintf.h"
|
||||
#include "lritemdesignintf.h"
|
||||
#include "lrpageinitintf.h"
|
||||
#include <QtGui>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class Tag;
|
||||
class TextItem : public ContentItemDesignIntf, IPageInit {
|
||||
class TextItem: public ContentItemDesignIntf, IPageInit {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString content READ content WRITE setContent)
|
||||
Q_PROPERTY(int margin READ marginSize WRITE setMarginSize)
|
||||
@@ -66,19 +65,35 @@ class TextItem : public ContentItemDesignIntf, IPageInit {
|
||||
Q_PROPERTY(QString format READ format WRITE setFormat)
|
||||
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
|
||||
Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
|
||||
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
||||
Q_PROPERTY(
|
||||
BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
||||
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
|
||||
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
|
||||
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE
|
||||
setTextLayoutDirection)
|
||||
Q_PROPERTY(bool fillInSecondPass READ fillInSecondPass WRITE setFillInSecondPass)
|
||||
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
|
||||
Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns)
|
||||
Q_PROPERTY(bool hideIfEmpty READ hideIfEmpty WRITE setHideIfEmpty)
|
||||
Q_PROPERTY(int fontLetterSpacing READ fontLetterSpacing WRITE setFontLetterSpacing)
|
||||
public:
|
||||
|
||||
enum AutoWidth{NoneAutoWidth, MaxWordLength, MaxStringLength};
|
||||
enum AngleType{Angle0, Angle90, Angle180, Angle270, Angle45, Angle315};
|
||||
enum ValueType{Default, DateTime, Double};
|
||||
enum AutoWidth {
|
||||
NoneAutoWidth,
|
||||
MaxWordLength,
|
||||
MaxStringLength
|
||||
};
|
||||
enum AngleType {
|
||||
Angle0,
|
||||
Angle90,
|
||||
Angle180,
|
||||
Angle270,
|
||||
Angle45,
|
||||
Angle315
|
||||
};
|
||||
enum ValueType {
|
||||
Default,
|
||||
DateTime,
|
||||
Double
|
||||
};
|
||||
#if QT_VERSION >= 0x050500
|
||||
Q_ENUM(AutoWidth)
|
||||
Q_ENUM(AngleType)
|
||||
@@ -90,7 +105,7 @@ public:
|
||||
#endif
|
||||
|
||||
void Init();
|
||||
TextItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
TextItem(QObject* owner = 0, QGraphicsItem* parent = 0);
|
||||
~TextItem();
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
|
||||
@@ -98,29 +113,29 @@ public:
|
||||
void setContent(const QString& value);
|
||||
|
||||
void setAlignment(Qt::Alignment value);
|
||||
Qt::Alignment alignment(){return m_alignment;}
|
||||
Qt::Alignment alignment() { return m_alignment; }
|
||||
|
||||
void geometryChangedEvent(QRectF, QRectF);
|
||||
bool isNeedUpdateSize(RenderPass) const;
|
||||
void updateItemSize(DataSourceManager *dataManager, RenderPass pass, int maxHeight);
|
||||
void expandContent(DataSourceManager *dataManager, RenderPass pass);
|
||||
void updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight);
|
||||
void expandContent(DataSourceManager* dataManager, RenderPass pass);
|
||||
|
||||
void setAutoHeight(bool value);
|
||||
bool autoHeight() const {return m_autoHeight;}
|
||||
bool autoHeight() const { return m_autoHeight; }
|
||||
|
||||
void setAutoWidth(AutoWidth value);
|
||||
AutoWidth autoWidth() const {return m_autoWidth;}
|
||||
AutoWidth autoWidth() const { return m_autoWidth; }
|
||||
|
||||
void setAdaptFontToSize(bool value);
|
||||
bool adaptFontToSize() const {return m_adaptFontToSize;}
|
||||
bool adaptFontToSize() const { return m_adaptFontToSize; }
|
||||
|
||||
bool canBeSplitted(int height) const;
|
||||
bool isSplittable() const { return true;}
|
||||
bool isEmpty() const{return m_strText.trimmed().isEmpty();}
|
||||
BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent);
|
||||
BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent);
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
|
||||
bool isSplittable() const { return true; }
|
||||
bool isEmpty() const { return m_strText.trimmed().isEmpty(); }
|
||||
BaseDesignIntf* cloneUpperPart(int height, QObject* owner, QGraphicsItem* parent);
|
||||
BaseDesignIntf* cloneBottomPart(int height, QObject* owner, QGraphicsItem* parent);
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
|
||||
BaseDesignIntf* cloneEmpty(int height, QObject* owner, QGraphicsItem* parent);
|
||||
void objectLoadFinished();
|
||||
|
||||
void setTextItemFont(QFont value);
|
||||
@@ -131,9 +146,9 @@ public:
|
||||
void setFontColorProperty(QColor value);
|
||||
AngleType angle() const;
|
||||
void setAngle(const AngleType& value);
|
||||
int foregroundOpacity(){return m_foregroundOpacity;}
|
||||
int foregroundOpacity() { return m_foregroundOpacity; }
|
||||
void setForegroundOpacity(int value);
|
||||
bool underlines(){return m_underlines;}
|
||||
bool underlines() { return m_underlines; }
|
||||
void setUnderlines(bool value);
|
||||
|
||||
bool trimValue() const;
|
||||
@@ -152,18 +167,18 @@ public:
|
||||
void setAllowHTMLInFields(bool allowHTMLInFields);
|
||||
|
||||
QString format() const;
|
||||
void setFormat(const QString &format);
|
||||
void setFormat(const QString& format);
|
||||
|
||||
ValueType valueType() const;
|
||||
void setValueType(const ValueType valueType);
|
||||
|
||||
QSizeF textSize(){ return m_textSize;}
|
||||
QSizeF textSize() { return m_textSize; }
|
||||
QString followTo() const;
|
||||
void setFollowTo(const QString &followTo);
|
||||
void setFollowTo(const QString& followTo);
|
||||
void setFollower(TextItem* follower);
|
||||
void clearFollower();
|
||||
bool hasFollower() const;
|
||||
TextItem* follower() const { return m_follower;}
|
||||
TextItem* follower() const { return m_follower; }
|
||||
bool initFollower(QString follower);
|
||||
|
||||
// IPageInit interface
|
||||
@@ -172,12 +187,12 @@ public:
|
||||
typedef QSharedPointer<QTextDocument> TextPtr;
|
||||
|
||||
qreal textIndent() const;
|
||||
void setTextIndent(const qreal &textIndent);
|
||||
void setTextIndent(const qreal& textIndent);
|
||||
Qt::LayoutDirection textLayoutDirection() const;
|
||||
void setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection);
|
||||
void setTextLayoutDirection(const Qt::LayoutDirection& textLayoutDirection);
|
||||
|
||||
void setWatermark(bool watermark);
|
||||
|
||||
|
||||
bool isReplaceCarriageReturns() const;
|
||||
void setReplaceCarriageReturns(bool isReplaceCarriageReturns);
|
||||
|
||||
@@ -194,24 +209,26 @@ protected:
|
||||
QString replaceReturns(QString text) const;
|
||||
QString getTextPart(int height, int skipHeight);
|
||||
void restoreLinksEvent();
|
||||
void preparePopUpMenu(QMenu &menu);
|
||||
void processPopUpAction(QAction *action);
|
||||
void preparePopUpMenu(QMenu& menu);
|
||||
void processPopUpAction(QAction* action);
|
||||
|
||||
private:
|
||||
void initTextSizes() const;
|
||||
void setTextFont(TextPtr text, const QFont &value) const;
|
||||
void setTextFont(TextPtr text, const QFont& value) const;
|
||||
void adaptFontSize(TextPtr text) const;
|
||||
QString formatDateTime(const QDateTime &value);
|
||||
QString formatDateTime(const QDateTime& value);
|
||||
QString formatNumber(const double value);
|
||||
QString formatFieldValue();
|
||||
QString extractText(QTextBlock& curBlock, int height);
|
||||
TextPtr textDocument() const;
|
||||
|
||||
private:
|
||||
QString m_strText;
|
||||
Qt::Alignment m_alignment;
|
||||
bool m_autoHeight;
|
||||
AutoWidth m_autoWidth;
|
||||
QSizeF mutable m_textSize;
|
||||
qreal mutable m_firstLineSize;
|
||||
qreal mutable m_firstLineSize;
|
||||
AngleType m_angle;
|
||||
int m_foregroundOpacity;
|
||||
bool m_underlines;
|
||||
@@ -225,7 +242,7 @@ private:
|
||||
|
||||
QString m_format;
|
||||
ValueType m_valueType;
|
||||
QString m_followTo;
|
||||
QString m_followTo;
|
||||
TextItem* m_follower;
|
||||
qreal m_textIndent;
|
||||
Qt::LayoutDirection m_textLayoutDirection;
|
||||
@@ -233,5 +250,5 @@ private:
|
||||
int m_fontLetterSpacing;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRTEXTITEM_H
|
||||
|
||||
Reference in New Issue
Block a user