Skip Menu |

This queue is for tickets about the Visio CPAN distribution.

Report information
The Basics
Id: 86073
Status: new
Priority: 0/
Queue: Visio

People
Owner: Nobody in particular
Requestors: LSV [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: visio module patch for making corrdinates
Hello, Some times ago I did map drawer on perl with visio. I made corrdinates in my patch, so that makes visio use in perl even easy. For instance, for making corrdinates we need PinX and PinY. ..snip.. $shape{$x} = $page->create_shape({fromMaster=> $cl }); my $ran = int(rand(65535)); $shape{$x}->set_id($ran); my $coord = "<PinX>$pinx</PinX><PinY>$piny</PinY>"; $shape{$x}->set_text($left); $shape{$x}->set_xform( $coord ) ; $pinx++; $piny++; ..snip.. in my patch that implemented in set_coord(), then we can easy call it with arguments and make a coordinates, because basicaly this module to drawe shapes in one place.
Subject: visio-perl.patch
diff -upNr ./Cell.pm ./Cell.pm --- ./Cell.pm 1970-01-01 10:00:00.000000000 +1000 +++ ./Cell.pm 2009-08-06 14:27:43.132781265 +1100 -0,0 +1,68 @@ + + +package Visio::Cell; +use 5.008; +use strict; +use warnings; +use Log::Log4perl qw(get_logger); +use XML::LibXML; +use Carp; +use Data::Dumper; +use vars qw($VERSION); + + +$VERSION = sprintf "%d.%03d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/; + +my $log = get_logger('visio.cell'); + +# Preloaded methods go here. + +sub new { + my $class = shift; + my $parentN = shift; + my $self = {}; + $self->{parentN} = $parentN; + $self->{xmldoc} = $parentN->ownerDocument; + $self->{xmlroot} = $self->{xmldoc}->documentElement; + bless($self,$class); +## + my $lnNL = $self->{parentN}->findnodes('Cell'); + if ($lnNL->size() > 0) { + $self->{CellNode} = $lnNL->pop(); + $log->debug("visio cell object already exists"); + } else { + $self->{lineNode} = $self->{xmldoc}->createElement('Cell'); + #$self->{parentN}->appendChild($self->{CellNode}); + #lets create the page + $log->debug("visio line object created"); + } +## + return $self; +} + +sub get_node { + my $self = shift; + return $self->{CellNode}; +} + +sub set_CellProperty { + my $self = shift; + my $property = shift; + my $value = shift; + my $format = shift; + my $node = Visio::generic_create_node($self->{CellNode}, + $property, + ); + Visio::generic_settext($node,$value); + if (defined $format) { + $node->setAttribute('F',$format); + } + $self->{property}{$property}=$property; + return $node; +} + + + +1; +__END__ + diff -upNr ./Page.pm ./Page.pm --- ./Page.pm 2005-08-13 15:34:53.000000000 +1100 +++ ./Page.pm 2009-07-28 15:59:22.630709048 +1100 -49,6 +49,7 @@ use Carp; use Data::Dumper; use vars qw($VERSION); +use Visio::Cell; use Visio::PageSheet; use Visio::Shape; -110,6 +111,15 @@ sub create_pageSheet { } } +sub set_cell { + my $self = shift; + if (defined $self->{Cell}) { + } else { + $self->{Cell} = new Visio::Cell($self->{shapeNode}); + } + return $self->{Cell}; +} + sub create_shape { my $self = shift; my $opts = shift; diff -upNr ./Shape.pm ./Shape.pm --- ./Shape.pm 2005-08-13 15:34:53.000000000 +1100 +++ ./Shape.pm 2009-07-28 16:54:37.602724160 +1100 -53,6 +53,8 @@ use Data::Dumper; use vars qw($VERSION); use Visio::Line; +use Visio::Cell; +use Visio::Page; use Visio::Layout; use Visio::Hyperlink; -123,6 +125,24 @@ sub set_text { $textN->appendChild($textNode); } +sub set_coord { +#my ($pinx,$piny,$name) = @_; +my $pinx = shift; +my $piny = shift; +my $node = shift; +my $self = shift; + if (!defined $node) { + $log->error('$node not defined in node'); + return 0; + } + if ($node->isa('Visio::Shape')) { + $node = $node->get_id; + } + +my $oXoY = $self->{pageSelf}->set_cell; +$oXoY->setAttribute('PinX',$self->$pinx); +$oXoY->setAttribute('PinY',$self->$piny); +} sub get_line { my $self = shift;