riched20: Implement IOleInPlaceSite interface.
This commit is contained in:
parent
f505e6fb4a
commit
6c425a169a
|
@ -82,6 +82,7 @@ struct ITextSelectionImpl {
|
|||
struct IOleClientSiteImpl {
|
||||
IOleClientSite IOleClientSite_iface;
|
||||
IOleWindow IOleWindow_iface;
|
||||
IOleInPlaceSite IOleInPlaceSite_iface;
|
||||
LONG ref;
|
||||
|
||||
IRichEditOleImpl *reOle;
|
||||
|
@ -228,6 +229,8 @@ IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj)
|
|||
*ppvObj = me;
|
||||
else if (IsEqualGUID(riid, &IID_IOleWindow))
|
||||
*ppvObj = &This->IOleWindow_iface;
|
||||
else if (IsEqualGUID(riid, &IID_IOleInPlaceSite))
|
||||
*ppvObj = &This->IOleInPlaceSite_iface;
|
||||
if (*ppvObj)
|
||||
{
|
||||
IOleClientSite_AddRef(me);
|
||||
|
@ -379,6 +382,133 @@ static const IOleWindowVtbl olewinvt = {
|
|||
IOleWindow_fnContextSensitiveHelp
|
||||
};
|
||||
|
||||
/* IOleInPlaceSite interface */
|
||||
static inline IOleClientSiteImpl *impl_from_IOleInPlaceSite(IOleInPlaceSite *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleInPlaceSite_iface);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppvObj)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppvObj);
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE IOleInPlaceSite_fnAddRef(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE IOleInPlaceSite_fnRelease(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnGetWindow(IOleInPlaceSite *iface, HWND *phwnd)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
return IOleWindow_GetWindow(&This->IOleWindow_iface, phwnd);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
return IOleWindow_ContextSensitiveHelp(&This->IOleWindow_iface, fEnterMode);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite *iface, IOleInPlaceFrame **ppFrame,
|
||||
IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
|
||||
LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)->(%p %p %p %p %p\n)", This, ppFrame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnScroll(IOleInPlaceSite *iface, SIZE scrollExtent)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)->(%d)\n", This, fUndoable);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite *iface)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect)
|
||||
{
|
||||
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
|
||||
FIXME("not implemented: (%p)->(%p)\n", This, lprcPosRect);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IOleInPlaceSiteVtbl olestvt =
|
||||
{
|
||||
IOleInPlaceSite_fnQueryInterface,
|
||||
IOleInPlaceSite_fnAddRef,
|
||||
IOleInPlaceSite_fnRelease,
|
||||
IOleInPlaceSite_fnGetWindow,
|
||||
IOleInPlaceSite_fnContextSensitiveHelp,
|
||||
IOleInPlaceSite_fnCanInPlaceActivate,
|
||||
IOleInPlaceSite_fnOnInPlaceActivate,
|
||||
IOleInPlaceSite_fnOnUIActivate,
|
||||
IOleInPlaceSite_fnGetWindowContext,
|
||||
IOleInPlaceSite_fnScroll,
|
||||
IOleInPlaceSite_fnOnUIDeactivate,
|
||||
IOleInPlaceSite_fnOnInPlaceDeactivate,
|
||||
IOleInPlaceSite_fnDiscardUndoState,
|
||||
IOleInPlaceSite_fnDeactivateAndUndo,
|
||||
IOleInPlaceSite_fnOnPosRectChange
|
||||
};
|
||||
|
||||
static IOleClientSiteImpl *
|
||||
CreateOleClientSite(IRichEditOleImpl *reOle)
|
||||
{
|
||||
|
@ -388,6 +518,7 @@ CreateOleClientSite(IRichEditOleImpl *reOle)
|
|||
|
||||
clientSite->IOleClientSite_iface.lpVtbl = &ocst;
|
||||
clientSite->IOleWindow_iface.lpVtbl = &olewinvt;
|
||||
clientSite->IOleInPlaceSite_iface.lpVtbl = &olestvt;
|
||||
clientSite->ref = 1;
|
||||
clientSite->reOle = reOle;
|
||||
return clientSite;
|
||||
|
|
|
@ -164,6 +164,10 @@ static void test_Interfaces(void)
|
|||
hres = IRichEditOle_QueryInterface(reOle, &IID_IOleWindow, (void **) &punk);
|
||||
ok(hres == E_NOINTERFACE, "IRichEditOle_QueryInterface\n");
|
||||
|
||||
punk = NULL;
|
||||
hres = IRichEditOle_QueryInterface(reOle, &IID_IOleInPlaceSite, (void **) &punk);
|
||||
ok(hres == E_NOINTERFACE, "IRichEditOle_QueryInterface\n");
|
||||
|
||||
ITextDocument_Release(txtDoc);
|
||||
IRichEditOle_Release(reOle);
|
||||
refcount = IRichEditOle_Release(reOle);
|
||||
|
@ -956,6 +960,7 @@ static void test_IOleClientSite_QueryInterface(void)
|
|||
ITextDocument *txtDoc = NULL;
|
||||
IOleClientSite *clientSite = NULL, *clientSite1 = NULL, *clientSite2 = NULL;
|
||||
IOleWindow *oleWin = NULL, *oleWin1 = NULL;
|
||||
IOleInPlaceSite *olePlace = NULL, *olePlace1 = NULL;
|
||||
HRESULT hres;
|
||||
LONG refcount1, refcount2;
|
||||
|
||||
|
@ -992,6 +997,26 @@ static void test_IOleClientSite_QueryInterface(void)
|
|||
ok(hres == S_OK, "IOleWindow_QueryInterface: 0x%08x\n", hres);
|
||||
ok(clientSite2 == clientSite1, "got wrong pointer\n");
|
||||
|
||||
/* IOleInPlaceSite interface */
|
||||
hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleInPlaceSite, (void **)&olePlace);
|
||||
ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
|
||||
refcount1 = get_refcount((IUnknown *)olePlace);
|
||||
refcount2 = get_refcount((IUnknown *)clientSite);
|
||||
ok(refcount1 == refcount2, "got wrong ref count.\n");
|
||||
|
||||
hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleInPlaceSite, (void **)&olePlace1);
|
||||
ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
|
||||
ok(olePlace == olePlace1, "Should not return a new pointer.\n");
|
||||
IOleInPlaceSite_Release(olePlace1);
|
||||
|
||||
hres = IOleWindow_QueryInterface(oleWin, &IID_IOleInPlaceSite, (void **)&olePlace1);
|
||||
ok(hres == S_OK, "IOleWindow_QueryInterface: 0x%08x\n", hres);
|
||||
refcount1 = get_refcount((IUnknown *)olePlace1);
|
||||
refcount2 = get_refcount((IUnknown *)oleWin);
|
||||
ok(refcount1 == refcount2, "got wrong ref count.\n");
|
||||
|
||||
IOleInPlaceSite_Release(olePlace1);
|
||||
IOleInPlaceSite_Release(olePlace);
|
||||
IOleWindow_Release(oleWin1);
|
||||
IOleWindow_Release(oleWin);
|
||||
IOleClientSite_Release(clientSite2);
|
||||
|
@ -1028,6 +1053,34 @@ static void test_IOleWindow_GetWindow(void)
|
|||
release_interfaces(&w, &reOle, &txtDoc, NULL);
|
||||
}
|
||||
|
||||
static void test_IOleInPlaceSite_GetWindow(void)
|
||||
{
|
||||
HWND w;
|
||||
IRichEditOle *reOle = NULL;
|
||||
ITextDocument *txtDoc = NULL;
|
||||
IOleClientSite *clientSite = NULL;
|
||||
IOleInPlaceSite *olePlace = NULL;
|
||||
HRESULT hres;
|
||||
HWND hwnd;
|
||||
|
||||
create_interfaces(&w, &reOle, &txtDoc, NULL);
|
||||
hres = IRichEditOle_GetClientSite(reOle, &clientSite);
|
||||
ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
|
||||
|
||||
hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleInPlaceSite, (void **)&olePlace);
|
||||
ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
|
||||
hres = IOleInPlaceSite_GetWindow(olePlace, &hwnd);
|
||||
ok(hres == S_OK, "IOleInPlaceSite_GetWindow: 0x%08x\n", hres);
|
||||
ok(w == hwnd, "got wrong pointer.\n");
|
||||
|
||||
hres = IOleInPlaceSite_GetWindow(olePlace, NULL);
|
||||
ok(hres == E_INVALIDARG, "IOleInPlaceSite_GetWindow: 0x%08x\n", hres);
|
||||
|
||||
IOleInPlaceSite_Release(olePlace);
|
||||
IOleClientSite_Release(clientSite);
|
||||
release_interfaces(&w, &reOle, &txtDoc, NULL);
|
||||
}
|
||||
|
||||
START_TEST(richole)
|
||||
{
|
||||
/* Must explicitly LoadLibrary(). The test has no references to functions in
|
||||
|
@ -1048,4 +1101,5 @@ START_TEST(richole)
|
|||
test_ITextRange_Collapse();
|
||||
test_IOleClientSite_QueryInterface();
|
||||
test_IOleWindow_GetWindow();
|
||||
test_IOleInPlaceSite_GetWindow();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue