lib
KoTextDocument Class Reference
List of all members.Detailed Description
Definition at line 45 of file KoTextDocument.h.
Public Types | |
enum | SelectionId { Standard = 0, InputMethodPreedit = 1, HighlightSelection = 2, Temp = 32000 } |
enum | DrawingFlags { DrawMisspelledLine = 1, DrawFormattingChars = 2, DrawSelections = 4, DontDrawNoteVariable = 8, TransparentBackground = 16 } |
Signals | |
void | paragraphDeleted (KoTextParag *parag) |
void | newCommand (KCommand *cmd) |
void | repaintChanged () |
Public Member Functions | |
virtual | ~KoTextDocument () |
void | setText (const QString &text, const QString &context) |
int | x () const |
int | y () const |
int | width () const |
int | height () const |
void | setWidth (int w) |
void | setY (int y) |
int | leftMargin () const |
void | setLeftMargin (int lm) |
int | rightMargin () const |
void | setRightMargin (int rm) |
KoTextParag * | firstParag () const |
KoTextParag * | lastParag () const |
void | setFirstParag (KoTextParag *p) |
void | setLastParag (KoTextParag *p) |
void | invalidate () |
void | setFormatter (KoTextFormatterBase *f) |
KoTextFormatterBase * | formatter () const |
QColor | selectionColor (int id) const |
bool | invertSelectionText (int id) const |
void | setSelectionColor (int id, const QColor &c) |
void | setInvertSelectionText (int id, bool b) |
bool | hasSelection (int id, bool visible=false) const |
bool | isSelectionSwapped (int id) |
void | setSelectionStart (int id, KoTextCursor *cursor) |
bool | setSelectionEnd (int id, KoTextCursor *cursor) |
void | selectAll (int id) |
bool | removeSelection (int id) |
void | selectionStart (int id, int ¶gId, int &index) |
KoTextCursor | selectionStartCursor (int id) |
KoTextCursor | selectionEndCursor (int id) |
void | selectionEnd (int id, int ¶gId, int &index) |
void | setFormat (int id, const KoTextFormat *f, int flags) |
KoTextParag * | selectionStart (int id) |
KoTextParag * | selectionEnd (int id) |
int | numSelections () const |
void | addSelection (int id) |
QString | selectedText (int id, bool withCustom=TRUE) const |
void | removeSelectedText (int id, KoTextCursor *cursor) |
KoTextParag * | paragAt (int i) const |
void | addCommand (KoTextDocCommand *cmd) |
KoTextCursor * | undo (KoTextCursor *c=0) |
KoTextCursor * | redo (KoTextCursor *c=0) |
KoTextDocCommandHistory * | commands () const |
KoTextFormatCollection * | formatCollection () const |
bool | find (const QString &expr, bool cs, bool wo, bool forward, int *parag, int *index, KoTextCursor *cursor) |
bool | inSelection (int selId, const QPoint &pos) const |
void | setUnderlineLinks (bool b) |
bool | underlineLinks () const |
void | setPaper (QBrush *brush) |
QBrush * | paper () const |
void | registerCustomItem (KoTextCustomItem *i, KoTextParag *p) |
void | unregisterCustomItem (KoTextCustomItem *i, KoTextParag *p) |
const QPtrList< KoTextCustomItem > & | allCustomItems () const |
void | setFlow (KoTextFlow *f) |
void | takeFlow () |
KoTextFlow * | flow () const |
bool | isPageBreakEnabled () const |
void | setPageBreakEnabled (bool b) |
void | setWithoutDoubleBuffer (bool b) |
bool | isWithoutDoubleBuffer () const |
void | setUseFormatCollection (bool b) |
bool | useFormatCollection () const |
void | setPlainText (const QString &text) |
QString | plainText () const |
int | alignment () const |
void | setAlignment (int a) |
int * | tabArray () const |
int | tabStopWidth () const |
void | setTabArray (int *a) |
void | setTabStops (int tw) |
void | setUndoDepth (int d) |
int | undoDepth () const |
int | length () const |
void | clear (bool createEmptyParag=FALSE) |
KoTextParag * | loadList (const QDomElement &list, KoOasisContext &context, KoTextParag *lastParagraph, KoStyleCollection *styleColl, KoTextParag *nextParagraph) |
KoTextParag * | loadOasisText (const QDomElement &bodyElem, KoOasisContext &context, KoTextParag *lastParagraph, KoStyleCollection *styleColl, KoTextParag *nextParagraph) |
QString | copySelection (KoXmlWriter &writer, KoSavingContext &context, int selectionId) |
void | saveOasisContent (KoXmlWriter &writer, KoSavingContext &context) const |
virtual KoTextParag * | createParag (KoTextDocument *d, KoTextParag *pr=0, KoTextParag *nx=0, bool updateIds=TRUE) |
int | addMargins () const |
void | informParagraphDeleted (KoTextParag *parag) |
KoTextDocument (KoTextZoomHandler *zoomHandler, KoTextFormatCollection *fc, KoTextFormatter *formatter=0L, bool createInitialParag=true) | |
KoTextZoomHandler * | formattingZoomHandler () const |
KoTextZoomHandler * | paintingZoomHandler () const |
bool | visitSelection (int selectionId, KoParagVisitor *visitor, bool forward=true) |
bool | visitDocument (KoParagVisitor *visitor, bool forward=true) |
bool | visitFromTo (KoTextParag *firstParag, int firstIndex, KoTextParag *lastParag, int lastIndex, KoParagVisitor *visitor, bool forw=true) |
bool | isDestroying () const |
KoTextParag * | drawWYSIWYG (QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, KoTextZoomHandler *zoomHandler, bool onlyChanged=FALSE, bool drawCursor=FALSE, KoTextCursor *cursor=0, bool resetChanged=TRUE, uint drawingFlags=KoTextDocument::DrawSelections) |
void | drawParagWYSIWYG (QPainter *p, KoTextParag *parag, int cx, int cy, int cw, int ch, QPixmap *&doubleBuffer, const QColorGroup &cg, KoTextZoomHandler *zoomHandler, bool drawCursor, KoTextCursor *cursor, bool resetChanged=TRUE, uint drawingFlags=KoTextDocument::DrawSelections) |
bool | drawFormattingChars () const |
bool | drawingMissingSpellLine () const |
bool | dontDrawingNoteVariable () const |
virtual KoTextDocCommand * | deleteTextCommand (KoTextDocument *textdoc, int id, int index, const QMemArray< KoTextStringChar > &str, const CustomItemsMap &customItemsMap, const QValueList< KoParagLayout > &oldParagLayouts) |
void | emitNewCommand (KCommand *cmd) |
void | emitRepaintChanged () |
Protected Member Functions | |
void | drawWithoutDoubleBuffer (QPainter *p, const QRect &rect, const QColorGroup &cg, KoTextZoomHandler *zoomHandler, const QBrush *paper=0) |
virtual bool | loadOasisBodyTag (const QDomElement &, KoOasisContext &, KoTextParag *&, KoStyleCollection *, KoTextParag *) |
virtual bool | loadSpanTag (const QDomElement &, KoOasisContext &, KoTextParag *, uint, QString &, KoTextCustomItem *&) |
Friends | |
class | KoTextCursor |
class | KoTextParag |
Member Enumeration Documentation
Constructor & Destructor Documentation
KoTextDocument::KoTextDocument | ( | KoTextZoomHandler * | zoomHandler, | |
KoTextFormatCollection * | fc, | |||
KoTextFormatter * | formatter = 0L , |
|||
bool | createInitialParag = true | |||
) |
Construct a text document, i.e.
a set of paragraphs
- Parameters:
-
zoomHandler The KoTextZoomHandler instance, to handle the zooming, as the name says :) We need one here because KoTextFormatter needs one for formatting, currently. fc a format collection for this document. Ownership is transferred to the document. ### formatter a text formatter for this document. If 0L, a KoTextFormatter is created. If not, ownership of the given one is transferred to the document. createInitialParag if true, an initial KoTextParag is created. Set to false if you reimplement createParag, since the constructor can't call the reimplementation. In that case, make sure to call clear(true) in your constructor; QRT doesn't support documents without paragraphs.
Definition at line 42 of file KoTextDocument.cpp.
Member Function Documentation
void KoTextDocument::paragraphDeleted | ( | KoTextParag * | parag | ) | [signal] |
Emitted when a paragraph is deleted (kotext addition).
KoTextZoomHandler* KoTextDocument::formattingZoomHandler | ( | ) | const [inline] |
Return the zoom handler associated with this document, used when formatting.
Don't use for any other purpose, it might disappear.
Definition at line 253 of file KoTextDocument.h.
KoTextZoomHandler* KoTextDocument::paintingZoomHandler | ( | ) | const [inline] |
Return the zoom handler currently used for drawing.
(This means, at a particular zoom level). Don't call this in a method that isn't called by drawWYSIWYG, it will be 0L ! (a different one than zoomHandler(), in case it disappears one day, to have different zoom levels in different views)
Definition at line 262 of file KoTextDocument.h.
bool KoTextDocument::visitSelection | ( | int | selectionId, | |
KoParagVisitor * | visitor, | |||
bool | forward = true | |||
) |
Visit all the parts of a selection.
Returns true, unless canceled. See KoParagVisitor.
Definition at line 981 of file KoTextDocument.cpp.
bool KoTextDocument::visitDocument | ( | KoParagVisitor * | visitor, | |
bool | forward = true | |||
) |
Visit all paragraphs of the document.
Returns true, unless canceled. See KoParagVisitor.
Definition at line 1018 of file KoTextDocument.cpp.
bool KoTextDocument::visitFromTo | ( | KoTextParag * | firstParag, | |
int | firstIndex, | |||
KoTextParag * | lastParag, | |||
int | lastIndex, | |||
KoParagVisitor * | visitor, | |||
bool | forw = true | |||
) |
Visit the document between those two point.
Returns true, unless canceled. See KoParagVisitor.
Definition at line 1023 of file KoTextDocument.cpp.
bool KoTextDocument::isDestroying | ( | ) | const [inline] |
Used by ~KoTextParag to know if it should die quickly.
Definition at line 280 of file KoTextDocument.h.
KoTextParag * KoTextDocument::drawWYSIWYG | ( | QPainter * | p, | |
int | cx, | |||
int | cy, | |||
int | cw, | |||
int | ch, | |||
const QColorGroup & | cg, | |||
KoTextZoomHandler * | zoomHandler, | |||
bool | onlyChanged = FALSE , |
|||
bool | drawCursor = FALSE , |
|||
KoTextCursor * | cursor = 0 , |
|||
bool | resetChanged = TRUE , |
|||
uint | drawingFlags = KoTextDocument::DrawSelections | |||
) |
The main drawing method.
Equivalent to KoTextDocument::draw, but reimplemented for wysiwyg
Definition at line 1067 of file KoTextDocument.cpp.
void KoTextDocument::drawParagWYSIWYG | ( | QPainter * | p, | |
KoTextParag * | parag, | |||
int | cx, | |||
int | cy, | |||
int | cw, | |||
int | ch, | |||
QPixmap *& | doubleBuffer, | |||
const QColorGroup & | cg, | |||
KoTextZoomHandler * | zoomHandler, | |||
bool | drawCursor, | |||
KoTextCursor * | cursor, | |||
bool | resetChanged = TRUE , |
|||
uint | drawingFlags = KoTextDocument::DrawSelections | |||
) |
Draw a single paragraph (used by drawWYSIWYG and by KWTextFrameSet::drawCursor).
Equivalent to KoTextDocument::draw, but modified for wysiwyg
Definition at line 1252 of file KoTextDocument.cpp.
bool KoTextDocument::drawFormattingChars | ( | ) | const [inline] |
Set by drawParagWYSIWYG, used by KoTextParag::drawParagString.
Definition at line 309 of file KoTextDocument.h.
bool KoTextDocument::drawingMissingSpellLine | ( | ) | const [inline] |
Set by drawParagWYSIWYG, used by KoTextParag::drawParagStringInternal.
Definition at line 311 of file KoTextDocument.h.
bool KoTextDocument::dontDrawingNoteVariable | ( | ) | const [inline] |
Set by drawParagWYSIWYG, used by KoTextParag::drawParagStringInternal.
Definition at line 314 of file KoTextDocument.h.
void KoTextDocument::newCommand | ( | KCommand * | cmd | ) | [signal] |
Emitted when a new command has been created and should be added to the main list of commands (usually in the KoDocument).
KoTextObject connects (and forwards) that one.
void KoTextDocument::repaintChanged | ( | ) | [signal] |
Tell the world that we'd like some repainting to happen.
KoTextObject connects (and forwards) that one.
virtual bool KoTextDocument::loadOasisBodyTag | ( | const QDomElement & | , | |
KoOasisContext & | , | |||
KoTextParag *& | , | |||
KoStyleCollection * | , | |||
KoTextParag * | ||||
) | [inline, protected, virtual] |
Called by loadOasisText.
This allows to extend the loading mechanism for special tags no handled by kotext (images, textboxes, tables, etc.)
- Returns:
- true if
tag
was handled.
Definition at line 346 of file KoTextDocument.h.
virtual bool KoTextDocument::loadSpanTag | ( | const QDomElement & | , | |
KoOasisContext & | , | |||
KoTextParag * | , | |||
uint | , | |||
QString & | , | |||
KoTextCustomItem *& | ||||
) | [inline, protected, virtual] |
Called by KoTextParag::loadOasisSpan.
This allows to extend the loading mechanism for special tags no handled by kotext (bookmarks, image, textbox, link, footnotes etc.) This method is here instead of in KoTextParag because it's easier to derive from KoTextDocument.
- Returns:
- true (and optionally
textData
andcustomItem
) iftag
was handled.
Definition at line 359 of file KoTextDocument.h.
The documentation for this class was generated from the following files: