From eef4c133e9649ebd690918bd7b83c2d5dc0dfcff Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 20 Sep 2017 20:20:44 +0300 Subject: Windows: avoid dependence on UNICODE define; prefer W functions Change-Id: I95b90128e93f0d88ed73601bcc5a7ca9279d4cf1 Reviewed-on: https://gerrit.libreoffice.org/42560 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- shell/inc/config.hxx | 2 -- .../shlxthandler/propsheets/listviewbuilder.cxx | 39 +++++++++++++++------- shell/source/win32/shlxthandler/shlxthdl.cxx | 1 - shell/source/win32/simplemail/senddoc.cxx | 4 +-- 4 files changed, 28 insertions(+), 18 deletions(-) (limited to 'shell') diff --git a/shell/inc/config.hxx b/shell/inc/config.hxx index eda0cfb06f9f..a888745ba5cd 100644 --- a/shell/inc/config.hxx +++ b/shell/inc/config.hxx @@ -24,8 +24,6 @@ #pragma warning (disable : 4786 4503 4917) #endif -#include - #ifdef _AMD64_ #define MODULE_NAME L"shlxthdl_x64.dll" #else diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx index caaf1e5222cc..156eb49f017c 100644 --- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx +++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx @@ -28,9 +28,24 @@ #include "config.hxx" #include -#include #include "resource.h" +// Unicode-only defines to break dependance on UNICODE define +#if !defined ListView_InsertColumnW +#define ListView_InsertColumnW(hwnd, iCol, pcol) \ + (int)SNDMSG((hwnd), LVM_INSERTCOLUMNW, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMNW *)(pcol)) +#endif + +#if !defined ListView_InsertItemW +#define ListView_InsertItemW(hwnd, pitem) \ + (int)SNDMSG((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LV_ITEMW *)(pitem)) +#endif + +#if !defined ListView_SetItemW +#define ListView_SetItemW(hwnd, pitem) \ + (BOOL)SNDMSG((hwnd), LVM_SETITEMW, 0, (LPARAM)(const LV_ITEMW *)(pitem)) +#endif + list_view_builder_ptr create_list_view_builder( HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2) @@ -83,17 +98,17 @@ void list_view_builder::build(statistic_group_list_t& gl) void list_view_builder::setup_list_view() { HIMAGELIST h_ils = ImageList_Create(16,15,ILC_MASK, 7, 0); - HBITMAP h_bmp = LoadBitmap(GetModuleHandle(MODULE_NAME), MAKEINTRESOURCE(IDB_PROPERTY_IMAGES)); + HBITMAP h_bmp = LoadBitmapW(GetModuleHandleW(MODULE_NAME), MAKEINTRESOURCEW(IDB_PROPERTY_IMAGES)); ImageList_AddMasked(h_ils, h_bmp, RGB(255, 0, 255)); (void) ListView_SetImageList(hwnd_list_view_, h_ils, LVSIL_SMALL); std::wstring header = GetResString(IDS_PROPERTY); - LVCOLUMN lvc; + LVCOLUMNW lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | - LVCF_TEXT | + LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = 0; @@ -101,11 +116,11 @@ void list_view_builder::setup_list_view() lvc.cx = 120; lvc.fmt = LVCFMT_LEFT; - ListView_InsertColumn(hwnd_list_view_, 0, &lvc); + ListView_InsertColumnW(hwnd_list_view_, 0, &lvc); lvc.iSubItem = 1; header = GetResString(IDS_PROPERTY_VALUE); lvc.pszText = const_cast(header.c_str()); - ListView_InsertColumn(hwnd_list_view_, 1, &lvc); + ListView_InsertColumnW(hwnd_list_view_, 1, &lvc); } @@ -117,7 +132,7 @@ void list_view_builder::insert_group(const std::wstring& /*title*/) void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable) { - LVITEM lvi; + LVITEMW lvi; lvi.iItem = ++row_index_; lvi.iSubItem = 0; @@ -137,13 +152,13 @@ void list_view_builder::insert_item(const std::wstring& title, const std::wstrin lvi.iImage = 3; } - ListView_InsertItem(hwnd_list_view_, &lvi); + ListView_InsertItemW(hwnd_list_view_, &lvi); lvi.mask = LVIF_TEXT; lvi.iSubItem = 1; lvi.pszText = const_cast(value.c_str()); - ListView_SetItem(hwnd_list_view_, &lvi); + ListView_SetItemW(hwnd_list_view_, &lvi); } @@ -193,7 +208,7 @@ void winxp_list_view_builder::insert_group(const std::wstring& name) void winxp_list_view_builder::insert_item( const std::wstring& title, const std::wstring& value, bool is_editable) { - LVITEM lvi; + LVITEMW lvi; lvi.iItem = ++row_index_; lvi.iSubItem = 0; @@ -213,13 +228,13 @@ void winxp_list_view_builder::insert_item( lvi.iImage = 3; } - ListView_InsertItem(get_list_view(), &lvi); + ListView_InsertItemW(get_list_view(), &lvi); lvi.mask = LVIF_TEXT; lvi.iSubItem = 1; lvi.pszText = const_cast(value.c_str()); - ListView_SetItem(get_list_view(), &lvi); + ListView_SetItemW(get_list_view(), &lvi); row_count_++; } diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx index 24833812d821..ff8b83670904 100644 --- a/shell/source/win32/shlxthandler/shlxthdl.cxx +++ b/shell/source/win32/shlxthandler/shlxthdl.cxx @@ -25,7 +25,6 @@ #include "fileextensions.hxx" #include "utilities.hxx" -#include #include #include diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx index b911a3b9cc5b..f0dfe8f547ea 100644 --- a/shell/source/win32/simplemail/senddoc.cxx +++ b/shell/source/win32/simplemail/senddoc.cxx @@ -26,8 +26,6 @@ #include "simplemapi.hxx" -#include - #include #include #include @@ -340,7 +338,7 @@ int main(int argc, char* argv[]) if (gMapiFlags & MAPI_LOGON_UI) oss << "--mapi-logon-ui" << std::endl; - MessageBox(nullptr, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION); + MessageBoxA(nullptr, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION); } #endif -- cgit