1: <?php
2: /**
3: * PHPWord
4: *
5: * Copyright (c) 2013 PHPWord
6: *
7: * This library is free software; you can redistribute it and/or
8: * modify it under the terms of the GNU Lesser General Public
9: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20: *
21: * @category PHPWord
22: * @package PHPWord
23: * @copyright Copyright (c) 2013 PHPWord
24: * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25: * @version 0.7.0
26: */
27:
28: /**
29: * PHPWord_Style_Cell
30: */
31: class PHPWord_Style_Cell
32: {
33:
34: const TEXT_DIR_BTLR = 'btLr';
35: const TEXT_DIR_TBRL = 'tbRl';
36:
37: /**
38: * Vertical align
39: *
40: * @var string
41: */
42: private $_valign;
43:
44: /**
45: * Text Direction
46: *
47: * @var string
48: */
49: private $_textDirection;
50:
51: /**
52: * Background-Color
53: *
54: * @var string
55: */
56: private $_bgColor;
57:
58: /**
59: * Border Top Size
60: *
61: * @var int
62: */
63: private $_borderTopSize;
64:
65: /**
66: * Border Top Color
67: *
68: * @var string
69: */
70: private $_borderTopColor;
71:
72: /**
73: * Border Left Size
74: *
75: * @var int
76: */
77: private $_borderLeftSize;
78:
79: /**
80: * Border Left Color
81: *
82: * @var string
83: */
84: private $_borderLeftColor;
85:
86: /**
87: * Border Right Size
88: *
89: * @var int
90: */
91: private $_borderRightSize;
92:
93: /**
94: * Border Right Color
95: *
96: * @var string
97: */
98: private $_borderRightColor;
99:
100: /**
101: * Border Bottom Size
102: *
103: * @var int
104: */
105: private $_borderBottomSize;
106:
107: /**
108: * Border Bottom Color
109: *
110: * @var string
111: */
112: private $_borderBottomColor;
113:
114: /**
115: * Border Default Color
116: *
117: * @var string
118: */
119: private $_defaultBorderColor;
120:
121: /**
122: * colspan
123: *
124: * @var integer
125: */
126: private $_gridSpan = NULL;
127:
128: /**
129: * rowspan
130: *
131: * @var integer
132: */
133: private $_vMerge = NULL;
134:
135: /**
136: * Create a new Cell Style
137: */
138: public function __construct()
139: {
140: $this->_valign = null;
141: $this->_textDirection = null;
142: $this->_bgColor = null;
143: $this->_borderTopSize = null;
144: $this->_borderTopColor = null;
145: $this->_borderLeftSize = null;
146: $this->_borderLeftColor = null;
147: $this->_borderRightSize = null;
148: $this->_borderRightColor = null;
149: $this->_borderBottomSize = null;
150: $this->_borderBottomColor = null;
151: $this->_defaultBorderColor = '000000';
152: }
153:
154: /**
155: * Set style value
156: *
157: * @var string $key
158: * @var mixed $value
159: */
160: public function setStyleValue($key, $value)
161: {
162: if ($key == '_borderSize') {
163: $this->setBorderSize($value);
164: } elseif ($key == '_borderColor') {
165: $this->setBorderColor($value);
166: } else {
167: $this->$key = $value;
168: }
169: }
170:
171: public function getVAlign()
172: {
173: return $this->_valign;
174: }
175:
176: public function setVAlign($pValue = null)
177: {
178: $this->_valign = $pValue;
179: }
180:
181: public function getTextDirection()
182: {
183: return $this->_textDirection;
184: }
185:
186: public function setTextDirection($pValue = null)
187: {
188: $this->_textDirection = $pValue;
189: }
190:
191: public function getBgColor()
192: {
193: return $this->_bgColor;
194: }
195:
196: public function setBgColor($pValue = null)
197: {
198: $this->_bgColor = $pValue;
199: }
200:
201: public function setHeight($pValue = null)
202: {
203: $this->_height = $pValue;
204: }
205:
206: public function setBorderSize($pValue = null)
207: {
208: $this->_borderTopSize = $pValue;
209: $this->_borderLeftSize = $pValue;
210: $this->_borderRightSize = $pValue;
211: $this->_borderBottomSize = $pValue;
212: }
213:
214: public function getBorderSize()
215: {
216: $t = $this->getBorderTopSize();
217: $l = $this->getBorderLeftSize();
218: $r = $this->getBorderRightSize();
219: $b = $this->getBorderBottomSize();
220:
221: return array($t, $l, $r, $b);
222: }
223:
224: public function setBorderColor($pValue = null)
225: {
226: $this->_borderTopColor = $pValue;
227: $this->_borderLeftColor = $pValue;
228: $this->_borderRightColor = $pValue;
229: $this->_borderBottomColor = $pValue;
230: }
231:
232: public function getBorderColor()
233: {
234: $t = $this->getBorderTopColor();
235: $l = $this->getBorderLeftColor();
236: $r = $this->getBorderRightColor();
237: $b = $this->getBorderBottomColor();
238:
239: return array($t, $l, $r, $b);
240: }
241:
242: public function setBorderTopSize($pValue = null)
243: {
244: $this->_borderTopSize = $pValue;
245: }
246:
247: public function getBorderTopSize()
248: {
249: return $this->_borderTopSize;
250: }
251:
252: public function setBorderTopColor($pValue = null)
253: {
254: $this->_borderTopColor = $pValue;
255: }
256:
257: public function getBorderTopColor()
258: {
259: return $this->_borderTopColor;
260: }
261:
262: public function setBorderLeftSize($pValue = null)
263: {
264: $this->_borderLeftSize = $pValue;
265: }
266:
267: public function getBorderLeftSize()
268: {
269: return $this->_borderLeftSize;
270: }
271:
272: public function setBorderLeftColor($pValue = null)
273: {
274: $this->_borderLeftColor = $pValue;
275: }
276:
277: public function getBorderLeftColor()
278: {
279: return $this->_borderLeftColor;
280: }
281:
282: public function setBorderRightSize($pValue = null)
283: {
284: $this->_borderRightSize = $pValue;
285: }
286:
287: public function getBorderRightSize()
288: {
289: return $this->_borderRightSize;
290: }
291:
292: public function setBorderRightColor($pValue = null)
293: {
294: $this->_borderRightColor = $pValue;
295: }
296:
297: public function getBorderRightColor()
298: {
299: return $this->_borderRightColor;
300: }
301:
302:
303: public function setBorderBottomSize($pValue = null)
304: {
305: $this->_borderBottomSize = $pValue;
306: }
307:
308: public function getBorderBottomSize()
309: {
310: return $this->_borderBottomSize;
311: }
312:
313: public function setBorderBottomColor($pValue = null)
314: {
315: $this->_borderBottomColor = $pValue;
316: }
317:
318: public function getBorderBottomColor()
319: {
320: return $this->_borderBottomColor;
321: }
322:
323: public function getDefaultBorderColor()
324: {
325: return $this->_defaultBorderColor;
326: }
327:
328: public function setGridSpan($pValue = null)
329: {
330: $this->_gridSpan = $pValue;
331: }
332:
333: public function getGridSpan()
334: {
335: return $this->_gridSpan;
336: }
337:
338: public function setVMerge($pValue = null)
339: {
340: $this->_vMerge = $pValue;
341: }
342:
343: public function getVMerge()
344: {
345: return $this->_vMerge;
346: }
347: }