KHTML
htmlediting_impl.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 1. Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * 2. Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * 00013 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 00014 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00016 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 00017 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00018 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00019 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00020 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00021 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00022 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00023 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 */ 00025 00026 #ifndef __htmleditingimpl_h__ 00027 #define __htmleditingimpl_h__ 00028 00029 #include "misc/shared.h" 00030 00031 #include "xml/dom_position.h" 00032 #include "xml/dom_selection.h" 00033 #include "dom/dom_string.h" 00034 00035 #include "xml/dom_nodeimpl.h" 00036 00037 #include <QList> 00038 00039 namespace DOM { 00040 class CSSProperty; 00041 class CSSStyleDeclarationImpl; 00042 class DocumentFragmentImpl; 00043 class DocumentImpl; 00044 class DOMString; 00045 class ElementImpl; 00046 class HTMLElementImpl; 00047 class NodeImpl; 00048 class NodeListImpl; 00049 class Position; 00050 class Range; 00051 class Selection; 00052 class TextImpl; 00053 class TreeWalkerImpl; 00054 } 00055 00056 using DOM::DocumentImpl; 00057 using DOM::NodeImpl; 00058 00059 namespace khtml 00060 { 00061 00062 class EditCommandImpl; 00063 00064 class SharedCommandImpl : public Shared<SharedCommandImpl> 00065 { 00066 public: 00067 SharedCommandImpl() {} 00068 virtual ~SharedCommandImpl() {} 00069 00070 virtual bool isCompositeStep() const = 0; 00071 00072 virtual void apply() = 0; 00073 virtual void unapply() = 0; 00074 virtual void reapply() = 0; 00075 00076 virtual DOM::DocumentImpl* document() const = 0; 00077 00078 virtual DOM::Selection startingSelection() const = 0; 00079 virtual DOM::Selection endingSelection() const = 0; 00080 00081 virtual void setStartingSelection(const DOM::Selection &s) = 0; 00082 virtual void setEndingSelection(const DOM::Selection &s) = 0; 00083 00084 virtual EditCommandImpl* parent() const = 0; 00085 virtual void setParent(EditCommandImpl *) = 0; 00086 }; 00087 00088 //------------------------------------------------------------------------------------------ 00089 // EditCommandImpl 00090 00091 class EditCommandImpl : public SharedCommandImpl 00092 { 00093 public: 00094 EditCommandImpl(DOM::DocumentImpl *); 00095 virtual ~EditCommandImpl(); 00096 00097 bool isCompositeStep() const { return parent(); } 00098 EditCommandImpl* parent() const; 00099 void setParent(EditCommandImpl *); 00100 00101 enum ECommandState { NotApplied, Applied }; 00102 00103 void apply(); 00104 void unapply(); 00105 void reapply(); 00106 00107 virtual void doApply() = 0; 00108 virtual void doUnapply() = 0; 00109 virtual void doReapply(); // calls doApply() 00110 00111 virtual DOM::DocumentImpl* document() const { return m_document.get(); } 00112 00113 DOM::Selection startingSelection() const { return m_startingSelection; } 00114 DOM::Selection endingSelection() const { return m_endingSelection; } 00115 00116 ECommandState state() const { return m_state; } 00117 void setState(ECommandState state) { m_state = state; } 00118 00119 void setStartingSelection(const DOM::Selection &s); 00120 void setEndingSelection(const DOM::Selection &s); 00121 00122 public: 00123 virtual bool isTypingCommand() const { return false; } 00124 virtual bool isInputTextCommand() const { return false; } 00125 00126 private: 00127 DocPtr<DOM::DocumentImpl> m_document; 00128 ECommandState m_state; 00129 DOM::Selection m_startingSelection; 00130 DOM::Selection m_endingSelection; 00131 RefPtr<EditCommandImpl> m_parent; 00132 }; 00133 00134 //------------------------------------------------------------------------------------------ 00135 // CompositeEditCommandImpl 00136 00137 class CompositeEditCommandImpl : public EditCommandImpl 00138 { 00139 public: 00140 CompositeEditCommandImpl(DOM::DocumentImpl *); 00141 virtual ~CompositeEditCommandImpl(); 00142 00143 virtual void doApply() = 0; 00144 virtual void doUnapply(); 00145 virtual void doReapply(); 00146 00147 protected: 00148 // 00149 // sugary-sweet convenience functions to help create and apply edit commands in composite commands 00150 // 00151 void appendNode(DOM::NodeImpl *parent, DOM::NodeImpl *appendChild); 00152 void applyCommandToComposite(PassRefPtr<EditCommandImpl>); 00153 void deleteCollapsibleWhitespace(); 00154 void deleteCollapsibleWhitespace(const DOM::Selection &selection); 00155 void deleteKeyPressed(); 00156 void deleteSelection(); 00157 void deleteSelection(const DOM::Selection &selection); 00158 void deleteText(DOM::TextImpl *node, long offset, long count); 00159 void inputText(const DOM::DOMString &text); 00160 void insertNodeAfter(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild); 00161 void insertNodeAt(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild, long offset); 00162 void insertNodeBefore(DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild); 00163 void insertText(DOM::TextImpl *node, long offset, const DOM::DOMString &text); 00164 void joinTextNodes(DOM::TextImpl *text1, DOM::TextImpl *text2); 00165 void removeCSSProperty(DOM::CSSStyleDeclarationImpl *, int property); 00166 void removeNodeAttribute(DOM::ElementImpl *, int attribute); 00167 void removeNode(DOM::NodeImpl *removeChild); 00168 void removeNodeAndPrune(DOM::NodeImpl *pruneNode, DOM::NodeImpl *stopNode=0); 00169 void removeNodePreservingChildren(DOM::NodeImpl *node); 00170 void replaceText(DOM::TextImpl *node, long offset, long count, const DOM::DOMString &replacementText); 00171 void setNodeAttribute(DOM::ElementImpl *, int attribute, const DOM::DOMString &); 00172 void splitTextNode(DOM::TextImpl *text, long offset); 00173 00174 DOM::ElementImpl *createTypingStyleElement() const; 00175 00176 QList<RefPtr<EditCommandImpl> > m_cmds; 00177 }; 00178 00179 //========================================================================================== 00180 // Concrete commands 00181 //------------------------------------------------------------------------------------------ 00182 // AppendNodeCommandImpl 00183 00184 class AppendNodeCommandImpl : public EditCommandImpl 00185 { 00186 public: 00187 AppendNodeCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *parentNode, DOM::NodeImpl *appendChild); 00188 virtual ~AppendNodeCommandImpl(); 00189 00190 virtual void doApply(); 00191 virtual void doUnapply(); 00192 00193 DOM::NodeImpl *parentNode() const { return m_parentNode; } 00194 DOM::NodeImpl *appendChild() const { return m_appendChild; } 00195 00196 private: 00197 DOM::NodeImpl *m_parentNode; 00198 DOM::NodeImpl *m_appendChild; 00199 }; 00200 00201 //------------------------------------------------------------------------------------------ 00202 // ApplyStyleCommandImpl 00203 00204 class ApplyStyleCommandImpl : public CompositeEditCommandImpl 00205 { 00206 public: 00207 ApplyStyleCommandImpl(DOM::DocumentImpl *, DOM::CSSStyleDeclarationImpl *style); 00208 virtual ~ApplyStyleCommandImpl(); 00209 00210 virtual void doApply(); 00211 00212 DOM::CSSStyleDeclarationImpl *style() const { return m_style; } 00213 00214 struct StyleChange { 00215 StyleChange() : applyBold(false), applyItalic(false) {} 00216 DOM::DOMString cssStyle; 00217 bool applyBold:1; 00218 bool applyItalic:1; 00219 }; 00220 00221 private: 00222 // style-removal helpers 00223 bool isHTMLStyleNode(DOM::HTMLElementImpl *); 00224 void removeHTMLStyleNode(DOM::HTMLElementImpl *); 00225 void removeCSSStyle(DOM::HTMLElementImpl *); 00226 void removeStyle(const DOM::Position &start, const DOM::Position &end); 00227 bool nodeFullySelected(const DOM::NodeImpl *node) const; 00228 00229 // style-application helpers 00230 bool currentlyHasStyle(const DOM::Position &, const DOM::CSSProperty *) const; 00231 StyleChange computeStyleChange(const DOM::Position &, DOM::CSSStyleDeclarationImpl *); 00232 bool splitTextAtStartIfNeeded(const DOM::Position &start, const DOM::Position &end); 00233 DOM::NodeImpl *splitTextAtEndIfNeeded(const DOM::Position &start, const DOM::Position &end); 00234 void surroundNodeRangeWithElement(DOM::NodeImpl *start, DOM::NodeImpl *end, DOM::ElementImpl *element); 00235 DOM::Position positionInsertionPoint(DOM::Position); 00236 void applyStyleIfNeeded(DOM::NodeImpl *start, DOM::NodeImpl *end); 00237 00238 DOM::CSSStyleDeclarationImpl *m_style; 00239 }; 00240 00241 //------------------------------------------------------------------------------------------ 00242 // DeleteCollapsibleWhitespaceCommandImpl 00243 00244 class DeleteCollapsibleWhitespaceCommandImpl : public CompositeEditCommandImpl 00245 { 00246 public: 00247 DeleteCollapsibleWhitespaceCommandImpl(DOM::DocumentImpl *document); 00248 DeleteCollapsibleWhitespaceCommandImpl(DOM::DocumentImpl *document, const DOM::Selection &selection); 00249 00250 virtual ~DeleteCollapsibleWhitespaceCommandImpl(); 00251 00252 virtual void doApply(); 00253 00254 private: 00255 DOM::Position deleteWhitespace(const DOM::Position &pos); 00256 00257 unsigned long m_charactersDeleted; 00258 DOM::Selection m_selectionToCollapse; 00259 bool m_hasSelectionToCollapse; 00260 }; 00261 00262 //------------------------------------------------------------------------------------------ 00263 // DeleteSelectionCommandImpl 00264 00265 class DeleteSelectionCommandImpl : public CompositeEditCommandImpl 00266 { 00267 public: 00268 DeleteSelectionCommandImpl(DOM::DocumentImpl *document); 00269 DeleteSelectionCommandImpl(DOM::DocumentImpl *document, const DOM::Selection &selection); 00270 00271 virtual ~DeleteSelectionCommandImpl(); 00272 00273 virtual void doApply(); 00274 00275 private: 00276 void deleteContentBeforeOffset(NodeImpl *node, int offset); 00277 void deleteContentAfterOffset(NodeImpl *node, int offset); 00278 void deleteContentInsideNode(NodeImpl *node, int startOffset, int endOffset); 00279 void deleteDownstreamWS(const DOM::Position &start); 00280 bool containsOnlyWhitespace(const DOM::Position &start, const DOM::Position &end); 00281 void joinTextNodesWithSameStyle(); 00282 00283 DOM::Selection m_selectionToDelete; 00284 bool m_hasSelectionToDelete; 00285 }; 00286 00287 //------------------------------------------------------------------------------------------ 00288 // DeleteTextCommandImpl 00289 00290 class DeleteTextCommandImpl : public EditCommandImpl 00291 { 00292 public: 00293 DeleteTextCommandImpl(DOM::DocumentImpl *document, DOM::TextImpl *node, long offset, long count); 00294 virtual ~DeleteTextCommandImpl(); 00295 00296 virtual void doApply(); 00297 virtual void doUnapply(); 00298 00299 DOM::TextImpl *node() const { return m_node; } 00300 long offset() const { return m_offset; } 00301 long count() const { return m_count; } 00302 00303 private: 00304 DOM::TextImpl *m_node; 00305 long m_offset; 00306 long m_count; 00307 DOM::DOMString m_text; 00308 }; 00309 00310 //------------------------------------------------------------------------------------------ 00311 // InputNewlineCommandImpl 00312 00313 class InputNewlineCommandImpl : public CompositeEditCommandImpl 00314 { 00315 public: 00316 InputNewlineCommandImpl(DOM::DocumentImpl *document); 00317 virtual ~InputNewlineCommandImpl(); 00318 00319 virtual void doApply(); 00320 00321 private: 00322 void insertNodeAfterPosition(DOM::NodeImpl *node, const DOM::Position &pos); 00323 void insertNodeBeforePosition(DOM::NodeImpl *node, const DOM::Position &pos); 00324 }; 00325 00326 //------------------------------------------------------------------------------------------ 00327 // InputTextCommandImpl 00328 00329 class InputTextCommandImpl : public CompositeEditCommandImpl 00330 { 00331 public: 00332 InputTextCommandImpl(DOM::DocumentImpl *document); 00333 virtual ~InputTextCommandImpl(); 00334 00335 virtual void doApply(); 00336 00337 void deleteCharacter(); 00338 void input(const DOM::DOMString &text); 00339 00340 unsigned long charactersAdded() const { return m_charactersAdded; } 00341 00342 virtual bool isInputTextCommand() const { return true; } 00343 private: 00344 DOM::Position prepareForTextInsertion(bool adjustDownstream); 00345 void execute(const DOM::DOMString &text); 00346 void insertSpace(DOM::TextImpl *textNode, unsigned long offset); 00347 00348 unsigned long m_charactersAdded; 00349 }; 00350 00351 //------------------------------------------------------------------------------------------ 00352 // InsertNodeBeforeCommandImpl 00353 00354 class InsertNodeBeforeCommandImpl : public EditCommandImpl 00355 { 00356 public: 00357 InsertNodeBeforeCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *insertChild, DOM::NodeImpl *refChild); 00358 virtual ~InsertNodeBeforeCommandImpl(); 00359 00360 virtual void doApply(); 00361 virtual void doUnapply(); 00362 00363 DOM::NodeImpl *insertChild() const { return m_insertChild; } 00364 DOM::NodeImpl *refChild() const { return m_refChild; } 00365 00366 private: 00367 DOM::NodeImpl *m_insertChild; 00368 DOM::NodeImpl *m_refChild; 00369 }; 00370 00371 //------------------------------------------------------------------------------------------ 00372 // InsertTextCommandImpl 00373 00374 class InsertTextCommandImpl : public EditCommandImpl 00375 { 00376 public: 00377 InsertTextCommandImpl(DOM::DocumentImpl *document, DOM::TextImpl *, long, const DOM::DOMString &); 00378 virtual ~InsertTextCommandImpl(); 00379 00380 virtual void doApply(); 00381 virtual void doUnapply(); 00382 00383 DOM::TextImpl *node() const { return m_node; } 00384 long offset() const { return m_offset; } 00385 DOM::DOMString text() const { return m_text; } 00386 00387 private: 00388 DOM::TextImpl *m_node; 00389 long m_offset; 00390 DOM::DOMString m_text; 00391 }; 00392 00393 //------------------------------------------------------------------------------------------ 00394 // JoinTextNodesCommandImpl 00395 00396 class JoinTextNodesCommandImpl : public EditCommandImpl 00397 { 00398 public: 00399 JoinTextNodesCommandImpl(DOM::DocumentImpl *, DOM::TextImpl *, DOM::TextImpl *); 00400 virtual ~JoinTextNodesCommandImpl(); 00401 00402 virtual void doApply(); 00403 virtual void doUnapply(); 00404 00405 DOM::TextImpl *firstNode() const { return m_text1; } 00406 DOM::TextImpl *secondNode() const { return m_text2; } 00407 00408 private: 00409 DOM::TextImpl *m_text1; 00410 DOM::TextImpl *m_text2; 00411 unsigned long m_offset; 00412 }; 00413 00414 //------------------------------------------------------------------------------------------ 00415 // ReplaceSelectionCommandImpl 00416 00417 class ReplaceSelectionCommandImpl : public CompositeEditCommandImpl 00418 { 00419 public: 00420 ReplaceSelectionCommandImpl(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, bool selectReplacement=true); 00421 virtual ~ReplaceSelectionCommandImpl(); 00422 00423 virtual void doApply(); 00424 00425 private: 00426 DOM::DocumentFragmentImpl *m_fragment; 00427 bool m_selectReplacement; 00428 }; 00429 00430 //------------------------------------------------------------------------------------------ 00431 // MoveSelectionCommandImpl 00432 00433 class MoveSelectionCommandImpl : public CompositeEditCommandImpl 00434 { 00435 public: 00436 MoveSelectionCommandImpl(DOM::DocumentImpl *document, DOM::DocumentFragmentImpl *fragment, DOM::Position &position); 00437 virtual ~MoveSelectionCommandImpl(); 00438 00439 virtual void doApply(); 00440 00441 private: 00442 DOM::DocumentFragmentImpl *m_fragment; 00443 DOM::Position m_position; 00444 }; 00445 00446 //------------------------------------------------------------------------------------------ 00447 // RemoveCSSPropertyCommand 00448 00449 class RemoveCSSPropertyCommandImpl : public EditCommandImpl 00450 { 00451 public: 00452 RemoveCSSPropertyCommandImpl(DOM::DocumentImpl *, DOM::CSSStyleDeclarationImpl *, int property); 00453 virtual ~RemoveCSSPropertyCommandImpl(); 00454 00455 virtual void doApply(); 00456 virtual void doUnapply(); 00457 00458 DOM::CSSStyleDeclarationImpl *styleDeclaration() const { return m_decl; } 00459 int property() const { return m_property; } 00460 00461 private: 00462 DOM::CSSStyleDeclarationImpl *m_decl; 00463 int m_property; 00464 DOM::DOMString m_oldValue; 00465 bool m_important; 00466 }; 00467 00468 //------------------------------------------------------------------------------------------ 00469 // RemoveNodeAttributeCommandImpl 00470 00471 class RemoveNodeAttributeCommandImpl : public EditCommandImpl 00472 { 00473 public: 00474 RemoveNodeAttributeCommandImpl(DOM::DocumentImpl *, DOM::ElementImpl *, DOM::NodeImpl::Id attribute); 00475 virtual ~RemoveNodeAttributeCommandImpl(); 00476 00477 virtual void doApply(); 00478 virtual void doUnapply(); 00479 00480 DOM::ElementImpl *element() const { return m_element; } 00481 DOM::NodeImpl::Id attribute() const { return m_attribute; } 00482 00483 private: 00484 DOM::ElementImpl *m_element; 00485 DOM::NodeImpl::Id m_attribute; 00486 DOM::DOMString m_oldValue; 00487 }; 00488 00489 //------------------------------------------------------------------------------------------ 00490 // RemoveNodeCommandImpl 00491 00492 class RemoveNodeCommandImpl : public EditCommandImpl 00493 { 00494 public: 00495 RemoveNodeCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *); 00496 virtual ~RemoveNodeCommandImpl(); 00497 00498 virtual void doApply(); 00499 virtual void doUnapply(); 00500 00501 DOM::NodeImpl *node() const { return m_removeChild; } 00502 00503 private: 00504 DOM::NodeImpl *m_parent; 00505 DOM::NodeImpl *m_removeChild; 00506 DOM::NodeImpl *m_refChild; 00507 }; 00508 00509 //------------------------------------------------------------------------------------------ 00510 // RemoveNodeAndPruneCommandImpl 00511 00512 class RemoveNodeAndPruneCommandImpl : public CompositeEditCommandImpl 00513 { 00514 public: 00515 RemoveNodeAndPruneCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *pruneNode, DOM::NodeImpl *stopNode=0); 00516 virtual ~RemoveNodeAndPruneCommandImpl(); 00517 00518 virtual void doApply(); 00519 00520 DOM::NodeImpl *pruneNode() const { return m_pruneNode; } 00521 DOM::NodeImpl *stopNode() const { return m_stopNode; } 00522 00523 private: 00524 DOM::NodeImpl *m_pruneNode; 00525 DOM::NodeImpl *m_stopNode; 00526 }; 00527 00528 //------------------------------------------------------------------------------------------ 00529 // RemoveNodePreservingChildrenCommandImpl 00530 00531 class RemoveNodePreservingChildrenCommandImpl : public CompositeEditCommandImpl 00532 { 00533 public: 00534 RemoveNodePreservingChildrenCommandImpl(DOM::DocumentImpl *, DOM::NodeImpl *); 00535 virtual ~RemoveNodePreservingChildrenCommandImpl(); 00536 00537 virtual void doApply(); 00538 00539 DOM::NodeImpl *node() const { return m_node; } 00540 00541 private: 00542 DOM::NodeImpl *m_node; 00543 }; 00544 00545 //------------------------------------------------------------------------------------------ 00546 // SetNodeAttributeCommandImpl 00547 00548 class SetNodeAttributeCommandImpl : public EditCommandImpl 00549 { 00550 public: 00551 SetNodeAttributeCommandImpl(DOM::DocumentImpl *, DOM::ElementImpl *, DOM::NodeImpl::Id attribute, const DOM::DOMString &value); 00552 virtual ~SetNodeAttributeCommandImpl(); 00553 00554 virtual void doApply(); 00555 virtual void doUnapply(); 00556 00557 DOM::ElementImpl *element() const { return m_element; } 00558 DOM::NodeImpl::Id attribute() const { return m_attribute; } 00559 DOM::DOMString value() const { return m_value; } 00560 00561 private: 00562 DOM::ElementImpl *m_element; 00563 DOM::NodeImpl::Id m_attribute; 00564 DOM::DOMString m_value; 00565 DOM::DOMString m_oldValue; 00566 }; 00567 00568 //------------------------------------------------------------------------------------------ 00569 // SplitTextNodeCommandImpl 00570 00571 class SplitTextNodeCommandImpl : public EditCommandImpl 00572 { 00573 public: 00574 SplitTextNodeCommandImpl(DOM::DocumentImpl *, DOM::TextImpl *, long); 00575 virtual ~SplitTextNodeCommandImpl(); 00576 00577 virtual void doApply(); 00578 virtual void doUnapply(); 00579 00580 DOM::TextImpl *node() const { return m_text2; } 00581 long offset() const { return m_offset; } 00582 00583 private: 00584 DOM::TextImpl *m_text1; 00585 DOM::TextImpl *m_text2; 00586 unsigned long m_offset; 00587 }; 00588 00589 //------------------------------------------------------------------------------------------ 00590 // TypingCommandImpl 00591 00592 class TypingCommandImpl : public CompositeEditCommandImpl 00593 { 00594 public: 00595 TypingCommandImpl(DOM::DocumentImpl *document); 00596 virtual ~TypingCommandImpl(); 00597 00598 virtual void doApply(); 00599 00600 bool openForMoreTyping() const { return m_openForMoreTyping; } 00601 void closeTyping() { m_openForMoreTyping = false; } 00602 00603 void insertText(const DOM::DOMString &text); 00604 void insertNewline(); 00605 void deleteKeyPressed(); 00606 00607 virtual bool isTypingCommand() const { return true; } 00608 00609 static void deleteKeyPressed0(DocumentImpl *document); 00610 static void insertNewline0(DocumentImpl *document); 00611 static void insertText0(DocumentImpl *document, const DOMString &text); 00612 00613 private: 00614 void issueCommandForDeleteKey(); 00615 void removeCommand(const PassRefPtr<EditCommandImpl>); 00616 void typingAddedToOpenCommand(); 00617 00618 bool m_openForMoreTyping; 00619 }; 00620 00621 //------------------------------------------------------------------------------------------ 00622 // InsertListCommandImpl 00623 00624 class InsertListCommandImpl : public CompositeEditCommandImpl 00625 { 00626 public: 00627 enum Type { OrderedList, UnorderedList }; 00628 00629 InsertListCommandImpl(DOM::DocumentImpl *document, Type type); 00630 virtual ~InsertListCommandImpl(); 00631 00632 virtual void doApply(); 00633 00634 static void insertList(DocumentImpl *document, Type type); 00635 00636 private: 00637 Type m_listType; 00638 }; 00639 00640 //------------------------------------------------------------------------------------------ 00641 00642 //------------------------------------------------------------------------------------------ 00643 // IndentOutdentCommandImpl 00644 00645 class IndentOutdentCommandImpl : public CompositeEditCommandImpl 00646 { 00647 public: 00648 enum Type { Indent, Outdent }; 00649 00650 IndentOutdentCommandImpl(DocumentImpl *document, Type type); 00651 virtual ~IndentOutdentCommandImpl(); 00652 00653 virtual void doApply(); 00654 00655 private: 00656 void indent(); 00657 void outdent(); 00658 00659 Type m_commandType; 00660 }; 00661 00662 //------------------------------------------------------------------------------------------ 00663 00664 } // end namespace khtml 00665 00666 #endif 00667
KDE 4.6 API Reference