KHTML
editor.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __EDITOR_H
00022 #define __EDITOR_H
00023
00024 #include "editor_command.h"
00025
00026 #include <khtml_export.h>
00027
00028 #include <QObject>
00029
00030 class QKeyEvent;
00031
00032 class KHTMLPart;
00033 class KHTMLView;
00034 class KHTMLEditorPart;
00035
00036 namespace khtml {
00037 class EditCommand;
00038 struct EditorContext;
00039 }
00040
00041 namespace DOM {
00042
00043 class Range;
00044 class NodeImpl;
00045 class DOMString;
00046 class CSSStyleDeclarationImpl;
00047 class EditorPrivate;
00048
00058 class KHTML_EXPORT Editor : public QObject {
00059 Q_OBJECT
00060
00061 Editor(KHTMLPart *);
00062 virtual ~Editor();
00063 public:
00064
00068 enum TriState { FalseTriState, TrueTriState, MixedTriState };
00069
00070
00071
00078 bool execCommand(const DOMString &command, bool userInterface, const DOMString &value);
00080 bool queryCommandEnabled(const DOMString &command);
00082 bool queryCommandIndeterm(const DOMString &command);
00084 bool queryCommandState(const DOMString &command);
00086 bool queryCommandSupported(const DOMString &command);
00088 DOMString queryCommandValue(const DOMString &command);
00089
00096 bool execCommand(EditorCommand, bool userInterface, const DOMString &value);
00098 bool queryCommandEnabled(EditorCommand);
00100 bool queryCommandIndeterm(EditorCommand);
00102 bool queryCommandState(EditorCommand);
00104 bool queryCommandSupported(EditorCommand);
00106 DOMString queryCommandValue(EditorCommand);
00107
00108
00109
00111 void copy();
00113 void cut();
00115 void paste();
00117 bool canPaste() const;
00119 void redo();
00121 void undo();
00123 bool canRedo() const;
00125 bool canUndo() const;
00127 void applyStyle(DOM::CSSStyleDeclarationImpl *);
00129 TriState selectionHasStyle(DOM::CSSStyleDeclarationImpl *) const;
00131 bool selectionStartHasStyle(DOM::CSSStyleDeclarationImpl *) const;
00133 DOM::DOMString selectionStartStylePropertyValue(int stylePropertyID) const;
00135 void print();
00137 DOM::CSSStyleDeclarationImpl *selectionComputedStyle(DOM::NodeImpl *&nodeToRemove) const;
00138
00139
00140
00141
00145 khtml::EditCommand lastEditCommand() const;
00146
00150 void appliedEditing(khtml::EditCommand &);
00151
00155 void unappliedEditing(khtml::EditCommand &);
00156
00160 void reappliedEditing(khtml::EditCommand &);
00161
00165 DOM::CSSStyleDeclarationImpl *typingStyle() const;
00166
00170 void setTypingStyle(DOM::CSSStyleDeclarationImpl *);
00171
00175 void clearTypingStyle();
00176
00177 private:
00179 bool handleKeyEvent(QKeyEvent *);
00180
00181 private:
00182 EditorPrivate *const d;
00183
00184 DOM::CSSStyleDeclarationImpl *m_typingStyle;
00185
00186 KHTMLPart *m_part;
00187
00188 friend class ::KHTMLPart;
00189 friend class ::KHTMLView;
00190 friend class ::KHTMLEditorPart;
00191 friend struct khtml::EditorContext;
00192 };
00193
00194 }
00195
00196 #endif // __EDITOR_H