Complex classes like ObjectsChart often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ObjectsChart, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 41 | class ObjectsChart extends AbstractPart |
||
| 42 | { |
||
| 43 | /** |
||
| 44 | * @var XMLWriter |
||
| 45 | */ |
||
| 46 | private $xmlContent; |
||
| 47 | /** |
||
| 48 | * @var XMLWriter |
||
| 49 | */ |
||
| 50 | private $xmlMeta; |
||
| 51 | /** |
||
| 52 | * @var XMLWriter |
||
| 53 | */ |
||
| 54 | private $xmlStyles; |
||
| 55 | /** |
||
| 56 | * @var mixed |
||
| 57 | */ |
||
| 58 | private $arrayData; |
||
| 59 | /** |
||
| 60 | * @var mixed |
||
| 61 | */ |
||
| 62 | private $arrayTitle; |
||
| 63 | /** |
||
| 64 | * @var integer |
||
| 65 | */ |
||
| 66 | private $numData; |
||
| 67 | /** |
||
| 68 | * @var integer |
||
| 69 | */ |
||
| 70 | private $numSeries; |
||
| 71 | /** |
||
| 72 | * @var string |
||
| 73 | */ |
||
| 74 | private $rangeCol; |
||
| 75 | |||
| 76 | 19 | public function writePart(Chart $chart) |
|
| 77 | { |
||
| 78 | 19 | $this->xmlContent = $this->getXMLWriter(); |
|
| 79 | 19 | $this->xmlMeta = $this->getXMLWriter(); |
|
| 80 | 19 | $this->xmlStyles = $this->getXMLWriter(); |
|
| 81 | |||
| 82 | 19 | $this->writeContentPart($chart); |
|
| 83 | |||
| 84 | return array( |
||
| 85 | 18 | 'content.xml' => $this->xmlContent->getData(), |
|
| 86 | 18 | 'meta.xml' => $this->xmlMeta->getData(), |
|
| 87 | 18 | 'styles.xml' => $this->xmlStyles->getData(), |
|
| 88 | 18 | ); |
|
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @param Chart $chart |
||
| 93 | */ |
||
| 94 | 19 | private function writeContentPart(Chart $chart) |
|
| 95 | { |
||
| 96 | 19 | $chartType = $chart->getPlotArea()->getType(); |
|
| 97 | 19 | if (!($chartType instanceof Area || $chartType instanceof AbstractTypeBar || $chartType instanceof Line || $chartType instanceof AbstractTypePie || $chartType instanceof Scatter)) { |
|
| 98 | 1 | throw new \Exception('The chart type provided could not be rendered.'); |
|
| 99 | } |
||
| 100 | |||
| 101 | // Data |
||
| 102 | 18 | $this->arrayData = array(); |
|
| 103 | 18 | $this->arrayTitle = array(); |
|
| 104 | 18 | $this->numData = 0; |
|
| 105 | 18 | foreach ($chart->getPlotArea()->getType()->getData() as $series) { |
|
|
|
|||
| 106 | 16 | $inc = 0; |
|
| 107 | 16 | $this->arrayTitle[] = $series->getTitle(); |
|
| 108 | 16 | foreach ($series->getValues() as $key => $value) { |
|
| 109 | 16 | if (!isset($this->arrayData[$inc])) { |
|
| 110 | 16 | $this->arrayData[$inc] = array(); |
|
| 111 | 16 | } |
|
| 112 | 16 | if (empty($this->arrayData[$inc])) { |
|
| 113 | 16 | $this->arrayData[$inc][] = $key; |
|
| 114 | 16 | } |
|
| 115 | 16 | $this->arrayData[$inc][] = $value; |
|
| 116 | 16 | $inc++; |
|
| 117 | 16 | } |
|
| 118 | 16 | if ($inc > $this->numData) { |
|
| 119 | 16 | $this->numData = $inc; |
|
| 120 | 16 | } |
|
| 121 | 18 | } |
|
| 122 | |||
| 123 | // office:document-content |
||
| 124 | 18 | $this->xmlContent->startElement('office:document-content'); |
|
| 125 | 18 | $this->xmlContent->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|
| 126 | 18 | $this->xmlContent->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'); |
|
| 127 | 18 | $this->xmlContent->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); |
|
| 128 | 18 | $this->xmlContent->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); |
|
| 129 | 18 | $this->xmlContent->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'); |
|
| 130 | 18 | $this->xmlContent->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'); |
|
| 131 | 18 | $this->xmlContent->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|
| 132 | 18 | $this->xmlContent->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|
| 133 | 18 | $this->xmlContent->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); |
|
| 134 | 18 | $this->xmlContent->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'); |
|
| 135 | 18 | $this->xmlContent->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'); |
|
| 136 | 18 | $this->xmlContent->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0'); |
|
| 137 | 18 | $this->xmlContent->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'); |
|
| 138 | 18 | $this->xmlContent->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML'); |
|
| 139 | 18 | $this->xmlContent->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'); |
|
| 140 | 18 | $this->xmlContent->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0'); |
|
| 141 | 18 | $this->xmlContent->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|
| 142 | 18 | $this->xmlContent->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer'); |
|
| 143 | 18 | $this->xmlContent->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc'); |
|
| 144 | 18 | $this->xmlContent->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events'); |
|
| 145 | 18 | $this->xmlContent->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms'); |
|
| 146 | 18 | $this->xmlContent->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); |
|
| 147 | 18 | $this->xmlContent->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 148 | 18 | $this->xmlContent->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report'); |
|
| 149 | 18 | $this->xmlContent->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2'); |
|
| 150 | 18 | $this->xmlContent->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml'); |
|
| 151 | 18 | $this->xmlContent->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); |
|
| 152 | 18 | $this->xmlContent->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table'); |
|
| 153 | 18 | $this->xmlContent->writeAttribute('xmlns:chartooo', 'http://openoffice.org/2010/chart'); |
|
| 154 | 18 | $this->xmlContent->writeAttribute('xmlns:drawooo', 'http://openoffice.org/2010/draw'); |
|
| 155 | 18 | $this->xmlContent->writeAttribute('xmlns:calcext', 'urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0'); |
|
| 156 | 18 | $this->xmlContent->writeAttribute('xmlns:loext', 'urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0'); |
|
| 157 | 18 | $this->xmlContent->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0'); |
|
| 158 | 18 | $this->xmlContent->writeAttribute('xmlns:formx', 'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0'); |
|
| 159 | 18 | $this->xmlContent->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/'); |
|
| 160 | 18 | $this->xmlContent->writeAttribute('office:version', '1.2'); |
|
| 161 | |||
| 162 | // office:automatic-styles |
||
| 163 | 18 | $this->xmlContent->startElement('office:automatic-styles'); |
|
| 164 | |||
| 165 | // Chart |
||
| 166 | 18 | $this->writeChartStyle($chart); |
|
| 167 | |||
| 168 | // Axis |
||
| 169 | 18 | $this->writeAxisStyle($chart); |
|
| 170 | |||
| 171 | // Series |
||
| 172 | 18 | $this->numSeries = 0; |
|
| 173 | 18 | foreach ($chart->getPlotArea()->getType()->getData() as $series) { |
|
| 174 | 16 | $this->writeSeriesStyle($chart, $series); |
|
| 175 | |||
| 176 | 16 | $this->numSeries++; |
|
| 177 | 18 | } |
|
| 178 | |||
| 179 | // Floor |
||
| 180 | 18 | $this->writeFloorStyle(); |
|
| 181 | |||
| 182 | // Legend |
||
| 183 | 18 | $this->writeLegendStyle($chart); |
|
| 184 | |||
| 185 | // PlotArea |
||
| 186 | 18 | $this->writePlotAreaStyle($chart); |
|
| 187 | |||
| 188 | // Title |
||
| 189 | 18 | $this->writeTitleStyle($chart->getTitle()); |
|
| 190 | |||
| 191 | // Wall |
||
| 192 | 18 | $this->writeWallStyle($chart); |
|
| 193 | |||
| 194 | // > office:automatic-styles |
||
| 195 | 18 | $this->xmlContent->endElement(); |
|
| 196 | |||
| 197 | // office:body |
||
| 198 | 18 | $this->xmlContent->startElement('office:body'); |
|
| 199 | // office:chart |
||
| 200 | 18 | $this->xmlContent->startElement('office:chart'); |
|
| 201 | // office:chart |
||
| 202 | 18 | $this->xmlContent->startElement('chart:chart'); |
|
| 203 | 18 | $this->xmlContent->writeAttribute('svg:width', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getWidth()), 3) . 'cm'); |
|
| 204 | 18 | $this->xmlContent->writeAttribute('svg:height', Text::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getHeight()), 3) . 'cm'); |
|
| 205 | 18 | $this->xmlContent->writeAttribute('xlink:href', '.'); |
|
| 206 | 18 | $this->xmlContent->writeAttribute('xlink:type', 'simple'); |
|
| 207 | 18 | $this->xmlContent->writeAttribute('chart:style-name', 'styleChart'); |
|
| 208 | 18 | if ($chartType instanceof Area) { |
|
| 209 | 1 | $this->xmlContent->writeAttribute('chart:class', 'chart:area'); |
|
| 210 | 18 | } elseif ($chartType instanceof AbstractTypeBar) { |
|
| 211 | 6 | $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); |
|
| 212 | 17 | } elseif ($chartType instanceof Line) { |
|
| 213 | 5 | $this->xmlContent->writeAttribute('chart:class', 'chart:line'); |
|
| 214 | 11 | } elseif ($chartType instanceof AbstractTypePie) { |
|
| 215 | 3 | $this->xmlContent->writeAttribute('chart:class', 'chart:circle'); |
|
| 216 | 6 | } elseif ($chartType instanceof Scatter) { |
|
| 217 | 3 | $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); |
|
| 218 | 3 | } |
|
| 219 | |||
| 220 | //**** Title **** |
||
| 221 | 18 | $this->writeTitle($chart->getTitle()); |
|
| 222 | |||
| 223 | //**** Legend **** |
||
| 224 | 18 | $this->writeLegend($chart); |
|
| 225 | |||
| 226 | //**** Plotarea **** |
||
| 227 | 18 | $this->writePlotArea($chart); |
|
| 228 | |||
| 229 | //**** Table **** |
||
| 230 | 18 | $this->writeTable(); |
|
| 231 | |||
| 232 | // > chart:chart |
||
| 233 | 18 | $this->xmlContent->endElement(); |
|
| 234 | // > office:chart |
||
| 235 | 18 | $this->xmlContent->endElement(); |
|
| 236 | // > office:body |
||
| 237 | 18 | $this->xmlContent->endElement(); |
|
| 238 | // > office:document-content |
||
| 239 | 18 | $this->xmlContent->endElement(); |
|
| 240 | 18 | } |
|
| 241 | |||
| 242 | /** |
||
| 243 | * @param Chart $chart |
||
| 244 | */ |
||
| 245 | 18 | private function writeAxis(Chart $chart) |
|
| 246 | { |
||
| 247 | 18 | $chartType = $chart->getPlotArea()->getType(); |
|
| 248 | |||
| 249 | // chart:axis |
||
| 250 | 18 | $this->xmlContent->startElement('chart:axis'); |
|
| 251 | 18 | $this->xmlContent->writeAttribute('chart:dimension', 'x'); |
|
| 252 | 18 | $this->xmlContent->writeAttribute('chart:name', 'primary-x'); |
|
| 253 | 18 | $this->xmlContent->writeAttribute('chartooo:axis-type', 'text'); |
|
| 254 | 18 | $this->xmlContent->writeAttribute('chart:style-name', 'styleAxisX'); |
|
| 255 | // chart:categories |
||
| 256 | 18 | $this->xmlContent->startElement('chart:categories'); |
|
| 257 | 18 | $this->xmlContent->writeAttribute('table:cell-range-address', 'table-local.$A$2:.$A$'.($this->numData+1)); |
|
| 258 | // > chart:categories |
||
| 259 | 18 | $this->xmlContent->endElement(); |
|
| 260 | // > chart:axis |
||
| 261 | 18 | $this->xmlContent->endElement(); |
|
| 262 | // chart:axis |
||
| 263 | 18 | $this->xmlContent->startElement('chart:axis'); |
|
| 264 | 18 | $this->xmlContent->writeAttribute('chart:dimension', 'y'); |
|
| 265 | 18 | $this->xmlContent->writeAttribute('chart:name', 'primary-y'); |
|
| 266 | 18 | $this->xmlContent->writeAttribute('chart:style-name', 'styleAxisY'); |
|
| 267 | // > chart:axis |
||
| 268 | 18 | $this->xmlContent->endElement(); |
|
| 269 | 18 | if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) { |
|
| 270 | // chart:axis |
||
| 271 | 5 | $this->xmlContent->startElement('chart:axis'); |
|
| 272 | 5 | $this->xmlContent->writeAttribute('chart:dimension', 'z'); |
|
| 273 | 5 | $this->xmlContent->writeAttribute('chart:name', 'primary-z'); |
|
| 274 | // > chart:axis |
||
| 275 | 5 | $this->xmlContent->endElement(); |
|
| 276 | 5 | } |
|
| 277 | 18 | } |
|
| 278 | |||
| 279 | /** |
||
| 280 | * @param Chart $chart |
||
| 281 | * @todo Set function in \PhpPresentation\Shape\Chart\Axis for defining width and color of the axis |
||
| 282 | */ |
||
| 283 | 18 | private function writeAxisStyle(Chart $chart) |
|
| 284 | { |
||
| 285 | 18 | $chartType = $chart->getPlotArea()->getType(); |
|
| 286 | |||
| 287 | // AxisX |
||
| 288 | // style:style |
||
| 289 | 18 | $this->xmlContent->startElement('style:style'); |
|
| 290 | 18 | $this->xmlContent->writeAttribute('style:name', 'styleAxisX'); |
|
| 291 | 18 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 292 | // style:chart-properties |
||
| 293 | 18 | $this->xmlContent->startElement('style:chart-properties'); |
|
| 294 | 18 | $this->xmlContent->writeAttribute('chart:display-label', 'true'); |
|
| 295 | 18 | $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); |
|
| 296 | 18 | $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); |
|
| 297 | 18 | if ($chartType instanceof AbstractTypePie) { |
|
| 298 | 3 | $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); |
|
| 299 | 3 | } |
|
| 300 | // > style:chart-properties |
||
| 301 | 18 | $this->xmlContent->endElement(); |
|
| 302 | // style:text-properties |
||
| 303 | 18 | $this->xmlContent->startElement('style:text-properties'); |
|
| 304 | 18 | $this->xmlContent->writeAttribute('fo:color', '#'.$chart->getPlotArea()->getAxisX()->getFont()->getColor()->getRGB()); |
|
| 305 | 18 | $this->xmlContent->writeAttribute('fo:font-family', $chart->getPlotArea()->getAxisX()->getFont()->getName()); |
|
| 306 | 18 | $this->xmlContent->writeAttribute('fo:font-size', $chart->getPlotArea()->getAxisX()->getFont()->getSize().'pt'); |
|
| 307 | 18 | $this->xmlContent->writeAttribute('fo:font-style', $chart->getPlotArea()->getAxisX()->getFont()->isItalic() ? 'italic' : 'normal'); |
|
| 308 | // > style:text-properties |
||
| 309 | 18 | $this->xmlContent->endElement(); |
|
| 310 | // style:graphic-properties |
||
| 311 | 18 | $this->xmlContent->startElement('style:graphic-properties'); |
|
| 312 | 18 | $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm'); |
|
| 313 | 18 | $this->xmlContent->writeAttribute('svg:stroke-color', '#878787'); |
|
| 314 | // > style:graphic-properties |
||
| 315 | 18 | $this->xmlContent->endElement(); |
|
| 316 | // > style:style |
||
| 317 | 18 | $this->xmlContent->endElement(); |
|
| 318 | |||
| 319 | // AxisY |
||
| 320 | // style:style |
||
| 321 | 18 | $this->xmlContent->startElement('style:style'); |
|
| 322 | 18 | $this->xmlContent->writeAttribute('style:name', 'styleAxisY'); |
|
| 323 | 18 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 324 | // style:chart-properties |
||
| 325 | 18 | $this->xmlContent->startElement('style:chart-properties'); |
|
| 326 | 18 | $this->xmlContent->writeAttribute('chart:display-label', 'true'); |
|
| 327 | 18 | $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); |
|
| 328 | 18 | $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); |
|
| 329 | 18 | if ($chartType instanceof AbstractTypePie) { |
|
| 330 | 3 | $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); |
|
| 331 | 3 | } |
|
| 332 | // > style:chart-properties |
||
| 333 | 18 | $this->xmlContent->endElement(); |
|
| 334 | // style:text-properties |
||
| 335 | 18 | $this->xmlContent->startElement('style:text-properties'); |
|
| 336 | 18 | $this->xmlContent->writeAttribute('fo:color', '#'.$chart->getPlotArea()->getAxisY()->getFont()->getColor()->getRGB()); |
|
| 337 | 18 | $this->xmlContent->writeAttribute('fo:font-family', $chart->getPlotArea()->getAxisY()->getFont()->getName()); |
|
| 338 | 18 | $this->xmlContent->writeAttribute('fo:font-size', $chart->getPlotArea()->getAxisY()->getFont()->getSize().'pt'); |
|
| 339 | 18 | $this->xmlContent->writeAttribute('fo:font-style', $chart->getPlotArea()->getAxisY()->getFont()->isItalic() ? 'italic' : 'normal'); |
|
| 340 | // > style:text-properties |
||
| 341 | 18 | $this->xmlContent->endElement(); |
|
| 342 | // style:graphic-properties |
||
| 343 | 18 | $this->xmlContent->startElement('style:graphic-properties'); |
|
| 344 | 18 | $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm'); |
|
| 345 | 18 | $this->xmlContent->writeAttribute('svg:stroke-color', '#878787'); |
|
| 346 | // > style:graphic-properties |
||
| 347 | 18 | $this->xmlContent->endElement(); |
|
| 348 | // > style:style |
||
| 349 | 18 | $this->xmlContent->endElement(); |
|
| 350 | 18 | } |
|
| 351 | |||
| 352 | /** |
||
| 353 | * @param Chart $chart |
||
| 354 | */ |
||
| 355 | 18 | private function writeChartStyle(Chart $chart) |
|
| 370 | |||
| 371 | 18 | private function writeFloor() |
|
| 379 | |||
| 380 | 18 | private function writeFloorStyle() |
|
| 398 | |||
| 399 | /** |
||
| 400 | * @param Chart $chart |
||
| 401 | */ |
||
| 402 | 18 | private function writeLegend(Chart $chart) |
|
| 414 | |||
| 415 | /** |
||
| 416 | * @param Chart $chart |
||
| 417 | */ |
||
| 418 | 18 | private function writeLegendStyle(Chart $chart) |
|
| 435 | |||
| 436 | /** |
||
| 437 | * @param Chart $chart |
||
| 438 | */ |
||
| 439 | 18 | private function writePlotArea(Chart $chart) |
|
| 440 | { |
||
| 441 | 18 | $chartType = $chart->getPlotArea()->getType(); |
|
| 442 | |||
| 443 | // chart:plot-area |
||
| 444 | 18 | $this->xmlContent->startElement('chart:plot-area'); |
|
| 445 | 18 | $this->xmlContent->writeAttribute('chart:style-name', 'stylePlotArea'); |
|
| 446 | 18 | if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) { |
|
| 447 | 5 | $this->xmlContent->writeAttribute('dr3d:ambient-color', '#cccccc'); |
|
| 448 | 5 | $this->xmlContent->writeAttribute('dr3d:lighting-mode', 'true'); |
|
| 449 | 5 | } |
|
| 450 | 18 | if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) { |
|
| 451 | // dr3d:light |
||
| 452 | $arrayLight = array( |
||
| 453 | 5 | array('#808080', '(0 0 1)', 'false', 'true'), |
|
| 454 | 5 | array('#666666', '(0.2 0.4 1)', 'true', 'false'), |
|
| 455 | 5 | array('#808080', '(0 0 1)', 'false', 'false'), |
|
| 456 | 5 | array('#808080', '(0 0 1)', 'false', 'false'), |
|
| 457 | 5 | array('#808080', '(0 0 1)', 'false', 'false'), |
|
| 458 | 5 | array('#808080', '(0 0 1)', 'false', 'false'), |
|
| 459 | 5 | array('#808080', '(0 0 1)', 'false', 'false'), |
|
| 460 | 5 | ); |
|
| 461 | 5 | foreach ($arrayLight as $light) { |
|
| 462 | 5 | $this->xmlContent->startElement('dr3d:light'); |
|
| 463 | 5 | $this->xmlContent->writeAttribute('dr3d:diffuse-color', $light[0]); |
|
| 464 | 5 | $this->xmlContent->writeAttribute('dr3d:direction', $light[1]); |
|
| 465 | 5 | $this->xmlContent->writeAttribute('dr3d:enabled', $light[2]); |
|
| 466 | 5 | $this->xmlContent->writeAttribute('dr3d:specular', $light[3]); |
|
| 467 | 5 | $this->xmlContent->endElement(); |
|
| 468 | 5 | } |
|
| 469 | 5 | } |
|
| 470 | |||
| 471 | //**** Axis **** |
||
| 472 | 18 | $this->writeAxis($chart); |
|
| 473 | |||
| 474 | //**** Series **** |
||
| 475 | 18 | $this->rangeCol = 'B'; |
|
| 476 | 18 | $this->numSeries = 0; |
|
| 477 | 18 | foreach ($chart->getPlotArea()->getType()->getData() as $series) { |
|
| 478 | 16 | $this->writeSeries($chart, $series); |
|
| 479 | 16 | $this->rangeCol++; |
|
| 480 | 16 | $this->numSeries++; |
|
| 481 | 18 | } |
|
| 482 | |||
| 483 | //**** Wall **** |
||
| 484 | 18 | $this->writeWall(); |
|
| 485 | //**** Floor **** |
||
| 486 | 18 | $this->writeFloor(); |
|
| 487 | // > chart:plot-area |
||
| 488 | 18 | $this->xmlContent->endElement(); |
|
| 489 | 18 | } |
|
| 490 | |||
| 491 | /** |
||
| 492 | * @param Chart $chart |
||
| 493 | * @link : http://books.evc-cit.info/odbook/ch08.html#chart-plot-area-section |
||
| 494 | */ |
||
| 495 | 18 | private function writePlotAreaStyle(Chart $chart) |
|
| 496 | { |
||
| 497 | 18 | $chartType = $chart->getPlotArea()->getType(); |
|
| 498 | |||
| 499 | // style:style |
||
| 500 | 18 | $this->xmlContent->startElement('style:style'); |
|
| 501 | 18 | $this->xmlContent->writeAttribute('style:name', 'stylePlotArea'); |
|
| 502 | 18 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 503 | // style:text-properties |
||
| 504 | 18 | $this->xmlContent->startElement('style:chart-properties'); |
|
| 505 | 18 | if ($chartType instanceof Bar3D) { |
|
| 506 | 3 | $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); |
|
| 507 | 3 | $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); |
|
| 508 | 18 | } elseif ($chartType instanceof Pie3D) { |
|
| 509 | 2 | $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); |
|
| 510 | 2 | $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); |
|
| 511 | 2 | } |
|
| 512 | 18 | if ($chartType instanceof AbstractTypeBar) { |
|
| 513 | 6 | if ($chartType->getBarDirection() == AbstractTypeBar::DIRECTION_HORIZONTAL) { |
|
| 514 | 2 | $this->xmlContent->writeAttribute('chart:vertical', 'true'); |
|
| 515 | 2 | } else { |
|
| 516 | 4 | $this->xmlContent->writeAttribute('chart:vertical', 'false'); |
|
| 517 | } |
||
| 518 | 6 | if ($chartType->getBarGrouping() == Bar::GROUPING_CLUSTERED) { |
|
| 519 | 6 | $this->xmlContent->writeAttribute('chart:stacked', 'false'); |
|
| 520 | 6 | $this->xmlContent->writeAttribute('chart:overlap', '0'); |
|
| 521 | 6 | } elseif ($chartType->getBarGrouping() == Bar::GROUPING_STACKED) { |
|
| 522 | $this->xmlContent->writeAttribute('chart:stacked', 'true'); |
||
| 523 | $this->xmlContent->writeAttribute('chart:overlap', '100'); |
||
| 524 | } elseif ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { |
||
| 525 | $this->xmlContent->writeAttribute('chart:stacked', 'true'); |
||
| 526 | $this->xmlContent->writeAttribute('chart:overlap', '100'); |
||
| 527 | $this->xmlContent->writeAttribute('chart:percentage', 'true'); |
||
| 528 | } |
||
| 529 | 6 | } |
|
| 530 | 18 | $labelFormat = 'value'; |
|
| 531 | 18 | if ($chartType instanceof AbstractTypeBar) { |
|
| 532 | 6 | if ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { |
|
| 533 | $labelFormat = 'percentage'; |
||
| 534 | } |
||
| 535 | 6 | } |
|
| 536 | 18 | $this->xmlContent->writeAttribute('chart:data-label-number', $labelFormat); |
|
| 537 | |||
| 538 | // > style:text-properties |
||
| 539 | 18 | $this->xmlContent->endElement(); |
|
| 540 | // > style:style |
||
| 541 | 18 | $this->xmlContent->endElement(); |
|
| 542 | 18 | } |
|
| 543 | |||
| 544 | /** |
||
| 545 | * @param Chart $chart |
||
| 546 | * @param Chart\Series $series |
||
| 547 | * @throws \Exception |
||
| 548 | */ |
||
| 549 | 16 | private function writeSeries(Chart $chart, Chart\Series $series) |
|
| 550 | { |
||
| 551 | 16 | $chartType = $chart->getPlotArea()->getType(); |
|
| 552 | |||
| 553 | 16 | $numRange = count($series->getValues()); |
|
| 554 | // chart:series |
||
| 555 | 16 | $this->xmlContent->startElement('chart:series'); |
|
| 556 | 16 | $this->xmlContent->writeAttribute('chart:values-cell-range-address', 'table-local.$'.$this->rangeCol.'$2:.$'.$this->rangeCol.'$'.($numRange+1)); |
|
| 557 | 16 | $this->xmlContent->writeAttribute('chart:label-cell-address', 'table-local.$'.$this->rangeCol.'$1'); |
|
| 558 | 16 | if ($chartType instanceof Area) { |
|
| 559 | 1 | $this->xmlContent->writeAttribute('chart:class', 'chart:area'); |
|
| 560 | 16 | } elseif ($chartType instanceof AbstractTypeBar) { |
|
| 561 | 5 | $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); |
|
| 562 | 15 | } elseif ($chartType instanceof Line) { |
|
| 563 | 4 | $this->xmlContent->writeAttribute('chart:class', 'chart:line'); |
|
| 564 | 10 | } elseif ($chartType instanceof AbstractTypePie) { |
|
| 565 | 3 | $this->xmlContent->writeAttribute('chart:class', 'chart:circle'); |
|
| 566 | 6 | } elseif ($chartType instanceof Scatter) { |
|
| 567 | 3 | $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); |
|
| 568 | 3 | } |
|
| 569 | 16 | $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries); |
|
| 570 | 16 | if ($chartType instanceof Area || $chartType instanceof AbstractTypeBar || $chartType instanceof Line || $chartType instanceof Scatter) { |
|
| 571 | 13 | $dataPointFills = $series->getDataPointFills(); |
|
| 572 | 13 | if (empty($dataPointFills)) { |
|
| 573 | 9 | $incRepeat = $numRange; |
|
| 574 | 9 | } else { |
|
| 575 | 4 | $inc = 0; |
|
| 576 | 4 | $incRepeat = 0; |
|
| 577 | 4 | $newFill = new Fill(); |
|
| 578 | do { |
||
| 579 | 4 | if ($series->getDataPointFill($inc)->getHashCode() != $newFill->getHashCode()) { |
|
| 580 | // chart:data-point |
||
| 581 | 4 | $this->xmlContent->startElement('chart:data-point'); |
|
| 582 | 4 | $this->xmlContent->writeAttribute('chart:repeated', $incRepeat); |
|
| 583 | // > chart:data-point |
||
| 584 | 4 | $this->xmlContent->endElement(); |
|
| 585 | 4 | $incRepeat = 0; |
|
| 586 | |||
| 587 | // chart:data-point |
||
| 588 | 4 | $this->xmlContent->startElement('chart:data-point'); |
|
| 589 | 4 | $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries.'_'.$inc); |
|
| 590 | // > chart:data-point |
||
| 591 | 4 | $this->xmlContent->endElement(); |
|
| 592 | 4 | } |
|
| 593 | 4 | $inc++; |
|
| 594 | 4 | $incRepeat++; |
|
| 595 | 4 | } while ($inc < $numRange); |
|
| 596 | 4 | $incRepeat--; |
|
| 597 | } |
||
| 598 | // chart:data-point |
||
| 599 | 13 | $this->xmlContent->startElement('chart:data-point'); |
|
| 600 | 13 | $this->xmlContent->writeAttribute('chart:repeated', $incRepeat); |
|
| 601 | // > chart:data-point |
||
| 602 | 13 | $this->xmlContent->endElement(); |
|
| 603 | 16 | } elseif ($chartType instanceof AbstractTypePie) { |
|
| 604 | 3 | $count = count($series->getDataPointFills()); |
|
| 605 | 3 | for ($inc = 0; $inc < $count; $inc++) { |
|
| 606 | // chart:data-point |
||
| 607 | 2 | $this->xmlContent->startElement('chart:data-point'); |
|
| 608 | 2 | $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries.'_'.$inc); |
|
| 609 | // > chart:data-point |
||
| 610 | 2 | $this->xmlContent->endElement(); |
|
| 611 | 2 | } |
|
| 612 | 3 | } |
|
| 613 | |||
| 614 | // > chart:series |
||
| 615 | 16 | $this->xmlContent->endElement(); |
|
| 616 | 16 | } |
|
| 617 | |||
| 618 | /** |
||
| 619 | * @param Chart $chart |
||
| 620 | * @param Chart\Series $series |
||
| 621 | */ |
||
| 622 | 16 | private function writeSeriesStyle(Chart $chart, Chart\Series $series) |
|
| 623 | { |
||
| 624 | 16 | $chartType = $chart->getPlotArea()->getType(); |
|
| 625 | |||
| 626 | // style:style |
||
| 627 | 16 | $this->xmlContent->startElement('style:style'); |
|
| 628 | 16 | $this->xmlContent->writeAttribute('style:name', 'styleSeries'.$this->numSeries); |
|
| 629 | 16 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 630 | // style:chart-properties |
||
| 631 | 16 | $this->xmlContent->startElement('style:chart-properties'); |
|
| 632 | 16 | $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); |
|
| 633 | 16 | $this->xmlContent->writeAttribute('chart:label-position', 'center'); |
|
| 634 | 16 | if ($chartType instanceof AbstractTypePie) { |
|
| 635 | 3 | $this->xmlContent->writeAttribute('chart:pie-offset', $chartType->getExplosion()); |
|
| 636 | 3 | } |
|
| 637 | 16 | if ($chartType instanceof Line || $chartType instanceof Scatter) { |
|
| 638 | 7 | $oMarker = $series->getMarker(); |
|
| 639 | 7 | if ($oMarker->getSymbol() == Chart\Marker::SYMBOL_NONE) { |
|
| 640 | /** |
||
| 641 | * @link : http://www.datypic.com/sc/odf/a-chart_symbol-type.html |
||
| 642 | */ |
||
| 643 | 7 | $this->xmlContent->writeAttribute('chart:symbol-type', 'none'); |
|
| 644 | 7 | } else { |
|
| 645 | /** |
||
| 646 | * @link : http://www.datypic.com/sc/odf/a-chart_symbol-name.html |
||
| 647 | */ |
||
| 648 | 2 | $this->xmlContent->writeAttribute('chart:symbol-type', 'named-symbol'); |
|
| 649 | 2 | switch ($oMarker->getSymbol()) { |
|
| 650 | 2 | case Chart\Marker::SYMBOL_DASH: |
|
| 651 | 2 | $symbolName = 'horizontal-bar'; |
|
| 652 | 2 | break; |
|
| 653 | 2 | case Chart\Marker::SYMBOL_DOT: |
|
| 654 | 2 | $symbolName = 'circle'; |
|
| 655 | 2 | break; |
|
| 656 | 2 | case Chart\Marker::SYMBOL_TRIANGLE: |
|
| 657 | 2 | $symbolName = 'arrow-up'; |
|
| 658 | 2 | break; |
|
| 659 | 2 | default: |
|
| 660 | 2 | $symbolName = $oMarker->getSymbol(); |
|
| 661 | 2 | break; |
|
| 662 | 2 | } |
|
| 663 | 2 | $this->xmlContent->writeAttribute('chart:symbol-name', $symbolName); |
|
| 664 | 2 | $symbolSize = number_format(CommonDrawing::pointsToCentimeters($oMarker->getSize()), 2, '.', ''); |
|
| 665 | 2 | $this->xmlContent->writeAttribute('chart:symbol-width', $symbolSize.'cm'); |
|
| 666 | 2 | $this->xmlContent->writeAttribute('chart:symbol-height', $symbolSize.'cm'); |
|
| 667 | } |
||
| 668 | 7 | } |
|
| 669 | // > style:chart-properties |
||
| 670 | 16 | $this->xmlContent->endElement(); |
|
| 671 | // style:graphic-properties |
||
| 672 | 16 | $this->xmlContent->startElement('style:graphic-properties'); |
|
| 673 | 16 | if ($chartType instanceof Line || $chartType instanceof Scatter) { |
|
| 674 | 7 | $outlineWidth = ''; |
|
| 675 | 7 | $outlineColor = ''; |
|
| 676 | |||
| 677 | 7 | $oOutline = $series->getOutline(); |
|
| 678 | 7 | if ($oOutline instanceof Outline) { |
|
| 679 | 2 | $outlineWidth = $oOutline->getWidth(); |
|
| 680 | 2 | if (!empty($outlineWidth)) { |
|
| 681 | 2 | $outlineWidth = number_format(CommonDrawing::pointsToCentimeters($outlineWidth), 3, '.', ''); |
|
| 682 | 2 | } |
|
| 683 | 2 | $outlineColor = $oOutline->getFill()->getStartColor()->getRGB(); |
|
| 684 | 2 | } |
|
| 685 | 7 | if (empty($outlineWidth)) { |
|
| 686 | 7 | $outlineWidth = '0.079'; |
|
| 687 | 7 | } |
|
| 688 | 7 | if (empty($outlineColor)) { |
|
| 689 | 7 | $outlineColor = '4a7ebb'; |
|
| 690 | 7 | } |
|
| 691 | 7 | $this->xmlContent->writeAttribute('svg:stroke-width', $outlineWidth.'cm'); |
|
| 692 | 7 | $this->xmlContent->writeAttribute('svg:stroke-color', '#'.$outlineColor); |
|
| 693 | 7 | } else { |
|
| 694 | 9 | $this->xmlContent->writeAttribute('draw:stroke', 'none'); |
|
| 695 | 9 | if (!($chartType instanceof Area)) { |
|
| 696 | 8 | $this->xmlContent->writeAttribute('draw:fill', $series->getFill()->getFillType()); |
|
| 697 | 8 | } |
|
| 698 | } |
||
| 699 | 16 | $this->xmlContent->writeAttribute('draw:fill-color', '#'.$series->getFill()->getStartColor()->getRGB()); |
|
| 700 | // > style:graphic-properties |
||
| 701 | 16 | $this->xmlContent->endElement(); |
|
| 702 | // style:text-properties |
||
| 703 | 16 | $this->xmlContent->startElement('style:text-properties'); |
|
| 704 | 16 | $this->xmlContent->writeAttribute('fo:color', '#'.$series->getFont()->getColor()->getRGB()); |
|
| 705 | 16 | $this->xmlContent->writeAttribute('fo:font-family', $series->getFont()->getName()); |
|
| 706 | 16 | $this->xmlContent->writeAttribute('fo:font-size', $series->getFont()->getSize().'pt'); |
|
| 707 | // > style:text-properties |
||
| 708 | 16 | $this->xmlContent->endElement(); |
|
| 709 | |||
| 710 | // > style:style |
||
| 711 | 16 | $this->xmlContent->endElement(); |
|
| 712 | |||
| 713 | 16 | foreach ($series->getDataPointFills() as $idx => $oFill) { |
|
| 714 | // style:style |
||
| 715 | 6 | $this->xmlContent->startElement('style:style'); |
|
| 716 | 6 | $this->xmlContent->writeAttribute('style:name', 'styleSeries'.$this->numSeries.'_'.$idx); |
|
| 717 | 6 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 718 | // style:graphic-properties |
||
| 719 | 6 | $this->xmlContent->startElement('style:graphic-properties'); |
|
| 720 | 6 | $this->xmlContent->writeAttribute('draw:fill', $oFill->getFillType()); |
|
| 721 | 6 | $this->xmlContent->writeAttribute('draw:fill-color', '#'.$oFill->getStartColor()->getRGB()); |
|
| 722 | // > style:graphic-properties |
||
| 723 | 6 | $this->xmlContent->endElement(); |
|
| 724 | // > style:style |
||
| 725 | 6 | $this->xmlContent->endElement(); |
|
| 726 | 16 | } |
|
| 727 | 16 | } |
|
| 728 | |||
| 729 | /** |
||
| 730 | */ |
||
| 731 | 18 | private function writeTable() |
|
| 732 | { |
||
| 733 | // table:table |
||
| 734 | 18 | $this->xmlContent->startElement('table:table'); |
|
| 735 | 18 | $this->xmlContent->writeAttribute('table:name', 'table-local'); |
|
| 736 | |||
| 737 | // table:table-header-columns |
||
| 738 | 18 | $this->xmlContent->startElement('table:table-header-columns'); |
|
| 739 | // table:table-column |
||
| 740 | 18 | $this->xmlContent->startElement('table:table-column'); |
|
| 741 | // > table:table-column |
||
| 742 | 18 | $this->xmlContent->endElement(); |
|
| 743 | // > table:table-header-columns |
||
| 744 | 18 | $this->xmlContent->endElement(); |
|
| 745 | |||
| 746 | // table:table-columns |
||
| 747 | 18 | $this->xmlContent->startElement('table:table-columns'); |
|
| 748 | // table:table-column |
||
| 749 | 18 | $this->xmlContent->startElement('table:table-column'); |
|
| 750 | 18 | if (!empty($this->arrayData)) { |
|
| 751 | 16 | $rowFirst = reset($this->arrayData); |
|
| 752 | 16 | $this->xmlContent->writeAttribute('table:number-columns-repeated', count($rowFirst) - 1); |
|
| 753 | 16 | } |
|
| 754 | // > table:table-column |
||
| 755 | 18 | $this->xmlContent->endElement(); |
|
| 756 | // > table:table-columns |
||
| 757 | 18 | $this->xmlContent->endElement(); |
|
| 758 | |||
| 759 | // table:table-header-rows |
||
| 760 | 18 | $this->xmlContent->startElement('table:table-header-rows'); |
|
| 761 | // table:table-row |
||
| 762 | 18 | $this->xmlContent->startElement('table:table-row'); |
|
| 763 | 18 | if (!empty($this->arrayData)) { |
|
| 764 | 16 | $rowFirst = reset($this->arrayData); |
|
| 765 | 16 | foreach ($rowFirst as $key => $cell) { |
|
| 766 | // table:table-cell |
||
| 767 | 16 | $this->xmlContent->startElement('table:table-cell'); |
|
| 768 | 16 | if (isset($this->arrayTitle[$key - 1])) { |
|
| 769 | 16 | $this->xmlContent->writeAttribute('office:value-type', 'string'); |
|
| 770 | 16 | } |
|
| 771 | // text:p |
||
| 772 | 16 | $this->xmlContent->startElement('text:p'); |
|
| 773 | 16 | if (isset($this->arrayTitle[$key - 1])) { |
|
| 774 | 16 | $this->xmlContent->text($this->arrayTitle[$key - 1]); |
|
| 775 | 16 | } |
|
| 776 | // > text:p |
||
| 777 | 16 | $this->xmlContent->endElement(); |
|
| 778 | // > table:table-cell |
||
| 779 | 16 | $this->xmlContent->endElement(); |
|
| 780 | 16 | } |
|
| 781 | 16 | } |
|
| 782 | // > table:table-row |
||
| 783 | 18 | $this->xmlContent->endElement(); |
|
| 784 | // > table:table-header-rows |
||
| 785 | 18 | $this->xmlContent->endElement(); |
|
| 786 | |||
| 787 | // table:table-rows |
||
| 788 | 18 | $this->xmlContent->startElement('table:table-rows'); |
|
| 789 | |||
| 790 | 18 | foreach ($this->arrayData as $row) { |
|
| 791 | // table:table-row |
||
| 792 | 16 | $this->xmlContent->startElement('table:table-row'); |
|
| 793 | 16 | foreach ($row as $cell) { |
|
| 794 | // table:table-cell |
||
| 795 | 16 | $this->xmlContent->startElement('table:table-cell'); |
|
| 796 | 16 | if (is_numeric($cell)) { |
|
| 797 | 16 | $this->xmlContent->writeAttribute('office:value-type', 'float'); |
|
| 798 | 16 | $this->xmlContent->writeAttribute('office:value', $cell); |
|
| 799 | 16 | } else { |
|
| 800 | 16 | $this->xmlContent->writeAttribute('office:value-type', 'string'); |
|
| 801 | } |
||
| 802 | // text:p |
||
| 803 | 16 | $this->xmlContent->startElement('text:p'); |
|
| 804 | 16 | $this->xmlContent->text($cell); |
|
| 805 | // > text:p |
||
| 806 | 16 | $this->xmlContent->endElement(); |
|
| 807 | // > table:table-cell |
||
| 808 | 16 | $this->xmlContent->endElement(); |
|
| 809 | 16 | } |
|
| 810 | // > table:table-row |
||
| 811 | 16 | $this->xmlContent->endElement(); |
|
| 812 | 18 | } |
|
| 813 | |||
| 814 | // > table:table-rows |
||
| 815 | 18 | $this->xmlContent->endElement(); |
|
| 816 | // > table:table |
||
| 817 | 18 | $this->xmlContent->endElement(); |
|
| 818 | 18 | } |
|
| 819 | |||
| 820 | /** |
||
| 821 | * @param Title $oTitle |
||
| 822 | */ |
||
| 823 | 18 | private function writeTitle(Title $oTitle) |
|
| 824 | { |
||
| 825 | 18 | if ($oTitle->isVisible()) { |
|
| 826 | // chart:title |
||
| 827 | 18 | $this->xmlContent->startElement('chart:title'); |
|
| 828 | 18 | $this->xmlContent->writeAttribute('svg:x', Text::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetX()), 3) . 'cm'); |
|
| 829 | 18 | $this->xmlContent->writeAttribute('svg:y', Text::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetY()), 3) . 'cm'); |
|
| 830 | 18 | $this->xmlContent->writeAttribute('chart:style-name', 'styleTitle'); |
|
| 831 | // > text:p |
||
| 832 | 18 | $this->xmlContent->startElement('text:p'); |
|
| 833 | 18 | $this->xmlContent->text($oTitle->getText()); |
|
| 834 | // > text:p |
||
| 835 | 18 | $this->xmlContent->endElement(); |
|
| 836 | // > chart:title |
||
| 837 | 18 | $this->xmlContent->endElement(); |
|
| 838 | 18 | } |
|
| 839 | 18 | } |
|
| 840 | |||
| 841 | /** |
||
| 842 | * @param Title $oTitle |
||
| 843 | */ |
||
| 844 | 18 | private function writeTitleStyle(Title $oTitle) |
|
| 845 | { |
||
| 846 | 18 | if ($oTitle->isVisible()) { |
|
| 847 | // style:style |
||
| 848 | 18 | $this->xmlContent->startElement('style:style'); |
|
| 849 | 18 | $this->xmlContent->writeAttribute('style:name', 'styleTitle'); |
|
| 850 | 18 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 851 | // style:text-properties |
||
| 852 | 18 | $this->xmlContent->startElement('style:text-properties'); |
|
| 853 | 18 | $this->xmlContent->writeAttribute('fo:color', '#'.$oTitle->getFont()->getColor()->getRGB()); |
|
| 854 | 18 | $this->xmlContent->writeAttribute('fo:font-family', $oTitle->getFont()->getName()); |
|
| 855 | 18 | $this->xmlContent->writeAttribute('fo:font-size', $oTitle->getFont()->getSize().'pt'); |
|
| 856 | 18 | $this->xmlContent->writeAttribute('fo:font-style', $oTitle->getFont()->isItalic() ? 'italic' : 'normal'); |
|
| 857 | // > style:text-properties |
||
| 858 | 18 | $this->xmlContent->endElement(); |
|
| 859 | // > style:style |
||
| 860 | 18 | $this->xmlContent->endElement(); |
|
| 861 | 18 | } |
|
| 862 | 18 | } |
|
| 863 | |||
| 864 | 18 | private function writeWall() |
|
| 872 | |||
| 873 | /** |
||
| 874 | * @param Chart $chart |
||
| 875 | */ |
||
| 876 | 18 | private function writeWallStyle(Chart $chart) |
|
| 877 | { |
||
| 878 | 18 | $chartType = $chart->getPlotArea()->getType(); |
|
| 879 | |||
| 880 | // style:style |
||
| 881 | 18 | $this->xmlContent->startElement('style:style'); |
|
| 882 | 18 | $this->xmlContent->writeAttribute('style:name', 'styleWall'); |
|
| 883 | 18 | $this->xmlContent->writeAttribute('style:family', 'chart'); |
|
| 901 | } |
||
| 902 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.