@@ -65,6 +65,7 @@ class renderer_plugin_odt_page extends Doku_Renderer {
6565 protected $ quote_depth = 0 ;
6666 protected $ quote_pos = 0 ;
6767 protected $ div_z_index = 0 ;
68+ protected $ disable_links = false ;
6869 /** @var Current pageFormat */
6970 protected $ page = null ;
7071 /** @var Array of used page styles. Will stay empty if only A4-portrait is used */
@@ -286,6 +287,9 @@ function document_end(){
286287 //$this->doc .= 'Path: '.$conf['mediadir'].'/'.$this->getConf("tpl_dir")."/".$this->template;
287288 //$this->p_close();
288289
290+ // Switch links back on
291+ $ this ->enable_links ();
292+
289293 // Insert TOC (if required)
290294 $ this ->insert_TOC ();
291295
@@ -436,6 +440,19 @@ public function finalize_ODTfile() {
436440 $ this ->doc = $ this ->docHandler ->get ();
437441 }
438442
443+ /**
444+ * Simple setter to enable creating links
445+ */
446+ function enable_links () {
447+ $ this ->disable_links = false ;
448+ }
449+
450+ /**
451+ * Simple setter to disable creating links
452+ */
453+ function disable_links () {
454+ $ this ->disable_links = true ;
455+ }
439456
440457 /**
441458 * This function does not really render the TOC but inserts a placeholder.
@@ -1767,7 +1784,7 @@ function _doLink($url,$name){
17671784 $ url = $ this ->_xmlEntities ($ url );
17681785 if (is_array ($ name )){
17691786 // Images
1770- if ($ url ) $ this ->doc .= '<draw:a xlink:type="simple" xlink:href=" ' .$ url .'"> ' ;
1787+ if ($ url && ! $ this -> disable_links ) $ this ->doc .= '<draw:a xlink:type="simple" xlink:href=" ' .$ url .'"> ' ;
17711788
17721789 if ($ name ['type ' ] == 'internalmedia ' ){
17731790 $ this ->internalmedia ($ name ['src ' ],
@@ -1779,12 +1796,12 @@ function _doLink($url,$name){
17791796 $ name ['linking ' ]);
17801797 }
17811798
1782- if ($ url ) $ this ->doc .= '</draw:a> ' ;
1799+ if ($ url && ! $ this -> disable_links ) $ this ->doc .= '</draw:a> ' ;
17831800 }else {
17841801 // Text
1785- if ($ url ) $ this ->doc .= '<text:a xlink:type="simple" xlink:href=" ' .$ url .'"> ' ;
1802+ if ($ url && ! $ this -> disable_links ) $ this ->doc .= '<text:a xlink:type="simple" xlink:href=" ' .$ url .'"> ' ;
17861803 $ this ->doc .= $ name ; // we get the name already XML encoded
1787- if ($ url ) $ this ->doc .= '</text:a> ' ;
1804+ if ($ url && ! $ this -> disable_links ) $ this ->doc .= '</text:a> ' ;
17881805 }
17891806 }
17901807
0 commit comments