Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / drawingml / customshapes / generatePresetsData.pl
blob99b2ff153036fb039a91f8a8a42cead3620afcee
1 #!/usr/bin/env perl
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/.
10 sub loadData()
12 open (IN, "<custom-shapes.log");
14 my %sources;
16 while (<IN>)
18 if (/==csdata== /)
20 if (/shape name: '/)
22 chop;
23 s/.*shape name: '([^']+)'.*/$1/;
24 $name = $_;
26 else
28 if (/==csdata== begin/)
30 $inside = true;
31 @code = ();
33 else
35 if (/==csdata== end/)
37 s/^ <\/([^>]+)>/$1/;
38 undef $inside;
39 $sources{$name} = [ @code ];
44 else
46 if ($inside)
48 push @code, $_;
53 close (IN);
55 return \%sources;
58 sub generateData
60 my $sources = shift;
61 open (OUT, ">oox-drawingml-cs-presets");
63 foreach $shape (sort(keys %$sources))
65 printf OUT "/* %s */\n", $shape;
66 print OUT @{$sources->{$shape}};
69 close OUT;
72 generateData(loadData());
74 # vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: #