infosoft: Use the pfnFillTextBuffer function to refresh the buffer.
This commit is contained in:
parent
510fc118dd
commit
c4c35d33b5
|
@ -87,35 +87,67 @@ static HRESULT WINAPI wb_Init( IWordBreaker *iface,
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI wb_BreakText( IWordBreaker *iface,
|
static HRESULT call_sink( IWordSink *pWordSink, TEXT_SOURCE *ts, UINT len )
|
||||||
TEXT_SOURCE *pTextSource, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
|
|
||||||
{
|
{
|
||||||
LPCWSTR p, q;
|
HRESULT r;
|
||||||
DWORD len;
|
|
||||||
|
|
||||||
FIXME("%p %p %p\n", pTextSource, pWordSink, pPhraseSink);
|
if (!len)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
p = pTextSource->awcBuffer;
|
TRACE("%d %s\n", len, debugstr_w(&ts->awcBuffer[ts->iCur]));
|
||||||
|
|
||||||
while (*p)
|
r = IWordSink_PutWord( pWordSink, len, &ts->awcBuffer[ts->iCur], len, ts->iCur );
|
||||||
|
ts->iCur += len;
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI wb_BreakText( IWordBreaker *iface,
|
||||||
|
TEXT_SOURCE *ts, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
|
||||||
|
{
|
||||||
|
UINT len, state = 0;
|
||||||
|
WCHAR ch;
|
||||||
|
|
||||||
|
TRACE("%p %p %p\n", ts, pWordSink, pPhraseSink);
|
||||||
|
|
||||||
|
if (pPhraseSink)
|
||||||
|
FIXME("IPhraseSink won't be called\n");
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
/* skip spaces and punctuation */
|
len = 0;
|
||||||
while(ispunctW(*p) || isspaceW(*p))
|
while ((ts->iCur + len) < ts->iEnd)
|
||||||
p++;
|
{
|
||||||
|
ch = ts->awcBuffer[ts->iCur + len];
|
||||||
|
|
||||||
/* find the end of the word */
|
switch (state)
|
||||||
q = p;
|
{
|
||||||
while(*q && !ispunctW(*q) && !isspaceW(*q))
|
case 0: /* skip spaces and punctuation */
|
||||||
q++;
|
|
||||||
|
|
||||||
len = q - p;
|
if (!ch || ispunctW(ch) || isspaceW(ch))
|
||||||
if (!len)
|
ts->iCur ++;
|
||||||
break;
|
else
|
||||||
|
state = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
IWordSink_PutWord( pWordSink, len, p, len, p - pTextSource->awcBuffer );
|
case 1: /* find the end of the word */
|
||||||
|
|
||||||
|
if (ch && !ispunctW(ch) && !isspaceW(ch))
|
||||||
|
len++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
call_sink( pWordSink, ts, len );
|
||||||
|
len = 0;
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
call_sink( pWordSink, ts, len );
|
||||||
|
|
||||||
|
} while (S_OK == ts->pfnFillTextBuffer( ts ));
|
||||||
|
|
||||||
p = q;
|
|
||||||
}
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +184,7 @@ HRESULT WINAPI wb_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObjec
|
||||||
wordbreaker_impl *This;
|
wordbreaker_impl *This;
|
||||||
IWordBreaker *wb;
|
IWordBreaker *wb;
|
||||||
|
|
||||||
FIXME("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject);
|
TRACE("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject);
|
||||||
|
|
||||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
||||||
if (!This)
|
if (!This)
|
||||||
|
|
Loading…
Reference in New Issue