ReactOS  0.4.14-dev-583-g2a1ba2c
editor.c
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2007 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #include "mshtml_private.h"
20 
21 #define NSCMD_ALIGN "cmd_align"
22 #define NSCMD_BEGINLINE "cmd_beginLine"
23 #define NSCMD_BOLD "cmd_bold"
24 #define NSCMD_CHARNEXT "cmd_charNext"
25 #define NSCMD_CHARPREVIOUS "cmd_charPrevious"
26 #define NSCMD_COPY "cmd_copy"
27 #define NSCMD_CUT "cmd_cut"
28 #define NSCMD_DELETECHARFORWARD "cmd_deleteCharForward"
29 #define NSCMD_DELETEWORDFORWARD "cmd_deleteWordForward"
30 #define NSCMD_ENDLINE "cmd_endLine"
31 #define NSCMD_FONTCOLOR "cmd_fontColor"
32 #define NSCMD_FONTFACE "cmd_fontFace"
33 #define NSCMD_INDENT "cmd_indent"
34 #define NSCMD_INSERTHR "cmd_insertHR"
35 #define NSCMD_INSERTLINKNOUI "cmd_insertLinkNoUI"
36 #define NSCMD_ITALIC "cmd_italic"
37 #define NSCMD_LINENEXT "cmd_lineNext"
38 #define NSCMD_LINEPREVIOUS "cmd_linePrevious"
39 #define NSCMD_MOVEBOTTOM "cmd_moveBottom"
40 #define NSCMD_MOVEPAGEDOWN "cmd_movePageDown"
41 #define NSCMD_MOVEPAGEUP "cmd_movePageUp"
42 #define NSCMD_MOVETOP "cmd_moveTop"
43 #define NSCMD_OL "cmd_ol"
44 #define NSCMD_OUTDENT "cmd_outdent"
45 #define NSCMD_PASTE "cmd_paste"
46 #define NSCMD_SELECTBEGINLINE "cmd_selectBeginLine"
47 #define NSCMD_SELECTBOTTOM "cmd_selectBottom"
48 #define NSCMD_SELECTCHARNEXT "cmd_selectCharNext"
49 #define NSCMD_SELECTCHARPREVIOUS "cmd_selectCharPrevious"
50 #define NSCMD_SELECTENDLINE "cmd_selectEndLine"
51 #define NSCMD_SELECTLINENEXT "cmd_selectLineNext"
52 #define NSCMD_SELECTLINEPREVIOUS "cmd_selectLinePrevious"
53 #define NSCMD_SELECTPAGEDOWN "cmd_selectPageDown"
54 #define NSCMD_SELECTPAGEUP "cmd_selectPageUp"
55 #define NSCMD_SELECTTOP "cmd_selectTop"
56 #define NSCMD_SELECTWORDNEXT "cmd_selectWordNext"
57 #define NSCMD_SELECTWORDPREVIOUS "cmd_selectWordPrevious"
58 #define NSCMD_UL "cmd_ul"
59 #define NSCMD_UNDERLINE "cmd_underline"
60 #define NSCMD_WORDNEXT "cmd_wordNext"
61 #define NSCMD_WORDPREVIOUS "cmd_wordPrevious"
62 
63 #define NSSTATE_ATTRIBUTE "state_attribute"
64 #define NSSTATE_ALL "state_all"
65 
66 #define NSALIGN_CENTER "center"
67 #define NSALIGN_LEFT "left"
68 #define NSALIGN_RIGHT "right"
69 
70 #define DOM_VK_LEFT VK_LEFT
71 #define DOM_VK_UP VK_UP
72 #define DOM_VK_RIGHT VK_RIGHT
73 #define DOM_VK_DOWN VK_DOWN
74 #define DOM_VK_DELETE VK_DELETE
75 #define DOM_VK_HOME VK_HOME
76 #define DOM_VK_END VK_END
77 
78 static const WCHAR fontW[] = {'f','o','n','t',0};
79 static const WCHAR sizeW[] = {'s','i','z','e',0};
80 
82 {
83  nsresult nsres;
84 
85  if(This->doc_obj->usermode != EDITMODE || !This->doc_obj->nscontainer || !This->doc_obj->nscontainer->editor)
86  return;
87 
88  if(dirty) {
89  nsres = nsIEditor_IncrementModificationCount(This->doc_obj->nscontainer->editor, 1);
90  if(NS_FAILED(nsres))
91  ERR("IncrementModificationCount failed: %08x\n", nsres);
92  }else {
93  nsres = nsIEditor_ResetModificationCount(This->doc_obj->nscontainer->editor);
94  if(NS_FAILED(nsres))
95  ERR("ResetModificationCount failed: %08x\n", nsres);
96  }
97 }
98 
99 static void do_ns_editor_command(NSContainer *This, const char *cmd)
100 {
101  nsresult nsres;
102 
103  if(!This->editor_controller)
104  return;
105 
106  nsres = nsIController_DoCommand(This->editor_controller, cmd);
107  if(NS_FAILED(nsres))
108  ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
109 }
110 
112 {
113  nsICommandManager *cmdmgr;
114  nsresult nsres;
115 
116  nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
117  if(NS_FAILED(nsres)) {
118  ERR("Could not get nsICommandManager: %08x\n", nsres);
119  return nsres;
120  }
121 
122  nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, This->doc->basedoc.window->nswindow, nsparam);
123  if(NS_FAILED(nsres))
124  ERR("GetCommandState(%s) failed: %08x\n", debugstr_a(cmd), nsres);
125 
126  nsICommandManager_Release(cmdmgr);
127  return nsres;
128 }
129 
130 static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
131 {
132  nsICommandParams *nsparam;
133  cpp_bool b = FALSE;
134 
135  if(This->doc_obj->usermode != EDITMODE || This->window->readystate < READYSTATE_INTERACTIVE)
136  return OLECMDF_SUPPORTED;
137 
138  if(This->doc_obj->nscontainer && nscmd) {
139  nsparam = create_nscommand_params();
140  get_ns_command_state(This->doc_obj->nscontainer, nscmd, nsparam);
141 
142  nsICommandParams_GetBooleanValue(nsparam, NSSTATE_ALL, &b);
143 
144  nsICommandParams_Release(nsparam);
145  }
146 
147  return OLECMDF_SUPPORTED | OLECMDF_ENABLED | (b ? OLECMDF_LATCHED : 0);
148 }
149 
150 static void set_ns_align(HTMLDocument *This, const char *align_str)
151 {
152  nsICommandParams *nsparam;
153 
154  if(!This->doc_obj->nscontainer)
155  return;
156 
157  nsparam = create_nscommand_params();
158  nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str);
159 
160  do_ns_command(This, NSCMD_ALIGN, nsparam);
161 
162  nsICommandParams_Release(nsparam);
163 }
164 
166 {
167  DWORD ret = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
168  nsAString justify_str;
169  cpp_bool b;
170  nsresult nsres;
171 
172  if(This->doc_obj->usermode != EDITMODE || This->window->readystate < READYSTATE_INTERACTIVE)
173  return OLECMDF_SUPPORTED;
174 
175  nsAString_Init(&justify_str, align);
176  nsres = nsIDOMHTMLDocument_QueryCommandState(This->doc_node->nsdoc, &justify_str, &b);
177  nsAString_Finish(&justify_str);
178  if(NS_SUCCEEDED(nsres) && b)
179  ret |= OLECMDF_LATCHED;
180 
181  return ret;
182 }
183 
184 
186 {
187  nsISelection *nsselection = NULL;
188  nsresult nsres;
189 
190  nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
191  if(NS_FAILED(nsres))
192  ERR("GetSelection failed %08x\n", nsres);
193 
194  return nsselection;
195 
196 }
197 
199 {
200  cpp_bool has_children;
201  UINT32 child_cnt, i;
202  nsIDOMNode *child_node;
203  nsIDOMNodeList *node_list;
204  UINT16 node_type;
205 
206  nsIDOMElement_HasChildNodes(elem, &has_children);
207  if(!has_children)
208  return;
209 
210  nsIDOMElement_GetChildNodes(elem, &node_list);
211  nsIDOMNodeList_GetLength(node_list, &child_cnt);
212 
213  for(i=0; i<child_cnt; i++) {
214  nsIDOMNodeList_Item(node_list, i, &child_node);
215 
216  nsIDOMNode_GetNodeType(child_node, &node_type);
217  if(node_type == ELEMENT_NODE) {
218  nsIDOMElement *child_elem;
219  nsAString tag_str;
220  const PRUnichar *ctag;
221 
222  nsIDOMNode_QueryInterface(child_node, &IID_nsIDOMElement, (void**)&child_elem);
223 
224  nsAString_Init(&tag_str, NULL);
225  nsIDOMElement_GetTagName(child_elem, &tag_str);
226  nsAString_GetData(&tag_str, &ctag);
227 
228  if(!strcmpiW(ctag, tag))
229  /* FIXME: remove node if there are no more attributes */
230  nsIDOMElement_RemoveAttribute(child_elem, attr_str);
231 
232  nsAString_Finish(&tag_str);
233 
234  remove_child_attr(child_elem, tag, attr_str);
235 
236  nsIDOMElement_Release(child_elem);
237  }
238 
239  nsIDOMNode_Release(child_node);
240  }
241 
242  nsIDOMNodeList_Release(node_list);
243 }
244 
246 {
247  nsISelection *nsselection = get_ns_selection(This);
249  nsIDOMNode *node = NULL, *tmp_node;
250  nsAString tag_str;
251  LPCWSTR tag;
252  UINT16 node_type;
253  nsresult nsres;
254 
255  *ret = 0;
256 
257  if(!nsselection)
258  return;
259 
260  nsISelection_GetFocusNode(nsselection, &node);
261  nsISelection_Release(nsselection);
262 
263  while(node) {
264  nsres = nsIDOMNode_GetNodeType(node, &node_type);
265  if(NS_FAILED(nsres) || node_type == DOCUMENT_NODE)
266  break;
267 
268  if(node_type == ELEMENT_NODE) {
269  nsIDOMNode_QueryInterface(node, &IID_nsIDOMHTMLElement, (void**)&elem);
270 
271  nsAString_Init(&tag_str, NULL);
272  nsIDOMHTMLElement_GetTagName(elem, &tag_str);
273  nsAString_GetData(&tag_str, &tag);
274 
275  if(!strcmpiW(tag, fontW)) {
276  nsAString val_str;
277  const PRUnichar *val;
278 
279  TRACE("found font tag %p\n", elem);
280 
281  get_elem_attr_value(elem, sizeW, &val_str, &val);
282  if(*val) {
283  TRACE("found size %s\n", debugstr_w(val));
284  strcpyW(ret, val);
285  }
286 
287  nsAString_Finish(&val_str);
288  }
289 
290  nsAString_Finish(&tag_str);
291  nsIDOMHTMLElement_Release(elem);
292  }
293 
294  if(*ret)
295  break;
296 
297  tmp_node = node;
298  nsIDOMNode_GetParentNode(node, &node);
299  nsIDOMNode_Release(tmp_node);
300  }
301 
302  if(node)
303  nsIDOMNode_Release(node);
304 }
305 
307 {
308  nsISelection *nsselection;
309  cpp_bool collapsed;
312  LONG range_cnt = 0;
313  nsAString size_str;
314  nsAString val_str;
315 
316  if(!This->doc_node->nsdoc) {
317  WARN("NULL nsdoc\n");
318  return;
319  }
320 
321  nsselection = get_ns_selection(This);
322  if(!nsselection)
323  return;
324 
325  nsISelection_GetRangeCount(nsselection, &range_cnt);
326  if(range_cnt != 1) {
327  FIXME("range_cnt %d not supprted\n", range_cnt);
328  if(!range_cnt) {
329  nsISelection_Release(nsselection);
330  return;
331  }
332  }
333 
334  create_nselem(This->doc_node, fontW, &elem);
335 
336  nsAString_InitDepend(&size_str, sizeW);
337  nsAString_InitDepend(&val_str, size);
338 
339  nsIDOMHTMLElement_SetAttribute(elem, &size_str, &val_str);
340  nsAString_Finish(&val_str);
341 
342  nsISelection_GetRangeAt(nsselection, 0, &range);
343  nsISelection_GetIsCollapsed(nsselection, &collapsed);
344  nsISelection_RemoveAllRanges(nsselection);
345 
346  nsIDOMRange_SurroundContents(range, (nsIDOMNode*)elem);
347 
348  if(collapsed) {
349  nsISelection_Collapse(nsselection, (nsIDOMNode*)elem, 0);
350  }else {
351  /* Remove all size attributes from the range */
352  remove_child_attr((nsIDOMElement*)elem, fontW, &size_str);
353  nsISelection_SelectAllChildren(nsselection, (nsIDOMNode*)elem);
354  }
355 
356  nsISelection_Release(nsselection);
357  nsIDOMRange_Release(range);
358  nsIDOMHTMLElement_Release(elem);
359 
360  nsAString_Finish(&size_str);
361 
362  set_dirty(This, VARIANT_TRUE);
363 }
364 
365 static void handle_arrow_key(HTMLDocument *This, nsIDOMKeyEvent *event, const char * const cmds[4])
366 {
367  int i=0;
368  cpp_bool b;
369 
370  nsIDOMKeyEvent_GetCtrlKey(event, &b);
371  if(b)
372  i |= 1;
373 
374  nsIDOMKeyEvent_GetShiftKey(event, &b);
375  if(b)
376  i |= 2;
377 
378  if(cmds[i])
379  do_ns_editor_command(This->doc_obj->nscontainer, cmds[i]);
380 
381  nsIDOMKeyEvent_PreventDefault(event);
382 }
383 
385 {
387  UINT32 code;
388 
389  nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
390 
391  nsIDOMKeyEvent_GetKeyCode(key_event, &code);
392 
393  switch(code) {
394  case DOM_VK_LEFT: {
395  static const char * const cmds[] = {
400  };
401 
402  TRACE("left\n");
404  break;
405  }
406  case DOM_VK_RIGHT: {
407  static const char * const cmds[] = {
412  };
413 
414  TRACE("right\n");
416  break;
417  }
418  case DOM_VK_UP: {
419  static const char * const cmds[] = {
424  };
425 
426  TRACE("up\n");
428  break;
429  }
430  case DOM_VK_DOWN: {
431  static const char * const cmds[] = {
436  };
437 
438  TRACE("down\n");
440  break;
441  }
442  case DOM_VK_DELETE: {
443  static const char * const cmds[] = {
446  NULL, NULL
447  };
448 
449  TRACE("delete\n");
451  break;
452  }
453  case DOM_VK_HOME: {
454  static const char * const cmds[] = {
459  };
460 
461  TRACE("home\n");
463  break;
464  }
465  case DOM_VK_END: {
466  static const char * const cmds[] = {
471  };
472 
473  TRACE("end\n");
475  break;
476  }
477  }
478 
479  nsIDOMKeyEvent_Release(key_event);
480 }
481 
483 {
484  get_editor_controller(This->doc_obj->nscontainer);
485 }
486 
487 static void set_ns_fontname(HTMLDocument *This, const char *fontname)
488 {
490 
491  nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, fontname);
492  do_ns_command(This, NSCMD_FONTFACE, nsparam);
493  nsICommandParams_Release(nsparam);
494 }
495 
497 {
498  TRACE("(%p)->(%p %p)\n", This, in, out);
499 
500  if(This->doc_obj->nscontainer)
501  do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_DELETECHARFORWARD);
502 
504  return S_OK;
505 }
506 
508 {
509  TRACE("(%p)->(%p %p)\n", This, in, out);
510 
511  if(!This->doc_obj->nscontainer) {
513  return E_FAIL;
514  }
515 
516  if(in) {
517  char *stra;
518 
519  if(V_VT(in) != VT_BSTR) {
520  FIXME("Unsupported fontname %s\n", debugstr_variant(out));
521  return E_INVALIDARG;
522  }
523 
524  TRACE("%s\n", debugstr_w(V_BSTR(in)));
525 
526  stra = heap_strdupWtoA(V_BSTR(in));
527  set_ns_fontname(This, stra);
528  heap_free(stra);
529 
531  }
532 
533  if(out) {
534  nsICommandParams *nsparam;
535  LPWSTR strw;
536  char *stra;
537  DWORD len;
538  nsresult nsres;
539 
540  V_VT(out) = VT_BSTR;
541  V_BSTR(out) = NULL;
542 
543  nsparam = create_nscommand_params();
544 
545  nsres = get_ns_command_state(This->doc_obj->nscontainer, NSCMD_FONTFACE, nsparam);
546  if(NS_FAILED(nsres))
547  return S_OK;
548 
549  nsICommandParams_GetCStringValue(nsparam, NSSTATE_ATTRIBUTE, &stra);
550  nsICommandParams_Release(nsparam);
551 
552  len = MultiByteToWideChar(CP_ACP, 0, stra, -1, NULL, 0);
553  strw = heap_alloc(len*sizeof(WCHAR));
554  MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, len);
555  nsfree(stra);
556 
558  heap_free(strw);
559  }
560 
561  return S_OK;
562 }
563 
565 {
566  TRACE("(%p)->(%p %p)\n", This, in, out);
567 
568  if(in) {
569  if(V_VT(in) == VT_I4) {
571  char color_str[10];
572 
573  sprintf(color_str, "#%02x%02x%02x",
574  V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff);
575 
576  nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str);
578 
579  nsICommandParams_Release(nsparam);
580  }else {
581  FIXME("unsupported forecolor %s\n", debugstr_variant(in));
582  }
583 
585  }
586 
587  if(out) {
588  FIXME("unsupported out\n");
589  return E_NOTIMPL;
590  }
591 
592  return S_OK;
593 }
594 
596 {
597  TRACE("(%p)->(%p %p)\n", This, in, out);
598 
599  if(out) {
600  WCHAR val[10] = {0};
601 
603  V_VT(out) = VT_I4;
604  V_I4(out) = strtolW(val, NULL, 10);
605  }
606 
607  if(in) {
608  switch(V_VT(in)) {
609  case VT_I4: {
610  WCHAR size[10];
611  static const WCHAR format[] = {'%','d',0};
614  break;
615  }
616  case VT_BSTR:
618  break;
619  default:
620  FIXME("unsupported fontsize %s\n", debugstr_variant(in));
621  }
622 
624  }
625 
626  return S_OK;
627 }
628 
630 {
631 
632  FIXME("(%p)->(%p %p)\n", This, in, out);
633  return E_NOTIMPL;
634 }
635 
637 {
638  TRACE("(%p)\n", This);
639 
640  if(in || out)
641  FIXME("unsupported args\n");
642 
643  if(This->doc_obj->nscontainer)
645 
647  return S_OK;
648 }
649 
651 {
652  TRACE("(%p)\n", This);
653 
654  if(in || out)
655  FIXME("unsupported args\n");
656 
657  if(This->doc_obj->nscontainer)
659 
661  return S_OK;
662 }
663 
665 {
666  static const PRUnichar justifycenterW[] = {'j','u','s','t','i','f','y','c','e','n','t','e','r',0};
667  static const PRUnichar justifyrightW[] = {'j','u','s','t','i','f','y','r','i','g','h','t',0};
668 
669  switch(cmd->cmdID) {
670  case IDM_JUSTIFYCENTER:
671  TRACE("(%p) IDM_JUSTIFYCENTER\n", This);
672  cmd->cmdf = query_align_status(This, justifycenterW);
673  break;
674  case IDM_JUSTIFYLEFT:
675  TRACE("(%p) IDM_JUSTIFYLEFT\n", This);
676  /* FIXME: We should set OLECMDF_LATCHED only if it's set explicitly. */
677  if(This->doc_obj->usermode != EDITMODE || This->window->readystate < READYSTATE_INTERACTIVE)
678  cmd->cmdf = OLECMDF_SUPPORTED;
679  else
680  cmd->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
681  break;
682  case IDM_JUSTIFYRIGHT:
683  TRACE("(%p) IDM_JUSTIFYRIGHT\n", This);
684  cmd->cmdf = query_align_status(This, justifyrightW);
685  break;
686  }
687 
688  return S_OK;
689 }
690 
692 {
693  TRACE("(%p)\n", This);
694 
695  if(in || out)
696  FIXME("unsupported args\n");
697 
700  return S_OK;
701 }
702 
704 {
705  TRACE("(%p)\n", This);
706 
707  if(in || out)
708  FIXME("unsupported args\n");
709 
712  return S_OK;
713 }
714 
716 {
717  TRACE("(%p)\n", This);
718 
719  if(in || out)
720  FIXME("unsupported args\n");
721 
724  return S_OK;
725 }
726 
728 {
729  TRACE("(%p)\n", This);
730 
731  if(in || out)
732  FIXME("unsupported args\n");
733 
736  return S_OK;
737 }
738 
740 {
741  TRACE("(%p)\n", This);
742 
743  if(in || out)
744  FIXME("unsupported args\n");
745 
748  return S_OK;
749 }
750 
752 {
753  TRACE("(%p)\n", This);
754 
755  if(in || out)
756  FIXME("unsupported args\n");
757 
760  return S_OK;
761 }
762 
764 {
765  TRACE("(%p)\n", This);
766 
767  if(in || out)
768  FIXME("unsupported args\n");
769 
772  return S_OK;
773 }
774 
776 {
777  TRACE("(%p)\n", This);
778 
779  if(in || out)
780  FIXME("unsupported args\n");
781 
784  return S_OK;
785 }
786 
788 {
789  TRACE("(%p)\n", This);
790 
791  if(in || out)
792  FIXME("unsupported args\n");
793 
796  return S_OK;
797 }
798 
800 {
801  WCHAR *ptr;
802 
803  if(out || !in || V_VT(in) != VT_BSTR) {
804  WARN("invalid arg %s\n", debugstr_variant(in));
805  return E_INVALIDARG;
806  }
807 
808  TRACE("(%p)->(%x %s)\n", This, cmdexecopt, debugstr_w(V_BSTR(in)));
809 
811 
812  ptr = V_BSTR(in);
813  if(*ptr == '1')
814  exec_bold(This, cmdexecopt, NULL, NULL);
815  ptr = strchrW(ptr, ',');
816  if(!ptr)
817  return S_OK;
818 
819  if(*++ptr == '1')
820  exec_italic(This, cmdexecopt, NULL, NULL);
821  ptr = strchrW(ptr, ',');
822  if(!ptr)
823  return S_OK;
824 
825  if(*++ptr == '1')
826  exec_underline(This, cmdexecopt, NULL, NULL);
827  ptr = strchrW(ptr, ',');
828  if(!ptr)
829  return S_OK;
830 
831  if(isdigitW(*++ptr)) {
832  VARIANT v;
833 
834  V_VT(&v) = VT_I4;
835  V_I4(&v) = *ptr-'0';
836 
837  exec_fontsize(This, cmdexecopt, &v, NULL);
838  }
839  ptr = strchrW(ptr, ',');
840  if(!ptr)
841  return S_OK;
842 
843  if(*++ptr != ',')
844  FIXME("set font color\n");
845  ptr = strchrW(ptr, ',');
846  if(!ptr)
847  return S_OK;
848 
849  if(*++ptr != ',')
850  FIXME("set background color\n");
851  ptr = strchrW(ptr, ',');
852  if(!ptr)
853  return S_OK;
854 
855  ptr++;
856  if(*ptr) {
857  VARIANT v;
858 
859  V_VT(&v) = VT_BSTR;
860  V_BSTR(&v) = SysAllocString(ptr);
861 
862  exec_fontname(This, cmdexecopt, &v, NULL);
863 
865  }
866 
867  return S_OK;
868 }
869 
871 {
873 
874  if(!This->doc_obj->nscontainer)
875  return E_FAIL;
876 
877  do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_COPY);
878  return S_OK;
879 }
880 
882 {
884 
885  if(!This->doc_obj->nscontainer)
886  return E_FAIL;
887 
888  do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_CUT);
889  return S_OK;
890 }
891 
893 {
895 
896  if(!This->doc_obj->nscontainer)
897  return E_FAIL;
898 
899  do_ns_editor_command(This->doc_obj->nscontainer, NSCMD_PASTE);
900  return S_OK;
901 }
902 
904 {
905  TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
906 
907  if(!in)
908  return S_OK;
909 
910  if(V_VT(in) == VT_BOOL)
911  set_dirty(This, V_BOOL(in));
912  else
913  FIXME("unsupported arg %s\n", debugstr_variant(in));
914 
915  return S_OK;
916 }
917 
919 {
920  switch(cmd->cmdID) {
921  case IDM_DELETE:
922  TRACE("CGID_MSHTML: IDM_DELETE\n");
923  cmd->cmdf = query_ns_edit_status(This, NULL);
924  break;
925  case IDM_FONTNAME:
926  TRACE("CGID_MSHTML: IDM_FONTNAME\n");
927  cmd->cmdf = query_ns_edit_status(This, NULL);
928  break;
929  case IDM_FONTSIZE:
930  TRACE("CGID_MSHTML: IDM_FONTSIZE\n");
931  cmd->cmdf = query_ns_edit_status(This, NULL);
932  break;
933  case IDM_BOLD:
934  TRACE("CGID_MSHTML: IDM_BOLD\n");
936  break;
937  case IDM_FORECOLOR:
938  TRACE("CGID_MSHTML: IDM_FORECOLOR\n");
939  cmd->cmdf = query_ns_edit_status(This, NULL);
940  break;
941  case IDM_ITALIC:
942  TRACE("CGID_MSHTML: IDM_ITALIC\n");
944  break;
945  case IDM_UNDERLINE:
946  TRACE("CGID_MSHTML: IDM_UNDERLINE\n");
948  break;
949  case IDM_HORIZONTALLINE:
950  TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
951  cmd->cmdf = query_ns_edit_status(This, NULL);
952  break;
953  case IDM_ORDERLIST:
954  TRACE("CGID_MSHTML: IDM_ORDERLIST\n");
956  break;
957  case IDM_UNORDERLIST:
958  TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
960  break;
961  case IDM_INDENT:
962  TRACE("CGID_MSHTML: IDM_INDENT\n");
963  cmd->cmdf = query_ns_edit_status(This, NULL);
964  break;
965  case IDM_OUTDENT:
966  TRACE("CGID_MSHTML: IDM_OUTDENT\n");
967  cmd->cmdf = query_ns_edit_status(This, NULL);
968  break;
969  case IDM_HYPERLINK:
970  TRACE("CGID_MSHTML: IDM_HYPERLINK\n");
971  cmd->cmdf = query_ns_edit_status(This, NULL);
972  break;
973  }
974 
975  return S_OK;
976 }
977 
979 {
980  static const WCHAR wszOther[] = {'(','o','t','h','e','r',')',0};
981  static const WCHAR wszFile[] = {'f','i','l','e',':',0};
982  static const WCHAR wszFtp[] = {'f','t','p',':',0};
983  static const WCHAR wszHttp[] = {'h','t','t','p',':',0};
984  static const WCHAR wszHttps[] = {'h','t','t','p','s',':',0};
985  static const WCHAR wszMailto[] = {'m','a','i','l','t','o',':',0};
986  static const WCHAR wszNews[] = {'n','e','w','s',':',0};
987 
988  switch (msg)
989  {
990  case WM_INITDIALOG:
991  {
992  INT def_idx;
993  HWND hwndCB = GetDlgItem(hwnd, IDC_TYPE);
994  HWND hwndURL = GetDlgItem(hwnd, IDC_URL);
995  INT len;
996 
998 
999  SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszOther);
1000  SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszFile);
1001  SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszFtp);
1002  def_idx = SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszHttp);
1004  SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszMailto);
1005  SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszNews);
1006  SendMessageW(hwndCB, CB_SETCURSEL, def_idx, 0);
1007 
1008  /* force the updating of the URL edit box */
1010 
1011  SetFocus(hwndURL);
1012  len = SendMessageW(hwndURL, WM_GETTEXTLENGTH, 0, 0);
1013  SendMessageW(hwndURL, EM_SETSEL, 0, len);
1014 
1015  return FALSE;
1016  }
1017  case WM_COMMAND:
1018  switch (wparam)
1019  {
1021  EndDialog(hwnd, wparam);
1022  return TRUE;
1023  case MAKEWPARAM(IDOK, BN_CLICKED):
1024  {
1026  HWND hwndURL = GetDlgItem(hwnd, IDC_URL);
1027  INT len = GetWindowTextLengthW(hwndURL);
1028  *url = SysAllocStringLen(NULL, len + 1);
1029  GetWindowTextW(hwndURL, *url, len + 1);
1030  EndDialog(hwnd, wparam);
1031  return TRUE;
1032  }
1034  {
1035  HWND hwndURL = GetDlgItem(hwnd, IDC_URL);
1036  INT item;
1037  INT len;
1038  LPWSTR type;
1039  LPWSTR url;
1040  LPWSTR p;
1041  static const WCHAR wszSlashSlash[] = {'/','/'};
1042 
1043  /* get string of currently selected hyperlink type */
1046  type = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
1048 
1049  if (!strcmpW(type, wszOther))
1050  *type = '\0';
1051 
1052  /* get current URL */
1053  len = GetWindowTextLengthW(hwndURL);
1054  url = HeapAlloc(GetProcessHeap(), 0, (len + strlenW(type) + 3) * sizeof(WCHAR));
1055  GetWindowTextW(hwndURL, url, len + 1);
1056 
1057  /* strip off old protocol */
1058  p = strchrW(url, ':');
1059  if (p && p[1] == '/' && p[2] == '/')
1060  p += 3;
1061  if (!p) p = url;
1062  memmove(url + (*type != '\0' ? strlenW(type) + 2 : 0), p, (len + 1 - (p - url)) * sizeof(WCHAR));
1063 
1064  /* add new protocol */
1065  if (*type != '\0')
1066  {
1067  memcpy(url, type, (strlenW(type) + 1) * sizeof(WCHAR));
1068  if (strcmpW(type, wszMailto) && strcmpW(type, wszNews))
1069  memcpy(url + strlenW(type), wszSlashSlash, sizeof(wszSlashSlash));
1070  }
1071 
1072  SetWindowTextW(hwndURL, url);
1073 
1074  HeapFree(GetProcessHeap(), 0, url);
1075  HeapFree(GetProcessHeap(), 0, type);
1076  return TRUE;
1077  }
1078  }
1079  return FALSE;
1080  case WM_CLOSE:
1082  return TRUE;
1083  default:
1084  return FALSE;
1085  }
1086 }
1087 
1089 {
1090  nsAString href_str, ns_url;
1091  nsIHTMLEditor *html_editor;
1092  nsIDOMHTMLElement *anchor_elem;
1093  cpp_bool insert_link_at_caret;
1094  nsISelection *nsselection;
1095  BSTR url = NULL;
1096  INT ret;
1097  HRESULT hres = E_FAIL;
1098 
1099  static const WCHAR aW[] = {'a',0};
1100  static const WCHAR hrefW[] = {'h','r','e','f',0};
1101 
1102  TRACE("%p, 0x%x, %p, %p\n", This, cmdexecopt, in, out);
1103 
1104  if (cmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER)
1105  {
1106  if (!in || V_VT(in) != VT_BSTR)
1107  {
1108  WARN("invalid arg\n");
1109  return E_INVALIDARG;
1110  }
1111  url = V_BSTR(in);
1112  }
1113  else
1114  {
1116  if (ret != IDOK)
1117  return OLECMDERR_E_CANCELED;
1118  }
1119 
1120  if(!This->doc_node->nsdoc) {
1121  WARN("NULL nsdoc\n");
1122  return E_UNEXPECTED;
1123  }
1124 
1125  nsselection = get_ns_selection(This);
1126  if (!nsselection)
1127  return E_FAIL;
1128 
1129  /* create an element for the link */
1130  create_nselem(This->doc_node, aW, &anchor_elem);
1131 
1132  nsAString_InitDepend(&href_str, hrefW);
1133  nsAString_InitDepend(&ns_url, url);
1134  nsIDOMHTMLElement_SetAttribute(anchor_elem, &href_str, &ns_url);
1135  nsAString_Finish(&href_str);
1136 
1137  nsISelection_GetIsCollapsed(nsselection, &insert_link_at_caret);
1138 
1139  /* create an element with text of URL */
1140  if (insert_link_at_caret) {
1141  nsIDOMNode *unused_node;
1142  nsIDOMText *text_node;
1143 
1144  nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &ns_url, &text_node);
1145 
1146  /* wrap the <a> tags around the text element */
1147  nsIDOMHTMLElement_AppendChild(anchor_elem, (nsIDOMNode*)text_node, &unused_node);
1148  nsIDOMText_Release(text_node);
1149  nsIDOMNode_Release(unused_node);
1150  }
1151 
1152  nsAString_Finish(&ns_url);
1153 
1154  nsIEditor_QueryInterface(This->doc_obj->nscontainer->editor, &IID_nsIHTMLEditor, (void **)&html_editor);
1155  if (html_editor) {
1156  nsresult nsres;
1157 
1158  if (insert_link_at_caret) {
1159  /* add them to the document at the caret position */
1160  nsres = nsIHTMLEditor_InsertElementAtSelection(html_editor, (nsIDOMElement*)anchor_elem, FALSE);
1161  nsISelection_SelectAllChildren(nsselection, (nsIDOMNode*)anchor_elem);
1162  }else /* add them around the selection using the magic provided to us by nsIHTMLEditor */
1163  nsres = nsIHTMLEditor_InsertLinkAroundSelection(html_editor, (nsIDOMElement*)anchor_elem);
1164 
1165  nsIHTMLEditor_Release(html_editor);
1166  hres = NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
1167  }
1168 
1169  nsISelection_Release(nsselection);
1170  nsIDOMHTMLElement_Release(anchor_elem);
1171 
1172  if (cmdexecopt != OLECMDEXECOPT_DONTPROMPTUSER)
1173  SysFreeString(url);
1174 
1175  TRACE("-- 0x%08x\n", hres);
1176  return hres;
1177 }
1178 
1189  {IDM_FONT, NULL, exec_font},
1199  {0,NULL,NULL}
1200 };
1201 
1203 {
1205 
1206  set_ns_fontname(This, "Times New Roman");
1207 }
1208 
1210 {
1211  cpp_bool modified;
1212 
1213  if(!This->doc_obj->nscontainer || !This->doc_obj->nscontainer->editor)
1214  return S_FALSE;
1215 
1216  nsIEditor_GetDocumentModified(This->doc_obj->nscontainer->editor, &modified);
1217 
1218  return modified ? S_OK : S_FALSE;
1219 }
1220 
1222 {
1223  IMoniker *mon;
1224  HRESULT hres;
1225 
1226  if(doc->usermode == EDITMODE)
1227  return S_OK;
1228 
1229  doc->usermode = EDITMODE;
1230 
1231  if(doc->basedoc.window->mon) {
1232  CLSID clsid = IID_NULL;
1233  hres = IMoniker_GetClassID(doc->basedoc.window->mon, &clsid);
1234  if(SUCCEEDED(hres)) {
1235  /* We should use IMoniker::Save here */
1236  FIXME("Use CLSID %s\n", debugstr_guid(&clsid));
1237  }
1238  }
1239 
1240  if(doc->frame)
1241  IOleInPlaceFrame_SetStatusText(doc->frame, NULL);
1242 
1243  doc->basedoc.window->readystate = READYSTATE_UNINITIALIZED;
1244 
1245  if(doc->client) {
1246  IOleCommandTarget *cmdtrg;
1247 
1248  hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
1249  if(SUCCEEDED(hres)) {
1250  VARIANT var;
1251 
1252  V_VT(&var) = VT_I4;
1253  V_I4(&var) = 0;
1254  IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
1255 
1256  IOleCommandTarget_Release(cmdtrg);
1257  }
1258  }
1259 
1260  if(doc->hostui) {
1261  DOCHOSTUIINFO hostinfo;
1262 
1263  memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
1264  hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
1265  hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
1266  if(SUCCEEDED(hres))
1267  /* FIXME: use hostinfo */
1268  TRACE("hostinfo = {%u %08x %08x %s %s}\n",
1269  hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
1270  debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
1271  }
1272 
1273  update_doc(&doc->basedoc, UPDATE_UI);
1274 
1275  if(doc->basedoc.window->mon) {
1276  /* FIXME: We should find nicer way to do this */
1278 
1279  mon = doc->basedoc.window->mon;
1280  IMoniker_AddRef(mon);
1281  }else {
1282  static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
1283 
1285  if(FAILED(hres)) {
1286  FIXME("CreateURLMoniker failed: %08x\n", hres);
1287  return hres;
1288  }
1289  }
1290 
1291  hres = IPersistMoniker_Load(&doc->basedoc.IPersistMoniker_iface, TRUE, mon, NULL, 0);
1292  IMoniker_Release(mon);
1293  if(FAILED(hres))
1294  return hres;
1295 
1296  if(doc->ui_active) {
1297  if(doc->ip_window)
1299  if(doc->hostui)
1300  IDocHostUIHandler_HideUI(doc->hostui);
1301  }
1302 
1303  if(doc->ui_active) {
1304  RECT rcBorderWidths;
1305 
1306  if(doc->hostui)
1307  IDocHostUIHandler_ShowUI(doc->hostui, DOCHOSTUITYPE_AUTHOR,
1309  doc->frame, doc->ip_window);
1310 
1311  if(doc->ip_window)
1313 
1314  memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
1315  if(doc->frame)
1316  IOleInPlaceFrame_SetBorderSpace(doc->frame, &rcBorderWidths);
1317  }
1318 
1319  return S_OK;
1320 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define UPDATE_UI
static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:636
IOleInPlaceUIWindow * ip_window
#define DOM_VK_END
Definition: editor.c:76
#define NSCMD_SELECTBEGINLINE
Definition: editor.c:46
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
HRESULT editor_exec_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:870
static const WCHAR wszHttp[]
Definition: urlmon_main.c:389
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
Definition: editor.c:384
#define NSCMD_ITALIC
Definition: editor.c:36
static HRESULT exec_orderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:751
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define CB_GETLBTEXTLEN
Definition: winuser.h:1935
#define IDM_INDENT
Definition: mshtmcid.h:207
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
HRESULT setup_edit_mode(HTMLDocumentObj *doc)
Definition: editor.c:1221
#define IDOK
Definition: winuser.h:824
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define NSCMD_INDENT
Definition: editor.c:33
Definition: compat.h:1947
#define NSCMD_OUTDENT
Definition: editor.c:44
static HRESULT query_edit_status(HTMLDocument *This, OLECMD *cmd)
Definition: editor.c:918
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define NSALIGN_RIGHT
Definition: editor.c:68
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static HRESULT exec_outdent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:787
static HRESULT query_justify(HTMLDocument *This, OLECMD *cmd)
Definition: editor.c:664
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
static HRESULT exec_horizontalline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:739
#define DOM_VK_HOME
Definition: editor.c:75
#define NSCMD_WORDNEXT
Definition: editor.c:60
Definition: ftp_var.h:139
static void get_font_size(HTMLDocument *This, WCHAR *ret)
Definition: editor.c:245
IOleClientSite * client
#define NSCMD_SELECTBOTTOM
Definition: editor.c:47
#define NSCMD_MOVEPAGEDOWN
Definition: editor.c:40
#define CB_GETLBTEXT
Definition: winuser.h:1934
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:99
static HRESULT exec_justifyleft(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:703
static void set_ns_fontname(HTMLDocument *This, const char *fontname)
Definition: editor.c:487
#define NSCMD_SELECTCHARNEXT
Definition: editor.c:48
HRESULT editor_exec_paste(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:892
#define WARN(fmt,...)
Definition: debug.h:111
#define strtolW(s, e, b)
Definition: unicode.h:33
HTMLOuterWindow * window
#define NSCMD_CHARNEXT
Definition: editor.c:24
#define CALLBACK
Definition: compat.h:27
COMMAND cmds[]
Definition: main.c:21
static HRESULT exec_fontsize(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:595
nsresult get_elem_attr_value(nsIDOMHTMLElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
Definition: htmlelem.c:143
#define DOM_VK_RIGHT
Definition: editor.c:72
HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
Definition: htmlelem.c:246
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: ecma_167.h:138
static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:507
HWND WINAPI SetFocus(_In_opt_ HWND)
void handle_edit_load(HTMLDocument *This)
Definition: editor.c:482
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static HRESULT exec_delete(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:496
UINT_PTR WPARAM
Definition: windef.h:207
#define IDC_TYPE
Definition: resource.h:221
OLECHAR * BSTR
Definition: compat.h:1942
int align(int length, int align)
Definition: dsound8.c:36
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define NSCMD_COPY
Definition: editor.c:26
int32_t INT_PTR
Definition: typedefs.h:62
static const WCHAR wszHttps[]
Definition: urlmon_main.c:390
#define NSCMD_UL
Definition: editor.c:58
coclass HostDialogHelper DOCHOSTUITYPE_AUTHOR
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:56
short VARIANT_BOOL
Definition: compat.h:1939
#define NSCMD_SELECTWORDNEXT
Definition: editor.c:56
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define NSCMD_DELETEWORDFORWARD
Definition: editor.c:29
#define V_I4(A)
Definition: oleauto.h:247
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define NSCMD_MOVEPAGEUP
Definition: editor.c:41
struct node node
static DWORD query_align_status(HTMLDocument *This, const WCHAR *align)
Definition: editor.c:165
#define NSCMD_DELETECHARFORWARD
Definition: editor.c:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDM_ITALIC
Definition: mshtmcid.h:79
#define IDM_FONTNAME
Definition: mshtmcid.h:40
unsigned int UINT32
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
#define IDM_FORECOLOR
Definition: mshtmcid.h:78
long LONG
Definition: pedump.c:60
IOleCommandTarget IOleCommandTarget_iface
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define debugstr_w
Definition: kernel32.h:32
static size_t elem
Definition: string.c:68
#define NSCMD_SELECTLINEPREVIOUS
Definition: editor.c:52
#define NSCMD_WORDPREVIOUS
Definition: editor.c:61
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define IDM_HYPERLINK
Definition: mshtmcid.h:148
#define S_FALSE
Definition: winerror.h:2357
static HRESULT exec_underline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:727
#define E_INVALIDARG
Definition: ddrawi.h:101
static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:650
#define NSCMD_INSERTHR
Definition: editor.c:34
static const WCHAR aW[]
Definition: htmlelem.c:21
#define CB_INSERTSTRING
Definition: winuser.h:1939
void nsfree(void *) DECLSPEC_HIDDEN
Definition: nsembed.c:783
#define NSCMD_MOVEBOTTOM
Definition: editor.c:39
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
static HRESULT exec_justifyright(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:715
#define NSCMD_CUT
Definition: editor.c:27
LONG_PTR LPARAM
Definition: windef.h:208
#define NSCMD_SELECTCHARPREVIOUS
Definition: editor.c:49
static nsISelection * get_ns_selection(HTMLDocument *This)
Definition: editor.c:185
static const WCHAR sizeW[]
Definition: editor.c:79
#define IDM_FONT
Definition: osk_res.h:46
void remove_target_tasks(LONG) DECLSPEC_HIDDEN
Definition: task.c:107
#define debugstr_guid
Definition: kernel32.h:35
#define IDM_UNDERLINE
Definition: mshtmcid.h:86
#define DOM_VK_DOWN
Definition: editor.c:73
#define b
Definition: ke_i.h:79
#define IDM_DELETE
Definition: shresdef.h:785
GLuint GLfloat * val
Definition: glext.h:7180
#define NS_FAILED(res)
#define IDM_JUSTIFYCENTER
Definition: mshtmcid.h:80
static HRESULT exec_setdirty(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:903
unsigned char cpp_bool
Definition: atl.c:38
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static INT_PTR CALLBACK hyperlink_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: editor.c:978
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
#define NSCMD_FONTFACE
Definition: editor.c:32
#define GetProcessHeap()
Definition: compat.h:403
static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:564
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NSCMD_SELECTENDLINE
Definition: editor.c:50
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
#define IDC_URL
Definition: resource.h:41
static const WCHAR url[]
Definition: encode.c:1432
static void set_font_size(HTMLDocument *This, LPCWSTR size)
Definition: editor.c:306
HTMLDocument basedoc
static char * heap_strdupWtoA(const WCHAR *str)
#define IDM_JUSTIFYRIGHT
Definition: mshtmcid.h:83
static HRESULT exec_unorderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:763
#define WM_CLOSE
Definition: winuser.h:1603
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define EM_SETSEL
Definition: winuser.h:2000
#define V_BOOL(A)
Definition: oleauto.h:224
static FILE * out
Definition: regtests2xml.c:44
#define NSCMD_BOLD
Definition: editor.c:23
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NSCMD_SELECTLINENEXT
Definition: editor.c:51
#define NSCMD_MOVETOP
Definition: editor.c:42
#define NSCMD_SELECTWORDPREVIOUS
Definition: editor.c:57
#define NS_SUCCEEDED(res)
#define IDM_UNORDERLIST
Definition: mshtmcid.h:206
READYSTATE readystate
int ret
IOleInPlaceFrame * frame
static const WCHAR fontW[]
Definition: editor.c:78
REFCLSID clsid
Definition: msctf.c:82
#define IID_NULL
Definition: guiddef.h:98
static void set_ns_align(HTMLDocument *This, const char *align_str)
Definition: editor.c:150
#define DWLP_USER
Definition: winuser.h:866
static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
Definition: editor.c:130
#define V_VT(A)
Definition: oleauto.h:211
#define NSCMD_ENDLINE
Definition: editor.c:30
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT exec_justifycenter(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:691
#define CB_SETCURSEL
Definition: winuser.h:1943
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
#define WM_COMMAND
Definition: winuser.h:1722
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
struct _cl_event * event
Definition: glext.h:7739
int code
Definition: i386-dis.c:3591
#define DOM_VK_DELETE
Definition: editor.c:74
#define V_BSTR(A)
Definition: oleauto.h:226
#define IDM_COMPOSESETTINGS
Definition: mshtmcid.h:308
GLenum GLint * range
Definition: glext.h:7539
#define strcmpiW(s1, s2)
Definition: unicode.h:39
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define ERR(fmt,...)
Definition: debug.h:109
#define NSCMD_LINENEXT
Definition: editor.c:37
#define NSCMD_ALIGN
Definition: editor.c:21
void get_editor_controller(NSContainer *) DECLSPEC_HIDDEN
Definition: nsembed.c:1029
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define NSCMD_SELECTTOP
Definition: editor.c:55
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
HINSTANCE hInst
Definition: dxdiag.c:13
static HRESULT exec_indent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:775
#define NSCMD_CHARPREVIOUS
Definition: editor.c:25
static ATOM item
Definition: dde.c:856
const GLdouble * v
Definition: gl.h:2040
#define NSCMD_LINEPREVIOUS
Definition: editor.c:38
GLuint in
Definition: glext.h:9616
#define IDM_ORDERLIST
Definition: mshtmcid.h:205
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
nsresult get_nsinterface(nsISupports *, REFIID, void **) DECLSPEC_HIDDEN
Definition: nsembed.c:907
void key_event(int scancode, int pressed)
Definition: svgawin.c:773
static void handle_arrow_key(HTMLDocument *This, nsIDOMKeyEvent *event, const char *const cmds[4])
Definition: editor.c:365
#define NSCMD_FONTCOLOR
Definition: editor.c:31
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define E_NOTIMPL
Definition: ddrawi.h:99
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170
#define NSSTATE_ALL
Definition: editor.c:64
static const WCHAR about_blankW[]
Definition: persist.c:24
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
unsigned short UINT16
#define IDM_FONTSIZE
Definition: mshtmcid.h:41
static void remove_child_attr(nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
Definition: editor.c:198
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
unsigned int UINT
Definition: ndis.h:50
#define IDM_SETDIRTY
Definition: mshtmcid.h:332
static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:1088
#define CBN_SELCHANGE
Definition: winuser.h:1961
IDocHostUIHandler * hostui
#define NSSTATE_ATTRIBUTE
Definition: editor.c:63
#define MultiByteToWideChar
Definition: compat.h:100
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
#define IDM_JUSTIFYLEFT
Definition: mshtmcid.h:82
#define E_UNEXPECTED
Definition: winerror.h:2456
#define NSCMD_UNDERLINE
Definition: editor.c:59
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
#define NSCMD_PASTE
Definition: editor.c:45
#define IDM_HORIZONTALLINE
Definition: mshtmcid.h:171
#define msg(x)
Definition: auth_time.c:54
#define IDD_HYPERLINK
Definition: resource.h:39
r dirty
Definition: btrfs.c:2863
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
IPersistMoniker IPersistMoniker_iface
#define NSALIGN_LEFT
Definition: editor.c:67
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR PRUnichar
Definition: nsiface.idl:48
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
#define NSCMD_SELECTPAGEUP
Definition: editor.c:54
#define NSCMD_BEGINLINE
Definition: editor.c:22
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
HRESULT editor_is_dirty(HTMLDocument *This)
Definition: editor.c:1209
#define DOM_VK_UP
Definition: editor.c:71
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HRESULT call_set_active_object(IOleInPlaceUIWindow *, IOleInPlaceActiveObject *) DECLSPEC_HIDDEN
Definition: view.c:398
void set_dirty(HTMLDocument *This, VARIANT_BOOL dirty)
Definition: editor.c:81
#define NSALIGN_CENTER
Definition: editor.c:66
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define IDM_BOLD
Definition: mshtmcid.h:75
#define IDM_OUTDENT
Definition: mshtmcid.h:208
static HRESULT exec_font(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:629
#define memset(x, y, z)
Definition: compat.h:39
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
void init_editor(HTMLDocument *This)
Definition: editor.c:1202
#define DOM_VK_LEFT
Definition: editor.c:70
#define WM_INITDIALOG
Definition: winuser.h:1721
#define HeapFree(x, y, z)
Definition: compat.h:402
#define NSCMD_SELECTPAGEDOWN
Definition: editor.c:53
HRESULT editor_exec_cut(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:881
static HRESULT exec_composesettings(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:799
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
Definition: editor.c:111
#define NSCMD_OL
Definition: editor.c:43
const cmdtable_t editmode_cmds[]
Definition: editor.c:1179
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static UINT WPARAM wparam
Definition: combo.c:716
static const WCHAR wszFtp[]
Definition: urlmon_main.c:387
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: dlist.c:348
char * tag
Definition: main.c:59