tablecell.cxx (4323f6b5) tablecell.cxx (f1574915)
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

--- 137 unchanged lines hidden (view full) ---

146 case XML_just:
147 case XML_dist:
148 default:
149 case XML_t: eVA = drawing::TextVerticalAdjust_TOP; break;
150 }
151 xPropSet->setPropertyValue( sVerticalAdjust, Any( eVA ) );
152}
153
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

--- 137 unchanged lines hidden (view full) ---

146 case XML_just:
147 case XML_dist:
148 default:
149 case XML_t: eVA = drawing::TextVerticalAdjust_TOP; break;
150 }
151 xPropSet->setPropertyValue( sVerticalAdjust, Any( eVA ) );
152}
153
154// save char color from tblstyle for combination later
155void lcl_getCharPropFromTblStylePart(TextCharacterProperties& rDstCharProp, const TableStylePart& rSrcTblStyle)
156{
157 const Color& clr = const_cast<TableStylePart&>(rSrcTblStyle).getTextColor();
158 if (clr.isUsed())
159 rDstCharProp.maCharColor = clr;
160 // TODO: there may be other similar properties from tblstyle which need combination later
161}
162
154void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
155 const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
156 const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
157{
158 TableStyle& rTable( const_cast< TableStyle& >( rTableStyle ) );
159 TableProperties& rProperties( const_cast< TableProperties& >( rTableProperties ) );
160
161 Reference< text::XText > xText( rxCell, UNO_QUERY_THROW );
162 Reference< text::XTextCursor > xAt = xText->createTextCursor();
163
164 applyTableCellProperties( rxCell, *this );
163void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
164 const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
165 const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
166{
167 TableStyle& rTable( const_cast< TableStyle& >( rTableStyle ) );
168 TableProperties& rProperties( const_cast< TableProperties& >( rTableProperties ) );
169
170 Reference< text::XText > xText( rxCell, UNO_QUERY_THROW );
171 Reference< text::XTextCursor > xAt = xText->createTextCursor();
172
173 applyTableCellProperties( rxCell, *this );
165 TextCharacterProperties aTextStyleProps;
166 getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
167
168 Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
169 oox::drawingml::FillProperties aFillProperties;
170 oox::drawingml::LineProperties aLinePropertiesLeft;
171 oox::drawingml::LineProperties aLinePropertiesRight;
172 oox::drawingml::LineProperties aLinePropertiesTop;
173 oox::drawingml::LineProperties aLinePropertiesBottom;
174 oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight;

--- 7 unchanged lines hidden (view full) ---

182 aLinePropertiesLeft,
183 aLinePropertiesRight,
184 aLinePropertiesTop,
185 aLinePropertiesBottom,
186 aLinePropertiesTopLeftToBottomRight,
187 aLinePropertiesBottomLeftToTopRight,
188 rTable.getWholeTbl() );
189
174
175 Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
176 oox::drawingml::FillProperties aFillProperties;
177 oox::drawingml::LineProperties aLinePropertiesLeft;
178 oox::drawingml::LineProperties aLinePropertiesRight;
179 oox::drawingml::LineProperties aLinePropertiesTop;
180 oox::drawingml::LineProperties aLinePropertiesBottom;
181 oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight;

--- 7 unchanged lines hidden (view full) ---

189 aLinePropertiesLeft,
190 aLinePropertiesRight,
191 aLinePropertiesTop,
192 aLinePropertiesBottom,
193 aLinePropertiesTopLeftToBottomRight,
194 aLinePropertiesBottomLeftToTopRight,
195 rTable.getWholeTbl() );
196
197 // get char color from tblstyle for combination later
198 TextCharacterProperties aTextCharProps;
199 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getWholeTbl());
200
190 if ( rProperties.isFirstRow() && ( nRow == 0 ) )
191 {
192 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
193 aLinePropertiesLeft,
194 aLinePropertiesRight,
195 aLinePropertiesTop,
196 aLinePropertiesBottom,
197 aLinePropertiesTopLeftToBottomRight,
198 aLinePropertiesBottomLeftToTopRight,
199 rTable.getFirstRow() );
201 if ( rProperties.isFirstRow() && ( nRow == 0 ) )
202 {
203 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
204 aLinePropertiesLeft,
205 aLinePropertiesRight,
206 aLinePropertiesTop,
207 aLinePropertiesBottom,
208 aLinePropertiesTopLeftToBottomRight,
209 aLinePropertiesBottomLeftToTopRight,
210 rTable.getFirstRow() );
211 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getFirstRow());
200 }
201 if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
202 {
203 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
204 aLinePropertiesLeft,
205 aLinePropertiesRight,
206 aLinePropertiesTop,
207 aLinePropertiesBottom,
208 aLinePropertiesTopLeftToBottomRight,
209 aLinePropertiesBottomLeftToTopRight,
210 rTable.getLastRow() );
212 }
213 if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
214 {
215 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
216 aLinePropertiesLeft,
217 aLinePropertiesRight,
218 aLinePropertiesTop,
219 aLinePropertiesBottom,
220 aLinePropertiesTopLeftToBottomRight,
221 aLinePropertiesBottomLeftToTopRight,
222 rTable.getLastRow() );
223 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getLastRow());
211 }
212 if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
213 {
214 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
215 aLinePropertiesLeft,
216 aLinePropertiesRight,
217 aLinePropertiesTop,
218 aLinePropertiesBottom,
219 aLinePropertiesTopLeftToBottomRight,
220 aLinePropertiesBottomLeftToTopRight,
221 rTable.getFirstCol() );
224 }
225 if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
226 {
227 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
228 aLinePropertiesLeft,
229 aLinePropertiesRight,
230 aLinePropertiesTop,
231 aLinePropertiesBottom,
232 aLinePropertiesTopLeftToBottomRight,
233 aLinePropertiesBottomLeftToTopRight,
234 rTable.getFirstCol() );
235 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getFirstCol());
222 }
223 if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
224 {
225 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
226 aLinePropertiesLeft,
227 aLinePropertiesRight,
228 aLinePropertiesTop,
229 aLinePropertiesBottom,
230 aLinePropertiesTopLeftToBottomRight,
231 aLinePropertiesBottomLeftToTopRight,
232 rTable.getLastCol() );
236 }
237 if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
238 {
239 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
240 aLinePropertiesLeft,
241 aLinePropertiesRight,
242 aLinePropertiesTop,
243 aLinePropertiesBottom,
244 aLinePropertiesTopLeftToBottomRight,
245 aLinePropertiesBottomLeftToTopRight,
246 rTable.getLastCol() );
247 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getLastCol());
233 }
234 if ( rProperties.isBandRow() )
235 {
236 if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
237 ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) )
238 {
239 sal_Int32 nBand = nRow;
240 if ( rProperties.isFirstRow() )
241 nBand++;
242 if ( nBand & 1 )
243 {
244 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
245 aLinePropertiesLeft,
246 aLinePropertiesRight,
247 aLinePropertiesTop,
248 aLinePropertiesBottom,
249 aLinePropertiesTopLeftToBottomRight,
250 aLinePropertiesBottomLeftToTopRight,
251 rTable.getBand2H() );
248 }
249 if ( rProperties.isBandRow() )
250 {
251 if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
252 ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) )
253 {
254 sal_Int32 nBand = nRow;
255 if ( rProperties.isFirstRow() )
256 nBand++;
257 if ( nBand & 1 )
258 {
259 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
260 aLinePropertiesLeft,
261 aLinePropertiesRight,
262 aLinePropertiesTop,
263 aLinePropertiesBottom,
264 aLinePropertiesTopLeftToBottomRight,
265 aLinePropertiesBottomLeftToTopRight,
266 rTable.getBand2H() );
267 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand2H());
252 }
253 else
254 {
255 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
256 aLinePropertiesLeft,
257 aLinePropertiesRight,
258 aLinePropertiesTop,
259 aLinePropertiesBottom,
260 aLinePropertiesTopLeftToBottomRight,
261 aLinePropertiesBottomLeftToTopRight,
262 rTable.getBand1H() );
268 }
269 else
270 {
271 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
272 aLinePropertiesLeft,
273 aLinePropertiesRight,
274 aLinePropertiesTop,
275 aLinePropertiesBottom,
276 aLinePropertiesTopLeftToBottomRight,
277 aLinePropertiesBottomLeftToTopRight,
278 rTable.getBand1H() );
279 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand1H());
263 }
264 }
265 }
266 if ( ( nRow == 0 ) && ( nColumn == 0 ) )
267 {
268 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
269 aLinePropertiesLeft,
270 aLinePropertiesRight,
271 aLinePropertiesTop,
272 aLinePropertiesBottom,
273 aLinePropertiesTopLeftToBottomRight,
274 aLinePropertiesBottomLeftToTopRight,
275 rTable.getNwCell() );
280 }
281 }
282 }
283 if ( ( nRow == 0 ) && ( nColumn == 0 ) )
284 {
285 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
286 aLinePropertiesLeft,
287 aLinePropertiesRight,
288 aLinePropertiesTop,
289 aLinePropertiesBottom,
290 aLinePropertiesTopLeftToBottomRight,
291 aLinePropertiesBottomLeftToTopRight,
292 rTable.getNwCell() );
293 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getNwCell());
276 }
277 if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
278 {
279 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
280 aLinePropertiesLeft,
281 aLinePropertiesRight,
282 aLinePropertiesTop,
283 aLinePropertiesBottom,
284 aLinePropertiesTopLeftToBottomRight,
285 aLinePropertiesBottomLeftToTopRight,
286 rTable.getSwCell() );
294 }
295 if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
296 {
297 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
298 aLinePropertiesLeft,
299 aLinePropertiesRight,
300 aLinePropertiesTop,
301 aLinePropertiesBottom,
302 aLinePropertiesTopLeftToBottomRight,
303 aLinePropertiesBottomLeftToTopRight,
304 rTable.getSwCell() );
305 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getSwCell());
287 }
288 if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
289 {
290 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
291 aLinePropertiesLeft,
292 aLinePropertiesRight,
293 aLinePropertiesTop,
294 aLinePropertiesBottom,
295 aLinePropertiesTopLeftToBottomRight,
296 aLinePropertiesBottomLeftToTopRight,
297 rTable.getNeCell() );
306 }
307 if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
308 {
309 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
310 aLinePropertiesLeft,
311 aLinePropertiesRight,
312 aLinePropertiesTop,
313 aLinePropertiesBottom,
314 aLinePropertiesTopLeftToBottomRight,
315 aLinePropertiesBottomLeftToTopRight,
316 rTable.getNeCell() );
317 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getNeCell());
298 }
299 if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
300 {
301 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
302 aLinePropertiesLeft,
303 aLinePropertiesRight,
304 aLinePropertiesTop,
305 aLinePropertiesBottom,
306 aLinePropertiesTopLeftToBottomRight,
307 aLinePropertiesBottomLeftToTopRight,
308 rTable.getSeCell() );
318 }
319 if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
320 {
321 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
322 aLinePropertiesLeft,
323 aLinePropertiesRight,
324 aLinePropertiesTop,
325 aLinePropertiesBottom,
326 aLinePropertiesTopLeftToBottomRight,
327 aLinePropertiesBottomLeftToTopRight,
328 rTable.getSeCell() );
329 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getSeCell());
309 }
310 if ( rProperties.isBandCol() )
311 {
312 if ( ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
313 ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
314 {
315 sal_Int32 nBand = nColumn;
316 if ( rProperties.isFirstCol() )
317 nBand++;
318 if ( nBand & 1 )
319 {
320 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
321 aLinePropertiesLeft,
322 aLinePropertiesRight,
323 aLinePropertiesTop,
324 aLinePropertiesBottom,
325 aLinePropertiesTopLeftToBottomRight,
326 aLinePropertiesBottomLeftToTopRight,
327 rTable.getBand2V() );
330 }
331 if ( rProperties.isBandCol() )
332 {
333 if ( ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
334 ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
335 {
336 sal_Int32 nBand = nColumn;
337 if ( rProperties.isFirstCol() )
338 nBand++;
339 if ( nBand & 1 )
340 {
341 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
342 aLinePropertiesLeft,
343 aLinePropertiesRight,
344 aLinePropertiesTop,
345 aLinePropertiesBottom,
346 aLinePropertiesTopLeftToBottomRight,
347 aLinePropertiesBottomLeftToTopRight,
348 rTable.getBand2V() );
349 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand2V());
328 }
329 else
330 {
331 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
332 aLinePropertiesLeft,
333 aLinePropertiesRight,
334 aLinePropertiesTop,
335 aLinePropertiesBottom,
336 aLinePropertiesTopLeftToBottomRight,
337 aLinePropertiesBottomLeftToTopRight,
338 rTable.getBand1V() );
350 }
351 else
352 {
353 applyTableStylePart( rFilterBase, rxCell, aFillProperties,
354 aLinePropertiesLeft,
355 aLinePropertiesRight,
356 aLinePropertiesTop,
357 aLinePropertiesBottom,
358 aLinePropertiesTopLeftToBottomRight,
359 aLinePropertiesBottomLeftToTopRight,
360 rTable.getBand1V() );
361 lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand1V());
339 }
340 }
341 }
362 }
363 }
364 }
365
366 getTextBody()->insertAt( rFilterBase, xText, xAt, aTextCharProps, pMasterTextListStyle );
367
342 aLinePropertiesLeft.assignUsed( maLinePropertiesLeft );
343 aLinePropertiesRight.assignUsed( maLinePropertiesRight );
344 aLinePropertiesTop.assignUsed( maLinePropertiesTop );
345 aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
346 aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
347 aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );
348 applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
349 applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );

--- 18 unchanged lines hidden ---
368 aLinePropertiesLeft.assignUsed( maLinePropertiesLeft );
369 aLinePropertiesRight.assignUsed( maLinePropertiesRight );
370 aLinePropertiesTop.assignUsed( maLinePropertiesTop );
371 aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
372 aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
373 aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );
374 applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
375 applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );

--- 18 unchanged lines hidden ---