lib
KoTextObject Class Reference
#include <KoTextObject.h>
Inheritance diagram for KoTextObject:

Detailed Description
The KoTextObject is the high-level object that contains a KoTextDocument (the list of paragraphs), and takes care of the operations on it (particularly the undo/redo commands).Editing the text isn't done by KoTextObject but by KoTextView (document/view design).
Definition at line 181 of file KoTextObject.h.
Public Types | |
enum | InsertFlag { DefaultInsertFlags = 0, CheckNewLine = 1, OverwriteMode = 2, DoNotRemoveSelected = 4, DoNotRepaint = 8 } |
enum | KeyboardAction { ActionBackspace, ActionDelete, ActionReturn, ActionKill } |
enum | ParagModifyType { AddChar = 0, RemoveChar = 1, ChangeFormat = 2 } |
Public Slots | |
bool | formatMore (int count=10, bool emitAfterFormatting=true) |
void | emitRepaintChanged () |
Signals | |
void | availableHeightNeeded () |
void | afterFormatting (int bottom, KoTextParag *m_lastFormatted, bool *abort) |
void | chapterParagraphFormatted (KoTextParag *parag) |
void | formattingFirstParag () |
void | newCommand (KCommand *cmd) |
void | repaintChanged (KoTextObject *) |
void | hideCursor () |
void | showCursor () |
void | setCursor (KoTextCursor *cursor) |
void | updateUI (bool updateFormat, bool force=false) |
void | showCurrentFormat () |
void | ensureCursorVisible () |
void | selectionChanged (bool hasSelection) |
void | showFormatObject (const KoTextFormat &) |
void | paragraphCreated (KoTextParag *parag) |
void | paragraphModified (KoTextParag *parag, int, int pos, int length) |
void | paragraphDeleted (KoTextParag *parag) |
Public Member Functions | |
KoTextObject (KoTextZoomHandler *zh, const QFont &defaultFont, const QString &defaultLanguage, bool defaultHyphenation, KoParagStyle *defaultStyle, int tabStopWidth=-1, QObject *parent=0, const char *name=0) | |
KoTextObject (KoTextDocument *textdoc, KoParagStyle *defaultStyle, QObject *parent=0, const char *name=0) | |
virtual | ~KoTextObject () |
void | setNeedSpellCheck (bool b) |
bool | needSpellCheck () const |
void | setProtectContent (bool b) |
bool | protectContent () const |
KoTextDocument * | textDocument () const |
void | setAvailableHeight (int avail) |
int | availableHeight () const |
void | undo () |
void | redo () |
void | clearUndoRedoInfo () |
bool | hasSelection () const |
QString | selectedText (KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) const |
bool | selectionHasCustomItems (KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) const |
void | insert (KoTextCursor *cursor, KoTextFormat *currentFormat, const QString &text, const QString &commandName, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard, int insertFlags=DefaultInsertFlags, CustomItemsMap customItemsMap=CustomItemsMap()) |
void | removeSelectedText (KoTextCursor *cursor, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard, const QString &cmdName=QString::null, bool createUndoRedo=true) |
KCommand * | replaceSelectionCommand (KoTextCursor *cursor, const QString &replacement, const QString &cmdName, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard, int insertFlags=DefaultInsertFlags, CustomItemsMap customItemsMap=CustomItemsMap()) |
KCommand * | removeSelectedTextCommand (KoTextCursor *cursor, KoTextDocument::SelectionId selectionId, bool repaint=true) |
KCommand * | insertParagraphCommand (KoTextCursor *cursor) |
void | pasteText (KoTextCursor *cursor, const QString &text, KoTextFormat *currentFormat, bool removeSelected) |
void | selectAll (bool select) |
void | highlightPortion (KoTextParag *parag, int index, int length, bool repaint) |
void | removeHighlight (bool repaint) |
KCommand * | setFormatCommand (const KoTextFormat *format, int flags, bool zoomFont=false) |
KCommand * | setFormatCommand (KoTextCursor *cursor, KoTextFormat **currentFormat, const KoTextFormat *format, int flags, bool zoomFont=false, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
void | doKeyboardAction (KoTextCursor *cursor, KoTextFormat *¤tFormat, KeyboardAction action) |
KCommand * | setCounterCommand (KoTextCursor *cursor, const KoParagCounter &counter, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setAlignCommand (KoTextCursor *cursor, int align, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setLineSpacingCommand (KoTextCursor *cursor, double spacing, KoParagLayout::SpacingType _type, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setBordersCommand (KoTextCursor *cursor, const KoBorder &leftBorder, const KoBorder &rightBorder, const KoBorder &topBorder, const KoBorder &bottomBorder, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setJoinBordersCommand (KoTextCursor *cursor, bool join, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setMarginCommand (KoTextCursor *cursor, QStyleSheetItem::Margin m, double margin, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setTabListCommand (KoTextCursor *cursor, const KoTabulatorList &tabList, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setBackgroundColorCommand (KoTextCursor *cursor, const QColor &color, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
KCommand * | setParagDirectionCommand (KoTextCursor *cursor, QChar::Direction d, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
void | applyStyle (KoTextCursor *cursor, const KoParagStyle *style, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard, int paragLayoutFlags=KoParagLayout::All, int formatFlags=KoTextFormat::Format, bool createUndoRedo=true, bool interactive=true) |
KCommand * | applyStyleCommand (KoTextCursor *cursor, const KoParagStyle *style, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard, int paragLayoutFlags=KoParagLayout::All, int formatFlags=KoTextFormat::Format, bool createUndoRedo=true, bool interactive=true) |
void | applyStyleChange (KoStyleChangeDefMap changed) |
void | setFormat (KoTextCursor *cursor, KoTextFormat **currentFormat, KoTextFormat *format, int flags, bool zoomFont=false) |
virtual KoTextFormat * | currentFormat () const |
virtual const KoParagLayout * | currentParagLayoutFormat () const |
virtual bool | rtl () const |
virtual KCommand * | setParagLayoutFormatCommand (KoParagLayout *newLayout, int flags, int marginIndex=-1) |
KCommand * | setParagLayoutCommand (KoTextCursor *cursor, const KoParagLayout ¶gLayout, KoTextDocument::SelectionId selectionId, int paragLayoutFlags, int marginIndex, bool createUndoRedo) |
virtual void | setFormat (KoTextFormat *newFormat, int flags, bool zoomFont=false) |
int | docFontSize (KoTextFormat *format) const |
int | zoomedFontSize (int docFontSize) const |
void | setViewArea (QWidget *w, int maxY) |
void | ensureFormatted (KoTextParag *parag, bool emitAfterFormatting=true) |
void | setLastFormattedParag (KoTextParag *parag) |
void | emitHideCursor () |
void | emitShowCursor () |
void | emitEnsureCursorVisible () |
void | emitUpdateUI (bool updateFormat, bool force=false) |
void | typingStarted () |
void | typingDone () |
void | abortFormatting () |
void | selectionChangedNotify (bool enableActions=true) |
void | emitNewCommand (KCommand *cmd) |
virtual KCommand * | setChangeCaseOfTextCommand (KoChangeCaseDia::TypeOfCase _type) |
KCommand * | changeCaseOfText (KoTextCursor *cursor, KoChangeCaseDia::TypeOfCase _type) |
QString | textChangedCase (const QString &_text, KoChangeCaseDia::TypeOfCase _type) |
KCommand * | changeCaseOfTextParag (int cursorPosStart, int cursorPosEnd, KoChangeCaseDia::TypeOfCase _type, KoTextCursor *cursor, KoTextParag *parag) |
void | loadOasisContent (const QDomElement &bodyElem, KoOasisContext &context, KoStyleCollection *styleColl) |
void | saveOasisContent (KoXmlWriter &writer, KoSavingContext &context) const |
KoTextCursor | pasteOasisText (const QDomElement &bodyElem, KoOasisContext &context, KoTextCursor &cursor, KoStyleCollection *styleColl) |
void | printRTDebug (int) |
bool | statistics (QProgressDialog *progress, ulong &charsWithSpace, ulong &charsWithoutSpace, ulong &words, ulong &sentences, ulong &syllables, ulong &lines, bool selected) |
int | numberOfparagraphLineSelected (KoTextParag *parag) |
KoVariable * | variableAtPoint (const QPoint &iPoint) const |
KoVariable * | variableAtPosition (KoTextParag *parag, int index) const |
void | storeParagUndoRedoInfo (KoTextCursor *cursor, KoTextDocument::SelectionId selectionId=KoTextDocument::Standard) |
void | copyCharFormatting (KoTextParag *parag, int position, int index, bool moveCustomItems) |
void | readFormats (KoTextCursor &c1, KoTextCursor &c2, bool copyParagLayouts=false, bool moveCustomItems=false) |
void | newPlaceHolderCommand (const QString &name) |
void | checkUndoRedoInfo (KoTextCursor *cursor, UndoRedoInfo::Type t) |
UndoRedoInfo & | undoRedoInfoStruct () |
void | setVisible (bool vis) |
bool | isVisible () const |
Static Public Member Functions | |
static const char * | acceptSelectionMimeType () |
static QCString | providesOasis (QMimeSource *mime) |
static QChar | customItemChar () |
Classes | |
struct | UndoRedoInfo |
The undo-redo structure holds the _temporary_ information for the current undo/redo command. More... |
Member Enumeration Documentation
|
Definition at line 248 of file KoTextObject.h. |
Constructor & Destructor Documentation
|
Constructor. This constructor creates the contained KoTextDocument automatically.
Definition at line 60 of file KoTextObject.cpp. |
|
Alternative constructor. This constructor allows to use a derived class from KoTextDocument.
Definition at line 72 of file KoTextObject.cpp. |
Member Function Documentation
|
Abort the current formatMore() loop, or prevent the next one from starting. Use with care. This is e.g. for KWFootNoteVariable, so that it can do a frame layout before formatting the main text again. It is important to make sure that formatMore will be called again ;) Definition at line 1882 of file KoTextObject.cpp. |
|
Emitted by formatMore() after formatting a bunch of paragraphs. KWord uses this signal to check for things like 'I need to create a new page' |
|
Apply a KoParagStyle to a selection.
Definition at line 808 of file KoTextObject.cpp. |
|
Update the paragraph that use the given style, after this style was changed. The flags tell which changes should be applied.
Definition at line 931 of file KoTextObject.cpp. |
|
Helper for applyStyle. Can also be called directly, so that the command isn't emitted, e.g. to put it into a macro-command.
Definition at line 822 of file KoTextObject.cpp. |
|
Emitted by availableHeight() when the available height hasn't been calculated yet or is invalid. Connect to a slot that calls setAvailableHeight() |
|
Emitted by formatMore() when formatting a "Head 1" paragraph. Used for the Section variable |
|
Terminate our current undo/redo info, to start with a new one.
Definition at line 199 of file KoTextObject.cpp. |
|
Copies a formatted char, <parag, position>, into undoRedoInfo.text, at position
Definition at line 322 of file KoTextObject.cpp. |
|
Support for treating the whole textobject as a single object Use this format for displaying the properties (font/color/. ..) of the object. Interface for accessing the current format Implements KoTextFormatInterface. Definition at line 2083 of file KoTextObject.cpp. |
|
Use this format for displaying the properties (Align/counter/. ..) of the object Implements KoTextFormatInterface. Definition at line 2091 of file KoTextObject.cpp. |
|
Return the user-visible font size for this format (i.e. LU to pt conversion) Definition at line 152 of file KoTextObject.cpp. |
|
Executes keyboard action This is normally called by a key event handler. Definition at line 420 of file KoTextObject.cpp. |
|
The views should make sure the cursor is visible.
|
|
Make sure that
Definition at line 1714 of file KoTextObject.cpp. |
|
Emitted by formatMore() when formatting the first paragraph.
|
|
return true if some text is selected
Definition at line 240 of file KoTextObject.h. |
|
Highlighting support (for search/replace, spellchecking etc. ). Don't forget to ensure the paragraph is visible. Definition at line 1649 of file KoTextObject.cpp. |
|
The main "insert" method, including undo/redo creation/update.
Definition at line 591 of file KoTextObject.cpp. |
|
Emitted when a new command has been created and should be added to the main list of commands (usually in the KoDocument). Make sure to connect to that one, otherwise the commands will just leak away... |
|
Creates a place holder for a command that will be completed later on. This is used for the insert and delete text commands, which are build delayed (see the UndoRedoInfo structure), in order to have an entry in the undo/redo history asap. Definition at line 386 of file KoTextObject.cpp. |
|
Paste plain text at the given
Definition at line 737 of file KoTextObject.cpp. |
|
Check if the mimesource Otherwise return an empty string. Definition at line 2425 of file KoTextObject.cpp. |
|
Remove the text currently selected, including undo/redo creation/update.
Definition at line 1518 of file KoTextObject.cpp. |
|
Tell the world that we'd like some repainting to happen.
|
|
returns the selected text [without formatting] if hasSelection()
Definition at line 242 of file KoTextObject.h. |
|
Tell the views that the selection changed (for cut/copy. ..) |
|
returns true if the given selection has any custom item in it
Definition at line 183 of file KoTextObject.cpp. |
|
Special hack for undo/redo - used by KoTextView.
|
|
Support for changing the format in the whole textobject.
Reimplemented from KoTextFormatInterface. Definition at line 2219 of file KoTextObject.cpp. |
|
Set format changes on selection or current cursor. Creates a command if the format was applied to a selection Definition at line 1071 of file KoTextObject.cpp. |
|
Set format changes on selection or current cursor. Returns a command if the format was applied to a selection Definition at line 986 of file KoTextObject.cpp. |
|
Implementation of setFormatCommand from KoTextFormatInterface - apply change to the whole document.
Implements KoTextFormatInterface. Definition at line 978 of file KoTextObject.cpp. |
|
Support for changing the format in the whole textobject.
Implements KoTextFormatInterface. Definition at line 2206 of file KoTextObject.cpp. |
|
Set the bottom of the view - in LU.
Definition at line 1701 of file KoTextObject.cpp. |
|
Same thing, when the current format (of the edit object) was changed.
|
|
This prepares undoRedoInfo for a paragraph formatting change If this does too much, we could pass an enum flag to it. But the main point is to avoid too much duplicated code Definition at line 394 of file KoTextObject.cpp. |
|
Return the text document contained in this KoTextObject.
Definition at line 229 of file KoTextObject.h. |
|
for KWTextFrameSet
Definition at line 582 of file KoTextObject.h. |
|
Emitted when the formatting under the cursor may have changed. The Edit object should re-read settings and update the UI. |
|
Return the variable at the given point (in document coordinates), if any.
Definition at line 2402 of file KoTextObject.cpp. |
|
Return the variable at the given position, if any. Passing KoTextView's m_cursor here is usually wrong, index must come from the variablePosition value returned by KoTextCursor::place(). Definition at line 2412 of file KoTextObject.cpp. |
|
Return the font size in LU, for this user-visible font size in pt.
Definition at line 158 of file KoTextObject.cpp. |
The documentation for this class was generated from the following files: