Commit bdc3ec09 authored by Thomas Zander's avatar Thomas Zander

Create a PaintContext for the KoTextDocumentLayout which holds the viewConverter.

svn path=/trunk/koffice/; revision=689412
parent 8f557148
......@@ -51,7 +51,7 @@ public:
bool nextParag() { return false; }
bool previousParag() { return false; }
double documentOffsetInShape() { return 0; }
void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &, const KoViewConverter*) {}
void draw(QPainter *, const KoTextDocumentLayout::PaintContext &) {}
KoStyleManager *styleManager() const { return m_styleManager; }
void setStyleManager(KoStyleManager *sm) { m_styleManager = sm; }
bool setFollowupShape(KoShape *) { return false; }
......@@ -157,12 +157,14 @@ QSizeF KoTextDocumentLayout::documentSize() const {
return QSizeF(10, 10);
}
void KoTextDocumentLayout::draw(QPainter *painter, const PaintContext &context) {
m_state->draw(painter, context, 0);
void KoTextDocumentLayout::draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context) {
PaintContext pc;
pc.textContext = context;
m_state->draw(painter, pc);
}
void KoTextDocumentLayout::draw ( QPainter * painter, const PaintContext & context, const KoViewConverter *converter ) {
m_state->draw(painter, context, converter);
void KoTextDocumentLayout::draw ( QPainter * painter, const KoTextDocumentLayout::PaintContext & context) {
m_state->draw(painter, context);
}
QRectF KoTextDocumentLayout::frameBoundingRect(QTextFrame *frame) const {
......
......@@ -42,6 +42,13 @@ class KOTEXT_EXPORT KoTextDocumentLayout : public QAbstractTextDocumentLayout {
Q_OBJECT
public:
class LayoutState;
struct PaintContext {
PaintContext() : viewConverter(0) { }
QAbstractTextDocumentLayout::PaintContext textContext;
const KoViewConverter *viewConverter;
};
/// constructor
explicit KoTextDocumentLayout(QTextDocument *document, KoTextDocumentLayout::LayoutState *layout = 0);
virtual ~KoTextDocumentLayout();
......@@ -74,9 +81,9 @@ public:
*/
virtual QSizeF documentSize () const;
/// Draws the layout on the given painter with the given context.
virtual void draw ( QPainter * painter, const PaintContext & context );
virtual void draw ( QPainter * painter, const QAbstractTextDocumentLayout::PaintContext & context );
/// Draws the layout on the given painter with the given context, and pass the zoom.
void draw ( QPainter * painter, const PaintContext & context, const KoViewConverter *converter );
void draw ( QPainter * painter, const KoTextDocumentLayout::PaintContext & context);
/// Returns the bounding rectacle of frame. Returns the bounding rectangle of frame.
virtual QRectF frameBoundingRect ( QTextFrame * frame ) const;
/**
......@@ -144,7 +151,7 @@ public:
/// Return the y position of the offset for the current shape (See KoTextShapeData::documentOffset() )
virtual double documentOffsetInShape() = 0;
/// paint the document
virtual void draw(QPainter *painter, const PaintContext & context, const KoViewConverter *converter ) = 0;
virtual void draw(QPainter *painter, const KoTextDocumentLayout::PaintContext & context) = 0;
/**
* After all shapes have been used and there is still text left, use the param shape to continue
* layout.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment