| 23 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
//require_once 'class.contentautostyle.php';
|
|
|
4 |
//require_once 'class.styleconstants.php';
|
|
|
5 |
|
|
|
6 |
include_once 'phpodt.php';
|
|
|
7 |
|
|
|
8 |
class RubyStyle extends ContentAutoStyle {
|
|
|
9 |
|
|
|
10 |
private $rubyProperties;
|
|
|
11 |
|
|
|
12 |
function __construct($name = '') {
|
|
|
13 |
if (empty($name)) {
|
|
|
14 |
$name = 'rubystyle'.rand(100, 9999999);
|
|
|
15 |
}
|
|
|
16 |
parent::__construct($name);
|
|
|
17 |
$this->styleElement->setAttribute('style:family', 'ruby');
|
|
|
18 |
$this->rubyProperties = $this->contentDocument->createElement('style:ruby-properties');
|
|
|
19 |
$this->styleElement->appendChild($this->rubyProperties);
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
function setRubyPosition($position) {
|
|
|
23 |
switch ($position) {
|
|
|
24 |
case StyleConstants::RUBY_ABOVE:
|
|
|
25 |
$position = 'above';
|
|
|
26 |
break;
|
|
|
27 |
case StyleConstants::RUBY_BELOW:
|
|
|
28 |
$position = 'below';
|
|
|
29 |
break;
|
|
|
30 |
default:
|
|
|
31 |
throw new StyleException('Invalid ruby position value');
|
|
|
32 |
}
|
|
|
33 |
$this->rubyProperties->setAttribute('style:ruby-position', $position);
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
function setRubyAlign($align) {
|
|
|
37 |
switch ($align) {
|
|
|
38 |
case StyleConstants::LEFT:
|
|
|
39 |
$align = 'left';
|
|
|
40 |
break;
|
|
|
41 |
case StyleConstants::RIGHT:
|
|
|
42 |
$align = 'right';
|
|
|
43 |
break;
|
|
|
44 |
case StyleConstants::CENTER:
|
|
|
45 |
$align = 'center';
|
|
|
46 |
break;
|
|
|
47 |
case StyleConstants::DISTRIBUTE_LETTER:
|
|
|
48 |
$align = 'distribute-letter';
|
|
|
49 |
break;
|
|
|
50 |
case StyleConstants::DISTRIBUTE_SPACE:
|
|
|
51 |
$align = 'distribute-space';
|
|
|
52 |
break;
|
|
|
53 |
default:
|
|
|
54 |
throw new StyleException('Invalid ruby alignment value');
|
|
|
55 |
}
|
|
|
56 |
$this->rubyProperties->setAttribute('style:ruby-align', $align);
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
}
|