1ca5ec200SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ca5ec200SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ca5ec200SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ca5ec200SAndrew Rist  * distributed with this work for additional information
6ca5ec200SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ca5ec200SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ca5ec200SAndrew Rist  * "License"); you may not use this file except in compliance
9ca5ec200SAndrew Rist  * with the License.  You may obtain a copy of the License at
10ca5ec200SAndrew Rist  *
11ca5ec200SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ca5ec200SAndrew Rist  *
13ca5ec200SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ca5ec200SAndrew Rist  * software distributed under the License is distributed on an
15ca5ec200SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ca5ec200SAndrew Rist  * KIND, either express or implied.  See the License for the
17ca5ec200SAndrew Rist  * specific language governing permissions and limitations
18ca5ec200SAndrew Rist  * under the License.
19ca5ec200SAndrew Rist  *
20ca5ec200SAndrew Rist  *************************************************************/
21ca5ec200SAndrew Rist 
22ca5ec200SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "oox/drawingml/table/tablecell.hxx"
25cdf0e10cSrcweir #include "oox/drawingml/table/tableproperties.hxx"
26cdf0e10cSrcweir #include "oox/drawingml/shapepropertymap.hxx"
27cdf0e10cSrcweir #include "oox/drawingml/textbody.hxx"
28cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx"
29cdf0e10cSrcweir #include "oox/helper/propertyset.hxx"
30cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
31cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
32cdf0e10cSrcweir #include <com/sun/star/table/XTable.hpp>
33cdf0e10cSrcweir #include <com/sun/star/table/XMergeableCellRange.hpp>
34cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp>
35cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp>
36cdf0e10cSrcweir #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
37cdf0e10cSrcweir #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
38cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
394323f6b5SJürgen Schmidt #include <com/sun/star/text/WritingMode.hpp>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir using rtl::OUString;
42cdf0e10cSrcweir using namespace ::oox::core;
43cdf0e10cSrcweir using namespace ::com::sun::star;
44cdf0e10cSrcweir using namespace ::com::sun::star::uno;
45cdf0e10cSrcweir using namespace ::com::sun::star::beans;
46cdf0e10cSrcweir using ::com::sun::star::table::BorderLine;
47cdf0e10cSrcweir using ::com::sun::star::drawing::LineStyle;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace oox { namespace drawingml { namespace table {
50cdf0e10cSrcweir 
TableCell()51cdf0e10cSrcweir TableCell::TableCell()
52cdf0e10cSrcweir : mnRowSpan ( 1 )
53cdf0e10cSrcweir , mnGridSpan( 1 )
54cdf0e10cSrcweir , mbhMerge( sal_False )
55cdf0e10cSrcweir , mbvMerge( sal_False )
56cdf0e10cSrcweir , mnMarL( 91440 )
57cdf0e10cSrcweir , mnMarR( 91440 )
58cdf0e10cSrcweir , mnMarT( 45720 )
59cdf0e10cSrcweir , mnMarB( 45720 )
60cdf0e10cSrcweir , mnVertToken( XML_horz )
61cdf0e10cSrcweir , mnAnchorToken( XML_t )
62cdf0e10cSrcweir , mbAnchorCtr( sal_False )
63cdf0e10cSrcweir , mnHorzOverflowToken( XML_clip )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir }
~TableCell()66cdf0e10cSrcweir TableCell::~TableCell()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
applyLineAttributes(const::oox::core::XmlFilterBase & rFilterBase,Reference<XPropertySet> & rxPropSet,oox::drawingml::LineProperties & rLineProperties,sal_Int32 nPropId)70cdf0e10cSrcweir void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
71cdf0e10cSrcweir         Reference< XPropertySet >& rxPropSet, oox::drawingml::LineProperties& rLineProperties,
72cdf0e10cSrcweir         sal_Int32 nPropId )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir     BorderLine aBorderLine( 0, 0, 0, 0 );
75cdf0e10cSrcweir     if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir         Color aColor = rLineProperties.maLineFill.getBestSolidColor();
78cdf0e10cSrcweir         aBorderLine.Color = aColor.getColor( rFilterBase.getGraphicHelper() );
79cdf0e10cSrcweir         aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
80cdf0e10cSrcweir         aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
81cdf0e10cSrcweir         aBorderLine.LineDistance = 0;
82cdf0e10cSrcweir     }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     PropertySet aPropSet( rxPropSet );
85cdf0e10cSrcweir     aPropSet.setProperty( nPropId, aBorderLine );
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
applyBorder(TableStylePart & rTableStylePart,sal_Int32 nLineType,oox::drawingml::LineProperties & rLineProperties)88cdf0e10cSrcweir void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rPartLineBorders( rTableStylePart.getLineBorders() );
91cdf0e10cSrcweir 	std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >::const_iterator aIter( rPartLineBorders.find( nLineType ) );
92cdf0e10cSrcweir 	if ( ( aIter != rPartLineBorders.end() ) && aIter->second.get() )
93cdf0e10cSrcweir 		rLineProperties.assignUsed( *aIter->second );
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
applyTableStylePart(const::oox::core::XmlFilterBase & rFilterBase,const Reference<::com::sun::star::table::XCell> & rxCell,oox::drawingml::FillProperties & rFillProperties,oox::drawingml::LineProperties & rLeftBorder,oox::drawingml::LineProperties & rRightBorder,oox::drawingml::LineProperties & rTopBorder,oox::drawingml::LineProperties & rBottomBorder,oox::drawingml::LineProperties & rTopLeftToBottomRightBorder,oox::drawingml::LineProperties & rBottomLeftToTopRightBorder,TableStylePart & rTableStylePart)96cdf0e10cSrcweir void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < ::com::sun::star::table::XCell >& rxCell, oox::drawingml::FillProperties& rFillProperties,
97cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rLeftBorder,
98cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rRightBorder,
99cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rTopBorder,
100cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rBottomBorder,
101cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rTopLeftToBottomRightBorder,
102cdf0e10cSrcweir 	 oox::drawingml::LineProperties& rBottomLeftToTopRightBorder,
103cdf0e10cSrcweir 	TableStylePart& rTableStylePart )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	boost::shared_ptr< ::oox::drawingml::FillProperties >& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() );
106cdf0e10cSrcweir 	if ( rPartFillPropertiesPtr.get() )
107cdf0e10cSrcweir 		rFillProperties.assignUsed( *rPartFillPropertiesPtr );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_left, rLeftBorder );
110cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_right, rRightBorder );
111cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_top, rTopBorder );
112cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_bottom, rBottomBorder );
113cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
114cdf0e10cSrcweir 	applyBorder( rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     TextCharacterProperties aTextCharProps;
117cdf0e10cSrcweir     aTextCharProps.maLatinFont = rTableStylePart.getLatinFont();
118cdf0e10cSrcweir     aTextCharProps.maAsianFont = rTableStylePart.getAsianFont();
119cdf0e10cSrcweir     aTextCharProps.maComplexFont = rTableStylePart.getComplexFont();
120cdf0e10cSrcweir     aTextCharProps.maSymbolFont = rTableStylePart.getSymbolFont();
121cdf0e10cSrcweir     aTextCharProps.maCharColor = rTableStylePart.getTextColor();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     PropertySet aPropSet( rxCell );
124cdf0e10cSrcweir     aTextCharProps.pushToPropSet( aPropSet, rFilterBase );
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
applyTableCellProperties(const Reference<::com::sun::star::table::XCell> & rxCell,const TableCell & rTableCell)127cdf0e10cSrcweir void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell >& rxCell, const TableCell& rTableCell )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir 	static const rtl::OUString	sTopBorder( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
130cdf0e10cSrcweir 	static const rtl::OUString	sBottomBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
131cdf0e10cSrcweir 	static const rtl::OUString	sLeftBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
132cdf0e10cSrcweir 	static const rtl::OUString	sRightBorder( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
133cdf0e10cSrcweir 	static const rtl::OUString	sVerticalAdjust( RTL_CONSTASCII_USTRINGPARAM( "TextVerticalAdjust" ) );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
136cdf0e10cSrcweir 	xPropSet->setPropertyValue( sTopBorder, Any( static_cast< sal_Int32 >( rTableCell.getTopMargin() / 360 ) ) );
137cdf0e10cSrcweir 	xPropSet->setPropertyValue( sRightBorder, Any( static_cast< sal_Int32 >( rTableCell.getRightMargin() / 360 ) ) );
138cdf0e10cSrcweir 	xPropSet->setPropertyValue( sLeftBorder, Any( static_cast< sal_Int32 >( rTableCell.getLeftMargin() / 360 ) ) );
139cdf0e10cSrcweir 	xPropSet->setPropertyValue( sBottomBorder, Any( static_cast< sal_Int32 >( rTableCell.getBottomMargin() / 360 ) ) );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	drawing::TextVerticalAdjust eVA;
142cdf0e10cSrcweir 	switch( rTableCell.getAnchorToken() )
143cdf0e10cSrcweir 	{
144cdf0e10cSrcweir 		case XML_ctr:	eVA = drawing::TextVerticalAdjust_CENTER; break;
145cdf0e10cSrcweir 		case XML_b:		eVA = drawing::TextVerticalAdjust_BOTTOM; break;
146cdf0e10cSrcweir 		case XML_just:
147cdf0e10cSrcweir 		case XML_dist:
148cdf0e10cSrcweir 		default:
149cdf0e10cSrcweir 		case XML_t:		eVA = drawing::TextVerticalAdjust_TOP; break;
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir 	xPropSet->setPropertyValue( sVerticalAdjust, Any( eVA ) );
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154*f1574915SArmin Le Grand // save char color from tblstyle for combination later
lcl_getCharPropFromTblStylePart(TextCharacterProperties & rDstCharProp,const TableStylePart & rSrcTblStyle)155*f1574915SArmin Le Grand void lcl_getCharPropFromTblStylePart(TextCharacterProperties& rDstCharProp, const TableStylePart& rSrcTblStyle)
156*f1574915SArmin Le Grand {
157*f1574915SArmin Le Grand     const Color& clr = const_cast<TableStylePart&>(rSrcTblStyle).getTextColor();
158*f1574915SArmin Le Grand     if (clr.isUsed())
159*f1574915SArmin Le Grand         rDstCharProp.maCharColor = clr;
160*f1574915SArmin Le Grand     // TODO: there may be other similar properties from tblstyle which need combination later
161*f1574915SArmin Le Grand }
162*f1574915SArmin Le Grand 
pushToXCell(const::oox::core::XmlFilterBase & rFilterBase,::oox::drawingml::TextListStylePtr pMasterTextListStyle,const::com::sun::star::uno::Reference<::com::sun::star::table::XCell> & rxCell,const TableProperties & rTableProperties,const TableStyle & rTableStyle,sal_Int32 nColumn,sal_Int32 nMaxColumn,sal_Int32 nRow,sal_Int32 nMaxRow)163cdf0e10cSrcweir void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
164cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
165cdf0e10cSrcweir 		const TableStyle& rTableStyle, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir 	TableStyle& rTable( const_cast< TableStyle& >( rTableStyle ) );
168cdf0e10cSrcweir 	TableProperties& rProperties( const_cast< TableProperties& >( rTableProperties ) );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 	Reference< text::XText > xText( rxCell, UNO_QUERY_THROW );
171cdf0e10cSrcweir 	Reference< text::XTextCursor > xAt = xText->createTextCursor();
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	applyTableCellProperties( rxCell, *this );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
176cdf0e10cSrcweir 	oox::drawingml::FillProperties aFillProperties;
177cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesLeft;
178cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesRight;
179cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesTop;
180cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesBottom;
181cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight;
182cdf0e10cSrcweir 	oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	boost::shared_ptr< ::oox::drawingml::FillProperties >& rBackgroundFillPropertiesPtr( rTable.getBackgroundFillProperties() );
185cdf0e10cSrcweir 	if ( rBackgroundFillPropertiesPtr.get() )
186cdf0e10cSrcweir 		aFillProperties.assignUsed( *rBackgroundFillPropertiesPtr );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	applyTableStylePart( rFilterBase, rxCell, aFillProperties,
189cdf0e10cSrcweir 		aLinePropertiesLeft,
190cdf0e10cSrcweir 		aLinePropertiesRight,
191cdf0e10cSrcweir 		aLinePropertiesTop,
192cdf0e10cSrcweir 		aLinePropertiesBottom,
193cdf0e10cSrcweir 		aLinePropertiesTopLeftToBottomRight,
194cdf0e10cSrcweir 		aLinePropertiesBottomLeftToTopRight,
195cdf0e10cSrcweir 		rTable.getWholeTbl() );
196cdf0e10cSrcweir 
197*f1574915SArmin Le Grand 	// get char color from tblstyle for combination later
198*f1574915SArmin Le Grand 	TextCharacterProperties aTextCharProps;
199*f1574915SArmin Le Grand 	lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getWholeTbl());
200*f1574915SArmin Le Grand 
201cdf0e10cSrcweir 	if ( rProperties.isFirstRow() && ( nRow == 0 ) )
202cdf0e10cSrcweir 	{
203cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
204cdf0e10cSrcweir 			aLinePropertiesLeft,
205cdf0e10cSrcweir 			aLinePropertiesRight,
206cdf0e10cSrcweir 			aLinePropertiesTop,
207cdf0e10cSrcweir 			aLinePropertiesBottom,
208cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
209cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
210cdf0e10cSrcweir 			rTable.getFirstRow() );
211*f1574915SArmin Le Grand        lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getFirstRow());
212cdf0e10cSrcweir 	}
213cdf0e10cSrcweir 	if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
216cdf0e10cSrcweir 			aLinePropertiesLeft,
217cdf0e10cSrcweir 			aLinePropertiesRight,
218cdf0e10cSrcweir 			aLinePropertiesTop,
219cdf0e10cSrcweir 			aLinePropertiesBottom,
220cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
221cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
222cdf0e10cSrcweir 			rTable.getLastRow() );
223*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getLastRow());
224cdf0e10cSrcweir 	}
225cdf0e10cSrcweir 	if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
226cdf0e10cSrcweir 	{
227cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
228cdf0e10cSrcweir 			aLinePropertiesLeft,
229cdf0e10cSrcweir 			aLinePropertiesRight,
230cdf0e10cSrcweir 			aLinePropertiesTop,
231cdf0e10cSrcweir 			aLinePropertiesBottom,
232cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
233cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
234cdf0e10cSrcweir 			rTable.getFirstCol() );
235*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getFirstCol());
236cdf0e10cSrcweir 	}
237cdf0e10cSrcweir 	if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
238cdf0e10cSrcweir 	{
239cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
240cdf0e10cSrcweir 			aLinePropertiesLeft,
241cdf0e10cSrcweir 			aLinePropertiesRight,
242cdf0e10cSrcweir 			aLinePropertiesTop,
243cdf0e10cSrcweir 			aLinePropertiesBottom,
244cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
245cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
246cdf0e10cSrcweir 			rTable.getLastCol() );
247*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getLastCol());
248cdf0e10cSrcweir 	}
249cdf0e10cSrcweir 	if ( rProperties.isBandRow() )
250cdf0e10cSrcweir 	{
251cdf0e10cSrcweir 		if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
252cdf0e10cSrcweir 			( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) )
253cdf0e10cSrcweir 		{
254cdf0e10cSrcweir 			sal_Int32 nBand = nRow;
255cdf0e10cSrcweir 			if ( rProperties.isFirstRow() )
256cdf0e10cSrcweir 				nBand++;
257cdf0e10cSrcweir 			if ( nBand & 1 )
258cdf0e10cSrcweir 			{
259cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
260cdf0e10cSrcweir 					aLinePropertiesLeft,
261cdf0e10cSrcweir 					aLinePropertiesRight,
262cdf0e10cSrcweir 					aLinePropertiesTop,
263cdf0e10cSrcweir 					aLinePropertiesBottom,
264cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
265cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
266cdf0e10cSrcweir 					rTable.getBand2H() );
267*f1574915SArmin Le Grand 				lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand2H());
268cdf0e10cSrcweir 			}
269cdf0e10cSrcweir 			else
270cdf0e10cSrcweir 			{
271cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
272cdf0e10cSrcweir 					aLinePropertiesLeft,
273cdf0e10cSrcweir 					aLinePropertiesRight,
274cdf0e10cSrcweir 					aLinePropertiesTop,
275cdf0e10cSrcweir 					aLinePropertiesBottom,
276cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
277cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
278cdf0e10cSrcweir 					rTable.getBand1H() );
279*f1574915SArmin Le Grand 				lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand1H());
280cdf0e10cSrcweir 			}
281cdf0e10cSrcweir 		}
282cdf0e10cSrcweir 	}
283cdf0e10cSrcweir 	if ( ( nRow == 0 ) && ( nColumn == 0 ) )
284cdf0e10cSrcweir 	{
285cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
286cdf0e10cSrcweir 			aLinePropertiesLeft,
287cdf0e10cSrcweir 			aLinePropertiesRight,
288cdf0e10cSrcweir 			aLinePropertiesTop,
289cdf0e10cSrcweir 			aLinePropertiesBottom,
290cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
291cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
292cdf0e10cSrcweir 			rTable.getNwCell() );
293*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getNwCell());
294cdf0e10cSrcweir 	}
295cdf0e10cSrcweir 	if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
296cdf0e10cSrcweir 	{
297cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
298cdf0e10cSrcweir 			aLinePropertiesLeft,
299cdf0e10cSrcweir 			aLinePropertiesRight,
300cdf0e10cSrcweir 			aLinePropertiesTop,
301cdf0e10cSrcweir 			aLinePropertiesBottom,
302cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
303cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
304cdf0e10cSrcweir 			rTable.getSwCell() );
305*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getSwCell());
306cdf0e10cSrcweir 	}
307cdf0e10cSrcweir 	if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
308cdf0e10cSrcweir 	{
309cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
310cdf0e10cSrcweir 			aLinePropertiesLeft,
311cdf0e10cSrcweir 			aLinePropertiesRight,
312cdf0e10cSrcweir 			aLinePropertiesTop,
313cdf0e10cSrcweir 			aLinePropertiesBottom,
314cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
315cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
316cdf0e10cSrcweir 			rTable.getNeCell() );
317*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getNeCell());
318cdf0e10cSrcweir 	}
319cdf0e10cSrcweir 	if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
320cdf0e10cSrcweir 	{
321cdf0e10cSrcweir 		applyTableStylePart( rFilterBase, rxCell, aFillProperties,
322cdf0e10cSrcweir 			aLinePropertiesLeft,
323cdf0e10cSrcweir 			aLinePropertiesRight,
324cdf0e10cSrcweir 			aLinePropertiesTop,
325cdf0e10cSrcweir 			aLinePropertiesBottom,
326cdf0e10cSrcweir 			aLinePropertiesTopLeftToBottomRight,
327cdf0e10cSrcweir 			aLinePropertiesBottomLeftToTopRight,
328cdf0e10cSrcweir 			rTable.getSeCell() );
329*f1574915SArmin Le Grand 		lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getSeCell());
330cdf0e10cSrcweir 	}
331cdf0e10cSrcweir 	if ( rProperties.isBandCol() )
332cdf0e10cSrcweir 	{
333cdf0e10cSrcweir 		if ( ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
334cdf0e10cSrcweir 			( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
335cdf0e10cSrcweir 		{
336cdf0e10cSrcweir 			sal_Int32 nBand = nColumn;
337cdf0e10cSrcweir 			if ( rProperties.isFirstCol() )
338cdf0e10cSrcweir 				nBand++;
339cdf0e10cSrcweir 			if ( nBand & 1 )
340cdf0e10cSrcweir 			{
341cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
342cdf0e10cSrcweir 					aLinePropertiesLeft,
343cdf0e10cSrcweir 					aLinePropertiesRight,
344cdf0e10cSrcweir 					aLinePropertiesTop,
345cdf0e10cSrcweir 					aLinePropertiesBottom,
346cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
347cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
348cdf0e10cSrcweir 					rTable.getBand2V() );
349*f1574915SArmin Le Grand 				lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand2V());
350cdf0e10cSrcweir 			}
351cdf0e10cSrcweir 			else
352cdf0e10cSrcweir 			{
353cdf0e10cSrcweir 				applyTableStylePart( rFilterBase, rxCell, aFillProperties,
354cdf0e10cSrcweir 					aLinePropertiesLeft,
355cdf0e10cSrcweir 					aLinePropertiesRight,
356cdf0e10cSrcweir 					aLinePropertiesTop,
357cdf0e10cSrcweir 					aLinePropertiesBottom,
358cdf0e10cSrcweir 					aLinePropertiesTopLeftToBottomRight,
359cdf0e10cSrcweir 					aLinePropertiesBottomLeftToTopRight,
360cdf0e10cSrcweir 					rTable.getBand1V() );
361*f1574915SArmin Le Grand 				lcl_getCharPropFromTblStylePart(aTextCharProps, rTable.getBand1V());
362cdf0e10cSrcweir 			}
363cdf0e10cSrcweir 		}
364cdf0e10cSrcweir 	}
365*f1574915SArmin Le Grand 
366*f1574915SArmin Le Grand 	getTextBody()->insertAt( rFilterBase, xText, xAt, aTextCharProps, pMasterTextListStyle );
367*f1574915SArmin Le Grand 
368cdf0e10cSrcweir 	aLinePropertiesLeft.assignUsed( maLinePropertiesLeft );
369cdf0e10cSrcweir     aLinePropertiesRight.assignUsed( maLinePropertiesRight );
370cdf0e10cSrcweir     aLinePropertiesTop.assignUsed( maLinePropertiesTop );
371cdf0e10cSrcweir     aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
372cdf0e10cSrcweir     aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
373cdf0e10cSrcweir     aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );
374cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
375cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );
376cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, PROP_TopBorder );
377cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottom, PROP_BottomBorder );
378cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
379cdf0e10cSrcweir     applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	aFillProperties.assignUsed( maFillProperties );
382cdf0e10cSrcweir     ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() );
383cdf0e10cSrcweir     // TODO: phClr?
384cdf0e10cSrcweir     aFillProperties.pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() );
385cdf0e10cSrcweir     PropertySet( xPropSet ).setProperties( aPropMap );
3864323f6b5SJürgen Schmidt 
3874323f6b5SJürgen Schmidt     if ( getVertToken() == XML_eaVert )
3884323f6b5SJürgen Schmidt     {
3894323f6b5SJürgen Schmidt         xPropSet->setPropertyValue(::rtl::OUString::createFromAscii( "TextWritingMode" ) , Any(com::sun::star::text::WritingMode_TB_RL) );
3904323f6b5SJürgen Schmidt     }
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir } } }
394