Commit 13d899ec authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added Exec(OLECMDID_OPTICAL_ZOOM) implementation.

parent 971cf700
......@@ -818,8 +818,9 @@ void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDD
void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
void release_nsio(void) DECLSPEC_HIDDEN;
BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
void init_node_cc(void);
void init_node_cc(void) DECLSPEC_HIDDEN;
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
......
......@@ -1149,6 +1149,28 @@ BOOL is_gecko_path(const char *path)
return ret;
}
void set_viewer_zoom(NSContainer *nscontainer, float factor)
{
nsIContentViewer *content_viewer;
nsIDocShell *doc_shell;
nsresult nsres;
TRACE("Setting to %f\n", factor);
nsres = get_nsinterface((nsISupports*)nscontainer->navigation, &IID_nsIDocShell, (void**)&doc_shell);
assert(nsres == NS_OK);
nsres = nsIDocShell_GetContentViewer(doc_shell, &content_viewer);
assert(nsres == NS_OK && content_viewer);
nsIDocShell_Release(doc_shell);
nsres = nsIContentViewer_SetFullZoom(content_viewer, factor);
if(NS_FAILED(nsres))
ERR("SetFullZoom failed: %08x\n", nsres);
nsIContentViewer_Release(content_viewer);
}
struct nsWeakReference {
nsIWeakReference nsIWeakReference_iface;
......
......@@ -548,8 +548,15 @@ static HRESULT exec_get_print_template(HTMLDocument *This, DWORD nCmdexecopt, VA
static HRESULT exec_optical_zoom(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
return E_NOTIMPL;
TRACE("(%p)->(%d %s %p)\n", This, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
if(!pvaIn || V_VT(pvaIn) != VT_I4) {
FIXME("Unsupported argument %s\n", debugstr_variant(pvaIn));
return E_NOTIMPL;
}
set_viewer_zoom(This->doc_obj->nscontainer, (float)V_I4(pvaIn)/100);
return S_OK;
}
static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd)
......
......@@ -229,12 +229,9 @@ void set_document_navigation(HTMLDocumentObj *doc, BOOL doc_can_navigate)
static void load_settings(HTMLDocumentObj *doc)
{
nsIContentViewer *content_viewer;
nsIDocShell *doc_shell;
HKEY settings_key;
DWORD val, size;
LONG res;
nsresult nsres;
static const WCHAR ie_keyW[] = {
'S','O','F','T','W','A','R','E','\\',
......@@ -250,23 +247,8 @@ static void load_settings(HTMLDocumentObj *doc)
size = sizeof(val);
res = RegGetValueW(settings_key, zoomW, zoom_factorW, RRF_RT_REG_DWORD, NULL, &val, &size);
RegCloseKey(settings_key);
if(res != ERROR_SUCCESS)
return;
TRACE("Setting ZoomFactor to %u\n", val);
nsres = get_nsinterface((nsISupports*)doc->nscontainer->navigation, &IID_nsIDocShell, (void**)&doc_shell);
assert(nsres == NS_OK);
nsres = nsIDocShell_GetContentViewer(doc_shell, &content_viewer);
assert(nsres == NS_OK && content_viewer);
nsIDocShell_Release(doc_shell);
nsres = nsIContentViewer_SetFullZoom(content_viewer, (float)val/100000);
if(NS_FAILED(nsres))
ERR("SetFullZoom failed: %08x\n", nsres);
nsIContentViewer_Release(content_viewer);
if(res == ERROR_SUCCESS)
set_viewer_zoom(doc->nscontainer, (float)val/100000);
}
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
......
......@@ -6641,7 +6641,7 @@ static void test_exec_optical_zoom(IHTMLDocument2 *doc, int factor)
SET_EXPECT(GetOverrideKeyPath);
hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
OLECMDEXECOPT_DODEFAULT, &v, NULL);
todo_wine ok(hres == S_OK || broken(hres == OLECMDERR_E_NOTSUPPORTED) /* IE6 */, "Exec failed: %08x\n", hres);
ok(hres == S_OK || broken(hres == OLECMDERR_E_NOTSUPPORTED) /* IE6 */, "Exec failed: %08x\n", hres);
CLEAR_CALLED(GetOverrideKeyPath);
IOleCommandTarget_Release(cmdtrg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment