• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • editing
editor.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2004 Leo Savernik <l.savernik@aon.at>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #include "editor.h"
22 
23 #include "jsediting.h"
24 #include "htmlediting_impl.h"
25 
26 #include "css/css_renderstyledeclarationimpl.h"
27 #include "css/css_valueimpl.h"
28 #include "xml/dom_selection.h"
29 #include "xml/dom_docimpl.h"
30 #include "xml/dom_elementimpl.h"
31 #include "xml/dom_textimpl.h"
32 #include "xml/dom2_rangeimpl.h"
33 #include "khtml_part.h"
34 #include "khtml_ext.h"
35 #include "khtmlpart_p.h"
36 
37 #include <QStack>
38 
39 #ifndef APPLE_CHANGES
40 # ifdef assert
41 # undef assert
42 # endif
43 # define assert(x) Q_ASSERT(x)
44 #endif
45 
46 #define PREPARE_JSEDITOR_CALL(command, retval) \
47  JSEditor *js = m_part->xmlDocImpl() ? m_part->xmlDocImpl()->jsEditor() : 0; \
48  if (!js) return retval; \
49  const CommandImp *imp = js->commandImp(command)
50 
51 #define DEBUG_COMMANDS
52 
53 using namespace WTF;
54 
55 using namespace DOM;
56 
57 using khtml::RenderStyleDeclarationImpl;
58 using khtml::EditCommandImpl;
59 using khtml::ApplyStyleCommandImpl;
60 using khtml::TypingCommandImpl;
61 using khtml::EditorContext;
62 using khtml::IndentOutdentCommandImpl;
63 
64 // --------------------------------------------------------------------------
65 
66 namespace DOM {
67 
68 static const int sMaxUndoSteps = 1000;
69 
70 class EditorPrivate {
71  public:
72  void registerUndo(EditCommandImpl *cmd, bool clearRedoStack = true) {
73  if (m_undo.count()>= sMaxUndoSteps)
74  m_undo.pop_front();
75  if (clearRedoStack)
76  m_redo.clear();
77  m_undo.push(cmd);
78  }
79  void registerRedo(EditCommandImpl *cmd) {
80  if (m_redo.count()>= sMaxUndoSteps)
81  m_redo.pop_front();
82  m_redo.push(cmd);
83  }
84  RefPtr<EditCommandImpl> m_lastEditCommand;
85  QStack<RefPtr<EditCommandImpl> > m_undo;
86  QStack<RefPtr<EditCommandImpl> > m_redo;
87 };
88 
89 }
90 
91 // ==========================================================================
92 
93 Editor::Editor(KHTMLPart *part)
94  : d(new EditorPrivate), m_typingStyle(0), m_part(part) {
95 }
96 
97 Editor::~Editor() {
98  if (m_typingStyle)
99  m_typingStyle->deref();
100  delete d;
101 }
102 
103 bool Editor::execCommand(const DOMString &command, bool userInterface, const DOMString &value)
104 {
105  PREPARE_JSEDITOR_CALL(command, false);
106  return js->execCommand(imp, userInterface, value);
107 }
108 
109 bool Editor::queryCommandEnabled(const DOMString &command)
110 {
111  PREPARE_JSEDITOR_CALL(command, false);
112  return js->queryCommandEnabled(imp);
113 }
114 
115 bool Editor::queryCommandIndeterm(const DOMString &command)
116 {
117  PREPARE_JSEDITOR_CALL(command, false);
118  return js->queryCommandIndeterm(imp);
119 }
120 
121 bool Editor::queryCommandState(const DOMString &command)
122 {
123  PREPARE_JSEDITOR_CALL(command, false);
124  return js->queryCommandState(imp);
125 }
126 
127 bool Editor::queryCommandSupported(const DOMString &command)
128 {
129  PREPARE_JSEDITOR_CALL(command, false);
130  return js->queryCommandSupported(imp);
131 }
132 
133 DOMString Editor::queryCommandValue(const DOMString &command)
134 {
135  PREPARE_JSEDITOR_CALL(command, DOMString());
136  return js->queryCommandValue(imp);
137 }
138 
139 bool Editor::execCommand(EditorCommand command, bool userInterface, const DOMString &value)
140 {
141  PREPARE_JSEDITOR_CALL(command, false);
142  return js->execCommand(imp, userInterface, value);
143 }
144 
145 bool Editor::queryCommandEnabled(EditorCommand command)
146 {
147  PREPARE_JSEDITOR_CALL(command, false);
148  return js->queryCommandEnabled(imp);
149 }
150 
151 bool Editor::queryCommandIndeterm(EditorCommand command)
152 {
153  PREPARE_JSEDITOR_CALL(command, false);
154  return js->queryCommandIndeterm(imp);
155 }
156 
157 bool Editor::queryCommandState(EditorCommand command)
158 {
159  PREPARE_JSEDITOR_CALL(command, false);
160  return js->queryCommandState(imp);
161 }
162 
163 bool Editor::queryCommandSupported(EditorCommand command)
164 {
165  PREPARE_JSEDITOR_CALL(command, false);
166  return js->queryCommandSupported(imp);
167 }
168 
169 DOMString Editor::queryCommandValue(EditorCommand command)
170 {
171  PREPARE_JSEDITOR_CALL(command, DOMString());
172  return js->queryCommandValue(imp);
173 }
174 
175 void Editor::copy()
176 {
177  static_cast<KHTMLPartBrowserExtension*>(m_part->browserExtension())->copy();
178 }
179 
180 void Editor::cut()
181 {
182  // ###
183  static_cast<KHTMLPartBrowserExtension*>(m_part->browserExtension())->cut();
184 }
185 
186 void Editor::paste()
187 {
188  // ###
189  // security?
190  // static_cast<KHTMLPartBrowserExtension*>(m_part->browserExtension())->paste();
191 }
192 
193 void Editor::print()
194 {
195  static_cast<KHTMLPartBrowserExtension*>(m_part->browserExtension())->print();
196 }
197 
198 bool Editor::canPaste() const
199 {
200  // ###
201  return false;
202 }
203 
204 void Editor::redo()
205 {
206  if (d->m_redo.isEmpty())
207  return;
208  RefPtr<EditCommandImpl> e = d->m_redo.pop();
209  e->reapply();
210 }
211 
212 void Editor::undo()
213 {
214  if (d->m_undo.isEmpty())
215  return;
216  RefPtr<EditCommandImpl> e = d->m_undo.pop();
217  e->unapply();
218 }
219 
220 bool Editor::canRedo() const
221 {
222  return !d->m_redo.isEmpty();
223 }
224 
225 bool Editor::canUndo() const
226 {
227  return !d->m_undo.isEmpty();
228 }
229 
230 void Editor::applyStyle(CSSStyleDeclarationImpl *style)
231 {
232  switch (m_part->caret().state()) {
233  case Selection::NONE:
234  // do nothing
235  break;
236  case Selection::CARET:
237  // FIXME: This blows away all the other properties of the typing style.
238  setTypingStyle(style);
239  break;
240  case Selection::RANGE:
241  if (m_part->xmlDocImpl() && style) {
242 #ifdef DEBUG_COMMANDS
243  kDebug() << "[create ApplyStyleCommand]" << endl;
244 #endif
245  // FIXME
246  (new ApplyStyleCommandImpl(m_part->xmlDocImpl(), style))->apply();
247  }
248  break;
249  }
250 }
251 
252 static void updateState(CSSStyleDeclarationImpl *desiredStyle, CSSStyleDeclarationImpl *computedStyle, bool &atStart, Editor::TriState &state)
253 {
254  QListIterator<CSSProperty*> it(*desiredStyle->values());
255  while (it.hasNext()) {
256  int propertyID = it.next()->id();
257  DOMString desiredProperty = desiredStyle->getPropertyValue(propertyID);
258  DOMString computedProperty = computedStyle->getPropertyValue(propertyID);
259  Editor::TriState propertyState = strcasecmp(desiredProperty, computedProperty) == 0
260  ? Editor::TrueTriState : Editor::FalseTriState;
261  if (atStart) {
262  state = propertyState;
263  atStart = false;
264  } else if (state != propertyState) {
265  state = Editor::MixedTriState;
266  break;
267  }
268  }
269 }
270 
271 Editor::TriState Editor::selectionHasStyle(CSSStyleDeclarationImpl *style) const
272 {
273  bool atStart = true;
274  TriState state = FalseTriState;
275 
276  EditorContext *ctx = m_part->editorContext();
277  if (ctx->m_selection.state() != Selection::RANGE) {
278  NodeImpl *nodeToRemove;
279  CSSStyleDeclarationImpl *selectionStyle = selectionComputedStyle(nodeToRemove);
280  if (!selectionStyle)
281  return FalseTriState;
282  selectionStyle->ref();
283  updateState(style, selectionStyle, atStart, state);
284  selectionStyle->deref();
285  if (nodeToRemove) {
286  int exceptionCode = 0;
287  nodeToRemove->remove(exceptionCode);
288  assert(exceptionCode == 0);
289  }
290  } else {
291  for (NodeImpl *node = ctx->m_selection.start().node(); node; node = node->traverseNextNode()) {
292  if (node->isHTMLElement()) {
293  CSSStyleDeclarationImpl *computedStyle = new RenderStyleDeclarationImpl(node);
294  computedStyle->ref();
295  updateState(style, computedStyle, atStart, state);
296  computedStyle->deref();
297  if (state == MixedTriState)
298  break;
299  }
300  if (node == ctx->m_selection.end().node())
301  break;
302  }
303  }
304 
305  return state;
306 }
307 
308 bool Editor::selectionStartHasStyle(CSSStyleDeclarationImpl *style) const
309 {
310  NodeImpl *nodeToRemove;
311  CSSStyleDeclarationImpl *selectionStyle = selectionComputedStyle(nodeToRemove);
312  if (!selectionStyle)
313  return false;
314 
315  selectionStyle->ref();
316 
317  bool match = true;
318 
319  QListIterator<CSSProperty*> it(*style->values());
320  while (it.hasNext()) {
321  int propertyID = it.next()->id();
322  DOMString desiredProperty = style->getPropertyValue(propertyID);
323  DOMString selectionProperty = selectionStyle->getPropertyValue(propertyID);
324  if (strcasecmp(selectionProperty, desiredProperty) != 0) {
325  match = false;
326  break;
327  }
328  }
329 
330  selectionStyle->deref();
331 
332  if (nodeToRemove) {
333  int exceptionCode = 0;
334  nodeToRemove->remove(exceptionCode);
335  assert(exceptionCode == 0);
336  }
337 
338  return match;
339 }
340 
341 DOMString Editor::selectionStartStylePropertyValue(int stylePropertyID) const
342 {
343  NodeImpl *nodeToRemove;
344  CSSStyleDeclarationImpl *selectionStyle = selectionComputedStyle(nodeToRemove);
345  if (!selectionStyle)
346  return DOMString();
347 
348  selectionStyle->ref();
349  DOMString value = selectionStyle->getPropertyValue(stylePropertyID);
350  selectionStyle->deref();
351 
352  if (nodeToRemove) {
353  int exceptionCode = 0;
354  nodeToRemove->remove(exceptionCode);
355  assert(exceptionCode == 0);
356  }
357 
358  return value;
359 }
360 
361 CSSStyleDeclarationImpl *Editor::selectionComputedStyle(NodeImpl *&nodeToRemove) const
362 {
363  nodeToRemove = 0;
364 
365  if (!m_part->xmlDocImpl())
366  return 0;
367 
368  EditorContext *ctx = m_part->editorContext();
369  if (ctx->m_selection.state() == Selection::NONE)
370  return 0;
371 
372  Range range(ctx->m_selection.toRange());
373  Position pos(range.startContainer().handle(), range.startOffset());
374  assert(pos.notEmpty());
375  ElementImpl *elem = pos.element();
376  ElementImpl *styleElement = elem;
377  int exceptionCode = 0;
378 
379  if (m_typingStyle) {
380  styleElement = m_part->xmlDocImpl()->createHTMLElement("SPAN");
381 // assert(exceptionCode == 0);
382 
383  styleElement->setAttribute(ATTR_STYLE, m_typingStyle->cssText().implementation());
384 // assert(exceptionCode == 0);
385 
386  TextImpl *text = m_part->xmlDocImpl()->createEditingTextNode("");
387  styleElement->appendChild(text, exceptionCode);
388  assert(exceptionCode == 0);
389 
390  elem->appendChild(styleElement, exceptionCode);
391  assert(exceptionCode == 0);
392 
393  nodeToRemove = styleElement;
394  }
395 
396  return new RenderStyleDeclarationImpl(styleElement);
397 }
398 
399 PassRefPtr<EditCommandImpl> Editor::lastEditCommand() const
400 {
401  return d->m_lastEditCommand;
402 }
403 
404 void Editor::appliedEditing(EditCommandImpl *cmd)
405 {
406 #ifdef DEBUG_COMMANDS
407  kDebug() << "[Applied editing]" << endl;
408 #endif
409  // make sure we have all the changes in rendering tree applied with relayout if needed before setting caret
410  // in particular that could be required for inline boxes recomputation when inserting text
411  m_part->xmlDocImpl()->updateLayout();
412 
413  m_part->setCaret(cmd->endingSelection(), false);
414  // Command will be equal to last edit command only in the case of typing
415  if (d->m_lastEditCommand == cmd) {
416  assert(cmd->isTypingCommand());
417  } else {
418  // Only register a new undo command if the command passed in is
419  // different from the last command
420  d->registerUndo(cmd);
421  d->m_lastEditCommand = cmd;
422  }
423  m_part->editorContext()->m_selection.setNeedsLayout(true);
424  m_part->selectionLayoutChanged();
425  // ### only emit if caret pos changed
426  m_part->emitCaretPositionChanged(cmd->endingSelection().caretPos());
427 }
428 
429 void Editor::unappliedEditing(EditCommandImpl *cmd)
430 {
431  // see comment in appliedEditing()
432  m_part->xmlDocImpl()->updateLayout();
433 
434  m_part->setCaret(cmd->startingSelection());
435  d->registerRedo(cmd);
436 #ifdef APPLE_CHANGES
437  KWQ(this)->respondToChangedContents();
438 #else
439  m_part->editorContext()->m_selection.setNeedsLayout(true);
440  m_part->selectionLayoutChanged();
441  // ### only emit if caret pos changed
442  m_part->emitCaretPositionChanged(cmd->startingSelection().caretPos());
443 #endif
444  d->m_lastEditCommand = 0;
445 }
446 
447 void Editor::reappliedEditing(EditCommandImpl *cmd)
448 {
449  // see comment in appliedEditing()
450  m_part->xmlDocImpl()->updateLayout();
451 
452  m_part->setCaret(cmd->endingSelection());
453  d->registerUndo(cmd, false /*clearRedoStack*/);
454 #ifdef APPLE_CHANGES
455  KWQ(this)->respondToChangedContents();
456 #else
457  m_part->selectionLayoutChanged();
458  // ### only emit if caret pos changed
459  m_part->emitCaretPositionChanged(cmd->endingSelection().caretPos());
460 #endif
461  d->m_lastEditCommand = 0;
462 }
463 
464 CSSStyleDeclarationImpl *Editor::typingStyle() const
465 {
466  return m_typingStyle;
467 }
468 
469 void Editor::setTypingStyle(CSSStyleDeclarationImpl *style)
470 {
471  CSSStyleDeclarationImpl *old = m_typingStyle;
472  m_typingStyle = style;
473  if (m_typingStyle)
474  m_typingStyle->ref();
475  if (old)
476  old->deref();
477 }
478 
479 void Editor::clearTypingStyle()
480 {
481  setTypingStyle(0);
482 }
483 
484 void Editor::closeTyping()
485 {
486  EditCommandImpl *lastCommand = lastEditCommand().get();
487  if (lastCommand && lastCommand->isTypingCommand())
488  static_cast<TypingCommandImpl*>(lastCommand)->closeTyping();
489 }
490 
491 void Editor::indent()
492 {
493  RefPtr<IndentOutdentCommandImpl> command = new IndentOutdentCommandImpl(m_part->xmlDocImpl(),
494  IndentOutdentCommandImpl::Indent);
495  command->apply();
496 }
497 
498 void Editor::outdent()
499 {
500  RefPtr<IndentOutdentCommandImpl> command = new IndentOutdentCommandImpl(m_part->xmlDocImpl(),
501  IndentOutdentCommandImpl::Outdent);
502  command->apply();
503 }
504 
505 bool Editor::handleKeyEvent(QKeyEvent *_ke)
506 {
507  bool handled = false;
508 
509  bool ctrl = _ke->modifiers() & Qt::ControlModifier;
510  bool alt = _ke->modifiers() & Qt::AltModifier;
511  //bool shift = _ke->modifiers() & Qt::ShiftModifier;
512  bool meta = _ke->modifiers() & Qt::MetaModifier;
513 
514  if (ctrl || alt || meta) {
515  return false;
516  }
517 
518  switch(_ke->key()) {
519 
520  case Qt::Key_Delete: {
521  Selection selectionToDelete = m_part->caret();
522 #ifdef DEBUG_COMMANDS
523  kDebug(6200) << "========== KEY_DELETE ==========" << endl;
524 #endif
525  if (selectionToDelete.state() == Selection::CARET) {
526  Position pos(selectionToDelete.start());
527 #ifdef DEBUG_COMMANDS
528  kDebug(6200) << "pos.inLastEditableInRootEditableElement " << pos.inLastEditableInRootEditableElement() << " pos.offset " << pos.offset() << " pos.max " << pos.node()->caretMaxRenderedOffset() << endl;
529 #endif
530  if (pos.nextCharacterPosition() == pos) {
531  // we're at the end of a root editable block...do nothing
532 #ifdef DEBUG_COMMANDS
533  kDebug(6200) << "no delete!!!!!!!!!!" << endl;
534 #endif
535  break;
536  }
537  m_part->d->editor_context.m_selection
538  = Selection(pos, pos.nextCharacterPosition());
539  }
540  // fall through
541  }
542  case Qt::Key_Backspace:
543  TypingCommandImpl::deleteKeyPressed0(m_part->xmlDocImpl());
544  handled = true;
545  break;
546 
547  case Qt::Key_Return:
548  case Qt::Key_Enter:
549 // if (shift)
550  TypingCommandImpl::insertNewline0(m_part->xmlDocImpl());
551 // else
552 // TypingCommand::insertParagraph(m_part->xmlDocImpl());
553  handled = true;
554  break;
555 
556  case Qt::Key_Escape:
557  case Qt::Key_Insert:
558  // FIXME implement me
559  handled = true;
560  break;
561 
562  default:
563 // handle_input:
564  if (m_part->caret().state() != Selection::CARET) {
565  // We didn't get a chance to grab the caret, likely because
566  // a script messed with contentEditable in the middle of events
567  // acquire it now if there isn't a selection
568  kDebug(6200) << "Editable node w/o caret!";
569  DOM::NodeImpl* focus = m_part->xmlDocImpl()->focusNode();
570  if (m_part->caret().state() == Selection::NONE) {
571  if (focus)
572  m_part->setCaret(Position(focus, focus->caretMinOffset()));
573  else
574  break;
575  }
576  }
577 
578  if (!_ke->text().isEmpty()) {
579  TypingCommandImpl::insertText0(m_part->xmlDocImpl(), _ke->text());
580  handled = true;
581  }
582 
583  }
584 
585  //if (handled) {
586  // ### check when to emit it
587 // m_part->emitSelectionChanged();
588  //}
589 
590  return handled;
591 
592 }
593 
594 
595 #include "editor.moc"
596 
khtml::EditorContext
Contextual information about the caret and the built-in editor.
Definition: editing_p.h:38
DOM::Editor::queryCommandValue
DOMString queryCommandValue(const DOMString &command)
Returns the given command's value.
Definition: editor.cpp:133
DOM::Editor::TrueTriState
Definition: editor.h:71
DOM::Editor::reappliedEditing
void reappliedEditing(khtml::EditCommandImpl *)
Called when editing has been reapplied.
Definition: editor.cpp:447
DOM::EditorCommand
EditorCommand
List of all supported built-in editor commands.
Definition: editor_command.h:29
khtml::EditorContext::m_selection
DOM::Selection m_selection
Definition: editing_p.h:44
DOM::Editor::redo
void redo()
redo last undone action
Definition: editor.cpp:204
KHTMLPartPrivate::editor_context
khtml::EditorContext editor_context
Definition: khtmlpart_p.h:371
DOM::Editor::execCommand
bool execCommand(const DOMString &command, bool userInterface, const DOMString &value)
Executes the given editor command.
Definition: editor.cpp:103
assert
#define assert(x)
Definition: editor.cpp:43
khtml_part.h
d
#define d
Definition: khtmlfind.cpp:42
DOM::strcasecmp
bool strcasecmp(const DOMString &a, const DOMString &b)
Definition: dom_string.cpp:295
DOM::Editor::queryCommandEnabled
bool queryCommandEnabled(const DOMString &command)
Checks whether the given command is enabled.
Definition: editor.cpp:109
DOM::DOMString::remove
void remove(unsigned int pos, int len=1)
Definition: dom_string.cpp:196
KHTMLPart
This class is khtml's main class.
Definition: khtml_part.h:206
DOM::Editor::selectionStartHasStyle
bool selectionStartHasStyle(DOM::CSSStyleDeclarationImpl *) const
returns whether the selection has got applied the given style
Definition: editor.cpp:308
PREPARE_JSEDITOR_CALL
#define PREPARE_JSEDITOR_CALL(command, retval)
Definition: editor.cpp:46
QStack
Definition: khtmlview.h:37
khtml::EditCommandImpl::startingSelection
DOM::Selection startingSelection() const
Definition: htmlediting_impl.h:113
khtml_ext.h
khtml::EditCommandImpl::endingSelection
DOM::Selection endingSelection() const
Definition: htmlediting_impl.h:114
DOM::Editor::selectionComputedStyle
DOM::CSSStyleDeclarationImpl * selectionComputedStyle(DOM::NodeImpl *&nodeToRemove) const
computed style of current selection
Definition: editor.cpp:361
khtml::EditCommandImpl::apply
void apply()
Definition: htmlediting_impl.cpp:230
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
editor.h
DOM::Editor::canPaste
bool canPaste() const
returns whether clipboard contains data to be pasted
Definition: editor.cpp:198
DOM::sMaxUndoSteps
static const int sMaxUndoSteps
Definition: editor.cpp:68
DOM::Editor::TriState
TriState
Tri-state boolean.
Definition: editor.h:71
DOM::Editor::queryCommandIndeterm
bool queryCommandIndeterm(const DOMString &command)
Checks whether the given command's style is indeterminate.
Definition: editor.cpp:115
khtml::EditCommandImpl
Definition: htmlediting_impl.h:91
DOM::Editor::copy
void copy()
copy selection to clipboard
Definition: editor.cpp:175
DOM::Editor::unappliedEditing
void unappliedEditing(khtml::EditCommandImpl *)
Called when editing has been unapplied.
Definition: editor.cpp:429
htmlediting_impl.h
DOM::Editor::selectionStartStylePropertyValue
DOM::DOMString selectionStartStylePropertyValue(int stylePropertyID) const
?
Definition: editor.cpp:341
KHTMLPart::browserExtension
KParts::BrowserExtension * browserExtension() const
Returns a pointer to the KParts::BrowserExtension.
Definition: khtml_part.cpp:1046
DOM::Editor::FalseTriState
Definition: editor.h:71
DOM::Editor::queryCommandState
bool queryCommandState(const DOMString &command)
Checks whether the given command's style is state.
Definition: editor.cpp:121
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
khtml::EditCommandImpl::isTypingCommand
virtual bool isTypingCommand() const
Definition: htmlediting_impl.h:123
DOM::Editor::applyStyle
void applyStyle(DOM::CSSStyleDeclarationImpl *)
applies the given style to the current selection
Definition: editor.cpp:230
DOM::Editor::canRedo
bool canRedo() const
returns whether any actions can be redone
Definition: editor.cpp:220
DOM::Editor::appliedEditing
void appliedEditing(khtml::EditCommandImpl *)
Called when editing has been applied.
Definition: editor.cpp:404
DOM::Editor::cut
void cut()
cut selection and insert into clipboard
Definition: editor.cpp:180
khtml::TypingCommandImpl
Definition: htmlediting_impl.h:592
DOM::Editor::canUndo
bool canUndo() const
returns whether any actions can be undone
Definition: editor.cpp:225
DOM::Editor::indent
void indent()
indent/outdent current selection
Definition: editor.cpp:491
DOM::Editor::print
void print()
prints the current document
Definition: editor.cpp:193
DOM::Editor::undo
void undo()
undo last action
Definition: editor.cpp:212
DOM::Editor::queryCommandSupported
bool queryCommandSupported(const DOMString &command)
Checks whether the given command is supported in the current context.
Definition: editor.cpp:127
DOM::Editor::closeTyping
void closeTyping()
Definition: editor.cpp:484
khtml::ApplyStyleCommandImpl
Definition: htmlediting_impl.h:204
updateState
static void updateState(CSSStyleDeclarationImpl *desiredStyle, CSSStyleDeclarationImpl *computedStyle, bool &atStart, Editor::TriState &state)
Definition: editor.cpp:252
KHTMLPartBrowserExtension
This is the BrowserExtension for a KHTMLPart document.
Definition: khtml_ext.h:43
khtml::IndentOutdentCommandImpl
Definition: htmlediting_impl.h:645
DOM::Editor::typingStyle
DOM::CSSStyleDeclarationImpl * typingStyle() const
Returns the typing style for the document.
Definition: editor.cpp:464
DOM::Editor::lastEditCommand
WTF::PassRefPtr< khtml::EditCommandImpl > lastEditCommand() const
Returns the most recent edit command applied.
Definition: editor.cpp:399
DOM::Range
Definition: dom2_range.h:79
jsediting.h
khtmlpart_p.h
DOM::Editor::paste
void paste()
paste into current selection from clipboard
Definition: editor.cpp:186
DOM::Editor::clearTypingStyle
void clearTypingStyle()
Clears the typing style for the document.
Definition: editor.cpp:479
DOM::Editor::outdent
void outdent()
Definition: editor.cpp:498
DOM::Editor::selectionHasStyle
TriState selectionHasStyle(DOM::CSSStyleDeclarationImpl *) const
returns whether the selection has got applied the given style
Definition: editor.cpp:271
DOM::Editor::setTypingStyle
void setTypingStyle(DOM::CSSStyleDeclarationImpl *)
Sets the typing style for the document.
Definition: editor.cpp:469
DOM::Editor::MixedTriState
Definition: editor.h:71
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal