sync hhctrl.ocx with wine 1.1.4

svn path=/trunk/; revision=36216
This commit is contained in:
Christoph von Wittich 2008-09-14 06:08:59 +00:00
parent 4ffc65aa1b
commit d827fb07fa
6 changed files with 180 additions and 35 deletions

View file

@ -0,0 +1,100 @@
/*
* HTML Help (Simplified and Traditional Chinese Resources)
*
* Copyright 2008 Hongbo Ni <hongbo.at.njstar.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Chinese text is encoded in UTF-8 */
#pragma code_page(65001)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
STRINGTABLE
BEGIN
IDS_CONTENTS "内容(&C)"
IDS_INDEX "目录(&N)"
IDS_SEARCH "搜寻(&S)"
IDS_FAVORITES "最爱(&I)"
END
STRINGTABLE
BEGIN
IDTB_EXPAND "显示"
IDTB_CONTRACT "隐藏"
IDTB_STOP "停止"
IDTB_REFRESH "刷新"
IDTB_BACK "向后"
IDTB_HOME "首页"
IDTB_SYNC "同步"
IDTB_PRINT "打印"
IDTB_OPTIONS "选项"
IDTB_FORWARD "向前"
IDTB_NOTES "说明"
IDTB_BROWSE_FWD "向前"
IDTB_BROWSE_BACK "向后"
IDTB_CONTENTS "内容"
IDTB_INDEX "目录"
IDTB_SEARCH "搜寻"
IDTB_HISTORY "历史"
IDTB_FAVORITES "最爱"
IDTB_JUMP1 "Jump1"
IDTB_JUMP2 "Jump2"
IDTB_CUSTOMIZE "个性化"
IDTB_ZOOM "放大"
IDTB_TOC_NEXT "后一项"
IDTB_TOC_PREV "前一项"
END
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
STRINGTABLE
BEGIN
IDS_CONTENTS "內容(&C)"
IDS_INDEX "目錄(&N)"
IDS_SEARCH "搜尋(&S)"
IDS_FAVORITES "最愛(&I)"
END
STRINGTABLE
BEGIN
IDTB_EXPAND "顯示"
IDTB_CONTRACT "隱藏"
IDTB_STOP "停止"
IDTB_REFRESH "刷新"
IDTB_BACK "向後"
IDTB_HOME "首頁"
IDTB_SYNC "同步"
IDTB_PRINT "列印"
IDTB_OPTIONS "選項"
IDTB_FORWARD "向前"
IDTB_NOTES "說明"
IDTB_BROWSE_FWD "向前"
IDTB_BROWSE_BACK "向後"
IDTB_CONTENTS "內容"
IDTB_INDEX "目錄"
IDTB_SEARCH "搜尋"
IDTB_HISTORY "歷史"
IDTB_FAVORITES "最愛"
IDTB_JUMP1 "Jump1"
IDTB_JUMP2 "Jump2"
IDTB_CUSTOMIZE "個性化"
IDTB_ZOOM "放大"
IDTB_TOC_NEXT "後一項"
IDTB_TOC_PREV "前一項"
END
#pragma code_page(default)

View file

@ -413,7 +413,7 @@ CHMInfo *CloseCHM(CHMInfo *chm)
IStream_Release(chm->strings_stream);
if(chm->strings_size) {
int i;
DWORD i;
for(i=0; i<chm->strings_size; i++)
heap_free(chm->strings[i]);

View file

@ -89,7 +89,7 @@ BOOL NavigateToUrl(HHInfo *info, LPCWSTR surl)
BOOL ret;
HRESULT hres;
static const WCHAR url_indicator[] = {':', '/', '/'};
static const WCHAR url_indicator[] = {':', '/', '/', 0};
TRACE("%s\n", debugstr_w(surl));
@ -587,7 +587,7 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo)
heap_free(szBuf);
}
SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)&buttons);
SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)buttons);
SendMessageW(hToolbar, TB_AUTOSIZE, 0, 0);
ShowWindow(hToolbar, SW_SHOW);

View file

@ -141,22 +141,22 @@ BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
/* memory allocation functions */
static inline void *heap_alloc(size_t len)
static inline void __WINE_ALLOC_SIZE(1) *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
}
static inline void *heap_alloc_zero(size_t len)
static inline void __WINE_ALLOC_SIZE(1) *heap_alloc_zero(size_t len)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
static inline void *heap_realloc(void *mem, size_t len)
static inline void __WINE_ALLOC_SIZE(2) *heap_realloc(void *mem, size_t len)
{
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
}
static inline void *heap_realloc_zero(void *mem, size_t len)
static inline void __WINE_ALLOC_SIZE(2) *heap_realloc_zero(void *mem, size_t len)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
}

View file

@ -45,3 +45,4 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "Si.rc"
#include "Sv.rc"
#include "Tr.rc"
#include "Zh.rc"

View file

@ -20,6 +20,10 @@
#include "hhctrl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
typedef struct IOleClientSiteImpl
@ -37,45 +41,62 @@ typedef struct IOleClientSiteImpl
HWND hwndWindow;
} IOleClientSiteImpl;
#define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpVtbl)
#define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpvtblDocHostUIHandler)
#define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpvtblOleInPlaceSite)
#define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpvtblOleInPlaceFrame)
static HRESULT STDMETHODCALLTYPE Site_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface);
*ppvObj = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IOleClientSite))
{
*ppvObj = This;
}
else if (IsEqualIID(riid, &IID_IOleInPlaceSite))
{
if (IsEqualIID(riid, &IID_IUnknown)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppvObj);
*ppvObj = CLIENTSITE(This);
}else if(IsEqualIID(riid, &IID_IOleClientSite)) {
TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppvObj);
*ppvObj = CLIENTSITE(This);
}else if (IsEqualIID(riid, &IID_IOleInPlaceSite)) {
TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppvObj);
*ppvObj = &(This->lpvtblOleInPlaceSite);
}
else if (IsEqualIID(riid, &IID_IDocHostUIHandler))
{
}else if (IsEqualIID(riid, &IID_IOleInPlaceFrame)) {
TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppvObj);
*ppvObj = &(This->lpvtblOleInPlaceSite);
}else if (IsEqualIID(riid, &IID_IDocHostUIHandler)) {
TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppvObj);
*ppvObj = &(This->lpvtblDocHostUIHandler);
}
else
}else {
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObj);
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppvObj);
return S_OK;
}
static ULONG STDMETHODCALLTYPE Site_AddRef(IOleClientSite *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface);
return InterlockedIncrement(&This->ref);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface);
LONG refCount = InterlockedDecrement(&This->ref);
LONG ref = InterlockedDecrement(&This->ref);
if (refCount)
return refCount;
TRACE("(%p) ref=%d\n", This, ref);
heap_free(This);
return 0;
if(!ref)
heap_free(This);
return ref;
}
static HRESULT STDMETHODCALLTYPE Site_SaveObject(IOleClientSite *iface)
@ -126,17 +147,22 @@ static const IOleClientSiteVtbl MyIOleClientSiteTable =
static HRESULT STDMETHODCALLTYPE UI_QueryInterface(IDocHostUIHandler *iface, REFIID riid, LPVOID *ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface);
return Site_QueryInterface((IOleClientSite *)This, riid, ppvObj);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj);
}
static ULONG STDMETHODCALLTYPE UI_AddRef(IDocHostUIHandler *iface)
{
return 1;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
}
static ULONG STDMETHODCALLTYPE UI_Release(IDocHostUIHandler * iface)
{
return 2;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface);
return IOleClientSite_Release(CLIENTSITE(This));
}
static HRESULT STDMETHODCALLTYPE UI_ShowContextMenu(IDocHostUIHandler *iface, DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
@ -246,17 +272,22 @@ static const IDocHostUIHandlerVtbl MyIDocHostUIHandlerTable =
static HRESULT STDMETHODCALLTYPE InPlace_QueryInterface(IOleInPlaceSite *iface, REFIID riid, LPVOID *ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
return Site_QueryInterface((IOleClientSite *)This, riid, ppvObj);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj);
}
static ULONG STDMETHODCALLTYPE InPlace_AddRef(IOleInPlaceSite *iface)
{
return 1;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
}
static ULONG STDMETHODCALLTYPE InPlace_Release(IOleInPlaceSite *iface)
{
return 2;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
return IOleClientSite_Release(CLIENTSITE(This));
}
static HRESULT STDMETHODCALLTYPE InPlace_GetWindow(IOleInPlaceSite *iface, HWND *lphwnd)
@ -290,7 +321,10 @@ static HRESULT STDMETHODCALLTYPE InPlace_OnUIActivate(IOleInPlaceSite *iface)
static HRESULT STDMETHODCALLTYPE InPlace_GetWindowContext(IOleInPlaceSite *iface, LPOLEINPLACEFRAME *lplpFrame, LPOLEINPLACEUIWINDOW *lplpDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
*lplpFrame = (LPOLEINPLACEFRAME)&This->lpvtblOleInPlaceFrame;
*lplpFrame = INPLACEFRAME(This);
IOleInPlaceFrame_AddRef(INPLACEFRAME(This));
*lplpDoc = NULL;
lpFrameInfo->fMDIApp = FALSE;
@ -331,8 +365,12 @@ static HRESULT STDMETHODCALLTYPE InPlace_OnPosRectChange(IOleInPlaceSite *iface,
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleInPlaceObject *inplace;
if (!IOleObject_QueryInterface(This->pBrowserObject, &IID_IOleInPlaceObject, (void **)&inplace))
if (IOleObject_QueryInterface(This->pBrowserObject, &IID_IOleInPlaceObject,
(void **)&inplace) == S_OK)
{
IOleInPlaceObject_SetObjectRects(inplace, lprcPosRect, lprcPosRect);
IOleInPlaceObject_Release(inplace);
}
return S_OK;
}
@ -358,17 +396,23 @@ static const IOleInPlaceSiteVtbl MyIOleInPlaceSiteTable =
static HRESULT STDMETHODCALLTYPE Frame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, LPVOID *ppvObj)
{
return E_NOTIMPL;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj);
}
static ULONG STDMETHODCALLTYPE Frame_AddRef(IOleInPlaceFrame *iface)
{
return 1;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
}
static ULONG STDMETHODCALLTYPE Frame_Release(IOleInPlaceFrame *iface)
{
return 2;
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
return IOleClientSite_Release(CLIENTSITE(This));
}
static HRESULT STDMETHODCALLTYPE Frame_GetWindow(IOleInPlaceFrame *iface, HWND *lphwnd)