ReactOS 0.4.15-dev-8131-g4988de4
editor.h File Reference
#include "editstr.h"
Include dependency graph for editor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RUN_IS_HIDDEN(run)
 
#define InitFormatEtc(fe, cf, med)
 
#define CP_UNICODE   1200
 
#define TXTHOST_VTABLE(This)   (This)->lpVtbl
 
#define ITextHost_TxGetDC(This)   TXTHOST_VTABLE(This)->TxGetDC(This)
 
#define ITextHost_TxReleaseDC(This, a)   TXTHOST_VTABLE(This)->TxReleaseDC(This,a)
 
#define ITextHost_TxShowScrollBar(This, a, b)   TXTHOST_VTABLE(This)->TxShowScrollBar(This,a,b)
 
#define ITextHost_TxEnableScrollBar(This, a, b)   TXTHOST_VTABLE(This)->TxEnableScrollBar(This,a,b)
 
#define ITextHost_TxSetScrollRange(This, a, b, c, d)   TXTHOST_VTABLE(This)->TxSetScrollRange(This,a,b,c,d)
 
#define ITextHost_TxSetScrollPos(This, a, b, c)   TXTHOST_VTABLE(This)->TxSetScrollPos(This,a,b,c)
 
#define ITextHost_TxInvalidateRect(This, a, b)   TXTHOST_VTABLE(This)->TxInvalidateRect(This,a,b)
 
#define ITextHost_TxViewChange(This, a)   TXTHOST_VTABLE(This)->TxViewChange(This,a)
 
#define ITextHost_TxCreateCaret(This, a, b, c)   TXTHOST_VTABLE(This)->TxCreateCaret(This,a,b,c)
 
#define ITextHost_TxShowCaret(This, a)   TXTHOST_VTABLE(This)->TxShowCaret(This,a)
 
#define ITextHost_TxSetCaretPos(This, a, b)   TXTHOST_VTABLE(This)->TxSetCaretPos(This,a,b)
 
#define ITextHost_TxSetTimer(This, a, b)   TXTHOST_VTABLE(This)->TxSetTimer(This,a,b)
 
#define ITextHost_TxKillTimer(This, a)   TXTHOST_VTABLE(This)->TxKillTimer(This,a)
 
#define ITextHost_TxScrollWindowEx(This, a, b, c, d, e, f, g)   TXTHOST_VTABLE(This)->TxScrollWindowEx(This,a,b,c,d,e,f,g)
 
#define ITextHost_TxSetCapture(This, a)   TXTHOST_VTABLE(This)->TxSetCapture(This,a)
 
#define ITextHost_TxSetFocus(This)   TXTHOST_VTABLE(This)->TxSetFocus(This)
 
#define ITextHost_TxSetCursor(This, a, b)   TXTHOST_VTABLE(This)->TxSetCursor(This,a,b)
 
#define ITextHost_TxScreenToClient(This, a)   TXTHOST_VTABLE(This)->TxScreenToClient(This,a)
 
#define ITextHost_TxClientToScreen(This, a)   TXTHOST_VTABLE(This)->TxClientToScreen(This,a)
 
#define ITextHost_TxActivate(This, a)   TXTHOST_VTABLE(This)->TxActivate(This,a)
 
#define ITextHost_TxDeactivate(This, a)   TXTHOST_VTABLE(This)->TxDeactivate(This,a)
 
#define ITextHost_TxGetClientRect(This, a)   TXTHOST_VTABLE(This)->TxGetClientRect(This,a)
 
#define ITextHost_TxGetViewInset(This, a)   TXTHOST_VTABLE(This)->TxGetViewInset(This,a)
 
#define ITextHost_TxGetCharFormat(This, a)   TXTHOST_VTABLE(This)->TxGetCharFormat(This,a)
 
#define ITextHost_TxGetParaFormat(This, a)   TXTHOST_VTABLE(This)->TxGetParaFormat(This,a)
 
#define ITextHost_TxGetSysColor(This, a)   TXTHOST_VTABLE(This)->TxGetSysColor(This,a)
 
#define ITextHost_TxGetBackStyle(This, a)   TXTHOST_VTABLE(This)->TxGetBackStyle(This,a)
 
#define ITextHost_TxGetMaxLength(This, a)   TXTHOST_VTABLE(This)->TxGetMaxLength(This,a)
 
#define ITextHost_TxGetScrollBars(This, a)   TXTHOST_VTABLE(This)->TxGetScrollBars(This,a)
 
#define ITextHost_TxGetPasswordChar(This, a)   TXTHOST_VTABLE(This)->TxGetPasswordChar(This,a)
 
#define ITextHost_TxGetAcceleratorPos(This, a)   TXTHOST_VTABLE(This)->TxGetAcceleratorPos(This,a)
 
#define ITextHost_TxGetExtent(This, a)   TXTHOST_VTABLE(This)->TxGetExtent(This,a)
 
#define ITextHost_OnTxCharFormatChange(This, a)   TXTHOST_VTABLE(This)->OnTxCharFormatChange(This,a)
 
#define ITextHost_OnTxParaFormatChange(This, a)   TXTHOST_VTABLE(This)->OnTxParaFormatChange(This,a)
 
#define ITextHost_TxGetPropertyBits(This, a, b)   TXTHOST_VTABLE(This)->TxGetPropertyBits(This,a,b)
 
#define ITextHost_TxNotify(This, a, b)   TXTHOST_VTABLE(This)->TxNotify(This,a,b)
 
#define ITextHost_TxImmGetContext(This)   TXTHOST_VTABLE(This)->TxImmGetContext(This)
 
#define ITextHost_TxImmReleaseContext(This, a)   TXTHOST_VTABLE(This)->TxImmReleaseContext(This,a)
 
#define ITextHost_TxGetSelectionBarWidth(This, a)   TXTHOST_VTABLE(This)->TxGetSelectionBarWidth(This,a)
 

Functions

static WCHARget_text (const ME_Run *run, int offset)
 
static const chardebugstr_run (const ME_Run *run)
 
ME_StyleME_MakeStyle (CHARFORMAT2W *style) DECLSPEC_HIDDEN
 
void ME_AddRefStyle (ME_Style *item) DECLSPEC_HIDDEN
 
void ME_DestroyStyle (ME_Style *item) DECLSPEC_HIDDEN
 
void ME_ReleaseStyle (ME_Style *item) DECLSPEC_HIDDEN
 
ME_StyleME_GetInsertStyle (ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN
 
ME_StyleME_ApplyStyle (ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style) DECLSPEC_HIDDEN
 
void select_style (ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN
 
void ME_InitCharFormat2W (CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_SaveTempStyle (ME_TextEditor *editor, ME_Style *style) DECLSPEC_HIDDEN
 
void ME_ClearTempStyle (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_DumpStyleToBuf (CHARFORMAT2W *pFmt, char buf[2048]) DECLSPEC_HIDDEN
 
void ME_DumpStyle (ME_Style *s) DECLSPEC_HIDDEN
 
BOOL cfany_to_cf2w (CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
 
BOOL cf2w_to_cfany (CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
 
void ME_CopyCharFormat (CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN
 
void ME_CharFormatFromLogFont (HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN
 
void ME_InsertBefore (ME_DisplayItem *diWhere, ME_DisplayItem *diWhat) DECLSPEC_HIDDEN
 
void ME_Remove (ME_DisplayItem *diWhere) DECLSPEC_HIDDEN
 
BOOL ME_NextRun (ME_DisplayItem **para, ME_DisplayItem **run, BOOL all_para) DECLSPEC_HIDDEN
 
BOOL ME_PrevRun (ME_DisplayItem **para, ME_DisplayItem **run, BOOL all_para) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindItemBack (ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindItemFwd (ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindItemBackOrHere (ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
 
ME_DisplayItemME_MakeDI (ME_DIType type) DECLSPEC_HIDDEN
 
void ME_DestroyDisplayItem (ME_DisplayItem *item) DECLSPEC_HIDDEN
 
void ME_DumpDocument (ME_TextBuffer *buffer) DECLSPEC_HIDDEN
 
void destroy_para (ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringN (LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringR (WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringConst (const WCHAR *str, int len) DECLSPEC_HIDDEN
 
ME_StringME_MakeStringEmpty (int len) DECLSPEC_HIDDEN
 
void ME_DestroyString (ME_String *s) DECLSPEC_HIDDEN
 
BOOL ME_AppendString (ME_String *s, const WCHAR *append, int len) DECLSPEC_HIDDEN
 
ME_StringME_VSplitString (ME_String *orig, int nVPos) DECLSPEC_HIDDEN
 
int ME_FindNonWhitespaceV (const ME_String *s, int nVChar) DECLSPEC_HIDDEN
 
int ME_CallWordBreakProc (ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code) DECLSPEC_HIDDEN
 
void ME_StrDeleteV (ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN
 
BOOL ME_InsertString (ME_String *s, int ofs, const WCHAR *insert, int len) DECLSPEC_HIDDEN
 
LPWSTR ME_ToUnicode (LONG codepage, LPVOID psz, INT *len) DECLSPEC_HIDDEN
 
void ME_EndToUnicode (LONG codepage, LPVOID psz) DECLSPEC_HIDDEN
 
static int ME_IsWSpace (WCHAR ch)
 
static int ME_CharCompare (WCHAR a, WCHAR b, int caseSensitive)
 
int ME_ReverseFindNonWhitespaceV (const ME_String *s, int nVChar) DECLSPEC_HIDDEN
 
int ME_ReverseFindWhitespaceV (const ME_String *s, int nVChar) DECLSPEC_HIDDEN
 
ME_DisplayItemME_RowStart (ME_DisplayItem *item) DECLSPEC_HIDDEN
 
ME_DisplayItemME_FindRowWithNumber (ME_TextEditor *editor, int nRow) DECLSPEC_HIDDEN
 
int ME_RowNumberFromCharOfs (ME_TextEditor *editor, int nOfs) DECLSPEC_HIDDEN
 
ME_DisplayItemME_MakeRun (ME_Style *s, int nFlags) DECLSPEC_HIDDEN
 
ME_DisplayItemME_InsertRunAtCursor (ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, const WCHAR *str, int len, int flags) DECLSPEC_HIDDEN
 
void ME_CheckCharOffsets (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_PropagateCharOffset (ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN
 
int ME_CharFromPointContext (ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN
 
int ME_CharFromPoint (ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN
 
int ME_PointFromCharContext (ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
 
int ME_PointFromChar (ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
 
BOOL ME_CanJoinRuns (const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN
 
void ME_JoinRuns (ME_TextEditor *editor, ME_DisplayItem *p) DECLSPEC_HIDDEN
 
ME_DisplayItemME_SplitRunSimple (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
void ME_UpdateRunFlags (ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN
 
SIZE ME_GetRunSizeCommon (ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx, int *pAscent, int *pDescent) DECLSPEC_HIDDEN
 
void ME_CursorFromCharOfs (ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor) DECLSPEC_HIDDEN
 
void ME_RunOfsFromCharOfs (ME_TextEditor *editor, int nCharOfs, ME_DisplayItem **ppPara, ME_DisplayItem **ppRun, int *pOfs) DECLSPEC_HIDDEN
 
int ME_CharOfsFromRunOfs (ME_TextEditor *editor, const ME_DisplayItem *pPara, const ME_DisplayItem *pRun, int nOfs) DECLSPEC_HIDDEN
 
void ME_SkipAndPropagateCharOffset (ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN
 
void ME_SetCharFormat (ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_SetSelectionCharFormat (ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_GetCharFormat (ME_TextEditor *editor, const ME_Cursor *from, const ME_Cursor *to, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_GetSelectionCharFormat (ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_GetDefaultCharFormat (ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
 
void ME_SetDefaultCharFormat (ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN
 
void ME_SetCursorToStart (ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
 
int set_selection_cursors (ME_TextEditor *editor, int from, int to) DECLSPEC_HIDDEN
 
BOOL ME_MoveCursorWords (ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs) DECLSPEC_HIDDEN
 
void hide_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
void show_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
void update_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
void create_caret (ME_TextEditor *ed) DECLSPEC_HIDDEN
 
BOOL ME_CharFromPos (ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact) DECLSPEC_HIDDEN
 
void ME_LButtonDown (ME_TextEditor *editor, int x, int y, int clickNum) DECLSPEC_HIDDEN
 
void ME_MouseMove (ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN
 
BOOL ME_DeleteTextAtCursor (ME_TextEditor *editor, int nCursor, int nChars) DECLSPEC_HIDDEN
 
void ME_InsertTextFromCursor (ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style) DECLSPEC_HIDDEN
 
void ME_InsertEndRowFromCursor (ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN
 
int ME_MoveCursorChars (ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop) DECLSPEC_HIDDEN
 
BOOL ME_ArrowKey (ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl) DECLSPEC_HIDDEN
 
int ME_GetCursorOfs (const ME_Cursor *cursor) DECLSPEC_HIDDEN
 
int ME_GetSelectionOfs (ME_TextEditor *editor, int *from, int *to) DECLSPEC_HIDDEN
 
int ME_GetSelection (ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DECLSPEC_HIDDEN
 
BOOL ME_IsSelection (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_DeleteSelection (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_SendSelChange (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_InsertOLEFromCursor (ME_TextEditor *editor, const REOBJECT *reo, int nCursor) DECLSPEC_HIDDEN
 
BOOL ME_InternalDeleteText (ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce) DECLSPEC_HIDDEN
 
int ME_GetTextLength (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
int ME_GetTextLengthEx (ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN
 
ME_StyleME_GetSelectionInsertStyle (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_GetCursorCoordinates (ME_TextEditor *editor, ME_Cursor *pCursor, int *x, int *y, int *height) DECLSPEC_HIDDEN
 
void ME_InitContext (ME_Context *c, ME_TextEditor *editor, HDC hDC) DECLSPEC_HIDDEN
 
void ME_DestroyContext (ME_Context *c) DECLSPEC_HIDDEN
 
BOOL ME_WrapMarkedParagraphs (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_InvalidateParagraphRange (ME_TextEditor *editor, ME_DisplayItem *start_para, ME_DisplayItem *last_para) DECLSPEC_HIDDEN
 
void ME_SendRequestResize (ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN
 
ME_DisplayItemME_GetParagraph (ME_DisplayItem *run) DECLSPEC_HIDDEN
 
void ME_GetSelectionParas (ME_TextEditor *editor, ME_DisplayItem **para, ME_DisplayItem **para_end) DECLSPEC_HIDDEN
 
void ME_MakeFirstParagraph (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_DisplayItemME_SplitParagraph (ME_TextEditor *editor, ME_DisplayItem *rp, ME_Style *style, const WCHAR *eol_str, int eol_len, int paraFlags) DECLSPEC_HIDDEN
 
ME_DisplayItemME_JoinParagraphs (ME_TextEditor *editor, ME_DisplayItem *tp, BOOL keepFirstParaFormat) DECLSPEC_HIDDEN
 
void ME_DumpParaStyle (ME_Paragraph *s) DECLSPEC_HIDDEN
 
void ME_DumpParaStyleToBuf (const PARAFORMAT2 *pFmt, char buf[2048]) DECLSPEC_HIDDEN
 
BOOL ME_SetSelectionParaFormat (ME_TextEditor *editor, const PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN
 
void ME_GetSelectionParaFormat (ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN
 
void ME_MarkAllForWrapping (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_SetDefaultParaFormat (ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN
 
void para_num_init (ME_Context *c, ME_Paragraph *para) DECLSPEC_HIDDEN
 
void para_num_clear (struct para_num *pn) DECLSPEC_HIDDEN
 
int get_total_width (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void mark_para_rewrap (ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN
 
ME_DisplayItemget_di_from_para (ME_Paragraph *para) DECLSPEC_HIDDEN
 
void add_marked_para (ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN
 
void remove_marked_para (ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN
 
void ME_PaintContent (ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN
 
void ME_Repaint (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_RewrapRepaint (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_UpdateRepaint (ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN
 
void ME_EnsureVisible (ME_TextEditor *editor, ME_Cursor *pCursor) DECLSPEC_HIDDEN
 
void ME_InvalidateSelection (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
BOOL ME_SetZoom (ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN
 
int ME_twips2pointsX (const ME_Context *c, int x) DECLSPEC_HIDDEN
 
int ME_twips2pointsY (const ME_Context *c, int y) DECLSPEC_HIDDEN
 
void ME_ScrollAbs (ME_TextEditor *editor, int x, int y) DECLSPEC_HIDDEN
 
void ME_HScrollAbs (ME_TextEditor *editor, int x) DECLSPEC_HIDDEN
 
void ME_VScrollAbs (ME_TextEditor *editor, int y) DECLSPEC_HIDDEN
 
void ME_ScrollUp (ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
 
void ME_ScrollDown (ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
 
void ME_ScrollLeft (ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN
 
void ME_ScrollRight (ME_TextEditor *editor, int cx) DECLSPEC_HIDDEN
 
void ME_UpdateScrollBar (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
int ME_GetParaBorderWidth (const ME_Context *c, int flags) DECLSPEC_HIDDEN
 
LRESULT CreateIRichEditOle (IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN
 
void ME_DrawOLE (ME_Context *c, int x, int y, ME_Run *run, BOOL selected) DECLSPEC_HIDDEN
 
void ME_GetOLEObjectSize (const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN
 
void ME_CopyReObject (REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN
 
void ME_DeleteReObject (struct re_object *re_object) DECLSPEC_HIDDEN
 
ME_TextEditorME_MakeEditor (ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN
 
void ME_DestroyEditor (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
LRESULT ME_HandleMessage (ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode, HRESULT *phresult) DECLSPEC_HIDDEN
 
void ME_SendOldNotify (ME_TextEditor *editor, int nCode) DECLSPEC_HIDDEN
 
int ME_GetTextW (ME_TextEditor *editor, WCHAR *buffer, int buflen, const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP) DECLSPEC_HIDDEN
 
void ME_RTFCharAttrHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_RTFParAttrHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_RTFTblAttrHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_RTFSpecialCharHook (struct _RTF_Info *info) DECLSPEC_HIDDEN
 
void ME_StreamInFill (ME_InStream *stream) DECLSPEC_HIDDEN
 
void ME_ReplaceSel (ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len) DECLSPEC_HIDDEN
 
int set_selection (ME_TextEditor *editor, int to, int from) DECLSPEC_HIDDEN
 
BOOL ME_IsInTable (ME_DisplayItem *pItem) DECLSPEC_HIDDEN
 
ME_DisplayItemME_InsertTableRowStartFromCursor (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_DisplayItemME_InsertTableRowStartAtParagraph (ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN
 
ME_DisplayItemME_InsertTableCellFromCursor (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_DisplayItemME_InsertTableRowEndFromCursor (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
ME_DisplayItemME_GetTableRowEnd (ME_DisplayItem *para) DECLSPEC_HIDDEN
 
ME_DisplayItemME_GetTableRowStart (ME_DisplayItem *para) DECLSPEC_HIDDEN
 
ME_DisplayItemME_GetOuterParagraph (ME_DisplayItem *para) DECLSPEC_HIDDEN
 
void ME_CheckTablesForCorruption (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_ProtectPartialTableDeletion (ME_TextEditor *editor, ME_Cursor *c, int *nChars) DECLSPEC_HIDDEN
 
ME_DisplayItemME_AppendTableRow (ME_TextEditor *editor, ME_DisplayItem *table_row) DECLSPEC_HIDDEN
 
void ME_TabPressedInTable (ME_TextEditor *editor, BOOL bSelectedRow) DECLSPEC_HIDDEN
 
void ME_MoveCursorFromTableRowStartParagraph (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
struct RTFTableME_MakeTableDef (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_InitTableDef (ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN
 
ITextHost * ME_CreateTextHost (HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10) DECLSPEC_HIDDEN
 
BOOL add_undo_insert_run (ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style) DECLSPEC_HIDDEN
 
BOOL add_undo_delete_run (ME_TextEditor *, int pos, int len) DECLSPEC_HIDDEN
 
BOOL add_undo_set_para_fmt (ME_TextEditor *, const ME_Paragraph *para) DECLSPEC_HIDDEN
 
BOOL add_undo_set_char_fmt (ME_TextEditor *, int pos, int len, const CHARFORMAT2W *fmt) DECLSPEC_HIDDEN
 
BOOL add_undo_join_paras (ME_TextEditor *, int pos) DECLSPEC_HIDDEN
 
BOOL add_undo_split_para (ME_TextEditor *, const ME_Paragraph *para, ME_String *eol_str, const ME_Cell *cell) DECLSPEC_HIDDEN
 
void ME_CommitUndo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_ContinueCoalescingTransaction (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_CommitCoalescingUndo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
BOOL ME_Undo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
BOOL ME_Redo (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
void ME_EmptyUndoStack (ME_TextEditor *editor) DECLSPEC_HIDDEN
 
LRESULT ME_StreamOutRange (ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream) DECLSPEC_HIDDEN
 
LRESULT ME_StreamOut (ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream) DECLSPEC_HIDDEN
 
HRESULT ME_GetDataObject (ME_TextEditor *editor, const ME_Cursor *start, int nChars, LPDATAOBJECT *lplpdataobj) DECLSPEC_HIDDEN
 
void release_typelib (void) DECLSPEC_HIDDEN
 

Variables

HANDLE me_heap DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ CP_UNICODE

#define CP_UNICODE   1200

Definition at line 95 of file editor.h.

◆ InitFormatEtc

#define InitFormatEtc (   fe,
  cf,
  med 
)
Value:
{\
(fe).cfFormat=cf;\
(fe).dwAspect=DVASPECT_CONTENT;\
(fe).ptd=NULL;\
(fe).tymed=med;\
(fe).lindex=-1;\
};
#define NULL
Definition: types.h:112
static DWORD tymed
Definition: url.c:174

Definition at line 32 of file editor.h.

◆ ITextHost_OnTxCharFormatChange

#define ITextHost_OnTxCharFormatChange (   This,
  a 
)    TXTHOST_VTABLE(This)->OnTxCharFormatChange(This,a)

Definition at line 319 of file editor.h.

◆ ITextHost_OnTxParaFormatChange

#define ITextHost_OnTxParaFormatChange (   This,
  a 
)    TXTHOST_VTABLE(This)->OnTxParaFormatChange(This,a)

Definition at line 320 of file editor.h.

◆ ITextHost_TxActivate

#define ITextHost_TxActivate (   This,
  a 
)    TXTHOST_VTABLE(This)->TxActivate(This,a)

Definition at line 306 of file editor.h.

◆ ITextHost_TxClientToScreen

#define ITextHost_TxClientToScreen (   This,
  a 
)    TXTHOST_VTABLE(This)->TxClientToScreen(This,a)

Definition at line 305 of file editor.h.

◆ ITextHost_TxCreateCaret

#define ITextHost_TxCreateCaret (   This,
  a,
  b,
  c 
)    TXTHOST_VTABLE(This)->TxCreateCaret(This,a,b,c)

Definition at line 295 of file editor.h.

◆ ITextHost_TxDeactivate

#define ITextHost_TxDeactivate (   This,
  a 
)    TXTHOST_VTABLE(This)->TxDeactivate(This,a)

Definition at line 307 of file editor.h.

◆ ITextHost_TxEnableScrollBar

#define ITextHost_TxEnableScrollBar (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxEnableScrollBar(This,a,b)

Definition at line 290 of file editor.h.

◆ ITextHost_TxGetAcceleratorPos

#define ITextHost_TxGetAcceleratorPos (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetAcceleratorPos(This,a)

Definition at line 317 of file editor.h.

◆ ITextHost_TxGetBackStyle

#define ITextHost_TxGetBackStyle (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetBackStyle(This,a)

Definition at line 313 of file editor.h.

◆ ITextHost_TxGetCharFormat

#define ITextHost_TxGetCharFormat (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetCharFormat(This,a)

Definition at line 310 of file editor.h.

◆ ITextHost_TxGetClientRect

#define ITextHost_TxGetClientRect (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetClientRect(This,a)

Definition at line 308 of file editor.h.

◆ ITextHost_TxGetDC

#define ITextHost_TxGetDC (   This)    TXTHOST_VTABLE(This)->TxGetDC(This)

Definition at line 287 of file editor.h.

◆ ITextHost_TxGetExtent

#define ITextHost_TxGetExtent (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetExtent(This,a)

Definition at line 318 of file editor.h.

◆ ITextHost_TxGetMaxLength

#define ITextHost_TxGetMaxLength (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetMaxLength(This,a)

Definition at line 314 of file editor.h.

◆ ITextHost_TxGetParaFormat

#define ITextHost_TxGetParaFormat (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetParaFormat(This,a)

Definition at line 311 of file editor.h.

◆ ITextHost_TxGetPasswordChar

#define ITextHost_TxGetPasswordChar (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetPasswordChar(This,a)

Definition at line 316 of file editor.h.

◆ ITextHost_TxGetPropertyBits

#define ITextHost_TxGetPropertyBits (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxGetPropertyBits(This,a,b)

Definition at line 321 of file editor.h.

◆ ITextHost_TxGetScrollBars

#define ITextHost_TxGetScrollBars (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetScrollBars(This,a)

Definition at line 315 of file editor.h.

◆ ITextHost_TxGetSelectionBarWidth

#define ITextHost_TxGetSelectionBarWidth (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetSelectionBarWidth(This,a)

Definition at line 325 of file editor.h.

◆ ITextHost_TxGetSysColor

#define ITextHost_TxGetSysColor (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetSysColor(This,a)

Definition at line 312 of file editor.h.

◆ ITextHost_TxGetViewInset

#define ITextHost_TxGetViewInset (   This,
  a 
)    TXTHOST_VTABLE(This)->TxGetViewInset(This,a)

Definition at line 309 of file editor.h.

◆ ITextHost_TxImmGetContext

#define ITextHost_TxImmGetContext (   This)    TXTHOST_VTABLE(This)->TxImmGetContext(This)

Definition at line 323 of file editor.h.

◆ ITextHost_TxImmReleaseContext

#define ITextHost_TxImmReleaseContext (   This,
  a 
)    TXTHOST_VTABLE(This)->TxImmReleaseContext(This,a)

Definition at line 324 of file editor.h.

◆ ITextHost_TxInvalidateRect

#define ITextHost_TxInvalidateRect (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxInvalidateRect(This,a,b)

Definition at line 293 of file editor.h.

◆ ITextHost_TxKillTimer

#define ITextHost_TxKillTimer (   This,
  a 
)    TXTHOST_VTABLE(This)->TxKillTimer(This,a)

Definition at line 299 of file editor.h.

◆ ITextHost_TxNotify

#define ITextHost_TxNotify (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxNotify(This,a,b)

Definition at line 322 of file editor.h.

◆ ITextHost_TxReleaseDC

#define ITextHost_TxReleaseDC (   This,
  a 
)    TXTHOST_VTABLE(This)->TxReleaseDC(This,a)

Definition at line 288 of file editor.h.

◆ ITextHost_TxScreenToClient

#define ITextHost_TxScreenToClient (   This,
  a 
)    TXTHOST_VTABLE(This)->TxScreenToClient(This,a)

Definition at line 304 of file editor.h.

◆ ITextHost_TxScrollWindowEx

#define ITextHost_TxScrollWindowEx (   This,
  a,
  b,
  c,
  d,
  e,
  f,
  g 
)    TXTHOST_VTABLE(This)->TxScrollWindowEx(This,a,b,c,d,e,f,g)

Definition at line 300 of file editor.h.

◆ ITextHost_TxSetCapture

#define ITextHost_TxSetCapture (   This,
  a 
)    TXTHOST_VTABLE(This)->TxSetCapture(This,a)

Definition at line 301 of file editor.h.

◆ ITextHost_TxSetCaretPos

#define ITextHost_TxSetCaretPos (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetCaretPos(This,a,b)

Definition at line 297 of file editor.h.

◆ ITextHost_TxSetCursor

#define ITextHost_TxSetCursor (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetCursor(This,a,b)

Definition at line 303 of file editor.h.

◆ ITextHost_TxSetFocus

#define ITextHost_TxSetFocus (   This)    TXTHOST_VTABLE(This)->TxSetFocus(This)

Definition at line 302 of file editor.h.

◆ ITextHost_TxSetScrollPos

#define ITextHost_TxSetScrollPos (   This,
  a,
  b,
  c 
)    TXTHOST_VTABLE(This)->TxSetScrollPos(This,a,b,c)

Definition at line 292 of file editor.h.

◆ ITextHost_TxSetScrollRange

#define ITextHost_TxSetScrollRange (   This,
  a,
  b,
  c,
  d 
)    TXTHOST_VTABLE(This)->TxSetScrollRange(This,a,b,c,d)

Definition at line 291 of file editor.h.

◆ ITextHost_TxSetTimer

#define ITextHost_TxSetTimer (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxSetTimer(This,a,b)

Definition at line 298 of file editor.h.

◆ ITextHost_TxShowCaret

#define ITextHost_TxShowCaret (   This,
  a 
)    TXTHOST_VTABLE(This)->TxShowCaret(This,a)

Definition at line 296 of file editor.h.

◆ ITextHost_TxShowScrollBar

#define ITextHost_TxShowScrollBar (   This,
  a,
  b 
)    TXTHOST_VTABLE(This)->TxShowScrollBar(This,a,b)

Definition at line 289 of file editor.h.

◆ ITextHost_TxViewChange

#define ITextHost_TxViewChange (   This,
  a 
)    TXTHOST_VTABLE(This)->TxViewChange(This,a)

Definition at line 294 of file editor.h.

◆ RUN_IS_HIDDEN

#define RUN_IS_HIDDEN (   run)
Value:
((run)->style->fmt.dwMask & CFM_HIDDEN \
&& (run)->style->fmt.dwEffects & CFE_HIDDEN)
Arabic default style
Definition: afstyles.h:94
#define CFE_HIDDEN
Definition: richedit.h:418
#define CFM_HIDDEN
Definition: richedit.h:340

Definition at line 29 of file editor.h.

◆ TXTHOST_VTABLE

#define TXTHOST_VTABLE (   This)    (This)->lpVtbl

Definition at line 284 of file editor.h.

Function Documentation

◆ add_marked_para()

void add_marked_para ( ME_TextEditor editor,
ME_DisplayItem para 
)

Definition at line 112 of file para.c.

113{
114 ME_DisplayItem *iter = editor->first_marked_para;
115
116 if (!iter)
117 {
118 editor->first_marked_para = di;
119 return;
120 }
121 while (iter)
122 {
123 if (iter == di)
124 return;
125 else if (di->member.para.nCharOfs < iter->member.para.nCharOfs)
126 {
127 if (iter == editor->first_marked_para)
128 editor->first_marked_para = di;
129 di->member.para.next_marked = iter;
130 iter->member.para.prev_marked = di;
131 break;
132 }
133 else if (di->member.para.nCharOfs >= iter->member.para.nCharOfs)
134 {
135 if (!iter->member.para.next_marked || di->member.para.nCharOfs < iter->member.para.next_marked->member.para.nCharOfs)
136 {
137 if (iter->member.para.next_marked)
138 {
139 di->member.para.next_marked = iter->member.para.next_marked;
140 iter->member.para.next_marked->member.para.prev_marked = di;
141 }
142 di->member.para.prev_marked = iter;
143 iter->member.para.next_marked = di;
144 break;
145 }
146 }
147 iter = iter->member.para.next_marked;
148 }
149}
union tagME_DisplayItem::@540 member
ME_Paragraph para
Definition: editstr.h:262
struct tagME_DisplayItem * next_marked
Definition: editstr.h:218
struct tagME_DisplayItem * prev_marked
Definition: editstr.h:218
ME_DisplayItem * first_marked_para
Definition: editstr.h:435

Referenced by mark_para_rewrap(), and ME_MakeFirstParagraph().

◆ add_undo_delete_run()

BOOL add_undo_delete_run ( ME_TextEditor editor,
int  pos,
int  len 
)

Definition at line 204 of file undo.c.

205{
206 struct undo_item *undo = add_undo( editor, undo_delete_run );
207 if (!undo) return FALSE;
208
209 undo->u.delete_run.pos = pos;
210 undo->u.delete_run.len = len;
211
212 return TRUE;
213}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ undo_delete_run
Definition: editstr.h:290
GLenum GLsizei len
Definition: glext.h:6722
struct delete_run_item delete_run
Definition: editstr.h:348
union undo_item::@541 u
static struct undo_item * add_undo(ME_TextEditor *editor, enum undo_type type)
Definition: undo.c:72

Referenced by ME_InsertRunAtCursor().

◆ add_undo_insert_run()

BOOL add_undo_insert_run ( ME_TextEditor editor,
int  pos,
const WCHAR str,
int  len,
int  flags,
ME_Style style 
)

Definition at line 131 of file undo.c.

132{
133 struct undo_item *undo = add_undo( editor, undo_insert_run );
134 if (!undo) return FALSE;
135
136 undo->u.insert_run.str = heap_alloc( (len + 1) * sizeof(WCHAR) );
137 if (!undo->u.insert_run.str)
138 {
139 ME_EmptyUndoStack( editor );
140 return FALSE;
141 }
142 memcpy( undo->u.insert_run.str, str, len * sizeof(WCHAR) );
143 undo->u.insert_run.str[len] = 0;
144 undo->u.insert_run.pos = pos;
145 undo->u.insert_run.len = len;
146 undo->u.insert_run.flags = flags;
147 undo->u.insert_run.style = style;
149 return TRUE;
150}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
void ME_AddRefStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:454
@ undo_insert_run
Definition: editstr.h:289
GLbitfield flags
Definition: glext.h:7161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const WCHAR * str
struct insert_run_item insert_run
Definition: editstr.h:347
void ME_EmptyUndoStack(ME_TextEditor *editor)
Definition: undo.c:53
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ME_InternalDeleteText().

◆ add_undo_join_paras()

BOOL add_undo_join_paras ( ME_TextEditor editor,
int  pos 
)

Definition at line 176 of file undo.c.

177{
178 struct undo_item *undo = add_undo( editor, undo_join_paras );
179 if (!undo) return FALSE;
180
181 undo->u.join_paras.pos = pos;
182 return TRUE;
183}
@ undo_join_paras
Definition: editstr.h:291
struct join_paras_item join_paras
Definition: editstr.h:349

Referenced by ME_SplitParagraph().

◆ add_undo_set_char_fmt()

BOOL add_undo_set_char_fmt ( ME_TextEditor editor,
int  pos,
int  len,
const CHARFORMAT2W fmt 
)

Definition at line 164 of file undo.c.

165{
166 struct undo_item *undo = add_undo( editor, undo_set_char_fmt );
167 if (!undo) return FALSE;
168
169 undo->u.set_char_fmt.pos = pos;
170 undo->u.set_char_fmt.len = len;
171 undo->u.set_char_fmt.fmt = *fmt;
172
173 return TRUE;
174}
@ undo_set_char_fmt
Definition: editstr.h:294
Definition: dsound.c:943
struct set_char_fmt_item set_char_fmt
Definition: editstr.h:352

Referenced by ME_SetCharFormat().

◆ add_undo_set_para_fmt()

BOOL add_undo_set_para_fmt ( ME_TextEditor editor,
const ME_Paragraph para 
)

Definition at line 152 of file undo.c.

153{
154 struct undo_item *undo = add_undo( editor, undo_set_para_fmt );
155 if (!undo) return FALSE;
156
157 undo->u.set_para_fmt.pos = para->nCharOfs;
158 undo->u.set_para_fmt.fmt = para->fmt;
159 undo->u.set_para_fmt.border = para->border;
160
161 return TRUE;
162}
@ undo_set_para_fmt
Definition: editstr.h:293
ME_BorderRect border
Definition: editstr.h:208
PARAFORMAT2 fmt
Definition: editstr.h:204
struct set_para_fmt_item set_para_fmt
Definition: editstr.h:351

Referenced by ME_JoinParagraphs(), ME_PlayUndoItem(), and ME_SetParaFormat().

◆ add_undo_split_para()

BOOL add_undo_split_para ( ME_TextEditor editor,
const ME_Paragraph para,
ME_String eol_str,
const ME_Cell cell 
)

Definition at line 185 of file undo.c.

186{
187 struct undo_item *undo = add_undo( editor, undo_split_para );
188 if (!undo) return FALSE;
189
190 undo->u.split_para.pos = para->nCharOfs - eol_str->nLen;
191 undo->u.split_para.eol_str = eol_str;
192 undo->u.split_para.fmt = para->fmt;
193 undo->u.split_para.border = para->border;
194 undo->u.split_para.flags = para->prev_para->member.para.nFlags & ~MEPF_CELL;
195
196 if (cell)
197 {
198 undo->u.split_para.cell_border = cell->border;
199 undo->u.split_para.cell_right_boundary = cell->nRightBoundary;
200 }
201 return TRUE;
202}
@ undo_split_para
Definition: editstr.h:292
int nRightBoundary
Definition: editstr.h:224
ME_BorderRect border
Definition: editstr.h:225
struct tagME_DisplayItem * prev_para
Definition: editstr.h:217
int nLen
Definition: editstr.h:57
struct split_para_item split_para
Definition: editstr.h:350

Referenced by ME_JoinParagraphs().

◆ cf2w_to_cfany()

BOOL cf2w_to_cfany ( CHARFORMAT2W to,
const CHARFORMAT2W from 
)

Definition at line 79 of file style.c.

80{
81 assert(from->cbSize == sizeof(CHARFORMAT2W));
82 if (to->cbSize == sizeof(CHARFORMATA))
83 {
84 CHARFORMATA *t = (CHARFORMATA *)to;
86 WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
87 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
88 t->dwMask &= CFM_ALL;
89 t->dwEffects &= CFM_EFFECTS;
90 return TRUE;
91 }
92 if (to->cbSize == sizeof(CHARFORMATW))
93 {
94 CHARFORMATW *t = (CHARFORMATW *)to;
95 CopyMemory(t, from, sizeof(*t));
96 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
97 t->dwMask &= CFM_ALL;
98 t->dwEffects &= CFM_EFFECTS;
99 return TRUE;
100 }
101 if (to->cbSize == sizeof(CHARFORMAT2A))
102 {
103 CHARFORMAT2A *t = (CHARFORMAT2A *)to;
104 /* copy the A structure without face name */
105 CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
106 /* convert face name */
107 WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
108 /* copy the rest of the 2A structure to 2W */
109 CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight));
110 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
111 return TRUE;
112 }
113 if (to->cbSize == sizeof(CHARFORMAT2W))
114 {
115 CopyMemory(to, from, sizeof(CHARFORMAT2W));
116 return TRUE;
117 }
118 return FALSE;
119}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define assert(x)
Definition: debug.h:53
GLdouble GLdouble t
Definition: gl.h:2047
#define CFM_EFFECTS
Definition: richedit.h:364
#define CFM_ALL
Definition: richedit.h:387
CardRegion * from
Definition: spigame.cpp:19
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define CopyMemory
Definition: winbase.h:1710

Referenced by ME_HandleMessage().

◆ cfany_to_cf2w()

BOOL cfany_to_cf2w ( CHARFORMAT2W to,
const CHARFORMAT2W from 
)

Definition at line 36 of file style.c.

37{
38 if (from->cbSize == sizeof(CHARFORMATA))
39 {
41 CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
42 to->cbSize = sizeof(CHARFORMAT2W);
43 if (f->dwMask & CFM_FACE) {
44 MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName));
45 }
46 return TRUE;
47 }
48 if (from->cbSize == sizeof(CHARFORMATW))
49 {
51 CopyMemory(to, f, sizeof(*f));
52 /* theoretically, we don't need to zero the remaining memory */
54 to->cbSize = sizeof(CHARFORMAT2W);
55 return TRUE;
56 }
57 if (from->cbSize == sizeof(CHARFORMAT2A))
58 {
60 /* copy the A structure without face name */
61 CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
62 /* convert face name */
63 if (f->dwMask & CFM_FACE)
64 MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName));
65 /* copy the rest of the 2A structure to 2W */
66 CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight));
67 to->cbSize = sizeof(CHARFORMAT2W);
68 return TRUE;
69 }
70 if (from->cbSize == sizeof(CHARFORMAT2W))
71 {
72 CopyMemory(to, from, sizeof(CHARFORMAT2W));
73 return TRUE;
74 }
75
76 return FALSE;
77}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define MultiByteToWideChar
Definition: compat.h:110
GLfloat f
Definition: glext.h:7540
struct _charformat2w CHARFORMAT2W
#define CFM_FACE
Definition: richedit.h:360
WCHAR szFaceName[LF_FACESIZE]
Definition: richedit.h:313
WORD wWeight
Definition: richedit.h:314
#define ZeroMemory
Definition: winbase.h:1712

Referenced by handle_EM_SETCHARFORMAT(), and ME_MakeFirstParagraph().

◆ create_caret()

void create_caret ( ME_TextEditor ed)

Definition at line 272 of file caret.c.

273{
274 int x, y, height;
275
276 ME_GetCursorCoordinates(editor, &editor->pCursors[0], &x, &y, &height);
277 ITextHost_TxCreateCaret(editor->texthost, NULL, 0, height);
278 editor->caret_height = height;
279 editor->caret_hidden = TRUE;
280}
void ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor, int *x, int *y, int *height)
Definition: caret.c:221
#define ITextHost_TxCreateCaret(This, a, b, c)
Definition: editor.h:295
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

Referenced by ME_HandleMessage(), and update_caret().

◆ CreateIRichEditOle()

LRESULT CreateIRichEditOle ( IUnknown outer_unk,
ME_TextEditor editor,
LPVOID ppvObj 
)

Definition at line 5688 of file richole.c.

5689{
5690 IRichEditOleImpl *reo;
5691
5692 reo = heap_alloc(sizeof(IRichEditOleImpl));
5693 if (!reo)
5694 return 0;
5695
5696 reo->IUnknown_inner.lpVtbl = &reo_unk_vtbl;
5697 reo->IRichEditOle_iface.lpVtbl = &revt;
5698 reo->ITextDocument2Old_iface.lpVtbl = &tdvt;
5699 reo->ref = 1;
5700 reo->editor = editor;
5701 reo->txtSel = NULL;
5702
5703 TRACE("Created %p\n",reo);
5704 list_init(&reo->rangelist);
5705 list_init(&reo->clientsites);
5706 if (outer_unk)
5707 reo->outer_unk = outer_unk;
5708 else
5709 reo->outer_unk = &reo->IUnknown_inner;
5710 *ppvObj = &reo->IUnknown_inner;
5711
5712 return 1;
5713}
static void list_init(struct list_entry *head)
Definition: list.h:51
static const IRichEditOleVtbl revt
Definition: richole.c:1510
static const ITextDocument2OldVtbl tdvt
Definition: richole.c:4550
static const IUnknownVtbl reo_unk_vtbl
Definition: richole.c:1006
#define TRACE(s)
Definition: solgame.cpp:4
IRichEditOle IRichEditOle_iface
Definition: richole.c:211
ITextSelectionImpl * txtSel
Definition: richole.c:217
ITextDocument2Old ITextDocument2Old_iface
Definition: richole.c:212
IUnknown IUnknown_inner
Definition: richole.c:210
struct list rangelist
Definition: richole.c:219
struct list clientsites
Definition: richole.c:220
IUnknown * outer_unk
Definition: richole.c:213
ME_TextEditor * editor
Definition: richole.c:216

Referenced by insert_static_object(), ITextServicesImpl_QueryInterface(), and ME_HandleMessage().

◆ debugstr_run()

static const char * debugstr_run ( const ME_Run run)
inlinestatic

Definition at line 46 of file editor.h.

47{
48 return debugstr_wn( get_text( run, 0 ), run->len );
49}
static WCHAR * get_text(const ME_Run *run, int offset)
Definition: editor.h:41
#define debugstr_wn
Definition: kernel32.h:33
int len
Definition: editstr.h:163

Referenced by itemize_para(), ME_CheckCharOffsets(), ME_DumpDocument(), ME_InternalDeleteText(), ME_JoinParagraphs(), ME_MaximizeSplit(), ME_PropagateCharOffset(), ME_SplitByBacktracking(), and split_run_extents().

◆ destroy_para()

void destroy_para ( ME_TextEditor editor,
ME_DisplayItem item 
)

Definition at line 48 of file para.c.

49{
50 assert(item->type == diParagraph);
51
52 if (item->member.para.nWidth == editor->nTotalWidth)
53 {
54 item->member.para.nWidth = 0;
55 editor->nTotalWidth = get_total_width(editor);
56 }
57 editor->total_rows -= item->member.para.nRows;
58 ME_DestroyString(item->member.para.text);
59 para_num_clear( &item->member.para.para_num );
60 remove_marked_para(editor, item);
62}
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN
Definition: list.c:160
void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN
Definition: string.c:96
@ diParagraph
Definition: editstr.h:85
static ATOM item
Definition: dde.c:856
void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
Definition: para.c:82
void para_num_clear(struct para_num *pn)
Definition: para.c:442
int get_total_width(ME_TextEditor *editor)
Definition: para.c:64

Referenced by ME_DestroyEditor(), and ME_JoinParagraphs().

◆ get_di_from_para()

ME_DisplayItem * get_di_from_para ( ME_Paragraph para)

Definition at line 32 of file para.c.

33{
35}
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define offsetof(TYPE, MEMBER)

Referenced by ME_InsertRunAtCursor(), ME_SetCharFormat(), ME_SetParaFormat(), and para_num_clear_list().

◆ get_text()

◆ get_total_width()

int get_total_width ( ME_TextEditor editor)

Definition at line 64 of file para.c.

65{
66 ME_Paragraph *para;
67 int total_width = 0;
68
69 if (editor->pBuffer->pFirst && editor->pBuffer->pLast)
70 {
71 para = &editor->pBuffer->pFirst->next->member.para;
72 while (para != &editor->pBuffer->pLast->member.para && para->next_para)
73 {
74 total_width = max(total_width, para->nWidth);
75 para = &para->next_para->member.para;
76 }
77 }
78
79 return total_width;
80}
struct tagME_DisplayItem * next
Definition: editstr.h:257
struct tagME_DisplayItem * next_para
Definition: editstr.h:217
ME_DisplayItem * pFirst
Definition: editstr.h:268
ME_DisplayItem * pLast
Definition: editstr.h:268
ME_TextBuffer * pBuffer
Definition: editstr.h:386
#define max(a, b)
Definition: svc.c:63

Referenced by destroy_para(), and ME_WrapMarkedParagraphs().

◆ hide_caret()

void hide_caret ( ME_TextEditor ed)

Definition at line 288 of file caret.c.

289{
290 /* calls to HideCaret are cumulative; do so only once */
291 if (!editor->caret_hidden)
292 {
293 ITextHost_TxShowCaret(editor->texthost, FALSE);
294 editor->caret_hidden = TRUE;
295 }
296}
#define ITextHost_TxShowCaret(This, a)
Definition: editor.h:296

Referenced by ME_ArrowKey(), ME_HandleMessage(), and update_caret().

◆ mark_para_rewrap()

void mark_para_rewrap ( ME_TextEditor editor,
ME_DisplayItem para 
)

Definition at line 26 of file para.c.

27{
29 add_marked_para(editor, para);
30}
#define MEPF_REWRAP
Definition: editstr.h:141
void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
Definition: para.c:112

Referenced by handle_enter(), ME_InsertRunAtCursor(), ME_InternalDeleteText(), ME_JoinParagraphs(), ME_JoinRuns(), ME_MarkForWrapping(), ME_PlayUndoItem(), ME_SetCharFormat(), ME_SetParaFormat(), ME_SplitParagraph(), ME_SplitRunSimple(), and para_num_clear_list().

◆ ME_AddRefStyle()

void ME_AddRefStyle ( ME_Style item)

Definition at line 454 of file style.c.

455{
456 assert(s->nRefs>0); /* style with 0 references isn't supposed to exist */
457 s->nRefs++;
458 all_refs++;
459 TRACE_(richedit_style)("ME_AddRefStyle %p, new refs=%d, total refs=%d\n", s, s->nRefs, all_refs);
460}
#define TRACE_(x)
Definition: compat.h:76
static int all_refs
Definition: style.c:26
GLdouble s
Definition: gl.h:2039

Referenced by add_undo_insert_run(), ME_ApplyStyle(), ME_GetInsertStyle(), ME_HandleMessage(), ME_MakeRun(), ME_RTFReadHook(), ME_SaveTempStyle(), ME_StreamIn(), para_num_init(), and RTFUngetToken().

◆ ME_AppendString()

BOOL ME_AppendString ( ME_String s,
const WCHAR append,
int  len 
)

Definition at line 126 of file string.c.

127{
128 return ME_InsertString( s, s->nLen, append, len );
129}
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
Definition: string.c:103
static void append(struct dump_context *dc, const void *data, unsigned size)
Definition: minidump.c:397

Referenced by ME_JoinParagraphs(), and ME_SplitParagraph().

◆ ME_AppendTableRow()

ME_DisplayItem * ME_AppendTableRow ( ME_TextEditor editor,
ME_DisplayItem table_row 
)

Definition at line 407 of file table.c.

409{
410 WCHAR endl = '\r', tab = '\t';
411 ME_DisplayItem *run;
412 PARAFORMAT2 *pFmt;
413 int i;
414
415 assert(table_row);
416 assert(table_row->type == diParagraph);
417 if (!editor->bEmulateVersion10) { /* v4.1 */
418 ME_DisplayItem *insertedCell, *para, *cell, *prevTableEnd;
419 cell = ME_FindItemFwd(ME_GetTableRowStart(table_row), diCell);
420 prevTableEnd = ME_GetTableRowEnd(table_row);
421 para = prevTableEnd->member.para.next_para;
422 run = ME_FindItemFwd(para, diRun);
423 editor->pCursors[0].pPara = para;
424 editor->pCursors[0].pRun = run;
425 editor->pCursors[0].nOffset = 0;
426 editor->pCursors[1] = editor->pCursors[0];
428 insertedCell = ME_FindItemFwd(para, diCell);
429 /* Copy cell properties */
430 insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
431 insertedCell->member.cell.border = cell->member.cell.border;
432 while (cell->member.cell.next_cell) {
433 cell = cell->member.cell.next_cell;
434 para = ME_InsertTableCellFromCursor(editor);
435 insertedCell = ME_FindItemBack(para, diCell);
436 /* Copy cell properties */
437 insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
438 insertedCell->member.cell.border = cell->member.cell.border;
439 };
440 para = ME_InsertTableRowEndFromCursor(editor);
441 para->member.para.fmt = prevTableEnd->member.para.fmt;
442 /* return the table row start for the inserted paragraph */
444 } else { /* v1.0 - 3.0 */
445 run = ME_FindItemBack(table_row->member.para.next_para, diRun);
446 pFmt = &table_row->member.para.fmt;
447 assert(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE);
448 editor->pCursors[0].pPara = table_row;
449 editor->pCursors[0].pRun = run;
450 editor->pCursors[0].nOffset = 0;
451 editor->pCursors[1] = editor->pCursors[0];
452 ME_InsertTextFromCursor(editor, 0, &endl, 1, run->member.run.style);
453 run = editor->pCursors[0].pRun;
454 for (i = 0; i < pFmt->cTabCount; i++) {
455 ME_InsertTextFromCursor(editor, 0, &tab, 1, run->member.run.style);
456 }
457 return table_row->member.para.next_para;
458 }
459}
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style)
Definition: caret.c:595
ME_DisplayItem * ME_GetTableRowEnd(ME_DisplayItem *para)
Definition: table.c:136
ME_DisplayItem * ME_InsertTableRowEndFromCursor(ME_TextEditor *editor)
Definition: table.c:129
ME_DisplayItem * ME_GetTableRowStart(ME_DisplayItem *para)
Definition: table.c:154
ME_DisplayItem * ME_InsertTableRowStartFromCursor(ME_TextEditor *editor)
Definition: table.c:79
ME_DisplayItem * ME_InsertTableCellFromCursor(ME_TextEditor *editor)
Definition: table.c:121
ME_DisplayItem * ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:111
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:134
@ diCell
Definition: editstr.h:86
@ diRun
Definition: editstr.h:87
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PFM_TABLE
Definition: richedit.h:870
#define PFE_TABLE
Definition: richedit.h:944
DWORD dwMask
Definition: richedit.h:667
SHORT cTabCount
Definition: richedit.h:674
WORD wEffects
Definition: richedit.h:669
struct tagME_DisplayItem * next_cell
Definition: editstr.h:229
ME_DisplayItem * pPara
Definition: editstr.h:275
int nOffset
Definition: editstr.h:277
ME_DisplayItem * pRun
Definition: editstr.h:276
ME_DIType type
Definition: editstr.h:256
ME_Cell cell
Definition: editstr.h:261
ME_Style * style
Definition: editstr.h:160
ME_Cursor * pCursors
Definition: editstr.h:387
BOOL bEmulateVersion10
Definition: editstr.h:385

Referenced by handle_enter(), and ME_SelectOrInsertNextCell().

◆ ME_ApplyStyle()

ME_Style * ME_ApplyStyle ( ME_TextEditor ed,
ME_Style sSrc,
CHARFORMAT2W style 
)

Definition at line 156 of file style.c.

157{
158 CHARFORMAT2W fmt = sSrc->fmt;
159 ME_Style *s;
160
161 assert(mod->cbSize == sizeof(CHARFORMAT2W));
162 COPY_STYLE_ITEM(CFM_ANIMATION, bAnimation);
163 COPY_STYLE_ITEM(CFM_BACKCOLOR, crBackColor);
164 COPY_STYLE_ITEM(CFM_CHARSET, bCharSet);
165 COPY_STYLE_ITEM(CFM_COLOR, crTextColor);
166 COPY_STYLE_ITEM_MEMCPY(CFM_FACE, szFaceName);
167 COPY_STYLE_ITEM(CFM_KERNING, wKerning);
170 COPY_STYLE_ITEM(CFM_REVAUTHOR, bRevAuthor);
171 if (mod->dwMask & CFM_SIZE) {
172 fmt.dwMask |= CFM_SIZE;
173 fmt.yHeight = min(mod->yHeight, yHeightCharPtsMost * 20);
174 }
175 COPY_STYLE_ITEM(CFM_SPACING, sSpacing);
176 COPY_STYLE_ITEM(CFM_STYLE, sStyle);
177 COPY_STYLE_ITEM(CFM_WEIGHT, wWeight);
178 /* FIXME: this is not documented this way, but that's the more logical */
179 COPY_STYLE_ITEM(CFM_FACE, bPitchAndFamily);
180
181 fmt.dwEffects &= ~(mod->dwMask);
182 fmt.dwEffects |= mod->dwEffects & mod->dwMask;
183 fmt.dwMask |= mod->dwMask;
184 if (mod->dwMask & CFM_COLOR)
185 {
186 if (mod->dwEffects & CFE_AUTOCOLOR)
187 fmt.dwEffects |= CFE_AUTOCOLOR;
188 else
189 fmt.dwEffects &= ~CFE_AUTOCOLOR;
190 }
191
192 COPY_STYLE_ITEM(CFM_UNDERLINETYPE, bUnderlineType);
193 /* If the CFM_UNDERLINE effect is not specified, set it appropriately */
194 if ((mod->dwMask & CFM_UNDERLINETYPE) && !(mod->dwMask & CFM_UNDERLINE))
195 {
196 fmt.dwMask |= CFM_UNDERLINE;
197 if (mod->bUnderlineType == CFU_UNDERLINENONE)
198 fmt.dwEffects &= ~CFE_UNDERLINE;
199 else
200 fmt.dwEffects |= CFE_UNDERLINE;
201 }
202
203 if (mod->dwMask & CFM_BOLD && !(mod->dwMask & CFM_WEIGHT))
204 {
205 fmt.wWeight = (mod->dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL;
206 } else if (mod->dwMask & CFM_WEIGHT && !(mod->dwMask & CFM_BOLD)) {
207 if (mod->wWeight > FW_NORMAL)
208 fmt.dwEffects |= CFE_BOLD;
209 else
210 fmt.dwEffects &= ~CFE_BOLD;
211 }
212
213 LIST_FOR_EACH_ENTRY(s, &editor->style_list, ME_Style, entry)
214 {
215 if (!memcmp( &s->fmt, &fmt, sizeof(fmt) ))
216 {
217 TRACE_(richedit_style)("found existing style %p\n", s);
218 ME_AddRefStyle( s );
219 return s;
220 }
221 }
222
223 s = ME_MakeStyle( &fmt );
224 if (s)
225 list_add_head( &editor->style_list, &s->entry );
226 TRACE_(richedit_style)("created new style %p\n", s);
227 return s;
228}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
int yOffset
Definition: appswitch.c:59
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define COPY_STYLE_ITEM(mask, member)
Definition: style.c:138
ME_Style * ME_MakeStyle(CHARFORMAT2W *style)
Definition: style.c:121
void ME_AddRefStyle(ME_Style *s)
Definition: style.c:454
#define COPY_STYLE_ITEM_MEMCPY(mask, member)
Definition: style.c:144
static int mod
Definition: i386-dis.c:1288
uint32_t entry
Definition: isohybrid.c:63
#define min(a, b)
Definition: monoChain.cc:55
#define yHeightCharPtsMost
Definition: richedit.h:214
#define CFE_BOLD
Definition: richedit.h:406
#define CFM_STYLE
Definition: richedit.h:351
#define CFE_AUTOCOLOR
Definition: richedit.h:414
#define CFM_OFFSET
Definition: richedit.h:359
#define CFM_WEIGHT
Definition: richedit.h:354
#define CFM_SPACING
Definition: richedit.h:353
#define CFM_CHARSET
Definition: richedit.h:358
#define CFE_UNDERLINE
Definition: richedit.h:408
#define CFM_BACKCOLOR
Definition: richedit.h:357
#define CFM_KERNING
Definition: richedit.h:352
#define CFM_LCID
Definition: richedit.h:356
#define CFM_SIZE
Definition: richedit.h:362
#define CFM_REVAUTHOR
Definition: richedit.h:347
#define CFM_ANIMATION
Definition: richedit.h:350
#define CFM_BOLD
Definition: richedit.h:332
#define CFM_UNDERLINETYPE
Definition: richedit.h:355
#define CFU_UNDERLINENONE
Definition: richedit.h:427
#define CFM_UNDERLINE
Definition: richedit.h:334
#define CFM_COLOR
Definition: richedit.h:361
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
CHARFORMAT2W fmt
Definition: editstr.h:73
#define FW_BOLD
Definition: wingdi.h:378
#define FW_NORMAL
Definition: wingdi.h:373

Referenced by ME_RTFCharAttrHook(), ME_SetCharFormat(), ME_SetDefaultCharFormat(), ME_SetSelectionCharFormat(), and para_num_init().

◆ ME_ArrowKey()

BOOL ME_ArrowKey ( ME_TextEditor ed,
int  nVKey,
BOOL  extend,
BOOL  ctrl 
)

Definition at line 1630 of file caret.c.

1631{
1632 int nCursor = 0;
1633 ME_Cursor *p = &editor->pCursors[nCursor];
1634 ME_Cursor tmp_curs = *p;
1635 BOOL success = FALSE;
1636
1637 ME_CheckCharOffsets(editor);
1638 switch(nVKey) {
1639 case VK_LEFT:
1640 editor->bCaretAtEnd = FALSE;
1641 if (ctrl)
1642 success = ME_MoveCursorWords(editor, &tmp_curs, -1);
1643 else
1644 success = ME_MoveCursorChars(editor, &tmp_curs, -1, extend);
1645 break;
1646 case VK_RIGHT:
1647 editor->bCaretAtEnd = FALSE;
1648 if (ctrl)
1649 success = ME_MoveCursorWords(editor, &tmp_curs, +1);
1650 else
1651 success = ME_MoveCursorChars(editor, &tmp_curs, +1, extend);
1652 break;
1653 case VK_UP:
1654 ME_MoveCursorLines(editor, &tmp_curs, -1, extend);
1655 break;
1656 case VK_DOWN:
1657 ME_MoveCursorLines(editor, &tmp_curs, +1, extend);
1658 break;
1659 case VK_PRIOR:
1660 ME_ArrowPageUp(editor, &tmp_curs);
1661 break;
1662 case VK_NEXT:
1663 ME_ArrowPageDown(editor, &tmp_curs);
1664 break;
1665 case VK_HOME: {
1666 if (ctrl)
1667 ME_ArrowCtrlHome(editor, &tmp_curs);
1668 else
1669 ME_ArrowHome(editor, &tmp_curs);
1670 editor->bCaretAtEnd = FALSE;
1671 break;
1672 }
1673 case VK_END:
1674 if (ctrl)
1675 ME_ArrowCtrlEnd(editor, &tmp_curs);
1676 else
1677 ME_ArrowEnd(editor, &tmp_curs);
1678 break;
1679 }
1680
1681 if (!extend)
1682 editor->pCursors[1] = tmp_curs;
1683 *p = tmp_curs;
1684
1685 ME_InvalidateSelection(editor);
1686 ME_Repaint(editor);
1687 hide_caret(editor);
1688 ME_EnsureVisible(editor, &tmp_curs);
1689 update_caret(editor);
1690 ME_SendSelChange(editor);
1691 return success;
1692}
static void ME_ArrowHome(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1521
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop)
Definition: caret.c:720
BOOL ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
Definition: caret.c:799
static void ME_ArrowPageUp(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1409
static void ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL extend)
Definition: caret.c:1323
void hide_caret(ME_TextEditor *editor)
Definition: caret.c:288
static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1572
void ME_SendSelChange(ME_TextEditor *editor)
Definition: caret.c:1598
static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1463
static void ME_ArrowEnd(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1547
void update_caret(ME_TextEditor *editor)
Definition: caret.c:298
static void ME_ArrowCtrlHome(ME_TextEditor *editor, ME_Cursor *pCursor)
Definition: caret.c:1541
void ME_CheckCharOffsets(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: run.c:101
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) DECLSPEC_HIDDEN
Definition: paint.c:1275
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:1322
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: paint.c:106
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat GLfloat p
Definition: glext.h:8902
#define ctrl
Definition: input.c:1756
#define success(from, fromstr, to, tostr)
#define VK_UP
Definition: winuser.h:2225
#define VK_NEXT
Definition: winuser.h:2221
#define VK_END
Definition: winuser.h:2222
#define VK_HOME
Definition: winuser.h:2223
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define VK_PRIOR
Definition: winuser.h:2220

Referenced by ME_KeyDown().

◆ ME_CallWordBreakProc()

int ME_CallWordBreakProc ( ME_TextEditor editor,
WCHAR str,
INT  len,
INT  start,
INT  code 
)

Definition at line 204 of file string.c.

205{
206 if (!editor->pfnWordBreak) {
207 return ME_WordBreakProc(str, start, len, code);
208 } else if (!editor->bEmulateVersion10) {
209 /* MSDN lied about the third parameter for EditWordBreakProc being the number
210 * of characters, it is actually the number of bytes of the string. */
211 return editor->pfnWordBreak(str, start, len * sizeof(WCHAR), code);
212 } else {
213 int result;
215 NULL, 0, NULL, NULL);
217 if (!buffer) return 0;
222 return result;
223 }
224}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static int ME_WordBreakProc(LPWSTR s, INT start, INT len, INT code)
Definition: string.c:162
GLuint start
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLuint64EXT * result
Definition: glext.h:11304
Definition: inflate.c:139
EDITWORDBREAKPROCW pfnWordBreak
Definition: editstr.h:417
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888

Referenced by ME_MoveCursorWords().

◆ ME_CanJoinRuns()

BOOL ME_CanJoinRuns ( const ME_Run run1,
const ME_Run run2 
)

Definition at line 35 of file run.c.

36{
37 if ((run1->nFlags | run2->nFlags) & MERF_NOJOIN)
38 return FALSE;
39 if (run1->style != run2->style)
40 return FALSE;
41 if ((run1->nFlags & MERF_STYLEFLAGS) != (run2->nFlags & MERF_STYLEFLAGS))
42 return FALSE;
43 return TRUE;
44}
#define MERF_STYLEFLAGS
Definition: editstr.h:103
#define MERF_NOJOIN
Definition: editstr.h:131
int nFlags
Definition: editstr.h:165

Referenced by ME_PrepareParagraphForWrapping().

◆ ME_CharCompare()

static int ME_CharCompare ( WCHAR  a,
WCHAR  b,
int  caseSensitive 
)
inlinestatic

Definition at line 106 of file editor.h.

107{
108 return caseSensitive ? (a == b) : (towupper(a) == towupper(b));
109}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
#define towupper(c)
Definition: wctype.h:99

Referenced by ME_FindText().

◆ ME_CharFormatFromLogFont()

void ME_CharFormatFromLogFont ( HDC  hDC,
const LOGFONTW lf,
CHARFORMAT2W fmt 
)

Definition at line 331 of file style.c.

332{
333 int ry;
334
337 lstrcpyW(fmt->szFaceName, lf->lfFaceName);
338 fmt->dwEffects = 0;
340 fmt->wWeight = lf->lfWeight;
341 fmt->yHeight = -lf->lfHeight*1440/ry;
342 if (lf->lfWeight > FW_NORMAL) fmt->dwEffects |= CFM_BOLD;
343 if (lf->lfItalic) fmt->dwEffects |= CFM_ITALIC;
344 if (lf->lfUnderline) fmt->dwEffects |= CFM_UNDERLINE;
345 fmt->bUnderlineType = CFU_UNDERLINE;
346 if (lf->lfStrikeOut) fmt->dwEffects |= CFM_STRIKEOUT;
347 fmt->bPitchAndFamily = lf->lfPitchAndFamily;
348 fmt->bCharSet = lf->lfCharSet;
349}
static HDC hDC
Definition: 3dtext.c:33
#define lstrcpyW
Definition: compat.h:749
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt)
Definition: style.c:150
#define CFM_STRIKEOUT
Definition: richedit.h:335
#define CFM_ITALIC
Definition: richedit.h:333
#define CFU_UNDERLINE
Definition: richedit.h:428
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfPitchAndFamily
Definition: dimm.idl:71
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719

Referenced by ME_HandleMessage().

◆ ME_CharFromPoint()

int ME_CharFromPoint ( ME_TextEditor editor,
int  cx,
ME_Run run,
BOOL  closest,
BOOL  visual_order 
)

Definition at line 521 of file run.c.

522{
524 int ret;
525
526 ME_InitContext( &c, editor, ITextHost_TxGetDC( editor->texthost ) );
527 ret = ME_CharFromPointContext( &c, cx, run, closest, visual_order );
529 return ret;
530}
void ME_DestroyContext(ME_Context *c)
Definition: context.c:44
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
Definition: context.c:23
int ME_CharFromPointContext(ME_Context *c, int cx, ME_Run *run, BOOL closest, BOOL visual_order)
Definition: run.c:462
#define ITextHost_TxGetDC(This)
Definition: editor.h:287
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
_Out_opt_ int * cx
Definition: commctrl.h:585
ITextHost * texthost
Definition: editstr.h:383
int ret

Referenced by ME_FindRunInRow().

◆ ME_CharFromPointContext()

int ME_CharFromPointContext ( ME_Context c,
int  cx,
ME_Run run,
BOOL  closest,
BOOL  visual_order 
)

Definition at line 462 of file run.c.

463{
464 ME_String *mask_text = NULL;
465 WCHAR *str;
466 int fit = 0;
467 SIZE sz, sz2, sz3;
468 if (!run->len || cx <= 0)
469 return 0;
470
471 if (run->nFlags & (MERF_TAB | MERF_ENDCELL))
472 {
473 if (!closest || cx < run->nWidth / 2) return 0;
474 return 1;
475 }
476
477 if (run->nFlags & MERF_GRAPHICS)
478 {
479 SIZE sz;
480 ME_GetOLEObjectSize(c, run, &sz);
481 if (!closest || cx < sz.cx / 2) return 0;
482 return 1;
483 }
484
485 if (run->para->nFlags & MEPF_COMPLEX)
486 {
487 int cp, trailing;
488 if (visual_order && run->script_analysis.fRTL) cx = run->nWidth - cx - 1;
489
490 ScriptXtoCP( cx, run->len, run->num_glyphs, run->clusters, run->vis_attrs, run->advances, &run->script_analysis,
491 &cp, &trailing );
492 TRACE("x %d cp %d trailing %d (run width %d) rtl %d log order %d\n", cx, cp, trailing, run->nWidth,
494 return closest ? cp + trailing : cp;
495 }
496
497 if (c->editor->cPasswordMask)
498 {
499 mask_text = ME_MakeStringR( c->editor->cPasswordMask, run->len );
500 str = mask_text->szData;
501 }
502 else
503 str = get_text( run, 0 );
504
505 select_style(c, run->style);
506 GetTextExtentExPointW(c->hDC, str, run->len,
507 cx, &fit, NULL, &sz);
508 if (closest && fit != run->len)
509 {
510 GetTextExtentPoint32W(c->hDC, str, fit, &sz2);
511 GetTextExtentPoint32W(c->hDC, str, fit + 1, &sz3);
512 if (cx >= (sz2.cx+sz3.cx)/2)
513 fit = fit + 1;
514 }
515
516 ME_DestroyString( mask_text );
517
518 return fit;
519}
HRESULT WINAPI ScriptXtoCP(int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piCP, int *piTrailing)
Definition: usp10.c:2854
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN
Definition: richole.c:5727
void select_style(ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN
Definition: style.c:369
ME_String * ME_MakeStringR(WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN
Definition: string.c:85
#define MERF_TAB
Definition: editstr.h:107
#define MERF_ENDCELL
Definition: editstr.h:109
#define MERF_GRAPHICS
Definition: editstr.h:105
#define MEPF_COMPLEX
Definition: editstr.h:146
POINT cp
Definition: magnifier.c:59
LONG cx
Definition: kdterminal.h:27
int num_glyphs
Definition: editstr.h:171
SCRIPT_VISATTR * vis_attrs
Definition: editstr.h:173
int * advances
Definition: editstr.h:174
SCRIPT_ANALYSIS script_analysis
Definition: editstr.h:170
int nWidth
Definition: editstr.h:164
WORD * clusters
Definition: editstr.h:177
WCHAR * szData
Definition: editstr.h:56
WORD fLogicalOrder
Definition: usp10.h:144
BOOL WINAPI GetTextExtentExPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ int cchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

Referenced by find_split_point(), and ME_CharFromPoint().

◆ ME_CharFromPos()

BOOL ME_CharFromPos ( ME_TextEditor editor,
int  x,
int  y,
ME_Cursor cursor,
BOOL isExact 
)

Definition at line 1122 of file caret.c.

1124{
1125 RECT rc;
1126 BOOL bResult;
1127
1128 ITextHost_TxGetClientRect(editor->texthost, &rc);
1129 if (x < 0 || y < 0 || x >= rc.right || y >= rc.bottom) {
1130 if (isExact) *isExact = FALSE;
1131 return FALSE;
1132 }
1133 x += editor->horz_si.nPos;
1134 y += editor->vert_si.nPos;
1135 bResult = ME_FindPixelPos(editor, x, y, cursor, NULL, FALSE);
1136 if (isExact) *isExact = bResult;
1137 return TRUE;
1138}
static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL *is_eol, BOOL final_eop)
Definition: caret.c:1055
#define ITextHost_TxGetClientRect(This, a)
Definition: editor.h:308
const char cursor[]
Definition: icontest.c:13
SCROLLINFO vert_si
Definition: editstr.h:441
SCROLLINFO horz_si
Definition: editstr.h:441
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309

Referenced by ME_HandleMessage(), ME_LinkNotify(), and ME_SetCursor().

◆ ME_CharOfsFromRunOfs()

int ME_CharOfsFromRunOfs ( ME_TextEditor editor,
const ME_DisplayItem pPara,
const ME_DisplayItem pRun,
int  nOfs 
)

Definition at line 156 of file run.c.

158{
159 assert(pRun && pRun->type == diRun);
160 assert(pPara && pPara->type == diParagraph);
161 return pPara->member.para.nCharOfs + pRun->member.run.nCharOfs + nOfs;
162}

Referenced by ME_HandleMessage().

◆ ME_CheckCharOffsets()

void ME_CheckCharOffsets ( ME_TextEditor editor)

Definition at line 101 of file run.c.

102{
103 ME_DisplayItem *p = editor->pBuffer->pFirst;
104 int ofs = 0, ofsp = 0;
105
106 if (!TRACE_ON(richedit_check))
107 return;
108
109 TRACE_(richedit_check)("Checking begin\n");
110 if(TRACE_ON(richedit_lists))
111 {
112 TRACE_(richedit_lists)("---\n");
113 ME_DumpDocument(editor->pBuffer);
114 }
115 do {
117 switch(p->type) {
118 case diTextEnd:
119 TRACE_(richedit_check)("tend, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
120 assert(ofsp+ofs == p->member.para.nCharOfs);
121 TRACE_(richedit_check)("Checking finished\n");
122 return;
123 case diParagraph:
124 TRACE_(richedit_check)("para, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
125 assert(ofsp+ofs == p->member.para.nCharOfs);
126 ofsp = p->member.para.nCharOfs;
127 ofs = 0;
128 break;
129 case diRun:
130 TRACE_(richedit_check)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08x\n",
131 p->member.run.nCharOfs, p->member.run.nCharOfs+ofsp, ofsp+ofs,
132 p->member.run.len, debugstr_run( &p->member.run ),
133 p->member.run.nFlags,
134 p->member.run.style->fmt.dwMask & p->member.run.style->fmt.dwEffects);
135 assert(ofs == p->member.run.nCharOfs);
136 assert(p->member.run.len);
137 ofs += p->member.run.len;
138 break;
139 case diCell:
140 TRACE_(richedit_check)("cell\n");
141 break;
142 default:
143 assert(0);
144 }
145 } while(1);
146 TRACE_(richedit_check)("Checking finished\n");
147}
#define TRACE_ON(x)
Definition: compat.h:75
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN
Definition: list.c:187
static const char * debugstr_run(const ME_Run *run)
Definition: editor.h:46
@ diTextEnd
Definition: editstr.h:89
@ diRunOrParagraphOrEnd
Definition: editstr.h:97

Referenced by ME_ArrowKey(), ME_InternalDeleteText(), ME_JoinParagraphs(), ME_JoinRuns(), ME_KeyDown(), ME_MakeEditor(), and split_run_extents().

◆ ME_CheckTablesForCorruption()

void ME_CheckTablesForCorruption ( ME_TextEditor editor)

Definition at line 192 of file table.c.

193{
194 if(TRACE_ON(richedit_lists))
195 {
196 TRACE("---\n");
197 ME_DumpDocument(editor->pBuffer);
198 }
199#ifndef NDEBUG
200 {
201 ME_DisplayItem *p, *pPrev;
202 pPrev = editor->pBuffer->pFirst;
203 p = pPrev->next;
204 if (!editor->bEmulateVersion10) /* v4.1 */
205 {
206 while (p->type == diParagraph)
207 {
208 assert(p->member.para.fmt.dwMask & PFM_TABLE);
209 assert(p->member.para.fmt.dwMask & PFM_TABLEROWDELIMITER);
210 if (p->member.para.pCell)
211 {
212 assert(p->member.para.nFlags & MEPF_CELL);
213 assert(p->member.para.fmt.wEffects & PFE_TABLE);
214 }
215 if (p->member.para.pCell != pPrev->member.para.pCell)
216 {
217 /* There must be a diCell in between the paragraphs if pCell changes. */
219 assert(pCell);
221 }
222 if (p->member.para.nFlags & MEPF_ROWEND)
223 {
224 /* ROWEND must come after a cell. */
225 assert(pPrev->member.para.pCell);
226 assert(p->member.para.pCell
227 == pPrev->member.para.pCell->member.cell.parent_cell);
228 assert(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER);
229 }
230 else if (p->member.para.pCell)
231 {
232 assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
233 assert(pPrev->member.para.pCell ||
235 if (pPrev->member.para.pCell &&
236 !(pPrev->member.para.nFlags & MEPF_ROWSTART))
237 {
238 assert(p->member.para.pCell->member.cell.parent_cell
239 == pPrev->member.para.pCell->member.cell.parent_cell);
240 if (pPrev->member.para.pCell != p->member.para.pCell)
241 assert(pPrev->member.para.pCell
242 == p->member.para.pCell->member.cell.prev_cell);
243 }
244 }
245 else if (!(p->member.para.nFlags & MEPF_ROWSTART))
246 {
247 assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
248 /* ROWSTART must be followed by a cell. */
249 assert(!(p->member.para.nFlags & MEPF_CELL));
250 /* ROWSTART must be followed by a cell. */
252 }
253 pPrev = p;
254 p = p->member.para.next_para;
255 }
256 } else { /* v1.0 - 3.0 */
257 while (p->type == diParagraph)
258 {
259 assert(!(p->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)));
260 assert(p->member.para.fmt.dwMask & PFM_TABLE);
261 assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
262 assert(!p->member.para.pCell);
263 p = p->member.para.next_para;
264 }
265 return;
266 }
267 assert(p->type == diTextEnd);
268 assert(!pPrev->member.para.pCell);
269 }
270#endif
271}
#define MEPF_CELL
Definition: editstr.h:143
#define MEPF_ROWSTART
Definition: editstr.h:144
#define MEPF_ROWEND
Definition: editstr.h:145
#define PFM_TABLEROWDELIMITER
Definition: richedit.h:868
#define PFE_TABLEROWDELIMITER
Definition: richedit.h:942
struct tagME_DisplayItem * pCell
Definition: editstr.h:207

Referenced by handle_enter(), ME_Redo(), ME_StreamIn(), and ME_Undo().

◆ ME_ClearTempStyle()

void ME_ClearTempStyle ( ME_TextEditor editor)

Definition at line 523 of file style.c.

524{
525 if (!editor->pBuffer->pCharStyle) return;
527 editor->pBuffer->pCharStyle = NULL;
528}
void ME_ReleaseStyle(ME_Style *s)
Definition: style.c:462
ME_Style * pCharStyle
Definition: editstr.h:269

Referenced by ME_DestroyEditor(), ME_HandleMessage(), ME_ReplaceSel(), ME_SendSelChange(), and ME_StreamIn().

◆ ME_CommitCoalescingUndo()

void ME_CommitCoalescingUndo ( ME_TextEditor editor)

Commits preceding changes into a undo transaction that can be expanded.

This function allows the transaction to be reopened with ME_ContinueCoalescingTransaction in order to continue the transaction. If an undo item is added to the undo stack as a result of a change without the transaction being reopened, then the transaction will be ended, and the changes will become a part of the next transaction.

This is used to allow typed characters to be grouped together since each typed character results in a single event, and each event adding undo items must be committed. Using this function as opposed to ME_CommitUndo allows multiple events to be grouped, and undone together.

Definition at line 301 of file undo.c.

302{
303 struct undo_item *item;
304 struct list *head;
305
306 if (editor->nUndoMode == umIgnore)
307 return;
308
309 assert(editor->nUndoMode == umAddToUndo);
310
311 head = list_head( &editor->undo_stack );
312 if (!head) return;
313
314 /* no need to commit empty transactions */
315 item = LIST_ENTRY( head, struct undo_item, entry );
316 if (item->type == undo_end_transaction ||
318 return;
319
321}
struct outqueuenode * head
Definition: adnsresfilter.c:66
Definition: list.h:37
@ umAddToUndo
Definition: editstr.h:281
@ umIgnore
Definition: editstr.h:283
@ undo_end_transaction
Definition: editstr.h:295
@ undo_potential_end_transaction
Definition: editstr.h:296
Definition: list.h:15
ME_UndoMode nUndoMode
Definition: editstr.h:406
struct list undo_stack
Definition: editstr.h:402
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by handle_enter(), ME_Char(), and ME_KeyDown().

◆ ME_CommitUndo()

void ME_CommitUndo ( ME_TextEditor editor)

Commits preceding changes into a transaction that can be undone together.

This should be called after all the changes occur associated with an event so that the group of changes can be undone atomically as a transaction.

This will have no effect the undo mode is set to ignore changes, or if no changes preceded calling this function before the last time it was called.

This can also be used to conclude a coalescing transaction (used for grouping typed characters).

Definition at line 227 of file undo.c.

228{
229 struct undo_item *item;
230 struct list *head;
231
232 if (editor->nUndoMode == umIgnore)
233 return;
234
235 assert(editor->nUndoMode == umAddToUndo);
236
237 /* no transactions, no need to commit */
238 head = list_head( &editor->undo_stack );
239 if (!head) return;
240
241 /* no need to commit empty transactions */
242 item = LIST_ENTRY( head, struct undo_item, entry );
243 if (item->type == undo_end_transaction) return;
244
246 {
248 return;
249 }
250
252}

Referenced by copy_or_cut(), handle_EM_SETCHARFORMAT(), handle_enter(), IRichEditOle_fnInsertObject(), ME_Char(), ME_HandleMessage(), ME_KeyDown(), ME_ReplaceSel(), ME_StreamIn(), ME_WmCreate(), and paste_emf().

◆ ME_ContinueCoalescingTransaction()

void ME_ContinueCoalescingTransaction ( ME_TextEditor editor)

Groups subsequent changes with previous ones for an undo if coalescing.

Has no effect if the previous changes were followed by a ME_CommitUndo. This function will only have an affect if the previous changes were followed by a call to ME_CommitCoalescingUndo, which allows the transaction to be continued.

This allows multiple consecutively typed characters to be grouped together to be undone by a single undo operation.

Definition at line 265 of file undo.c.

266{
267 struct undo_item *item;
268 struct list *head;
269
270 if (editor->nUndoMode == umIgnore)
271 return;
272
273 assert(editor->nUndoMode == umAddToUndo);
274
275 head = list_head( &editor->undo_stack );
276 if (!head) return;
277
278 item = LIST_ENTRY( head, struct undo_item, entry );
280 {
281 list_remove( &item->entry );
282 editor->nUndoStackSize--;
284 }
285}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
int nUndoStackSize
Definition: editstr.h:404
static void destroy_undo_item(struct undo_item *undo)
Definition: undo.c:25

Referenced by handle_enter(), ME_Char(), and ME_KeyDown().

◆ ME_CopyCharFormat()

void ME_CopyCharFormat ( CHARFORMAT2W pDest,
const CHARFORMAT2W pSrc 
)

Definition at line 230 of file style.c.

231{
232 /* using this with non-2W structs is forbidden */
233 assert(pSrc->cbSize == sizeof(CHARFORMAT2W));
234 assert(pDest->cbSize == sizeof(CHARFORMAT2W));
235 *pDest = *pSrc;
236}

Referenced by ME_GetDefaultCharFormat(), ME_GetRunCharFormat(), and ME_GetSelectionCharFormat().

◆ ME_CopyReObject()

void ME_CopyReObject ( REOBJECT dst,
const REOBJECT src,
DWORD  flags 
)

Definition at line 5907 of file richole.c.

5908{
5909 *dst = *src;
5910 dst->poleobj = NULL;
5911 dst->pstg = NULL;
5912 dst->polesite = NULL;
5913
5914 if ((flags & REO_GETOBJ_POLEOBJ) && src->poleobj)
5915 {
5916 dst->poleobj = src->poleobj;
5917 IOleObject_AddRef(dst->poleobj);
5918 }
5919 if ((flags & REO_GETOBJ_PSTG) && src->pstg)
5920 {
5921 dst->pstg = src->pstg;
5922 IStorage_AddRef(dst->pstg);
5923 }
5924 if ((flags & REO_GETOBJ_POLESITE) && src->polesite)
5925 {
5926 dst->polesite = src->polesite;
5927 IOleClientSite_AddRef(dst->polesite);
5928 }
5929}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by create_re_object(), and IRichEditOle_fnGetObject().

◆ ME_CreateTextHost()

ITextHost * ME_CreateTextHost ( HWND  hwnd,
CREATESTRUCTW cs,
BOOL  bEmulateVersion10 
)

Definition at line 44 of file txthost.c.

45{
46 ITextHostImpl *texthost;
47
48 texthost = CoTaskMemAlloc(sizeof(*texthost));
49 if (!texthost) return NULL;
50
51 texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
52 texthost->ref = 1;
53 texthost->hWnd = hwnd;
54 texthost->bEmulateVersion10 = bEmulateVersion10;
55 memset( &texthost->para_fmt, 0, sizeof(texthost->para_fmt) );
56 texthost->para_fmt.cbSize = sizeof(texthost->para_fmt);
57 texthost->para_fmt.dwMask = PFM_ALIGNMENT;
58 texthost->para_fmt.wAlignment = PFA_LEFT;
59 if (cs->style & ES_RIGHT)
60 texthost->para_fmt.wAlignment = PFA_RIGHT;
61 if (cs->style & ES_CENTER)
62 texthost->para_fmt.wAlignment = PFA_CENTER;
63
64 return &texthost->ITextHost_iface;
65}
#define cs
Definition: i386-dis.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define ES_CENTER
Definition: pedump.c:665
#define ES_RIGHT
Definition: pedump.c:666
#define PFA_RIGHT
Definition: richedit.h:922
#define PFA_CENTER
Definition: richedit.h:923
#define PFA_LEFT
Definition: richedit.h:921
#define PFM_ALIGNMENT
Definition: richedit.h:841
#define memset(x, y, z)
Definition: compat.h:39
BOOL bEmulateVersion10
Definition: txthost.c:38
LONG ref
Definition: txthost.c:36
ITextHost ITextHost_iface
Definition: txthost.c:35
PARAFORMAT2 para_fmt
Definition: txthost.c:39
HWND hWnd
Definition: txthost.c:37
WORD wAlignment
Definition: richedit.h:673
UINT cbSize
Definition: richedit.h:666
static const ITextHostVtbl textHostVtbl
Definition: txthost.c:42
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by create_windowed_editor().

◆ ME_CursorFromCharOfs()

void ME_CursorFromCharOfs ( ME_TextEditor editor,
int  nCharOfs,
ME_Cursor pCursor 
)

◆ ME_DeleteReObject()

void ME_DeleteReObject ( struct re_object re_object)

Definition at line 5899 of file richole.c.

5900{
5901 if (reobj->obj.poleobj) IOleObject_Release(reobj->obj.poleobj);
5902 if (reobj->obj.pstg) IStorage_Release(reobj->obj.pstg);
5903 if (reobj->obj.polesite) IOleClientSite_Release(reobj->obj.polesite);
5904 heap_free(reobj);
5905}

Referenced by ME_DestroyDisplayItem().

◆ ME_DeleteSelection()

void ME_DeleteSelection ( ME_TextEditor editor)

Definition at line 1584 of file caret.c.

1585{
1586 int from, to;
1587 int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
1588 int nEndCursor = nStartCursor ^ 1;
1589 ME_DeleteTextAtCursor(editor, nStartCursor, to - from);
1590 editor->pCursors[nEndCursor] = editor->pCursors[nStartCursor];
1591}
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars)
Definition: caret.c:510
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to)
Definition: caret.c:42

Referenced by ME_HandleMessage(), ME_InsertEndRowFromCursor(), ME_InsertOLEFromCursor(), ME_InsertTextFromCursor(), and ME_KeyDown().

◆ ME_DeleteTextAtCursor()

BOOL ME_DeleteTextAtCursor ( ME_TextEditor editor,
int  nCursor,
int  nChars 
)

Definition at line 510 of file caret.c.

511{
512 assert(nCursor>=0 && nCursor<editor->nCursors);
513 /* text operations set modified state */
514 editor->nModifyStep = 1;
515 return ME_InternalDeleteText(editor, &editor->pCursors[nCursor],
516 nChars, FALSE);
517}
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce)
Definition: caret.c:360

Referenced by ME_DeleteSelection(), and ME_KeyDown().

◆ ME_DestroyContext()

void ME_DestroyContext ( ME_Context c)

Definition at line 44 of file context.c.

45{
47 if (c->hDC) ITextHost_TxReleaseDC( c->editor->texthost, c->hDC );
48}
#define ITextHost_TxReleaseDC(This, a)
Definition: editor.h:288

Referenced by ME_CharFromPoint(), ME_GetCursorCoordinates(), ME_InvalidateParagraphRange(), ME_MakeFirstParagraph(), ME_PaintContent(), ME_PointFromChar(), ME_WrapMarkedParagraphs(), and stream_out_graphics().

◆ ME_DestroyDisplayItem()

void ME_DestroyDisplayItem ( ME_DisplayItem item)

Definition at line 160 of file list.c.

161{
162 if (0)
163 TRACE("type=%s\n", ME_GetDITypeName(item->type));
164 if (item->type==diRun)
165 {
166 if (item->member.run.reobj)
167 {
168 list_remove(&item->member.run.reobj->entry);
169 ME_DeleteReObject(item->member.run.reobj);
170 }
171 heap_free( item->member.run.glyphs );
172 heap_free( item->member.run.clusters );
173 ME_ReleaseStyle(item->member.run.style);
174 }
176}
static const char * ME_GetDITypeName(ME_DIType type)
Definition: list.c:146
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:462
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN
Definition: richole.c:5899

Referenced by destroy_para(), ME_DestroyEditor(), ME_InternalDeleteText(), ME_JoinParagraphs(), ME_JoinRuns(), and ME_PrepareParagraphForWrapping().

◆ ME_DestroyEditor()

void ME_DestroyEditor ( ME_TextEditor editor)

Definition at line 3194 of file editor.c.

3195{
3196 ME_DisplayItem *p = editor->pBuffer->pFirst, *pNext = NULL;
3197 ME_Style *s, *cursor2;
3198 int i;
3199
3200 ME_ClearTempStyle(editor);
3201 ME_EmptyUndoStack(editor);
3202 editor->pBuffer->pFirst = NULL;
3203 while(p) {
3204 pNext = p->next;
3205 if (p->type == diParagraph)
3206 destroy_para(editor, p);
3207 else
3209 p = pNext;
3210 }
3211
3212 LIST_FOR_EACH_ENTRY_SAFE( s, cursor2, &editor->style_list, ME_Style, entry )
3213 ME_DestroyStyle( s );
3214
3216 for (i=0; i<HFONT_CACHE_SIZE; i++)
3217 {
3218 if (editor->pFontCache[i].hFont)
3219 DeleteObject(editor->pFontCache[i].hFont);
3220 }
3221 if (editor->rgbBackColor != -1)
3222 DeleteObject(editor->hbrBackground);
3223 if(editor->lpOleCallback)
3224 IRichEditOleCallback_Release(editor->lpOleCallback);
3225 ITextHost_Release(editor->texthost);
3226 if (editor->reOle)
3227 {
3228 IUnknown_Release(editor->reOle);
3229 editor->reOle = NULL;
3230 }
3232
3233 heap_free(editor->pBuffer);
3234 heap_free(editor->pCursors);
3235 heap_free(editor);
3236}
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN
Definition: para.c:48
void ME_DestroyStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:442
void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: undo.c:53
void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: style.c:523
#define HFONT_CACHE_SIZE
Definition: editstr.h:69
pKey DeleteObject()
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct define * next
Definition: compiler.c:65
ME_Style * pDefaultStyle
Definition: editstr.h:270
ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]
Definition: editstr.h:410
COLORREF rgbBackColor
Definition: editstr.h:397
IUnknown * reOle
Definition: editstr.h:384
LPRICHEDITOLECALLBACK lpOleCallback
Definition: editstr.h:418
HBRUSH hbrBackground
Definition: editstr.h:398
struct list style_list
Definition: editstr.h:447

Referenced by ITextServicesImpl_Release(), and ME_HandleMessage().

◆ ME_DestroyString()

void ME_DestroyString ( ME_String s)

Definition at line 96 of file string.c.

97{
98 if (!s) return;
99 if (s->free) s->free( s );
100 heap_free( s );
101}

Referenced by destroy_para(), destroy_undo_item(), draw_text(), ME_CharFromPointContext(), ME_GetRunSizeCommon(), ME_PointFromCharContext(), and para_num_clear().

◆ ME_DestroyStyle()

void ME_DestroyStyle ( ME_Style item)

Definition at line 442 of file style.c.

443{
444 list_remove( &s->entry );
445 if (s->font_cache)
446 {
447 release_font_cache( s->font_cache );
448 s->font_cache = NULL;
449 }
450 ScriptFreeCache( &s->script_cache );
451 heap_free(s);
452}
static void release_font_cache(ME_FontCacheItem *item)
Definition: style.c:360
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080

Referenced by ME_DestroyEditor(), and ME_ReleaseStyle().

◆ ME_DrawOLE()

void ME_DrawOLE ( ME_Context c,
int  x,
int  y,
ME_Run run,
BOOL  selected 
)

Definition at line 5804 of file richole.c.

5805{
5806 IDataObject* ido;
5807 FORMATETC fmt;
5808 STGMEDIUM stgm;
5809 DIBSECTION dibsect;
5810 ENHMETAHEADER emh;
5811 HDC hMemDC;
5812 SIZE sz;
5813 BOOL has_size;
5814 HBITMAP old_bm;
5815 RECT rc;
5816
5817 assert(run->nFlags & MERF_GRAPHICS);
5818 assert(run->reobj);
5819 if (IOleObject_QueryInterface(run->reobj->obj.poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
5820 {
5821 FIXME("Couldn't get interface\n");
5822 return;
5823 }
5824 has_size = run->reobj->obj.sizel.cx != 0 || run->reobj->obj.sizel.cy != 0;
5825 fmt.cfFormat = CF_BITMAP;
5826 fmt.ptd = NULL;
5827 fmt.dwAspect = DVASPECT_CONTENT;
5828 fmt.lindex = -1;
5829 fmt.tymed = TYMED_GDI;
5830 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5831 {
5832 fmt.cfFormat = CF_ENHMETAFILE;
5833 fmt.tymed = TYMED_ENHMF;
5834 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5835 {
5836 FIXME("Couldn't get storage medium\n");
5837 IDataObject_Release(ido);
5838 return;
5839 }
5840 }
5841 IDataObject_Release(ido);
5842
5843 switch (stgm.tymed)
5844 {
5845 case TYMED_GDI:
5846 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
5847 hMemDC = CreateCompatibleDC(c->hDC);
5848 old_bm = SelectObject(hMemDC, stgm.u.hBitmap);
5849 if (has_size)
5850 {
5851 convert_sizel(c, &run->reobj->obj.sizel, &sz);
5852 } else {
5853 sz.cx = dibsect.dsBm.bmWidth;
5854 sz.cy = dibsect.dsBm.bmHeight;
5855 }
5856 if (c->editor->nZoomNumerator != 0)
5857 {
5858 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5859 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5860 }
5861 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
5862 hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
5863
5864 SelectObject(hMemDC, old_bm);
5865 DeleteDC(hMemDC);
5866 break;
5867 case TYMED_ENHMF:
5868 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
5869 if (has_size)
5870 {
5871 convert_sizel(c, &run->reobj->obj.sizel, &sz);
5872 } else {
5873 sz.cx = emh.rclBounds.right - emh.rclBounds.left;
5874 sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
5875 }
5876 if (c->editor->nZoomNumerator != 0)
5877 {
5878 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5879 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5880 }
5881
5882 rc.left = x;
5883 rc.top = y - sz.cy;
5884 rc.right = x + sz.cx;
5885 rc.bottom = y;
5886 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
5887 break;
5888 default:
5889 FIXME("Unsupported tymed %d\n", stgm.tymed);
5890 selected = FALSE;
5891 break;
5892 }
5893 ReleaseStgMedium(&stgm);
5894
5895 if (selected && !c->editor->bHideSelection)
5896 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
5897}
#define CF_BITMAP
Definition: constants.h:397
#define CF_ENHMETAFILE
Definition: constants.h:409
#define FIXME(fmt,...)
Definition: debug.h:114
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
static void convert_sizel(const ME_Context *c, const SIZEL *szl, SIZE *sz)
Definition: richole.c:5715
#define S_OK
Definition: intsafe.h:52
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
const GUID IID_IDataObject
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
LONG cy
Definition: kdterminal.h:28
LONG bmHeight
Definition: wingdi.h:1423
LONG bmWidth
Definition: wingdi.h:1422
BITMAP dsBm
Definition: wingdi.h:1669
RECTL rclBounds
Definition: wingdi.h:2322
struct re_object * reobj
Definition: editstr.h:168
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333
#define DSTINVERT
Definition: wingdi.h:327
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)

Referenced by ME_DrawRun().

◆ ME_DumpDocument()

void ME_DumpDocument ( ME_TextBuffer buffer)

Definition at line 187 of file list.c.

188{
189 /* FIXME this is useless, */
190 ME_DisplayItem *pItem = buffer->pFirst;
191 TRACE("DOCUMENT DUMP START\n");
192 while(pItem) {
193 switch(pItem->type)
194 {
195 case diTextStart:
196 TRACE("Start\n");
197 break;
198 case diCell:
199 TRACE("Cell(level=%d%s)\n", pItem->member.cell.nNestingLevel,
200 !pItem->member.cell.next_cell ? ", END" :
201 (!pItem->member.cell.prev_cell ? ", START" :""));
202 break;
203 case diParagraph:
204 TRACE("Paragraph(ofs=%d)\n", pItem->member.para.nCharOfs);
205 if (pItem->member.para.nFlags & MEPF_ROWSTART)
206 TRACE(" - (Table Row Start)\n");
207 if (pItem->member.para.nFlags & MEPF_ROWEND)
208 TRACE(" - (Table Row End)\n");
209 break;
210 case diStartRow:
211 TRACE(" - StartRow\n");
212 break;
213 case diRun:
214 TRACE(" - Run(%s, %d, flags=%x)\n", debugstr_run( &pItem->member.run ),
215 pItem->member.run.nCharOfs, pItem->member.run.nFlags);
216 break;
217 case diTextEnd:
218 TRACE("End(ofs=%d)\n", pItem->member.para.nCharOfs);
219 break;
220 default:
221 break;
222 }
223 pItem = pItem->next;
224 }
225 TRACE("DOCUMENT DUMP END\n");
226}
@ diStartRow
Definition: editstr.h:88
@ diTextStart
Definition: editstr.h:84
struct tagME_DisplayItem * prev_cell
Definition: editstr.h:229
int nNestingLevel
Definition: editstr.h:223

Referenced by ME_CheckCharOffsets(), and ME_CheckTablesForCorruption().

◆ ME_DumpParaStyle()

void ME_DumpParaStyle ( ME_Paragraph s)

◆ ME_DumpParaStyleToBuf()

void ME_DumpParaStyleToBuf ( const PARAFORMAT2 pFmt,
char  buf[2048] 
)

Definition at line 819 of file para.c.

820{
821 char *p;
822 p = buf;
823
824#define DUMP(mask, name, fmt, field) \
825 if (pFmt->dwMask & (mask)) p += sprintf(p, "%-22s" fmt "\n", name, pFmt->field); \
826 else p += sprintf(p, "%-22sN/A\n", name);
827
828/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
829#define DUMP_EFFECT(mask, name) \
830 p += sprintf(p, "%-22s%s\n", name, (pFmt->dwMask & (mask)) ? ((pFmt->wEffects & ((mask) >> 16)) ? "yes" : "no") : "N/A");
831
832 DUMP(PFM_NUMBERING, "Numbering:", "%u", wNumbering);
833 DUMP_EFFECT(PFM_DONOTHYPHEN, "Disable auto-hyphen:");
834 DUMP_EFFECT(PFM_KEEP, "No page break in para:");
835 DUMP_EFFECT(PFM_KEEPNEXT, "No page break in para & next:");
836 DUMP_EFFECT(PFM_NOLINENUMBER, "No line number:");
837 DUMP_EFFECT(PFM_NOWIDOWCONTROL, "No widow & orphan:");
838 DUMP_EFFECT(PFM_PAGEBREAKBEFORE, "Page break before:");
839 DUMP_EFFECT(PFM_RTLPARA, "RTL para:");
840 DUMP_EFFECT(PFM_SIDEBYSIDE, "Side by side:");
841 DUMP_EFFECT(PFM_TABLE, "Table:");
842 DUMP(PFM_OFFSETINDENT, "Offset indent:", "%d", dxStartIndent);
843 DUMP(PFM_STARTINDENT, "Start indent:", "%d", dxStartIndent);
844 DUMP(PFM_RIGHTINDENT, "Right indent:", "%d", dxRightIndent);
845 DUMP(PFM_OFFSET, "Offset:", "%d", dxOffset);
846 if (pFmt->dwMask & PFM_ALIGNMENT) {
847 switch (pFmt->wAlignment) {
848 case PFA_LEFT : p += sprintf(p, "Alignment: left\n"); break;
849 case PFA_RIGHT : p += sprintf(p, "Alignment: right\n"); break;
850 case PFA_CENTER : p += sprintf(p, "Alignment: center\n"); break;
851 case PFA_JUSTIFY: p += sprintf(p, "Alignment: justify\n"); break;
852 default : p += sprintf(p, "Alignment: incorrect %d\n", pFmt->wAlignment); break;
853 }
854 }
855 else p += sprintf(p, "Alignment: N/A\n");
856 DUMP(PFM_TABSTOPS, "Tab Stops:", "%d", cTabCount);
857 if (pFmt->dwMask & PFM_TABSTOPS) {
858 int i;
859 p += sprintf(p, "\t");
860 for (i = 0; i < pFmt->cTabCount; i++) p += sprintf(p, "%x ", pFmt->rgxTabs[i]);
861 p += sprintf(p, "\n");
862 }
863 DUMP(PFM_SPACEBEFORE, "Space Before:", "%d", dySpaceBefore);
864 DUMP(PFM_SPACEAFTER, "Space After:", "%d", dySpaceAfter);
865 DUMP(PFM_LINESPACING, "Line spacing:", "%d", dyLineSpacing);
866 DUMP(PFM_STYLE, "Text style:", "%d", sStyle);
867 DUMP(PFM_LINESPACING, "Line spacing rule:", "%u", bLineSpacingRule);
868 /* bOutlineLevel should be 0 */
869 DUMP(PFM_SHADING, "Shading Weight:", "%u", wShadingWeight);
870 DUMP(PFM_SHADING, "Shading Style:", "%u", wShadingStyle);
871 DUMP(PFM_NUMBERINGSTART, "Numbering Start:", "%u", wNumberingStart);
872 DUMP(PFM_NUMBERINGSTYLE, "Numbering Style:", "0x%x", wNumberingStyle);
873 DUMP(PFM_NUMBERINGTAB, "Numbering Tab:", "%u", wNumberingStyle);
874 DUMP(PFM_BORDER, "Border Space:", "%u", wBorderSpace);
875 DUMP(PFM_BORDER, "Border Width:", "%u", wBorderWidth);
876 DUMP(PFM_BORDER, "Borders:", "%u", wBorders);
877
878#undef DUMP
879#undef DUMP_EFFECT
880}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define DUMP(mask, name, fmt, field)
#define DUMP_EFFECT(mask, name)
#define PFM_SPACEBEFORE
Definition: richedit.h:847
#define PFM_OFFSETINDENT
Definition: richedit.h:844
#define PFM_NUMBERING
Definition: richedit.h:843
#define PFM_NOLINENUMBER
Definition: richedit.h:860
#define PFM_KEEPNEXT
Definition: richedit.h:858
#define PFM_NUMBERINGSTYLE
Definition: richedit.h:853
#define PFM_DONOTHYPHEN
Definition: richedit.h:862
#define PFM_LINESPACING
Definition: richedit.h:849
#define PFM_OFFSET
Definition: richedit.h:840
#define PFM_SHADING
Definition: richedit.h:852
#define PFM_RIGHTINDENT
Definition: richedit.h:839
#define PFM_NOWIDOWCONTROL
Definition: richedit.h:861
#define PFM_PAGEBREAKBEFORE
Definition: richedit.h:859
#define PFM_BORDER
Definition: richedit.h:851
#define PFM_SIDEBYSIDE
Definition: richedit.h:863
#define PFA_JUSTIFY
Definition: richedit.h:924
#define PFM_TABSTOPS
Definition: richedit.h:842
#define PFM_STYLE
Definition: richedit.h:850
#define PFM_KEEP
Definition: richedit.h:857
#define PFM_RTLPARA
Definition: richedit.h:856
#define PFM_SPACEAFTER
Definition: richedit.h:848
#define PFM_STARTINDENT
Definition: richedit.h:838
#define PFM_NUMBERINGSTART
Definition: richedit.h:855
#define PFM_NUMBERINGTAB
Definition: richedit.h:854
LONG rgxTabs[MAX_TAB_STOPS]
Definition: richedit.h:675

◆ ME_DumpStyle()

void ME_DumpStyle ( ME_Style s)

Definition at line 243 of file style.c.

244{
245 char buf[2048];
246 ME_DumpStyleToBuf(&s->fmt, buf);
247 TRACE_(richedit_style)("%s\n", buf);
248}
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048])
Definition: style.c:250

◆ ME_DumpStyleToBuf()

void ME_DumpStyleToBuf ( CHARFORMAT2W pFmt,
char  buf[2048] 
)

Definition at line 250 of file style.c.

251{
252 /* FIXME only CHARFORMAT styles implemented */
253 /* this function sucks, doesn't check for buffer overruns but it's "good enough" as for debug code */
254 char *p;
255 p = buf;
256 p += sprintf(p, "Font face: ");
257 if (pFmt->dwMask & CFM_FACE) {
258 WCHAR *q = pFmt->szFaceName;
259 while(*q) {
260 *p++ = (*q > 255) ? '?' : *q;
261 q++;
262 }
263 } else
264 p += sprintf(p, "N/A");
265
266 if (pFmt->dwMask & CFM_SIZE)
267 p += sprintf(p, "\nFont size: %d\n", pFmt->yHeight);
268 else
269 p += sprintf(p, "\nFont size: N/A\n");
270
271 if (pFmt->dwMask & CFM_OFFSET)
272 p += sprintf(p, "Char offset: %d\n", pFmt->yOffset);
273 else
274 p += sprintf(p, "Char offset: N/A\n");
275
276 if (pFmt->dwMask & CFM_CHARSET)
277 p += sprintf(p, "Font charset: %d\n", (int)pFmt->bCharSet);
278 else
279 p += sprintf(p, "Font charset: N/A\n");
280
281 /* I'm assuming CFM_xxx and CFE_xxx are the same values, fortunately it IS true wrt used flags*/
282 ME_DumpStyleEffect(&p, "Font bold:", pFmt, CFM_BOLD);
283 ME_DumpStyleEffect(&p, "Font italic:", pFmt, CFM_ITALIC);
284 ME_DumpStyleEffect(&p, "Font underline:", pFmt, CFM_UNDERLINE);
285 ME_DumpStyleEffect(&p, "Font strikeout:", pFmt, CFM_STRIKEOUT);
286 ME_DumpStyleEffect(&p, "Hidden text:", pFmt, CFM_HIDDEN);
287 p += sprintf(p, "Text color: ");
288 if (pFmt->dwMask & CFM_COLOR)
289 {
290 if (pFmt->dwEffects & CFE_AUTOCOLOR)
291 p += sprintf(p, "auto\n");
292 else
293 p += sprintf(p, "%06x\n", (int)pFmt->crTextColor);
294 }
295 else
296 p += sprintf(p, "N/A\n");
297 ME_DumpStyleEffect(&p, "Text protected:", pFmt, CFM_PROTECTED);
298}
static void ME_DumpStyleEffect(char **p, const char *name, const CHARFORMAT2W *fmt, int mask)
Definition: style.c:238
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define CFM_PROTECTED
Definition: richedit.h:336
BYTE bCharSet
Definition: richedit.h:311
DWORD dwMask
Definition: richedit.h:306
LONG yOffset
Definition: richedit.h:309
DWORD dwEffects
Definition: richedit.h:307
LONG yHeight
Definition: richedit.h:308
COLORREF crTextColor
Definition: richedit.h:310

Referenced by ME_DumpStyle(), and ME_KeyDown().

◆ ME_EmptyUndoStack()

void ME_EmptyUndoStack ( ME_TextEditor editor)

Definition at line 53 of file undo.c.

54{
55 struct undo_item *cursor, *cursor2;
56 if (editor->nUndoMode == umIgnore)
57 return;
58
59 TRACE("Emptying undo stack\n");
60
61 editor->nUndoStackSize = 0;
62
63 LIST_FOR_EACH_ENTRY_SAFE( cursor, cursor2, &editor->undo_stack, struct undo_item, entry )
64 {
65 list_remove( &cursor->entry );
67 }
68
69 empty_redo_stack( editor );
70}
static void empty_redo_stack(ME_TextEditor *editor)
Definition: undo.c:43

Referenced by add_undo_insert_run(), fnTextSrv_TxSetText(), ME_DestroyEditor(), ME_HandleMessage(), ME_ReplaceSel(), and ME_StreamIn().

◆ ME_EndToUnicode()

void ME_EndToUnicode ( LONG  codepage,
LPVOID  psz 
)

Definition at line 248 of file string.c.

249{
250 if (codepage != CP_UNICODE)
251 heap_free( psz );
252}
#define CP_UNICODE
Definition: stg_prop.c:74
int codepage
Definition: win_iconv.c:156

Referenced by ME_HandleMessage(), and ME_SetText().

◆ ME_EnsureVisible()

void ME_EnsureVisible ( ME_TextEditor editor,
ME_Cursor pCursor 
)

Definition at line 1275 of file paint.c.

1276{
1277 ME_Run *pRun = &pCursor->pRun->member.run;
1278 ME_DisplayItem *pRow = ME_FindItemBack(pCursor->pRun, diStartRow);
1279 ME_DisplayItem *pPara = pCursor->pPara;
1280 int x, y, yheight;
1281
1282#ifdef __REACTOS__
1283 if (!pRow || !pPara)
1284 return;
1285#else
1286 assert(pRow);
1287 assert(pPara);
1288#endif
1289
1290 if (editor->styleFlags & ES_AUTOHSCROLL)
1291 {
1292 x = pRun->pt.x + ME_PointFromChar(editor, pRun, pCursor->nOffset, TRUE);
1293 if (x > editor->horz_si.nPos + editor->sizeWindow.cx)
1294 x = x + 1 - editor->sizeWindow.cx;
1295 else if (x > editor->horz_si.nPos)
1296 x = editor->horz_si.nPos;
1297
1298 if (~editor->styleFlags & ES_AUTOVSCROLL)
1299 {
1300 ME_HScrollAbs(editor, x);
1301 return;
1302 }
1303 } else {
1304 if (~editor->styleFlags & ES_AUTOVSCROLL)
1305 return;
1306 x = editor->horz_si.nPos;
1307 }
1308
1309 y = pPara->member.para.pt.y + pRow->member.row.pt.y;
1310 yheight = pRow->member.row.nHeight;
1311
1312 if (y < editor->vert_si.nPos)
1313 ME_ScrollAbs(editor, x, y);
1314 else if (y + yheight > editor->vert_si.nPos + editor->sizeWindow.cy)
1315 ME_ScrollAbs(editor, x, y + yheight - editor->sizeWindow.cy);
1316 else if (x != editor->horz_si.nPos)
1317 ME_ScrollAbs(editor, x, editor->vert_si.nPos);
1318}
void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
Definition: paint.c:1043
void ME_HScrollAbs(ME_TextEditor *editor, int x)
Definition: paint.c:1106
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
Definition: run.c:598
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_AUTOHSCROLL
Definition: pedump.c:672
POINT pt
Definition: editstr.h:239
int nHeight
Definition: editstr.h:234
POINT pt
Definition: editstr.h:167
DWORD styleFlags
Definition: editstr.h:388
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by ME_ArrowKey(), ME_HandleMessage(), ME_MouseMove(), and ME_UpdateRepaint().

◆ ME_FindItemBack()

◆ ME_FindItemBackOrHere()

ME_DisplayItem * ME_FindItemBackOrHere ( ME_DisplayItem di,
ME_DIType  nTypeOrClass 
)

Definition at line 124 of file list.c.

125{
126 while(di!=NULL) {
127 if (ME_DITypesEqual(di->type, nTypeOrClass))
128 return di;
129 di = di->prev;
130 }
131 return NULL;
132}

Referenced by ME_GetParagraph(), and ME_RowStart().

◆ ME_FindItemFwd()

◆ ME_FindNonWhitespaceV()

int ME_FindNonWhitespaceV ( const ME_String s,
int  nVChar 
)

◆ ME_FindRowWithNumber()

ME_DisplayItem * ME_FindRowWithNumber ( ME_TextEditor editor,
int  nRow 
)

Definition at line 44 of file row.c.

45{
47 int nCount = 0;
48
49 while (item->type == diParagraph &&
50 nCount + item->member.para.nRows <= nRow)
51 {
52 nCount += item->member.para.nRows;
53 item = item->member.para.next_para;
54 }
55 if (item->type != diParagraph)
56 return NULL;
57 for (item = ME_FindItemFwd(item, diStartRow); item && nCount < nRow; nCount++)
59 return item;
60}

Referenced by ME_HandleMessage().

◆ ME_GetCharFormat()

void ME_GetCharFormat ( ME_TextEditor editor,
const ME_Cursor from,
const ME_Cursor to,
CHARFORMAT2W pFmt 
)

Definition at line 819 of file run.c.

821{
822 ME_DisplayItem *run, *run_end;
823 CHARFORMAT2W tmp;
824
825 run = from->pRun;
826 /* special case - if selection is empty, take previous char's formatting */
827 if (from->pRun == to->pRun && from->nOffset == to->nOffset)
828 {
829 if (!from->nOffset)
830 {
832 if (tmp_run->type == diRun) {
833 ME_GetRunCharFormat(editor, tmp_run, pFmt);
834 return;
835 }
836 }
837 ME_GetRunCharFormat(editor, run, pFmt);
838 return;
839 }
840
841 run_end = to->pRun;
842 if (!to->nOffset)
843 run_end = ME_FindItemBack(run_end, diRun);
844
845 ME_GetRunCharFormat(editor, run, pFmt);
846
847 if (run == run_end) return;
848
849 do {
850 /* FIXME add more style feature comparisons */
853
854 run = ME_FindItemFwd(run, diRun);
855
856 ZeroMemory(&tmp, sizeof(tmp));
857 tmp.cbSize = sizeof(tmp);
858 ME_GetRunCharFormat(editor, run, &tmp);
859
860 assert((tmp.dwMask & dwAttribs) == dwAttribs);
861 /* reset flags that differ */
862
863 if (pFmt->yHeight != tmp.yHeight)
864 pFmt->dwMask &= ~CFM_SIZE;
865 if (pFmt->dwMask & CFM_FACE)
866 {
867 if (!(tmp.dwMask & CFM_FACE))
868 pFmt->dwMask &= ~CFM_FACE;
869 else if (wcscmp(pFmt->szFaceName, tmp.szFaceName) ||
870 pFmt->bPitchAndFamily != tmp.bPitchAndFamily)
871 pFmt->dwMask &= ~CFM_FACE;
872 }
873 if (pFmt->yHeight != tmp.yHeight)
874 pFmt->dwMask &= ~CFM_SIZE;
875 if (pFmt->bUnderlineType != tmp.bUnderlineType)
876 pFmt->dwMask &= ~CFM_UNDERLINETYPE;
877 if (pFmt->dwMask & CFM_COLOR)
878 {
879 if (!((pFmt->dwEffects&CFE_AUTOCOLOR) & (tmp.dwEffects&CFE_AUTOCOLOR)))
880 {
881 if (pFmt->crTextColor != tmp.crTextColor)
882 pFmt->dwMask &= ~CFM_COLOR;
883 }
884 }
885
886 pFmt->dwMask &= ~((pFmt->dwEffects ^ tmp.dwEffects) & dwEffects);
887 pFmt->dwEffects = tmp.dwEffects;
888
889 } while(run != run_end);
890}
static void ME_GetRunCharFormat(ME_TextEditor *editor, ME_DisplayItem *run, CHARFORMAT2W *pFmt)
Definition: run.c:779
@ diRunOrParagraph
Definition: editstr.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CFM_LINK
Definition: richedit.h:337
#define CFM_SUPERSCRIPT
Definition: richedit.h:349
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BYTE bUnderlineType
Definition: richedit.h:321
BYTE bPitchAndFamily
Definition: richedit.h:312

Referenced by get_textfont_prop_for_pos(), ME_GetSelectionCharFormat(), ME_StreamIn(), and ME_UpdateLinkAttribute().

◆ ME_GetCursorCoordinates()

void ME_GetCursorCoordinates ( ME_TextEditor editor,
ME_Cursor pCursor,
int x,
int y,
int height 
)

Definition at line 221 of file caret.c.

223{
225 ME_DisplayItem *run = pCursor->pRun;
226 ME_DisplayItem *para = pCursor->pPara;
227 ME_DisplayItem *pSizeRun = run;
229 int run_x;
230
231 assert(height && x && y);
233 assert(run && run->type == diRun);
234 assert(para && para->type == diParagraph);
235
237 assert(row && row->type == diStartRow);
238
239 ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
240
241 if (!pCursor->nOffset)
242 {
244 assert(prev);
245 if (prev->type == diRun)
246 pSizeRun = prev;
247 }
248 if (editor->bCaretAtEnd && !pCursor->nOffset &&
249 run == ME_FindItemFwd(row, diRun))
250 {
252 assert(tmp);
253 if (tmp->type == diRun)
254 {
256 pSizeRun = run = tmp;
257 assert(run);
258 assert(run->type == diRun);
259 }
260 }
261 run_x = ME_PointFromCharContext( &c, &run->member.run, pCursor->nOffset, TRUE );
262
263 *height = pSizeRun->member.run.nAscent + pSizeRun->member.run.nDescent;
264 *x = c.rcView.left + run->member.run.pt.x + run_x - editor->horz_si.nPos;
265 *y = c.rcView.top + para->member.para.pt.y + row->member.row.nBaseline
266 + run->member.run.pt.y - pSizeRun->member.run.nAscent
267 - editor->vert_si.nPos;
269 return;
270}
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
Definition: run.c:557
@ diStartRowOrParagraph
Definition: editstr.h:92
int nAscent
Definition: editstr.h:166
int nDescent
Definition: editstr.h:166
BOOL bCaretAtEnd
Definition: editstr.h:399

Referenced by create_caret(), ITextRange_fnScrollIntoView(), and update_caret().

◆ ME_GetCursorOfs()

◆ ME_GetDataObject()

HRESULT ME_GetDataObject ( ME_TextEditor editor,
const ME_Cursor start,
int  nChars,
LPDATAOBJECT lplpdataobj 
)

◆ ME_GetDefaultCharFormat()

void ME_GetDefaultCharFormat ( ME_TextEditor editor,
CHARFORMAT2W pFmt 
)

Definition at line 790 of file run.c.

791{
792 ME_CopyCharFormat(pFmt, &editor->pBuffer->pDefaultStyle->fmt);
793}
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN
Definition: style.c:230

Referenced by ME_HandleMessage().

◆ ME_GetInsertStyle()

ME_Style * ME_GetInsertStyle ( ME_TextEditor editor,
int  nCursor 
)

Definition at line 476 of file style.c.

477{
478 if (ME_IsSelection(editor))
479 {
480 ME_Cursor *from, *to;
481
482 ME_GetSelection(editor, &from, &to);
483 ME_AddRefStyle(from->pRun->member.run.style);
484 return from->pRun->member.run.style;
485 }
486 if (editor->pBuffer->pCharStyle) {
488 return editor->pBuffer->pCharStyle;
489 }
490 else
491 {
492 ME_Cursor *pCursor = &editor->pCursors[nCursor];
493 ME_DisplayItem *pRunItem = pCursor->pRun;
494 ME_DisplayItem *pPrevItem = NULL;
495 if (pCursor->nOffset) {
496 ME_Run *pRun = &pRunItem->member.run;
497 ME_AddRefStyle(pRun->style);
498 return pRun->style;
499 }
500 pPrevItem = ME_FindItemBack(pRunItem, diRunOrParagraph);
501 if (pPrevItem->type == diRun)
502 {
503 ME_AddRefStyle(pPrevItem->member.run.style);
504 return pPrevItem->member.run.style;
505 }
506 else
507 {
508 ME_AddRefStyle(pRunItem->member.run.style);
509 return pRunItem->member.run.style;
510 }
511 }
512}
BOOL ME_IsSelection(ME_TextEditor *editor)
Definition: caret.c:1578
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to)
Definition: caret.c:57

Referenced by handle_enter(), ITextRange_fnSetText(), ME_Char(), ME_GetSelectionInsertStyle(), ME_HandleMessage(), ME_InsertEndParaFromCursor(), ME_InsertEndRowFromCursor(), ME_InsertOLEFromCursor(), and ME_SetSelectionCharFormat().

◆ ME_GetOLEObjectSize()

void ME_GetOLEObjectSize ( const ME_Context c,
ME_Run run,
SIZE pSize 
)

Definition at line 5727 of file richole.c.

5728{
5729 IDataObject* ido;
5730 FORMATETC fmt;
5731 STGMEDIUM stgm;
5732 DIBSECTION dibsect;
5733 ENHMETAHEADER emh;
5734
5735 assert(run->nFlags & MERF_GRAPHICS);
5736 assert(run->reobj);
5737
5738 if (run->reobj->obj.sizel.cx != 0 || run->reobj->obj.sizel.cy != 0)
5739 {
5740 convert_sizel(c, &run->reobj->obj.sizel, pSize);
5741 if (c->editor->nZoomNumerator != 0)
5742 {
5743 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5744 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5745 }
5746 return;
5747 }
5748
5749 if (!run->reobj->obj.poleobj)
5750 {
5751 pSize->cx = pSize->cy = 0;
5752 return;
5753 }
5754
5755 if (IOleObject_QueryInterface(run->reobj->obj.poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
5756 {
5757 FIXME("Query Interface IID_IDataObject failed!\n");
5758 pSize->cx = pSize->cy = 0;
5759 return;
5760 }
5761 fmt.cfFormat = CF_BITMAP;
5762 fmt.ptd = NULL;
5763 fmt.dwAspect = DVASPECT_CONTENT;
5764 fmt.lindex = -1;
5765 fmt.tymed = TYMED_GDI;
5766 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5767 {
5768 fmt.cfFormat = CF_ENHMETAFILE;
5769 fmt.tymed = TYMED_ENHMF;
5770 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
5771 {
5772 FIXME("unsupported format\n");
5773 pSize->cx = pSize->cy = 0;
5774 IDataObject_Release(ido);
5775 return;
5776 }
5777 }
5778 IDataObject_Release(ido);
5779
5780 switch (stgm.tymed)
5781 {
5782 case TYMED_GDI:
5783 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
5784 pSize->cx = dibsect.dsBm.bmWidth;
5785 pSize->cy = dibsect.dsBm.bmHeight;
5786 break;
5787 case TYMED_ENHMF:
5788 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
5789 pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
5790 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
5791 break;
5792 default:
5793 FIXME("Unsupported tymed %d\n", stgm.tymed);
5794 break;
5795 }
5796 ReleaseStgMedium(&stgm);
5797 if (c->editor->nZoomNumerator != 0)
5798 {
5799 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5800 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
5801 }
5802}

Referenced by ME_CharFromPointContext(), ME_GetRunSizeCommon(), and ME_PointFromCharContext().

◆ ME_GetOuterParagraph()

ME_DisplayItem * ME_GetOuterParagraph ( ME_DisplayItem para)

Definition at line 172 of file table.c.

173{
174 if (para->member.para.nFlags & MEPF_ROWEND)
175 para = para->member.para.prev_para;
176 while (para->member.para.pCell)
177 {
178 para = ME_GetTableRowStart(para);
179 if (!para->member.para.pCell)
180 break;
182 }
183 return para;
184}

Referenced by ME_InvalidateParagraphRange().

◆ ME_GetParaBorderWidth()

int ME_GetParaBorderWidth ( const ME_Context c,
int  flags 
)

Definition at line 529 of file paint.c.

530{
531 int idx = (flags >> 8) & 0xF;
532 int width;
533
535 {
536 FIXME("Unsupported border value %d\n", idx);
537 return 0;
538 }
540 if (border_details[idx].dble) width = width * 2 + 1;
541 return width;
542}
unsigned int idx
Definition: utils.c:41
static int ME_GetBorderPenWidth(const ME_Context *c, int idx)
Definition: paint.c:516
static const struct @542 border_details[]
unsigned width
Definition: paint.c:490
unsigned dble
Definition: paint.c:490
GLint GLint GLsizei width
Definition: gl.h:1546

Referenced by ME_DrawParaDecoration(), and ME_WrapTextParagraph().

◆ ME_GetParagraph()

ME_DisplayItem * ME_GetParagraph ( ME_DisplayItem run)

◆ ME_GetRunSizeCommon()

SIZE ME_GetRunSizeCommon ( ME_Context c,
const ME_Paragraph para,
ME_Run run,
int  nLen,
int  startx,
int pAscent,
int pDescent 
)

Definition at line 616 of file run.c.

618{
619 static const WCHAR spaceW[] = {' ',0};
620 SIZE size;
621
622 nLen = min( nLen, run->len );
623
624 if (run->nFlags & MERF_ENDPARA)
625 {
626 nLen = min( nLen, 1 );
627 ME_GetTextExtent(c, spaceW, nLen, run->style, &size);
628 }
629 else if (para->nFlags & MEPF_COMPLEX)
630 {
631 size.cx = run->nWidth;
632 }
633 else if (c->editor->cPasswordMask)
634 {
635 ME_String *szMasked = ME_MakeStringR(c->editor->cPasswordMask,nLen);
636 ME_GetTextExtent(c, szMasked->szData, nLen,run->style, &size);
637 ME_DestroyString(szMasked);
638 }
639 else
640 {
641 ME_GetTextExtent(c, get_text( run, 0 ), nLen, run->style, &size);
642 }
643 *pAscent = run->style->tm.tmAscent;
644 *pDescent = run->style->tm.tmDescent;
645 size.cy = *pAscent + *pDescent;
646
647 if (run->nFlags & MERF_TAB)
648 {
649 int pos = 0, i = 0, ppos, shift = 0;
650 const PARAFORMAT2 *pFmt = &para->fmt;
651
652 if (c->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
653 pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
654 /* The horizontal gap shifts the tab positions to leave the gap. */
655 shift = pFmt->dxOffset * 2;
656 do {
657 if (i < pFmt->cTabCount)
658 {
659 /* Only one side of the horizontal gap is needed at the end of
660 * the table row. */
661 if (i == pFmt->cTabCount -1)
662 shift = shift >> 1;
663 pos = shift + (pFmt->rgxTabs[i]&0x00FFFFFF);
664 i++;
665 }
666 else
667 {
669 }
670 ppos = ME_twips2pointsX(c, pos);
671 if (ppos > startx + run->pt.x) {
672 size.cx = ppos - startx - run->pt.x;
673 break;
674 }
675 } while(1);
676 size.cy = *pAscent + *pDescent;
677 return size;
678 }
679 if (run->nFlags & MERF_GRAPHICS)
680 {
681 ME_GetOLEObjectSize(c, run, &size);
682 if (size.cy > *pAscent)
683 *pAscent = size.cy;
684 /* descent is unchanged */
685 return size;
686 }
687 return size;
688}
static void ME_GetTextExtent(ME_Context *c, LPCWSTR szText, int nChars, ME_Style *s, SIZE *size)
Definition: run.c:537
int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN
Definition: paint.c:153
#define MERF_ENDPARA
Definition: editstr.h:122