1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski #include <osl/diagnose.h>
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim Jagielski #include "oox/drawingml/table/tablestylecellstylecontext.hxx"
27*b1cdbd2cSJim Jagielski #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
28*b1cdbd2cSJim Jagielski #include "oox/drawingml/linepropertiescontext.hxx"
29*b1cdbd2cSJim Jagielski #include "oox/helper/attributelist.hxx"
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski using namespace ::oox::core;
32*b1cdbd2cSJim Jagielski using namespace ::com::sun::star;
33*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::uno;
34*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::xml::sax;
35*b1cdbd2cSJim Jagielski using ::rtl::OUString;
36*b1cdbd2cSJim Jagielski
37*b1cdbd2cSJim Jagielski namespace oox { namespace drawingml { namespace table {
38*b1cdbd2cSJim Jagielski
TableStyleCellStyleContext(ContextHandler & rParent,TableStylePart & rTableStylePart)39*b1cdbd2cSJim Jagielski TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart )
40*b1cdbd2cSJim Jagielski : ContextHandler( rParent )
41*b1cdbd2cSJim Jagielski , mrTableStylePart( rTableStylePart )
42*b1cdbd2cSJim Jagielski , mnLineType( XML_none )
43*b1cdbd2cSJim Jagielski {
44*b1cdbd2cSJim Jagielski }
45*b1cdbd2cSJim Jagielski
~TableStyleCellStyleContext()46*b1cdbd2cSJim Jagielski TableStyleCellStyleContext::~TableStyleCellStyleContext()
47*b1cdbd2cSJim Jagielski {
48*b1cdbd2cSJim Jagielski }
49*b1cdbd2cSJim Jagielski
50*b1cdbd2cSJim Jagielski // CT_TableStyleCellStyle
51*b1cdbd2cSJim Jagielski uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
createFastChildContext(::sal_Int32 aElementToken,const uno::Reference<xml::sax::XFastAttributeList> & xAttribs)52*b1cdbd2cSJim Jagielski TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
53*b1cdbd2cSJim Jagielski throw ( xml::sax::SAXException, uno::RuntimeException)
54*b1cdbd2cSJim Jagielski {
55*b1cdbd2cSJim Jagielski uno::Reference< xml::sax::XFastContextHandler > xRet;
56*b1cdbd2cSJim Jagielski AttributeList aAttribs( xAttribs );
57*b1cdbd2cSJim Jagielski switch( aElementToken )
58*b1cdbd2cSJim Jagielski {
59*b1cdbd2cSJim Jagielski case A_TOKEN( tcBdr ): // CT_TableCellBorderStyle
60*b1cdbd2cSJim Jagielski break;
61*b1cdbd2cSJim Jagielski case A_TOKEN( left ): // CT_ThemeableLineStyle
62*b1cdbd2cSJim Jagielski case A_TOKEN( right ):
63*b1cdbd2cSJim Jagielski case A_TOKEN( top ):
64*b1cdbd2cSJim Jagielski case A_TOKEN( bottom ):
65*b1cdbd2cSJim Jagielski case A_TOKEN( insideH ):
66*b1cdbd2cSJim Jagielski case A_TOKEN( insideV ):
67*b1cdbd2cSJim Jagielski case A_TOKEN( tl2br ):
68*b1cdbd2cSJim Jagielski case A_TOKEN( tr2bl ):
69*b1cdbd2cSJim Jagielski mnLineType = getBaseToken( aElementToken );
70*b1cdbd2cSJim Jagielski break;
71*b1cdbd2cSJim Jagielski
72*b1cdbd2cSJim Jagielski case A_TOKEN( ln ):
73*b1cdbd2cSJim Jagielski {
74*b1cdbd2cSJim Jagielski if ( mnLineType != XML_none )
75*b1cdbd2cSJim Jagielski {
76*b1cdbd2cSJim Jagielski std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders();
77*b1cdbd2cSJim Jagielski ::oox::drawingml::LinePropertiesPtr mpLineProperties( new oox::drawingml::LineProperties );
78*b1cdbd2cSJim Jagielski rLineBorders[ mnLineType ] = mpLineProperties;
79*b1cdbd2cSJim Jagielski xRet = new LinePropertiesContext( *this, xAttribs, *mpLineProperties );
80*b1cdbd2cSJim Jagielski }
81*b1cdbd2cSJim Jagielski }
82*b1cdbd2cSJim Jagielski break;
83*b1cdbd2cSJim Jagielski case A_TOKEN( lnRef ):
84*b1cdbd2cSJim Jagielski {
85*b1cdbd2cSJim Jagielski if ( mnLineType != XML_none )
86*b1cdbd2cSJim Jagielski {
87*b1cdbd2cSJim Jagielski ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
88*b1cdbd2cSJim Jagielski rLineStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
89*b1cdbd2cSJim Jagielski xRet.set( new ColorContext( *this, rLineStyleRef.maPhClr ) );
90*b1cdbd2cSJim Jagielski }
91*b1cdbd2cSJim Jagielski }
92*b1cdbd2cSJim Jagielski break;
93*b1cdbd2cSJim Jagielski
94*b1cdbd2cSJim Jagielski // EG_ThemeableFillStyle (choice)
95*b1cdbd2cSJim Jagielski case A_TOKEN( fill ): // CT_FillProperties
96*b1cdbd2cSJim Jagielski {
97*b1cdbd2cSJim Jagielski FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties();
98*b1cdbd2cSJim Jagielski rxFillProperties.reset( new FillProperties );
99*b1cdbd2cSJim Jagielski xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
100*b1cdbd2cSJim Jagielski }
101*b1cdbd2cSJim Jagielski break;
102*b1cdbd2cSJim Jagielski case A_TOKEN( fillRef ): // CT_StyleMatrixReference
103*b1cdbd2cSJim Jagielski {
104*b1cdbd2cSJim Jagielski ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
105*b1cdbd2cSJim Jagielski rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
106*b1cdbd2cSJim Jagielski xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
107*b1cdbd2cSJim Jagielski }
108*b1cdbd2cSJim Jagielski break;
109*b1cdbd2cSJim Jagielski
110*b1cdbd2cSJim Jagielski case A_TOKEN( cell3D ): // CT_Cell3D
111*b1cdbd2cSJim Jagielski break;
112*b1cdbd2cSJim Jagielski }
113*b1cdbd2cSJim Jagielski if( !xRet.is() )
114*b1cdbd2cSJim Jagielski {
115*b1cdbd2cSJim Jagielski uno::Reference<XFastContextHandler> xTmp(this);
116*b1cdbd2cSJim Jagielski xRet.set( xTmp );
117*b1cdbd2cSJim Jagielski }
118*b1cdbd2cSJim Jagielski return xRet;
119*b1cdbd2cSJim Jagielski }
120*b1cdbd2cSJim Jagielski
121*b1cdbd2cSJim Jagielski } } }
122