2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 #include "mshtml_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 #define NSCMD_ALIGN "cmd_align"
41 #define NSCMD_BOLD "cmd_bold"
42 #define NSCMD_FONTCOLOR "cmd_fontColor"
43 #define NSCMD_FONTFACE "cmd_fontFace"
44 #define NSCMD_INDENT "cmd_indent"
45 #define NSCMD_INSERTHR "cmd_insertHR"
46 #define NSCMD_ITALIC "cmd_italic"
47 #define NSCMD_OL "cmd_ol"
48 #define NSCMD_OUTDENT "cmd_outdent"
49 #define NSCMD_UL "cmd_ul"
50 #define NSCMD_UNDERLINE "cmd_underline"
52 #define NSSTATE_ATTRIBUTE "state_attribute"
53 #define NSSTATE_ALL "state_all"
55 #define NSALIGN_CENTER "center"
56 #define NSALIGN_LEFT "left"
57 #define NSALIGN_RIGHT "right"
59 #define DOM_VK_LEFT VK_LEFT
60 #define DOM_VK_UP VK_UP
61 #define DOM_VK_RIGHT VK_RIGHT
62 #define DOM_VK_DOWN VK_DOWN
64 static const WCHAR wszFont[] = {'f','o','n','t',0};
65 static const WCHAR wszSize[] = {'s','i','z','e',0};
67 static void do_ns_command(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
69 nsICommandManager *cmdmgr;
70 nsIInterfaceRequestor *iface_req;
73 TRACE("(%p)\n", This);
75 nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
76 &IID_nsIInterfaceRequestor, (void**)&iface_req);
77 if(NS_FAILED(nsres)) {
78 ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
82 nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
84 nsIInterfaceRequestor_Release(iface_req);
85 if(NS_FAILED(nsres)) {
86 ERR("Could not get nsICommandManager: %08x\n", nsres);
90 nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, NULL);
92 ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
94 nsICommandManager_Release(cmdmgr);
97 static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
99 nsICommandManager *cmdmgr;
100 nsIInterfaceRequestor *iface_req;
103 nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
104 &IID_nsIInterfaceRequestor, (void**)&iface_req);
105 if(NS_FAILED(nsres)) {
106 ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
110 nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
112 nsIInterfaceRequestor_Release(iface_req);
113 if(NS_FAILED(nsres)) {
114 ERR("Could not get nsICommandManager: %08x\n", nsres);
118 nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, NULL, nsparam);
120 ERR("GetCommandState(%s) failed: %08x\n", debugstr_a(cmd), nsres);
122 nsICommandManager_Release(cmdmgr);
126 static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
128 nsICommandParams *nsparam;
131 if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
132 return OLECMDF_SUPPORTED;
134 if(This->nscontainer && nscmd) {
135 nsparam = create_nscommand_params();
136 get_ns_command_state(This->nscontainer, nscmd, nsparam);
138 nsICommandParams_GetBooleanValue(nsparam, NSSTATE_ALL, &b);
140 nsICommandParams_Release(nsparam);
143 return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (b ? OLECMDF_LATCHED : 0);
146 static void set_ns_align(HTMLDocument *This, const char *align_str)
148 nsICommandParams *nsparam;
150 if(!This->nscontainer)
153 nsparam = create_nscommand_params();
154 nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str);
156 do_ns_command(This->nscontainer, NSCMD_ALIGN, nsparam);
158 nsICommandParams_Release(nsparam);
161 static DWORD query_align_status(HTMLDocument *This, const char *align_str)
163 nsICommandParams *nsparam;
166 if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
167 return OLECMDF_SUPPORTED;
169 if(This->nscontainer) {
170 nsparam = create_nscommand_params();
171 get_ns_command_state(This->nscontainer, NSCMD_ALIGN, nsparam);
173 nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &align);
175 nsICommandParams_Release(nsparam);
178 return OLECMDF_SUPPORTED | OLECMDF_ENABLED
179 | (align && !strcmp(align_str, align) ? OLECMDF_LATCHED : 0);
183 static nsISelection *get_ns_selection(HTMLDocument *This)
185 nsIDOMWindow *dom_window;
186 nsISelection *nsselection = NULL;
189 if(!This->nscontainer)
192 nsres = nsIWebBrowser_GetContentDOMWindow(This->nscontainer->webbrowser, &dom_window);
196 nsIDOMWindow_GetSelection(dom_window, &nsselection);
197 nsIDOMWindow_Release(dom_window);
203 static void remove_child_attr(nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
206 PRUint32 child_cnt, i;
207 nsIDOMNode *child_node;
208 nsIDOMNodeList *node_list;
211 nsIDOMElement_HasChildNodes(elem, &has_children);
215 nsIDOMElement_GetChildNodes(elem, &node_list);
216 nsIDOMNodeList_GetLength(node_list, &child_cnt);
218 for(i=0; i<child_cnt; i++) {
219 nsIDOMNodeList_Item(node_list, i, &child_node);
221 nsIDOMNode_GetNodeType(child_node, &node_type);
222 if(node_type == ELEMENT_NODE) {
223 nsIDOMElement *child_elem;
225 const PRUnichar *ctag;
227 nsIDOMNode_QueryInterface(child_node, &IID_nsIDOMElement, (void**)&child_elem);
229 nsAString_Init(&tag_str, NULL);
230 nsIDOMElement_GetTagName(child_elem, &tag_str);
231 nsAString_GetData(&tag_str, &ctag, NULL);
233 if(!strcmpiW(ctag, tag))
234 /* FIXME: remove node if there are no more attributes */
235 nsIDOMElement_RemoveAttribute(child_elem, attr_str);
237 nsAString_Finish(&tag_str);
239 remove_child_attr(child_elem, tag, attr_str);
241 nsIDOMNode_Release(child_elem);
244 nsIDOMNode_Release(child_node);
247 nsIDOMNodeList_Release(node_list);
250 static void get_font_size(HTMLDocument *This, WCHAR *ret)
252 nsISelection *nsselection = get_ns_selection(This);
253 nsIDOMElement *elem = NULL;
254 nsIDOMNode *node = NULL, *tmp_node;
265 nsISelection_GetFocusNode(nsselection, &node);
266 nsISelection_Release(nsselection);
269 nsres = nsIDOMNode_GetNodeType(node, &node_type);
270 if(NS_FAILED(nsres) || node_type == DOCUMENT_NODE)
273 if(node_type == ELEMENT_NODE) {
274 nsIDOMNode_QueryInterface(node, &IID_nsIDOMElement, (void**)&elem);
276 nsAString_Init(&tag_str, NULL);
277 nsIDOMElement_GetTagName(elem, &tag_str);
278 nsAString_GetData(&tag_str, &tag, NULL);
280 if(!strcmpiW(tag, wszFont)) {
281 nsAString size_str, val_str;
284 TRACE("found font tag %p\n", elem);
286 nsAString_Init(&size_str, wszSize);
287 nsAString_Init(&val_str, NULL);
289 nsIDOMElement_GetAttribute(elem, &size_str, &val_str);
290 nsAString_GetData(&val_str, &val, NULL);
293 TRACE("found size %s\n", debugstr_w(val));
297 nsAString_Finish(&size_str);
298 nsAString_Finish(&val_str);
301 nsAString_Finish(&tag_str);
303 nsIDOMElement_Release(elem);
310 nsIDOMNode_GetParentNode(node, &node);
311 nsIDOMNode_Release(tmp_node);
315 nsIDOMNode_Release(node);
318 static void set_font_size(HTMLDocument *This, LPCWSTR size)
320 nsISelection *nsselection;
322 nsIDOMDocument *nsdoc;
325 PRInt32 range_cnt = 0;
331 nsselection = get_ns_selection(This);
336 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
340 nsAString_Init(&font_str, wszFont);
341 nsAString_Init(&size_str, wszSize);
342 nsAString_Init(&val_str, size);
344 nsISelection_GetRangeCount(nsselection, &range_cnt);
346 FIXME("range_cnt %d not supprted\n", range_cnt);
348 nsIDOMDocument_CreateElement(nsdoc, &font_str, &elem);
349 nsIDOMElement_SetAttribute(elem, &size_str, &val_str);
351 nsISelection_GetRangeAt(nsselection, 0, &range);
352 nsISelection_GetIsCollapsed(nsselection, &collapsed);
353 nsISelection_RemoveAllRanges(nsselection);
355 nsIDOMRange_SurroundContents(range, (nsIDOMNode*)elem);
358 nsISelection_Collapse(nsselection, (nsIDOMNode*)elem, 0);
360 /* Remove all size attrbutes from the range */
361 remove_child_attr(elem, wszFont, &size_str);
362 nsISelection_SelectAllChildren(nsselection, (nsIDOMNode*)elem);
365 nsIDOMRange_Release(range);
366 nsIDOMElement_Release(elem);
368 nsAString_Finish(&font_str);
369 nsAString_Finish(&size_str);
370 nsAString_Finish(&val_str);
372 nsISelection_Release(nsselection);
373 nsIDOMDocument_Release(nsdoc);
376 static BOOL is_visible_text_node(nsIDOMNode *node)
378 nsIDOMCharacterData *char_data;
383 nsIDOMNode_QueryInterface(node, &IID_nsIDOMCharacterData, (void**)&char_data);
385 nsIDOMCharacterData_GetLength(char_data, &len);
387 nsAString_Init(&data_str, NULL);
388 nsIDOMCharacterData_GetData(char_data, &data_str);
389 nsAString_GetData(&data_str, &data, NULL);
393 for(ptr=data+1; ptr && isspaceW(*ptr); ptr++)
397 nsAString_Finish(&data_str);
399 nsIDOMCharacterData_Release(char_data);
404 static nsIDOMNode *get_child_text_node(nsIDOMNode *node, BOOL first)
406 nsIDOMNode *iter, *iter2;
409 nsIDOMNode_GetFirstChild(node, &iter);
411 nsIDOMNode_GetLastChild(node, &iter);
416 nsIDOMNode_GetNodeType(iter, &node_type);
419 if(is_visible_text_node(iter))
422 iter2 = get_child_text_node(iter, first);
424 nsIDOMNode_Release(iter);
430 nsIDOMNode_GetNextSibling(iter, &iter2);
432 nsIDOMNode_GetPreviousSibling(iter, &iter2);
434 nsIDOMNode_Release(iter);
441 static nsIDOMNode *get_next_text_node(nsIDOMNode *node, BOOL next)
443 nsIDOMNode *iter, *iter2 = NULL, *parent = NULL;
447 nsIDOMNode_AddRef(iter);
451 nsIDOMNode_GetNextSibling(iter, &iter2);
453 nsIDOMNode_GetPreviousSibling(iter, &iter2);
456 nsIDOMNode_GetParentNode(iter, &parent);
457 nsIDOMNode_Release(iter);
464 nsIDOMNode_GetNextSibling(iter, &iter2);
466 nsIDOMNode_GetPreviousSibling(iter, &iter2);
469 nsIDOMNode_Release(iter);
472 nsIDOMNode_GetNodeType(iter, &node_type);
476 if(is_visible_text_node(iter))
479 iter2 = get_child_text_node(iter, next);
481 nsIDOMNode_Release(iter);
490 static void collapse_end_node(nsISelection *selection, nsIDOMNode *node)
492 nsIDOMCharacterData *char_data;
495 nsIDOMNode_QueryInterface(node, &IID_nsIDOMCharacterData, (void**)&char_data);
496 nsIDOMCharacterData_GetLength(char_data, &len);
497 nsIDOMCharacterData_Release(char_data);
499 nsISelection_Collapse(selection, node, len);
502 static void collapse_next_char(HTMLDocument *doc, nsIDOMKeyEvent *event, BOOL next)
504 nsISelection *selection = get_ns_selection(doc);
508 nsIDOMNode *text_node;
510 nsIDOMKeyEvent_GetCtrlKey(event, &b);
513 nsIDOMKeyEvent_GetShiftKey(event, &b);
516 nsISelection_GetIsCollapsed(selection, &collapsed);
518 nsISelection_CollapseToEnd(selection);
520 nsISelection_GetFocusNode(selection, &node);
521 nsIDOMNode_GetNodeType(node, &node_type);
523 if(node_type == TEXT_NODE) {
524 nsIDOMCharacterData *char_data;
528 nsISelection_GetFocusOffset(selection, &offset);
530 nsIDOMNode_QueryInterface(node, &IID_nsIDOMCharacterData, (void**)&char_data);
531 nsIDOMCharacterData_GetLength(char_data, &len);
532 nsIDOMCharacterData_Release(char_data);
534 if(next ? offset != len : offset) {
535 nsISelection_Collapse(selection, node, offset + (next?1:-1));
540 text_node = get_next_text_node(node, next);
543 nsISelection_Collapse(selection, text_node, 1);
545 collapse_end_node(selection, text_node);
546 nsIDOMNode_Release(text_node);
549 nsIDOMNode_Release(node);
550 nsISelection_Release(selection);
553 void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
555 nsIDOMKeyEvent *key_event;
558 nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
560 nsIDOMKeyEvent_GetKeyCode(key_event, &code);
565 collapse_next_char(This, key_event, FALSE);
569 collapse_next_char(This, key_event, TRUE);
572 nsIDOMKeyEvent_Release(key_event);
575 static void set_ns_fontname(NSContainer *This, const char *fontname)
577 nsICommandParams *nsparam = create_nscommand_params();
579 nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, fontname);
580 do_ns_command(This, NSCMD_FONTFACE, nsparam);
581 nsICommandParams_Release(nsparam);
584 static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
586 TRACE("(%p)->(%p %p)\n", This, in, out);
588 if(!This->nscontainer)
595 if(V_VT(in) != VT_BSTR) {
596 FIXME("Unsupported vt=%d\n", V_VT(out));
600 TRACE("%s\n", debugstr_w(V_BSTR(in)));
602 len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, NULL, 0, NULL, NULL);
603 stra = mshtml_alloc(len);
604 WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, stra, -1, NULL, NULL);
606 set_ns_fontname(This->nscontainer, stra);
610 update_doc(This, UPDATE_UI);
614 nsICommandParams *nsparam;
620 nsparam = create_nscommand_params();
622 nsres = get_ns_command_state(This->nscontainer, NSCMD_FONTFACE, nsparam);
626 nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &stra);
627 nsICommandParams_Release(nsparam);
629 len = MultiByteToWideChar(CP_ACP, 0, stra, -1, NULL, 0);
630 strw = mshtml_alloc(len*sizeof(WCHAR));
631 MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, -1);
635 V_BSTR(out) = SysAllocString(strw);
642 static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
644 TRACE("(%p)->(%p %p)\n", This, in, out);
647 if(V_VT(in) == VT_I4) {
648 nsICommandParams *nsparam = create_nscommand_params();
651 sprintf(color_str, "#%02x%02x%02x",
652 V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff);
654 nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str);
655 do_ns_command(This->nscontainer, NSCMD_FONTCOLOR, nsparam);
657 nsICommandParams_Release(nsparam);
659 FIXME("unsupported in vt=%d\n", V_VT(in));
664 FIXME("unsupported out\n");
671 static HRESULT exec_fontsize(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
673 TRACE("(%p)->(%p %p)\n", This, in, out);
680 get_font_size(This, val);
681 V_I4(out) = strtolW(val, NULL, 10);
684 get_font_size(This, val);
685 V_BSTR(out) = SysAllocString(val);
688 FIXME("unsupported vt %d\n", V_VT(out));
696 static const WCHAR format[] = {'%','d',0};
697 wsprintfW(size, format, V_I4(in));
698 set_font_size(This, size);
702 set_font_size(This, V_BSTR(in));
705 FIXME("unsupported vt %d\n", V_VT(in));
712 static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
714 TRACE("(%p)\n", This);
717 FIXME("unsupported args\n");
719 if(This->nscontainer)
720 do_ns_command(This->nscontainer, NSCMD_BOLD, NULL);
725 static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
727 TRACE("(%p)\n", This);
730 FIXME("unsupported args\n");
732 if(This->nscontainer)
733 do_ns_command(This->nscontainer, NSCMD_ITALIC, NULL);
738 static HRESULT query_justify(HTMLDocument *This, OLECMD *cmd)
741 case IDM_JUSTIFYCENTER:
742 TRACE("(%p) IDM_JUSTIFYCENTER\n", This);
743 cmd->cmdf = query_align_status(This, NSALIGN_CENTER);
745 case IDM_JUSTIFYLEFT:
746 TRACE("(%p) IDM_JUSTIFYLEFT\n", This);
747 /* FIXME: We should set OLECMDF_LATCHED only if it's set explicitly. */
748 if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
749 cmd->cmdf = OLECMDF_SUPPORTED;
751 cmd->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
753 case IDM_JUSTIFYRIGHT:
754 TRACE("(%p) IDM_JUSTIFYRIGHT\n", This);
755 cmd->cmdf = query_align_status(This, NSALIGN_RIGHT);
762 static HRESULT exec_justifycenter(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
764 TRACE("(%p)\n", This);
767 FIXME("unsupported args\n");
769 set_ns_align(This, NSALIGN_CENTER);
773 static HRESULT exec_justifyleft(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
775 TRACE("(%p)\n", This);
778 FIXME("unsupported args\n");
780 set_ns_align(This, NSALIGN_LEFT);
784 static HRESULT exec_justifyright(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
786 TRACE("(%p)\n", This);
787 set_ns_align(This, NSALIGN_RIGHT);
791 static HRESULT exec_underline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
793 TRACE("(%p)\n", This);
796 FIXME("unsupported args\n");
798 if(This->nscontainer)
799 do_ns_command(This->nscontainer, NSCMD_UNDERLINE, NULL);
804 static HRESULT exec_horizontalline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
806 TRACE("(%p)\n", This);
809 FIXME("unsupported args\n");
811 if(This->nscontainer)
812 do_ns_command(This->nscontainer, NSCMD_INSERTHR, NULL);
817 static HRESULT exec_orderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
819 TRACE("(%p)\n", This);
822 FIXME("unsupported args\n");
824 if(This->nscontainer)
825 do_ns_command(This->nscontainer, NSCMD_OL, NULL);
830 static HRESULT exec_unorderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
832 TRACE("(%p)\n", This);
835 FIXME("unsupported args\n");
837 if(This->nscontainer)
838 do_ns_command(This->nscontainer, NSCMD_UL, NULL);
843 static HRESULT exec_indent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
845 TRACE("(%p)\n", This);
848 FIXME("unsupported args\n");
850 if(This->nscontainer)
851 do_ns_command(This->nscontainer, NSCMD_INDENT, NULL);
856 static HRESULT exec_outdent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
858 TRACE("(%p)\n", This);
861 FIXME("unsupported args\n");
863 if(This->nscontainer)
864 do_ns_command(This->nscontainer, NSCMD_OUTDENT, NULL);
869 static HRESULT exec_composesettings(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
871 if(out || !in || V_VT(in) != VT_BSTR) {
872 WARN("invalid arg\n");
876 FIXME("%s\n", debugstr_w(V_BSTR(in)));
881 static HRESULT query_edit_status(HTMLDocument *This, OLECMD *cmd)
885 TRACE("CGID_MSHTML: IDM_FONTNAME\n");
886 cmd->cmdf = query_ns_edit_status(This, NULL);
889 TRACE("CGID_MSHTML: IDM_FONTSIZE\n");
890 cmd->cmdf = query_ns_edit_status(This, NULL);
893 TRACE("CGID_MSHTML: IDM_BOLD\n");
894 cmd->cmdf = query_ns_edit_status(This, NSCMD_BOLD);
897 TRACE("CGID_MSHTML: IDM_FORECOLOR\n");
898 cmd->cmdf = query_ns_edit_status(This, NULL);
901 TRACE("CGID_MSHTML: IDM_ITALIC\n");
902 cmd->cmdf = query_ns_edit_status(This, NSCMD_ITALIC);
905 TRACE("CGID_MSHTML: IDM_UNDERLINE\n");
906 cmd->cmdf = query_ns_edit_status(This, NSCMD_UNDERLINE);
908 case IDM_HORIZONTALLINE:
909 TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
910 cmd->cmdf = query_ns_edit_status(This, NULL);
913 TRACE("CGID_MSHTML: IDM_ORDERLIST\n");
914 cmd->cmdf = query_ns_edit_status(This, NSCMD_OL);
916 case IDM_UNORDERLIST:
917 TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
918 cmd->cmdf = query_ns_edit_status(This, NSCMD_UL);
921 TRACE("CGID_MSHTML: IDM_INDENT\n");
922 cmd->cmdf = query_ns_edit_status(This, NULL);
925 TRACE("CGID_MSHTML: IDM_OUTDENT\n");
926 cmd->cmdf = query_ns_edit_status(This, NULL);
933 const cmdtable_t editmode_cmds[] = {
934 {IDM_FONTNAME, query_edit_status, exec_fontname},
935 {IDM_FONTSIZE, query_edit_status, exec_fontsize},
936 {IDM_FORECOLOR, query_edit_status, exec_forecolor},
937 {IDM_BOLD, query_edit_status, exec_bold},
938 {IDM_ITALIC, query_edit_status, exec_italic},
939 {IDM_JUSTIFYCENTER, query_justify, exec_justifycenter},
940 {IDM_JUSTIFYRIGHT, query_justify, exec_justifyright},
941 {IDM_JUSTIFYLEFT, query_justify, exec_justifyleft},
942 {IDM_UNDERLINE, query_edit_status, exec_underline},
943 {IDM_HORIZONTALLINE, query_edit_status, exec_horizontalline},
944 {IDM_ORDERLIST, query_edit_status, exec_orderlist},
945 {IDM_UNORDERLIST, query_edit_status, exec_unorderlist},
946 {IDM_INDENT, query_edit_status, exec_indent},
947 {IDM_OUTDENT, query_edit_status, exec_outdent},
948 {IDM_COMPOSESETTINGS, NULL, exec_composesettings},
952 void init_editor(HTMLDocument *This)
954 if(!This->nscontainer)
957 set_ns_fontname(This->nscontainer, "Times New Roman");