| 1 | package Visio::Line; | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | |||||||||||
| 5 | #PLEASE SEE MSPATENTLICENSE | ||||||||||
| 6 | # "This product may incorporate intellectual property owned by | ||||||||||
| 7 | # Microsoft Corporation. The terms and conditions upon which Microsoft | ||||||||||
| 8 | # is licensing such intellectual property may be found at | ||||||||||
| 9 | # http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp" | ||||||||||
| 10 | |||||||||||
| 11 | # Copyright 2005 Aamer Akhter. All rights reserved. | ||||||||||
| 12 | |||||||||||
| 13 | # Redistribution and use in source and binary forms, with or without | ||||||||||
| 14 | # modification, are permitted provided that the following conditions are | ||||||||||
| 15 | # met: | ||||||||||
| 16 | |||||||||||
| 17 | # 1. Redistributions of source code must retain the above copyright | ||||||||||
| 18 | # notice, this list of conditions and the following disclaimer. | ||||||||||
| 19 | |||||||||||
| 20 | # 2. Redistributions in binary form must reproduce the above copyright | ||||||||||
| 21 | # notice, this list of conditions and the following disclaimer in the | ||||||||||
| 22 | # documentation and/or other materials provided with the distribution. | ||||||||||
| 23 | |||||||||||
| 24 | # THIS SOFTWARE IS PROVIDED BY THE LICENSOR(S) ``AS IS'' AND ANY EXPRESS | ||||||||||
| 25 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||||||||
| 26 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||||||||
| 27 | # DISCLAIMED. IN NO EVENT SHALL THE LICENSOR(S) OR OTHER CONTRIBUTORS BE | ||||||||||
| 28 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||||||||
| 29 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||||||||
| 30 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||||||||||
| 31 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||||||||||
| 32 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||||||||||
| 33 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||||||||||
| 34 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||
| 35 | |||||||||||
| 36 | # The views and conclusions contained in the software and documentation | ||||||||||
| 37 | # are those of the authors and should not be interpreted as representing | ||||||||||
| 38 | # official policies, either expressed or implied, of the Licensor(s). | ||||||||||
| 39 | |||||||||||
| 40 | # The software may be subject to additional license restrictions | ||||||||||
| 41 | # provided by the Licensor(s). | ||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | 1 | ▶ | use Log::Log4perl qw(get_logger); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 48 | 1 | ▶ | use XML::LibXML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 49 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 50 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 51 | 1 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 1 | $VERSION = sprintf "%d.%03d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/; | |||||||||
| 55 | |||||||||||
| 56 | 1 | my $log = get_logger('visio.line'); | |||||||||
| 57 | |||||||||||
| 58 | # Preloaded methods go here. | ||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 61 | 0 | my $class = shift; | |||||||||
| 62 | 0 | my $parentN = shift; | |||||||||
| 63 | 0 | my $self = {}; | |||||||||
| 64 | 0 | $self->{parentN} = $parentN; | |||||||||
| 65 | 0 | $self->{xmldoc} = $parentN->ownerDocument; | |||||||||
| 66 | 0 | $self->{xmlroot} = $self->{xmldoc}->documentElement; | |||||||||
| 67 | 0 | bless($self,$class); | |||||||||
| 68 | 0 | my $lnNL = $self->{parentN}->findnodes('Line'); | |||||||||
| 69 | 0 | ▶ | if ($lnNL->size() > 0) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | $self->{lineNode} = $lnNL->pop(); | |||||||||
| 71 | 0 | $log->debug("visio line object already exists"); | |||||||||
| 72 | } else { | ||||||||||
| 73 | 0 | $self->{lineNode} = $self->{xmldoc}->createElement('Line'); | |||||||||
| 74 | 0 | $self->{parentN}->appendChild($self->{lineNode}); | |||||||||
| 75 | #lets create the page | ||||||||||
| 76 | 0 | $log->debug("visio line object created"); | |||||||||
| 77 | } | ||||||||||
| 78 | 0 | return $self; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 0 | ▶ | sub get_node { | ||||||||
|
Subroutine
get_node: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 82 | 0 | my $self = shift; | |||||||||
| 83 | 0 | return $self->{lineNode}; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 0 | ▶ | sub set_LineProperty { | ||||||||
|
Subroutine
set_LineProperty: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 87 | 0 | my $self = shift; | |||||||||
| 88 | 0 | my $property = shift; | |||||||||
| 89 | 0 | my $value = shift; | |||||||||
| 90 | 0 | my $format = shift; | |||||||||
| 91 | my $node = Visio::generic_create_node($self->{lineNode}, | ||||||||||
| 92 | 0 | $property, | |||||||||
| 93 | ); | ||||||||||
| 94 | 0 | Visio::generic_settext($node,$value); | |||||||||
| 95 | 0 | ▶ | if (defined $format) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | 0 | $node->setAttribute('F',$format); | |||||||||
| 97 | } | ||||||||||
| 98 | 0 | $self->{property}{$property}=$property; | |||||||||
| 99 | 0 | return $node; | |||||||||
| 100 | } | ||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | 1 | 1; | |||||||||
| 104 | __END__ | ||||||||||