1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <resources.hxx>
25 
26 namespace writerfilter {
27 namespace doctok {
28 
29 /* WW8sprmTDefTable */
30 
get_cellx_count()31 sal_uInt32 WW8sprmTDefTable::get_cellx_count()
32 {
33     return getU8(0x4) + 1;
34 }
35 
get_cellx(sal_uInt32 nIndex)36 sal_uInt16 WW8sprmTDefTable::get_cellx(sal_uInt32 nIndex)
37 {
38     return getU16(0x5 + nIndex * 2);
39 }
40 
get_tc_count()41 sal_uInt32 WW8sprmTDefTable::get_tc_count()
42 {
43     return get_cellx_count() - 1;
44 }
45 
46 writerfilter::Reference<Properties>::Pointer_t
get_tc(sal_uInt32 pos)47 WW8sprmTDefTable::get_tc(sal_uInt32 pos)
48 {
49     return writerfilter::Reference<Properties>::Pointer_t
50         (new WW8TC(this,
51                    0x5 + get_cellx_count() * 2 + pos * WW8TC::getSize()));
52 }
53 
54 /* WW8sprmTTableBorders */
55 
get_rgbbrc_count()56 sal_uInt32 WW8sprmTTableBorders::get_rgbbrc_count()
57 {
58     return 6;
59 }
60 
61 writerfilter::Reference<Properties>::Pointer_t
get_rgbbrc(sal_uInt32 pos)62 WW8sprmTTableBorders::get_rgbbrc(sal_uInt32 pos)
63 {
64     return writerfilter::Reference<Properties>::Pointer_t
65         (new WW8BRC(*this, 0x3 + pos * WW8BRC::getSize()));
66 }
67 
68 /* WW8sprmTCellBottomColor */
69 
calcSize()70 sal_uInt32 WW8sprmTCellBottomColor::calcSize()
71 {
72     return  get_cellBottomColor_count() * 4 + 3;
73 }
74 
get_cellBottomColor_count()75 sal_uInt32 WW8sprmTCellBottomColor::get_cellBottomColor_count()
76 {
77     return getU8(0x2) / 4;
78 }
79 
get_cellBottomColor(sal_uInt32 pos)80 sal_uInt32 WW8sprmTCellBottomColor::get_cellBottomColor(sal_uInt32 pos)
81 {
82     return getU32(0x3 + 4 * pos);
83 }
84 
85 /* WW8sprmTCellLeftColor */
86 
calcSize()87 sal_uInt32 WW8sprmTCellLeftColor::calcSize()
88 {
89     return  get_cellLeftColor_count() * 4 + 3;
90 }
91 
get_cellLeftColor_count()92 sal_uInt32 WW8sprmTCellLeftColor::get_cellLeftColor_count()
93 {
94     return getU8(0x2) / 4;
95 }
96 
get_cellLeftColor(sal_uInt32 pos)97 sal_uInt32 WW8sprmTCellLeftColor::get_cellLeftColor(sal_uInt32 pos)
98 {
99     return getU32(0x3 + 4 * pos);
100 }
101 
102 /* WW8sprmTCellTopColor */
103 
calcSize()104 sal_uInt32 WW8sprmTCellTopColor::calcSize()
105 {
106     return  get_cellTopColor_count() * 4 + 3;
107 }
108 
get_cellTopColor_count()109 sal_uInt32 WW8sprmTCellTopColor::get_cellTopColor_count()
110 {
111     return getU8(0x2) / 4;
112 }
113 
get_cellTopColor(sal_uInt32 pos)114 sal_uInt32 WW8sprmTCellTopColor::get_cellTopColor(sal_uInt32 pos)
115 {
116     return getU32(0x3 + 4 * pos);
117 }
118 
119 /* WW8sprmTCellRightColor */
120 
calcSize()121 sal_uInt32 WW8sprmTCellRightColor::calcSize()
122 {
123     return  get_cellRightColor_count() * 4 + 3;
124 }
125 
get_cellRightColor_count()126 sal_uInt32 WW8sprmTCellRightColor::get_cellRightColor_count()
127 {
128     return getU8(0x2) / 4;
129 }
130 
get_cellRightColor(sal_uInt32 pos)131 sal_uInt32 WW8sprmTCellRightColor::get_cellRightColor(sal_uInt32 pos)
132 {
133     return getU32(0x3 + 4 * pos);
134 }
135 
136 /* WW8sprmTGridLineProps */
137 
calcSize()138 sal_uInt32 WW8sprmTGridLineProps::calcSize()
139 {
140     return getSize();
141 }
142 
143 /* WW8sprmTDefTableShd */
144 
calcSize()145 sal_uInt32 WW8sprmTDefTableShd::calcSize()
146 {
147     return get_shd_count() * WW8SHD::getSize() + 3;
148 }
149 
get_shd_count()150 sal_uInt32 WW8sprmTDefTableShd::get_shd_count()
151 {
152     return getU8(0x2) / WW8SHD::getSize();
153 }
154 
155 writerfilter::Reference<Properties>::Pointer_t
get_shd(sal_uInt32 pos)156 WW8sprmTDefTableShd::get_shd(sal_uInt32 pos)
157 {
158     return writerfilter::Reference<Properties>::Pointer_t
159         (new WW8SHD(*this, 0x3 + pos * WW8SHD::getSize()));
160 }
161 
162 /* WW8sprmTCellShd */
163 
calcSize()164 sal_uInt32 WW8sprmTCellShd::calcSize()
165 {
166     return get_shd_count() * WW8CellShd::getSize();
167 }
168 
get_shd_count()169 sal_uInt32 WW8sprmTCellShd::get_shd_count()
170 {
171     return getU8(0x2) / WW8CellShd::getSize();
172 }
173 
174 writerfilter::Reference<Properties>::Pointer_t
get_shd(sal_uInt32 pos)175 WW8sprmTCellShd::get_shd(sal_uInt32 pos)
176 {
177     return writerfilter::Reference<Properties>::Pointer_t
178         (new WW8CellShd(*this, 0x3 + pos * WW8CellShd::getSize()));
179 }
180 
181 /* WW8sprmTCellShadow */
182 
calcSize()183 sal_uInt32 WW8sprmTCellShadow::calcSize()
184 {
185     return get_cellShadow_count() * WW8CellShd::getSize();
186 }
187 
get_cellShadow_count()188 sal_uInt32 WW8sprmTCellShadow::get_cellShadow_count()
189 {
190     return getU8(0x2) / WW8CellShd::getSize();
191 }
192 
193 writerfilter::Reference<Properties>::Pointer_t
get_cellShadow(sal_uInt32 pos)194 WW8sprmTCellShadow::get_cellShadow(sal_uInt32 pos)
195 {
196     return writerfilter::Reference<Properties>::Pointer_t
197         (new WW8CellShd(*this, 0x3 + pos * WW8CellShd::getSize()));
198 }
199 
200 }}
201