1package Spreadsheet::ParseExcel::FmtUnicode; 2 3############################################################################### 4# 5# Spreadsheet::ParseExcel::FmtUnicode - A class for Cell formats. 6# 7# Used in conjunction with Spreadsheet::ParseExcel. 8# 9# Copyright (c) 2014 Douglas Wilson 10# Copyright (c) 2009-2013 John McNamara 11# Copyright (c) 2006-2008 Gabor Szabo 12# Copyright (c) 2000-2006 Kawai Takanori 13# 14# perltidy with standard settings. 15# 16# Documentation after __END__ 17# 18 19use strict; 20use warnings; 21 22use Unicode::Map; 23use base 'Spreadsheet::ParseExcel::FmtDefault'; 24 25our $VERSION = '0.65'; 26 27#------------------------------------------------------------------------------ 28# new (for Spreadsheet::ParseExcel::FmtUnicode) 29#------------------------------------------------------------------------------ 30sub new { 31 my ( $sPkg, %hKey ) = @_; 32 my $sMap = $hKey{Unicode_Map}; 33 my $oMap; 34 $oMap = Unicode::Map->new($sMap) if $sMap; 35 my $oThis = { 36 Unicode_Map => $sMap, 37 _UniMap => $oMap, 38 }; 39 bless $oThis; 40 return $oThis; 41} 42 43#------------------------------------------------------------------------------ 44# TextFmt (for Spreadsheet::ParseExcel::FmtUnicode) 45#------------------------------------------------------------------------------ 46sub TextFmt { 47 my ( $oThis, $sTxt, $sCode ) = @_; 48 if ( $oThis->{_UniMap} ) { 49 if ( !defined($sCode) ) { 50 my $sSv = $sTxt; 51 $sTxt =~ s/(.)/\x00$1/sg; 52 $sTxt = $oThis->{_UniMap}->from_unicode($sTxt); 53 $sTxt = $sSv unless ($sTxt); 54 } 55 elsif ( $sCode eq 'ucs2' ) { 56 $sTxt = $oThis->{_UniMap}->from_unicode($sTxt); 57 } 58 59 # $sTxt = $oThis->{_UniMap}->from_unicode($sTxt) 60 # if(defined($sCode) && $sCode eq 'ucs2'); 61 return $sTxt; 62 } 63 else { 64 return $sTxt; 65 } 66} 671; 68 69__END__ 70 71=pod 72 73=head1 NAME 74 75Spreadsheet::ParseExcel::FmtUnicode - A class for Cell formats. 76 77=head1 SYNOPSIS 78 79See the documentation for Spreadsheet::ParseExcel. 80 81=head1 DESCRIPTION 82 83This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel. 84 85=head1 AUTHOR 86 87Current maintainer 0.60+: Douglas Wilson dougw@cpan.org 88 89Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org 90 91Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org 92 93Original author: Kawai Takanori kwitknr@cpan.org 94 95=head1 COPYRIGHT 96 97Copyright (c) 2014 Douglas Wilson 98 99Copyright (c) 2009-2013 John McNamara 100 101Copyright (c) 2006-2008 Gabor Szabo 102 103Copyright (c) 2000-2006 Kawai Takanori 104 105All rights reserved. 106 107You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. 108 109=cut 110