IUnknown_AddRef((IUnknown *)*ppvObj);
return S_OK;
}
-
- if (IsEqualGUID(riid, &IID_ITextServices))
- {
- static int once;
- if (!once++) FIXME("%p: unhandled interface IID_ITextServices\n", This);
- return E_NOINTERFACE;
- }
-
FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid));
return E_NOINTERFACE;
return E_NOTIMPL;
}
-static void cp2range(ME_TextEditor *editor, LONG *cp1, LONG *cp2)
-{
- int len = ME_GetTextLength(editor) + 1;
- *cp1 = max(*cp1, 0);
- *cp2 = max(*cp2, 0);
- *cp1 = min(*cp1, len);
- *cp2 = min(*cp2, len);
- if (*cp1 > *cp2)
- {
- int tmp = *cp1;
- *cp1 = *cp2;
- *cp2 = tmp;
- }
- if (*cp1 == len)
- *cp1 = *cp2 = len - 1;
-}
-
static HRESULT WINAPI ITextRange_fnSetRange(ITextRange *me, LONG anchor, LONG active)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
if (!This->child.reole)
return CO_E_RELEASED;
- cp2range(This->child.reole->editor, &anchor, &active);
- if (anchor == This->start && active == This->end)
- return S_FALSE;
-
- This->start = anchor;
- This->end = active;
- return S_OK;
+ return E_NOTIMPL;
}
static HRESULT textrange_inrange(LONG start, LONG end, ITextRange *range, LONG *ret)
{
ITextFontImpl *This = impl_from_ITextFont(iface);
FIXME("(%p)->(%p): stub\n", This, pFont);
-
- if (This->range && !get_range_reole(This->range))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextFontImpl *This = impl_from_ITextFont(iface);
FIXME("(%p)->(%p): stub\n", This, ret);
-
- if (This->range && !get_range_reole(This->range))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextFontImpl *This = impl_from_ITextFont(iface);
FIXME("(%p)->(%p %p): stub\n", This, font, ret);
-
- if (This->range && !get_range_reole(This->range))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextFontImpl *This = impl_from_ITextFont(iface);
FIXME("(%p)->(%p): stub\n", This, value);
-
- if (This->range && !get_range_reole(This->range))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextFontImpl *This = impl_from_ITextFont(iface);
FIXME("(%p)->(%d): stub\n", This, value);
-
- if (This->range && !get_range_reole(This->range))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
return ref;
}
-static IRichEditOleImpl *para_get_reole(ITextParaImpl *This)
-{
- if (This->range)
- {
- ITextRangeImpl *rng = impl_from_ITextRange(This->range);
- return rng->child.reole;
- }
- return NULL;
-}
-
static HRESULT WINAPI TextPara_GetTypeInfoCount(ITextPara *iface, UINT *pctinfo)
{
ITextParaImpl *This = impl_from_ITextPara(iface);
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, ret);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, para);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, ret);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p %p)\n", This, para, ret);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
static HRESULT WINAPI TextPara_GetAlignment(ITextPara *iface, LONG *value)
{
ITextParaImpl *This = impl_from_ITextPara(iface);
- static int once;
-
- if (!once++) FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
+ FIXME("(%p)->(%p)\n", This, value);
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f %.2f %.2f)\n", This, StartIndent, LeftIndent, RightIndent);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d %.2f)\n", This, LineSpacingRule, LineSpacing);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%p)\n", This, value);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f %d %d)\n", This, tbPos, tbAlign, tbLeader);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)\n", This);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%.2f)\n", This, pos);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
{
ITextParaImpl *This = impl_from_ITextPara(iface);
FIXME("(%p)->(%d %p %p %p)\n", This, iTab, ptbPos, ptbAlign, ptbLeader);
-
- if (!para_get_reole(This))
- return CO_E_RELEASED;
-
return E_NOTIMPL;
}
ITextRange** ppRange)
{
IRichEditOleImpl *This = impl_from_ITextDocument(me);
+ const int len = ME_GetTextLength(This->editor) + 1;
TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2);
if (!ppRange)
return E_INVALIDARG;
- cp2range(This->editor, &cp1, &cp2);
+ cp1 = max(cp1, 0);
+ cp2 = max(cp2, 0);
+ cp1 = min(cp1, len);
+ cp2 = min(cp2, len);
+ if (cp1 > cp2)
+ {
+ LONG tmp;
+ tmp = cp1;
+ cp1 = cp2;
+ cp2 = tmp;
+ }
+ if (cp1 == len)
+ cp1 = cp2 = len - 1;
+
return CreateITextRange(This, cp1, cp2, ppRange);
}
return;
}
}
+ IDataObject_Release(ido);
switch (stgm.tymed)
{
GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
pSize->cx = dibsect.dsBm.bmWidth;
pSize->cy = dibsect.dsBm.bmHeight;
- if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
break;
case TYMED_ENHMF:
GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
- if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
break;
default:
FIXME("Unsupported tymed %d\n", stgm.tymed);
break;
}
- IDataObject_Release(ido);
+ ReleaseStgMedium(&stgm);
if (c->editor->nZoomNumerator != 0)
{
pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
}
}
-void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
- ME_Paragraph *para, BOOL selected)
+void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, BOOL selected)
{
IDataObject* ido;
FORMATETC fmt;
HDC hMemDC;
SIZE sz;
BOOL has_size;
+ HBITMAP old_bm;
+ RECT rc;
assert(run->nFlags & MERF_GRAPHICS);
assert(run->ole_obj);
return;
}
}
+ IDataObject_Release(ido);
+
switch (stgm.tymed)
{
case TYMED_GDI:
GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
hMemDC = CreateCompatibleDC(c->hDC);
- SelectObject(hMemDC, stgm.u.hBitmap);
+ old_bm = SelectObject(hMemDC, stgm.u.hBitmap);
if (has_size)
{
convert_sizel(c, &run->ole_obj->sizel, &sz);
} else {
- sz.cx = MulDiv(dibsect.dsBm.bmWidth, c->dpi.cx, 96);
- sz.cy = MulDiv(dibsect.dsBm.bmHeight, c->dpi.cy, 96);
+ sz.cx = dibsect.dsBm.bmWidth;
+ sz.cy = dibsect.dsBm.bmHeight;
}
if (c->editor->nZoomNumerator != 0)
{
sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
}
- if (sz.cx == dibsect.dsBm.bmWidth && sz.cy == dibsect.dsBm.bmHeight)
- {
- BitBlt(c->hDC, x, y - sz.cy,
- dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight,
- hMemDC, 0, 0, SRCCOPY);
- } else {
- StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
- hMemDC, 0, 0, dibsect.dsBm.bmWidth,
- dibsect.dsBm.bmHeight, SRCCOPY);
- }
+ StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
+ hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
+
+ SelectObject(hMemDC, old_bm);
DeleteDC(hMemDC);
- if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
break;
case TYMED_ENHMF:
GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
{
convert_sizel(c, &run->ole_obj->sizel, &sz);
} else {
- sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top, c->dpi.cx, 96);
- sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left, c->dpi.cy, 96);
+ sz.cx = emh.rclBounds.right - emh.rclBounds.left;
+ sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
}
if (c->editor->nZoomNumerator != 0)
{
sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
}
- {
- RECT rc;
-
- rc.left = x;
- rc.top = y - sz.cy;
- rc.right = x + sz.cx;
- rc.bottom = y;
- PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
- }
- if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
+ rc.left = x;
+ rc.top = y - sz.cy;
+ rc.right = x + sz.cx;
+ rc.bottom = y;
+ PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
break;
default:
FIXME("Unsupported tymed %d\n", stgm.tymed);
selected = FALSE;
break;
}
+ ReleaseStgMedium(&stgm);
+
if (selected && !c->editor->bHideSelection)
PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
- IDataObject_Release(ido);
}
void ME_DeleteReObject(REOBJECT* reo)