ReactOS 0.4.15-dev-8102-g108db8f
editor.c File Reference
#include "mshtml_private.h"
Include dependency graph for editor.c:

Go to the source code of this file.

Macros

#define NSCMD_ALIGN   "cmd_align"
 
#define NSCMD_BEGINLINE   "cmd_beginLine"
 
#define NSCMD_BOLD   "cmd_bold"
 
#define NSCMD_CHARNEXT   "cmd_charNext"
 
#define NSCMD_CHARPREVIOUS   "cmd_charPrevious"
 
#define NSCMD_COPY   "cmd_copy"
 
#define NSCMD_CUT   "cmd_cut"
 
#define NSCMD_DELETECHARFORWARD   "cmd_deleteCharForward"
 
#define NSCMD_DELETEWORDFORWARD   "cmd_deleteWordForward"
 
#define NSCMD_ENDLINE   "cmd_endLine"
 
#define NSCMD_FONTCOLOR   "cmd_fontColor"
 
#define NSCMD_FONTFACE   "cmd_fontFace"
 
#define NSCMD_INDENT   "cmd_indent"
 
#define NSCMD_INSERTHR   "cmd_insertHR"
 
#define NSCMD_INSERTLINKNOUI   "cmd_insertLinkNoUI"
 
#define NSCMD_ITALIC   "cmd_italic"
 
#define NSCMD_LINENEXT   "cmd_lineNext"
 
#define NSCMD_LINEPREVIOUS   "cmd_linePrevious"
 
#define NSCMD_MOVEBOTTOM   "cmd_moveBottom"
 
#define NSCMD_MOVEPAGEDOWN   "cmd_movePageDown"
 
#define NSCMD_MOVEPAGEUP   "cmd_movePageUp"
 
#define NSCMD_MOVETOP   "cmd_moveTop"
 
#define NSCMD_OL   "cmd_ol"
 
#define NSCMD_OUTDENT   "cmd_outdent"
 
#define NSCMD_PASTE   "cmd_paste"
 
#define NSCMD_SELECTBEGINLINE   "cmd_selectBeginLine"
 
#define NSCMD_SELECTBOTTOM   "cmd_selectBottom"
 
#define NSCMD_SELECTCHARNEXT   "cmd_selectCharNext"
 
#define NSCMD_SELECTCHARPREVIOUS   "cmd_selectCharPrevious"
 
#define NSCMD_SELECTENDLINE   "cmd_selectEndLine"
 
#define NSCMD_SELECTLINENEXT   "cmd_selectLineNext"
 
#define NSCMD_SELECTLINEPREVIOUS   "cmd_selectLinePrevious"
 
#define NSCMD_SELECTPAGEDOWN   "cmd_selectPageDown"
 
#define NSCMD_SELECTPAGEUP   "cmd_selectPageUp"
 
#define NSCMD_SELECTTOP   "cmd_selectTop"
 
#define NSCMD_SELECTWORDNEXT   "cmd_selectWordNext"
 
#define NSCMD_SELECTWORDPREVIOUS   "cmd_selectWordPrevious"
 
#define NSCMD_UL   "cmd_ul"
 
#define NSCMD_UNDERLINE   "cmd_underline"
 
#define NSCMD_WORDNEXT   "cmd_wordNext"
 
#define NSCMD_WORDPREVIOUS   "cmd_wordPrevious"
 
#define NSSTATE_ATTRIBUTE   "state_attribute"
 
#define NSSTATE_ALL   "state_all"
 
#define NSALIGN_CENTER   "center"
 
#define NSALIGN_LEFT   "left"
 
#define NSALIGN_RIGHT   "right"
 
#define DOM_VK_LEFT   VK_LEFT
 
#define DOM_VK_UP   VK_UP
 
#define DOM_VK_RIGHT   VK_RIGHT
 
#define DOM_VK_DOWN   VK_DOWN
 
#define DOM_VK_DELETE   VK_DELETE
 
#define DOM_VK_HOME   VK_HOME
 
#define DOM_VK_END   VK_END
 

Functions

void set_dirty (HTMLDocument *This, VARIANT_BOOL dirty)
 
static void do_ns_editor_command (NSContainer *This, const char *cmd)
 
static nsresult get_ns_command_state (NSContainer *This, const char *cmd, nsICommandParams *nsparam)
 
static DWORD query_ns_edit_status (HTMLDocument *This, const char *nscmd)
 
static void set_ns_align (HTMLDocument *This, const char *align_str)
 
static DWORD query_align_status (HTMLDocument *This, const WCHAR *align)
 
static nsISelectionget_ns_selection (HTMLDocument *This)
 
static void remove_child_attr (nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
 
static void get_font_size (HTMLDocument *This, WCHAR *ret)
 
static void set_font_size (HTMLDocument *This, LPCWSTR size)
 
static void handle_arrow_key (HTMLDocument *This, nsIDOMKeyEvent *event, const char *const cmds[4])
 
void handle_edit_event (HTMLDocument *This, nsIDOMEvent *event)
 
void handle_edit_load (HTMLDocument *This)
 
static void set_ns_fontname (HTMLDocument *This, const char *fontname)
 
static HRESULT exec_delete (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_fontname (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_forecolor (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_fontsize (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_font (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_bold (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_italic (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT query_justify (HTMLDocument *This, OLECMD *cmd)
 
static HRESULT exec_justifycenter (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_justifyleft (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_justifyright (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_underline (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_horizontalline (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_orderlist (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_unorderlist (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_indent (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_outdent (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_composesettings (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
HRESULT editor_exec_copy (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
HRESULT editor_exec_cut (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
HRESULT editor_exec_paste (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT exec_setdirty (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
static HRESULT query_edit_status (HTMLDocument *This, OLECMD *cmd)
 
static INT_PTR CALLBACK hyperlink_dlgproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static HRESULT exec_hyperlink (HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 
void init_editor (HTMLDocument *This)
 
HRESULT editor_is_dirty (HTMLDocument *This)
 
HRESULT setup_edit_mode (HTMLDocumentObj *doc)
 

Variables

static const WCHAR fontW [] = {'f','o','n','t',0}
 
static const WCHAR sizeW [] = {'s','i','z','e',0}
 
const cmdtable_t editmode_cmds []
 

Macro Definition Documentation

◆ DOM_VK_DELETE

#define DOM_VK_DELETE   VK_DELETE

Definition at line 74 of file editor.c.

◆ DOM_VK_DOWN

#define DOM_VK_DOWN   VK_DOWN

Definition at line 73 of file editor.c.

◆ DOM_VK_END

#define DOM_VK_END   VK_END

Definition at line 76 of file editor.c.

◆ DOM_VK_HOME

#define DOM_VK_HOME   VK_HOME

Definition at line 75 of file editor.c.

◆ DOM_VK_LEFT

#define DOM_VK_LEFT   VK_LEFT

Definition at line 70 of file editor.c.

◆ DOM_VK_RIGHT

#define DOM_VK_RIGHT   VK_RIGHT

Definition at line 72 of file editor.c.

◆ DOM_VK_UP

#define DOM_VK_UP   VK_UP

Definition at line 71 of file editor.c.

◆ NSALIGN_CENTER

#define NSALIGN_CENTER   "center"

Definition at line 66 of file editor.c.

◆ NSALIGN_LEFT

#define NSALIGN_LEFT   "left"

Definition at line 67 of file editor.c.

◆ NSALIGN_RIGHT

#define NSALIGN_RIGHT   "right"

Definition at line 68 of file editor.c.

◆ NSCMD_ALIGN

#define NSCMD_ALIGN   "cmd_align"

Definition at line 21 of file editor.c.

◆ NSCMD_BEGINLINE

#define NSCMD_BEGINLINE   "cmd_beginLine"

Definition at line 22 of file editor.c.

◆ NSCMD_BOLD

#define NSCMD_BOLD   "cmd_bold"

Definition at line 23 of file editor.c.

◆ NSCMD_CHARNEXT

#define NSCMD_CHARNEXT   "cmd_charNext"

Definition at line 24 of file editor.c.

◆ NSCMD_CHARPREVIOUS

#define NSCMD_CHARPREVIOUS   "cmd_charPrevious"

Definition at line 25 of file editor.c.

◆ NSCMD_COPY

#define NSCMD_COPY   "cmd_copy"

Definition at line 26 of file editor.c.

◆ NSCMD_CUT

#define NSCMD_CUT   "cmd_cut"

Definition at line 27 of file editor.c.

◆ NSCMD_DELETECHARFORWARD

#define NSCMD_DELETECHARFORWARD   "cmd_deleteCharForward"

Definition at line 28 of file editor.c.

◆ NSCMD_DELETEWORDFORWARD

#define NSCMD_DELETEWORDFORWARD   "cmd_deleteWordForward"

Definition at line 29 of file editor.c.

◆ NSCMD_ENDLINE

#define NSCMD_ENDLINE   "cmd_endLine"

Definition at line 30 of file editor.c.

◆ NSCMD_FONTCOLOR

#define NSCMD_FONTCOLOR   "cmd_fontColor"

Definition at line 31 of file editor.c.

◆ NSCMD_FONTFACE

#define NSCMD_FONTFACE   "cmd_fontFace"

Definition at line 32 of file editor.c.

◆ NSCMD_INDENT

#define NSCMD_INDENT   "cmd_indent"

Definition at line 33 of file editor.c.

◆ NSCMD_INSERTHR

#define NSCMD_INSERTHR   "cmd_insertHR"

Definition at line 34 of file editor.c.

◆ NSCMD_INSERTLINKNOUI

#define NSCMD_INSERTLINKNOUI   "cmd_insertLinkNoUI"

Definition at line 35 of file editor.c.

◆ NSCMD_ITALIC

#define NSCMD_ITALIC   "cmd_italic"

Definition at line 36 of file editor.c.

◆ NSCMD_LINENEXT

#define NSCMD_LINENEXT   "cmd_lineNext"

Definition at line 37 of file editor.c.

◆ NSCMD_LINEPREVIOUS

#define NSCMD_LINEPREVIOUS   "cmd_linePrevious"

Definition at line 38 of file editor.c.

◆ NSCMD_MOVEBOTTOM

#define NSCMD_MOVEBOTTOM   "cmd_moveBottom"

Definition at line 39 of file editor.c.

◆ NSCMD_MOVEPAGEDOWN

#define NSCMD_MOVEPAGEDOWN   "cmd_movePageDown"

Definition at line 40 of file editor.c.

◆ NSCMD_MOVEPAGEUP

#define NSCMD_MOVEPAGEUP   "cmd_movePageUp"

Definition at line 41 of file editor.c.

◆ NSCMD_MOVETOP

#define NSCMD_MOVETOP   "cmd_moveTop"

Definition at line 42 of file editor.c.

◆ NSCMD_OL

#define NSCMD_OL   "cmd_ol"

Definition at line 43 of file editor.c.

◆ NSCMD_OUTDENT

#define NSCMD_OUTDENT   "cmd_outdent"

Definition at line 44 of file editor.c.

◆ NSCMD_PASTE

#define NSCMD_PASTE   "cmd_paste"

Definition at line 45 of file editor.c.

◆ NSCMD_SELECTBEGINLINE

#define NSCMD_SELECTBEGINLINE   "cmd_selectBeginLine"

Definition at line 46 of file editor.c.

◆ NSCMD_SELECTBOTTOM

#define NSCMD_SELECTBOTTOM   "cmd_selectBottom"

Definition at line 47 of file editor.c.

◆ NSCMD_SELECTCHARNEXT

#define NSCMD_SELECTCHARNEXT   "cmd_selectCharNext"

Definition at line 48 of file editor.c.

◆ NSCMD_SELECTCHARPREVIOUS

#define NSCMD_SELECTCHARPREVIOUS   "cmd_selectCharPrevious"

Definition at line 49 of file editor.c.

◆ NSCMD_SELECTENDLINE

#define NSCMD_SELECTENDLINE   "cmd_selectEndLine"

Definition at line 50 of file editor.c.

◆ NSCMD_SELECTLINENEXT

#define NSCMD_SELECTLINENEXT   "cmd_selectLineNext"

Definition at line 51 of file editor.c.

◆ NSCMD_SELECTLINEPREVIOUS

#define NSCMD_SELECTLINEPREVIOUS   "cmd_selectLinePrevious"

Definition at line 52 of file editor.c.

◆ NSCMD_SELECTPAGEDOWN

#define NSCMD_SELECTPAGEDOWN   "cmd_selectPageDown"

Definition at line 53 of file editor.c.

◆ NSCMD_SELECTPAGEUP

#define NSCMD_SELECTPAGEUP   "cmd_selectPageUp"

Definition at line 54 of file editor.c.

◆ NSCMD_SELECTTOP

#define NSCMD_SELECTTOP   "cmd_selectTop"

Definition at line 55 of file editor.c.

◆ NSCMD_SELECTWORDNEXT

#define NSCMD_SELECTWORDNEXT   "cmd_selectWordNext"

Definition at line 56 of file editor.c.

◆ NSCMD_SELECTWORDPREVIOUS

#define NSCMD_SELECTWORDPREVIOUS   "cmd_selectWordPrevious"

Definition at line 57 of file editor.c.

◆ NSCMD_UL

#define NSCMD_UL   "cmd_ul"

Definition at line 58 of file editor.c.

◆ NSCMD_UNDERLINE

#define NSCMD_UNDERLINE   "cmd_underline"

Definition at line 59 of file editor.c.

◆ NSCMD_WORDNEXT

#define NSCMD_WORDNEXT   "cmd_wordNext"

Definition at line 60 of file editor.c.

◆ NSCMD_WORDPREVIOUS

#define NSCMD_WORDPREVIOUS   "cmd_wordPrevious"

Definition at line 61 of file editor.c.

◆ NSSTATE_ALL

#define NSSTATE_ALL   "state_all"

Definition at line 64 of file editor.c.

◆ NSSTATE_ATTRIBUTE

#define NSSTATE_ATTRIBUTE   "state_attribute"

Definition at line 63 of file editor.c.

Function Documentation

◆ do_ns_editor_command()

static void do_ns_editor_command ( NSContainer This,
const char cmd 
)
static

Definition at line 99 of file editor.c.

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}
#define ERR(fmt,...)
Definition: debug.h:113
#define debugstr_a
Definition: kernel32.h:31
#define NS_FAILED(res)
Definition: ftp_var.h:139

Referenced by editor_exec_copy(), editor_exec_cut(), editor_exec_paste(), exec_delete(), and handle_arrow_key().

◆ editor_exec_copy()

HRESULT editor_exec_copy ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)

Definition at line 870 of file editor.c.

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}
#define E_FAIL
Definition: ddrawi.h:102
#define NSCMD_COPY
Definition: editor.c:26
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
#define S_OK
Definition: intsafe.h:52
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62

Referenced by exec_mshtml_copy().

◆ editor_exec_cut()

HRESULT editor_exec_cut ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)

Definition at line 881 of file editor.c.

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}
#define NSCMD_CUT
Definition: editor.c:27

Referenced by exec_mshtml_cut().

◆ editor_exec_paste()

HRESULT editor_exec_paste ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)

Definition at line 892 of file editor.c.

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}
#define NSCMD_PASTE
Definition: editor.c:45

Referenced by exec_mshtml_paste().

◆ editor_is_dirty()

HRESULT editor_is_dirty ( HTMLDocument This)

Definition at line 1209 of file editor.c.

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}
unsigned char cpp_bool
Definition: atl.c:38
#define S_FALSE
Definition: winerror.h:2357

Referenced by PersistStreamInit_IsDirty().

◆ exec_bold()

static HRESULT exec_bold ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 636 of file editor.c.

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}
#define FIXME(fmt,...)
Definition: debug.h:114
#define NULL
Definition: types.h:112
#define NSCMD_BOLD
Definition: editor.c:23
GLuint in
Definition: glext.h:9616
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
static FILE * out
Definition: regtests2xml.c:44
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by exec_composesettings().

◆ exec_composesettings()

static HRESULT exec_composesettings ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 799 of file editor.c.

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;
861
862 exec_fontname(This, cmdexecopt, &v, NULL);
863
865 }
866
867 return S_OK;
868}
#define WARN(fmt,...)
Definition: debug.h:115
#define E_INVALIDARG
Definition: ddrawi.h:101
@ VT_BSTR
Definition: compat.h:2303
@ VT_I4
Definition: compat.h:2298
static HRESULT exec_underline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:727
static HRESULT exec_fontsize(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:595
static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:507
static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:650
static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:636
const GLdouble * v
Definition: gl.h:2040
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_I4(A)
Definition: oleauto.h:247
#define isdigitW(n)
Definition: unicode.h:56
#define strchrW(s, c)
Definition: unicode.h:40
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ exec_delete()

static HRESULT exec_delete ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 496 of file editor.c.

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}
#define NSCMD_DELETECHARFORWARD
Definition: editor.c:28

◆ exec_font()

static HRESULT exec_font ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 629 of file editor.c.

630{
631
632 FIXME("(%p)->(%p %p)\n", This, in, out);
633 return E_NOTIMPL;
634}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ exec_fontname()

static HRESULT exec_fontname ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 507 of file editor.c.

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
559 }
560
561 return S_OK;
562}
static char * heap_strdupWtoA(const WCHAR *str)
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define NSSTATE_ATTRIBUTE
Definition: editor.c:63
#define NSCMD_FONTFACE
Definition: editor.c:32
static void set_ns_fontname(HTMLDocument *This, const char *fontname)
Definition: editor.c:487
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
Definition: editor.c:111
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
void nsfree(void *) DECLSPEC_HIDDEN
Definition: nsembed.c:783
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by exec_composesettings().

◆ exec_fontsize()

static HRESULT exec_fontsize ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 595 of file editor.c.

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}
static void set_font_size(HTMLDocument *This, LPCWSTR size)
Definition: editor.c:306
static void get_font_size(HTMLDocument *This, WCHAR *ret)
Definition: editor.c:245
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLuint GLfloat * val
Definition: glext.h:7180
#define strtolW(s, e, b)
Definition: unicode.h:39
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by exec_composesettings().

◆ exec_forecolor()

static HRESULT exec_forecolor ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 564 of file editor.c.

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}
#define NSCMD_FONTCOLOR
Definition: editor.c:31
#define sprintf(buf, format,...)
Definition: sprintf.c:55

◆ exec_horizontalline()

static HRESULT exec_horizontalline ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 739 of file editor.c.

740{
741 TRACE("(%p)\n", This);
742
743 if(in || out)
744 FIXME("unsupported args\n");
745
748 return S_OK;
749}
#define NSCMD_INSERTHR
Definition: editor.c:34

◆ exec_hyperlink()

static HRESULT exec_hyperlink ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 1088 of file editor.c.

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;
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)
1174
1175 TRACE("-- 0x%08x\n", hres);
1176 return hres;
1177}
#define FALSE
Definition: types.h:117
OLECHAR * BSTR
Definition: compat.h:2293
static INT_PTR CALLBACK hyperlink_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: editor.c:978
static nsISelection * get_ns_selection(HTMLDocument *This)
Definition: editor.c:185
#define IDD_HYPERLINK
Definition: resource.h:39
HINSTANCE hInst
Definition: dxdiag.c:13
static const WCHAR aW[]
Definition: htmlelem.c:21
HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
Definition: htmlelem.c:246
static const WCHAR url[]
Definition: encode.c:1432
HRESULT hres
Definition: protocol.c:465
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
#define NS_SUCCEEDED(res)
int32_t INT
Definition: typedefs.h:58
int ret
LONG_PTR LPARAM
Definition: windef.h:208
#define E_UNEXPECTED
Definition: winerror.h:2456
#define IDOK
Definition: winuser.h:830
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

◆ exec_indent()

static HRESULT exec_indent ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 775 of file editor.c.

776{
777 TRACE("(%p)\n", This);
778
779 if(in || out)
780 FIXME("unsupported args\n");
781
784 return S_OK;
785}
#define NSCMD_INDENT
Definition: editor.c:33

◆ exec_italic()

static HRESULT exec_italic ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 650 of file editor.c.

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}
#define NSCMD_ITALIC
Definition: editor.c:36

Referenced by exec_composesettings().

◆ exec_justifycenter()

static HRESULT exec_justifycenter ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 691 of file editor.c.

692{
693 TRACE("(%p)\n", This);
694
695 if(in || out)
696 FIXME("unsupported args\n");
697
700 return S_OK;
701}
static void set_ns_align(HTMLDocument *This, const char *align_str)
Definition: editor.c:150
#define NSALIGN_CENTER
Definition: editor.c:66

◆ exec_justifyleft()

static HRESULT exec_justifyleft ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 703 of file editor.c.

704{
705 TRACE("(%p)\n", This);
706
707 if(in || out)
708 FIXME("unsupported args\n");
709
712 return S_OK;
713}
#define NSALIGN_LEFT
Definition: editor.c:67

◆ exec_justifyright()

static HRESULT exec_justifyright ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 715 of file editor.c.

716{
717 TRACE("(%p)\n", This);
718
719 if(in || out)
720 FIXME("unsupported args\n");
721
724 return S_OK;
725}
#define NSALIGN_RIGHT
Definition: editor.c:68

◆ exec_orderlist()

static HRESULT exec_orderlist ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 751 of file editor.c.

752{
753 TRACE("(%p)\n", This);
754
755 if(in || out)
756 FIXME("unsupported args\n");
757
760 return S_OK;
761}
#define NSCMD_OL
Definition: editor.c:43

◆ exec_outdent()

static HRESULT exec_outdent ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 787 of file editor.c.

788{
789 TRACE("(%p)\n", This);
790
791 if(in || out)
792 FIXME("unsupported args\n");
793
796 return S_OK;
797}
#define NSCMD_OUTDENT
Definition: editor.c:44

◆ exec_setdirty()

static HRESULT exec_setdirty ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 903 of file editor.c.

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)
912 else
913 FIXME("unsupported arg %s\n", debugstr_variant(in));
914
915 return S_OK;
916}
@ VT_BOOL
Definition: compat.h:2306
void set_dirty(HTMLDocument *This, VARIANT_BOOL dirty)
Definition: editor.c:81
#define V_BOOL(A)
Definition: oleauto.h:224

◆ exec_underline()

static HRESULT exec_underline ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 727 of file editor.c.

728{
729 TRACE("(%p)\n", This);
730
731 if(in || out)
732 FIXME("unsupported args\n");
733
736 return S_OK;
737}
#define NSCMD_UNDERLINE
Definition: editor.c:59

Referenced by exec_composesettings().

◆ exec_unorderlist()

static HRESULT exec_unorderlist ( HTMLDocument This,
DWORD  cmdexecopt,
VARIANT in,
VARIANT out 
)
static

Definition at line 763 of file editor.c.

764{
765 TRACE("(%p)\n", This);
766
767 if(in || out)
768 FIXME("unsupported args\n");
769
772 return S_OK;
773}
#define NSCMD_UL
Definition: editor.c:58

◆ get_font_size()

static void get_font_size ( HTMLDocument This,
WCHAR ret 
)
static

Definition at line 245 of file editor.c.

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}
unsigned short UINT16
static const WCHAR sizeW[]
Definition: editor.c:79
static const WCHAR fontW[]
Definition: editor.c:78
nsresult get_elem_attr_value(nsIDOMHTMLElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
Definition: htmlelem.c:143
static size_t elem
Definition: string.c:68
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
WCHAR PRUnichar
Definition: nsiface.idl:48
#define strcmpiW(s1, s2)
Definition: unicode.h:45
#define strcpyW(d, s)
Definition: unicode.h:35
Definition: ecma_167.h:138
Definition: dlist.c:348
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by exec_fontsize().

◆ get_ns_command_state()

static nsresult get_ns_command_state ( NSContainer This,
const char cmd,
nsICommandParams nsparam 
)
static

Definition at line 111 of file editor.c.

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}
nsresult get_nsinterface(nsISupports *, REFIID, void **) DECLSPEC_HIDDEN
Definition: nsembed.c:907

Referenced by exec_fontname(), and query_ns_edit_status().

◆ get_ns_selection()

static nsISelection * get_ns_selection ( HTMLDocument This)
static

Definition at line 185 of file editor.c.

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}

Referenced by exec_hyperlink(), get_font_size(), and set_font_size().

◆ handle_arrow_key()

static void handle_arrow_key ( HTMLDocument This,
nsIDOMKeyEvent event,
const char *const  cmds[4] 
)
static

Definition at line 365 of file editor.c.

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}
COMMAND cmds[]
Definition: main.c:21
struct _cl_event * event
Definition: glext.h:7739
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
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 b
Definition: ke_i.h:79

Referenced by handle_edit_event().

◆ handle_edit_event()

void handle_edit_event ( HTMLDocument This,
nsIDOMEvent event 
)

Definition at line 384 of file editor.c.

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}
unsigned int UINT32
#define NSCMD_LINENEXT
Definition: editor.c:37
#define DOM_VK_DOWN
Definition: editor.c:73
#define NSCMD_ENDLINE
Definition: editor.c:30
#define NSCMD_SELECTWORDPREVIOUS
Definition: editor.c:57
#define DOM_VK_LEFT
Definition: editor.c:70
#define NSCMD_BEGINLINE
Definition: editor.c:22
#define NSCMD_CHARPREVIOUS
Definition: editor.c:25
#define NSCMD_LINEPREVIOUS
Definition: editor.c:38
#define NSCMD_MOVEPAGEUP
Definition: editor.c:41
#define DOM_VK_HOME
Definition: editor.c:75
#define DOM_VK_DELETE
Definition: editor.c:74
#define NSCMD_SELECTBEGINLINE
Definition: editor.c:46
static void handle_arrow_key(HTMLDocument *This, nsIDOMKeyEvent *event, const char *const cmds[4])
Definition: editor.c:365
#define DOM_VK_END
Definition: editor.c:76
#define NSCMD_CHARNEXT
Definition: editor.c:24
#define DOM_VK_RIGHT
Definition: editor.c:72
#define NSCMD_DELETEWORDFORWARD
Definition: editor.c:29
#define NSCMD_SELECTENDLINE
Definition: editor.c:50
#define NSCMD_MOVEPAGEDOWN
Definition: editor.c:40
#define NSCMD_SELECTPAGEUP
Definition: editor.c:54
#define NSCMD_SELECTCHARPREVIOUS
Definition: editor.c:49
#define NSCMD_SELECTBOTTOM
Definition: editor.c:47
#define NSCMD_SELECTCHARNEXT
Definition: editor.c:48
#define NSCMD_SELECTPAGEDOWN
Definition: editor.c:53
#define NSCMD_SELECTWORDNEXT
Definition: editor.c:56
#define NSCMD_WORDPREVIOUS
Definition: editor.c:61
#define DOM_VK_UP
Definition: editor.c:71
#define NSCMD_SELECTTOP
Definition: editor.c:55
#define NSCMD_SELECTLINEPREVIOUS
Definition: editor.c:52
#define NSCMD_MOVETOP
Definition: editor.c:42
#define NSCMD_SELECTLINENEXT
Definition: editor.c:51
#define NSCMD_WORDNEXT
Definition: editor.c:60
#define NSCMD_MOVEBOTTOM
Definition: editor.c:39
Definition: inflate.c:139
void key_event(int scancode, int pressed)
Definition: svgawin.c:773

Referenced by handle_keypress().

◆ handle_edit_load()

void handle_edit_load ( HTMLDocument This)

Definition at line 482 of file editor.c.

483{
484 get_editor_controller(This->doc_obj->nscontainer);
485}
void get_editor_controller(NSContainer *) DECLSPEC_HIDDEN
Definition: nsembed.c:1029

Referenced by handle_docobj_load().

◆ hyperlink_dlgproc()

static INT_PTR CALLBACK hyperlink_dlgproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 978 of file editor.c.

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);
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 {
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);
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
1076 return TRUE;
1077 }
1078 }
1079 return FALSE;
1080 case WM_CLOSE:
1082 return TRUE;
1083 default:
1084 return FALSE;
1085 }
1086}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
#define TRUE
Definition: types.h:120
#define IDC_TYPE
Definition: resource.h:223
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define IDC_URL
Definition: resource.h:41
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static ATOM item
Definition: dde.c:856
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define strcmpW(s1, s2)
Definition: unicode.h:44
#define strlenW(s)
Definition: unicode.h:34
static const WCHAR wszHttps[]
Definition: urlmon_main.c:390
static const WCHAR wszFtp[]
Definition: urlmon_main.c:387
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
static const WCHAR wszHttp[]
Definition: urlmon_main.c:389
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define WM_GETTEXTLENGTH
Definition: winuser.h:1619
#define WM_CLOSE
Definition: winuser.h:1621
#define CB_GETLBTEXTLEN
Definition: winuser.h:1953
#define DWLP_USER
Definition: winuser.h:872
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define CB_GETLBTEXT
Definition: winuser.h:1952
#define IDCANCEL
Definition: winuser.h:831
#define WM_COMMAND
Definition: winuser.h:1740
#define CB_SETCURSEL
Definition: winuser.h:1961
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CBN_SELCHANGE
Definition: winuser.h:1979
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2018
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define BN_CLICKED
Definition: winuser.h:1925
#define CB_INSERTSTRING
Definition: winuser.h:1957
#define CB_GETCURSEL
Definition: winuser.h:1943
#define SetWindowLongPtrW
Definition: winuser.h:5346
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by exec_hyperlink().

◆ init_editor()

void init_editor ( HTMLDocument This)

Definition at line 1202 of file editor.c.

1203{
1205
1206 set_ns_fontname(This, "Times New Roman");
1207}

Referenced by parse_complete().

◆ query_align_status()

static DWORD query_align_status ( HTMLDocument This,
const WCHAR align 
)
static

Definition at line 165 of file editor.c.

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}
int align(int length, int align)
Definition: dsound8.c:36
@ EDITMODE

Referenced by query_justify().

◆ query_edit_status()

static HRESULT query_edit_status ( HTMLDocument This,
OLECMD *  cmd 
)
static

Definition at line 918 of file editor.c.

919{
920 switch(cmd->cmdID) {
921 case IDM_DELETE:
922 TRACE("CGID_MSHTML: IDM_DELETE\n");
924 break;
925 case IDM_FONTNAME:
926 TRACE("CGID_MSHTML: IDM_FONTNAME\n");
928 break;
929 case IDM_FONTSIZE:
930 TRACE("CGID_MSHTML: IDM_FONTSIZE\n");
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");
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;
950 TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
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");
964 break;
965 case IDM_OUTDENT:
966 TRACE("CGID_MSHTML: IDM_OUTDENT\n");
968 break;
969 case IDM_HYPERLINK:
970 TRACE("CGID_MSHTML: IDM_HYPERLINK\n");
972 break;
973 }
974
975 return S_OK;
976}
#define IDM_UNDERLINE
Definition: resource.h:103
#define IDM_ITALIC
Definition: resource.h:102
#define IDM_BOLD
Definition: resource.h:101
static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
Definition: editor.c:130
#define IDM_FORECOLOR
Definition: mshtmcid.h:78
#define IDM_UNORDERLIST
Definition: mshtmcid.h:206
#define IDM_HYPERLINK
Definition: mshtmcid.h:148
#define IDM_INDENT
Definition: mshtmcid.h:207
#define IDM_HORIZONTALLINE
Definition: mshtmcid.h:171
#define IDM_ORDERLIST
Definition: mshtmcid.h:205
#define IDM_OUTDENT
Definition: mshtmcid.h:208
#define IDM_FONTNAME
Definition: mshtmcid.h:40
#define IDM_FONTSIZE
Definition: mshtmcid.h:41
#define IDM_DELETE
Definition: shresdef.h:866

◆ query_justify()

static HRESULT query_justify ( HTMLDocument This,
OLECMD *  cmd 
)
static

Definition at line 664 of file editor.c.

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) {
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}
static DWORD query_align_status(HTMLDocument *This, const WCHAR *align)
Definition: editor.c:165
#define IDM_JUSTIFYCENTER
Definition: mshtmcid.h:80
#define IDM_JUSTIFYLEFT
Definition: mshtmcid.h:82
#define IDM_JUSTIFYRIGHT
Definition: mshtmcid.h:83

◆ query_ns_edit_status()

static DWORD query_ns_edit_status ( HTMLDocument This,
const char nscmd 
)
static

Definition at line 130 of file editor.c.

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}
#define NSSTATE_ALL
Definition: editor.c:64

Referenced by query_edit_status().

◆ remove_child_attr()

static void remove_child_attr ( nsIDOMElement elem,
LPCWSTR  tag,
nsAString attr_str 
)
static

Definition at line 198 of file editor.c.

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}
static void remove_child_attr(nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
Definition: editor.c:198

Referenced by remove_child_attr(), and set_font_size().

◆ set_dirty()

void set_dirty ( HTMLDocument This,
VARIANT_BOOL  dirty 
)

Definition at line 81 of file editor.c.

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}
r dirty
Definition: btrfs.c:3004

Referenced by exec_setdirty(), and set_font_size().

◆ set_font_size()

static void set_font_size ( HTMLDocument This,
LPCWSTR  size 
)
static

Definition at line 306 of file editor.c.

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 */
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}
GLenum GLint * range
Definition: glext.h:7539
long LONG
Definition: pedump.c:60

Referenced by exec_fontsize().

◆ set_ns_align()

static void set_ns_align ( HTMLDocument This,
const char align_str 
)
static

Definition at line 150 of file editor.c.

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}
#define NSCMD_ALIGN
Definition: editor.c:21

Referenced by exec_justifycenter(), exec_justifyleft(), and exec_justifyright().

◆ set_ns_fontname()

static void set_ns_fontname ( HTMLDocument This,
const char fontname 
)
static

Definition at line 487 of file editor.c.

488{
490
491 nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, fontname);
493 nsICommandParams_Release(nsparam);
494}

Referenced by exec_fontname(), and init_editor().

◆ setup_edit_mode()

HRESULT setup_edit_mode ( HTMLDocumentObj doc)

Definition at line 1221 of file editor.c.

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) {
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
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}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
const char * var
Definition: shader.c:5666
REFCLSID clsid
Definition: msctf.c:82
coclass HostDialogHelper DOCHOSTUITYPE_AUTHOR
static const WCHAR about_blankW[]
Definition: persist.c:24
HRESULT call_set_active_object(IOleInPlaceUIWindow *, IOleInPlaceActiveObject *) DECLSPEC_HIDDEN
Definition: view.c:398
void remove_target_tasks(LONG) DECLSPEC_HIDDEN
Definition: task.c:107
#define IID_NULL
Definition: guiddef.h:98
#define memset(x, y, z)
Definition: compat.h:39
IOleClientSite * client
IOleInPlaceUIWindow * ip_window
IOleInPlaceFrame * frame
HTMLDocument basedoc
IDocHostUIHandler * hostui
HTMLOuterWindow * window
IPersistMoniker IPersistMoniker_iface
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
IOleCommandTarget IOleCommandTarget_iface
READYSTATE readystate
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732

Referenced by exec_editmode(), and HTMLDocument_put_designMode().

Variable Documentation

◆ editmode_cmds

const cmdtable_t editmode_cmds
Initial value:
= {
{0,NULL,NULL}
}
static HRESULT exec_justifyright(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:715
static HRESULT query_edit_status(HTMLDocument *This, OLECMD *cmd)
Definition: editor.c:918
static HRESULT exec_delete(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:496
static HRESULT exec_setdirty(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:903
static HRESULT exec_justifycenter(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:691
static HRESULT exec_font(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:629
static HRESULT exec_unorderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:763
static HRESULT exec_indent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:775
static HRESULT exec_outdent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:787
static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:1088
static HRESULT exec_orderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:751
static HRESULT exec_horizontalline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:739
static HRESULT exec_composesettings(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:799
static HRESULT query_justify(HTMLDocument *This, OLECMD *cmd)
Definition: editor.c:664
static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:564
static HRESULT exec_justifyleft(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:703
#define IDM_SETDIRTY
Definition: mshtmcid.h:332
#define IDM_COMPOSESETTINGS
Definition: mshtmcid.h:308
#define IDM_FONT
Definition: osk_res.h:43

Definition at line 1179 of file editor.c.

Referenced by OleCommandTarget_Exec(), and OleCommandTarget_QueryStatus().

◆ fontW

◆ sizeW