1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/drawingml/table/tablecell.hxx"
29*cdf0e10cSrcweir #include "oox/drawingml/table/tableproperties.hxx"
30*cdf0e10cSrcweir #include "oox/drawingml/shapepropertymap.hxx"
31*cdf0e10cSrcweir #include "oox/drawingml/textbody.hxx"
32*cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx"
33*cdf0e10cSrcweir #include "oox/helper/propertyset.hxx"
34*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/table/XTable.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/table/XMergeableCellRange.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir using rtl::OUString;
45*cdf0e10cSrcweir using namespace ::oox::core;
46*cdf0e10cSrcweir using namespace ::com::sun::star;
47*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
48*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
49*cdf0e10cSrcweir using ::com::sun::star::table::BorderLine;
50*cdf0e10cSrcweir using ::com::sun::star::drawing::LineStyle;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir namespace oox { namespace drawingml { namespace table {
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir TableCell::TableCell()
55*cdf0e10cSrcweir : mnRowSpan ( 1 )
56*cdf0e10cSrcweir , mnGridSpan( 1 )
57*cdf0e10cSrcweir , mbhMerge( sal_False )
58*cdf0e10cSrcweir , mbvMerge( sal_False )
59*cdf0e10cSrcweir , mnMarL( 91440 )
60*cdf0e10cSrcweir , mnMarR( 91440 )
61*cdf0e10cSrcweir , mnMarT( 45720 )
62*cdf0e10cSrcweir , mnMarB( 45720 )
63*cdf0e10cSrcweir , mnVertToken( XML_horz )
64*cdf0e10cSrcweir , mnAnchorToken( XML_t )
65*cdf0e10cSrcweir , mbAnchorCtr( sal_False )
66*cdf0e10cSrcweir , mnHorzOverflowToken( XML_clip )
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir TableCell::~TableCell()
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
74*cdf0e10cSrcweir         Reference< XPropertySet >& rxPropSet, oox::drawingml::LineProperties& rLineProperties,
75*cdf0e10cSrcweir         sal_Int32 nPropId )
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir     BorderLine aBorderLine( 0, 0, 0, 0 );
78*cdf0e10cSrcweir     if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
79*cdf0e10cSrcweir     {
80*cdf0e10cSrcweir         Color aColor = rLineProperties.maLineFill.getBestSolidColor();
81*cdf0e10cSrcweir         aBorderLine.Color = aColor.getColor( rFilterBase.getGraphicHelper() );
82*cdf0e10cSrcweir         aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
83*cdf0e10cSrcweir         aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
84*cdf0e10cSrcweir         aBorderLine.LineDistance = 0;
85*cdf0e10cSrcweir     }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     PropertySet aPropSet( rxPropSet );
88*cdf0e10cSrcweir     aPropSet.setProperty( nPropId, aBorderLine );
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties )
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir 	std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.getLineBorders() );
94*cdf0e10cSrcweir 	std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) );
95*cdf0e10cSrcweir 	if ( ( aIter != rPartLineBorders.end() ) && aIter->second.get() )
96*cdf0e10cSrcweir 		rLineProperties.assignUsed( *aIter->second );
97*cdf0e10cSrcweir }
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < ::com::sun::star::table::XCell >& rxCell, oox::drawingml::FillProperties& rFillProperties,
100*cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rLeftBorder,
101*cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rRightBorder,
102*cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rTopBorder,
103*cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rBottomBorder,
104*cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rTopLeftToBottomRightBorder,
105*cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rBottomLeftToTopRightBorder,
106*cdf0e10cSrcweir 	TableStylePart& rTableStylePart )
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir 	boost::shared_ptr< ::oox::drawingml::FillProperties >& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() );
109*cdf0e10cSrcweir 	if ( rPartFillPropertiesPtr.get() )
110*cdf0e10cSrcweir 		rFillProperties.assignUsed( *rPartFillPropertiesPtr );
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_left, rLeftBorder );
113*cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_right, rRightBorder );
114*cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_top, rTopBorder );
115*cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_bottom, rBottomBorder );
116*cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
117*cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     TextCharacterProperties aTextCharProps;
120*cdf0e10cSrcweir     aTextCharProps.maLatinFont = rTableStylePart.getLatinFont();
121*cdf0e10cSrcweir     aTextCharProps.maAsianFont = rTableStylePart.getAsianFont();
122*cdf0e10cSrcweir     aTextCharProps.maComplexFont = rTableStylePart.getComplexFont();
123*cdf0e10cSrcweir     aTextCharProps.maSymbolFont = rTableStylePart.getSymbolFont();
124*cdf0e10cSrcweir     aTextCharProps.maCharColor = rTableStylePart.getTextColor();
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     PropertySet aPropSet( rxCell );
127*cdf0e10cSrcweir     aTextCharProps.pushToPropSet( aPropSet, rFilterBase );
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell >& rxCell, const TableCell& rTableCell )
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir 	static const rtl::OUString	sTopBorder( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
133*cdf0e10cSrcweir 	static const rtl::OUString	sBottomBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
134*cdf0e10cSrcweir 	static const rtl::OUString	sLeftBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
135*cdf0e10cSrcweir 	static const rtl::OUString	sRightBorder( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
136*cdf0e10cSrcweir 	static const rtl::OUString	sVerticalAdjust( RTL_CONSTASCII_USTRINGPARAM( "TextVerticalAdjust" ) );
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
139*cdf0e10cSrcweir 	xPropSet->setPropertyValue( sTopBorder, Any( static_cast< sal_Int32 >( rTableCell.getTopMargin() / 360 ) ) );
140*cdf0e10cSrcweir 	xPropSet->setPropertyValue( sRightBorder, Any( static_cast< sal_Int32 >( rTableCell.getRightMargin() / 360 ) ) );
141*cdf0e10cSrcweir 	xPropSet->setPropertyValue( sLeftBorder, Any( static_cast< sal_Int32 >( rTableCell.getLeftMargin() / 360 ) ) );
142*cdf0e10cSrcweir 	xPropSet->setPropertyValue( sBottomBorder, Any( static_cast< sal_Int32 >( rTableCell.getBottomMargin() / 360 ) ) );
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 	drawing::TextVerticalAdjust eVA;
145*cdf0e10cSrcweir 	switch( rTableCell.getAnchorToken() )
146*cdf0e10cSrcweir 	{
147*cdf0e10cSrcweir 		case XML_ctr:	eVA = drawing::TextVerticalAdjust_CENTER; break;
148*cdf0e10cSrcweir 		case XML_b:		eVA = drawing::TextVerticalAdjust_BOTTOM; break;
149*cdf0e10cSrcweir 		case XML_just:
150*cdf0e10cSrcweir 		case XML_dist:
151*cdf0e10cSrcweir 		default:
152*cdf0e10cSrcweir 		case XML_t:		eVA = drawing::TextVerticalAdjust_TOP; break;
153*cdf0e10cSrcweir 	}
154*cdf0e10cSrcweir 	xPropSet->setPropertyValue( sVerticalAdjust, Any( eVA ) );
155*cdf0e10cSrcweir }
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
158*cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
159*cdf0e10cSrcweir 		const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir 	TableStyle& rTable( const_cast< TableStyle& >( rTableStyle ) );
162*cdf0e10cSrcweir 	TableProperties& rProperties( const_cast< TableProperties& >( rTableProperties ) );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	Reference< text::XText > xText( rxCell, UNO_QUERY_THROW );
165*cdf0e10cSrcweir 	Reference< text::XTextCursor > xAt = xText->createTextCursor();
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	applyTableCellProperties( rxCell, *this );
168*cdf0e10cSrcweir     TextCharacterProperties aTextStyleProps;
169*cdf0e10cSrcweir 	getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
172*cdf0e10cSrcweir 	oox::drawingml::FillProperties aFillProperties;
173*cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesLeft;
174*cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesRight;
175*cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesTop;
176*cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesBottom;
177*cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight;
178*cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight;
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	boost::shared_ptr< ::oox::drawingml::FillProperties >& rBackgroundFillPropertiesPtr( rTable.getBackgroundFillProperties() );
181*cdf0e10cSrcweir 	if ( rBackgroundFillPropertiesPtr.get() )
182*cdf0e10cSrcweir 		aFillProperties.assignUsed( *rBackgroundFillPropertiesPtr );
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	applyTableStylePart( rFilterBase, rxCell, aFillProperties,
185*cdf0e10cSrcweir 		aLinePropertiesLeft,
186*cdf0e10cSrcweir 		aLinePropertiesRight,
187*cdf0e10cSrcweir 		aLinePropertiesTop,
188*cdf0e10cSrcweir 		aLinePropertiesBottom,
189*cdf0e10cSrcweir 		aLinePropertiesTopLeftToBottomRight,
190*cdf0e10cSrcweir 		aLinePropertiesBottomLeftToTopRight,
191*cdf0e10cSrcweir 		rTable.getWholeTbl() );
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	if ( rProperties.isFirstRow() && ( nRow == 0 ) )
194*cdf0e10cSrcweir 	{
195*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
196*cdf0e10cSrcweir 			aLinePropertiesLeft,
197*cdf0e10cSrcweir 			aLinePropertiesRight,
198*cdf0e10cSrcweir 			aLinePropertiesTop,
199*cdf0e10cSrcweir 			aLinePropertiesBottom,
200*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
201*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
202*cdf0e10cSrcweir 			rTable.getFirstRow() );
203*cdf0e10cSrcweir 	}
204*cdf0e10cSrcweir 	if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
205*cdf0e10cSrcweir 	{
206*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
207*cdf0e10cSrcweir 			aLinePropertiesLeft,
208*cdf0e10cSrcweir 			aLinePropertiesRight,
209*cdf0e10cSrcweir 			aLinePropertiesTop,
210*cdf0e10cSrcweir 			aLinePropertiesBottom,
211*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
212*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
213*cdf0e10cSrcweir 			rTable.getLastRow() );
214*cdf0e10cSrcweir 	}
215*cdf0e10cSrcweir 	if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
216*cdf0e10cSrcweir 	{
217*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
218*cdf0e10cSrcweir 			aLinePropertiesLeft,
219*cdf0e10cSrcweir 			aLinePropertiesRight,
220*cdf0e10cSrcweir 			aLinePropertiesTop,
221*cdf0e10cSrcweir 			aLinePropertiesBottom,
222*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
223*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
224*cdf0e10cSrcweir 			rTable.getFirstCol() );
225*cdf0e10cSrcweir 	}
226*cdf0e10cSrcweir 	if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
227*cdf0e10cSrcweir 	{
228*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
229*cdf0e10cSrcweir 			aLinePropertiesLeft,
230*cdf0e10cSrcweir 			aLinePropertiesRight,
231*cdf0e10cSrcweir 			aLinePropertiesTop,
232*cdf0e10cSrcweir 			aLinePropertiesBottom,
233*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
234*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
235*cdf0e10cSrcweir 			rTable.getLastCol() );
236*cdf0e10cSrcweir 	}
237*cdf0e10cSrcweir 	if ( rProperties.isBandRow() )
238*cdf0e10cSrcweir 	{
239*cdf0e10cSrcweir 		if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
240*cdf0e10cSrcweir 			( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) )
241*cdf0e10cSrcweir 		{
242*cdf0e10cSrcweir 			sal_Int32 nBand = nRow;
243*cdf0e10cSrcweir 			if ( rProperties.isFirstRow() )
244*cdf0e10cSrcweir 				nBand++;
245*cdf0e10cSrcweir 			if ( nBand & 1 )
246*cdf0e10cSrcweir 			{
247*cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
248*cdf0e10cSrcweir 					aLinePropertiesLeft,
249*cdf0e10cSrcweir 					aLinePropertiesRight,
250*cdf0e10cSrcweir 					aLinePropertiesTop,
251*cdf0e10cSrcweir 					aLinePropertiesBottom,
252*cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
253*cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
254*cdf0e10cSrcweir 					rTable.getBand2H() );
255*cdf0e10cSrcweir 			}
256*cdf0e10cSrcweir 			else
257*cdf0e10cSrcweir 			{
258*cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
259*cdf0e10cSrcweir 					aLinePropertiesLeft,
260*cdf0e10cSrcweir 					aLinePropertiesRight,
261*cdf0e10cSrcweir 					aLinePropertiesTop,
262*cdf0e10cSrcweir 					aLinePropertiesBottom,
263*cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
264*cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
265*cdf0e10cSrcweir 					rTable.getBand1H() );
266*cdf0e10cSrcweir 			}
267*cdf0e10cSrcweir 		}
268*cdf0e10cSrcweir 	}
269*cdf0e10cSrcweir 	if ( ( nRow == 0 ) && ( nColumn == 0 ) )
270*cdf0e10cSrcweir 	{
271*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
272*cdf0e10cSrcweir 			aLinePropertiesLeft,
273*cdf0e10cSrcweir 			aLinePropertiesRight,
274*cdf0e10cSrcweir 			aLinePropertiesTop,
275*cdf0e10cSrcweir 			aLinePropertiesBottom,
276*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
277*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
278*cdf0e10cSrcweir 			rTable.getNwCell() );
279*cdf0e10cSrcweir 	}
280*cdf0e10cSrcweir 	if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
281*cdf0e10cSrcweir 	{
282*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
283*cdf0e10cSrcweir 			aLinePropertiesLeft,
284*cdf0e10cSrcweir 			aLinePropertiesRight,
285*cdf0e10cSrcweir 			aLinePropertiesTop,
286*cdf0e10cSrcweir 			aLinePropertiesBottom,
287*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
288*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
289*cdf0e10cSrcweir 			rTable.getSwCell() );
290*cdf0e10cSrcweir 	}
291*cdf0e10cSrcweir 	if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
292*cdf0e10cSrcweir 	{
293*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
294*cdf0e10cSrcweir 			aLinePropertiesLeft,
295*cdf0e10cSrcweir 			aLinePropertiesRight,
296*cdf0e10cSrcweir 			aLinePropertiesTop,
297*cdf0e10cSrcweir 			aLinePropertiesBottom,
298*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
299*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
300*cdf0e10cSrcweir 			rTable.getNeCell() );
301*cdf0e10cSrcweir 	}
302*cdf0e10cSrcweir 	if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
303*cdf0e10cSrcweir 	{
304*cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
305*cdf0e10cSrcweir 			aLinePropertiesLeft,
306*cdf0e10cSrcweir 			aLinePropertiesRight,
307*cdf0e10cSrcweir 			aLinePropertiesTop,
308*cdf0e10cSrcweir 			aLinePropertiesBottom,
309*cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
310*cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
311*cdf0e10cSrcweir 			rTable.getSeCell() );
312*cdf0e10cSrcweir 	}
313*cdf0e10cSrcweir 	if ( rProperties.isBandCol() )
314*cdf0e10cSrcweir 	{
315*cdf0e10cSrcweir 		if ( ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
316*cdf0e10cSrcweir 			( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
317*cdf0e10cSrcweir 		{
318*cdf0e10cSrcweir 			sal_Int32 nBand = nColumn;
319*cdf0e10cSrcweir 			if ( rProperties.isFirstCol() )
320*cdf0e10cSrcweir 				nBand++;
321*cdf0e10cSrcweir 			if ( nBand & 1 )
322*cdf0e10cSrcweir 			{
323*cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
324*cdf0e10cSrcweir 					aLinePropertiesLeft,
325*cdf0e10cSrcweir 					aLinePropertiesRight,
326*cdf0e10cSrcweir 					aLinePropertiesTop,
327*cdf0e10cSrcweir 					aLinePropertiesBottom,
328*cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
329*cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
330*cdf0e10cSrcweir 					rTable.getBand2V() );
331*cdf0e10cSrcweir 			}
332*cdf0e10cSrcweir 			else
333*cdf0e10cSrcweir 			{
334*cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
335*cdf0e10cSrcweir 					aLinePropertiesLeft,
336*cdf0e10cSrcweir 					aLinePropertiesRight,
337*cdf0e10cSrcweir 					aLinePropertiesTop,
338*cdf0e10cSrcweir 					aLinePropertiesBottom,
339*cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
340*cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
341*cdf0e10cSrcweir 					rTable.getBand1V() );
342*cdf0e10cSrcweir 			}
343*cdf0e10cSrcweir 		}
344*cdf0e10cSrcweir 	}
345*cdf0e10cSrcweir 	aLinePropertiesLeft.assignUsed( maLinePropertiesLeft );
346*cdf0e10cSrcweir     aLinePropertiesRight.assignUsed( maLinePropertiesRight );
347*cdf0e10cSrcweir     aLinePropertiesTop.assignUsed( maLinePropertiesTop );
348*cdf0e10cSrcweir     aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
349*cdf0e10cSrcweir     aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
350*cdf0e10cSrcweir     aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );
351*cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
352*cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );
353*cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, PROP_TopBorder );
354*cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottom, PROP_BottomBorder );
355*cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
356*cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 	aFillProperties.assignUsed( maFillProperties );
359*cdf0e10cSrcweir     ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() );
360*cdf0e10cSrcweir     // TODO: phClr?
361*cdf0e10cSrcweir     aFillProperties.pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() );
362*cdf0e10cSrcweir     PropertySet( xPropSet ).setProperties( aPropMap );
363*cdf0e10cSrcweir }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir } } }
366