From: Rob Kinyon Date: Fri, 2 Jun 2006 20:20:53 +0000 (+0000) Subject: r13925@rob-kinyons-powerbook58: rob | 2006-06-02 14:29:05 -0400 X-Git-Tag: v0.27~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FExcel-Template.git;a=commitdiff_plain;h=cf663350e6c614cc3704206b1389f1215ce481f5 r13925@rob-kinyons-powerbook58: rob | 2006-06-02 14:29:05 -0400 Added FreezePanes and completed Image --- diff --git a/Changes b/Changes index 63f260c..251ae25 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ Revision history for Perl distribution Excel::Template 0.26 Thu Jun 01 17:00:00 2005 - Fixed how widths are whitelisted to allow '.' for fractions + - Fixed how certain formats are copied + - Added + - Added 0.25 Thu May 26 11:00:00 2005 - Changed how the template file is opened to use 3-arg open() if available diff --git a/MANIFEST b/MANIFEST index 5fc2f97..5a83c33 100644 --- a/MANIFEST +++ b/MANIFEST @@ -31,6 +31,7 @@ lib/Excel/Template/Container/Worksheet.pm lib/Excel/Template/Element/Backref.pm lib/Excel/Template/Element/Cell.pm lib/Excel/Template/Element/Formula.pm +lib/Excel/Template/Element/FreezePanes.pm lib/Excel/Template/Element/Image.pm lib/Excel/Template/Element/Range.pm lib/Excel/Template/Element/Var.pm @@ -73,6 +74,7 @@ t/021_loop_error.t t/022_keep_leading_zeros.t t/023_relative_values.t t/024_image.t +t/025_freezepanes.t t/998_pod.t t/999_pod_coverage.t t/mock.pm diff --git a/lib/Excel/Template/Element/Image.pm b/lib/Excel/Template/Element/Image.pm index 2817ad4..dd9b9dd 100644 --- a/lib/Excel/Template/Element/Image.pm +++ b/lib/Excel/Template/Element/Image.pm @@ -13,10 +13,9 @@ sub render { my $self = shift; my ($context) = @_; - my $path = $context->get( $self, 'PATH' ); - my ($row, $col, $offset, $scale) = map { + my ($row, $col, $path, $offset, $scale) = map { $context->get($self, $_) - } qw( ROW COL OFFSET SCALE ); + } qw( ROW COL PATH OFFSET SCALE ); my @offsets = (0,0); if ( $offset =~ /^\s*([\d.]+)\s*,\s*([\d.]+)/ ) { @@ -28,7 +27,7 @@ sub render { @scales = ($1,$2); } - $context->active_worksheet->insert_image( + $context->active_worksheet->insert_bitmap( $row, $col, $path, @offsets, @scales, ); @@ -54,12 +53,16 @@ To insert an image into the worksheet =head1 NODE NAME -CELL +IMAGE =head1 INHERITANCE L +=head1 EFFECTS + +This will consume one column in the current row. + =head1 DEPENDENCIES None @@ -73,6 +76,8 @@ None Please see L for more information about the offset and scaling options as well as any other restrictions that might be in place. This node does B perform any sort of validation upon your parameters. You are assumed to know what you are doing. +Note that the offset and scaling values are "X,Y". You I provide both values, even if the Y value is 0. If you provide a 0 value for either scaling option, L will default that to 1. + =head1 AUTHOR Rob Kinyon (rob.kinyon@gmail.com) diff --git a/lib/Excel/Template/Factory.pm b/lib/Excel/Template/Factory.pm index 3c86dc0..ed87510 100644 --- a/lib/Excel/Template/Factory.pm +++ b/lib/Excel/Template/Factory.pm @@ -12,12 +12,13 @@ my %Manifest = ( 'WORKBOOK' => 'Excel::Template::Container::Workbook', 'WORKSHEET' => 'Excel::Template::Container::Worksheet', - 'BACKREF' => 'Excel::Template::Element::Backref', - 'CELL' => 'Excel::Template::Element::Cell', - 'FORMULA' => 'Excel::Template::Element::Formula', - 'IMAGE' => 'Excel::Template::Element::Image', - 'RANGE' => 'Excel::Template::Element::Range', - 'VAR' => 'Excel::Template::Element::Var', + 'BACKREF' => 'Excel::Template::Element::Backref', + 'CELL' => 'Excel::Template::Element::Cell', + 'FORMULA' => 'Excel::Template::Element::Formula', + 'FREEZEPANES' => 'Excel::Template::Element::FreezePanes', + 'IMAGE' => 'Excel::Template::Element::Image', + 'RANGE' => 'Excel::Template::Element::Range', + 'VAR' => 'Excel::Template::Element::Var', 'FORMAT' => 'Excel::Template::Container::Format', @@ -49,7 +50,7 @@ my %isBuildable = map { $_ => ~~1 } qw( WORKBOOK WORKSHEET FORMAT BOLD HIDDEN ITALIC LOCKED OUTLINE SHADOW STRIKEOUT IF ROW LOOP SCOPE KEEP_LEADING_ZEROS - CELL FORMULA IMAGE + CELL FORMULA FREEZEPANES IMAGE VAR BACKREF RANGE ); diff --git a/t/024_image.t b/t/024_image.t index 0d5b33e..a0a344a 100644 --- a/t/024_image.t +++ b/t/024_image.t @@ -24,11 +24,11 @@ Spreadsheet::WriteExcel::add_format( '' ) Spreadsheet::WriteExcel::add_worksheet( '' ) Spreadsheet::WriteExcel::Worksheet::new( '' ) Spreadsheet::WriteExcel::Worksheet::write( '0', '0', 'before', '1' ) -Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '1', '/full/path', '0', '0', '0', '0' ) +Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '1', '/full/path', '0', '0', '0', '0' ) Spreadsheet::WriteExcel::Worksheet::write( '0', '2', 'after', '1' ) -Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '3', '/full/path', '2', '2', '0', '0' ) -Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '4', '/full/path', '0', '0', '2', '2' ) -Spreadsheet::WriteExcel::Worksheet::insert_image( '0', '5', '/full/path', '0', '1', '1.1', '0' ) +Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '3', '/full/path', '2', '2', '0', '0' ) +Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '4', '/full/path', '0', '0', '2', '2' ) +Spreadsheet::WriteExcel::Worksheet::insert_bitmap( '0', '5', '/full/path', '0', '1', '1.1', '0' ) Spreadsheet::WriteExcel::close( '' ) __END_EXPECTED__ @@ -43,4 +43,3 @@ __DATA__ - diff --git a/t/Spreadsheet/WriteExcel/Worksheet.pm b/t/Spreadsheet/WriteExcel/Worksheet.pm index 2f6428a..a3e6d16 100644 --- a/t/Spreadsheet/WriteExcel/Worksheet.pm +++ b/t/Spreadsheet/WriteExcel/Worksheet.pm @@ -97,12 +97,21 @@ sub keep_leading_zeros { } } -sub insert_image { +sub insert_bitmap { my $self = shift; { local $" = "', '"; - push @mock::calls, __PACKAGE__ . "::insert_image( '@_' )"; + push @mock::calls, __PACKAGE__ . "::insert_bitmap( '@_' )"; + } +} + +sub freeze_panes { + my $self = shift; + + { + local $" = "', '"; + push @mock::calls, __PACKAGE__ . "::freeze_panes( '@_' )"; } }