Commit c78c4529 authored by Thomas Zander's avatar Thomas Zander

API docs

svn path=/trunk/koffice/; revision=689423
parent bdc3ec09
......@@ -23,15 +23,6 @@
#include <QFontMetricsF>
#include <QTextOption>
// store notes in text using this class
// make Layout detect these and then make a TextShape hold an additional QTextDocument
// for footnotes. Footnotes are then added to the shape and thus layouted.
// the TextShape has to paint the footnote-document.
// Got to think if its most useful to have the footnote document have an offset in where
// the text is positioned, or that we need an 'offset-from-top' double in the shape.
class KoInlineNote::Private {
Private(KoInlineNote::Type t) : autoNumbering(false), type(t) {}
......@@ -22,33 +22,63 @@
#include "KoInlineObject.h"
#include "kotext_export.h"
/** foot or end note */
* This object is an inline object, which means it is anchored in the text-flow and it can hold note info.
* Typical notes that use this are Footnotes and Endnotes.
class KOTEXT_EXPORT KoInlineNote : public KoInlineObject {
/// The type of note specifies how the application will use the text from the note.
enum Type {
// Comment?
Footnote, ///< Notes of this type will have their text placed at the bottom of a shape.
Endnote ///< Notes of this type are used as endnotes in appliations that support that.
// Comment-note?
* Construct a new note to be inserted in the text using KoTextSelectionHandler::insertInlineObject() for example.
* @param type the type of note, which specifies how the application will use the text from the new note.
KoInlineNote(Type type);
// destructor
virtual ~KoInlineNote();
* Set the text that backs this note.
* @param text the new text
void setText(const QString &text);
* Set the label that is shown at the spot this inline note is inserted.
* @param text the new label
void setLabel(const QString &text);
/// return the current text
QString text() const;
/// return the current label
QString label() const;
* @return whether the label should be automatically recreated or if the label is static.
bool autoNumbering() const;
* Set whether the label should be automatically recreated.
* @param on if true then changes in footnote-ordering will recalcualte the label.
void setAutoNumbering(bool on);
/// return the type of note.
Type type() const;
/// reimplemented
virtual void updatePosition(const QTextDocument *document, QTextInlineObject object,
int posInDocument, const QTextCharFormat &format);
/// reimplemented
virtual void resize(const QTextDocument *document, QTextInlineObject object,
int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
/// reimplemented
virtual void paint (QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextCharFormat &format);
......@@ -43,9 +43,12 @@ class KOTEXT_EXPORT KoTextDocumentLayout : public QAbstractTextDocumentLayout {
class LayoutState;
/// This struct is a helper for painting of kotext texts.
struct PaintContext {
PaintContext() : viewConverter(0) { }
/// the QText context
QAbstractTextDocumentLayout::PaintContext textContext;
/// A view converter, when set, is used to find out when the zoom is so low that painting of text is unneeded
const KoViewConverter *viewConverter;
......@@ -150,7 +153,12 @@ public:
virtual bool previousParag() = 0;
/// Return the y position of the offset for the current shape (See KoTextShapeData::documentOffset() )
virtual double documentOffsetInShape() = 0;
/// paint the document
* Paint the document.
* Paint the whole document, at least within the cliprect as set on the painter.
* @param painter the painter to draw to.
* @param context a set of variables able to alter the way things are painted.
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
......@@ -193,7 +201,7 @@ public:
static void updateTabsForLine(const QTextBlock &block, int lineNumber);
public slots:
/// make sure we start a layout run
/// make sure we start a layout run (returns immediately)
void scheduleLayout();
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