1: <?php
 2: 
 3: /**
 4: *  Class RCompositeNode
 5: *  @version 1.0.0
 6: *  @author v.raskin
 7:  * @package vsword.node
 8: */
 9: class RCompositeNode extends EmptyCompositeNode implements INodeTextAdded, ILineContext {
10:     
11:     /**
12:      * 
13:      * @param INodeStyle $node
14:      */
15:     public function addTextStyle(INodeStyle $node) {
16:         $this->getLastRPrCompositeNode()->addNode($node);
17:     }
18:     
19:     /**
20:     * @param string $text
21:     * @return INode
22:     */
23:     public function addText($text) {    
24:         $this->addNode( new TextNode($text)); 
25:         return $this;
26:     }
27:         
28:     /**
29:     * 
30:     * @return \RPrCompositeNode
31:     */
32:     public function getLastRPrCompositeNode() {
33:             $node = $this->getLastNode();
34:             if(is_null($node) || !($node instanceof  RPrCompositeNode)) {
35:                 $node = new RPrCompositeNode();
36:                 $this->addNode($node);
37:             }
38:             return $node;
39:     }
40:     
41:     protected function beforeRenderChildrensWord() {
42:         return '<w:r>';
43:     }
44:     
45:     protected function afterRenderChildrensWord() {
46:         return '</w:r>';
47:     }
48: }