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

KHTML

  • khtml
  • editing
jsediting.cpp
Go to the documentation of this file.
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#include "jsediting.h"
27#include "editing/htmlediting_impl.h"
28#include "editor.h"
29
30#include "css/cssproperties.h"
31#include "css/cssvalues.h"
32#include "css/css_valueimpl.h"
33#include "xml/dom_selection.h"
34#include "xml/dom_docimpl.h"
35#include "dom/dom_string.h"
36
37#include "misc/khtml_partaccessor.h"
38
39#include <QHash>
40#include <QString>
41
42using khtml::TypingCommandImpl;
43using khtml::InsertListCommandImpl;
44//
45#define KPAC khtml::KHTMLPartAccessor
46
47#define DEBUG_COMMANDS
48
49namespace DOM {
50
51class DocumentImpl;
52
53struct CommandImp {
54 bool (*execFn)(KHTMLPart *part, bool userInterface, const DOMString &value);
55 bool (*enabledFn)(KHTMLPart *part);
56 Editor::TriState (*stateFn)(KHTMLPart *part);
57 DOMString (*valueFn)(KHTMLPart *part);
58};
59
60typedef QHash<QString,const CommandImp*> CommandDict;
61static CommandDict createCommandDictionary();
62
63bool JSEditor::execCommand(const CommandImp *cmd, bool userInterface, const DOMString &value)
64{
65 if (!cmd || !cmd->enabledFn)
66 return false;
67 KHTMLPart *part = m_doc->part();
68 if (!part)
69 return false;
70 m_doc->updateLayout();
71 return cmd->enabledFn(part) && cmd->execFn(part, userInterface, value);
72}
73
74bool JSEditor::queryCommandEnabled(const CommandImp *cmd)
75{
76 if (!cmd || !cmd->enabledFn)
77 return false;
78 KHTMLPart *part = m_doc->part();
79 if (!part)
80 return false;
81 m_doc->updateLayout();
82 return cmd->enabledFn(part);
83}
84
85bool JSEditor::queryCommandIndeterm(const CommandImp *cmd)
86{
87 if (!cmd || !cmd->enabledFn)
88 return false;
89 KHTMLPart *part = m_doc->part();
90 if (!part)
91 return false;
92 m_doc->updateLayout();
93 return cmd->stateFn(part) == Editor::MixedTriState;
94}
95
96bool JSEditor::queryCommandState(const CommandImp *cmd)
97{
98 if (!cmd || !cmd->enabledFn)
99 return false;
100 KHTMLPart *part = m_doc->part();
101 if (!part)
102 return false;
103 m_doc->updateLayout();
104 return cmd->stateFn(part) != Editor::FalseTriState;
105}
106
107bool JSEditor::queryCommandSupported(const CommandImp *cmd)
108{
109 return cmd != 0;
110}
111
112DOMString JSEditor::queryCommandValue(const CommandImp *cmd)
113{
114 if (!cmd || !cmd->enabledFn)
115 return DOMString();
116 KHTMLPart *part = m_doc->part();
117 if (!part)
118 return DOMString();
119 m_doc->updateLayout();
120 return cmd->valueFn(part);
121}
122
123// =============================================================================================
124
125// Private stuff
126
127static bool execStyleChange(KHTMLPart *part, int propertyID, const DOMString &propertyValue)
128{
129 CSSStyleDeclarationImpl *style = new CSSStyleDeclarationImpl(0);
130 style->setProperty(propertyID, propertyValue);
131 style->ref();
132 part->editor()->applyStyle(style);
133 style->deref();
134 return true;
135}
136
137static bool execStyleChange(KHTMLPart *part, int propertyID, int propertyEnum)
138{
139 CSSStyleDeclarationImpl *style = new CSSStyleDeclarationImpl(0);
140 style->setProperty(propertyID, propertyEnum);
141 style->ref();
142 part->editor()->applyStyle(style);
143 style->deref();
144 return true;
145}
146
147static bool execStyleChange(KHTMLPart *part, int propertyID, const char *propertyValue)
148{
149 return execStyleChange(part, propertyID, DOMString(propertyValue));
150}
151
152static Editor::TriState stateStyle(KHTMLPart *part, int propertyID, const char *desiredValue)
153{
154 CSSStyleDeclarationImpl *style = new CSSStyleDeclarationImpl(0);
155 style->setProperty(propertyID, desiredValue);
156 style->ref();
157 Editor::TriState state = part->editor()->selectionHasStyle(style);
158 style->deref();
159 return state;
160}
161
162static bool selectionStartHasStyle(KHTMLPart *part, int propertyID, const char *desiredValue)
163{
164 CSSStyleDeclarationImpl *style = new CSSStyleDeclarationImpl(0);
165 style->setProperty(propertyID, desiredValue);
166 style->ref();
167 bool hasStyle = part->editor()->selectionStartHasStyle(style);
168 style->deref();
169 return hasStyle;
170}
171
172static DOMString valueStyle(KHTMLPart *part, int propertyID)
173{
174 return part->editor()->selectionStartStylePropertyValue(propertyID);
175}
176
177// =============================================================================================
178//
179// execCommand implementations
180//
181
182static bool execBackColor(KHTMLPart *part, bool /*userInterface*/, const DOMString &value)
183{
184 return execStyleChange(part, CSS_PROP_BACKGROUND_COLOR, value);
185}
186
187static bool execBold(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
188{
189 bool isBold = selectionStartHasStyle(part, CSS_PROP_FONT_WEIGHT, "bold");
190 return execStyleChange(part, CSS_PROP_FONT_WEIGHT, isBold ? "normal" : "bold");
191}
192
193static bool execCopy(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
194{
195 part->editor()->copy();
196 return true;
197}
198
199static bool execCut(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
200{
201 part->editor()->cut();
202 return true;
203}
204
205static bool execDelete(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
206{
207 TypingCommandImpl::deleteKeyPressed0(KPAC::xmlDocImpl(part));
208 return true;
209}
210
211static bool execFontName(KHTMLPart *part, bool /*userInterface*/, const DOMString &value)
212{
213 return execStyleChange(part, CSS_PROP_FONT_FAMILY, value);
214}
215
216static bool execFontSize(KHTMLPart *part, bool /*userInterface*/, const DOMString &value)
217{
218 // This should handle sizes 1-7 like <font> does. Who the heck designed this interface? (Rhetorical question)
219 bool ok;
220 int val = value.string().toInt(&ok);
221 if (ok && val >= 1 && val <= 7) {
222 int size;
223 switch (val) {
224 case 1: size = CSS_VAL_XX_SMALL; break;
225 case 2: size = CSS_VAL_SMALL; break;
226 case 3: size = CSS_VAL_MEDIUM; break;
227 case 4: size = CSS_VAL_LARGE; break;
228 case 5: size = CSS_VAL_X_LARGE; break;
229 case 6: size = CSS_VAL_XX_LARGE; break;
230 default: size = CSS_VAL__KHTML_XXX_LARGE;
231 }
232 return execStyleChange(part, CSS_PROP_FONT_SIZE, size);
233 }
234
235 return execStyleChange(part, CSS_PROP_FONT_SIZE, value);
236}
237
238static bool execForeColor(KHTMLPart *part, bool /*userInterface*/, const DOMString &value)
239{
240 return execStyleChange(part, CSS_PROP_COLOR, value);
241}
242
243static bool execIndent(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
244{
245 part->editor()->indent();
246 return true;
247}
248
249static bool execInsertNewline(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
250{
251 TypingCommandImpl::insertNewline0(KPAC::xmlDocImpl(part));
252 return true;
253}
254
255static bool execInsertParagraph(KHTMLPart * /*part*/, bool /*userInterface*/, const DOMString &/*value*/)
256{
257 // FIXME: Implement.
258 return false;
259}
260
261static bool execInsertText(KHTMLPart *part, bool /*userInterface*/, const DOMString &value)
262{
263 TypingCommandImpl::insertText0(KPAC::xmlDocImpl(part), value);
264 return true;
265}
266
267static bool execInsertOrderedList(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
268{
269 InsertListCommandImpl::insertList(KPAC::xmlDocImpl(part), InsertListCommandImpl::OrderedList);
270 return true;
271}
272
273static bool execInsertUnorderedList(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
274{
275 InsertListCommandImpl::insertList(KPAC::xmlDocImpl(part), InsertListCommandImpl::UnorderedList);
276 return true;
277}
278
279static bool execItalic(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
280{
281 bool isItalic = selectionStartHasStyle(part, CSS_PROP_FONT_STYLE, "italic");
282 return execStyleChange(part, CSS_PROP_FONT_STYLE, isItalic ? "normal" : "italic");
283}
284
285static bool execJustifyCenter(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
286{
287 return execStyleChange(part, CSS_PROP_TEXT_ALIGN, "center");
288}
289
290static bool execJustifyFull(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
291{
292 return execStyleChange(part, CSS_PROP_TEXT_ALIGN, "justify");
293}
294
295static bool execJustifyLeft(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
296{
297 return execStyleChange(part, CSS_PROP_TEXT_ALIGN, "left");
298}
299
300static bool execJustifyRight(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
301{
302 return execStyleChange(part, CSS_PROP_TEXT_ALIGN, "right");
303}
304
305static bool execOutdent(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
306{
307 part->editor()->outdent();
308 return true;
309}
310
311#ifndef NO_SUPPORT_PASTE
312
313static bool execPaste(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
314{
315 part->editor()->paste();
316 return true;
317}
318
319#endif
320
321static bool execPrint(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
322{
323 part->editor()->print();
324 return true;
325}
326
327static bool execRedo(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
328{
329 part->editor()->redo();
330 return true;
331}
332
333static bool execSelectAll(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
334{
335 part->selectAll();
336 return true;
337}
338
339static bool execStrikeThrough(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
340{
341 bool isStriked = selectionStartHasStyle(part, CSS_PROP_TEXT_DECORATION, "line-through");
342 return execStyleChange(part, CSS_PROP_TEXT_DECORATION, isStriked ? "none" : "line-through");
343}
344
345static bool execSubscript(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
346{
347 return execStyleChange(part, CSS_PROP_VERTICAL_ALIGN, "sub");
348}
349
350static bool execSuperscript(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
351{
352 return execStyleChange(part, CSS_PROP_VERTICAL_ALIGN, "super");
353}
354
355static bool execUndo(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
356{
357 part->editor()->undo();
358 return true;
359}
360
361static bool execUnderline(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
362{
363 bool isUnderline = selectionStartHasStyle(part, CSS_PROP_TEXT_DECORATION, "underline");
364 return execStyleChange(part, CSS_PROP_TEXT_DECORATION, isUnderline ? "none" : "underline");
365}
366
367static bool execUnselect(KHTMLPart *part, bool /*userInterface*/, const DOMString &/*value*/)
368{
369 KPAC::clearSelection(part);
370 return true;
371}
372
373// =============================================================================================
374//
375// queryCommandEnabled implementations
376//
377// It's a bit difficult to get a clear notion of the difference between
378// "supported" and "enabled" from reading the Microsoft documentation, but
379// what little I could glean from that seems to make some sense.
380// Supported = The command is supported by this object.
381// Enabled = The command is available and enabled.
382
383static bool enabled(KHTMLPart * /*part*/)
384{
385 return true;
386}
387
388static bool enabledAnySelection(KHTMLPart *part)
389{
390 return KPAC::caret(part).notEmpty();
391}
392
393#ifndef NO_SUPPORT_PASTE
394
395static bool enabledPaste(KHTMLPart *part)
396{
397 return part->editor()->canPaste();
398}
399
400#endif
401
402static bool enabledRangeSelection(KHTMLPart *part)
403{
404 return KPAC::caret(part).state() == Selection::RANGE;
405}
406
407static bool enabledRedo(KHTMLPart *part)
408{
409 return part->editor()->canRedo();
410}
411
412static bool enabledUndo(KHTMLPart *part)
413{
414 return part->editor()->canUndo();
415}
416
417// =============================================================================================
418//
419// queryCommandIndeterm/State implementations
420//
421// It's a bit difficult to get a clear notion of what these methods are supposed
422// to do from reading the Microsoft documentation, but my current guess is this:
423//
424// queryCommandState and queryCommandIndeterm work in concert to return
425// the two bits of information that are needed to tell, for instance,
426// if the text of a selection is bold. The answer can be "yes", "no", or
427// "partially".
428//
429// If this is so, then queryCommandState should return "yes" in the case where
430// all the text is bold and "no" for non-bold or partially-bold text.
431// Then, queryCommandIndeterm should return "no" in the case where
432// all the text is either all bold or not-bold and and "yes" for partially-bold text.
433
434static Editor::TriState stateNone(KHTMLPart * /*part*/)
435{
436 return Editor::FalseTriState;
437}
438
439static Editor::TriState stateBold(KHTMLPart *part)
440{
441 return stateStyle(part, CSS_PROP_FONT_WEIGHT, "bold");
442}
443
444static Editor::TriState stateItalic(KHTMLPart *part)
445{
446 return stateStyle(part, CSS_PROP_FONT_STYLE, "italic");
447}
448
449static Editor::TriState stateStrike(KHTMLPart *part)
450{
451 return stateStyle(part, CSS_PROP_TEXT_DECORATION, "line-through");
452}
453
454static Editor::TriState stateSubscript(KHTMLPart *part)
455{
456 return stateStyle(part, CSS_PROP_VERTICAL_ALIGN, "sub");
457}
458
459static Editor::TriState stateSuperscript(KHTMLPart *part)
460{
461 return stateStyle(part, CSS_PROP_VERTICAL_ALIGN, "super");
462}
463
464static Editor::TriState stateUnderline(KHTMLPart *part)
465{
466 return stateStyle(part, CSS_PROP_TEXT_DECORATION, "underline");
467}
468
469// =============================================================================================
470//
471// queryCommandValue implementations
472//
473
474static DOMString valueNull(KHTMLPart * /*part*/)
475{
476 return DOMString();
477}
478
479static DOMString valueBackColor(KHTMLPart *part)
480{
481 return valueStyle(part, CSS_PROP_BACKGROUND_COLOR);
482}
483
484static DOMString valueFontName(KHTMLPart *part)
485{
486 return valueStyle(part, CSS_PROP_FONT_FAMILY);
487}
488
489static DOMString valueFontSize(KHTMLPart *part)
490{
491 return valueStyle(part, CSS_PROP_FONT_SIZE);
492}
493
494static DOMString valueForeColor(KHTMLPart *part)
495{
496 return valueStyle(part, CSS_PROP_COLOR);
497}
498
499// =============================================================================================
500
501struct EditorCommandInfo { const char *name; CommandImp imp; };
502
503// NOTE: strictly keep in sync with EditorCommand in editor_command.h
504static const EditorCommandInfo commands[] = {
505
506 { "backColor", { execBackColor, enabled, stateNone, valueBackColor } },
507 { "bold", { execBold, enabledAnySelection, stateBold, valueNull } },
508 { "copy", { execCopy, enabledRangeSelection, stateNone, valueNull } },
509 { "cut", { execCut, enabledRangeSelection, stateNone, valueNull } },
510 { "delete", { execDelete, enabledAnySelection, stateNone, valueNull } },
511 { "fontName", { execFontName, enabledAnySelection, stateNone, valueFontName } },
512 { "fontSize", { execFontSize, enabledAnySelection, stateNone, valueFontSize } },
513 { "foreColor", { execForeColor, enabledAnySelection, stateNone, valueForeColor } },
514 { "indent", { execIndent, enabledAnySelection, stateNone, valueNull } },
515 { "insertNewline", { execInsertNewline, enabledAnySelection, stateNone, valueNull } },
516 { "insertOrderedList", { execInsertOrderedList, enabledAnySelection, stateNone, valueNull } },
517 { "insertParagraph", { execInsertParagraph, enabledAnySelection, stateNone, valueNull } },
518 { "insertText", { execInsertText, enabledAnySelection, stateNone, valueNull } },
519 { "insertUnorderedList", { execInsertUnorderedList, enabledAnySelection, stateNone, valueNull } },
520 { "italic", { execItalic, enabledAnySelection, stateItalic, valueNull } },
521 { "justifyCenter", { execJustifyCenter, enabledAnySelection, stateNone, valueNull } },
522 { "justifyFull", { execJustifyFull, enabledAnySelection, stateNone, valueNull } },
523 { "justifyLeft", { execJustifyLeft, enabledAnySelection, stateNone, valueNull } },
524 { "justifyNone", { execJustifyLeft, enabledAnySelection, stateNone, valueNull } },
525 { "justifyRight", { execJustifyRight, enabledAnySelection, stateNone, valueNull } },
526 { "outdent", { execOutdent, enabledAnySelection, stateNone, valueNull } },
527#ifndef NO_SUPPORT_PASTE
528 { "paste", { execPaste, enabledPaste, stateNone, valueNull } },
529#else
530 { 0, { 0, 0, 0, 0 } },
531#endif
532 { "print", { execPrint, enabled, stateNone, valueNull } },
533 { "redo", { execRedo, enabledRedo, stateNone, valueNull } },
534 { "selectAll", { execSelectAll, enabled, stateNone, valueNull } },
535 { "StrikeThrough", {execStrikeThrough, enabled, stateStrike, valueNull } },
536 { "subscript", { execSubscript, enabledAnySelection, stateSubscript, valueNull } },
537 { "superscript", { execSuperscript, enabledAnySelection, stateSuperscript, valueNull } },
538 { "underline", { execUnderline, enabledAnySelection, stateUnderline, valueNull } },
539 { "undo", { execUndo, enabledUndo, stateNone, valueNull } },
540 { "unselect", { execUnselect, enabledAnySelection, stateNone, valueNull } }
541
542 //
543 // The "unsupported" commands are listed here since they appear in the Microsoft
544 // documentation used as the basis for the list.
545 //
546
547 // 2d-position (not supported)
548 // absolutePosition (not supported)
549 // blockDirLTR (not supported)
550 // blockDirRTL (not supported)
551 // browseMode (not supported)
552 // clearAuthenticationCache (not supported)
553 // createBookmark (not supported)
554 // createLink (not supported)
555 // dirLTR (not supported)
556 // dirRTL (not supported)
557 // editMode (not supported)
558 // formatBlock (not supported)
559 // inlineDirLTR (not supported)
560 // inlineDirRTL (not supported)
561 // insertButton (not supported)
562 // insertFieldSet (not supported)
563 // insertHorizontalRule (not supported)
564 // insertIFrame (not supported)
565 // insertImage (not supported)
566 // insertInputButton (not supported)
567 // insertInputCheckbox (not supported)
568 // insertInputFileUpload (not supported)
569 // insertInputHidden (not supported)
570 // insertInputImage (not supported)
571 // insertInputPassword (not supported)
572 // insertInputRadio (not supported)
573 // insertInputReset (not supported)
574 // insertInputSubmit (not supported)
575 // insertInputText (not supported)
576 // insertMarquee (not supported)
577 // insertOrderedList (not supported)
578 // insertSelectDropDown (not supported)
579 // insertSelectListBox (not supported)
580 // insertTextArea (not supported)
581 // insertUnorderedList (not supported)
582 // liveResize (not supported)
583 // multipleSelection (not supported)
584 // open (not supported)
585 // overwrite (not supported)
586 // playImage (not supported)
587 // refresh (not supported)
588 // removeFormat (not supported)
589 // removeParaFormat (not supported)
590 // saveAs (not supported)
591 // sizeToControl (not supported)
592 // sizeToControlHeight (not supported)
593 // sizeToControlWidth (not supported)
594 // stop (not supported)
595 // stopimage (not supported)
596 // strikethrough (not supported)
597 // unbookmark (not supported)
598 // underline (not supported)
599 // unlink (not supported)
600};
601
602static CommandDict createCommandDictionary()
603{
604 const int numCommands = sizeof(commands) / sizeof(commands[0]);
605 CommandDict commandDictionary; // case-insensitive dictionary
606 for (int i = 0; i < numCommands; ++i) {
607 if (commands[i].name)
608 commandDictionary.insert(QString(commands[i].name).toLower(), &commands[i].imp);
609 }
610 return commandDictionary;
611}
612
613const CommandImp *JSEditor::commandImp(const DOMString &command)
614{
615 static CommandDict commandDictionary = createCommandDictionary();
616 const CommandImp *result = commandDictionary.value( command.string().toLower() );
617#ifdef DEBUG_COMMANDS
618 if (!result)
619 kDebug() << "[Command is not supported yet]" << command << endl;
620#endif
621 return result;
622}
623
624const CommandImp *JSEditor::commandImp(int command)
625{
626 if (command < 0 || command >= int(sizeof commands / sizeof commands[0]) )
627 return 0;
628 return &commands[command].imp;
629}
630
631
632
633} // namespace DOM
634
635#undef KPAC
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::DOMString::string
QString string() const
Definition: dom_string.cpp:236
DOM::Editor::applyStyle
void applyStyle(DOM::CSSStyleDeclarationImpl *)
applies the given style to the current selection
Definition: editor.cpp:230
DOM::Editor::TriState
TriState
Tri-state boolean.
Definition: editor.h:71
DOM::Editor::MixedTriState
@ MixedTriState
Definition: editor.h:71
DOM::Editor::FalseTriState
@ FalseTriState
Definition: editor.h:71
DOM::Editor::canRedo
bool canRedo() const
returns whether any actions can be redone
Definition: editor.cpp:220
DOM::Editor::print
void print()
prints the current document
Definition: editor.cpp:193
DOM::Editor::copy
void copy()
copy selection to clipboard
Definition: editor.cpp:175
DOM::Editor::selectionHasStyle
TriState selectionHasStyle(DOM::CSSStyleDeclarationImpl *) const
returns whether the selection has got applied the given style
Definition: editor.cpp:271
DOM::Editor::selectionStartHasStyle
bool selectionStartHasStyle(DOM::CSSStyleDeclarationImpl *) const
returns whether the selection has got applied the given style
Definition: editor.cpp:308
DOM::Editor::paste
void paste()
paste into current selection from clipboard
Definition: editor.cpp:186
DOM::Editor::outdent
void outdent()
Definition: editor.cpp:498
DOM::Editor::indent
void indent()
indent/outdent current selection
Definition: editor.cpp:491
DOM::Editor::canUndo
bool canUndo() const
returns whether any actions can be undone
Definition: editor.cpp:225
DOM::Editor::selectionStartStylePropertyValue
DOM::DOMString selectionStartStylePropertyValue(int stylePropertyID) const
?
Definition: editor.cpp:341
DOM::Editor::undo
void undo()
undo last action
Definition: editor.cpp:212
DOM::Editor::canPaste
bool canPaste() const
returns whether clipboard contains data to be pasted
Definition: editor.cpp:198
DOM::Editor::cut
void cut()
cut selection and insert into clipboard
Definition: editor.cpp:180
DOM::Editor::redo
void redo()
redo last undone action
Definition: editor.cpp:204
DOM::JSEditor::queryCommandIndeterm
bool queryCommandIndeterm(const CommandImp *)
Definition: jsediting.cpp:85
DOM::JSEditor::execCommand
bool execCommand(const CommandImp *, bool userInterface, const DOMString &value)
Definition: jsediting.cpp:63
DOM::JSEditor::commandImp
const CommandImp * commandImp(const DOMString &command)
Definition: jsediting.cpp:613
DOM::JSEditor::queryCommandState
bool queryCommandState(const CommandImp *)
Definition: jsediting.cpp:96
DOM::JSEditor::queryCommandEnabled
bool queryCommandEnabled(const CommandImp *)
Definition: jsediting.cpp:74
DOM::JSEditor::queryCommandValue
DOMString queryCommandValue(const CommandImp *)
Definition: jsediting.cpp:112
DOM::JSEditor::queryCommandSupported
bool queryCommandSupported(const CommandImp *)
Definition: jsediting.cpp:107
KHTMLPart
This class is khtml's main class.
Definition: khtml_part.h:207
KHTMLPart::editor
DOM::Editor * editor() const
Returns the instance of the attached html editor interface.
Definition: khtml_part.cpp:3500
KHTMLPart::selectAll
void selectAll()
Marks all text in the document as selected.
Definition: khtml_part.cpp:6746
QHash
khtml::InsertListCommandImpl
Definition: htmlediting_impl.h:625
khtml::TypingCommandImpl
Definition: htmlediting_impl.h:593
dom_string.h
editor.h
kDebug
#define kDebug
htmlediting_impl.h
jsediting.h
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
DOM::execUnderline
static bool execUnderline(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:361
DOM::execBackColor
static bool execBackColor(KHTMLPart *part, bool, const DOMString &value)
Definition: jsediting.cpp:182
DOM::execBold
static bool execBold(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:187
DOM::execInsertParagraph
static bool execInsertParagraph(KHTMLPart *, bool, const DOMString &)
Definition: jsediting.cpp:255
DOM::execCopy
static bool execCopy(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:193
DOM::stateUnderline
static Editor::TriState stateUnderline(KHTMLPart *part)
Definition: jsediting.cpp:464
DOM::stateNone
static Editor::TriState stateNone(KHTMLPart *)
Definition: jsediting.cpp:434
DOM::execCut
static bool execCut(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:199
DOM::enabledRedo
static bool enabledRedo(KHTMLPart *part)
Definition: jsediting.cpp:407
DOM::execIndent
static bool execIndent(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:243
DOM::execJustifyFull
static bool execJustifyFull(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:290
DOM::execSuperscript
static bool execSuperscript(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:350
DOM::enabledPaste
static bool enabledPaste(KHTMLPart *part)
Definition: jsediting.cpp:395
DOM::valueForeColor
static DOMString valueForeColor(KHTMLPart *part)
Definition: jsediting.cpp:494
DOM::stateBold
static Editor::TriState stateBold(KHTMLPart *part)
Definition: jsediting.cpp:439
DOM::execJustifyCenter
static bool execJustifyCenter(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:285
DOM::execOutdent
static bool execOutdent(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:305
DOM::stateItalic
static Editor::TriState stateItalic(KHTMLPart *part)
Definition: jsediting.cpp:444
DOM::execStyleChange
static bool execStyleChange(KHTMLPart *part, int propertyID, const DOMString &propertyValue)
Definition: jsediting.cpp:127
DOM::valueStyle
static DOMString valueStyle(KHTMLPart *part, int propertyID)
Definition: jsediting.cpp:172
DOM::execInsertUnorderedList
static bool execInsertUnorderedList(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:273
DOM::valueNull
static DOMString valueNull(KHTMLPart *)
Definition: jsediting.cpp:474
DOM::valueBackColor
static DOMString valueBackColor(KHTMLPart *part)
Definition: jsediting.cpp:479
DOM::execInsertNewline
static bool execInsertNewline(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:249
DOM::execFontName
static bool execFontName(KHTMLPart *part, bool, const DOMString &value)
Definition: jsediting.cpp:211
DOM::enabledRangeSelection
static bool enabledRangeSelection(KHTMLPart *part)
Definition: jsediting.cpp:402
DOM::execDelete
static bool execDelete(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:205
DOM::execSubscript
static bool execSubscript(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:345
DOM::execForeColor
static bool execForeColor(KHTMLPart *part, bool, const DOMString &value)
Definition: jsediting.cpp:238
DOM::execUnselect
static bool execUnselect(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:367
DOM::enabledAnySelection
static bool enabledAnySelection(KHTMLPart *part)
Definition: jsediting.cpp:388
DOM::execStrikeThrough
static bool execStrikeThrough(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:339
DOM::execJustifyRight
static bool execJustifyRight(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:300
DOM::execJustifyLeft
static bool execJustifyLeft(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:295
DOM::CommandDict
QHash< QString, const CommandImp * > CommandDict
Definition: jsediting.cpp:60
DOM::enabled
static bool enabled(KHTMLPart *)
Definition: jsediting.cpp:383
DOM::stateSuperscript
static Editor::TriState stateSuperscript(KHTMLPart *part)
Definition: jsediting.cpp:459
DOM::execInsertText
static bool execInsertText(KHTMLPart *part, bool, const DOMString &value)
Definition: jsediting.cpp:261
DOM::stateStrike
static Editor::TriState stateStrike(KHTMLPart *part)
Definition: jsediting.cpp:449
DOM::createCommandDictionary
static CommandDict createCommandDictionary()
Definition: jsediting.cpp:602
DOM::execPrint
static bool execPrint(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:321
DOM::valueFontSize
static DOMString valueFontSize(KHTMLPart *part)
Definition: jsediting.cpp:489
DOM::enabledUndo
static bool enabledUndo(KHTMLPart *part)
Definition: jsediting.cpp:412
DOM::selectionStartHasStyle
static bool selectionStartHasStyle(KHTMLPart *part, int propertyID, const char *desiredValue)
Definition: jsediting.cpp:162
DOM::execUndo
static bool execUndo(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:355
DOM::execSelectAll
static bool execSelectAll(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:333
DOM::execRedo
static bool execRedo(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:327
DOM::valueFontName
static DOMString valueFontName(KHTMLPart *part)
Definition: jsediting.cpp:484
DOM::execFontSize
static bool execFontSize(KHTMLPart *part, bool, const DOMString &value)
Definition: jsediting.cpp:216
DOM::stateSubscript
static Editor::TriState stateSubscript(KHTMLPart *part)
Definition: jsediting.cpp:454
DOM::execPaste
static bool execPaste(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:313
DOM::execItalic
static bool execItalic(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:279
DOM::stateStyle
static Editor::TriState stateStyle(KHTMLPart *part, int propertyID, const char *desiredValue)
Definition: jsediting.cpp:152
DOM::commands
static const EditorCommandInfo commands[]
Definition: jsediting.cpp:504
DOM::execInsertOrderedList
static bool execInsertOrderedList(KHTMLPart *part, bool, const DOMString &)
Definition: jsediting.cpp:267
name
const char * name(StandardAction id)
ok
KGuiItem ok()
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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