This file is indexed.

/usr/bin/oodoc_test is in libopenoffice-oodoc-perl 2.125-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
#-----------------------------------------------------------------------------
# OpenOffice::OODoc test					2010-02-11
#-----------------------------------------------------------------------------

=head1	NAME

oodoc_test - OpenOffice::OODoc test document generation

=head1	DESCRIPTION

This utility checks the current OpenOffice::OODoc installation and generates
a test document from scratch. The generated document can then be found in the
current directory, and its name is "odftest.odt".

=cut

use strict;
use OpenOffice::OODoc;

#-----------------------------------------------------------------------------

sub	display_date
	{
	return localtime(odfTimelocal(shift));
	}

#-----------------------------------------------------------------------------

my $version	= $OpenOffice::OODoc::VERSION;
my $pkgdate	= display_date $OpenOffice::OODoc::BUILD_DATE;
my $instpath	= $OpenOffice::OODoc::INSTALLATION_PATH;

print	"OpenOffice::OODoc installation test\n  Version\t\t$version\n"	.
	"  Build date\t\t$pkgdate\n"		.
	"  Installation path\t$instpath\n";

my $generator	=	"OpenOffice::OODoc " . $OpenOffice::OODoc::VERSION .
				" installation test";
my $testfile    =       $ARGV[0]        ||
                        (
                        $OpenOffice::OODoc::File::DEFAULT_OFFICE_FORMAT == 2 ?
				"odftest.odt" : "ootest.sxw"
			);
my $class	=	"text";
my $image_file	=	"$instpath/data/image.png";
my $image_size	=	"60mm, 82mm";
my $test_date	=	odfLocaltime();

print "Generating $testfile file\n";

# Creating an empty new ODF file with the default template
# unlink $testfile;
my $archive = odfContainer($testfile, create => 'text');
unless ($archive)
	{
	die "# Unable to create the test file\n";
	}
	
#-----------------------------------------------------------------------------

my $notice	= 
"This document has been generated by the OpenOffice::OODoc " .
"installation test. If you can read this paragraph in blue letters with " .
"a yellow background, if you can see a centered image at the top of the " .
"page, and if the informations below make sense, " .
"your installation is probably OK.";

my $title	= "OpenOffice::OODoc test document";
my $description	= "Generated by $generator";

# Opening the content using OpenOffice::OODoc::Document
my $doc	= odfConnector
		(
		container	=> $archive,
		part		=> 'content',
		readable_XML	=> 'true'
		)
	or die "# Unable to find a regular document content\n";

my $styles = odfConnector
		(
		container	=> $archive,
		part		=> 'styles',
		readable_XML	=> 'true'
		)
	or die "# Unable to get the styles\n";

# Creating a graphic style
$styles->createImageStyle
	(
	'Centered Image',
	properties	=>
			{
			'horizontal-pos'	=> 'center',
			'vertical-pos'	        => 'from-top',
			'wrap'                  => 'none',
			'fo:margin-bottom'	=> '1cm'
			}
	);
# Inserting an image in the document
$doc->createImageElement
	(
		'Logo',
		style		=> 'Centered Image',
		page		=> 1,
		size		=> $image_size,
		import		=> $image_file
	);

# Appending a page footer
$styles->createStyle
	(
	'Centered Paragraph',
	family		=> 'paragraph',
	parent		=> 'Standard',
	properties	=>
		{
		'fo:text-align'		=> 'center'
		}
	);
$styles->styleProperties
	(
	'Centered Paragraph',
	area		=> 'text',
	'fo:font-size'	=> '60%'
	);
$styles->masterPageFooter
	(
	'Standard',
	$styles->createParagraph
			(
			"Created by OpenOffice::OODoc\n" . localtime(),
			'Centered Paragraph'
			)
	);
# Appending a level 1 heading
$doc->appendHeading
	(
	text	=> "Congratulations !",
	level	=> "1",
	style	=> "Heading_20_1"
	);

# Creating a coloured paragraph style (blue foreground, yellow background)
$styles->createStyle
	(
	"Colour",
	family		=> 'paragraph',
	parent		=> 'Standard',
	properties	=>
			{
			-area			=> 'paragraph',
			'fo:color'		=> odfColor(0,0,128),
			'fo:background-color'	=> odfColor("yellow"),
			'fo:text-align'		=> 'justify'
			}
	);
if ($doc->isOpenDocument)
	{
	$styles->styleProperties
		("Colour", -area => 'text', 'fo:color' => '#000080');
	}
# Appending another paragraph using the new style
my $pg = $doc->appendParagraph(text => $notice, style => "Colour" );

# Appending another level 1 heading
$doc->appendHeading
	(
	text	=> "Your environment",
	level	=> 1,
	style	=> "Heading_20_1"
	);
# Appending a table showing some environment details
my $table = $doc->appendTable("Environment", 6, 2);
$doc->cellValue($table, "A1", "Platform");
$doc->cellValue($table, "B1", $^O);
$doc->cellValue($table, "A2", "Perl version");
$doc->cellValue($table, "B2", $]);
$doc->cellValue($table, "A3", "Archive::Zip version");
$doc->cellValue($table, "B3", $Archive::Zip::VERSION);
$doc->cellValue($table, "A4", "XML::Twig version");
$doc->cellValue($table, "B4", $XML::Twig::VERSION);
$doc->cellValue($table, "A5", "OpenOffice::OODoc version");
$doc->cellValue($table, "B5", $OpenOffice::OODoc::VERSION);
$doc->cellValue($table, "A6", "OpenOffice::OODoc build");
$doc->cellValueType($table, "B6", 'date');
$doc->cellValue($table, "B6", $OpenOffice::OODoc::BUILD_DATE);

# Appending another level 1 heading
$doc->appendHeading
	(
	text	=> "Your installation choices",
	level	=> 1,
	style	=> "Heading_20_1"
	);

# Appending a table with the installation parameters
my $office_format = $OpenOffice::OODoc::File::DEFAULT_OFFICE_FORMAT == 2 ?
	"OASIS Open Document" : "OpenOffice.org 1.0";
my $color_map	= $OpenOffice::OODoc::Styles::COLORMAP || "<none>";
$table = $doc->appendTable("Choices", 4, 2);
$doc->cellValue($table, "A1", "Local character set");
$doc->cellValue($table, "B1", $OpenOffice::OODoc::XPath::LOCAL_CHARSET);
$doc->cellValue($table, "A2", "Working directory");
$doc->cellValue($table, "B2", $OpenOffice::OODoc::File::WORKING_DIRECTORY);
$doc->cellValue($table, "A3", "RGB color map");
$doc->cellValue($table, "B3", $color_map);
$doc->cellValue($table, "A4", "Default office document format");
$doc->cellValue($table, "B4", $office_format);

# Opening the metadata of the document
my $meta = odfMeta(container => $archive, readable_XML => 'on')
	or die "# Unable to find regular metadata\n";
# Writing some metadata elements
$meta->title($title);
$meta->creator($ENV{'USER'});
$meta->initial_creator($ENV{'USER'});
$meta->description($description);
$meta->generator($generator);
$meta->creation_date($test_date);
$meta->date($test_date);
$meta->removeUserProperties();
$meta->setUserProperty("Application", type => 'string', value => "oodoc_test");
$meta->setUserProperty("Test date", type => 'date', value => $test_date);

# Saving the $testfile file
print "Saving $testfile file\n";
$archive->save;

$doc->dispose;
$styles->dispose;
$meta->dispose;

exit 0;