diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Cs.rc b/reactos/dll/win32/oledlg/lang/oledlg_Cs.rc index 6c5089a3d39..d6fa43d7201 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Cs.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Cs.rc @@ -30,6 +30,8 @@ STRINGTABLE IDS_BROWSE "Procházet" IDS_NOTOLEMOD "Soubor není platným OLE modulem. Nelze registrovat OLE propojení." IDS_NOTOLEMODCAPTION "Přidat propojení" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Da.rc b/reactos/dll/win32/oledlg/lang/oledlg_Da.rc index 14618ac1431..b57d54922e1 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Da.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Da.rc @@ -27,6 +27,8 @@ STRINGTABLE IDS_BROWSE "Gennemse" IDS_NOTOLEMOD "Filen ser ikke ud til at være et gyldig OLE modul. Kunne ikke registrere OLE control'en." IDS_NOTOLEMODCAPTION "Tilføj control" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_De.rc b/reactos/dll/win32/oledlg/lang/oledlg_De.rc index 7fdefe3bbf8..f6a68fa30f7 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_De.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_De.rc @@ -27,6 +27,8 @@ STRINGTABLE IDS_BROWSE "Durchsuchen" IDS_NOTOLEMOD "Die Datei ist offenbar kein gültiges OLE-Steuermodul. Die OLE-Steuerung konnte nicht registriert werden." IDS_NOTOLEMODCAPTION "Steuerung hinzufügen" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_En.rc b/reactos/dll/win32/oledlg/lang/oledlg_En.rc index f61258e9315..52ed242624e 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_En.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_En.rc @@ -25,6 +25,8 @@ STRINGTABLE IDS_BROWSE "Browse" IDS_NOTOLEMOD "File does not appear to be a valid OLE module. Unable to register OLE control." IDS_NOTOLEMODCAPTION "Add Control" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Es.rc b/reactos/dll/win32/oledlg/lang/oledlg_Es.rc index ac8c3112c2f..134bc2ee5ae 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Es.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Es.rc @@ -25,6 +25,8 @@ STRINGTABLE IDS_BROWSE "Explorar" IDS_NOTOLEMOD "El archivo no parece ser un módulo OLE válido. Incapaz de registrar el control OLE." IDS_NOTOLEMODCAPTION "Añadir control" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Fr.rc b/reactos/dll/win32/oledlg/lang/oledlg_Fr.rc index 764e1d6ee94..c486527bd6c 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Fr.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Fr.rc @@ -32,6 +32,8 @@ STRINGTABLE IDS_BROWSE "Parcourir" IDS_NOTOLEMOD "Le fichier ne semble pas être un module OLE valide. Impossible d'enregistrer le contrôle OLE." IDS_NOTOLEMODCAPTION "Ajouter un contrôle" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_He.rc b/reactos/dll/win32/oledlg/lang/oledlg_He.rc index 4fb3dec7707..d46e4097fd8 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_He.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_He.rc @@ -27,6 +27,8 @@ STRINGTABLE IDS_BROWSE "סייר" IDS_NOTOLEMOD "File does not appear to be a valid OLE module. Unable to register OLE control." IDS_NOTOLEMODCAPTION "הוספת בקר" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Hu.rc b/reactos/dll/win32/oledlg/lang/oledlg_Hu.rc index 9c7489a954a..1ccd26a30fe 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Hu.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Hu.rc @@ -28,6 +28,8 @@ STRINGTABLE IDS_BROWSE "Tallózás" IDS_NOTOLEMOD "A fájl úgy tűnik nem egy érvényes OLE modul. Nem tudom regisztrálni az OLE vezérlőt." IDS_NOTOLEMODCAPTION "Vezérlő hozzáadása" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_It.rc b/reactos/dll/win32/oledlg/lang/oledlg_It.rc index 5d35ae06da3..fa382680b0e 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_It.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_It.rc @@ -29,6 +29,8 @@ STRINGTABLE IDS_BROWSE "Esplora" IDS_NOTOLEMOD "Il file non sembra essere un modulo OLE valido. Impossibile registrare il controllo OLE." IDS_NOTOLEMODCAPTION "Aggiungi Controllo" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Ja.rc b/reactos/dll/win32/oledlg/lang/oledlg_Ja.rc index 289f4f4c5cc..26919b97940 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Ja.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Ja.rc @@ -28,6 +28,8 @@ STRINGTABLE IDS_BROWSE "参照" IDS_NOTOLEMOD "ファイルは有効なOLEモジュールではないようです。OLEコントロールを登録できません。" IDS_NOTOLEMODCAPTION "コントロールを追加" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Ko.rc b/reactos/dll/win32/oledlg/lang/oledlg_Ko.rc index 21526e903cc..6d3b5ba107f 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Ko.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Ko.rc @@ -26,6 +26,8 @@ STRINGTABLE IDS_BROWSE "찾기" IDS_NOTOLEMOD "이 파일은 올바른 OLE모듈이 아닌거로 보입니다. OLE컨트롤을 등록할수 없습니다." IDS_NOTOLEMODCAPTION "컨트롤 더하기" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Lt.rc b/reactos/dll/win32/oledlg/lang/oledlg_Lt.rc index a0c1306be49..f709b1dbcab 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Lt.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Lt.rc @@ -28,6 +28,8 @@ STRINGTABLE IDS_BROWSE "Parinkti" IDS_NOTOLEMOD "Panašu, kad failas nėra galiojantis OLE modulis. Nepavyko užregistruoti OLE valdiklio." IDS_NOTOLEMODCAPTION "Pridėti valdiklį" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Nl.rc b/reactos/dll/win32/oledlg/lang/oledlg_Nl.rc index 3b3b37e9f30..0e91bcad75e 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Nl.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Nl.rc @@ -29,6 +29,8 @@ STRINGTABLE IDS_BROWSE "Bladeren" IDS_NOTOLEMOD "Het bestand is geen geldig OLE bestand. De registratie is mislukt." IDS_NOTOLEMODCAPTION "Toevoegen" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_No.rc b/reactos/dll/win32/oledlg/lang/oledlg_No.rc index 9aeafd8c39c..4515364d7e6 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_No.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_No.rc @@ -25,6 +25,8 @@ STRINGTABLE IDS_BROWSE "Bla" IDS_NOTOLEMOD "Filen ser ikke ut til å være en gyldig OLE-modul. Kunne ikke registrere OLE-kontroller." IDS_NOTOLEMODCAPTION "Legg til kontroller" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Pl.rc b/reactos/dll/win32/oledlg/lang/oledlg_Pl.rc index 64a31c8521d..9d3c723f451 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Pl.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Pl.rc @@ -26,6 +26,8 @@ STRINGTABLE IDS_BROWSE "Przeglądaj" IDS_NOTOLEMOD "Plik nie wydaje się być poprawnym modułem OLE. Nie udało się zarejestrować kontrolki OLE." IDS_NOTOLEMODCAPTION "Dodaj kontrolkę" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Pt.rc b/reactos/dll/win32/oledlg/lang/oledlg_Pt.rc index 98f78e74c1d..27ebc70f972 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Pt.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Pt.rc @@ -30,6 +30,8 @@ STRINGTABLE IDS_BROWSE "Procurar" IDS_NOTOLEMOD "O arquivo não parece ser um módulo OLE válido. Impossível registrar o controle OLE." IDS_NOTOLEMODCAPTION "Adicionar Controle" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE @@ -108,6 +110,8 @@ STRINGTABLE IDS_BROWSE "Procurar" IDS_NOTOLEMOD "O ficheiro não parece ser um módulo OLE válido. Impossível registrar o controlo OLE." IDS_NOTOLEMODCAPTION "Adicionar Controlo" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Ro.rc b/reactos/dll/win32/oledlg/lang/oledlg_Ro.rc index 4ea40517e95..53860677288 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Ro.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Ro.rc @@ -30,6 +30,8 @@ STRINGTABLE IDS_BROWSE "Navigare" IDS_NOTOLEMOD "Fișierul nu pare a fi un modul OLE valid. Nu se poate înregistra controlul OLE." IDS_NOTOLEMODCAPTION "Adaugă un control" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Ru.rc b/reactos/dll/win32/oledlg/lang/oledlg_Ru.rc index 0508b4b436b..be3f02fdb53 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Ru.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Ru.rc @@ -28,6 +28,8 @@ STRINGTABLE IDS_BROWSE "Просмотр" IDS_NOTOLEMOD "Файл не является корректным модулем OLE. Невозможно зарегистрировать элемент управления OLE." IDS_NOTOLEMODCAPTION "Добавить элемент управления" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Si.rc b/reactos/dll/win32/oledlg/lang/oledlg_Si.rc index 92e8b7a9c3a..52bad67719e 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Si.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Si.rc @@ -27,6 +27,8 @@ STRINGTABLE IDS_BROWSE "Brskaj" IDS_NOTOLEMOD "Datoteka ni veljaven OLE modul. OLE kontrole ni mogoče registrirati." IDS_NOTOLEMODCAPTION "Dodajanje kontrole" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Sq.rc b/reactos/dll/win32/oledlg/lang/oledlg_Sq.rc index 08c65da8909..6fb075f2f3c 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Sq.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Sq.rc @@ -28,6 +28,8 @@ STRINGTABLE IDS_BROWSE "Shfleto" IDS_NOTOLEMOD "Dokument nuk duket të ketë një modul të vlefshme OLE. Në pamundësi për të regjistruar kontrollin OLE." IDS_NOTOLEMODCAPTION "Shto Kontroll" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Sv.rc b/reactos/dll/win32/oledlg/lang/oledlg_Sv.rc index ede873ba56b..ce7072f1175 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Sv.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Sv.rc @@ -25,6 +25,8 @@ STRINGTABLE IDS_BROWSE "Bläddra" IDS_NOTOLEMOD "File does not appear to be a valid OLE module. Unable to register OLE control." IDS_NOTOLEMODCAPTION "Add Control" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Tr.rc b/reactos/dll/win32/oledlg/lang/oledlg_Tr.rc index 4e9ab93d505..8a2a2117e30 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Tr.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Tr.rc @@ -27,6 +27,8 @@ STRINGTABLE IDS_BROWSE "Göz At" IDS_NOTOLEMOD "Kütük, geçerli bir OLE parçası olarak görünmüyor. OLE denetimi saklanamıyor." IDS_NOTOLEMODCAPTION "Denetim Ekle" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Uk.rc b/reactos/dll/win32/oledlg/lang/oledlg_Uk.rc index 039a7897a59..f36a9648b78 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Uk.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Uk.rc @@ -28,6 +28,8 @@ STRINGTABLE IDS_BROWSE "Огляд" IDS_NOTOLEMOD "Файл не є модулем управління OLE. Не вдається зареєструвати елемент управління OLE." IDS_NOTOLEMODCAPTION "Додати елемент управління" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/lang/oledlg_Zh.rc b/reactos/dll/win32/oledlg/lang/oledlg_Zh.rc index d135302178b..d18dfc676db 100644 --- a/reactos/dll/win32/oledlg/lang/oledlg_Zh.rc +++ b/reactos/dll/win32/oledlg/lang/oledlg_Zh.rc @@ -30,6 +30,8 @@ STRINGTABLE IDS_BROWSE "浏览" IDS_NOTOLEMOD "本文件不像是一个有效的 OLE 模型. 不能注册 OLE 控件." IDS_NOTOLEMODCAPTION "添加控件" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE @@ -108,6 +110,8 @@ STRINGTABLE IDS_BROWSE "瀏覽" IDS_NOTOLEMOD "本檔案不像是一個有效的 OLE 模型. 不能註冊 OLE 控件." IDS_NOTOLEMODCAPTION "添加控件" + IDS_VERBMENU_OBJECT "&Object" + IDS_VERBMENU_CONVERT "&Convert..." } STRINGTABLE diff --git a/reactos/dll/win32/oledlg/oledlg_main.c b/reactos/dll/win32/oledlg/oledlg_main.c index fc3645ff83f..abeb1454ac9 100644 --- a/reactos/dll/win32/oledlg/oledlg_main.c +++ b/reactos/dll/win32/oledlg/oledlg_main.c @@ -87,35 +87,154 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) /*********************************************************************** * OleUIAddVerbMenuA (OLEDLG.1) */ -BOOL WINAPI OleUIAddVerbMenuA( - LPOLEOBJECT lpOleObj, LPCSTR lpszShortType, - HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax, - BOOL bAddConvert, UINT idConvert, HMENU *lphMenu) +BOOL WINAPI OleUIAddVerbMenuA(IOleObject *object, LPCSTR shorttype, + HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax, + BOOL addConvert, UINT idConvert, HMENU *lphMenu) { - FIXME("(%p, %s, %p, %d, %d, %d, %d, %d, %p): stub\n", - lpOleObj, debugstr_a(lpszShortType), - hMenu, uPos, uIDVerbMin, uIDVerbMax, - bAddConvert, idConvert, lphMenu - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + WCHAR *shorttypeW = NULL; + BOOL ret; + + TRACE("(%p, %s, %p, %d, %d, %d, %d, %d, %p)\n", object, debugstr_a(shorttype), + hMenu, uPos, uIDVerbMin, uIDVerbMax, addConvert, idConvert, lphMenu); + + if (shorttype) + { + INT len = MultiByteToWideChar(CP_ACP, 0, shorttype, -1, NULL, 0); + shorttypeW = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + if (shorttypeW) + MultiByteToWideChar(CP_ACP, 0, shorttype, -1, shorttypeW, len); + } + + ret = OleUIAddVerbMenuW(object, shorttypeW, hMenu, uPos, uIDVerbMin, uIDVerbMax, + addConvert, idConvert, lphMenu); + HeapFree(GetProcessHeap(), 0, shorttypeW); + return ret; +} + +static inline BOOL is_verb_in_range(const OLEVERB *verb, UINT idmin, UINT idmax) +{ + if (idmax == 0) return TRUE; + return (verb->lVerb + idmin <= idmax); +} + +static HRESULT get_next_insertable_verb(IEnumOLEVERB *enumverbs, UINT idmin, UINT idmax, OLEVERB *verb) +{ + memset(verb, 0, sizeof(*verb)); + + while (IEnumOLEVERB_Next(enumverbs, 1, verb, NULL) == S_OK) { + if (is_verb_in_range(verb, idmin, idmax) && (verb->grfAttribs & OLEVERBATTRIB_ONCONTAINERMENU)) + return S_OK; + + CoTaskMemFree(verb->lpszVerbName); + memset(verb, 0, sizeof(*verb)); + } + + return S_FALSE; +} + +static void insert_verb_to_menu(HMENU menu, UINT idmin, const OLEVERB *verb) +{ + InsertMenuW(menu, ~0, verb->fuFlags | MF_BYPOSITION | MF_STRING, verb->lVerb + idmin, verb->lpszVerbName); } /*********************************************************************** * OleUIAddVerbMenuW (OLEDLG.14) */ -BOOL WINAPI OleUIAddVerbMenuW( - LPOLEOBJECT lpOleObj, LPCWSTR lpszShortType, - HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax, - BOOL bAddConvert, UINT idConvert, HMENU *lphMenu) +BOOL WINAPI OleUIAddVerbMenuW(IOleObject *object, LPCWSTR shorttype, + HMENU hMenu, UINT uPos, UINT idmin, UINT idmax, BOOL addConvert, UINT idConvert, HMENU *ret_submenu) { - FIXME("(%p, %s, %p, %d, %d, %d, %d, %d, %p): stub\n", - lpOleObj, debugstr_w(lpszShortType), - hMenu, uPos, uIDVerbMin, uIDVerbMax, - bAddConvert, idConvert, lphMenu - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + static const WCHAR spaceW[] = {' ',0}; + IEnumOLEVERB *enumverbs = NULL; + WCHAR *rootname, *objecttype; + LPOLESTR usertype = NULL; + OLEVERB firstverb, verb; + WCHAR resstrW[32]; /* should be enough */ + BOOL singleverb; + HMENU submenu; + + TRACE("(%p, %s, %p, %d, %d, %d, %d, %d, %p)\n", object, debugstr_w(shorttype), + hMenu, uPos, idmin, idmax, addConvert, idConvert, ret_submenu); + + if (ret_submenu) + *ret_submenu = NULL; + + if (!hMenu || !ret_submenu) + return FALSE; + + /* check if we can get verbs at all */ + if (object) + IOleObject_EnumVerbs(object, &enumverbs); + + LoadStringW(OLEDLG_hInstance, IDS_VERBMENU_OBJECT, resstrW, sizeof(resstrW)/sizeof(WCHAR)); + /* no object, or object without enumeration support */ + if (!object || (object && !enumverbs)) { + InsertMenuW(hMenu, uPos, MF_BYPOSITION|MF_STRING|MF_GRAYED, idmin, resstrW); + return FALSE; + } + + /* root entry string */ + if (!shorttype && (IOleObject_GetUserType(object, USERCLASSTYPE_SHORT, &usertype) == S_OK)) + objecttype = usertype; + else + objecttype = (WCHAR*)shorttype; + + rootname = CoTaskMemAlloc((strlenW(objecttype) + strlenW(resstrW) + 2)*sizeof(WCHAR)); + strcpyW(rootname, objecttype); + strcatW(rootname, spaceW); + strcatW(rootname, resstrW); + CoTaskMemFree(usertype); + + /* iterate through verbs */ + + /* find first suitable verb */ + get_next_insertable_verb(enumverbs, idmin, idmax, &firstverb); + singleverb = get_next_insertable_verb(enumverbs, idmin, idmax, &verb) != S_OK; + + if (singleverb && !addConvert) { + WCHAR *str = CoTaskMemAlloc((strlenW(rootname) + strlenW(firstverb.lpszVerbName) + 2)*sizeof(WCHAR)); + + strcpyW(str, firstverb.lpszVerbName); + strcatW(str, spaceW); + strcatW(str, rootname); + + RemoveMenu(hMenu, uPos, MF_BYPOSITION); + InsertMenuW(hMenu, uPos, MF_BYPOSITION|MF_STRING, idmin, str); + CoTaskMemFree(firstverb.lpszVerbName); + CoTaskMemFree(rootname); + CoTaskMemFree(str); + IEnumOLEVERB_Release(enumverbs); + return TRUE; + } + + submenu = CreatePopupMenu(); + insert_verb_to_menu(submenu, idmin, &firstverb); + CoTaskMemFree(firstverb.lpszVerbName); + + if (!singleverb) { + insert_verb_to_menu(submenu, idmin, &verb); + CoTaskMemFree(verb.lpszVerbName); + } + + while (get_next_insertable_verb(enumverbs, idmin, idmax, &verb) == S_OK) { + insert_verb_to_menu(submenu, idmin, &verb); + CoTaskMemFree(verb.lpszVerbName); + } + + /* convert verb is at the bottom of a popup, separated from verbs */ + if (addConvert) { + LoadStringW(OLEDLG_hInstance, IDS_VERBMENU_CONVERT, resstrW, sizeof(resstrW)/sizeof(WCHAR)); + InsertMenuW(submenu, ~0, MF_BYPOSITION|MF_SEPARATOR, 0, NULL); + InsertMenuW(submenu, ~0, MF_BYPOSITION|MF_STRING, idConvert, resstrW); + } + + if (submenu) + *ret_submenu = submenu; + + /* now submenu is ready, add root entry to original menu, attach submenu */ + InsertMenuW(hMenu, uPos, MF_BYPOSITION|MF_POPUP|MF_STRING, (UINT_PTR)submenu, rootname); + IEnumOLEVERB_Release(enumverbs); + CoTaskMemFree(rootname); + return TRUE; } /*********************************************************************** diff --git a/reactos/dll/win32/oledlg/pastespl.c b/reactos/dll/win32/oledlg/pastespl.c index 2a5765d16df..ff8ae41dc96 100644 --- a/reactos/dll/win32/oledlg/pastespl.c +++ b/reactos/dll/win32/oledlg/pastespl.c @@ -693,7 +693,7 @@ UINT WINAPI OleUIPasteSpecialW(LPOLEUIPASTESPECIALW ps) HRSRC hrsrc; if(name == NULL) return OLEUI_ERR_LPSZTEMPLATEINVALID; - hrsrc = FindResourceW(hInst, name, MAKEINTRESOURCEW(RT_DIALOG)); + hrsrc = FindResourceW(hInst, name, (LPWSTR)RT_DIALOG); if(!hrsrc) return OLEUI_ERR_FINDTEMPLATEFAILURE; dlg_templ = LoadResource(hInst, hrsrc); if(!dlg_templ) return OLEUI_ERR_LOADTEMPLATEFAILURE; diff --git a/reactos/dll/win32/oledlg/resource.h b/reactos/dll/win32/oledlg/resource.h index bb339bd44cd..8d934331141 100644 --- a/reactos/dll/win32/oledlg/resource.h +++ b/reactos/dll/win32/oledlg/resource.h @@ -41,6 +41,10 @@ #define IDC_FILELBL 1010 #define IDC_FILE 1011 +/* String ids for verb menu */ +#define IDS_VERBMENU_CONVERT 0x130 +#define IDS_VERBMENU_OBJECT 0x135 + /* String ids for Paste Special */ #define IDS_PS_PASTE_DATA 0x190 #define IDS_PS_PASTE_OBJECT 0x191 diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index a7988b84d83..d626ca08382 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -149,7 +149,7 @@ reactos/dll/win32/ole32 # Synced to WineStaging-1.7.47 reactos/dll/win32/oleacc # Synced to WineStaging-1.7.47 reactos/dll/win32/oleaut32 # Synced to WineStaging-1.7.47 reactos/dll/win32/olecli32 # Synced to WineStaging-1.7.37 -reactos/dll/win32/oledlg # Synced to WineStaging-1.7.37 +reactos/dll/win32/oledlg # Synced to WineStaging-1.7.47 reactos/dll/win32/olepro32 # Synced to WineStaging-1.7.37 reactos/dll/win32/olesvr32 # Synced to WineStaging-1.7.37 reactos/dll/win32/olethk32 # Synced to WineStaging-1.7.37