Commit 5cc8c9fe authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Retrieve the default paragraph alignment from the text host.

parent 4cb7578d
...@@ -2884,7 +2884,7 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y) ...@@ -2884,7 +2884,7 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
return TRUE; return TRUE;
} }
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10, DWORD csStyle) ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
{ {
ME_TextEditor *ed = ALLOC_OBJ(ME_TextEditor); ME_TextEditor *ed = ALLOC_OBJ(ME_TextEditor);
int i; int i;
...@@ -2898,11 +2898,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10, DWORD ...@@ -2898,11 +2898,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10, DWORD
ed->reOle = NULL; ed->reOle = NULL;
ed->bEmulateVersion10 = bEmulateVersion10; ed->bEmulateVersion10 = bEmulateVersion10;
ed->styleFlags = 0; ed->styleFlags = 0;
ed->alignStyle = PFA_LEFT;
if (csStyle & ES_RIGHT)
ed->alignStyle = PFA_RIGHT;
if (csStyle & ES_CENTER)
ed->alignStyle = PFA_CENTER;
ITextHost_TxGetPropertyBits(texthost, ITextHost_TxGetPropertyBits(texthost,
(TXTBIT_RICHTEXT|TXTBIT_MULTILINE| (TXTBIT_RICHTEXT|TXTBIT_MULTILINE|
TXTBIT_READONLY|TXTBIT_USEPASSWORD| TXTBIT_READONLY|TXTBIT_USEPASSWORD|
...@@ -4799,7 +4794,7 @@ static BOOL create_windowed_editor(HWND hwnd, CREATESTRUCTW *create, BOOL emulat ...@@ -4799,7 +4794,7 @@ static BOOL create_windowed_editor(HWND hwnd, CREATESTRUCTW *create, BOOL emulat
if (!host) return FALSE; if (!host) return FALSE;
editor = ME_MakeEditor( host, emulate_10, create->style ); editor = ME_MakeEditor( host, emulate_10 );
if (!editor) if (!editor)
{ {
ITextHost_Release( host ); ITextHost_Release( host );
......
...@@ -255,7 +255,7 @@ void ME_DeleteReObject(REOBJECT* reo) DECLSPEC_HIDDEN; ...@@ -255,7 +255,7 @@ void ME_DeleteReObject(REOBJECT* reo) DECLSPEC_HIDDEN;
void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN; void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN;
/* editor.c */ /* editor.c */
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10, DWORD csStyle) DECLSPEC_HIDDEN; ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
void ME_DestroyEditor(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_DestroyEditor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL unicode, HRESULT* phresult) DECLSPEC_HIDDEN; LPARAM lParam, BOOL unicode, HRESULT* phresult) DECLSPEC_HIDDEN;
......
...@@ -382,7 +382,6 @@ typedef struct tagME_TextEditor ...@@ -382,7 +382,6 @@ typedef struct tagME_TextEditor
ME_TextBuffer *pBuffer; ME_TextBuffer *pBuffer;
ME_Cursor *pCursors; ME_Cursor *pCursors;
DWORD styleFlags; DWORD styleFlags;
DWORD alignStyle;
DWORD exStyleFlags; DWORD exStyleFlags;
int nCursors; int nCursors;
SIZE sizeWindow; SIZE sizeWindow;
......
...@@ -863,10 +863,22 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) ...@@ -863,10 +863,22 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
{ {
const PARAFORMAT2 *host_fmt;
HRESULT hr;
ZeroMemory(pFmt, sizeof(PARAFORMAT2)); ZeroMemory(pFmt, sizeof(PARAFORMAT2));
pFmt->cbSize = sizeof(PARAFORMAT2); pFmt->cbSize = sizeof(PARAFORMAT2);
pFmt->dwMask = PFM_ALL2; pFmt->dwMask = PFM_ALL2;
pFmt->wAlignment = editor->alignStyle; pFmt->wAlignment = PFA_LEFT;
pFmt->sStyle = -1; pFmt->sStyle = -1;
pFmt->bOutlineLevel = TRUE; pFmt->bOutlineLevel = TRUE;
hr = ITextHost_TxGetParaFormat( editor->texthost, (const PARAFORMAT **)&host_fmt );
if (SUCCEEDED(hr))
{
/* Just use the alignment for now */
if (host_fmt->dwMask & PFM_ALIGNMENT)
pFmt->wAlignment = host_fmt->wAlignment;
ITextHost_OnTxParaFormatChange( editor->texthost, (PARAFORMAT *)pFmt );
}
} }
...@@ -38,6 +38,7 @@ typedef struct ITextHostImpl { ...@@ -38,6 +38,7 @@ typedef struct ITextHostImpl {
LONG ref; LONG ref;
HWND hWnd; HWND hWnd;
BOOL bEmulateVersion10; BOOL bEmulateVersion10;
PARAFORMAT2 para_fmt;
} ITextHostImpl; } ITextHostImpl;
static const ITextHostVtbl textHostVtbl; static const ITextHostVtbl textHostVtbl;
...@@ -53,6 +54,14 @@ ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion1 ...@@ -53,6 +54,14 @@ ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion1
texthost->ref = 1; texthost->ref = 1;
texthost->hWnd = hwnd; texthost->hWnd = hwnd;
texthost->bEmulateVersion10 = bEmulateVersion10; texthost->bEmulateVersion10 = bEmulateVersion10;
memset( &texthost->para_fmt, 0, sizeof(texthost->para_fmt) );
texthost->para_fmt.cbSize = sizeof(texthost->para_fmt);
texthost->para_fmt.dwMask = PFM_ALIGNMENT;
texthost->para_fmt.wAlignment = PFA_LEFT;
if (cs->style & ES_RIGHT)
texthost->para_fmt.wAlignment = PFA_RIGHT;
if (cs->style & ES_CENTER)
texthost->para_fmt.wAlignment = PFA_CENTER;
return &texthost->ITextHost_iface; return &texthost->ITextHost_iface;
} }
...@@ -260,9 +269,11 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface, ...@@ -260,9 +269,11 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface,
} }
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface, DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface,
const PARAFORMAT **ppPF) const PARAFORMAT **fmt)
{ {
return E_NOTIMPL; ITextHostImpl *This = impl_from_ITextHost(iface);
*fmt = (const PARAFORMAT *)&This->para_fmt;
return S_OK;
} }
DECLSPEC_HIDDEN COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface, DECLSPEC_HIDDEN COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface,
......
...@@ -413,7 +413,7 @@ HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, I ...@@ -413,7 +413,7 @@ HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, I
ITextImpl->pMyHost = pITextHost; ITextImpl->pMyHost = pITextHost;
ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl; ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl; ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl;
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE, ES_LEFT); ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);
ITextImpl->editor->exStyleFlags = 0; ITextImpl->editor->exStyleFlags = 0;
SetRectEmpty(&ITextImpl->editor->rcFormat); SetRectEmpty(&ITextImpl->editor->rcFormat);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment