mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 04:13:37 +00:00
Krzysztof Foltman <[email protected]> - removed trailing spaces from some files - tab support - indent support - PageUp key support. - Support for "normal" scroll bar functionality (line and page scrolling). - made string operations consistent wrt whitespace handling (which should greatly improve stability of the wrap code and eliminate regressions of the most recent versions) - completely new scrollbar handling (much more reliable) and related redraw fixes - Page Down handler (no Page Up yet, fixing wrap/redraw/scrollbar bugs was of higher priority) - RTF reader doesn't use RichEdit messages anymore (which saves on unnecessary repaints) - added unicode character support to RTF import (like: \u12345 ?) - small fixes - fixed whitespace identification bug - removed drawing of paragraph marks - improved stub implementations for IRichEditOle - Unknown destinations are now correctly skipped (so loading an RTF file generated by, for example, OpenOffice doesn't produce lots of garbage anymore). - Format stack for RTF groups (so that RTF reader can correctly read what RTF writer wrote :) ) - EM_STREAMIN can now deal with undo in a reasonable manner (no multiple undo actions in one EM_STREAMIN). - Related changes to undo code (umIgnore mode is now handled correctly). - Numerous improvements in the RTF reader: it reads some character attributes now (you will have proper small print in license agreements now). - Fixed a memory overwrite bug in conversion from CHARFORMAT2A to CHARFORMAT2W. - Optimized repaint of the area below the text. - ME_JoinRuns didn't mark the paragraph for rewrapping, fixed. - Removed PostQuitMessage(0) from WM_DESTROY handler (duh!). - Use of EM_GETOLEINTERFACE is reported with FIXME instead of TRACE (any app using this message is likely to encounter major problems). - WM_COPY (and WM_CUT) can now put both Unicode and RTF format (thanks to Phil Krylov's RTF generator code). - New message implemented - WM_PASTE. - RTF reader: rtfPlain implemented (kind of). - RTF writer: rewritten main loop (the old one crashed in some circumstances when SFF_SELECTION was used). - The meaning of the rewrap flag got inverted (MEPF_REWRAP instead of MEPF_WRAPPED) for consistency. - Major code cleanups in rewrap/repaint code, leading to "smarter" behaviour wrt repainting selections. - Old font management replaced by the cache-based one, which keeps maximum of 10 HFONTs at once, instead of one per a couple of runs. - EM_CANPASTE implemented - updated TODO list (including list of (un)implemented messages) - fixed WM_PASTE (the previous version might not close the clipboard if it didn't contain a usable format) - scrollbar operations (like clicking on arrows) should update scrollbar's current position Gerald Pfeifer <[email protected]> - Make ME_ArrowLeft() return a value in every case. Phil Krylov <[email protected]> - Make RTF reader fall back to simple text if a correct RTF header is not detected. This should fix some installers. - Made RTF reader and writer handle codepages mostly similar to the original riched20.dll. - Fixed support for RTF documents using ANSI charset and added support for multibyte charsets, so that BIG5 and UTF-8 RTF documents are working now. - Replaced slow and outdated character set handling in RTF reader by Unicode/codepages support. Added charset->codepage conversion. - Implemented hash table lookup for RTF keywords in RTF reader. - Added "generator" RTF destination handling. - Initial implementation of EM_STREAMOUT and RTF writer. - Fixed \u keyword to output signed 16-bit values. Also fixed CP_SYMBOL conversion and the detection of the default font's codepage. - Improved RTF export. Mike McCormack <[email protected]> - Remove casts and unused code. Hannu Valtonen <[email protected]> - Added mousewheel support. Vincent Beron <[email protected]> - Use "" for Windows includes in dlls, instead of <>. Jakob Eriksson <[email protected]> - Get rid of HeapAlloc casts. Jason Edmeades <[email protected]> - Correct memory allocation macro. svn path=/trunk/; revision=15014
268 lines
7.1 KiB
C
268 lines
7.1 KiB
C
/*
|
|
* RichEdit GUIDs and OLE interface
|
|
*
|
|
* Copyright 2004 by Krzysztof Foltman
|
|
* Copyright 2004 Aric Stewart
|
|
*
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
|
|
#define NONAMELESSUNION
|
|
#define NONAMELESSSTRUCT
|
|
#define COBJMACROS
|
|
|
|
#include "windef.h"
|
|
#include "winbase.h"
|
|
#include "wingdi.h"
|
|
#include "winuser.h"
|
|
#include "ole2.h"
|
|
#include "richole.h"
|
|
#include "wine/debug.h"
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
|
|
|
typedef struct IRichEditOleImpl {
|
|
IRichEditOleVtbl *lpVtbl;
|
|
DWORD ref;
|
|
} IRichEditOleImpl;
|
|
|
|
/* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
|
|
|
|
/* FIXME: the next 6 lines should be in textserv.h */
|
|
#define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
|
|
GUID name = { l, w1, w2, {b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5}}
|
|
|
|
TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
|
|
TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
|
|
TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
|
|
TRACE("%p %s\n", This, debugstr_guid(riid) );
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
IsEqualGUID(riid, &IID_IRichEditOle))
|
|
{
|
|
IRichEditOle_AddRef(me);
|
|
*ppvObj = (LPVOID) This;
|
|
return S_OK;
|
|
}
|
|
FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
|
|
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
static ULONG WINAPI
|
|
IRichEditOle_fnAddRef(IRichEditOle *me)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
TRACE("%p ref = %lu\n", This, ref);
|
|
|
|
return ref;
|
|
}
|
|
|
|
static ULONG WINAPI
|
|
IRichEditOle_fnRelease(IRichEditOle *me)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
TRACE ("%p ref=%lu\n", This, ref);
|
|
|
|
if (!ref)
|
|
{
|
|
TRACE ("Destroying %p\n", This);
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
}
|
|
return ref;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
|
|
REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnGetClientSite(IRichEditOle *me,
|
|
LPOLECLIENTSITE *lplpolesite)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
|
|
DWORD reco, LPDATAOBJECT *lplpdataobj)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
|
|
REOBJECT *lpreobject, DWORD dwFlags)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static LONG WINAPI
|
|
IRichEditOle_fnGetObjectCount(IRichEditOle *me)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
|
|
CLIPFORMAT cf, HGLOBAL hMetaPict)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *lpreobject)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
|
|
LPSTORAGE lpstg)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
|
|
LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static HRESULT WINAPI
|
|
IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
|
|
{
|
|
IRichEditOleImpl *This = (IRichEditOleImpl *)me;
|
|
FIXME("stub %p\n",This);
|
|
return E_NOTIMPL;
|
|
}
|
|
|
|
static IRichEditOleVtbl revt = {
|
|
IRichEditOle_fnQueryInterface,
|
|
IRichEditOle_fnAddRef,
|
|
IRichEditOle_fnRelease,
|
|
IRichEditOle_fnGetClientSite,
|
|
IRichEditOle_fnGetObjectCount,
|
|
IRichEditOle_fnGetLinkCount,
|
|
IRichEditOle_fnGetObject,
|
|
IRichEditOle_fnInsertObject,
|
|
IRichEditOle_fnConvertObject,
|
|
IRichEditOle_fnActivateAs,
|
|
IRichEditOle_fnSetHostNames,
|
|
IRichEditOle_fnSetLinkAvailable,
|
|
IRichEditOle_fnSetDvaspect,
|
|
IRichEditOle_fnHandsOffStorage,
|
|
IRichEditOle_fnSaveCompleted,
|
|
IRichEditOle_fnInPlaceDeactivate,
|
|
IRichEditOle_fnContextSensitiveHelp,
|
|
IRichEditOle_fnGetClipboardData,
|
|
IRichEditOle_fnImportDataObject
|
|
};
|
|
|
|
LRESULT CreateIRichEditOle(LPVOID *ppObj)
|
|
{
|
|
IRichEditOleImpl *reo;
|
|
|
|
reo = HeapAlloc(GetProcessHeap(), 0, sizeof(IRichEditOleImpl));
|
|
if (!reo)
|
|
return 0;
|
|
|
|
reo->lpVtbl = &revt;
|
|
reo->ref = 1;
|
|
TRACE("Created %p\n",reo);
|
|
*ppObj = (LPVOID) reo;
|
|
|
|
return 1;
|
|
}
|