KoTextObject Class Reference
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). More...
#include <kotextobject.h>
Inheritance diagram for KoTextObject:

Public Types | |
enum | SelectionIds { HighlightSelection = 1 } |
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 (KoZoomHandler *zh, const QFont &defaultFont, const QString &defaultLanguage, bool hyphen, double ulw, KoStyle *defaultStyle, int _tabStopWidth=-1, QObject *parent=0, const char *name=0) | |
KoTextObject (KoTextDocument *textdoc, KoStyle *defaultStyle, QObject *parent=0, const char *name=0) | |
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 (int selectionId=KoTextDocument::Standard) const |
bool | selectionHasCustomItems (int selectionId=KoTextDocument::Standard) const |
void | insert (KoTextCursor *cursor, KoTextFormat *currentFormat, const QString &text, bool checkNewLine, bool removeSelected, const QString &commandName, CustomItemsMap customItemsMap=CustomItemsMap(), int selectionId=KoTextDocument::Standard, bool repaint=true) |
void | removeSelectedText (KoTextCursor *cursor, int selectionId=KoTextDocument::Standard, const QString &cmdName=QString::null, bool createUndoRedo=true) |
KCommand * | replaceSelectionCommand (KoTextCursor *cursor, const QString &replacement, int selectionId, const QString &cmdName, bool repaint=true) |
KCommand * | removeSelectedTextCommand (KoTextCursor *cursor, int 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, int selectionId=KoTextDocument::Standard) |
void | doKeyboardAction (KoTextCursor *cursor, KoTextFormat *¤tFormat, KeyboardAction action) |
KCommand * | setCounterCommand (KoTextCursor *cursor, const KoParagCounter &counter, int selectionId=KoTextDocument::Standard) |
KCommand * | setAlignCommand (KoTextCursor *cursor, int align, int selectionId=KoTextDocument::Standard) |
KCommand * | setLineSpacingCommand (KoTextCursor *cursor, double spacing, KoParagLayout::SpacingType _type, int selectionId=KoTextDocument::Standard) |
KCommand * | setBordersCommand (KoTextCursor *cursor, const KoBorder &leftBorder, const KoBorder &rightBorder, const KoBorder &topBorder, const KoBorder &bottomBorder, int selectionId=KoTextDocument::Standard) |
KCommand * | setMarginCommand (KoTextCursor *cursor, QStyleSheetItem::Margin m, double margin, int selectionId=KoTextDocument::Standard) |
KCommand * | setTabListCommand (KoTextCursor *cursor, const KoTabulatorList &tabList, int selectionId=KoTextDocument::Standard) |
KCommand * | setParagDirectionCommand (KoTextCursor *cursor, QChar::Direction d, int selectionId=KoTextDocument::Standard) |
void | applyStyle (KoTextCursor *cursor, const KoStyle *style, int selectionId=KoTextDocument::Standard, int paragLayoutFlags=KoParagLayout::All, int formatFlags=KoTextFormat::Format, bool createUndoRedo=true, bool interactive=true) |
KCommand * | applyStyleCommand (KoTextCursor *cursor, const KoStyle *style, int selectionId=KoTextDocument::Standard, int paragLayoutFlags=KoParagLayout::All, int formatFlags=KoTextFormat::Format, bool createUndoRedo=true, bool interactive=true) |
void | applyStyleChange (StyleChangeDefMap 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 * | setParagLayoutFormatCommand (KoTextCursor *cursor, int selectionId, KoParagLayout *newLayout, int flags, int marginIndex) |
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 | printRTDebug (int) |
void | storeParagUndoRedoInfo (KoTextCursor *cursor, int 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 | |
QChar | customItemChar () |
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 168 of file kotextobject.h.
Member Enumeration Documentation
|
Selections ids.
Definition at line 266 of file kotextobject.h. |
Constructor & Destructor Documentation
|
Constructor.
Definition at line 46 of file kotextobject.cc. References KoTextObject(). Referenced by KoTextObject(). |
|
Alternative constructor.
Definition at line 56 of file kotextobject.cc. References KoTextObject(). |
Member Function Documentation
|
Return the text document contained in this KoTextObject.
Definition at line 200 of file kotextobject.h. Referenced by KoTextIterator::init(), and KoTextView::KoTextView(). |
|
Terminate our current undo/redo info, to start with a new one.
Definition at line 188 of file kotextobject.cc. References KoTextObject::UndoRedoInfo::clear(). Referenced by doKeyboardAction(), insert(), and KoTextView::terminate(). |
|
return true if some text is selected
Definition at line 211 of file kotextobject.h. Referenced by KoTextView::dataToolActionList(). |
|
returns the selected text [without formatting] if hasSelection()
Definition at line 213 of file kotextobject.h. References selectedText(). Referenced by KoTextView::dataToolActionList(), and selectedText(). |
|
returns true if the given selection has any custom item in it
Definition at line 172 of file kotextobject.cc. References selectionHasCustomItems(). Referenced by selectionHasCustomItems(). |
|
The main "insert" method, including undo/redo creation/update.
Definition at line 554 of file kotextobject.cc. References clearUndoRedoInfo(), copyCharFormatting(), KoTextObject::UndoRedoInfo::customItemsMap, ensureCursorVisible(), ensureFormatted(), KoTextObject::UndoRedoInfo::id, KoTextObject::UndoRedoInfo::index, insert(), CustomItemsMap::insertItems(), newPlaceHolderCommand(), repaintChanged(), KoTextObject::UndoRedoInfo::text, updateUI(), and KoTextObject::UndoRedoInfo::valid(). Referenced by insert(), and KoTextView::insertText(). |
|
Remove the text currently selected, including undo/redo creation/update.
Definition at line 1343 of file kotextobject.cc. References KoTextObject::UndoRedoInfo::clear(), ensureCursorVisible(), KoTextObject::UndoRedoInfo::id, KoTextObject::UndoRedoInfo::index, newPlaceHolderCommand(), removeSelectedText(), KoTextObject::UndoRedoInfo::text, and KoTextObject::UndoRedoInfo::valid(). Referenced by doKeyboardAction(), and removeSelectedText(). |
|
Highlighting support (for search/replace, spellchecking etc.). Don't forget to ensure the paragraph is visible. Definition at line 1468 of file kotextobject.cc. References highlightPortion(). Referenced by highlightPortion(). |
|
Implementation of setFormatCommand from KoTextFormatInterface - apply change to the whole document.
Implements KoTextFormatInterface. Definition at line 914 of file kotextobject.cc. References setFormatCommand(). Referenced by setFormat(), KoTextView::setFormatCommand(), and setFormatCommand(). |
|
Set format changes on selection or current cursor. Returns a command if the format was applied to a selection Definition at line 922 of file kotextobject.cc. References KoTextFormat::addRef(), KoTextObject::UndoRedoInfo::clear(), KoTextObject::UndoRedoInfo::customItemsMap, KoTextFormat::isMisspelled(), KoTextFormat::key(), KoTextFormat::pointSize(), KoTextFormat::removeRef(), repaintChanged(), setFormatCommand(), KoTextFormat::setMisspelled(), KoTextFormat::setPointSize(), showCurrentFormat(), KoTextObject::UndoRedoInfo::text, and zoomedFontSize(). |
|
Executes keyboard action This is normally called by a key event handler. Definition at line 411 of file kotextobject.cc. References clearUndoRedoInfo(), copyCharFormatting(), KoTextObject::UndoRedoInfo::customItemsMap, doKeyboardAction(), ensureCursorVisible(), KoStyle::followingStyle(), KoTextObject::UndoRedoInfo::id, KoTextObject::UndoRedoInfo::index, newCommand(), newPlaceHolderCommand(), KoTextObject::UndoRedoInfo::oldParagLayouts, removeSelectedText(), repaintChanged(), KoTextObject::UndoRedoInfo::text, updateUI(), and KoTextObject::UndoRedoInfo::valid(). Referenced by doKeyboardAction(). |
|
Apply a KoStyle to a selection.
Definition at line 697 of file kotextobject.cc. References applyStyle(), applyStyleCommand(), and newCommand(). Referenced by applyStyle(), and applyStyleChange(). |
|
Helper for applyStyle. Can also be called directly, so that the command isn't emitted, e.g. to put it into a macro-command.
Applying a style is three distinct operations : 1 - Changing the paragraph settings (setParagLayout) 2 - Changing the character formatting for each char in the paragraph (setFormat(indices)) 3 - Changing the character formatting for the whole paragraph (setFormat()) [just in case] -> We need a macro command to hold the 3 commands Definition at line 711 of file kotextobject.cc. References applyStyleCommand(), KoTextObject::UndoRedoInfo::clear(), KoTextObject::UndoRedoInfo::eid, KoTextObject::UndoRedoInfo::id, KoTextObject::UndoRedoInfo::oldParagLayouts, KoStyle::paragLayout(), repaintChanged(), storeParagUndoRedoInfo(), KoTextObject::UndoRedoInfo::text, KoTextObject::UndoRedoInfo::type, and updateUI(). Referenced by applyStyle(), and applyStyleCommand(). |
|
Update the paragraph that use the given style, after this style was changed. The flags tell which changes should be applied.
Definition at line 840 of file kotextobject.cc. References applyStyle(), applyStyleChange(), KoParagLayout::bottomBorder, KoParagLayout::counter, KoParagLayout::leftBorder, KoParagLayout::lineSpacing, KoParagLayout::margins, KoStyle::paragLayout(), repaintChanged(), KoParagLayout::rightBorder, KoParagLayout::setTabList(), KoParagLayout::topBorder, and updateUI(). Referenced by applyStyleChange(). |
|
Set format changes on selection or current cursor. Creates a command if the format was applied to a selection Definition at line 1007 of file kotextobject.cc. References newCommand(), setFormat(), and setFormatCommand(). Referenced by setFormat(). |
|
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 1880 of file kotextobject.cc. Referenced by setFormat(). |
|
Use this format for displaying the properties (Align/counter/...) of the object.
Implements KoTextFormatInterface. Definition at line 1888 of file kotextobject.cc. |
|
Support for changing the format in the whole textobject.
Implements KoTextFormatInterface. Definition at line 1899 of file kotextobject.cc. References setParagLayoutFormatCommand(). Referenced by setParagLayoutFormatCommand(). |
|
Support for changing the format in the whole textobject.
Reimplemented from KoTextFormatInterface. Definition at line 1939 of file kotextobject.cc. References currentFormat(), newCommand(), setFormat(), and setFormatCommand(). |
|
Return the user-visible font size for this format (i.e. LU to pt conversion) Definition at line 141 of file kotextobject.cc. References docFontSize(), and KoTextFormat::pointSize(). Referenced by docFontSize(). |
|
Return the font size in LU, for this user-visible font size in pt.
Definition at line 147 of file kotextobject.cc. References zoomedFontSize(). Referenced by setFormatCommand(), and zoomedFontSize(). |
|
Set the bottom of the view - in LU.
Definition at line 1520 of file kotextobject.cc. References setViewArea(). Referenced by setViewArea(). |
|
Make sure that
Definition at line 1532 of file kotextobject.cc. References ensureFormatted(). Referenced by ensureFormatted(), and insert(). |
|
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 1697 of file kotextobject.cc. |
|
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() after formatting a bunch of paragraphs. KWord uses this signal to check for things like 'I need to create a new page' |
|
Emitted by formatMore() when formatting a "Head 1" paragraph. Used for the Section variable |
|
Emitted by formatMore() when formatting the first paragraph.
|
|
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... Referenced by applyStyle(), doKeyboardAction(), newPlaceHolderCommand(), and setFormat(). |
|
Tell the world that we'd like some repainting to happen.
Referenced by applyStyleChange(), applyStyleCommand(), doKeyboardAction(), insert(), and setFormatCommand(). |
|
Special hack for undo/redo - used by KoTextView.
|
|
Emitted when the formatting under the cursor may have changed. The Edit object should re-read settings and update the UI. Referenced by applyStyleChange(), applyStyleCommand(), doKeyboardAction(), and insert(). |
|
Same thing, when the current format (of the edit object) was changed.
Referenced by setFormatCommand(). |
|
The views should make sure the cursor is visible.
Referenced by doKeyboardAction(), insert(), and removeSelectedText(). |
|
Tell the views that the selection changed (for cut/copy...).
|
|
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 385 of file kotextobject.cc. References KoTextObject::UndoRedoInfo::clear(), KoTextObject::UndoRedoInfo::eid, KoTextObject::UndoRedoInfo::id, KoTextObject::UndoRedoInfo::index, KoTextObject::UndoRedoInfo::oldParagLayouts, storeParagUndoRedoInfo(), and KoTextObject::UndoRedoInfo::text. Referenced by applyStyleCommand(), and storeParagUndoRedoInfo(). |
|
Copies a formatted char, <parag, position>, into undoRedoInfo.text, at position <index>.
Definition at line 311 of file kotextobject.cc. References copyCharFormatting(), KoTextObject::UndoRedoInfo::customItemsMap, and KoTextObject::UndoRedoInfo::text. Referenced by copyCharFormatting(), doKeyboardAction(), and insert(). |
|
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 377 of file kotextobject.cc. References newCommand(), newPlaceHolderCommand(), and KoTextObject::UndoRedoInfo::placeHolderCmd. Referenced by doKeyboardAction(), insert(), newPlaceHolderCommand(), and removeSelectedText(). |
|
for KWTextFrameSet
Definition at line 506 of file kotextobject.h. |
The documentation for this class was generated from the following files: