merge the formfield patch from ooo-build
[ooovba.git] / sysui / desktop / macosx / list_icons.pl
blobfc498c272d2452e92f9230df22a77776e55b4490
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 #*************************************************************************
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 #
9 # Copyright 2008 by Sun Microsystems, Inc.
11 # OpenOffice.org - a multi-platform office productivity suite
13 # $RCSfile: list_icons.pl,v $
15 # $Revision: 1.3 $
17 # This file is part of OpenOffice.org.
19 # OpenOffice.org is free software: you can redistribute it and/or modify
20 # it under the terms of the GNU Lesser General Public License version 3
21 # only, as published by the Free Software Foundation.
23 # OpenOffice.org is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU Lesser General Public License version 3 for more details
27 # (a copy is included in the LICENSE file that accompanied this code).
29 # You should have received a copy of the GNU Lesser General Public License
30 # version 3 along with OpenOffice.org. If not, see
31 # <http://www.openoffice.org/license.html>
32 # for a copy of the LGPLv3 License.
34 #*************************************************************************
36 use warnings;
37 use strict 'vars';
39 # package all .icns if XML::Parser module is not installed
40 eval 'use XML::Parser;'; if ( $@ ) { print '*.icns'; exit 0; };
42 my $valuetype = "none";
43 my $key = "none";
46 # XML handlers
49 sub start_handler {
50 my ($parser,$element,%attributes) = @_;
51 $valuetype = "$element";
54 sub char_handler {
55 my ($parser,$string) = @_;
56 if ( $key eq "CFBundleTypeIconFile" || $key eq "CFBundleIconFile" ) {
57 $string =~ s/^\s+//;
58 $string =~ s/\s+$//;
59 print "$string " if length($string) > 0;
61 $key = "$string" if $valuetype eq "key";
64 sub default_handler {
65 my ($parser,$string) = @_;
68 sub end_handler {
69 my ($parser,$element) = @_;
71 $key = "none" if $valuetype ne "key";
72 $valuetype = "none";
76 # main
79 my $parser = new XML::Parser(ErrorContext => 2,
80 Namespaces => 1);
82 $parser->setHandlers( Start => \&start_handler,
83 End => \&end_handler,
84 Char => \&char_handler,
85 Default => \&default_handler);
86 $parser->parse(STDIN);
88 print "\n";