summaryrefslogtreecommitdiff
path: root/shell/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-20 20:20:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-22 20:53:30 +0200
commiteef4c133e9649ebd690918bd7b83c2d5dc0dfcff (patch)
tree1a8d084c5b16056a15258770a05b9cd2d53a40bc /shell/source
parentbb406680cebd6fa1e1bdb9e2de430cd9a1f44da0 (diff)
Windows: avoid dependence on UNICODE define; prefer W functions
Change-Id: I95b90128e93f0d88ed73601bcc5a7ca9279d4cf1 Reviewed-on: https://gerrit.libreoffice.org/42560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'shell/source')
-rw-r--r--shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx39
-rw-r--r--shell/source/win32/shlxthandler/shlxthdl.cxx1
-rw-r--r--shell/source/win32/simplemail/senddoc.cxx4
3 files changed, 28 insertions, 16 deletions
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 <commctrl.h>
-#include <tchar.h>
#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<wchar_t*>(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<wchar_t*>(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<wchar_t*>(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 <tchar.h>
#include <string>
#include <shlobj.h>
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 <tchar.h>
-
#include <iostream>
#include <vector>
#include <sstream>
@@ -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