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