KHtml

htmlediting_impl.h
1 /*
2  * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef __htmleditingimpl_h__
27 #define __htmleditingimpl_h__
28 
29 #include "misc/shared.h"
30 
31 #include "xml/dom_position.h"
32 #include "xml/dom_selection.h"
33 #include "dom/dom_string.h"
34 
35 #include "xml/dom_nodeimpl.h"
36 
37 #include <QList>
38 
39 namespace DOM
40 {
41 class CSSProperty;
42 class CSSStyleDeclarationImpl;
43 class DocumentFragmentImpl;
44 class DocumentImpl;
45 class DOMString;
46 class ElementImpl;
47 class HTMLElementImpl;
48 class NodeImpl;
49 class NodeListImpl;
50 class Position;
51 class Range;
52 class Selection;
53 class TextImpl;
54 class TreeWalkerImpl;
55 }
56 
57 using DOM::DocumentImpl;
58 using DOM::NodeImpl;
59 
60 namespace khtml
61 {
62 
63 class EditCommandImpl;
64 
65 class SharedCommandImpl : public Shared<SharedCommandImpl>
66 {
67 public:
68  SharedCommandImpl() {}
69  virtual ~SharedCommandImpl() {}
70 
71  virtual bool isCompositeStep() const = 0;
72 
73  virtual void apply() = 0;
74  virtual void unapply() = 0;
75  virtual void reapply() = 0;
76 
77  virtual DOM::DocumentImpl *document() const = 0;
78 
79  virtual DOM::Selection startingSelection() const = 0;
80  virtual DOM::Selection endingSelection() const = 0;
81 
82  virtual void setStartingSelection(const DOM::Selection &s) = 0;
83  virtual void setEndingSelection(const DOM::Selection &s) = 0;
84 
85  virtual EditCommandImpl *parent() const = 0;
86  virtual void setParent(EditCommandImpl *) = 0;
87 };
88 
89 //------------------------------------------------------------------------------------------
90 // EditCommandImpl
91 
92 class EditCommandImpl : public SharedCommandImpl
93 {
94 public:
95  EditCommandImpl(DOM::DocumentImpl *);
96  virtual ~EditCommandImpl();
97 
98  bool isCompositeStep() const override
99  {
100  return parent();
101  }
102  EditCommandImpl *parent() const override;
103  void setParent(EditCommandImpl *) override;
104 
105  enum ECommandState { NotApplied, Applied };
106 
107  void apply() override;
108  void unapply() override;
109  void reapply() override;
110 
111  virtual void doApply() = 0;
112  virtual void doUnapply() = 0;
113  virtual void doReapply(); // calls doApply()
114 
115  DOM::DocumentImpl *document() const override
116  {
117  return m_document.get();
118  }
119 
120  DOM::Selection startingSelection() const override
121  {
122  return m_startingSelection;
123  }
124  DOM::Selection endingSelection() const override
125  {
126  return m_endingSelection;
127  }
128 
129  ECommandState state() const
130  {
131  return m_state;
132  }
133  void setState(ECommandState state)
134  {
135  m_state = state;
136  }
137 
138  void setStartingSelection(const DOM::Selection &s) override;
139  void setEndingSelection(const DOM::Selection &s) override;
140 
141 public:
142  virtual bool isTypingCommand() const
143  {
144  return false;
145  }
146  virtual bool isInputTextCommand() const
147  {
148  return false;
149  }
150 
151 private:
152  DocPtr<DOM::DocumentImpl> m_document;
153  ECommandState m_state;
154  DOM::Selection m_startingSelection;
155  DOM::Selection m_endingSelection;
156  RefPtr<EditCommandImpl> m_parent;
157 };
158 
159 //------------------------------------------------------------------------------------------
160 // CompositeEditCommandImpl
161 
162 class CompositeEditCommandImpl : public EditCommandImpl
163 {
164 public:
165  CompositeEditCommandImpl(DOM::DocumentImpl *);
166  virtual ~CompositeEditCommandImpl();
167 
168  void doApply() override = 0;
169  void doUnapply() override;
170  void doReapply() override;
171 
172 protected:
173  //
174  // sugary-sweet convenience functions to help create and apply edit commands in composite commands
175  //
176  void appendNode(DOM::NodeImpl *parent, DOM::NodeImpl *appendChild);
177  void applyCommandToComposite(PassRefPtr<EditCommandImpl>);
178  void deleteCollapsibleWhitespace();
179  void deleteCollapsibleWhitespace(const DOM::Selection &selection);
180  void deleteKeyPressed();
181  void deleteSelection();
182  void deleteSelection(const DOM::Selection &selection);
183  void deleteText(DOM::TextImpl *node, long offset, long count);
184  void inputText(const DOM::DOMString &text);
185  void insertNodeAfter(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild);
186  void insertNodeAt(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild, long offset);
187  void insertNodeBefore(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild);
188  void insertText(DOM::TextImpl *node, long offset, const DOM::DOMString &text);
189  void joinTextNodes(DOM::TextImpl *text1, DOM::TextImpl *text2);
190  void removeCSSProperty(DOM::CSSStyleDeclarationImpl *, int property);
191  void removeNodeAttribute(DOM::ElementImpl *, int attribute);
192  void removeNode(DOM::NodeImpl *removeChild);
193  void removeNodeAndPrune(DOM::NodeImpl *pruneNode, DOM::NodeImpl *stopNode = nullptr);
194  void removeNodePreservingChildren(DOM::NodeImpl *node);
195  void replaceText(DOM::TextImpl *node, long offset, long count, const DOM::DOMString &replacementText);
196  void setNodeAttribute(DOM::ElementImpl *, int attribute, const DOM::DOMString &);
197  void splitTextNode(DOM::TextImpl *text, long offset);
198 
199  DOM::ElementImpl *createTypingStyleElement() const;
200 
202 };
203 
204 //==========================================================================================
205 // Concrete commands
206 //------------------------------------------------------------------------------------------
207 // AppendNodeCommandImpl
208 
209 class AppendNodeCommandImpl : public EditCommandImpl
210 {
211 public:
212  AppendNodeCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *parentNode, DOM::NodeImpl *appendChild);
213  virtual ~AppendNodeCommandImpl();
214 
215  void doApply() override;
216  void doUnapply() override;
217 
218  DOM::NodeImpl *parentNode() const
219  {
220  return m_parentNode;
221  }
222  DOM::NodeImpl *appendChild() const
223  {
224  return m_appendChild;
225  }
226 
227 private:
228  DOM::NodeImpl *m_parentNode;
229  DOM::NodeImpl *m_appendChild;
230 };
231 
232 //------------------------------------------------------------------------------------------
233 // ApplyStyleCommandImpl
234 
235 class ApplyStyleCommandImpl : public CompositeEditCommandImpl
236 {
237 public:
238  ApplyStyleCommandImpl(DOM::DocumentImpl *, DOM::CSSStyleDeclarationImpl *style);
239  virtual ~ApplyStyleCommandImpl();
240 
241  void doApply() override;
242 
243  DOM::CSSStyleDeclarationImpl *style() const
244  {
245  return m_style;
246  }
247 
248  struct StyleChange {
249  StyleChange() : applyBold(false), applyItalic(false) {}
250  DOM::DOMString cssStyle;
251  bool applyBold: 1;
252  bool applyItalic: 1;
253  };
254 
255 private:
256  // style-removal helpers
257  bool isHTMLStyleNode(DOM::HTMLElementImpl *);
258  void removeHTMLStyleNode(DOM::HTMLElementImpl *);
259  void removeCSSStyle(DOM::HTMLElementImpl *);
260  void removeStyle(const DOM::Position &start, const DOM::Position &end);
261  bool nodeFullySelected(const DOM::NodeImpl *node) const;
262 
263  // style-application helpers
264  bool currentlyHasStyle(const DOM::Position &, const DOM::CSSProperty *) const;
265  StyleChange computeStyleChange(const DOM::Position &, DOM::CSSStyleDeclarationImpl *);
266  bool splitTextAtStartIfNeeded(const DOM::Position &start, const DOM::Position &end);
267  DOM::NodeImpl *splitTextAtEndIfNeeded(const DOM::Position &start, const DOM::Position &end);
268  void surroundNodeRangeWithElement(DOM::NodeImpl *start, DOM::NodeImpl *end, DOM::ElementImpl *element);
269  DOM::Position positionInsertionPoint(DOM::Position);
270  void applyStyleIfNeeded(DOM::NodeImpl *start, DOM::NodeImpl *end);
271 
272  DOM::CSSStyleDeclarationImpl *m_style;
273 };
274 
275 //------------------------------------------------------------------------------------------
276 // DeleteCollapsibleWhitespaceCommandImpl
277 
278 class DeleteCollapsibleWhitespaceCommandImpl : public CompositeEditCommandImpl
279 {
280 public:
281  DeleteCollapsibleWhitespaceCommandImpl(DOM::DocumentImpl *document);
282  DeleteCollapsibleWhitespaceCommandImpl(DOM::DocumentImpl *document, const DOM::Selection &selection);
283 
284  virtual ~DeleteCollapsibleWhitespaceCommandImpl();
285 
286  void doApply() override;
287 
288 private:
289  DOM::Position deleteWhitespace(const DOM::Position &pos);
290 
291  unsigned long m_charactersDeleted;
292  DOM::Selection m_selectionToCollapse;
293  bool m_hasSelectionToCollapse;
294 };
295 
296 //------------------------------------------------------------------------------------------
297 // DeleteSelectionCommandImpl
298 
299 class DeleteSelectionCommandImpl : public CompositeEditCommandImpl
300 {
301 public:
302  DeleteSelectionCommandImpl(DOM::DocumentImpl *document);
303  DeleteSelectionCommandImpl(DOM::DocumentImpl *document, const DOM::Selection &selection);
304 
305  virtual ~DeleteSelectionCommandImpl();
306 
307  void doApply() override;
308 
309 private:
310  void deleteContentBeforeOffset(NodeImpl *node, int offset);
311  void deleteContentAfterOffset(NodeImpl *node, int offset);
312  void deleteContentInsideNode(NodeImpl *node, int startOffset, int endOffset);
313  void deleteDownstreamWS(const DOM::Position &start);
314  bool containsOnlyWhitespace(const DOM::Position &start, const DOM::Position &end);
315  void joinTextNodesWithSameStyle();
316 
317  DOM::Selection m_selectionToDelete;
318  bool m_hasSelectionToDelete;
319 };
320 
321 //------------------------------------------------------------------------------------------
322 // DeleteTextCommandImpl
323 
324 class DeleteTextCommandImpl : public EditCommandImpl
325 {
326 public:
327  DeleteTextCommandImpl(DOM::DocumentImpl *document, DOM::TextImpl *node, long offset, long count);
328  virtual ~DeleteTextCommandImpl();
329 
330  void doApply() override;
331  void doUnapply() override;
332 
333  DOM::TextImpl *node() const
334  {
335  return m_node;
336  }
337  long offset() const
338  {
339  return m_offset;
340  }
341  long count() const
342  {
343  return m_count;
344  }
345 
346 private:
347  DOM::TextImpl *m_node;
348  long m_offset;
349  long m_count;
350  DOM::DOMString m_text;
351 };
352 
353 //------------------------------------------------------------------------------------------
354 // InputNewlineCommandImpl
355 
356 class InputNewlineCommandImpl : public CompositeEditCommandImpl
357 {
358 public:
359  InputNewlineCommandImpl(DOM::DocumentImpl *document);
360  virtual ~InputNewlineCommandImpl();
361 
362  void doApply() override;
363 
364 private:
365  void insertNodeAfterPosition(DOM::NodeImpl *node, const DOM::Position &pos);
366  void insertNodeBeforePosition(DOM::NodeImpl *node, const DOM::Position &pos);
367 };
368 
369 //------------------------------------------------------------------------------------------
370 // InputTextCommandImpl
371 
372 class InputTextCommandImpl : public CompositeEditCommandImpl
373 {
374 public:
375  InputTextCommandImpl(DOM::DocumentImpl *document);
376  virtual ~InputTextCommandImpl();
377 
378  void doApply() override;
379 
380  void deleteCharacter();
381  void input(const DOM::DOMString &text);
382 
383  unsigned long charactersAdded() const
384  {
385  return m_charactersAdded;
386  }
387 
388  bool isInputTextCommand() const override
389  {
390  return true;
391  }
392 private:
393  DOM::Position prepareForTextInsertion(bool adjustDownstream);
394  void execute(const DOM::DOMString &text);
395  void insertSpace(DOM::TextImpl *textNode, unsigned long offset);
396 
397  unsigned long m_charactersAdded;
398 };
399 
400 //------------------------------------------------------------------------------------------
401 // InsertNodeBeforeCommandImpl
402 
403 class InsertNodeBeforeCommandImpl : public EditCommandImpl
404 {
405 public:
406  InsertNodeBeforeCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild);
407  virtual ~InsertNodeBeforeCommandImpl();
408 
409  void doApply() override;
410  void doUnapply() override;
411 
412  DOM::NodeImpl *insertChild() const
413  {
414  return m_insertChild;
415  }
416  DOM::NodeImpl *refChild() const
417  {
418  return m_refChild;
419  }
420 
421 private:
422  DOM::NodeImpl *m_insertChild;
423  DOM::NodeImpl *m_refChild;
424 };
425 
426 //------------------------------------------------------------------------------------------
427 // InsertTextCommandImpl
428 
429 class InsertTextCommandImpl : public EditCommandImpl
430 {
431 public:
432  InsertTextCommandImpl(DOM::DocumentImpl *document, DOM::TextImpl *, long, const DOM::DOMString &);
433  virtual ~InsertTextCommandImpl();
434 
435  void doApply() override;
436  void doUnapply() override;
437 
438  DOM::TextImpl *node() const
439  {
440  return m_node;
441  }
442  long offset() const
443  {
444  return m_offset;
445  }
446  DOM::DOMString text() const
447  {
448  return m_text;
449  }
450 
451 private:
452  DOM::TextImpl *m_node;
453  long m_offset;
454  DOM::DOMString m_text;
455 };
456 
457 //------------------------------------------------------------------------------------------
458 // JoinTextNodesCommandImpl
459 
460 class JoinTextNodesCommandImpl : public EditCommandImpl
461 {
462 public:
463  JoinTextNodesCommandImpl(DOM::DocumentImpl *, DOM::TextImpl *, DOM::TextImpl *);
464  virtual ~JoinTextNodesCommandImpl();
465 
466  void doApply() override;
467  void doUnapply() override;
468 
469  DOM::TextImpl *firstNode() const
470  {
471  return m_text1;
472  }
473  DOM::TextImpl *secondNode() const
474  {
475  return m_text2;
476  }
477 
478 private:
479  DOM::TextImpl *m_text1;
480  DOM::TextImpl *m_text2;
481  unsigned long m_offset;
482 };
483 
484 //------------------------------------------------------------------------------------------
485 // ReplaceSelectionCommandImpl
486 
487 class ReplaceSelectionCommandImpl : public CompositeEditCommandImpl
488 {
489 public:
490  ReplaceSelectionCommandImpl(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, bool selectReplacement = true);
491  virtual ~ReplaceSelectionCommandImpl();
492 
493  void doApply() override;
494 
495 private:
496  DOM::DocumentFragmentImpl *m_fragment;
497  bool m_selectReplacement;
498 };
499 
500 //------------------------------------------------------------------------------------------
501 // MoveSelectionCommandImpl
502 
503 class MoveSelectionCommandImpl : public CompositeEditCommandImpl
504 {
505 public:
506  MoveSelectionCommandImpl(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position);
507  virtual ~MoveSelectionCommandImpl();
508 
509  void doApply() override;
510 
511 private:
512  DOM::DocumentFragmentImpl *m_fragment;
513  DOM::Position m_position;
514 };
515 
516 //------------------------------------------------------------------------------------------
517 // RemoveCSSPropertyCommand
518 
519 class RemoveCSSPropertyCommandImpl : public EditCommandImpl
520 {
521 public:
522  RemoveCSSPropertyCommandImpl(DOM::DocumentImpl *, DOM::CSSStyleDeclarationImpl *, int property);
523  virtual ~RemoveCSSPropertyCommandImpl();
524 
525  void doApply() override;
526  void doUnapply() override;
527 
528  DOM::CSSStyleDeclarationImpl *styleDeclaration() const
529  {
530  return m_decl;
531  }
532  int property() const
533  {
534  return m_property;
535  }
536 
537 private:
538  DOM::CSSStyleDeclarationImpl *m_decl;
539  int m_property;
540  DOM::DOMString m_oldValue;
541  bool m_important;
542 };
543 
544 //------------------------------------------------------------------------------------------
545 // RemoveNodeAttributeCommandImpl
546 
547 class RemoveNodeAttributeCommandImpl : public EditCommandImpl
548 {
549 public:
550  RemoveNodeAttributeCommandImpl(DOM::DocumentImpl *, DOM::ElementImpl *, DOM::NodeImpl::Id attribute);
551  virtual ~RemoveNodeAttributeCommandImpl();
552 
553  void doApply() override;
554  void doUnapply() override;
555 
556  DOM::ElementImpl *element() const
557  {
558  return m_element;
559  }
560  DOM::NodeImpl::Id attribute() const
561  {
562  return m_attribute;
563  }
564 
565 private:
566  DOM::ElementImpl *m_element;
567  DOM::NodeImpl::Id m_attribute;
568  DOM::DOMString m_oldValue;
569 };
570 
571 //------------------------------------------------------------------------------------------
572 // RemoveNodeCommandImpl
573 
574 class RemoveNodeCommandImpl : public EditCommandImpl
575 {
576 public:
577  RemoveNodeCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *);
578  virtual ~RemoveNodeCommandImpl();
579 
580  void doApply() override;
581  void doUnapply() override;
582 
583  DOM::NodeImpl *node() const
584  {
585  return m_removeChild;
586  }
587 
588 private:
589  DOM::NodeImpl *m_parent;
590  DOM::NodeImpl *m_removeChild;
591  DOM::NodeImpl *m_refChild;
592 };
593 
594 //------------------------------------------------------------------------------------------
595 // RemoveNodeAndPruneCommandImpl
596 
597 class RemoveNodeAndPruneCommandImpl : public CompositeEditCommandImpl
598 {
599 public:
600  RemoveNodeAndPruneCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *pruneNode, DOM::NodeImpl *stopNode = nullptr);
601  virtual ~RemoveNodeAndPruneCommandImpl();
602 
603  void doApply() override;
604 
605  DOM::NodeImpl *pruneNode() const
606  {
607  return m_pruneNode;
608  }
609  DOM::NodeImpl *stopNode() const
610  {
611  return m_stopNode;
612  }
613 
614 private:
615  DOM::NodeImpl *m_pruneNode;
616  DOM::NodeImpl *m_stopNode;
617 };
618 
619 //------------------------------------------------------------------------------------------
620 // RemoveNodePreservingChildrenCommandImpl
621 
622 class RemoveNodePreservingChildrenCommandImpl : public CompositeEditCommandImpl
623 {
624 public:
625  RemoveNodePreservingChildrenCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *);
626  virtual ~RemoveNodePreservingChildrenCommandImpl();
627 
628  void doApply() override;
629 
630  DOM::NodeImpl *node() const
631  {
632  return m_node;
633  }
634 
635 private:
636  DOM::NodeImpl *m_node;
637 };
638 
639 //------------------------------------------------------------------------------------------
640 // SetNodeAttributeCommandImpl
641 
642 class SetNodeAttributeCommandImpl : public EditCommandImpl
643 {
644 public:
645  SetNodeAttributeCommandImpl(DOM::DocumentImpl *, DOM::ElementImpl *, DOM::NodeImpl::Id attribute, const DOM::DOMString &value);
646  virtual ~SetNodeAttributeCommandImpl();
647 
648  void doApply() override;
649  void doUnapply() override;
650 
651  DOM::ElementImpl *element() const
652  {
653  return m_element;
654  }
655  DOM::NodeImpl::Id attribute() const
656  {
657  return m_attribute;
658  }
659  DOM::DOMString value() const
660  {
661  return m_value;
662  }
663 
664 private:
665  DOM::ElementImpl *m_element;
666  DOM::NodeImpl::Id m_attribute;
667  DOM::DOMString m_value;
668  DOM::DOMString m_oldValue;
669 };
670 
671 //------------------------------------------------------------------------------------------
672 // SplitTextNodeCommandImpl
673 
674 class SplitTextNodeCommandImpl : public EditCommandImpl
675 {
676 public:
677  SplitTextNodeCommandImpl(DOM::DocumentImpl *, DOM::TextImpl *, long);
678  virtual ~SplitTextNodeCommandImpl();
679 
680  void doApply() override;
681  void doUnapply() override;
682 
683  DOM::TextImpl *node() const
684  {
685  return m_text2;
686  }
687  long offset() const
688  {
689  return m_offset;
690  }
691 
692 private:
693  DOM::TextImpl *m_text1;
694  DOM::TextImpl *m_text2;
695  unsigned long m_offset;
696 };
697 
698 //------------------------------------------------------------------------------------------
699 // TypingCommandImpl
700 
701 class TypingCommandImpl : public CompositeEditCommandImpl
702 {
703 public:
704  TypingCommandImpl(DOM::DocumentImpl *document);
705  virtual ~TypingCommandImpl();
706 
707  void doApply() override;
708 
709  bool openForMoreTyping() const
710  {
711  return m_openForMoreTyping;
712  }
713  void closeTyping()
714  {
715  m_openForMoreTyping = false;
716  }
717 
718  void insertText(const DOM::DOMString &text);
719  void insertNewline();
720  void deleteKeyPressed();
721 
722  bool isTypingCommand() const override
723  {
724  return true;
725  }
726 
727  static void deleteKeyPressed0(DocumentImpl *document);
728  static void insertNewline0(DocumentImpl *document);
729  static void insertText0(DocumentImpl *document, const DOMString &text);
730 
731 private:
732  void issueCommandForDeleteKey();
733  void removeCommand(const PassRefPtr<EditCommandImpl>);
734  void typingAddedToOpenCommand();
735 
736  bool m_openForMoreTyping;
737 };
738 
739 //------------------------------------------------------------------------------------------
740 // InsertListCommandImpl
741 
742 class InsertListCommandImpl : public CompositeEditCommandImpl
743 {
744 public:
745  enum Type { OrderedList, UnorderedList };
746 
747  InsertListCommandImpl(DOM::DocumentImpl *document, Type type);
748  virtual ~InsertListCommandImpl();
749 
750  void doApply() override;
751 
752  static void insertList(DocumentImpl *document, Type type);
753 
754 private:
755  Type m_listType;
756 };
757 
758 //------------------------------------------------------------------------------------------
759 
760 //------------------------------------------------------------------------------------------
761 // IndentOutdentCommandImpl
762 
763 class IndentOutdentCommandImpl : public CompositeEditCommandImpl
764 {
765 public:
766  enum Type { Indent, Outdent };
767 
768  IndentOutdentCommandImpl(DocumentImpl *document, Type type);
769  virtual ~IndentOutdentCommandImpl();
770 
771  void doApply() override;
772 
773 private:
774  void indent();
775  void outdent();
776 
777  Type m_commandType;
778 };
779 
780 //------------------------------------------------------------------------------------------
781 
782 } // end namespace khtml
783 
784 #endif
785 
This file is part of the HTML rendering engine for KDE.
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This library provides a full-featured HTML parser and widget.
KGuiItem apply()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.