2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer
::windows
::property
;
21 use installer
::exiter
;
23 use installer
::globals
;
24 use installer
::windows
::idtglobal
;
25 use installer
::windows
::language
;
27 #############################################
28 # Setting the properties dynamically
29 # for the table Property.idt
30 #############################################
32 sub get_arpcomments_for_property_table
34 my ( $allvariables, $languagestringref ) = @_;
36 my $name = $allvariables->{'PRODUCTNAME'};
37 my $version = $allvariables->{'PRODUCTVERSION'};
38 my $comment = $name . " " . $version;
40 my $postversionextension = "";
41 if ( $allvariables->{'POSTVERSIONEXTENSION'} )
43 $postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
44 $comment = $comment . " " . $postversionextension;
47 if ( $installer::globals
::languagepack
) { $comment = $comment . " " . "Language Pack"; }
48 elsif ( $installer::globals
::helppack
) { $comment = $comment . " " . "Help Pack"; }
50 my $languagestring = $$languagestringref;
51 $languagestring =~ s/\_/\,/g;
52 if ( length($languagestring) > 30 ) { $languagestring = "multilanguage"; } # fdo#64053
54 $comment = $comment . " ($languagestring)";
59 sub get_installlevel_for_property_table
61 my $installlevel = "100";
65 sub get_ischeckforproductupdates_for_property_table
67 my $ischeckforproductupdates = "1";
68 return $ischeckforproductupdates;
71 sub get_manufacturer_for_property_table
73 return $installer::globals
::manufacturer
;
76 sub get_productlanguage_for_property_table
79 my $windowslanguage = installer
::windows
::language
::get_windows_language
($language);
80 return $windowslanguage;
83 sub get_language_string
87 for ( my $i = 0; $i <= $#installer::globals
::languagenames
; $i++ )
89 $langstring = $langstring . $installer::globals
::languagenames
[$i] . ", ";
92 $langstring =~ s/\,\s*$//;
93 $langstring = "(" . $langstring . ")";
98 sub get_english_language_string
102 # Sorting value not keys, therefore collecting all values
104 foreach my $lang ( keys %installer::globals
::all_required_english_languagestrings
)
106 $helper{$installer::globals
::all_required_english_languagestrings
{$lang}} = 1;
109 foreach my $lang ( sort keys %helper )
111 $langstring = $langstring . $lang . ", ";
114 $langstring =~ s/\,\s*$//;
115 $langstring = "(" . $langstring . ")";
120 sub get_productname
($$)
122 my ( $language, $allvariables ) = @_;
124 my $name = $allvariables->{'PRODUCTNAME'};
129 sub get_productname_for_property_table
($$)
131 my ( $language, $allvariables ) = @_;
133 my $name = get_productname
($language, $allvariables);
134 my $version = $allvariables->{'PRODUCTVERSION'};
135 my $productname = $name . " " . $version;
137 my $productextension = "";
138 if ( $allvariables->{'PRODUCTEXTENSION'} )
140 $productextension = $allvariables->{'PRODUCTEXTENSION'};
141 $productname = $productname . $productextension;
144 my $postversionextension = "";
145 if ( $allvariables->{'POSTVERSIONEXTENSION'} )
147 $postversionextension = $allvariables->{'POSTVERSIONEXTENSION'};
148 $productname = $productname . " " . $postversionextension;
151 if ( $installer::globals
::languagepack
)
153 my $langstring = get_english_language_string
(); # Example: (English, German)
154 $productname = $name . " " . $version . " Language Pack" . " " . $langstring;
156 elsif ( $installer::globals
::helppack
)
158 my $langstring = get_english_language_string
(); # New: (English, German)
159 $productname = $name . " " . $version . " Help Pack" . " " . $langstring;
162 # Saving this name in hash $allvariables for further usage
163 $allvariables->{'PROPERTYTABLEPRODUCTNAME'} = $productname;
164 my $infoline = "Defined variable PROPERTYTABLEPRODUCTNAME: $productname\n";
165 push(@installer::globals
::logfileinfo
, $infoline);
170 sub get_quickstarterlinkname_for_property_table
($$)
172 my ( $language, $allvariables ) = @_;
174 # no usage of POSTVERSIONEXTENSION for Quickstarter link name!
175 my $name = get_productname
($language, $allvariables);
176 my $version = $allvariables->{'PRODUCTVERSION'};
177 my $quickstartername = $name . " " . $version;
179 my $infoline = "Defined Quickstarter Link name: $quickstartername\n";
180 push(@installer::globals
::logfileinfo
, $infoline);
182 return $quickstartername;
185 sub get_productversion_for_property_table
187 return $installer::globals
::msiproductversion
;
190 #######################################################
191 # Setting some important properties
192 # (for finding the product in deinstallation process)
193 #######################################################
195 sub set_important_properties
197 my ($propertyfile, $allvariables, $languagestringref) = @_;
199 # Setting new variables with the content of %PRODUCTNAME and %PRODUCTVERSION
200 if ( $allvariables->{'PRODUCTNAME'} )
202 my $onepropertyline = "DEFINEDPRODUCT" . "\t" . $allvariables->{'PRODUCTNAME'} . "\n";
203 push(@
{$propertyfile}, $onepropertyline);
206 if ( $allvariables->{'PRODUCTVERSION'} )
208 my $onepropertyline = "DEFINEDVERSION" . "\t" . $allvariables->{'PRODUCTVERSION'} . "\n";
209 push(@
{$propertyfile}, $onepropertyline);
212 if (( $allvariables->{'PRODUCTNAME'} ) && ( $allvariables->{'PRODUCTVERSION'} ) && ( $allvariables->{'REGISTRYLAYERNAME'} ))
214 my $onepropertyline = "FINDPRODUCT" . "\t" . "Software\\LibreOffice" . "\\" . $allvariables->{'REGISTRYLAYERNAME'} . "\\" . $allvariables->{'PRODUCTNAME'} . "\\" . $allvariables->{'PRODUCTVERSION'} . "\n";
215 push(@
{$propertyfile}, $onepropertyline);
218 if ( $allvariables->{'PRODUCTMAJOR'} )
220 my $onepropertyline = "PRODUCTMAJOR" . "\t" . $allvariables->{'PRODUCTMAJOR'} . "\n";
221 push(@
{$propertyfile}, $onepropertyline);
224 if ( $allvariables->{'PRODUCTMINOR'} )
226 my $onepropertyline = "PRODUCTMINOR" . "\t" . $allvariables->{'PRODUCTMINOR'} . "\n";
227 push(@
{$propertyfile}, $onepropertyline);
230 if ( $allvariables->{'PRODUCTBUILDID'} )
232 my $onepropertyline = "PRODUCTBUILDID" . "\t" . $allvariables->{'PRODUCTBUILDID'} . "\n";
233 push(@
{$propertyfile}, $onepropertyline);
236 if ( $allvariables->{'URELAYERVERSION'} )
238 my $onepropertyline = "URELAYERVERSION" . "\t" . $allvariables->{'URELAYERVERSION'} . "\n";
239 push(@
{$propertyfile}, $onepropertyline);
242 if ( $allvariables->{'BRANDPACKAGEVERSION'} )
244 my $onepropertyline = "BRANDPACKAGEVERSION" . "\t" . $allvariables->{'BRANDPACKAGEVERSION'} . "\n";
245 push(@
{$propertyfile}, $onepropertyline);
248 if ( $allvariables->{'EXCLUDE_FROM_REBASE'} )
250 my $onepropertyline = "EXCLUDE_FROM_REBASE" . "\t" . $allvariables->{'EXCLUDE_FROM_REBASE'} . "\n";
251 push(@
{$propertyfile}, $onepropertyline);
254 if ( $allvariables->{'PREREQUIREDPATCH'} )
256 my $onepropertyline = "PREREQUIREDPATCH" . "\t" . $allvariables->{'PREREQUIREDPATCH'} . "\n";
257 push(@
{$propertyfile}, $onepropertyline);
260 my $onepropertyline = "IGNOREPREREQUIREDPATCH" . "\t" . "1" . "\n";
261 push(@
{$propertyfile}, $onepropertyline);
263 $onepropertyline = "DONTOPTIMIZELIBS" . "\t" . "0" . "\n";
264 push(@
{$propertyfile}, $onepropertyline);
266 if ( $installer::globals
::officedirhostname
)
268 my $onepropertyline = "OFFICEDIRHOSTNAME" . "\t" . $installer::globals
::officedirhostname
. "\n";
269 push(@
{$propertyfile}, $onepropertyline);
271 my $localofficedirhostname = $installer::globals
::officedirhostname
;
272 $localofficedirhostname =~ s/\//\\/g
;
273 $onepropertyline = "OFFICEDIRHOSTNAME_" . "\t" . $localofficedirhostname . "\n";
274 push(@
{$propertyfile}, $onepropertyline);
277 if ( $installer::globals
::desktoplinkexists
)
279 my $onepropertyline = "DESKTOPLINKEXISTS" . "\t" . "1" . "\n";
280 push(@
{$propertyfile}, $onepropertyline);
282 $onepropertyline = "CREATEDESKTOPLINK" . "\t" . "1" . "\n"; # Setting the default
283 push(@
{$propertyfile}, $onepropertyline);
286 if ( $installer::globals
::languagepack
)
288 my $onepropertyline = "ISLANGUAGEPACK" . "\t" . "1" . "\n";
289 push(@
{$propertyfile}, $onepropertyline);
291 elsif ( $installer::globals
::helppack
)
293 my $onepropertyline = "ISHELPPACK" . "\t" . "1" . "\n";
294 push(@
{$propertyfile}, $onepropertyline);
297 my $languagesline = "PRODUCTALLLANGUAGES" . "\t" . $$languagestringref . "\n";
298 push(@
{$propertyfile}, $languagesline);
300 if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
302 # my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
303 # push(@{$propertyfile}, $registryline);
304 my $betainfoline = "BETAPRODUCT" . "\t" . "1" . "\n";
305 push(@
{$propertyfile}, $betainfoline);
307 elsif ( $allvariables->{'DEVELOPMENTPRODUCT'} )
309 my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n";
310 push(@
{$propertyfile}, $registryline);
314 my $registryline = "WRITE_REGISTRY" . "\t" . "1" . "\n"; # Default: Write complete registry
315 push(@
{$propertyfile}, $registryline);
318 # Adding also used tree conditions for multilayer products.
319 # These are saved in %installer::globals::usedtreeconditions
320 foreach my $treecondition (keys %installer::globals
::usedtreeconditions
)
322 my $onepropertyline = $treecondition . "\t" . "1" . "\n";
323 push(@
{$propertyfile}, $onepropertyline);
326 # No more license dialog for selected products
327 if ( $allvariables->{'HIDELICENSEDIALOG'} )
329 my $onepropertyline = "HIDEEULA" . "\t" . "1" . "\n";
331 my $already_defined = 0;
333 for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
335 if ( ${$propertyfile}[$i] =~ /^\s*HIDEEULA\t/ )
337 ${$propertyfile}[$i] = $onepropertyline;
338 $already_defined = 1;
343 if ( ! $already_defined )
345 push(@
{$propertyfile}, $onepropertyline);
350 #######################################################
351 # Setting properties needed for ms file type registration
352 #######################################################
354 sub set_ms_file_types_properties
356 my ($propertyfile) = @_;
358 # we do not register PPSM, PPAM, and XLAM file types in
359 # setup_native\source\win32\customactions\reg4allmsdoc\reg4allmsi.cxx
360 # (probably because LibreOffice can't deal with them properly (?)
362 push(@
{$propertyfile}, "REGISTER_PPS" . "\t" . "0" . "\n");
363 push(@
{$propertyfile}, "REGISTER_PPSX" . "\t" . "0" . "\n");
364 # push(@{$propertyfile}, "REGISTER_PPSM" . "\t" . "0" . "\n");
365 # push(@{$propertyfile}, "REGISTER_PPAM" . "\t" . "0" . "\n");
366 push(@
{$propertyfile}, "REGISTER_PPT" . "\t" . "0" . "\n");
367 push(@
{$propertyfile}, "REGISTER_PPTX" . "\t" . "0" . "\n");
368 push(@
{$propertyfile}, "REGISTER_PPTM" . "\t" . "0" . "\n");
369 push(@
{$propertyfile}, "REGISTER_POT" . "\t" . "0" . "\n");
370 push(@
{$propertyfile}, "REGISTER_POTX" . "\t" . "0" . "\n");
371 push(@
{$propertyfile}, "REGISTER_POTM" . "\t" . "0" . "\n");
373 push(@
{$propertyfile}, "REGISTER_DOC" . "\t" . "0" . "\n");
374 push(@
{$propertyfile}, "REGISTER_DOCX" . "\t" . "0" . "\n");
375 push(@
{$propertyfile}, "REGISTER_DOCM" . "\t" . "0" . "\n");
376 push(@
{$propertyfile}, "REGISTER_DOT" . "\t" . "0" . "\n");
377 push(@
{$propertyfile}, "REGISTER_DOTX" . "\t" . "0" . "\n");
378 push(@
{$propertyfile}, "REGISTER_DOTM" . "\t" . "0" . "\n");
379 push(@
{$propertyfile}, "REGISTER_RTF" . "\t" . "0" . "\n");
381 push(@
{$propertyfile}, "REGISTER_XLS" . "\t" . "0" . "\n");
382 push(@
{$propertyfile}, "REGISTER_XLSX" . "\t" . "0" . "\n");
383 push(@
{$propertyfile}, "REGISTER_XLSM" . "\t" . "0" . "\n");
384 push(@
{$propertyfile}, "REGISTER_XLSB" . "\t" . "0" . "\n");
385 # push(@{$propertyfile}, "REGISTER_XLAM" . "\t" . "0" . "\n");
386 push(@
{$propertyfile}, "REGISTER_XLT" . "\t" . "0" . "\n");
387 push(@
{$propertyfile}, "REGISTER_XLTX" . "\t" . "0" . "\n");
388 push(@
{$propertyfile}, "REGISTER_XLTM" . "\t" . "0" . "\n");
390 push(@
{$propertyfile}, "REGISTER_NO_MSO_TYPES" . "\t" . "0" . "\n");
391 push(@
{$propertyfile}, "REGISTER_ALL_MSO_TYPES" . "\t" . "0" . "\n");
394 ####################################################################################
395 # Updating the file Property.idt dynamically
398 ####################################################################################
400 sub update_property_table
402 my ($basedir, $language, $allvariables, $languagestringref) = @_;
404 my $properyfilename = $basedir . $installer::globals
::separator
. "Property.idt";
406 my $propertyfile = installer
::files
::read_file
($properyfilename);
408 my $hasarpnomodify = 0;
410 # Getting the new values
411 # Some values (arpcomments, arpcontacts, ...) are inserted from the Property.mlf
413 my $arpcomments = get_arpcomments_for_property_table
($allvariables, $languagestringref);
414 my $installlevel = get_installlevel_for_property_table
();
415 my $ischeckforproductupdates = get_ischeckforproductupdates_for_property_table
();
416 my $manufacturer = get_manufacturer_for_property_table
();
417 my $productlanguage = get_productlanguage_for_property_table
($language);
418 my $productname = get_productname_for_property_table
($language, $allvariables);
419 my $productversion = get_productversion_for_property_table
();
420 my $quickstarterlinkname = get_quickstarterlinkname_for_property_table
($language, $allvariables);
421 my $windowsminversiontext = "Windows Vista";
422 my $windowsminversionnumber = "600";
424 if ( $allvariables->{'WINDOWSSDKVERSION'} eq '70' )
426 $windowsminversiontext = "Windows XP";
427 $windowsminversionnumber = "501";
430 # Updating the values
432 for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
434 ${$propertyfile}[$i] =~ s/\bARPCOMMENTSTEMPLATE\b/$arpcomments/;
435 ${$propertyfile}[$i] =~ s/\bINSTALLLEVELTEMPLATE\b/$installlevel/;
436 ${$propertyfile}[$i] =~ s/\bISCHECKFORPRODUCTUPDATESTEMPLATE\b/$ischeckforproductupdates/;
437 ${$propertyfile}[$i] =~ s/\bMANUFACTURERTEMPLATE\b/$manufacturer/;
438 ${$propertyfile}[$i] =~ s/\bPRODUCTLANGUAGETEMPLATE\b/$productlanguage/;
439 ${$propertyfile}[$i] =~ s/\bPRODUCTNAMETEMPLATE\b/$productname/;
440 ${$propertyfile}[$i] =~ s/\bPRODUCTVERSIONTEMPLATE\b/$productversion/;
441 ${$propertyfile}[$i] =~ s/\bQUICKSTARTERLINKNAMETEMPLATE\b/$quickstarterlinkname/;
442 ${$propertyfile}[$i] =~ s/\bWINDOWSMINVERSIONTEXTTEMPLATE\b/$windowsminversiontext/;
443 ${$propertyfile}[$i] =~ s/\bWINDOWSMINVERSIONNUMBERTEMPLATE\b/$windowsminversionnumber/;
444 if ( ${$propertyfile}[$i] =~ m/\bARPNOMODIFY\b/ ) { $hasarpnomodify = 1; }
447 # Check if are building silent MSI
448 if ( $ENV{ENABLE_SILENT_MSI
} eq "TRUE" )
450 push(@
{$propertyfile}, "LIMITUI" . "\t" . "1" . "\n");
451 if ( !($hasarpnomodify) )
453 push(@
{$propertyfile}, "ARPNOMODIFY" . "\t" . "1" . "\n");
457 # Setting variables into propertytable
458 set_important_properties
($propertyfile, $allvariables, $languagestringref);
460 # Setting variables for register for ms file types
461 set_ms_file_types_properties
($propertyfile);
465 installer
::files
::save_file
($properyfilename ,$propertyfile);
466 my $infoline = "Updated idt file: $properyfilename\n";
467 push(@installer::globals
::logfileinfo
, $infoline);
471 ####################################################################################
472 # Setting language specific Properties in file Property.idt dynamically
475 ####################################################################################
477 sub set_languages_in_property_table
479 my ($basedir, $languagesarrayref) = @_;
481 my $properyfilename = $basedir . $installer::globals
::separator
. "Property.idt";
482 my $propertyfile = installer
::files
::read_file
($properyfilename);
484 # Setting the info about multilingual installation in property "isMulti"
486 my $propertyname = "isMulti";
487 my $ismultivalue = 0;
489 if ( $installer::globals
::ismultilingual
) { $ismultivalue = 1; }
491 my $onepropertyline = $propertyname . "\t" . $ismultivalue . "\n";
492 push(@
{$propertyfile}, $onepropertyline);
494 # setting the ARPPRODUCTICON
496 if ($installer::globals
::sofficeiconadded
) # set in shortcut.pm
498 $onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.ico" . "\n";
499 push(@
{$propertyfile}, $onepropertyline);
504 installer
::files
::save_file
($properyfilename ,$propertyfile);
505 my $infoline = "Added language content into idt file: $properyfilename\n";
506 push(@installer::globals
::logfileinfo
, $infoline);
510 ############################################################
511 # Setting the ProductCode and the UpgradeCode
512 # into the Property table. Both have to be stored
513 # in the global file $installer::globals::codefilename
514 ############################################################
516 sub set_codes_in_property_table
520 # Reading the property file
522 my $properyfilename = $basedir . $installer::globals
::separator
. "Property.idt";
523 my $propertyfile = installer
::files
::read_file
($properyfilename);
525 # Updating the values
527 for ( my $i = 0; $i <= $#{$propertyfile}; $i++ )
529 ${$propertyfile}[$i] =~ s/\bPRODUCTCODETEMPLATE\b/$installer::globals::productcode/;
530 ${$propertyfile}[$i] =~ s/\bUPGRADECODETEMPLATE\b/$installer::globals::upgradecode/;
533 # Saving the property file
535 installer
::files
::save_file
($properyfilename ,$propertyfile);
536 my $infoline = "Added language content into idt file: $properyfilename\n";
537 push(@installer::globals
::logfileinfo
, $infoline);
541 ############################################################
542 # Changing default for MS file type registration
544 ############################################################
546 sub update_checkbox_table
548 my ($basedir, $allvariables) = @_;
550 if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" ))
552 my $checkboxfilename = $basedir . $installer::globals
::separator
. "CheckBox.idt";
554 if ( -f
$checkboxfilename )
556 my $checkboxfile = installer
::files
::read_file
($checkboxfilename);
558 my $checkboxline = "SELECT_WORD" . "\t" . "0" . "\n";
559 push(@
{$checkboxfile}, $checkboxline);
560 $checkboxline = "SELECT_EXCEL" . "\t" . "0" . "\n";
561 push(@
{$checkboxfile}, $checkboxline);
562 $checkboxline = "SELECT_POWERPOINT" . "\t" . "0" . "\n";
563 push(@
{$checkboxfile}, $checkboxline);
564 $checkboxline = "SELECT_VISIO" . "\t" . "0" . "\n";
565 push(@
{$checkboxfile}, $checkboxline);
567 # Saving the property file
568 installer
::files
::save_file
($checkboxfilename ,$checkboxfile);
569 my $infoline = "Added ms file type defaults into idt file: $checkboxfilename\n";
570 push(@installer::globals
::logfileinfo
, $infoline);