KHTML
htmlediting.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
00022
00023
00024
00025
00026 #ifndef __htmlediting_h__
00027 #define __htmlediting_h__
00028
00029 #include "edit_command.h"
00030
00031 #include "xml/dom_nodeimpl.h"
00032
00033 namespace DOM {
00034 class CSSStyleDeclarationImpl;
00035 class DocumentFragmentImpl;
00036 class DocumentImpl;
00037 class DOMString;
00038 class ElementImpl;
00039 class NodeImpl;
00040 class Position;
00041 class Selection;
00042 class TextImpl;
00043 }
00044
00045 namespace khtml {
00046
00047 class AppendNodeCommandImpl;
00048 class ApplyStyleCommandImpl;
00049 class CompositeEditCommandImpl;
00050 class DeleteCollapsibleWhitespaceCommandImpl;
00051 class DeleteSelectionCommandImpl;
00052 class DeleteTextCommandImpl;
00053 class EditCommand;
00054 class EditCommandImpl;
00055 class InputNewlineCommandImpl;
00056 class InputTextCommandImpl;
00057 class InsertNodeBeforeCommandImpl;
00058 class InsertTextCommandImpl;
00059 class JoinTextNodesCommandImpl;
00060 class MoveSelectionCommandImpl;
00061 class ReplaceSelectionCommandImpl;
00062 class RemoveCSSPropertyCommandImpl;
00063 class RemoveNodeAttributeCommandImpl;
00064 class RemoveNodeCommandImpl;
00065 class RemoveNodeAndPruneCommandImpl;
00066 class RemoveNodePreservingChildrenCommandImpl;
00067 class SetNodeAttributeCommandImpl;
00068 class SplitTextNodeCommandImpl;
00069 class TypingCommandImpl;
00070
00071
00072
00073
00074 class CompositeEditCommand : public EditCommand
00075 {
00076 public:
00077 CompositeEditCommand();
00078 CompositeEditCommand(CompositeEditCommandImpl *);
00079 CompositeEditCommand(const CompositeEditCommand &);
00080 ~CompositeEditCommand();
00081
00082 private:
00083 inline CompositeEditCommandImpl *impl() const;
00084 };
00085
00086
00087
00088
00089
00090
00091 class AppendNodeCommand : public EditCommand
00092 {
00093 public:
00094 AppendNodeCommand(DOM::DocumentImpl *, DOM::NodeImpl *parentNode, DOM::NodeImpl *appendChild);
00095 ~AppendNodeCommand();
00096
00097 DOM::NodeImpl *parentNode() const;
00098 DOM::NodeImpl *appendChild() const;
00099
00100 private:
00101 inline AppendNodeCommandImpl *impl() const;
00102 };
00103
00104
00105
00106
00107 class ApplyStyleCommand : public CompositeEditCommand
00108 {
00109 public:
00110 ApplyStyleCommand(DOM::DocumentImpl *, DOM::CSSStyleDeclarationImpl *);
00111 ~ApplyStyleCommand();
00112
00113 DOM::CSSStyleDeclarationImpl *style() const;
00114
00115 private:
00116 inline ApplyStyleCommandImpl *impl() const;
00117 };
00118
00119
00120
00121
00122 class DeleteCollapsibleWhitespaceCommand : public CompositeEditCommand
00123 {
00124 public:
00125 DeleteCollapsibleWhitespaceCommand(DOM::DocumentImpl *document);
00126 DeleteCollapsibleWhitespaceCommand(DOM::DocumentImpl *document, const DOM::Selection &selection);
00127
00128 ~DeleteCollapsibleWhitespaceCommand();
00129
00130 private:
00131 inline DeleteCollapsibleWhitespaceCommandImpl *impl() const;
00132 };
00133
00134
00135
00136
00137 class DeleteSelectionCommand : public CompositeEditCommand
00138 {
00139 public:
00140 DeleteSelectionCommand(DOM::DocumentImpl *document);
00141 DeleteSelectionCommand(DOM::DocumentImpl *document, const DOM::Selection &selection);
00142 ~DeleteSelectionCommand();
00143
00144 private:
00145 inline DeleteSelectionCommandImpl *impl() const;
00146 };
00147
00148
00149
00150
00151 class DeleteTextCommand : public EditCommand
00152 {
00153 public:
00154 DeleteTextCommand(DOM::DocumentImpl *document, DOM::TextImpl *, long offset, long count);
00155 DeleteTextCommand(const DeleteTextCommand &);
00156 ~DeleteTextCommand();
00157
00158 DOM::TextImpl *node() const;
00159 long offset() const;
00160 long count() const;
00161
00162 private:
00163 inline DeleteTextCommandImpl *impl() const;
00164 };
00165
00166
00167
00168
00169 class InputNewlineCommand : public CompositeEditCommand
00170 {
00171 public:
00172 InputNewlineCommand(DOM::DocumentImpl *document);
00173 ~InputNewlineCommand();
00174
00175 private:
00176 inline InputNewlineCommandImpl *impl() const;
00177 };
00178
00179
00180
00181
00182 class InputTextCommand : public CompositeEditCommand
00183 {
00184 public:
00185 InputTextCommand(DOM::DocumentImpl *document);
00186 ~InputTextCommand();
00187
00188 void deleteCharacter();
00189 void input(const DOM::DOMString &text);
00190
00191 unsigned long charactersAdded() const;
00192
00193 private:
00194 inline InputTextCommandImpl *impl() const;
00195 };
00196
00197
00198
00199
00200 class InsertNodeBeforeCommand : public EditCommand
00201 {
00202 public:
00203 InsertNodeBeforeCommand();
00204 InsertNodeBeforeCommand(DOM::DocumentImpl *, DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild);
00205 InsertNodeBeforeCommand(const InsertNodeBeforeCommand &);
00206 ~InsertNodeBeforeCommand();
00207
00208 DOM::NodeImpl *insertChild() const;
00209 DOM::NodeImpl *refChild() const;
00210
00211 private:
00212 inline InsertNodeBeforeCommandImpl *impl() const;
00213 };
00214
00215
00216
00217
00218 class InsertTextCommand : public EditCommand
00219 {
00220 public:
00221 InsertTextCommand(DOM::DocumentImpl *document, DOM::TextImpl *, long, const DOM::DOMString &);
00222 ~InsertTextCommand();
00223
00224 DOM::TextImpl *node() const;
00225 long offset() const;
00226 DOM::DOMString text() const;
00227
00228 private:
00229 inline InsertTextCommandImpl *impl() const;
00230 };
00231
00232
00233
00234
00235 class JoinTextNodesCommand : public EditCommand
00236 {
00237 public:
00238 JoinTextNodesCommand(DOM::DocumentImpl *, DOM::TextImpl *, DOM::TextImpl *);
00239 ~JoinTextNodesCommand();
00240
00241 DOM::TextImpl *firstNode() const;
00242 DOM::TextImpl *secondNode() const;
00243
00244 private:
00245 inline JoinTextNodesCommandImpl *impl() const;
00246 };
00247
00248
00249
00250
00251 class ReplaceSelectionCommand : public CompositeEditCommand
00252 {
00253 public:
00254 ReplaceSelectionCommand(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, bool selectReplacement=true);
00255 ~ReplaceSelectionCommand();
00256
00257 private:
00258 inline ReplaceSelectionCommandImpl *impl() const;
00259 };
00260
00261
00262
00263
00264 class MoveSelectionCommand : public CompositeEditCommand
00265 {
00266 public:
00267 MoveSelectionCommand(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position);
00268 ~MoveSelectionCommand();
00269
00270 private:
00271 inline MoveSelectionCommandImpl *impl() const;
00272 };
00273
00274
00275
00276
00277 class RemoveCSSPropertyCommand : public EditCommand
00278 {
00279 public:
00280 RemoveCSSPropertyCommand(DOM::DocumentImpl *, DOM::CSSStyleDeclarationImpl *, int property);
00281 ~RemoveCSSPropertyCommand();
00282
00283 DOM::CSSStyleDeclarationImpl *styleDeclaration() const;
00284 int property() const;
00285
00286 private:
00287 inline RemoveCSSPropertyCommandImpl *impl() const;
00288 };
00289
00290
00291
00292
00293 class RemoveNodeAttributeCommand : public EditCommand
00294 {
00295 public:
00296 RemoveNodeAttributeCommand(DOM::DocumentImpl *, DOM::ElementImpl *, DOM::NodeImpl::Id attribute);
00297 ~RemoveNodeAttributeCommand();
00298
00299 DOM::ElementImpl *element() const;
00300 DOM::NodeImpl::Id attribute() const;
00301
00302 private:
00303 inline RemoveNodeAttributeCommandImpl *impl() const;
00304 };
00305
00306
00307
00308
00309 class RemoveNodeCommand : public EditCommand
00310 {
00311 public:
00312 RemoveNodeCommand(DOM::DocumentImpl *, DOM::NodeImpl *node);
00313 ~RemoveNodeCommand();
00314
00315 DOM::NodeImpl *node() const;
00316
00317 private:
00318 inline RemoveNodeCommandImpl *impl() const;
00319 };
00320
00321
00322
00323
00324 class RemoveNodeAndPruneCommand : public CompositeEditCommand
00325 {
00326 public:
00327 RemoveNodeAndPruneCommand(DOM::DocumentImpl *, DOM::NodeImpl *pruneNode, DOM::NodeImpl *stopNode=0);
00328 ~RemoveNodeAndPruneCommand();
00329
00330 DOM::NodeImpl *pruneNode() const;
00331 DOM::NodeImpl *stopNode() const;
00332
00333 private:
00334 inline RemoveNodeAndPruneCommandImpl *impl() const;
00335 };
00336
00337
00338
00339
00340 class RemoveNodePreservingChildrenCommand : public CompositeEditCommand
00341 {
00342 public:
00343 RemoveNodePreservingChildrenCommand(DOM::DocumentImpl *document, DOM::NodeImpl *node);
00344 ~RemoveNodePreservingChildrenCommand();
00345
00346 DOM::NodeImpl *node() const;
00347
00348 private:
00349 inline RemoveNodePreservingChildrenCommandImpl *impl() const;
00350 };
00351
00352
00353
00354
00355 class SetNodeAttributeCommand : public EditCommand
00356 {
00357 public:
00358 SetNodeAttributeCommand(DOM::DocumentImpl *, DOM::ElementImpl *, DOM::NodeImpl::Id attribute, const DOM::DOMString &value);
00359 ~SetNodeAttributeCommand();
00360
00361 DOM::ElementImpl *element() const;
00362 DOM::NodeImpl::Id attribute() const;
00363 DOM::DOMString value() const;
00364
00365 private:
00366 inline SetNodeAttributeCommandImpl *impl() const;
00367 };
00368
00369
00370
00371
00372 class SplitTextNodeCommand : public EditCommand
00373 {
00374 public:
00375 SplitTextNodeCommand(DOM::DocumentImpl *, DOM::TextImpl *, long);
00376 ~SplitTextNodeCommand();
00377
00378 DOM::TextImpl *node() const;
00379 long offset() const;
00380
00381 private:
00382 inline SplitTextNodeCommandImpl *impl() const;
00383 };
00384
00385
00386
00387
00388 class TypingCommand : public CompositeEditCommand
00389 {
00390 public:
00391 static void deleteKeyPressed(DOM::DocumentImpl *document);
00392 static void insertText(DOM::DocumentImpl *document, const DOM::DOMString &text);
00393 static void insertNewline(DOM::DocumentImpl *document);
00394 static bool isOpenForMoreTypingCommand(const EditCommand &);
00395 static void closeTyping(EditCommand);
00396
00397 bool openForMoreTyping() const;
00398 void closeTyping();
00399
00400 private:
00401 TypingCommand(DOM::DocumentImpl *document);
00402 TypingCommand(TypingCommand *);
00403 TypingCommand(const TypingCommand &);
00404 ~TypingCommand();
00405
00406 void deleteKeyPressed();
00407 void insertText(const DOM::DOMString &text);
00408 void insertNewline();
00409
00410 inline TypingCommandImpl *impl() const;
00411 };
00412
00413
00414
00415 }
00416
00417 #endif