| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #ifndef VTEXTDOCUMENTLAYOUTDATA_H
- #define VTEXTDOCUMENTLAYOUTDATA_H
- // Denote the start and end position of a marker line.
- struct Marker
- {
- QPointF m_start;
- QPointF m_end;
- };
- struct ImagePaintInfo
- {
- // The rect to draw the image.
- QRectF m_rect;
- // Name of the image.
- QString m_name;
- // Forced background.
- QColor m_background;
- bool isValid() const
- {
- return !m_name.isEmpty();
- }
- bool hasForcedBackground() const
- {
- return m_background.isValid();
- }
- };
- struct BlockLayoutInfo
- {
- BlockLayoutInfo()
- : m_offset(-1)
- {
- }
- void reset()
- {
- m_offset = -1;
- m_rect = QRectF();
- m_markers.clear();
- m_images.clear();
- }
- bool isNull() const
- {
- return m_rect.isNull();
- }
- bool hasOffset() const
- {
- return m_offset > -1 && !m_rect.isNull();
- }
- qreal top() const
- {
- Q_ASSERT(hasOffset());
- return m_offset;
- }
- qreal bottom() const
- {
- Q_ASSERT(hasOffset());
- return m_offset + m_rect.height();
- }
- // Y offset of this block.
- // -1 for invalid.
- qreal m_offset;
- // The bounding rect of this block, including the margins.
- // Null for invalid.
- QRectF m_rect;
- // Markers to draw for this block.
- // Y is the offset within this block.
- QVector<Marker> m_markers;
- // Images to draw for this block.
- // Y is the offset within this block.
- QVector<ImagePaintInfo> m_images;
- };
- #endif // VTEXTDOCUMENTLAYOUTDATA_H
|