1<?php
2/**
3 * Helper class to read in a CSS style.
4 *
5 * This is just a wrapper for the ODT CSS class to make it's
6 * functionality available as a DokuWiki helper plugin.
7 *
8 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
9 * @author     LarsDW223
10 */
11
12require_once DOKU_PLUGIN . 'odt/ODT/css/cssimportnew.php';
13
14// must be run within Dokuwiki
15if (!defined('DOKU_INC')) die();
16
17/**
18 * Class helper_plugin_odt_cssimport
19 *
20 * @package helper\cssimportnew
21 */
22class helper_plugin_odt_cssimportnew extends DokuWiki_Plugin {
23    protected $internal = NULL;
24
25    public function __construct() {
26        $this->internal = new cssimportnew();
27    }
28
29    /**
30     * Get reference to internal cssimportnew object.
31     *
32     * @return cssimportnew
33     */
34    function getInternal($contents) {
35        return $this->internal;
36    }
37
38    /**
39     * @param $contents
40     * @return bool
41     */
42    function importFromString($contents) {
43        return $this->internal->importFromString($contents);
44    }
45
46    public function setMedia ($media) {
47        $this->internal->setMedia($media);
48    }
49
50    public function getMedia () {
51        return $this->internal->getMedia();
52    }
53
54    /**
55     * @param $filename
56     * @return bool|void
57     */
58    function importFromFile($filename) {
59        return $this->internal->importFromFile($filename);
60    }
61
62    /**
63     * @return mixed
64     */
65    public function getRaw () {
66        return $this->internal->getRaw();
67    }
68
69    /**
70     * @param $element
71     * @param $classString
72     * @param $name
73     * @param null $media
74     * @return null
75     */
76    public function getPropertyForElement ($name, iElementCSSMatchable $element) {
77        return $this->internal->getPropertyForElement ($name, $element);
78    }
79
80    /**
81     * @param $dest
82     * @param $element
83     * @param $classString
84     * @param null $media
85     */
86    public function getPropertiesForElement (&$dest, iElementCSSMatchable $element, helper_plugin_odt_units $units) {
87        $this->internal->getPropertiesForElement ($dest, $element, $units->getInternal());
88    }
89
90    /**
91     * @return string
92     */
93    public function rulesToString () {
94        return $this->internal->rulesToString ();
95    }
96
97    /**
98     * @param $URL
99     * @param $replacement
100     * @return string
101     */
102    public function replaceURLPrefix ($URL, $replacement) {
103        return $this->internal->replaceURLPrefix ($URL, $replacement);
104    }
105
106    /**
107     * @param $callback
108     */
109    public function adjustLengthValues ($callback) {
110        $this->internal->adjustLengthValues ($callback);
111    }
112}
113