tdf#69066: use Restart Manager to restart processes during installation

The goal is to allow installer to automatically close and restart closed
applications, and thus diminish users frustration when they don't know
how to close explorer.exe, or how to start it again and bring desktop back.

Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/aa370379

Notes:
* A dialog MsiRMFilesInUse must be present in MSI.
* It will only be used when operating system's Windows Installer version
is >=4.0, and OS is Vista or newer. If system's Windows Installer is older,
then current FilesInUse dialog will be used.
* MSIRESTARTMANAGERCONTROL property has default value of 0, that enables
installer to use the Restart Manager. It is explicitly set in MSI just in case.
* Do not use Restart Manager and do reboot is selected by default.

Change-Id: If9d8be7cb478d81db03485ee912991ae9d568ed8
Reviewed-on: https://gerrit.libreoffice.org/28171
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf b/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf
index f4293a5..4d39022 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf
+++ b/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf
@@ -684,3 +684,19 @@ en-US  = "Create a start link on desktop"

[OOO_CONTROL_321]
en-US  = "Load [ProductName] during system start-up"

[OOO_CONTROL_322]
en-US  = "Some files that need to be updated are currently in use."

[OOO_CONTROL_323]
en-US  = "The following applications are using files that need to be updated by this setup. You can let Installation Wizard close them and attempt to restart them or reboot the machine later."

[OOO_CONTROL_324]
en-US  = "{&MSSansBold8}Files in Use"

[OOO_CONTROL_325]
en-US  = "Cancel"

[OOO_CONTROL_326]
en-US  = "OK"

diff --git a/instsetoo_native/inc_openoffice/windows/msi_languages/RadioBut.ulf b/instsetoo_native/inc_openoffice/windows/msi_languages/RadioBut.ulf
index e311558..9bd6e44 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_languages/RadioBut.ulf
+++ b/instsetoo_native/inc_openoffice/windows/msi_languages/RadioBut.ulf
@@ -43,3 +43,9 @@ en-US = "&Anyone who uses this computer (all users)"
[OOO_RADIOBUTTON_9]
en-US = "Only for &me ([USERNAME])"

[OOO_RADIOBUTTON_10]
en-US = "&Close the applications and attempt to restart them."

[OOO_RADIOBUTTON_11]
en-US = "&Do not close applications. A reboot will be required."

diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt
index 11def31..f90d76f 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt
@@ -177,6 +177,16 @@ MaintenanceWelcome	Image	Bitmap	0	0	122	234	1		ImageBmp		
MaintenanceWelcome	Next	PushButton	230	243	66	17	3		OOO_CONTROL_148	Cancel	
MaintenanceWelcome	TextLine1	Text	135	8	225	45	65539		OOO_CONTROL_149		
MaintenanceWelcome	TextLine2	Text	135	55	228	50	65539		OOO_CONTROL_150		
MsiRMFilesInUse	Banner	Bitmap	0	0	374	44	1		BannerBmp		
MsiRMFilesInUse	DlgTitle	Text	13	6	280	15	196611		OOO_CONTROL_324		
MsiRMFilesInUse	DlgDesc	Text	21	23	272	25	196611		OOO_CONTROL_322		
MsiRMFilesInUse	BannerLine	Line	0	44	374	0	1				
MsiRMFilesInUse	DlgText	Text	21	51	326	43	3		OOO_CONTROL_323		
MsiRMFilesInUse	List	ListBox	21	95	332	85	7	FileInUseProcess			
MsiRMFilesInUse	ShutdownOption	RadioButtonGroup	26	190	305	45	3	MsiUIRMOption		OK	
MsiRMFilesInUse	DlgLine	Line	0	234	374	0	1				
MsiRMFilesInUse	OK	PushButton	230	243	66	17	3		OOO_CONTROL_326	Cancel	
MsiRMFilesInUse	Cancel	PushButton	301	243	66	17	3		OOO_CONTROL_325	ShutdownOption	
OutOfSpace	Banner	Bitmap	0	0	374	44	1		BannerBmp		
OutOfSpace	BannerLine	Line	0	44	374	0	1				
OutOfSpace	DlgDesc	Text	21	23	272	25	65539		OOO_CONTROL_153		
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/ControlE.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/ControlE.idt
index a7683a7..24301a5 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/ControlE.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/ControlE.idt
@@ -80,6 +80,9 @@ MaintenanceType	Next	Reinstall	ALL	_IsMaintenance = "Reinstall"	10
MaintenanceType	Next	ReinstallMode	[ReinstallModeText]	_IsMaintenance = "Reinstall"	9
MaintenanceWelcome	Cancel	SpawnDialog	CancelSetup	1	0
MaintenanceWelcome	Next	NewDialog	MaintenanceType	1	0
MsiRMFilesInUse	Cancel	EndDialog	Exit	1	1
MsiRMFilesInUse	OK	EndDialog	Return	1	1
MsiRMFilesInUse	OK	RMShutdownAndRestart	0	MsiUIRMOption~="UseRM"	2
OutOfSpace	Resume	NewDialog	AdminNetworkLocation	ACTION = "ADMIN"	0
OutOfSpace	Resume	NewDialog	CustomSetup	ACTION <> "ADMIN"	0
PatchWelcome	Back	NewDialog	SplashBitmap	Display_IsBitmapDlg	0
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/Dialog.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/Dialog.idt
index 1b2694a..73d6ad8 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/Dialog.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/Dialog.idt
@@ -18,6 +18,7 @@ LanguageInfo1	50	50	260	85	3	[ProductName]  - [STR_INSTALLATION_WIZARD]	OK	OK	OK
LicenseAgreement	50	50	374	266	2	[ProductName] - [STR_INSTALLATION_WIZARD]	Agree	Next	Cancel
MaintenanceType	50	50	374	266	3	[ProductName] - [STR_INSTALLATION_WIZARD]	RadioGroup	Next	Cancel
MaintenanceWelcome	50	50	374	266	3	[ProductName] - [STR_INSTALLATION_WIZARD]	Next	Next	Cancel
MsiRMFilesInUse	50	50	374	266	19	[ProductName] - [STR_INSTALLATION_WIZARD]	OK	OK	Cancel
OutOfSpace	50	50	374	266	3	[ProductName] - [STR_INSTALLATION_WIZARD]	Resume	Resume	Resume
PatchWelcome	50	50	374	266	3	[ProductName] Patch - [STR_INSTALLATION_WIZARD]	Next	Next	Cancel
ReadyToInstall	50	50	374	266	35	[ProductName] - [STR_INSTALLATION_WIZARD]	InstallNow	InstallNow	Cancel
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
index b771f8b..b167320 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
@@ -29,6 +29,8 @@ ISSCRIPT_VERSION_MISSING	IDS_ISSCRIPT_VERSION_MISSING
ISSCRIPT_VERSION_OLD	IDS_ISSCRIPT_VERSION_OLD
ISVROOT_PORT_NO	0
Manufacturer	MANUFACTURERTEMPLATE
MSIRESTARTMANAGERCONTROL	0
MsiUIRMOption	DontUseRM
PIDTemplate	12345<###-%%%%%%%>@@@@@
ProductCode	PRODUCTCODETEMPLATE
ProductID	none
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/RadioBut.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/RadioBut.idt
index a08edf3..c042587 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/RadioBut.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/RadioBut.idt
@@ -10,3 +10,5 @@ AgreeToLicense	1	No	0	15	295	15	OOO_RADIOBUTTON_6	
AgreeToLicense	2	Yes	0	0	295	15	OOO_RADIOBUTTON_7	
ApplicationUsers	1	AllUsers	1	7	290	14	OOO_RADIOBUTTON_8	
ApplicationUsers	2	OnlyCurrentUser	1	23	290	14	OOO_RADIOBUTTON_9	
MsiUIRMOption	1	UseRM	0	0	295	16	OOO_RADIOBUTTON_10	
MsiUIRMOption	2	DontUseRM	0	20	295	16	OOO_RADIOBUTTON_11