ReactOS  0.4.12-dev-51-ge94618b
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.

Referenced by handle_edit_event().

◆ DOM_VK_DOWN

#define DOM_VK_DOWN   VK_DOWN

Definition at line 73 of file editor.c.

Referenced by handle_edit_event().

◆ DOM_VK_END

#define DOM_VK_END   VK_END

Definition at line 76 of file editor.c.

Referenced by handle_edit_event().

◆ DOM_VK_HOME

#define DOM_VK_HOME   VK_HOME

Definition at line 75 of file editor.c.

Referenced by handle_edit_event().

◆ DOM_VK_LEFT

#define DOM_VK_LEFT   VK_LEFT

Definition at line 70 of file editor.c.

Referenced by handle_edit_event().

◆ DOM_VK_RIGHT

#define DOM_VK_RIGHT   VK_RIGHT

Definition at line 72 of file editor.c.

Referenced by handle_edit_event().

◆ DOM_VK_UP

#define DOM_VK_UP   VK_UP

Definition at line 71 of file editor.c.

Referenced by handle_edit_event().

◆ NSALIGN_CENTER

#define NSALIGN_CENTER   "center"

Definition at line 66 of file editor.c.

Referenced by exec_justifycenter().

◆ NSALIGN_LEFT

#define NSALIGN_LEFT   "left"

Definition at line 67 of file editor.c.

Referenced by exec_justifyleft().

◆ NSALIGN_RIGHT

#define NSALIGN_RIGHT   "right"

Definition at line 68 of file editor.c.

Referenced by exec_justifyright().

◆ NSCMD_ALIGN

#define NSCMD_ALIGN   "cmd_align"

Definition at line 21 of file editor.c.

Referenced by set_ns_align().

◆ NSCMD_BEGINLINE

#define NSCMD_BEGINLINE   "cmd_beginLine"

Definition at line 22 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_BOLD

#define NSCMD_BOLD   "cmd_bold"

Definition at line 23 of file editor.c.

Referenced by exec_bold(), and query_edit_status().

◆ NSCMD_CHARNEXT

#define NSCMD_CHARNEXT   "cmd_charNext"

Definition at line 24 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_CHARPREVIOUS

#define NSCMD_CHARPREVIOUS   "cmd_charPrevious"

Definition at line 25 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_COPY

#define NSCMD_COPY   "cmd_copy"

Definition at line 26 of file editor.c.

Referenced by editor_exec_copy().

◆ NSCMD_CUT

#define NSCMD_CUT   "cmd_cut"

Definition at line 27 of file editor.c.

Referenced by editor_exec_cut().

◆ NSCMD_DELETECHARFORWARD

#define NSCMD_DELETECHARFORWARD   "cmd_deleteCharForward"

Definition at line 28 of file editor.c.

Referenced by exec_delete(), and handle_edit_event().

◆ NSCMD_DELETEWORDFORWARD

#define NSCMD_DELETEWORDFORWARD   "cmd_deleteWordForward"

Definition at line 29 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_ENDLINE

#define NSCMD_ENDLINE   "cmd_endLine"

Definition at line 30 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_FONTCOLOR

#define NSCMD_FONTCOLOR   "cmd_fontColor"

Definition at line 31 of file editor.c.

Referenced by exec_forecolor().

◆ NSCMD_FONTFACE

#define NSCMD_FONTFACE   "cmd_fontFace"

Definition at line 32 of file editor.c.

Referenced by exec_fontname(), and set_ns_fontname().

◆ NSCMD_INDENT

#define NSCMD_INDENT   "cmd_indent"

Definition at line 33 of file editor.c.

Referenced by exec_indent().

◆ NSCMD_INSERTHR

#define NSCMD_INSERTHR   "cmd_insertHR"

Definition at line 34 of file editor.c.

Referenced by exec_horizontalline().

◆ 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.

Referenced by exec_italic(), and query_edit_status().

◆ NSCMD_LINENEXT

#define NSCMD_LINENEXT   "cmd_lineNext"

Definition at line 37 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_LINEPREVIOUS

#define NSCMD_LINEPREVIOUS   "cmd_linePrevious"

Definition at line 38 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_MOVEBOTTOM

#define NSCMD_MOVEBOTTOM   "cmd_moveBottom"

Definition at line 39 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_MOVEPAGEDOWN

#define NSCMD_MOVEPAGEDOWN   "cmd_movePageDown"

Definition at line 40 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_MOVEPAGEUP

#define NSCMD_MOVEPAGEUP   "cmd_movePageUp"

Definition at line 41 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_MOVETOP

#define NSCMD_MOVETOP   "cmd_moveTop"

Definition at line 42 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_OL

#define NSCMD_OL   "cmd_ol"

Definition at line 43 of file editor.c.

Referenced by exec_orderlist(), and query_edit_status().

◆ NSCMD_OUTDENT

#define NSCMD_OUTDENT   "cmd_outdent"

Definition at line 44 of file editor.c.

Referenced by exec_outdent().

◆ NSCMD_PASTE

#define NSCMD_PASTE   "cmd_paste"

Definition at line 45 of file editor.c.

Referenced by editor_exec_paste().

◆ NSCMD_SELECTBEGINLINE

#define NSCMD_SELECTBEGINLINE   "cmd_selectBeginLine"

Definition at line 46 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTBOTTOM

#define NSCMD_SELECTBOTTOM   "cmd_selectBottom"

Definition at line 47 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTCHARNEXT

#define NSCMD_SELECTCHARNEXT   "cmd_selectCharNext"

Definition at line 48 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTCHARPREVIOUS

#define NSCMD_SELECTCHARPREVIOUS   "cmd_selectCharPrevious"

Definition at line 49 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTENDLINE

#define NSCMD_SELECTENDLINE   "cmd_selectEndLine"

Definition at line 50 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTLINENEXT

#define NSCMD_SELECTLINENEXT   "cmd_selectLineNext"

Definition at line 51 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTLINEPREVIOUS

#define NSCMD_SELECTLINEPREVIOUS   "cmd_selectLinePrevious"

Definition at line 52 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTPAGEDOWN

#define NSCMD_SELECTPAGEDOWN   "cmd_selectPageDown"

Definition at line 53 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTPAGEUP

#define NSCMD_SELECTPAGEUP   "cmd_selectPageUp"

Definition at line 54 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTTOP

#define NSCMD_SELECTTOP   "cmd_selectTop"

Definition at line 55 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTWORDNEXT

#define NSCMD_SELECTWORDNEXT   "cmd_selectWordNext"

Definition at line 56 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_SELECTWORDPREVIOUS

#define NSCMD_SELECTWORDPREVIOUS   "cmd_selectWordPrevious"

Definition at line 57 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_UL

#define NSCMD_UL   "cmd_ul"

Definition at line 58 of file editor.c.

Referenced by exec_unorderlist(), and query_edit_status().

◆ NSCMD_UNDERLINE

#define NSCMD_UNDERLINE   "cmd_underline"

Definition at line 59 of file editor.c.

Referenced by exec_underline(), and query_edit_status().

◆ NSCMD_WORDNEXT

#define NSCMD_WORDNEXT   "cmd_wordNext"

Definition at line 60 of file editor.c.

Referenced by handle_edit_event().

◆ NSCMD_WORDPREVIOUS

#define NSCMD_WORDPREVIOUS   "cmd_wordPrevious"

Definition at line 61 of file editor.c.

Referenced by handle_edit_event().

◆ NSSTATE_ALL

#define NSSTATE_ALL   "state_all"

Definition at line 64 of file editor.c.

Referenced by query_ns_edit_status().

◆ NSSTATE_ATTRIBUTE

#define NSSTATE_ATTRIBUTE   "state_attribute"

Definition at line 63 of file editor.c.

Referenced by exec_fontname(), exec_forecolor(), set_ns_align(), and set_ns_fontname().

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.

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

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 }
Definition: ftp_var.h:139
nsIController * editor_controller
#define NS_FAILED(res)
#define debugstr_a
Definition: kernel32.h:31
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT nsresult
Definition: nsiface.idl:39

◆ editor_exec_copy()

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

Definition at line 870 of file editor.c.

Referenced by exec_mshtml_copy().

871 {
872  update_doc(This, UPDATE_UI);
873 
874  if(!This->doc_obj->nscontainer)
875  return E_FAIL;
876 
878  return S_OK;
879 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
#define NSCMD_COPY
Definition: editor.c:26
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
#define E_FAIL
Definition: ddrawi.h:102
NSContainer * nscontainer
#define S_OK
Definition: intsafe.h:59

◆ editor_exec_cut()

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

Definition at line 881 of file editor.c.

Referenced by exec_mshtml_cut().

882 {
883  update_doc(This, UPDATE_UI);
884 
885  if(!This->doc_obj->nscontainer)
886  return E_FAIL;
887 
889  return S_OK;
890 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
#define E_FAIL
Definition: ddrawi.h:102
NSContainer * nscontainer
#define NSCMD_CUT
Definition: editor.c:27
#define S_OK
Definition: intsafe.h:59

◆ editor_exec_paste()

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

Definition at line 892 of file editor.c.

Referenced by exec_mshtml_paste().

893 {
894  update_doc(This, UPDATE_UI);
895 
896  if(!This->doc_obj->nscontainer)
897  return E_FAIL;
898 
900  return S_OK;
901 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
#define E_FAIL
Definition: ddrawi.h:102
NSContainer * nscontainer
#define S_OK
Definition: intsafe.h:59
#define NSCMD_PASTE
Definition: editor.c:45

◆ editor_is_dirty()

HRESULT editor_is_dirty ( HTMLDocument This)

Definition at line 1209 of file editor.c.

Referenced by PersistStreamInit_IsDirty().

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 }
HTMLDocumentObj * doc_obj
NSContainer * nscontainer
#define S_FALSE
Definition: winerror.h:2357
unsigned char cpp_bool
Definition: atl.c:39
nsIEditor * editor
#define S_OK
Definition: intsafe.h:59

◆ exec_bold()

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

Definition at line 636 of file editor.c.

Referenced by exec_composesettings().

637 {
638  TRACE("(%p)\n", This);
639 
640  if(in || out)
641  FIXME("unsupported args\n");
642 
643  if(This->doc_obj->nscontainer)
644  do_ns_command(This, NSCMD_BOLD, NULL);
645 
646  update_doc(This, UPDATE_UI);
647  return S_OK;
648 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
#define FIXME(fmt,...)
Definition: debug.h:110
NSContainer * nscontainer
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NSCMD_BOLD
Definition: editor.c:23
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59

◆ 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 
810  update_doc(This, UPDATE_UI);
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 
864  SysFreeString(V_BSTR(&v));
865  }
866 
867  return S_OK;
868 }
#define UPDATE_UI
static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:636
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
Definition: compat.h:1932
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
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
#define V_I4(A)
Definition: oleauto.h:247
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
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
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
#define TRACE(s)
Definition: solgame.cpp:4
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170

◆ 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)
502 
503  update_doc(This, UPDATE_UI);
504  return S_OK;
505 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
#define NSCMD_DELETECHARFORWARD
Definition: editor.c:28
NSContainer * nscontainer
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ 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 FIXME(fmt,...)
Definition: debug.h:110
#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.

Referenced by exec_composesettings().

508 {
509  TRACE("(%p)->(%p %p)\n", This, in, out);
510 
511  if(!This->doc_obj->nscontainer) {
512  update_doc(This, UPDATE_UI);
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 
530  update_doc(This, UPDATE_UI);
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 
557  V_BSTR(out) = SysAllocString(strw);
558  heap_free(strw);
559  }
560 
561  return S_OK;
562 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
static void set_ns_fontname(HTMLDocument *This, const char *fontname)
Definition: editor.c:487
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
NSContainer * nscontainer
#define E_INVALIDARG
Definition: ddrawi.h:101
void nsfree(void *) DECLSPEC_HIDDEN
Definition: nsembed.c:783
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
#define NSCMD_FONTFACE
Definition: editor.c:32
static char * heap_strdupWtoA(const WCHAR *str)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
#define NSSTATE_ATTRIBUTE
Definition: editor.c:63
#define MultiByteToWideChar
Definition: compat.h:100
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
Definition: editor.c:111
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ exec_fontsize()

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

Definition at line 595 of file editor.c.

Referenced by exec_composesettings().

596 {
597  TRACE("(%p)->(%p %p)\n", This, in, out);
598 
599  if(out) {
600  WCHAR val[10] = {0};
601 
602  get_font_size(This, val);
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};
612  wsprintfW(size, format, V_I4(in));
613  set_font_size(This, size);
614  break;
615  }
616  case VT_BSTR:
617  set_font_size(This, V_BSTR(in));
618  break;
619  default:
620  FIXME("unsupported fontsize %s\n", debugstr_variant(in));
621  }
622 
623  update_doc(This, UPDATE_UI);
624  }
625 
626  return S_OK;
627 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
Definition: compat.h:1932
static void get_font_size(HTMLDocument *This, WCHAR *ret)
Definition: editor.c:245
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define strtolW(s, e, b)
Definition: unicode.h:33
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define V_I4(A)
Definition: oleauto.h:247
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static void set_font_size(HTMLDocument *This, LPCWSTR size)
Definition: editor.c:306
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59

◆ 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);
577  do_ns_command(This, NSCMD_FONTCOLOR, nsparam);
578 
579  nsICommandParams_Release(nsparam);
580  }else {
581  FIXME("unsupported forecolor %s\n", debugstr_variant(in));
582  }
583 
584  update_doc(This, UPDATE_UI);
585  }
586 
587  if(out) {
588  FIXME("unsupported out\n");
589  return E_NOTIMPL;
590  }
591 
592  return S_OK;
593 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
Definition: compat.h:1932
#define V_I4(A)
Definition: oleauto.h:247
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
#define V_VT(A)
Definition: oleauto.h:211
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
#define NSCMD_FONTCOLOR
Definition: editor.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NSSTATE_ATTRIBUTE
Definition: editor.c:63

◆ 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 
747  update_doc(This, UPDATE_UI);
748  return S_OK;
749 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define FIXME(fmt,...)
Definition: debug.h:110
#define NSCMD_INSERTHR
Definition: editor.c:34
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59

◆ 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;
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 }
#define IDOK
Definition: winuser.h:824
HTMLDocumentObj * doc_obj
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
nsIDOMHTMLDocument * nsdoc
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
Definition: htmlelem.c:246
OLECHAR * BSTR
Definition: compat.h:1927
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:56
HTMLDocumentNode * doc_node
LONG_PTR LPARAM
Definition: windef.h:208
NSContainer * nscontainer
#define E_INVALIDARG
Definition: ddrawi.h:101
static const WCHAR aW[]
Definition: htmlelem.c:21
smooth NULL
Definition: ftsmooth.c:416
static nsISelection * get_ns_selection(HTMLDocument *This)
Definition: editor.c:185
unsigned char cpp_bool
Definition: atl.c:39
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
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
#define NS_SUCCEEDED(res)
int ret
#define V_VT(A)
Definition: oleauto.h:211
nsIEditor * editor
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
HINSTANCE hInst
Definition: dxdiag.c:13
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
#define E_UNEXPECTED
Definition: winerror.h:2456
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
#define IDD_HYPERLINK
Definition: resource.h:39
HRESULT nsresult
Definition: nsiface.idl:39
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ 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 
783  update_doc(This, UPDATE_UI);
784  return S_OK;
785 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define NSCMD_INDENT
Definition: editor.c:33
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59

◆ exec_italic()

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

Definition at line 650 of file editor.c.

Referenced by exec_composesettings().

651 {
652  TRACE("(%p)\n", This);
653 
654  if(in || out)
655  FIXME("unsupported args\n");
656 
657  if(This->doc_obj->nscontainer)
659 
660  update_doc(This, UPDATE_UI);
661  return S_OK;
662 }
#define UPDATE_UI
#define NSCMD_ITALIC
Definition: editor.c:36
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
HTMLDocumentObj * doc_obj
#define FIXME(fmt,...)
Definition: debug.h:110
NSContainer * nscontainer
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59

◆ 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 
699  update_doc(This, UPDATE_UI);
700  return S_OK;
701 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static void set_ns_align(HTMLDocument *This, const char *align_str)
Definition: editor.c:150
#define S_OK
Definition: intsafe.h:59
#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 
710  set_ns_align(This, NSALIGN_LEFT);
711  update_doc(This, UPDATE_UI);
712  return S_OK;
713 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static void set_ns_align(HTMLDocument *This, const char *align_str)
Definition: editor.c:150
#define S_OK
Definition: intsafe.h:59
#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 
723  update_doc(This, UPDATE_UI);
724  return S_OK;
725 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define NSALIGN_RIGHT
Definition: editor.c:68
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static void set_ns_align(HTMLDocument *This, const char *align_str)
Definition: editor.c:150
#define S_OK
Definition: intsafe.h:59

◆ 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 
758  do_ns_command(This, NSCMD_OL, NULL);
759  update_doc(This, UPDATE_UI);
760  return S_OK;
761 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59
#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 
795  update_doc(This, UPDATE_UI);
796  return S_OK;
797 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define NSCMD_OUTDENT
Definition: editor.c:44
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59

◆ 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)
911  set_dirty(This, V_BOOL(in));
912  else
913  FIXME("unsupported arg %s\n", debugstr_variant(in));
914 
915  return S_OK;
916 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
void set_dirty(HTMLDocument *This, VARIANT_BOOL dirty)
Definition: editor.c:81

◆ exec_underline()

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

Definition at line 727 of file editor.c.

Referenced by exec_composesettings().

728 {
729  TRACE("(%p)\n", This);
730 
731  if(in || out)
732  FIXME("unsupported args\n");
733 
735  update_doc(This, UPDATE_UI);
736  return S_OK;
737 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59
#define NSCMD_UNDERLINE
Definition: editor.c:59

◆ 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 
770  do_ns_command(This, NSCMD_UL, NULL);
771  update_doc(This, UPDATE_UI);
772  return S_OK;
773 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
#define NSCMD_UL
Definition: editor.c:58
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define S_OK
Definition: intsafe.h:59

◆ get_font_size()

static void get_font_size ( HTMLDocument This,
WCHAR ret 
)
static

Definition at line 245 of file editor.c.

Referenced by exec_fontsize().

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 }
Definition: graphics.c:170
nsresult get_elem_attr_value(nsIDOMHTMLElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
Definition: htmlelem.c:143
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
struct node node
#define debugstr_w
Definition: kernel32.h:32
static size_t elem
Definition: string.c:68
smooth NULL
Definition: ftsmooth.c:416
static nsISelection * get_ns_selection(HTMLDocument *This)
Definition: editor.c:185
static const WCHAR sizeW[]
Definition: editor.c:79
GLuint GLfloat * val
Definition: glext.h:7180
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static const WCHAR fontW[]
Definition: editor.c:78
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
#define strcmpiW(s1, s2)
Definition: unicode.h:39
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
unsigned short UINT16
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR PRUnichar
Definition: nsiface.idl:48
char * tag
Definition: main.c:59

◆ 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.

Referenced by exec_fontname(), and query_ns_edit_status().

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 }
nsIWebBrowser * webbrowser
Definition: ftp_var.h:139
HTMLOuterWindow * window
#define NS_FAILED(res)
#define debugstr_a
Definition: kernel32.h:31
HTMLDocument basedoc
nsIDOMWindow * nswindow
#define ERR(fmt,...)
Definition: debug.h:109
HTMLDocumentObj * doc
nsresult get_nsinterface(nsISupports *, REFIID, void **) DECLSPEC_HIDDEN
Definition: nsembed.c:907
HRESULT nsresult
Definition: nsiface.idl:39

◆ get_ns_selection()

static nsISelection* get_ns_selection ( HTMLDocument This)
static

Definition at line 185 of file editor.c.

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

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 }
HTMLOuterWindow * window
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
nsIDOMWindow * nswindow
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT nsresult
Definition: nsiface.idl:39

◆ 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.

Referenced by handle_edit_event().

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])
380 
381  nsIDOMKeyEvent_PreventDefault(event);
382 }
HTMLDocumentObj * doc_obj
COMMAND cmds[]
Definition: main.c:21
static void do_ns_editor_command(NSContainer *This, const char *cmd)
Definition: editor.c:99
GLenum GLclampf GLint i
Definition: glfuncs.h:14
NSContainer * nscontainer
#define b
Definition: ke_i.h:79
unsigned char cpp_bool
Definition: atl.c:39

◆ handle_edit_event()

void handle_edit_event ( HTMLDocument This,
nsIDOMEvent event 
)

Definition at line 384 of file editor.c.

Referenced by handle_keypress().

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");
403  handle_arrow_key(This, key_event, cmds);
404  break;
405  }
406  case DOM_VK_RIGHT: {
407  static const char * const cmds[] = {
412  };
413 
414  TRACE("right\n");
415  handle_arrow_key(This, key_event, cmds);
416  break;
417  }
418  case DOM_VK_UP: {
419  static const char * const cmds[] = {
424  };
425 
426  TRACE("up\n");
427  handle_arrow_key(This, key_event, cmds);
428  break;
429  }
430  case DOM_VK_DOWN: {
431  static const char * const cmds[] = {
436  };
437 
438  TRACE("down\n");
439  handle_arrow_key(This, key_event, cmds);
440  break;
441  }
442  case DOM_VK_DELETE: {
443  static const char * const cmds[] = {
446  NULL, NULL
447  };
448 
449  TRACE("delete\n");
450  handle_arrow_key(This, key_event, cmds);
451  break;
452  }
453  case DOM_VK_HOME: {
454  static const char * const cmds[] = {
459  };
460 
461  TRACE("home\n");
462  handle_arrow_key(This, key_event, cmds);
463  break;
464  }
465  case DOM_VK_END: {
466  static const char * const cmds[] = {
471  };
472 
473  TRACE("end\n");
474  handle_arrow_key(This, key_event, cmds);
475  break;
476  }
477  }
478 
479  nsIDOMKeyEvent_Release(key_event);
480 }
#define DOM_VK_END
Definition: editor.c:76
#define NSCMD_SELECTBEGINLINE
Definition: editor.c:46
#define DOM_VK_HOME
Definition: editor.c:75
#define NSCMD_WORDNEXT
Definition: editor.c:60
#define NSCMD_SELECTBOTTOM
Definition: editor.c:47
#define NSCMD_MOVEPAGEDOWN
Definition: editor.c:40
#define NSCMD_SELECTCHARNEXT
Definition: editor.c:48
#define NSCMD_CHARNEXT
Definition: editor.c:24
COMMAND cmds[]
Definition: main.c:21
#define DOM_VK_RIGHT
Definition: editor.c:72
#define NSCMD_SELECTWORDNEXT
Definition: editor.c:56
#define NSCMD_DELETEWORDFORWARD
Definition: editor.c:29
#define NSCMD_MOVEPAGEUP
Definition: editor.c:41
#define NSCMD_DELETECHARFORWARD
Definition: editor.c:28
unsigned int UINT32
#define NSCMD_SELECTLINEPREVIOUS
Definition: editor.c:52
#define NSCMD_WORDPREVIOUS
Definition: editor.c:61
#define NSCMD_MOVEBOTTOM
Definition: editor.c:39
smooth NULL
Definition: ftsmooth.c:416
#define NSCMD_SELECTCHARPREVIOUS
Definition: editor.c:49
#define DOM_VK_DOWN
Definition: editor.c:73
#define TRACE(s)
Definition: solgame.cpp:4
#define NSCMD_SELECTENDLINE
Definition: editor.c:50
#define NSCMD_SELECTLINENEXT
Definition: editor.c:51
#define NSCMD_MOVETOP
Definition: editor.c:42
#define NSCMD_SELECTWORDPREVIOUS
Definition: editor.c:57
#define NSCMD_ENDLINE
Definition: editor.c:30
int code
Definition: i386-dis.c:3591
#define DOM_VK_DELETE
Definition: editor.c:74
#define NSCMD_LINENEXT
Definition: editor.c:37
#define NSCMD_SELECTTOP
Definition: editor.c:55
#define NSCMD_CHARPREVIOUS
Definition: editor.c:25
#define NSCMD_LINEPREVIOUS
Definition: editor.c:38
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_SELECTPAGEUP
Definition: editor.c:54
#define NSCMD_BEGINLINE
Definition: editor.c:22
#define DOM_VK_UP
Definition: editor.c:71
#define DOM_VK_LEFT
Definition: editor.c:70
#define NSCMD_SELECTPAGEDOWN
Definition: editor.c:53

◆ handle_edit_load()

void handle_edit_load ( HTMLDocument This)

Definition at line 482 of file editor.c.

Referenced by handle_docobj_load().

483 {
485 }
HTMLDocumentObj * doc_obj
NSContainer * nscontainer
void get_editor_controller(NSContainer *) DECLSPEC_HIDDEN
Definition: nsembed.c:1029

◆ 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.

Referenced by exec_hyperlink().

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);
1003  SendMessageW(hwndCB, CB_INSERTSTRING, -1, (LPARAM)wszHttps);
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  {
1025  BSTR *url = (BSTR *)GetWindowLongPtrW(hwnd, DWLP_USER);
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 */
1044  item = SendMessageW((HWND)lparam, CB_GETCURSEL, 0, 0);
1045  len = SendMessageW((HWND)lparam, CB_GETLBTEXTLEN, item, 0);
1046  type = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
1047  SendMessageW((HWND)lparam, CB_GETLBTEXT, item, (LPARAM)type);
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:
1081  EndDialog(hwnd, IDCANCEL);
1082  return TRUE;
1083  default:
1084  return FALSE;
1085  }
1086 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
static const WCHAR wszHttp[]
Definition: urlmon_main.c:389
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define CB_GETLBTEXTLEN
Definition: winuser.h:1914
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
#define IDOK
Definition: winuser.h:824
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CB_GETLBTEXT
Definition: winuser.h:1913
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDC_TYPE
Definition: resource.h:213
OLECHAR * BSTR
Definition: compat.h:1927
#define GetWindowLongPtrW
Definition: winuser.h:4698
static const WCHAR wszHttps[]
Definition: urlmon_main.c:390
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1904
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_INSERTSTRING
Definition: winuser.h:1918
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_URL
Definition: resource.h:41
static const WCHAR url[]
Definition: encode.c:1432
#define WM_CLOSE
Definition: winuser.h:1603
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define EM_SETSEL
Definition: winuser.h:1979
#define BN_CLICKED
Definition: winuser.h:1886
#define DWLP_USER
Definition: winuser.h:866
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define CB_SETCURSEL
Definition: winuser.h:1922
#define WM_COMMAND
Definition: winuser.h:1716
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
static ATOM item
Definition: dde.c:856
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBN_SELCHANGE
Definition: winuser.h:1940
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
#define SetWindowLongPtrW
Definition: winuser.h:5215
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
#define HeapFree(x, y, z)
Definition: compat.h:394
static const WCHAR wszFtp[]
Definition: urlmon_main.c:387
UINT WPARAM wparam
Definition: msvc.h:92

◆ init_editor()

void init_editor ( HTMLDocument This)

Definition at line 1202 of file editor.c.

Referenced by parse_complete().

1203 {
1204  update_doc(This, UPDATE_UI);
1205 
1206  set_ns_fontname(This, "Times New Roman");
1207 }
#define UPDATE_UI
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
static void set_ns_fontname(HTMLDocument *This, const char *fontname)
Definition: editor.c:487

◆ query_align_status()

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

Definition at line 165 of file editor.c.

Referenced by query_justify().

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 }
HTMLDocumentObj * doc_obj
nsIDOMHTMLDocument * nsdoc
HTMLOuterWindow * window
int align(int length, int align)
Definition: dsound8.c:36
HTMLDocumentNode * doc_node
#define b
Definition: ke_i.h:79
unsigned char cpp_bool
Definition: atl.c:39
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NS_SUCCEEDED(res)
READYSTATE readystate
int ret
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
HRESULT nsresult
Definition: nsiface.idl:39

◆ 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");
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");
935  cmd->cmdf = query_ns_edit_status(This, NSCMD_BOLD);
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");
943  cmd->cmdf = query_ns_edit_status(This, NSCMD_ITALIC);
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");
955  cmd->cmdf = query_ns_edit_status(This, NSCMD_OL);
956  break;
957  case IDM_UNORDERLIST:
958  TRACE("CGID_MSHTML: IDM_HORIZONTALLINE\n");
959  cmd->cmdf = query_ns_edit_status(This, NSCMD_UL);
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 }
#define NSCMD_ITALIC
Definition: editor.c:36
#define IDM_INDENT
Definition: mshtmcid.h:207
Definition: ftp_var.h:139
#define NSCMD_UL
Definition: editor.c:58
#define IDM_ITALIC
Definition: mshtmcid.h:79
#define IDM_FONTNAME
Definition: mshtmcid.h:40
#define IDM_FORECOLOR
Definition: mshtmcid.h:78
#define IDM_HYPERLINK
Definition: mshtmcid.h:148
smooth NULL
Definition: ftsmooth.c:416
#define IDM_UNDERLINE
Definition: mshtmcid.h:86
#define IDM_DELETE
Definition: shresdef.h:767
#define TRACE(s)
Definition: solgame.cpp:4
#define NSCMD_BOLD
Definition: editor.c:23
#define IDM_UNORDERLIST
Definition: mshtmcid.h:206
static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
Definition: editor.c:130
#define S_OK
Definition: intsafe.h:59
#define IDM_ORDERLIST
Definition: mshtmcid.h:205
#define IDM_FONTSIZE
Definition: mshtmcid.h:41
#define NSCMD_UNDERLINE
Definition: editor.c:59
#define IDM_HORIZONTALLINE
Definition: mshtmcid.h:171
#define IDM_BOLD
Definition: mshtmcid.h:75
#define IDM_OUTDENT
Definition: mshtmcid.h:208
#define NSCMD_OL
Definition: editor.c:43

◆ 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) {
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 }
HTMLDocumentObj * doc_obj
Definition: ftp_var.h:139
HTMLOuterWindow * window
static DWORD query_align_status(HTMLDocument *This, const WCHAR *align)
Definition: editor.c:165
#define IDM_JUSTIFYCENTER
Definition: mshtmcid.h:80
#define TRACE(s)
Definition: solgame.cpp:4
#define IDM_JUSTIFYRIGHT
Definition: mshtmcid.h:83
READYSTATE readystate
#define S_OK
Definition: intsafe.h:59
#define IDM_JUSTIFYLEFT
Definition: mshtmcid.h:82
WCHAR PRUnichar
Definition: nsiface.idl:48

◆ query_ns_edit_status()

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

Definition at line 130 of file editor.c.

Referenced by query_edit_status().

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 }
HTMLDocumentObj * doc_obj
HTMLOuterWindow * window
NSContainer * nscontainer
unsigned char cpp_bool
Definition: atl.c:39
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
READYSTATE readystate
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
#define NSSTATE_ALL
Definition: editor.c:64
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
Definition: editor.c:111

◆ remove_child_attr()

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

Definition at line 198 of file editor.c.

Referenced by set_font_size().

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 }
Definition: ecma_167.h:138
GLenum GLclampf GLint i
Definition: glfuncs.h:14
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
unsigned char cpp_bool
Definition: atl.c:39
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
#define strcmpiW(s1, s2)
Definition: unicode.h:39
unsigned short UINT16
static void remove_child_attr(nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
Definition: editor.c:198
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
WCHAR PRUnichar
Definition: nsiface.idl:48

◆ set_dirty()

void set_dirty ( HTMLDocument This,
VARIANT_BOOL  dirty 
)

Definition at line 81 of file editor.c.

Referenced by exec_setdirty(), and set_font_size().

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 }
HTMLDocumentObj * doc_obj
NSContainer * nscontainer
#define NS_FAILED(res)
nsIEditor * editor
#define ERR(fmt,...)
Definition: debug.h:109
r dirty
Definition: btrfs.c:2638
HRESULT nsresult
Definition: nsiface.idl:39

◆ set_font_size()

static void set_font_size ( HTMLDocument This,
LPCWSTR  size 
)
static

Definition at line 306 of file editor.c.

Referenced by exec_fontsize().

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 }
nsIDOMHTMLDocument * nsdoc
#define WARN(fmt,...)
Definition: debug.h:111
HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
Definition: htmlelem.c:246
HTMLDocumentNode * doc_node
long LONG
Definition: pedump.c:60
static size_t elem
Definition: string.c:68
#define FIXME(fmt,...)
Definition: debug.h:110
static nsISelection * get_ns_selection(HTMLDocument *This)
Definition: editor.c:185
static const WCHAR sizeW[]
Definition: editor.c:79
unsigned char cpp_bool
Definition: atl.c:39
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR fontW[]
Definition: editor.c:78
GLenum GLint * range
Definition: glext.h:7539
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
static void remove_child_attr(nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
Definition: editor.c:198
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
void set_dirty(HTMLDocument *This, VARIANT_BOOL dirty)
Definition: editor.c:81

◆ set_ns_align()

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

Definition at line 150 of file editor.c.

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

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 }
HTMLDocumentObj * doc_obj
NSContainer * nscontainer
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define NSCMD_ALIGN
Definition: editor.c:21
#define NSSTATE_ATTRIBUTE
Definition: editor.c:63

◆ set_ns_fontname()

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

Definition at line 487 of file editor.c.

Referenced by exec_fontname(), and init_editor().

488 {
490 
491  nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, fontname);
492  do_ns_command(This, NSCMD_FONTFACE, nsparam);
493  nsICommandParams_Release(nsparam);
494 }
#define NSCMD_FONTFACE
Definition: editor.c:32
nsICommandParams * create_nscommand_params(void) DECLSPEC_HIDDEN
Definition: nsembed.c:865
void do_ns_command(HTMLDocument *, const char *, nsICommandParams *) DECLSPEC_HIDDEN
Definition: olecmd.c:24
#define NSSTATE_ATTRIBUTE
Definition: editor.c:63

◆ setup_edit_mode()

HRESULT setup_edit_mode ( HTMLDocumentObj doc)

Definition at line 1221 of file editor.c.

Referenced by exec_editmode(), and HTMLDocument_put_designMode().

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 
1284  hres = CreateURLMoniker(NULL, about_blankW, &mon);
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 UPDATE_UI
IOleInPlaceUIWindow * ip_window
#define TRUE
Definition: types.h:120
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
Definition: compat.h:1932
IOleClientSite * client
__wchar_t WCHAR
Definition: xmlstorage.h:180
HTMLOuterWindow * window
coclass HostDialogHelper DOCHOSTUITYPE_AUTHOR
#define V_I4(A)
Definition: oleauto.h:247
IOleCommandTarget IOleCommandTarget_iface
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
void remove_target_tasks(LONG) DECLSPEC_HIDDEN
Definition: task.c:107
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HTMLDocument basedoc
READYSTATE readystate
IOleInPlaceFrame * frame
REFCLSID clsid
Definition: msctf.c:84
#define IID_NULL
Definition: guiddef.h:93
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
static const WCHAR about_blankW[]
Definition: persist.c:24
IDocHostUIHandler * hostui
IPersistMoniker IPersistMoniker_iface
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
HRESULT call_set_active_object(IOleInPlaceUIWindow *, IOleInPlaceActiveObject *) DECLSPEC_HIDDEN
Definition: view.c:398
#define memset(x, y, z)
Definition: compat.h:39
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Variable Documentation

◆ editmode_cmds

const cmdtable_t editmode_cmds
Initial value:
= {
{0,NULL,NULL}
}
static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:636
static HRESULT exec_orderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:751
#define IDM_INDENT
Definition: mshtmcid.h:207
static HRESULT query_edit_status(HTMLDocument *This, OLECMD *cmd)
Definition: editor.c:918
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
static HRESULT exec_horizontalline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:739
static HRESULT exec_justifyleft(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:703
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_delete(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:496
#define IDM_ITALIC
Definition: mshtmcid.h:79
#define IDM_FONTNAME
Definition: mshtmcid.h:40
#define IDM_FORECOLOR
Definition: mshtmcid.h:78
#define IDM_HYPERLINK
Definition: mshtmcid.h:148
static HRESULT exec_underline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:727
static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:650
smooth NULL
Definition: ftsmooth.c:416
static HRESULT exec_justifyright(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:715
#define IDM_UNDERLINE
Definition: mshtmcid.h:86
#define IDM_DELETE
Definition: shresdef.h:767
#define IDM_JUSTIFYCENTER
Definition: mshtmcid.h:80
static HRESULT exec_setdirty(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:903
static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:564
#define IDM_FONT
Definition: mshtmcid.h:116
#define IDM_JUSTIFYRIGHT
Definition: mshtmcid.h:83
static HRESULT exec_unorderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:763
#define IDM_UNORDERLIST
Definition: mshtmcid.h:206
static HRESULT exec_justifycenter(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:691
#define IDM_COMPOSESETTINGS
Definition: mshtmcid.h:308
static HRESULT exec_indent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:775
#define IDM_ORDERLIST
Definition: mshtmcid.h:205
#define IDM_FONTSIZE
Definition: mshtmcid.h:41
#define IDM_SETDIRTY
Definition: mshtmcid.h:332
static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:1088
#define IDM_JUSTIFYLEFT
Definition: mshtmcid.h:82
#define IDM_HORIZONTALLINE
Definition: mshtmcid.h:171
#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
static HRESULT exec_composesettings(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
Definition: editor.c:799

Definition at line 1179 of file editor.c.

Referenced by OleCommandTarget_Exec(), and OleCommandTarget_QueryStatus().

◆ fontW

◆ sizeW