CreateElement.inc 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. <?php
  2. /**
  3. * Create tag elements
  4. *
  5. * @category Phpdocx
  6. * @package elements
  7. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  8. * (http://www.2mdc.com)
  9. * @license LGPL
  10. * @version 1.0
  11. * @link http://www.phpdocx.com
  12. * @since File available since Release 1.0
  13. */
  14. /**
  15. * Main class, create tag elements
  16. *
  17. * @category Phpdocx
  18. * @package elements
  19. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  20. * (http://www.2mdc.com)
  21. * @license http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  22. * @version 1.0
  23. * @link http://www.phpdocx.com
  24. * @since Class available since Release 1.0
  25. */
  26. class CreateElement
  27. {
  28. const MATHNAMESPACEWORD = 'm';
  29. const NAMESPACEWORD = 'w';
  30. /**
  31. *
  32. * @var string
  33. * @access protected
  34. */
  35. protected $_xml;
  36. /**
  37. * Construct
  38. *
  39. * @access public
  40. */
  41. public function __construct()
  42. {
  43. }
  44. /**
  45. * Destruct
  46. *
  47. * @access public
  48. */
  49. public function __destruct()
  50. {
  51. }
  52. /**
  53. *
  54. * @access public
  55. * @return string
  56. */
  57. public function __toString()
  58. {
  59. }
  60. /**
  61. * Generate w:p
  62. *
  63. * @access protected
  64. */
  65. protected function generateP()
  66. {
  67. $this->_xml = '<' . CreateElement::NAMESPACEWORD .
  68. ':p>__GENERATEP__</' . CreateElement::NAMESPACEWORD .
  69. ':p>';
  70. }
  71. /**
  72. * Generate w:ppr
  73. *
  74. * @access protected
  75. */
  76. protected function generatePPR()
  77. {
  78. $xml = '<' . CreateElement::NAMESPACEWORD . ':pPr>__GENERATEPPR__</' .
  79. CreateElement::NAMESPACEWORD . ':pPr>__GENERATER__';
  80. $this->_xml = str_replace('__GENERATEP__', $xml, $this->_xml);
  81. }
  82. /**
  83. * Generate w:t
  84. *
  85. * @param string $dat
  86. * @access protected
  87. */
  88. protected function generateT($dat)
  89. {
  90. $xml = '<' . CreateElement::NAMESPACEWORD . ':t xml:space="preserve">' .
  91. $dat . '</' . CreateElement::NAMESPACEWORD . ':t>';
  92. $this->_xml = str_replace('__GENERATER__', $xml, $this->_xml);
  93. }
  94. /**
  95. * Generate w:rpr
  96. *
  97. * @access protected
  98. */
  99. protected function generateRPR()
  100. {
  101. $xml = '<' . CreateElement::NAMESPACEWORD .
  102. ':rPr>__GENERATERPR__</' . CreateElement::NAMESPACEWORD .
  103. ':rPr>__GENERATER__';
  104. $this->_xml = str_replace('__GENERATER__', $xml, $this->_xml);
  105. }
  106. /**
  107. * Generate w:jc
  108. *
  109. * @param string $val
  110. * @access protected
  111. */
  112. protected function generateJC($val = '')
  113. {
  114. $xml = '<' . CreateElement::NAMESPACEWORD .
  115. ':jc ' . CreateElement::NAMESPACEWORD . ':val="' . $val .
  116. '"></' . CreateElement::NAMESPACEWORD . ':jc>';
  117. $this->_xml = str_replace('__GENERATEPPR__', $xml, $this->_xml);
  118. }
  119. /**
  120. * Generate w:b
  121. *
  122. * @access protected
  123. * @param string $val
  124. */
  125. protected function generateB($strVal = 'single')
  126. {
  127. $element = '<' . CreateElement::NAMESPACEWORD . ':b ' .
  128. CreateElement::NAMESPACEWORD . ':val="' . $strVal . '"></' .
  129. CreateElement::NAMESPACEWORD . ':b>__GENERATERPR__';
  130. $this->_xml = str_replace('__GENERATERPR__', $element, $this->_xml);
  131. }
  132. /**
  133. * Generate w:bcs
  134. *
  135. * @access protected
  136. */
  137. protected function generateBCS()
  138. {
  139. $xml = '<' . CreateElement::NAMESPACEWORD .
  140. ':bCs></' . CreateElement::NAMESPACEWORD .
  141. ':bCs>__GENERATERPR__';
  142. $this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml);
  143. }
  144. /**
  145. * Generate w:noproof
  146. *
  147. * @access protected
  148. */
  149. protected function generateNOPROOF()
  150. {
  151. $xml = '<' . CreateElement::NAMESPACEWORD .
  152. ':noProof></' . CreateElement::NAMESPACEWORD .
  153. ':noProof>__GENERATEPPR__';
  154. $this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml);
  155. }
  156. /**
  157. * Generate w:r
  158. *
  159. * @access protected
  160. */
  161. protected function generateR()
  162. {
  163. if (!empty($this->_xml)) {
  164. if (preg_match("/__GENERATEP__/", $this->_xml)) {
  165. $xml = '<' . CreateElement::NAMESPACEWORD .
  166. ':r>__GENERATER__</' . CreateElement::NAMESPACEWORD .
  167. ':r>';
  168. $this->_xml = str_replace('__GENERATEP__', $xml, $this->_xml);
  169. } elseif (preg_match("/__GENERATER__/", $this->_xml)) {
  170. $xml = '<' . CreateElement::NAMESPACEWORD .
  171. ':r>__GENERATER__</' . CreateElement::NAMESPACEWORD .
  172. ':r>';
  173. $this->_xml = str_replace('__GENERATER__', $xml, $this->_xml);
  174. }
  175. } else {
  176. $this->_xml = '<' . CreateElement::NAMESPACEWORD .
  177. ':r>__GENERATER__</' . CreateElement::NAMESPACEWORD .
  178. ':r>__GENERATER__';
  179. }
  180. }
  181. /**
  182. * Generate w:drawing
  183. *
  184. * @access protected
  185. */
  186. protected function generateDRAWING()
  187. {
  188. $xml = '<' . CreateElement::NAMESPACEWORD .
  189. ':drawing>__GENERATEDRAWING__</' .
  190. CreateElement::NAMESPACEWORD .
  191. ':drawing>';
  192. $this->_xml = str_replace('__GENERATER__', $xml, $this->_xml);
  193. }
  194. /**
  195. * Generate w:inline
  196. *
  197. * @param string $distT
  198. * @param string $distB
  199. * @param string $distL
  200. * @param string $distR
  201. * @access protected
  202. */
  203. protected function generateINLINE($distT = '0', $distB ='0',
  204. $distL = '0', $distR ='0')
  205. {
  206. $xml = '<' . CreateImage::NAMESPACEWORD .
  207. ':inline distT="' . $distT . '" distB="' . $distB .
  208. '" distL="' . $distL . '" distR="' . $distR .
  209. '">__GENERATEINLINE__</' . CreateImage::NAMESPACEWORD .
  210. ':inline>';
  211. $this->_xml = str_replace('__GENERATEDRAWING__', $xml, $this->_xml);
  212. }
  213. /**
  214. * Generate w:anchor
  215. *
  216. * @param string $behindDoc
  217. * @param string $distT
  218. * @param string $distB
  219. * @param string $distL
  220. * @param string $distR
  221. * @param int $simplePos
  222. * @param string $relativeHeight
  223. * @param string $locked
  224. * @param string $layoutInCell
  225. * @param string $allowOverlap
  226. * @access protected
  227. */
  228. protected function generateANCHOR($behindDoc = 0, $distT = '0',
  229. $distB = '0', $distL = '114300',
  230. $distR = '114300', $simplePos = 0,
  231. $relativeHeight = '251658240',
  232. $locked = 0, $layoutInCell = 1,
  233. $allowOverlap = 1)
  234. {
  235. $xml = '<' . CreateImage::NAMESPACEWORD . ':anchor distT="' . $distT .
  236. '" distB="' . $distB . '" distL="' . $distL .
  237. '" distR="' . $distR . '" simplePos="' . $simplePos .
  238. '" relativeHeight="' . $relativeHeight .
  239. '" behindDoc="' . $behindDoc .
  240. '" locked="' . $locked .
  241. '" layoutInCell="' . $layoutInCell .
  242. '" allowOverlap="' . $allowOverlap .
  243. '">__GENERATEINLINE__</' . CreateImage::NAMESPACEWORD .
  244. ':anchor>';
  245. $this->_xml = str_replace('__GENERATEDRAWING__', $xml, $this->_xml);
  246. }
  247. /**
  248. * Generate w:simplepos
  249. *
  250. * @param string $x
  251. * @param string $y
  252. * @access protected
  253. */
  254. protected function generateSIMPLEPOS($x = '0', $y = '0')
  255. {
  256. $xml = '<' . CreateImage::NAMESPACEWORD .
  257. ':simplePos x="' . $x . '" y="' . $y .
  258. '"></' . CreateImage::NAMESPACEWORD .
  259. ':simplePos>__GENERATEINLINE__';
  260. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  261. }
  262. /**
  263. * Generate w:positionh
  264. *
  265. * @param string $relativeFrom
  266. * @access protected
  267. */
  268. protected function generatePOSITIONH($relativeFrom = 'column')
  269. {
  270. $xml = '<' . CreateImage::NAMESPACEWORD .
  271. ':positionH relativeFrom="' . $relativeFrom .
  272. '">__GENERATEPOSITION__</' . CreateImage::NAMESPACEWORD .
  273. ':positionH>__GENERATEINLINE__';
  274. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  275. }
  276. /**
  277. * Generate w:positionv
  278. *
  279. * @param string $relativeFrom
  280. * @access protected
  281. */
  282. protected function generatePOSITIONV($relativeFrom = 'paragraph')
  283. {
  284. $xml = '<' . CreateImage::NAMESPACEWORD .
  285. ':positionV relativeFrom="' . $relativeFrom .
  286. '">__GENERATEPOSITION__</' . CreateImage::NAMESPACEWORD .
  287. ':positionV>__GENERATEINLINE__';
  288. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  289. }
  290. /**
  291. * Generate w:posoffset
  292. *
  293. * @param int $num
  294. * @access protected
  295. */
  296. protected function generatePOSOFFSET($num)
  297. {
  298. $xml = '<' . CreateImage::NAMESPACEWORD . ':posOffset>' . $num .
  299. '</' . CreateImage::NAMESPACEWORD . ':posOffset>';
  300. $this->_xml = str_replace('__GENERATEPOSITION__', $xml, $this->_xml);
  301. }
  302. /**
  303. * Generate w:extent
  304. *
  305. * @param string $cx
  306. * @param string $cy
  307. * @access protected
  308. */
  309. protected function generateEXTENT($cx = '2986543', $cy = '2239906')
  310. {
  311. $xml = '<' . CreateImage::NAMESPACEWORD . ':extent cx="' . $cx .
  312. '" cy="' . $cy . '"></' . CreateImage::NAMESPACEWORD .
  313. ':extent>__GENERATEINLINE__';
  314. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  315. }
  316. /**
  317. * Generate w:effectextent
  318. *
  319. * @param string $l
  320. * @param string $t
  321. * @param string $r
  322. * @param string $b
  323. * @access protected
  324. */
  325. protected function generateEFFECTEXTENT($l = "19050", $t = "0",
  326. $r = "4307", $b = "0")
  327. {
  328. $xml = '<' . CreateImage::NAMESPACEWORD . ':effectExtent l="' . $l .
  329. '" t="' . $t . '" r="' . $r . '" b="' . $b .
  330. '"></' . CreateImage::NAMESPACEWORD .
  331. ':effectExtent>__GENERATEINLINE__';
  332. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  333. }
  334. /**
  335. * Generate w:wrapsquare
  336. *
  337. * @param string $wrapText
  338. * @access protected
  339. */
  340. protected function generateWRAPSQUARE($wrapText = "bothSides")
  341. {
  342. $xml = '<' . CreateImage::NAMESPACEWORD .
  343. ':wrapSquare wrapText="' . $wrapText .
  344. '"></' . CreateImage::NAMESPACEWORD .
  345. ':wrapSquare>__GENERATEINLINE__';
  346. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  347. }
  348. /**
  349. * Generate w:wrapnone
  350. *
  351. * @access protected
  352. */
  353. protected function generateWRAPNONE()
  354. {
  355. $xml = '<' . CreateImage::NAMESPACEWORD .
  356. ':wrapNone></' . CreateImage::NAMESPACEWORD .
  357. ':wrapNone>__GENERATEINLINE__';
  358. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  359. }
  360. /**
  361. * Generate w:wraptopandbottom
  362. *
  363. * @access protected
  364. */
  365. protected function generateWRAPTOPANDBOTTOM()
  366. {
  367. $xml = '<' . CreateImage::NAMESPACEWORD .
  368. ':wrapTopAndBottom></' . CreateImage::NAMESPACEWORD .
  369. ':wrapTopAndBottom>__GENERATEINLINE__';
  370. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  371. }
  372. /**
  373. * Generate w:wrapthrough
  374. *
  375. * @param string $wrapText
  376. * @access protected
  377. */
  378. protected function generateWRAPTHROUGH($wrapText = 'bothSides')
  379. {
  380. $xml = '<' . CreateImage::NAMESPACEWORD .
  381. ':wrapThrough wrapText="' . $wrapText .
  382. '">__GENERATEWRAPTHROUGH__</' . CreateImage::NAMESPACEWORD .
  383. ':wrapThrough>__GENERATEINLINE__';
  384. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  385. }
  386. /**
  387. * Generate w:wrappolygon
  388. *
  389. * @param string $edited
  390. * @access protected
  391. */
  392. protected function generateWRAPPOLYGON($edited = '0')
  393. {
  394. $xml = '<' . CreateImage::NAMESPACEWORD .
  395. ':wrapPolygon edited="' . $edited .
  396. '">__GENERATEWRAPPOLYGON__</' . CreateImage::NAMESPACEWORD .
  397. ':wrapPolygon>';
  398. $this->_xml = str_replace('__GENERATEWRAPTHROUGH__', $xml, $this->_xml);
  399. }
  400. /**
  401. * Generate w:start
  402. *
  403. * @param string $x
  404. * @param string $y
  405. * @access protected
  406. */
  407. protected function generateSTART($x = '-198', $y = '0')
  408. {
  409. $xml = '<' . CreateImage::NAMESPACEWORD .
  410. ':start x="' . $x . '" y="' . $y .
  411. '"></' . CreateImage::NAMESPACEWORD .
  412. ':start>__GENERATEWRAPPOLYGON__';
  413. $this->_xml = str_replace('__GENERATEWRAPPOLYGON__', $xml, $this->_xml);
  414. }
  415. /**
  416. * Generate w:lineto
  417. *
  418. * @param string $x
  419. * @param string $y
  420. * @access protected
  421. */
  422. protected function generateLINETO($x = '-198', $y = '21342')
  423. {
  424. $xml = '<' . CreateImage::NAMESPACEWORD .
  425. ':lineTo x="' . $x . '" y="' . $y .
  426. '"></' . CreateImage::NAMESPACEWORD .
  427. ':lineTo>__GENERATEWRAPPOLYGON__';
  428. $this->_xml = str_replace('__GENERATEWRAPPOLYGON__', $xml, $this->_xml);
  429. }
  430. /**
  431. * Generate w:docpr
  432. *
  433. * @param string $id
  434. * @param string $name
  435. * @access protected
  436. */
  437. protected function generateDOCPR($id = "1", $name = "0 Imagen")
  438. {
  439. $xml = '<' . CreateImage::NAMESPACEWORD . ':docPr id="' . $id .
  440. '" name="' . $name . '" descr="' . $this->getName() .
  441. '"></' . CreateImage::NAMESPACEWORD .
  442. ':docPr>__GENERATEINLINE__';
  443. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  444. }
  445. /**
  446. * Generate w:cnvgraphicframepr
  447. *
  448. * @access protected
  449. */
  450. protected function generateCNVGRAPHICFRAMEPR()
  451. {
  452. $xml = '<' . CreateImage::NAMESPACEWORD .
  453. ':cNvGraphicFramePr>__GENERATECNVGRAPHICFRAMEPR__</' .
  454. CreateImage::NAMESPACEWORD .
  455. ':cNvGraphicFramePr>__GENERATEINLINE__';
  456. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  457. }
  458. /**
  459. * Generate w:graphicpframelocks
  460. *
  461. * @param string $noChangeAspect
  462. * @access protected
  463. */
  464. protected function generateGRAPHICPRAMELOCKS($noChangeAspect = '')
  465. {
  466. $xmlAux = '<' . CreateImage::NAMESPACEWORD1 .
  467. ':graphicFrameLocks xmlns:a="' .
  468. 'http://schemas.openxmlformats.org/drawingml/2006/main"';
  469. if ($noChangeAspect != '')
  470. $xmlAux .= ' noChangeAspect="' . $noChangeAspect . '"';
  471. $xmlAux .= '></' . CreateImage::NAMESPACEWORD1 . ':graphicFrameLocks>';
  472. $this->_xml = str_replace(
  473. '__GENERATECNVGRAPHICFRAMEPR__', $xmlAux, $this->_xml
  474. );
  475. }
  476. /**
  477. * Generate w:graphic
  478. *
  479. * @param string $xmlns
  480. * @access protected
  481. */
  482. protected function generateGRAPHIC(
  483. $xmlns = 'http://schemas.openxmlformats.org/drawingml/2006/main')
  484. {
  485. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  486. ':graphic xmlns:a="' . $xmlns .
  487. '">__GENERATEGRAPHIC__</' . CreateImage::NAMESPACEWORD1 .
  488. ':graphic>';
  489. $this->_xml = str_replace('__GENERATEINLINE__', $xml, $this->_xml);
  490. }
  491. /**
  492. * Generate w:graphicdata
  493. *
  494. * @param string $uri
  495. * @access protected
  496. */
  497. protected function generateGRAPHICDATA(
  498. $uri = 'http://schemas.openxmlformats.org/drawingml/2006/picture')
  499. {
  500. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  501. ':graphicData uri="' . $uri .
  502. '">__GENERATEGRAPHICDATA__</' . CreateImage::NAMESPACEWORD1 .
  503. ':graphicData>';
  504. $this->_xml = str_replace('__GENERATEGRAPHIC__', $xml, $this->_xml);
  505. }
  506. /**
  507. * Generate w:pic
  508. *
  509. * @param string $pic
  510. * @access protected
  511. */
  512. protected function generatePIC(
  513. $pic = 'http://schemas.openxmlformats.org/drawingml/2006/picture')
  514. {
  515. $xml = '<' . CreateImage::NAMESPACEWORD2 .
  516. ':pic xmlns:pic="' . $pic .
  517. '">__GENERATEPIC__</' . CreateImage::NAMESPACEWORD2 .
  518. ':pic>';
  519. $this->_xml = str_replace('__GENERATEGRAPHICDATA__', $xml, $this->_xml);
  520. }
  521. /**
  522. * Generate w:nvpicpr
  523. *
  524. * @access protected
  525. */
  526. protected function generateNVPICPR()
  527. {
  528. $xml = '<' . CreateImage::NAMESPACEWORD2 .
  529. ':nvPicPr>__GENERATENVPICPR__</' . CreateImage::NAMESPACEWORD2 .
  530. ':nvPicPr>__GENERATEPIC__';
  531. $this->_xml = str_replace('__GENERATEPIC__', $xml, $this->_xml);
  532. }
  533. /**
  534. * Generate w:cnvpr
  535. *
  536. * @param string $id
  537. * @access protected
  538. */
  539. protected function generateCNVPR($id = '0')
  540. {
  541. $xml = '<' . CreateImage::NAMESPACEWORD2 .
  542. ':cNvPr id="' . $id . '" name="' . $this->getName() .
  543. '"></' . CreateImage::NAMESPACEWORD2 .
  544. ':cNvPr>__GENERATENVPICPR__';
  545. $this->_xml = str_replace('__GENERATENVPICPR__', $xml, $this->_xml);
  546. }
  547. /**
  548. * Generate w:cnvpicpr
  549. *
  550. * @access protected
  551. */
  552. protected function generateCNVPICPR()
  553. {
  554. $xml = '<' . CreateImage::NAMESPACEWORD2 .
  555. ':cNvPicPr></' . CreateImage::NAMESPACEWORD2 .
  556. ':cNvPicPr>__GENERATENVPICPR__';
  557. $this->_xml = str_replace('__GENERATENVPICPR__', $xml, $this->_xml);
  558. }
  559. /**
  560. * Generate w:blipfill
  561. *
  562. * @access protected
  563. */
  564. protected function generateBLIPFILL()
  565. {
  566. $xml = '<' . CreateImage::NAMESPACEWORD2 .
  567. ':blipFill>__GENERATEBLIPFILL__</' .
  568. CreateImage::NAMESPACEWORD2 . ':blipFill>__GENERATEPIC__';
  569. $this->_xml = str_replace('__GENERATEPIC__', $xml, $this->_xml);
  570. }
  571. /**
  572. * Generate w:blip
  573. *
  574. * @param string $cstate
  575. * @access protected
  576. */
  577. protected function generateBLIP($cstate = 'print')
  578. {
  579. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  580. ':blip r:embed="rId' . $this->getRId() .
  581. '" cstate="' . $cstate .
  582. '"></' . CreateImage::NAMESPACEWORD1 .
  583. ':blip>__GENERATEBLIPFILL__';
  584. $this->_xml = str_replace('__GENERATEBLIPFILL__', $xml, $this->_xml);
  585. }
  586. /**
  587. * Generate w:stretch
  588. *
  589. * @access protected
  590. */
  591. protected function generateSTRETCH()
  592. {
  593. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  594. ':stretch>__GENERATESTRETCH__</' . CreateImage::NAMESPACEWORD1 .
  595. ':stretch>__GENERATEBLIPFILL__';
  596. $this->_xml = str_replace('__GENERATEBLIPFILL__', $xml, $this->_xml);
  597. }
  598. /**
  599. * Generate w:fillrect
  600. *
  601. * @access protected
  602. */
  603. protected function generateFILLRECT()
  604. {
  605. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  606. ':fillRect></' . CreateImage::NAMESPACEWORD1 .
  607. ':fillRect>';
  608. $this->_xml = str_replace('__GENERATESTRETCH__', $xml, $this->_xml);
  609. }
  610. /**
  611. * Generate w:sppr
  612. *
  613. * @access protected
  614. */
  615. protected function generateSPPR()
  616. {
  617. $xml = '<' . CreateImage::NAMESPACEWORD2 .
  618. ':spPr>__GENERATESPPR__</' . CreateImage::NAMESPACEWORD2 .
  619. ':spPr>';
  620. $this->_xml = str_replace('__GENERATEPIC__', $xml, $this->_xml);
  621. }
  622. /**
  623. * Generate w:xfrm
  624. *
  625. * @access protected
  626. */
  627. protected function generateXFRM()
  628. {
  629. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  630. ':xfrm>__GENERATEXFRM__</' . CreateImage::NAMESPACEWORD1 .
  631. ':xfrm>__GENERATESPPR__';
  632. $this->_xml = str_replace('__GENERATESPPR__', $xml, $this->_xml);
  633. }
  634. /**
  635. * Generate w:off
  636. *
  637. * @param string $x
  638. * @param string $y
  639. * @access protected
  640. */
  641. protected function generateOFF($x = '0', $y = '0')
  642. {
  643. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  644. ':off x="' . $x . '" y="' . $y .
  645. '"></' . CreateImage::NAMESPACEWORD1 .
  646. ':off>__GENERATEXFRM__';
  647. $this->_xml = str_replace('__GENERATEXFRM__', $xml, $this->_xml);
  648. }
  649. /**
  650. * Generate w:ext
  651. *
  652. * @param string $cx
  653. * @param string $cy
  654. * @access protected
  655. */
  656. protected function generateEXT($cx = '2997226', $cy = '2247918')
  657. {
  658. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  659. ':ext cx="' . $cx . '" cy="' . $cy .
  660. '"></' . CreateImage::NAMESPACEWORD1 .
  661. ':ext>__GENERATEXFRM__';
  662. $this->_xml = str_replace('__GENERATEXFRM__', $xml, $this->_xml);
  663. }
  664. /**
  665. * Generate w:prstgeom
  666. *
  667. * @param string $prst
  668. * @access protected
  669. */
  670. protected function generatePRSTGEOM($prst = 'rect')
  671. {
  672. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  673. ':prstGeom prst="' . $prst .
  674. '">__GENERATEPRSTGEOM__</' . CreateImage::NAMESPACEWORD1 .
  675. ':prstGeom>__GENERATESPPR__';
  676. $this->_xml = str_replace('__GENERATESPPR__', $xml, $this->_xml);
  677. }
  678. /**
  679. * Generate w:avlst
  680. *
  681. * @access protected
  682. */
  683. protected function generateAVLST()
  684. {
  685. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  686. ':avLst></' . CreateImage::NAMESPACEWORD1 .
  687. ':avLst>__GENERATEPRSTGEOM__';
  688. $this->_xml = str_replace('__GENERATEPRSTGEOM__', $xml, $this->_xml);
  689. }
  690. /**
  691. * Generate w:ln
  692. *
  693. * @param string $w
  694. * @access protected
  695. */
  696. protected function generateLN($w = '12700')
  697. {
  698. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  699. ':ln w="' . $w . '">__GENERATELN__</' .
  700. CreateImage::NAMESPACEWORD1 .
  701. ':ln>__GENERATESPPR__';
  702. $this->_xml = str_replace('__GENERATESPPR__', $xml, $this->_xml);
  703. }
  704. /**
  705. * Generate w:solidfill
  706. *
  707. * @access protected
  708. */
  709. protected function generateSOLIDFILL()
  710. {
  711. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  712. ':solidFill>__GENERATESOLIDFILL__</' .
  713. CreateImage::NAMESPACEWORD1 .
  714. ':solidFill>__GENERATELN__';
  715. $this->_xml = str_replace('__GENERATELN__', $xml, $this->_xml);
  716. }
  717. /**
  718. * Generate w:schemeclr
  719. *
  720. * @param string $val
  721. * @access protected
  722. */
  723. protected function generateSCHEMECLR($val = 'tx1')
  724. {
  725. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':schemeClr val="' . $val .
  726. '"></' . CreateImage::NAMESPACEWORD1 . ':schemeClr>';
  727. $this->_xml = str_replace('__GENERATESOLIDFILL__', $xml, $this->_xml);
  728. }
  729. /**
  730. * Generate w:prstdash
  731. *
  732. * @param string $val
  733. * @access protected
  734. */
  735. protected function generatePRSTDASH($val = 'sysDash')
  736. {
  737. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':prstDash val="' . $val .
  738. '"></' . CreateImage::NAMESPACEWORD1 .
  739. ':prstDash>__GENERATELN__';
  740. $this->_xml = str_replace('__GENERATELN__', $xml, $this->_xml);
  741. }
  742. /**
  743. * Delete pending tags
  744. *
  745. * @access protected
  746. */
  747. protected function cleanTemplate()
  748. {
  749. $this->_xml = preg_replace('/__[A-Z]+__/', '', $this->_xml);
  750. }
  751. /**
  752. * Delete first w:rpr
  753. *
  754. * @access protected
  755. */
  756. protected function cleanTemplateFirstRPR()
  757. {
  758. $this->_xml = preg_replace('/__GENERATERPR__/', '', $this->_xml, 1);
  759. }
  760. /**
  761. * Generate w:r
  762. *
  763. * @access protected
  764. */
  765. protected function generateQUITAR()
  766. {
  767. $this->_xml = '<' . CreateElement::NAMESPACEWORD .
  768. ':r>__GENERATER__</' . CreateElement::NAMESPACEWORD .
  769. ':r>';
  770. }
  771. /**
  772. * Generate w:pstyle
  773. *
  774. * @param string $val
  775. * @access protected
  776. */
  777. protected function generatePSTYLE($val = 'Textonotaalfinal')
  778. {
  779. $xml = '<' . CreateElement::NAMESPACEWORD .
  780. ':pStyle ' . CreateElement::NAMESPACEWORD .
  781. ':val="' . $val . '"></' . CreateElement::NAMESPACEWORD .
  782. ':pStyle>';
  783. $this->_xml = str_replace('__GENERATEPPR__', $xml, $this->_xml);
  784. }
  785. /**
  786. * Generate w:rstyle
  787. *
  788. * @param string $val
  789. * @access protected
  790. */
  791. protected function generateRSTYLE($val = 'Refdenotaalfinal')
  792. {
  793. $xml = '<' . CreateElement::NAMESPACEWORD .
  794. ':rStyle ' . CreateElement::NAMESPACEWORD .
  795. ':val="' . $val .
  796. '"></' . CreateElement::NAMESPACEWORD .
  797. ':rStyle>';
  798. $this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml);
  799. }
  800. /**
  801. * Generate w:rfonts
  802. *
  803. * @param string $font
  804. * @access protected
  805. */
  806. protected function generateRFONTS($font)
  807. {
  808. $xml = '<' . CreateElement::NAMESPACEWORD .
  809. ':rFonts ' . CreateElement::NAMESPACEWORD .
  810. ':ascii="' . $font . '" ' . CreateElement::NAMESPACEWORD .
  811. ':hAnsi="' . $font . '" ' . CreateElement::NAMESPACEWORD .
  812. ':cs="' . $font . '"></' . CreateElement::NAMESPACEWORD .
  813. ':rFonts>__GENERATERPR__';
  814. $this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml);
  815. }
  816. }