[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - scp2/source setup_native/source

Petr Mladek pmladek at kemper.freedesktop.org
Mon May 14 07:56:31 PDT 2012


 scp2/source/ooo/windowscustomaction_ooo.scp                  |    9 +
 setup_native/source/win32/customactions/sellang/exports.dxp  |    1 
 setup_native/source/win32/customactions/sellang/makefile.mk  |    3 
 setup_native/source/win32/customactions/sellang/sorttree.cxx |   67 +++++++++++
 4 files changed, 79 insertions(+), 1 deletion(-)

New commits:
commit 6aa1f471f7828a04af13fcfc9eb6234c3ac1998a
Author: Andras Timar <atimar at suse.com>
Date:   Thu May 10 10:38:20 2012 +0200

    error handling in SortTree custom action
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>
    Signed-off-by: Jesús Corrius <jesus at softcatala.org>
    Change-Id: I03a06d09e3e84b6cb13bd68e8be4caebb1b9f5ab

diff --git a/setup_native/source/win32/customactions/sellang/sorttree.cxx b/setup_native/source/win32/customactions/sellang/sorttree.cxx
index 25c6c6d..41695e2 100644
--- a/setup_native/source/win32/customactions/sellang/sorttree.cxx
+++ b/setup_native/source/win32/customactions/sellang/sorttree.cxx
@@ -23,15 +23,45 @@ extern "C" UINT __stdcall SortTree(MSIHANDLE)
     // Sort items (languages) in SelectionTree control, fdo#46355
 
     HWND hwndMSI = FindWindow(TEXT("MsiDialogCloseClass"), NULL);
+    if (hwndMSI == NULL)
+    {
+        OutputDebugString("SortTree: MsiDialogCloseClass not found\n");
+        return ERROR_SUCCESS;
+    }
     HWND hwndTV = FindWindowEx(hwndMSI, NULL, TEXT("SysTreeView32"), NULL);
+    if (hwndTV == NULL)
+    {
+        OutputDebugString("SortTree: SysTreeView32 not found\n");
+        return ERROR_SUCCESS;
+    }
     HTREEITEM treeRoot = TreeView_GetRoot(hwndTV);
+    if (treeRoot == NULL)
+    {
+        OutputDebugString("SortTree: TreeView_GetRoot failed\n");
+        return ERROR_SUCCESS;
+    }
     HTREEITEM optional = TreeView_GetNextSibling(hwndTV, treeRoot);
+    if (optional == NULL)
+    {
+        OutputDebugString("SortTree: Optional Components branch not found\n");
+        return ERROR_SUCCESS;
+    }
     HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
+    if (dicts == NULL)
+    {
+        OutputDebugString("SortTree: Dictionaries branch not found\n");
+        return ERROR_SUCCESS;
+    }
     TreeView_SortChildren(hwndTV, dicts, TRUE);
     HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
+    if (langs == NULL)
+    {
+        OutputDebugString("SortTree: Additional UI Languages branch not found\n");
+        return ERROR_SUCCESS;
+    }
     TreeView_SortChildren(hwndTV, langs, TRUE);
 
-	return ERROR_SUCCESS;
+    return ERROR_SUCCESS;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f12ab92d1d404ac72c011587b7b73b89c69d7b38
Author: Andras Timar <atimar at suse.com>
Date:   Tue Apr 24 21:51:33 2012 +0200

    fdo#46355 sort SelectionTree control of Custom Setup with a custom action
    
    Although Microsoft says that SelectionTree control can publish a control
    event only on Windows Server 2003 and above, the  custom action seems to
    be working under a fully patched Windows XP SP3. Maybe it fails silently
    on older Windows XPs, not to mention Windows 2000. I did not test those.
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>
    Signed-off-by: Jesús Corrius <jesus at softcatala.org>

diff --git a/scp2/source/ooo/windowscustomaction_ooo.scp b/scp2/source/ooo/windowscustomaction_ooo.scp
index 2ddfe34..f62b086 100644
--- a/scp2/source/ooo/windowscustomaction_ooo.scp
+++ b/scp2/source/ooo/windowscustomaction_ooo.scp
@@ -474,6 +474,15 @@ WindowsCustomAction gid_Customaction_SelectLanguage
     Assignment1 = ("ControlEvent", "SetupType", "Next", "DoAction", "SelectLanguage", "1", "1");
 End
 
+WindowsCustomAction gid_Customaction_SortTree
+    Name = "SortTree";
+    Typ = "321";
+    Source = "sellangmsi.dll";
+    Target = "SortTree";
+    Inbinarytable = 1;
+    Assignment1 = ("ControlEvent", "CustomSetup", "Tree", "DoAction", "SortTree", "1", "1");
+End
+
 WindowsCustomAction gid_Customaction_RebaseLibrariesonproperties
 	Name = "RebaseLibrariesOnProperties";
 	Typ = "65";
diff --git a/setup_native/source/win32/customactions/sellang/exports.dxp b/setup_native/source/win32/customactions/sellang/exports.dxp
index cc6dd8d..c8a622e 100644
--- a/setup_native/source/win32/customactions/sellang/exports.dxp
+++ b/setup_native/source/win32/customactions/sellang/exports.dxp
@@ -1 +1,2 @@
 SelectLanguage
+SortTree
diff --git a/setup_native/source/win32/customactions/sellang/makefile.mk b/setup_native/source/win32/customactions/sellang/makefile.mk
index ffad814..862653e 100644
--- a/setup_native/source/win32/customactions/sellang/makefile.mk
+++ b/setup_native/source/win32/customactions/sellang/makefile.mk
@@ -49,7 +49,8 @@ CFLAGS+=-D_STLP_USE_STATIC_LIB
 UWINAPILIB=
 
 SLOFILES = \
-    $(SLO)$/sellang.obj
+    $(SLO)/sellang.obj \
+    $(SLO)/sorttree.obj
 
 SHL1STDLIBS= \
     $(KERNEL32LIB)\
diff --git a/setup_native/source/win32/customactions/sellang/sorttree.cxx b/setup_native/source/win32/customactions/sellang/sorttree.cxx
new file mode 100644
index 0000000..25c6c6d
--- /dev/null
+++ b/setup_native/source/win32/customactions/sellang/sorttree.cxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifdef _MSC_VER
+#pragma warning(push, 1) /* disable warnings within system headers */
+#endif
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <msiquery.h>
+#include <commctrl.h>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+extern "C" UINT __stdcall SortTree(MSIHANDLE)
+{
+    // Sort items (languages) in SelectionTree control, fdo#46355
+
+    HWND hwndMSI = FindWindow(TEXT("MsiDialogCloseClass"), NULL);
+    HWND hwndTV = FindWindowEx(hwndMSI, NULL, TEXT("SysTreeView32"), NULL);
+    HTREEITEM treeRoot = TreeView_GetRoot(hwndTV);
+    HTREEITEM optional = TreeView_GetNextSibling(hwndTV, treeRoot);
+    HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
+    TreeView_SortChildren(hwndTV, dicts, TRUE);
+    HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
+    TreeView_SortChildren(hwndTV, langs, TRUE);
+
+	return ERROR_SUCCESS;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list