Bundle-PBib
view release on metacpan or search on metacpan
lib/PBib/Document/OpenOffice.pm view on Meta::CPAN
return "<text:p>$text</text:p>\n";
}
sub linebreak { my ($self) = @_;
# return code that stands for a line-break
return "<text:line-break/>\n";
}
sub singleQuotes { my ($self, $text) = @_;
# return $text enclosed in single quotes
return "$LQUOTE_EN$text$RQUOTE_EN";
}
sub doubleQuotes { my ($self, $text) = @_;
# return $text enclosed in double quotes
return "$LDBLQUOTE_EN$text$RDBLQUOTE_EN";
}
# fields
sub field {
my ($self, $text, $code) = @_;
return "$text" . $self->comment("field: $code");
}
sub bookmark {
my ($self, $text, $bookmark) = @_;
return $text unless defined($bookmark);
return "<text:bookmark-start text:name=\"$bookmark\"/>$text<text:bookmark-end text:name=\"$bookmark\"/>";
}
sub bookmarkLink {
# return $text marked as a hyperlink to bookmark $id
my ($self, $text, $id) = @_;
return "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"$id\">$text</text:bookmark-ref>";
# Alternative:
# return $self->hyperlink($text, "#$id");
}
sub hyperlink {
# return $text marked as bookmark (with $refID as bookmark)
my ($self, $text, $url) = @_;
$url = $text unless( $url );
return "<text:a xlink:type=\"simple\" xlink:href=\"$url\">$text</text:a>";
}
sub bibitems_start { my ($self) = @_; return ""; }
sub bibitems_separator { my ($self) = @_; return $self->linebreak(); }
sub bibitems_end { my ($self) = @_; return ""; }
sub block_start { my ($self) = @_; return ""; }
sub block_separator { my ($self) = @_; return " "; }
sub block_end { my ($self) = @_; return "\n"; }
sub tieConnect { my $self = shift;
# use non-breaking-space
return join($NB_SPACE, @_);
}
sub comment { my ($self, $text) = @_;
return $self->bold($self->italic($text));
}
#
#
# interactive editing methods
#
#
sub openInEditor { my ($self, $filename) = @_;
# $self->PBib::Document::MSWord::openInEditor($filename);
}
sub jumpToBookmark {
my ($self, $bookmark) = @_;
# this feature require some interaction with an appropriate editor
# application for this kind of document
# open the document in an editor, and jump to the given bookmark
# $self->PBib::Document::MSWord::jumpToBookmark($bookmark);
}
=back
=cut
# =head1 NAME
# PBib::Document::OpenOffice::StringBufferFileHandle - Print to a string instead to a file.
# =head1 SYNOPSIS
# use PBib::Document::OpenOffice;
# my $sbfh = new PBib::OpenOffice::StringBufferFileHandle();
# my $string = $sbfh->contents();
# =head1 DESCRIPTION
# This can be passed to Document::write() to get the contents as a
# string instead of written into a file.
# =cut
package PBib::Document::OpenOffice::StringBufferFileHandle;
sub new {
my $self = shift;
my $class = ref($self) || $self;
my $sbfh = bless {contents => ''}, $class;
return $sbfh;
}
sub print {
my $self = shift;
$self->{contents} = $self->{contents} . "@_";
}
sub contents {
my $self = shift;
return $self->{contents};
( run in 2.516 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )