LibreOffice Module setup_native (master) 1
sorttree.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#define WIN32_LEAN_AND_MEAN
11#include <windows.h>
12#include <msi.h>
13#include <commctrl.h>
14
15extern "C" __declspec(dllexport) UINT __stdcall SortTree(MSIHANDLE)
16{
17 // Sort items (languages) in SelectionTree control, fdo#46355
18
19 HWND hwndMSI = FindWindowW(L"MsiDialogCloseClass", nullptr);
20 if (hwndMSI == nullptr)
21 {
22 OutputDebugStringW(L"SortTree: MsiDialogCloseClass not found\n");
23 return ERROR_SUCCESS;
24 }
25 HWND hwndTV = FindWindowExW(hwndMSI, nullptr, L"SysTreeView32", nullptr);
26 if (hwndTV == nullptr)
27 {
28 OutputDebugStringW(L"SortTree: SysTreeView32 not found\n");
29 return ERROR_SUCCESS;
30 }
31 HTREEITEM optional = TreeView_GetRoot(hwndTV);
32 if (optional == nullptr)
33 {
34 OutputDebugStringW(L"SortTree: Optional Components branch not found\n");
35 return ERROR_SUCCESS;
36 }
37 HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
38 if (dicts == nullptr)
39 {
40 OutputDebugStringW(L"SortTree: Dictionaries branch not found\n");
41 return ERROR_SUCCESS;
42 }
43 TreeView_SortChildren(hwndTV, dicts, TRUE);
44 HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
45 if (langs == nullptr)
46 {
47 OutputDebugStringW(L"SortTree: Additional UI Languages branch not found\n");
48 return ERROR_SUCCESS;
49 }
50 TreeView_SortChildren(hwndTV, langs, TRUE);
51
52 return ERROR_SUCCESS;
53}
54
55/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define TRUE
__declspec(dllexport) UINT __stdcall SortTree(MSIHANDLE)
Definition: sorttree.cxx:15