123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469 |
- <?php
- /**
- * PHPWord
- *
- * Copyright (c) 2011 PHPWord
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPWord
- * @package PHPWord
- * @copyright Copyright (c) 010 PHPWord
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version Beta 0.6.3, 08.07.2011
- */
- /**
- * PHPWord_Style_TableFull
- *
- * @category PHPWord
- * @package PHPWord_Style
- * @copyright Copyright (c) 2011 PHPWord
- */
- class PHPWord_Style_TableFull {
-
- /**
- * Style for first row
- *
- * @var PHPWord_Style_Table
- */
- private $_firstRow = null;
-
- /**
- * Cell Margin Top
- *
- * @var int
- */
- private $_cellMarginTop = null;
-
- /**
- * Cell Margin Left
- *
- * @var int
- */
- private $_cellMarginLeft = null;
-
- /**
- * Cell Margin Right
- *
- * @var int
- */
- private $_cellMarginRight = null;
-
- /**
- * Cell Margin Bottom
- *
- * @var int
- */
- private $_cellMarginBottom = null;
-
- /**
- * Background-Color
- *
- * @var string
- */
- private $_bgColor;
-
- /**
- * Border Top Size
- *
- * @var int
- */
- private $_borderTopSize;
-
- /**
- * Border Top Color
- *
- * @var string
- */
- private $_borderTopColor;
-
- /**
- * Border Left Size
- *
- * @var int
- */
- private $_borderLeftSize;
-
- /**
- * Border Left Color
- *
- * @var string
- */
- private $_borderLeftColor;
-
- /**
- * Border Right Size
- *
- * @var int
- */
- private $_borderRightSize;
-
- /**
- * Border Right Color
- *
- * @var string
- */
- private $_borderRightColor;
-
- /**
- * Border Bottom Size
- *
- * @var int
- */
- private $_borderBottomSize;
-
- /**
- * Border Bottom Color
- *
- * @var string
- */
- private $_borderBottomColor;
-
- /**
- * Border InsideH Size
- *
- * @var int
- */
- private $_borderInsideHSize;
-
- /**
- * Border InsideH Color
- *
- * @var string
- */
- private $_borderInsideHColor;
-
- /**
- * Border InsideV Size
- *
- * @var int
- */
- private $_borderInsideVSize;
-
- /**
- * Border InsideV Color
- *
- * @var string
- */
- private $_borderInsideVColor;
-
- // 表格居中属性,用法:表格style数组中:'tableAlign' => 'center'
- private $_tableAlign = NULL;
-
- // 表格缩进属性
- private $_tableIndent = NULL;
-
- /**
- * Create a new TableFull Font
- */
- public function __construct($styleTable = null, $styleFirstRow = null, $styleLastRow = null) {
-
- if(!is_null($styleFirstRow) && is_array($styleFirstRow)) {
- $this->_firstRow = clone $this;
-
- unset($this->_firstRow->_firstRow);
- unset($this->_firstRow->_cellMarginBottom);
- unset($this->_firstRow->_cellMarginTop);
- unset($this->_firstRow->_cellMarginLeft);
- unset($this->_firstRow->_cellMarginRight);
- unset($this->_firstRow->_borderInsideVColor);
- unset($this->_firstRow->_borderInsideVSize);
- unset($this->_firstRow->_borderInsideHColor);
- unset($this->_firstRow->_borderInsideHSize);
- unset($this->_firstRow->_tableAlign);
- unset($this->_firstRow->_tableIndent);
- foreach($styleFirstRow as $key => $value) {
- if(substr($key, 0, 1) != '_') {
- $key = '_'.$key;
- }
-
- $this->_firstRow->setStyleValue($key, $value);
- }
- }
-
- if(!is_null($styleTable) && is_array($styleTable)) {
- foreach($styleTable as $key => $value) {
- if(substr($key, 0, 1) != '_') {
- $key = '_'.$key;
- }
- $this->setStyleValue($key, $value);
- }
- }
- }
-
- public function setTableAlign($pValue = NULL)
- {
- $this->_tableAlign = $pValue;
- }
-
- public function getTableAlign()
- {
- return $this->_tableAlign;
- }
-
- public function setTableIndent($pValue = NULL)
- {
- $this->_tableIndent = $pValue;
- }
-
- public function getTableIndent()
- {
- return $this->_tableIndent;
- }
-
- /**
- * Set style value
- *
- * @param string $key
- * @param mixed $value
- */
- public function setStyleValue($key, $value) {
- if($key == '_borderSize') {
- $this->setBorderSize($value);
- } elseif($key == '_borderColor') {
- $this->setBorderColor($value);
- } elseif($key == '_cellMargin') {
- $this->setCellMargin($value);
- } else {
- $this->$key = $value;
- }
- }
-
- /**
- * Get First Row Style
- *
- * @return PHPWord_Style_TableFull
- */
- public function getFirstRow() {
- return $this->_firstRow;
- }
-
- /**
- * Get Last Row Style
- *
- * @return PHPWord_Style_TableFull
- */
- public function getLastRow() {
- return $this->_lastRow;
- }
-
- public function getBgColor() {
- return $this->_bgColor;
- }
- public function setBgColor($pValue = null) {
- $this->_bgColor = $pValue;
- }
- /**
- * Set TLRBVH Border Size
- *
- * @param int $pValue
- */
- public function setBorderSize($pValue = null) {
- $this->_borderTopSize = $pValue;
- $this->_borderLeftSize = $pValue;
- $this->_borderRightSize = $pValue;
- $this->_borderBottomSize = $pValue;
- $this->_borderInsideHSize = $pValue;
- $this->_borderInsideVSize = $pValue;
- }
-
- /**
- * Get TLRBVH Border Size
- *
- * @return array
- */
- public function getBorderSize() {
- $t = $this->getBorderTopSize();
- $l = $this->getBorderLeftSize();
- $r = $this->getBorderRightSize();
- $b = $this->getBorderBottomSize();
- $h = $this->getBorderInsideHSize();
- $v = $this->getBorderInsideVSize();
-
- return array($t, $l, $r, $b, $h, $v);
- }
-
- /**
- * Set TLRBVH Border Color
- */
- public function setBorderColor($pValue = null) {
- $this->_borderTopColor = $pValue;
- $this->_borderLeftColor = $pValue;
- $this->_borderRightColor = $pValue;
- $this->_borderBottomColor = $pValue;
- $this->_borderInsideHColor = $pValue;
- $this->_borderInsideVColor = $pValue;
- }
-
- /**
- * Get TLRB Border Color
- *
- * @return array
- */
- public function getBorderColor() {
- $t = $this->getBorderTopColor();
- $l = $this->getBorderLeftColor();
- $r = $this->getBorderRightColor();
- $b = $this->getBorderBottomColor();
- $h = $this->getBorderInsideHColor();
- $v = $this->getBorderInsideVColor();
-
- return array($t, $l, $r, $b, $h, $v);
- }
-
- public function setBorderTopSize($pValue = null) {
- $this->_borderTopSize = $pValue;
- }
-
- public function getBorderTopSize() {
- return $this->_borderTopSize;
- }
-
- public function setBorderTopColor($pValue = null) {
- $this->_borderTopColor = $pValue;
- }
-
- public function getBorderTopColor() {
- return $this->_borderTopColor;
- }
- public function setBorderLeftSize($pValue = null) {
- $this->_borderLeftSize = $pValue;
- }
-
- public function getBorderLeftSize() {
- return $this->_borderLeftSize;
- }
-
- public function setBorderLeftColor($pValue = null) {
- $this->_borderLeftColor = $pValue;
- }
-
- public function getBorderLeftColor() {
- return $this->_borderLeftColor;
- }
-
- public function setBorderRightSize($pValue = null) {
- $this->_borderRightSize = $pValue;
- }
-
- public function getBorderRightSize() {
- return $this->_borderRightSize;
- }
-
- public function setBorderRightColor($pValue = null) {
- $this->_borderRightColor = $pValue;
- }
-
- public function getBorderRightColor() {
- return $this->_borderRightColor;
- }
-
- public function setBorderBottomSize($pValue = null) {
- $this->_borderBottomSize = $pValue;
- }
-
- public function getBorderBottomSize() {
- return $this->_borderBottomSize;
- }
-
- public function setBorderBottomColor($pValue = null) {
- $this->_borderBottomColor = $pValue;
- }
-
- public function getBorderBottomColor() {
- return $this->_borderBottomColor;
- }
-
- public function setBorderInsideHColor($pValue = null) {
- $this->_borderInsideHColor = $pValue;
- }
-
- public function getBorderInsideHColor() {
- return (isset($this->_borderInsideHColor)) ? $this->_borderInsideHColor : null;
- }
-
- public function setBorderInsideVColor($pValue = null) {
- $this->_borderInsideVColor = $pValue;
- }
-
- public function getBorderInsideVColor() {
- return (isset($this->_borderInsideVColor)) ? $this->_borderInsideVColor : null;
- }
-
- public function setBorderInsideHSize($pValue = null) {
- $this->_borderInsideHSize = $pValue;
- }
-
- public function getBorderInsideHSize() {
- return (isset($this->_borderInsideHSize)) ? $this->_borderInsideHSize : null;
- }
-
- public function setBorderInsideVSize($pValue = null) {
- $this->_borderInsideVSize = $pValue;
- }
-
- public function getBorderInsideVSize() {
- return (isset($this->_borderInsideVSize)) ? $this->_borderInsideVSize : null;
- }
-
- public function setCellMarginTop($pValue = null) {
- $this->_cellMarginTop = $pValue;
- }
-
- public function getCellMarginTop() {
- return $this->_cellMarginTop;
- }
-
- public function setCellMarginLeft($pValue = null) {
- $this->_cellMarginLeft = $pValue;
- }
-
- public function getCellMarginLeft() {
- return $this->_cellMarginLeft;
- }
-
- public function setCellMarginRight($pValue = null) {
- $this->_cellMarginRight = $pValue;
- }
-
- public function getCellMarginRight() {
- return $this->_cellMarginRight;
- }
-
- public function setCellMarginBottom($pValue = null) {
- $this->_cellMarginBottom = $pValue;
- }
-
- public function getCellMarginBottom() {
- return $this->_cellMarginBottom;
- }
-
- public function setCellMargin($pValue = null) {
- $this->_cellMarginTop = $pValue;
- $this->_cellMarginLeft = $pValue;
- $this->_cellMarginRight = $pValue;
- $this->_cellMarginBottom = $pValue;
- }
-
- public function getCellMargin() {
- return array($this->_cellMarginTop, $this->_cellMarginLeft, $this->_cellMarginRight, $this->_cellMarginBottom);
- }
- }
- ?>
|