1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26:
27:
28: 29: 30:
31: class PHPWord_Style_TableFull
32: {
33:
34: 35: 36: 37: 38:
39: private $_firstRow = null;
40:
41: 42: 43: 44: 45:
46: private $_cellMarginTop = null;
47:
48: 49: 50: 51: 52:
53: private $_cellMarginLeft = null;
54:
55: 56: 57: 58: 59:
60: private $_cellMarginRight = null;
61:
62: 63: 64: 65: 66:
67: private $_cellMarginBottom = null;
68:
69: 70: 71: 72: 73:
74: private $_bgColor;
75:
76: 77: 78: 79: 80:
81: private $_borderTopSize;
82:
83: 84: 85: 86: 87:
88: private $_borderTopColor;
89:
90: 91: 92: 93: 94:
95: private $_borderLeftSize;
96:
97: 98: 99: 100: 101:
102: private $_borderLeftColor;
103:
104: 105: 106: 107: 108:
109: private $_borderRightSize;
110:
111: 112: 113: 114: 115:
116: private $_borderRightColor;
117:
118: 119: 120: 121: 122:
123: private $_borderBottomSize;
124:
125: 126: 127: 128: 129:
130: private $_borderBottomColor;
131:
132: 133: 134: 135: 136:
137: private $_borderInsideHSize;
138:
139: 140: 141: 142: 143:
144: private $_borderInsideHColor;
145:
146: 147: 148: 149: 150:
151: private $_borderInsideVSize;
152:
153: 154: 155: 156: 157:
158: private $_borderInsideVColor;
159:
160:
161: 162: 163:
164: public function __construct($styleTable = null, $styleFirstRow = null, $styleLastRow = null)
165: {
166:
167: if (!is_null($styleFirstRow) && is_array($styleFirstRow)) {
168: $this->_firstRow = clone $this;
169:
170: unset($this->_firstRow->_firstRow);
171: unset($this->_firstRow->_cellMarginBottom);
172: unset($this->_firstRow->_cellMarginTop);
173: unset($this->_firstRow->_cellMarginLeft);
174: unset($this->_firstRow->_cellMarginRight);
175: unset($this->_firstRow->_borderInsideVColor);
176: unset($this->_firstRow->_borderInsideVSize);
177: unset($this->_firstRow->_borderInsideHColor);
178: unset($this->_firstRow->_borderInsideHSize);
179: foreach ($styleFirstRow as $key => $value) {
180: if (substr($key, 0, 1) != '_') {
181: $key = '_' . $key;
182: }
183:
184: $this->_firstRow->setStyleValue($key, $value);
185: }
186: }
187:
188: if (!is_null($styleTable) && is_array($styleTable)) {
189: foreach ($styleTable as $key => $value) {
190: if (substr($key, 0, 1) != '_') {
191: $key = '_' . $key;
192: }
193: $this->setStyleValue($key, $value);
194: }
195: }
196: }
197:
198: 199: 200: 201: 202: 203:
204: public function setStyleValue($key, $value)
205: {
206: if ($key == '_borderSize') {
207: $this->setBorderSize($value);
208: } elseif ($key == '_borderColor') {
209: $this->setBorderColor($value);
210: } elseif ($key == '_cellMargin') {
211: $this->setCellMargin($value);
212: } else {
213: $this->$key = $value;
214: }
215: }
216:
217: 218: 219: 220: 221:
222: public function getFirstRow()
223: {
224: return $this->_firstRow;
225: }
226:
227: 228: 229: 230: 231:
232: public function getLastRow()
233: {
234: return $this->_lastRow;
235: }
236:
237: public function getBgColor()
238: {
239: return $this->_bgColor;
240: }
241:
242: public function setBgColor($pValue = null)
243: {
244: $this->_bgColor = $pValue;
245: }
246:
247: 248: 249: 250: 251:
252: public function setBorderSize($pValue = null)
253: {
254: $this->_borderTopSize = $pValue;
255: $this->_borderLeftSize = $pValue;
256: $this->_borderRightSize = $pValue;
257: $this->_borderBottomSize = $pValue;
258: $this->_borderInsideHSize = $pValue;
259: $this->_borderInsideVSize = $pValue;
260: }
261:
262: 263: 264: 265: 266:
267: public function getBorderSize()
268: {
269: $t = $this->getBorderTopSize();
270: $l = $this->getBorderLeftSize();
271: $r = $this->getBorderRightSize();
272: $b = $this->getBorderBottomSize();
273: $h = $this->getBorderInsideHSize();
274: $v = $this->getBorderInsideVSize();
275:
276: return array($t, $l, $r, $b, $h, $v);
277: }
278:
279: 280: 281:
282: public function setBorderColor($pValue = null)
283: {
284: $this->_borderTopColor = $pValue;
285: $this->_borderLeftColor = $pValue;
286: $this->_borderRightColor = $pValue;
287: $this->_borderBottomColor = $pValue;
288: $this->_borderInsideHColor = $pValue;
289: $this->_borderInsideVColor = $pValue;
290: }
291:
292: 293: 294: 295: 296:
297: public function getBorderColor()
298: {
299: $t = $this->getBorderTopColor();
300: $l = $this->getBorderLeftColor();
301: $r = $this->getBorderRightColor();
302: $b = $this->getBorderBottomColor();
303: $h = $this->getBorderInsideHColor();
304: $v = $this->getBorderInsideVColor();
305:
306: return array($t, $l, $r, $b, $h, $v);
307: }
308:
309: public function setBorderTopSize($pValue = null)
310: {
311: $this->_borderTopSize = $pValue;
312: }
313:
314: public function getBorderTopSize()
315: {
316: return $this->_borderTopSize;
317: }
318:
319: public function setBorderTopColor($pValue = null)
320: {
321: $this->_borderTopColor = $pValue;
322: }
323:
324: public function getBorderTopColor()
325: {
326: return $this->_borderTopColor;
327: }
328:
329: public function setBorderLeftSize($pValue = null)
330: {
331: $this->_borderLeftSize = $pValue;
332: }
333:
334: public function getBorderLeftSize()
335: {
336: return $this->_borderLeftSize;
337: }
338:
339: public function setBorderLeftColor($pValue = null)
340: {
341: $this->_borderLeftColor = $pValue;
342: }
343:
344: public function getBorderLeftColor()
345: {
346: return $this->_borderLeftColor;
347: }
348:
349: public function setBorderRightSize($pValue = null)
350: {
351: $this->_borderRightSize = $pValue;
352: }
353:
354: public function getBorderRightSize()
355: {
356: return $this->_borderRightSize;
357: }
358:
359: public function setBorderRightColor($pValue = null)
360: {
361: $this->_borderRightColor = $pValue;
362: }
363:
364: public function getBorderRightColor()
365: {
366: return $this->_borderRightColor;
367: }
368:
369: public function setBorderBottomSize($pValue = null)
370: {
371: $this->_borderBottomSize = $pValue;
372: }
373:
374: public function getBorderBottomSize()
375: {
376: return $this->_borderBottomSize;
377: }
378:
379: public function setBorderBottomColor($pValue = null)
380: {
381: $this->_borderBottomColor = $pValue;
382: }
383:
384: public function getBorderBottomColor()
385: {
386: return $this->_borderBottomColor;
387: }
388:
389: public function setBorderInsideHColor($pValue = null)
390: {
391: $this->_borderInsideHColor = $pValue;
392: }
393:
394: public function getBorderInsideHColor()
395: {
396: return (isset($this->_borderInsideHColor)) ? $this->_borderInsideHColor : null;
397: }
398:
399: public function setBorderInsideVColor($pValue = null)
400: {
401: $this->_borderInsideVColor = $pValue;
402: }
403:
404: public function getBorderInsideVColor()
405: {
406: return (isset($this->_borderInsideVColor)) ? $this->_borderInsideVColor : null;
407: }
408:
409: public function setBorderInsideHSize($pValue = null)
410: {
411: $this->_borderInsideHSize = $pValue;
412: }
413:
414: public function getBorderInsideHSize()
415: {
416: return (isset($this->_borderInsideHSize)) ? $this->_borderInsideHSize : null;
417: }
418:
419: public function setBorderInsideVSize($pValue = null)
420: {
421: $this->_borderInsideVSize = $pValue;
422: }
423:
424: public function getBorderInsideVSize()
425: {
426: return (isset($this->_borderInsideVSize)) ? $this->_borderInsideVSize : null;
427: }
428:
429: public function setCellMarginTop($pValue = null)
430: {
431: $this->_cellMarginTop = $pValue;
432: }
433:
434: public function getCellMarginTop()
435: {
436: return $this->_cellMarginTop;
437: }
438:
439: public function setCellMarginLeft($pValue = null)
440: {
441: $this->_cellMarginLeft = $pValue;
442: }
443:
444: public function getCellMarginLeft()
445: {
446: return $this->_cellMarginLeft;
447: }
448:
449: public function setCellMarginRight($pValue = null)
450: {
451: $this->_cellMarginRight = $pValue;
452: }
453:
454: public function getCellMarginRight()
455: {
456: return $this->_cellMarginRight;
457: }
458:
459: public function setCellMarginBottom($pValue = null)
460: {
461: $this->_cellMarginBottom = $pValue;
462: }
463:
464: public function getCellMarginBottom()
465: {
466: return $this->_cellMarginBottom;
467: }
468:
469: public function setCellMargin($pValue = null)
470: {
471: $this->_cellMarginTop = $pValue;
472: $this->_cellMarginLeft = $pValue;
473: $this->_cellMarginRight = $pValue;
474: $this->_cellMarginBottom = $pValue;
475: }
476:
477: public function getCellMargin()
478: {
479: return array($this->_cellMarginTop, $this->_cellMarginLeft, $this->_cellMarginRight, $this->_cellMarginBottom);
480: }
481: }
482: