From 5f51dda7eeab4d905ecf86ac447b76346ab0df0b Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 14 May 2014 16:06:51 +0200 Subject: [PATCH] oleacc: Add GetStateText implementation. --- dlls/oleacc/main.c | 64 ++++++++- dlls/oleacc/oleacc.rc | 34 +++++ dlls/oleacc/oleacc.spec | 4 +- dlls/oleacc/resource.h | 50 +++++++ dlls/oleacc/tests/main.c | 71 ++++++++++ po/ar.po | 294 ++++++++++++++++++++++++++++++--------- po/bg.po | 274 +++++++++++++++++++++++++++--------- po/ca.po | 294 ++++++++++++++++++++++++++++++--------- po/cs.po | 294 ++++++++++++++++++++++++++++++--------- po/da.po | 294 ++++++++++++++++++++++++++++++--------- po/de.po | 294 ++++++++++++++++++++++++++++++--------- po/el.po | 269 ++++++++++++++++++++++++++--------- po/en.po | 258 +++++++++++++++++++++++++--------- po/en_US.po | 258 +++++++++++++++++++++++++--------- po/eo.po | 282 ++++++++++++++++++++++++++++--------- po/es.po | 294 ++++++++++++++++++++++++++++++--------- po/fa.po | 263 +++++++++++++++++++++++++--------- po/fi.po | 294 ++++++++++++++++++++++++++++++--------- po/fr.po | 294 ++++++++++++++++++++++++++++++--------- po/he.po | 285 ++++++++++++++++++++++++++++--------- po/hi.po | 258 +++++++++++++++++++++++++--------- po/hr.po | 292 +++++++++++++++++++++++++++++--------- po/hu.po | 294 ++++++++++++++++++++++++++++++--------- po/it.po | 294 ++++++++++++++++++++++++++++++--------- po/ja.po | 294 ++++++++++++++++++++++++++++++--------- po/ko.po | 294 ++++++++++++++++++++++++++++++--------- po/lt.po | 294 ++++++++++++++++++++++++++++++--------- po/ml.po | 258 +++++++++++++++++++++++++--------- po/nb_NO.po | 294 ++++++++++++++++++++++++++++++--------- po/nl.po | 294 ++++++++++++++++++++++++++++++--------- po/or.po | 258 +++++++++++++++++++++++++--------- po/pa.po | 258 +++++++++++++++++++++++++--------- po/pl.po | 294 ++++++++++++++++++++++++++++++--------- po/pt_BR.po | 294 ++++++++++++++++++++++++++++++--------- po/pt_PT.po | 292 +++++++++++++++++++++++++++++--------- po/rm.po | 261 +++++++++++++++++++++++++--------- po/ro.po | 292 +++++++++++++++++++++++++++++--------- po/ru.po | 294 ++++++++++++++++++++++++++++++--------- po/sk.po | 280 ++++++++++++++++++++++++++++--------- po/sl.po | 294 ++++++++++++++++++++++++++++++--------- po/sr_RS@cyrillic.po | 284 ++++++++++++++++++++++++++++--------- po/sr_RS@latin.po | 288 +++++++++++++++++++++++++++++--------- po/sv.po | 294 ++++++++++++++++++++++++++++++--------- po/te.po | 258 +++++++++++++++++++++++++--------- po/th.po | 270 ++++++++++++++++++++++++++--------- po/tr.po | 292 +++++++++++++++++++++++++++++--------- po/uk.po | 294 ++++++++++++++++++++++++++++++--------- po/wa.po | 263 +++++++++++++++++++++++++--------- po/wine.pot | 258 +++++++++++++++++++++++++--------- po/zh_CN.po | 286 ++++++++++++++++++++++++++++--------- po/zh_TW.po | 294 ++++++++++++++++++++++++++++++--------- 51 files changed, 10235 insertions(+), 2993 deletions(-) create mode 100644 dlls/oleacc/resource.h diff --git a/dlls/oleacc/main.c b/dlls/oleacc/main.c index 32aaa140f69..89c014285db 100644 --- a/dlls/oleacc/main.c +++ b/dlls/oleacc/main.c @@ -23,11 +23,11 @@ #include #include "windef.h" #include "winbase.h" -#include "winuser.h" #include "ole2.h" #include "initguid.h" #include "oleacc_private.h" +#include "resource.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -401,3 +401,65 @@ UINT WINAPI GetRoleTextA(DWORD role, LPSTR lpRole, UINT rolemax) return length - 1; } + +UINT WINAPI GetStateTextW(DWORD state_bit, WCHAR *state_str, UINT state_str_len) +{ + DWORD state_id; + + TRACE("%x %p %u\n", state_bit, state_str, state_str_len); + + if(state_bit & ~(STATE_SYSTEM_VALID | STATE_SYSTEM_HASPOPUP)) { + if(state_str && state_str_len) + state_str[0] = 0; + return 0; + } + + state_id = IDS_STATE_NORMAL; + while(state_bit) { + state_id++; + state_bit /= 2; + } + + if(state_str) { + UINT ret = LoadStringW(oleacc_handle, state_id, state_str, state_str_len); + if(!ret && state_str_len) + state_str[0] = 0; + return ret; + }else { + WCHAR *tmp; + return LoadStringW(oleacc_handle, state_id, (WCHAR*)&tmp, 0); + } + +} + +UINT WINAPI GetStateTextA(DWORD state_bit, CHAR *state_str, UINT state_str_len) +{ + DWORD state_id; + + TRACE("%x %p %u\n", state_bit, state_str, state_str_len); + + if(state_str && !state_str_len) + return 0; + + if(state_bit & ~(STATE_SYSTEM_VALID | STATE_SYSTEM_HASPOPUP)) { + if(state_str && state_str_len) + state_str[0] = 0; + return 0; + } + + state_id = IDS_STATE_NORMAL; + while(state_bit) { + state_id++; + state_bit /= 2; + } + + if(state_str) { + UINT ret = LoadStringA(oleacc_handle, state_id, state_str, state_str_len); + if(!ret && state_str_len) + state_str[0] = 0; + return ret; + }else { + CHAR tmp[256]; + return LoadStringA(oleacc_handle, state_id, tmp, sizeof(tmp)); + } +} diff --git a/dlls/oleacc/oleacc.rc b/dlls/oleacc/oleacc.rc index 9163378a879..d4563971a65 100644 --- a/dlls/oleacc/oleacc.rc +++ b/dlls/oleacc/oleacc.rc @@ -19,6 +19,7 @@ */ #include "oleacc.h" +#include "resource.h" #pragma makedep po @@ -91,6 +92,39 @@ STRINGTABLE ROLE_SYSTEM_SPLITBUTTON "split button" ROLE_SYSTEM_IPADDRESS "IP address" ROLE_SYSTEM_OUTLINEBUTTON "outline button" + + IDS_STATE_NORMAL "normal" + IDS_STATE_UNAVAILABLE "unavailable" + IDS_STATE_SELECTED "selected" + IDS_STATE_FOCUSED "focused" + IDS_STATE_PRESSED "pressed" + IDS_STATE_CHECKED "checked" + IDS_STATE_MIXED "mixed" + IDS_STATE_READONLY "read only" + IDS_STATE_HOTTRACKED "hot tracked" + IDS_STATE_DEFAULT "default" + IDS_STATE_EXPANDED "expanded" + IDS_STATE_COLLAPSED "collapsed" + IDS_STATE_BUSY "busy" + IDS_STATE_FLOATING "floating" + IDS_STATE_MARQUEED "marqueed" + IDS_STATE_ANIMATED "animated" + IDS_STATE_INVISIBLE "invisible" + IDS_STATE_OFFSCREEN "offscreen" + IDS_STATE_SIZEABLE "sizeable" + IDS_STATE_MOVEABLE "moveable" + IDS_STATE_SELFVOICING "self voicing" + IDS_STATE_FOCUSABLE "focusable" + IDS_STATE_SELECTABLE "selectable" + IDS_STATE_LINKED "linked" + IDS_STATE_TRAVERSED "traversed" + IDS_STATE_MULTISELECTABLE "multi selectable" + IDS_STATE_EXTSELECTABLE "extended selectable" + IDS_STATE_ALERT_LOW "alert low" + IDS_STATE_ALERT_MEDIUM "alert medium" + IDS_STATE_ALERT_HIGH "alert high" + IDS_STATE_PROTECTED "protected" + IDS_STATE_HASPOPUP "has popup" } LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL diff --git a/dlls/oleacc/oleacc.spec b/dlls/oleacc/oleacc.spec index dc92172e88a..679ba1a7c44 100644 --- a/dlls/oleacc/oleacc.spec +++ b/dlls/oleacc/oleacc.spec @@ -12,8 +12,8 @@ @ stdcall GetProcessHandleFromHwnd(ptr) @ stdcall GetRoleTextA(long ptr long) @ stdcall GetRoleTextW(long ptr long) -@ stub GetStateTextA -@ stub GetStateTextW +@ stdcall GetStateTextA(long ptr long) +@ stdcall GetStateTextW(long ptr long) @ stub IID_IAccessible @ stub IID_IAccessibleHandler @ stub LIBID_Accessibility diff --git a/dlls/oleacc/resource.h b/dlls/oleacc/resource.h new file mode 100644 index 00000000000..d97697b6fcd --- /dev/null +++ b/dlls/oleacc/resource.h @@ -0,0 +1,50 @@ +/* + * Copyright 2014 Piotr Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define IDS_STATE_NORMAL 0x1000 +#define IDS_STATE_UNAVAILABLE 0x1001 +#define IDS_STATE_SELECTED 0x1002 +#define IDS_STATE_FOCUSED 0x1003 +#define IDS_STATE_PRESSED 0x1004 +#define IDS_STATE_CHECKED 0x1005 +#define IDS_STATE_MIXED 0x1006 +#define IDS_STATE_READONLY 0x1007 +#define IDS_STATE_HOTTRACKED 0x1008 +#define IDS_STATE_DEFAULT 0x1009 +#define IDS_STATE_EXPANDED 0x100a +#define IDS_STATE_COLLAPSED 0x100b +#define IDS_STATE_BUSY 0x100c +#define IDS_STATE_FLOATING 0x100d +#define IDS_STATE_MARQUEED 0x100e +#define IDS_STATE_ANIMATED 0x100f +#define IDS_STATE_INVISIBLE 0x1010 +#define IDS_STATE_OFFSCREEN 0x1011 +#define IDS_STATE_SIZEABLE 0x1012 +#define IDS_STATE_MOVEABLE 0x1013 +#define IDS_STATE_SELFVOICING 0x1014 +#define IDS_STATE_FOCUSABLE 0x1015 +#define IDS_STATE_SELECTABLE 0x1016 +#define IDS_STATE_LINKED 0x1017 +#define IDS_STATE_TRAVERSED 0x1018 +#define IDS_STATE_MULTISELECTABLE 0x1019 +#define IDS_STATE_EXTSELECTABLE 0x101a +#define IDS_STATE_ALERT_LOW 0x101b +#define IDS_STATE_ALERT_MEDIUM 0x101c +#define IDS_STATE_ALERT_HIGH 0x101d +#define IDS_STATE_PROTECTED 0x101e +#define IDS_STATE_HASPOPUP 0x101f diff --git a/dlls/oleacc/tests/main.c b/dlls/oleacc/tests/main.c index 4f9ea9833f1..76ea9699b8a 100644 --- a/dlls/oleacc/tests/main.c +++ b/dlls/oleacc/tests/main.c @@ -140,6 +140,76 @@ static void test_getroletext(void) } } +static void test_GetStateText(void) +{ + WCHAR buf[1024], buf2[1024]; + char bufa[1024]; + void *ptr; + UINT ret, ret2; + int i; + + ret2 = GetStateTextW(0, NULL, 1024); + ok(ret2, "GetStateText failed\n"); + + ptr = NULL; + ret = GetStateTextW(0, (WCHAR*)&ptr, 0); + ok(ret == ret2, "got %d, expected %d\n", ret, ret2); + ok(ptr != NULL, "ptr was not changed\n"); + + ret = GetStateTextW(0, buf, 1024); + ok(ret == ret2, "got %d, expected %d\n", ret, ret2); + ok(!memcmp(buf, ptr, ret*sizeof(WCHAR)), "got %s, expected %s\n", + wine_dbgstr_wn(buf, ret), wine_dbgstr_wn(ptr, ret)); + + ret = GetStateTextW(0, buf, 1); + ok(!ret, "got %d, expected 0\n", ret); + ok(!buf[0], "buf[0] = '%c'\n", buf[0]); + + for(i=0; i<30; i++) { + ret = GetStateTextW(1<