MSHTML: more implementation of view

Jacek Caban jack at itma.pwr.wroc.pl
Fri Apr 15 02:31:32 CDT 2005


Changelog:
    - More implementation of view
    - Added IOleInPlaceActiveObject
-------------- next part --------------
Index: dlls/mshtml/htmldoc.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/htmldoc.c,v
retrieving revision 1.5
diff -u -r1.5 htmldoc.c
--- dlls/mshtml/htmldoc.c	14 Apr 2005 11:30:50 -0000	1.5
+++ dlls/mshtml/htmldoc.c	15 Apr 2005 07:25:42 -0000
@@ -76,6 +76,9 @@
     }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
         TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
         *ppvObject = DOCVIEW(This);
+    }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
+        TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
+        *ppvObject = ACTOBJ(This);
     }
 
     if(*ppvObject) {
@@ -107,6 +110,8 @@
             IOleClientSite_Release(This->client);
         if(This->ipsite)
             IOleInPlaceSite_Release(This->ipsite);
+        if(This->frame)
+            IOleInPlaceFrame_Release(This->frame);
         HeapFree(GetProcessHeap(), 0, This);
     }
 
Index: dlls/mshtml/oleobj.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/oleobj.c,v
retrieving revision 1.2
diff -u -r1.2 oleobj.c
--- dlls/mshtml/oleobj.c	13 Apr 2005 14:41:19 -0000	1.2
+++ dlls/mshtml/oleobj.c	15 Apr 2005 07:25:42 -0000
@@ -374,10 +374,104 @@
     OleDocument_EnumViews
 };
 
+/**********************************************************
+ * IOleInPlaceActiveObject implementation
+ */
+
+#define ACTOBJ_THIS \
+    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleInPlaceActiveObjectVtbl));
+
+static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
+{
+    ACTOBJ_THIS
+    return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
+}
+
+static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
+{
+    ACTOBJ_THIS
+    return IHTMLDocument2_AddRef(HTMLDOC(This));
+}
+
+static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
+{
+    ACTOBJ_THIS
+    return IHTMLDocument2_Release(HTMLDOC(This));
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
+{
+    ACTOBJ_THIS
+    TRACE("(%p)->(%p)\n", This, phwnd);
+
+    if(!phwnd)
+        return E_INVALIDARG;
+
+    *phwnd = This->hwnd;
+    return S_OK;
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
+{
+    ACTOBJ_THIS
+    FIXME("(%p)->(%x)\n", This, fEnterMode);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
+{
+    ACTOBJ_THIS
+    FIXME("(%p)->(%p)\n", This, lpmsg);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
+{
+    ACTOBJ_THIS
+    FIXME("(%p)->(%x)\n", This, fActivate);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
+{
+    ACTOBJ_THIS
+    FIXME("(%p)->(%x)\n", This, fActivate);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
+                                                IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
+{
+    ACTOBJ_THIS
+    FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
+{
+    ACTOBJ_THIS
+    FIXME("(%p)->(%x)\n", This, fEnable);
+    return E_NOTIMPL;
+}
+
+static IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
+    OleInPlaceActiveObject_QueryInterface,
+    OleInPlaceActiveObject_AddRef,
+    OleInPlaceActiveObject_Release,
+    OleInPlaceActiveObject_GetWindow,
+    OleInPlaceActiveObject_ContextSensitiveHelp,
+    OleInPlaceActiveObject_TranslateAccelerator,
+    OleInPlaceActiveObject_OnFrameWindowActivate,
+    OleInPlaceActiveObject_OnDocWindowActivate,
+    OleInPlaceActiveObject_ResizeBorder,
+    OleInPlaceActiveObject_EnableModeless
+};
+
 void HTMLDocument_OleObj_Init(HTMLDocument *This)
 {
     This->lpOleObjectVtbl = &OleObjectVtbl;
     This->lpOleDocumentVtbl = &OleDocumentVtbl;
+    This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
 
     This->client = NULL;
 }
Index: dlls/mshtml/view.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/view.c,v
retrieving revision 1.2
diff -u -r1.2 view.c
--- dlls/mshtml/view.c	14 Apr 2005 11:30:50 -0000	1.2
+++ dlls/mshtml/view.c	15 Apr 2005 07:25:42 -0000
@@ -40,6 +40,8 @@
 
 static const WCHAR wszInternetExplorer_Server[] =
     {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
+static const WCHAR wszHTML_Document[] =
+    {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
 
 static ATOM serverwnd_class = 0;
 
@@ -206,8 +208,12 @@
 static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
 {
     DOCVIEW_THIS
-    FIXME("(%p)->(%x)\n", This, fShow);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%x)\n", This, fShow);
+
+    if(This->hwnd)
+        ShowWindow(This->hwnd, fShow);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
@@ -244,8 +250,6 @@
             WARN("GetWindowContext failed: %08lx\n", hres);
             return hres;
         }
-        if(pIPFrame)
-            IOleInPlaceFrame_Release(pIPFrame);
         if(pIPWnd)
             IOleInPlaceUIWindow_Release(pIPWnd);
         TRACE("got window context: %p %p {%ld %ld %ld %ld} {%ld %ld %ld %ld} {%d %x %p %p %d}\n",
@@ -283,16 +287,23 @@
 
         hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
         if(SUCCEEDED(hres)) {
-            /* IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This->pDoc), wszHTMLDocument); */
+            IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This), wszHTML_Document);
         }else {
             FIXME("OnUIActivate failed: %08lx\n", hres);
             DestroyWindow(hwnd);
             return hres;
         }
+        if(This->frame)
+            IOleInPlaceFrame_Release(This->frame);
+        This->frame = pIPFrame;
         This->hwnd = hwnd;
     }else {
-        FIXME("deactivating is not supported\n");
-        return E_NOTIMPL;
+        static const WCHAR wszEmpty[] = {0};
+    
+        if(This->frame)
+            IOleInPlaceFrame_SetActiveObject(This->frame, NULL, wszEmpty);
+        if(This->ipsite)
+            IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
     }
     return S_OK;
 }
@@ -307,8 +318,19 @@
 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
 {
     DOCVIEW_THIS
-    FIXME("(%p)->(%lx)\n", This, dwReserved);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%lx)\n", This, dwReserved);
+
+    if(dwReserved)
+        WARN("dwReserved = %ld\n", dwReserved);
+
+    /* NOTE:
+     * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
+     * QueryInterface(IID_IOleControlSite) and KillTimer
+     */
+
+    IOleDocumentView_Show(iface, FALSE);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
@@ -357,5 +379,6 @@
     This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
 
     This->ipsite = NULL;
+    This->frame = NULL;
     This->hwnd = NULL;
 }
Index: dlls/mshtml/mshtml_private.h
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/mshtml_private.h,v
retrieving revision 1.5
diff -u -r1.5 mshtml_private.h
--- dlls/mshtml/mshtml_private.h	14 Apr 2005 11:30:50 -0000	1.5
+++ dlls/mshtml/mshtml_private.h	15 Apr 2005 07:25:42 -0000
@@ -17,30 +17,33 @@
  */
 
 typedef struct {
-    IHTMLDocument2Vtbl  *lpHTMLDocument2Vtbl;
-    IPersistMonikerVtbl *lpPersistMonikerVtbl;
-    IPersistFileVtbl    *lpPersistFileVtbl;
-    IMonikerPropVtbl    *lpMonikerPropVtbl;
-    IOleObjectVtbl      *lpOleObjectVtbl;
-    IOleDocumentVtbl    *lpOleDocumentVtbl;
-    IOleDocumentViewVtbl*lpOleDocumentViewVtbl;
+    IHTMLDocument2Vtbl          *lpHTMLDocument2Vtbl;
+    IPersistMonikerVtbl         *lpPersistMonikerVtbl;
+    IPersistFileVtbl            *lpPersistFileVtbl;
+    IMonikerPropVtbl            *lpMonikerPropVtbl;
+    IOleObjectVtbl              *lpOleObjectVtbl;
+    IOleDocumentVtbl            *lpOleDocumentVtbl;
+    IOleDocumentViewVtbl        *lpOleDocumentViewVtbl;
+    IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
 
     ULONG ref;
 
     IOleClientSite *client;
     IOleInPlaceSite *ipsite;
+    IOleInPlaceFrame *frame;
 
     HWND hwnd;
 } HTMLDocument;
 
-#define HTMLDOC(x)       ((IHTMLDocument2*)     &(x)->lpHTMLDocument2Vtbl)
-#define PERSIST(x)       ((IPersist*)           &(x)->lpPersistFileVtbl)
-#define PERSISTMON(x)    ((IPersistMoniker*)    &(x)->lpPersistMonikerVtbl)
-#define PERSISTFILE(x)   ((IPersistFile*)       &(x)->lpPersistFileVtbl)
-#define MONPROP(x)       ((IMonikerProp*)       &(x)->lpMonikerPropVtbl)
-#define OLEOBJ(x)        ((IOleObject*)         &(x)->lpOleObjectVtbl)
-#define OLEDOC(x)        ((IOleDocument*)       &(x)->lpOleDocumentVtbl)
-#define DOCVIEW(x)       ((IOleDocumentView*)   &(x)->lpOleDocumentViewVtbl)
+#define HTMLDOC(x)       ((IHTMLDocument2*)          &(x)->lpHTMLDocument2Vtbl)
+#define PERSIST(x)       ((IPersist*)                &(x)->lpPersistFileVtbl)
+#define PERSISTMON(x)    ((IPersistMoniker*)         &(x)->lpPersistMonikerVtbl)
+#define PERSISTFILE(x)   ((IPersistFile*)            &(x)->lpPersistFileVtbl)
+#define MONPROP(x)       ((IMonikerProp*)            &(x)->lpMonikerPropVtbl)
+#define OLEOBJ(x)        ((IOleObject*)              &(x)->lpOleObjectVtbl)
+#define OLEDOC(x)        ((IOleDocument*)            &(x)->lpOleDocumentVtbl)
+#define DOCVIEW(x)       ((IOleDocumentView*)        &(x)->lpOleDocumentViewVtbl)
+#define ACTOBJ(x)        ((IOleInPlaceActiveObject*)  &(x)->lpOleInPlaceActiveObjectVtbl)
 
 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
 


More information about the wine-patches mailing list