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 ElementImpl;
00046 class DOMString;
00047 class CSSStyleDeclarationImpl;
00048 class EditorPrivate;
00049
00059 class KHTML_EXPORT Editor : public QObject {
00060 Q_OBJECT
00061
00062 Editor(KHTMLPart *);
00063 virtual ~Editor();
00064 public:
00065
00069 enum TriState { FalseTriState, TrueTriState, MixedTriState };
00070
00071
00072
00079 bool execCommand(const DOMString &command, bool userInterface, const DOMString &value);
00081 bool queryCommandEnabled(const DOMString &command);
00083 bool queryCommandIndeterm(const DOMString &command);
00085 bool queryCommandState(const DOMString &command);
00087 bool queryCommandSupported(const DOMString &command);
00089 DOMString queryCommandValue(const DOMString &command);
00090
00097 bool execCommand(EditorCommand, bool userInterface, const DOMString &value);
00099 bool queryCommandEnabled(EditorCommand);
00101 bool queryCommandIndeterm(EditorCommand);
00103 bool queryCommandState(EditorCommand);
00105 bool queryCommandSupported(EditorCommand);
00107 DOMString queryCommandValue(EditorCommand);
00108
00109
00110
00112 void copy();
00114 void cut();
00116 void paste();
00118 bool canPaste() const;
00120 void redo();
00122 void undo();
00124 bool canRedo() const;
00126 bool canUndo() const;
00128 void applyStyle(DOM::CSSStyleDeclarationImpl *);
00130 TriState selectionHasStyle(DOM::CSSStyleDeclarationImpl *) const;
00132 bool selectionStartHasStyle(DOM::CSSStyleDeclarationImpl *) const;
00134 DOM::DOMString selectionStartStylePropertyValue(int stylePropertyID) const;
00136 void print();
00138 DOM::CSSStyleDeclarationImpl *selectionComputedStyle(DOM::NodeImpl *&nodeToRemove) const;
00139
00140
00141
00142
00146 khtml::EditCommand lastEditCommand() const;
00147
00151 void appliedEditing(khtml::EditCommand &);
00152
00156 void unappliedEditing(khtml::EditCommand &);
00157
00161 void reappliedEditing(khtml::EditCommand &);
00162
00166 DOM::CSSStyleDeclarationImpl *typingStyle() const;
00167
00171 void setTypingStyle(DOM::CSSStyleDeclarationImpl *);
00172
00176 void clearTypingStyle();
00177
00178 private:
00180 bool handleKeyEvent(QKeyEvent *);
00181
00182 private:
00183 EditorPrivate *const d;
00184
00185 DOM::CSSStyleDeclarationImpl *m_typingStyle;
00186
00187 KHTMLPart *m_part;
00188
00189 friend class ::KHTMLPart;
00190 friend class ::KHTMLView;
00191 friend class ::KHTMLEditorPart;
00192 friend struct khtml::EditorContext;
00193 friend class DOM::ElementImpl;
00194 };
00195
00196 }
00197
00198 #endif // __EDITOR_H