tdf#133368: update extensions website URLs and use https
[LibreOffice.git] / setup_native / source / win32 / customactions / sellang / sorttree.cxx
blobcb44675b90c9e24df3374b9b3d1fbe908501fb8c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #define WIN32_LEAN_AND_MEAN
11 #include <windows.h>
12 #include <msi.h>
13 #include <commctrl.h>
15 extern "C" __declspec(dllexport) UINT __stdcall SortTree(MSIHANDLE)
17 // Sort items (languages) in SelectionTree control, fdo#46355
19 HWND hwndMSI = FindWindowW(L"MsiDialogCloseClass", nullptr);
20 if (hwndMSI == nullptr)
22 OutputDebugStringW(L"SortTree: MsiDialogCloseClass not found\n");
23 return ERROR_SUCCESS;
25 HWND hwndTV = FindWindowExW(hwndMSI, nullptr, L"SysTreeView32", nullptr);
26 if (hwndTV == nullptr)
28 OutputDebugStringW(L"SortTree: SysTreeView32 not found\n");
29 return ERROR_SUCCESS;
31 HTREEITEM optional = TreeView_GetRoot(hwndTV);
32 if (optional == nullptr)
34 OutputDebugStringW(L"SortTree: Optional Components branch not found\n");
35 return ERROR_SUCCESS;
37 HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
38 if (dicts == nullptr)
40 OutputDebugStringW(L"SortTree: Dictionaries branch not found\n");
41 return ERROR_SUCCESS;
43 TreeView_SortChildren(hwndTV, dicts, TRUE);
44 HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
45 if (langs == nullptr)
47 OutputDebugStringW(L"SortTree: Additional UI Languages branch not found\n");
48 return ERROR_SUCCESS;
50 TreeView_SortChildren(hwndTV, langs, TRUE);
52 return ERROR_SUCCESS;
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */