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: 32: 33: 34: 35: 36: 37:
38: namespace MOC\Module\Office\Document\Excel\Cell\Style;
39: use MOC\Api;
40: use MOC\Generic\Device\Module;
41:
42: 43: 44:
45: class Color implements Module {
46: 47: 48: 49: 50: 51:
52: public static function InterfaceChangelog() {
53: return Api::Core()->Changelog()->Create( __CLASS__ );
54: }
55:
56: 57: 58: 59: 60: 61:
62: public static function InterfaceDepending() {
63: return Api::Core()->Depending();
64: }
65:
66: 67: 68: 69: 70: 71:
72: public static function InterfaceInstance() {
73: return new Color();
74: }
75:
76: 77: 78:
79: public function Black() {
80: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
81: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_BLACK ) );
82: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_BLACK ) );
83: return Api::Module()->Office()->Document()->Excel();
84: }
85:
86: 87: 88:
89: public function Blue() {
90: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
91: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_BLUE ) );
92: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_BLUE ) );
93: return Api::Module()->Office()->Document()->Excel();
94: }
95:
96: 97: 98:
99: public function DarkBlue() {
100: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
101: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKBLUE ) );
102: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKBLUE ) );
103: return Api::Module()->Office()->Document()->Excel();
104: }
105:
106: 107: 108:
109: public function DarkGreen() {
110: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
111: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKGREEN ) );
112: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKGREEN ) );
113: return Api::Module()->Office()->Document()->Excel();
114: }
115:
116: 117: 118:
119: public function DarkRed() {
120: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
121: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKRED ) );
122: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKRED ) );
123: return Api::Module()->Office()->Document()->Excel();
124: }
125:
126: 127: 128:
129: public function DarkYellow() {
130: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
131: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKYELLOW ) );
132: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_DARKYELLOW ) );
133: return Api::Module()->Office()->Document()->Excel();
134: }
135:
136: 137: 138:
139: public function Green() {
140: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
141: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_GREEN ) );
142: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_GREEN ) );
143: return Api::Module()->Office()->Document()->Excel();
144: }
145:
146: 147: 148:
149: public function Red() {
150: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
151: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_RED ) );
152: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_RED ) );
153: return Api::Module()->Office()->Document()->Excel();
154: }
155:
156: 157: 158:
159: public function White() {
160: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
161: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_WHITE ) );
162: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_WHITE ) );
163: return Api::Module()->Office()->Document()->Excel();
164: }
165:
166: 167: 168:
169: public function Yellow() {
170: $this->getColor()->setFillType( \PHPExcel_Style_Fill::FILL_SOLID );
171: $this->getColor()->setStartColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_YELLOW ) );
172: $this->getColor()->setEndColor( new \PHPExcel_Style_Color( \PHPExcel_Style_Color::COLOR_YELLOW ) );
173: return Api::Module()->Office()->Document()->Excel();
174: }
175:
176: 177: 178:
179: private function getColor() {
180: return Api::Extension()->Excel()->Current()
181: ->getActiveSheet()
182: ->getStyle(
183: Api::Module()->Office()->Document()->Excel()
184: ->Cell()->Select()->Current()
185: )
186: ->getFill();
187: }
188: }
189: