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