KHTML
edit_command.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 EDIT_COMMAND_H
00022 #define EDIT_COMMAND_H
00023
00024 #include "misc/shared.h"
00025
00026 namespace DOM {
00027 class DocumentImpl;
00028 class Selection;
00029 }
00030
00031 namespace khtml {
00032
00033
00034
00035
00040 enum ECommandID {
00041 EditCommandID,
00042 AppendNodeCommandID,
00043 ApplyStyleCommandID,
00044 CompositeEditCommandID,
00045 DeleteCollapsibleWhitespaceCommandID,
00046 DeleteSelectionCommandID,
00047 DeleteTextCommandID,
00048 InputNewlineCommandID,
00049 InputTextCommandID,
00050 InsertNodeBeforeCommandID,
00051 InsertTextCommandID,
00052 JoinTextNodesCommandID,
00053 MoveSelectionCommandID,
00054 ReplaceSelectionCommandID,
00055 RemoveCSSPropertyCommandID,
00056 RemoveNodeAttributeCommandID,
00057 RemoveNodeCommandID,
00058 RemoveNodeAndPruneCommandID,
00059 RemoveNodePreservingChildrenCommandID,
00060 SetNodeAttributeCommandID,
00061 SplitTextNodeCommandID,
00062 TypingCommandID
00063 };
00064
00065
00066
00067
00068 class EditCommand;
00069 class EditCommandImpl;
00070
00071 class SharedCommandImpl : public Shared<SharedCommandImpl>
00072 {
00073 public:
00074 SharedCommandImpl() {}
00075 virtual ~SharedCommandImpl() {}
00076
00077 virtual int commandID() const = 0;
00078 virtual bool isCompositeStep() const = 0;
00079
00080 virtual void apply() = 0;
00081 virtual void unapply() = 0;
00082 virtual void reapply() = 0;
00083
00084 virtual DOM::DocumentImpl* document() const = 0;
00085
00086 virtual DOM::Selection startingSelection() const = 0;
00087 virtual DOM::Selection endingSelection() const = 0;
00088
00089 virtual void setStartingSelection(const DOM::Selection &s) = 0;
00090 virtual void setEndingSelection(const DOM::Selection &s) = 0;
00091
00092 virtual EditCommandImpl* parent() const = 0;
00093 virtual void setParent(EditCommandImpl *) = 0;
00094 };
00095
00096
00097
00098
00099 class EditCommand : public SharedPtr<SharedCommandImpl>
00100 {
00101 public:
00102 EditCommand();
00103 EditCommand(EditCommandImpl *);
00104 EditCommand(const EditCommand &);
00105 ~EditCommand();
00106
00107 int commandID() const;
00108 bool isCompositeStep() const;
00109 bool isNull() const;
00110 bool notNull() const;
00111
00112 void apply();
00113 void unapply();
00114 void reapply();
00115
00116 DOM::DocumentImpl* document() const;
00117
00118 DOM::Selection startingSelection() const;
00119 DOM::Selection endingSelection() const;
00120
00121 void setStartingSelection(const DOM::Selection &s);
00122 void setEndingSelection(const DOM::Selection &s);
00123
00124 EditCommand parent() const;
00125
00126 EditCommandImpl *handle() const;
00127
00128 static EditCommand &emptyCommand();
00129 };
00130
00131 }
00132
00133
00134 #endif