[RICHED20] Sync with Wine Staging 2.16. CORE-13762
[reactos.git] / reactos / dll / win32 / riched20 / txthost.c
index 112295a..f926964 100644 (file)
@@ -27,6 +27,7 @@ typedef struct ITextHostImpl {
     LONG ref;
     HWND hWnd;
     BOOL bEmulateVersion10;
+    PARAFORMAT2 para_fmt;
 } ITextHostImpl;
 
 static const ITextHostVtbl textHostVtbl;
@@ -34,23 +35,22 @@ static const ITextHostVtbl textHostVtbl;
 ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10)
 {
     ITextHostImpl *texthost;
+
     texthost = CoTaskMemAlloc(sizeof(*texthost));
-    if (texthost)
-    {
-        ME_TextEditor *editor;
-
-        texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
-        texthost->ref = 1;
-        texthost->hWnd = hwnd;
-        texthost->bEmulateVersion10 = bEmulateVersion10;
-
-        editor = ME_MakeEditor(&texthost->ITextHost_iface, bEmulateVersion10, cs->style);
-        editor->exStyleFlags = GetWindowLongW(hwnd, GWL_EXSTYLE);
-        editor->styleFlags |= GetWindowLongW(hwnd, GWL_STYLE) & ES_WANTRETURN;
-        editor->hWnd = hwnd; /* FIXME: Remove editor's dependence on hWnd */
-        editor->hwndParent = cs->hwndParent;
-        SetWindowLongPtrW(hwnd, 0, (LONG_PTR)editor);
-    }
+    if (!texthost) return NULL;
+
+    texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
+    texthost->ref = 1;
+    texthost->hWnd = hwnd;
+    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;
 }
@@ -258,9 +258,11 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetCharFormat(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,