Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include <osl/diagnose.h>
21 : :
22 : : #include "oox/drawingml/table/tablestylecellstylecontext.hxx"
23 : : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
24 : : #include "oox/drawingml/linepropertiescontext.hxx"
25 : : #include "oox/helper/attributelist.hxx"
26 : :
27 : : using namespace ::oox::core;
28 : : using namespace ::com::sun::star;
29 : : using namespace ::com::sun::star::uno;
30 : : using namespace ::com::sun::star::xml::sax;
31 : : using ::rtl::OUString;
32 : :
33 : : namespace oox { namespace drawingml { namespace table {
34 : :
35 : 0 : TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart )
36 : : : ContextHandler( rParent )
37 : : , mrTableStylePart( rTableStylePart )
38 : 0 : , mnLineType( XML_none )
39 : : {
40 : 0 : }
41 : :
42 : 0 : TableStyleCellStyleContext::~TableStyleCellStyleContext()
43 : : {
44 [ # # ]: 0 : }
45 : :
46 : : // CT_TableStyleCellStyle
47 : : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
48 : 0 : TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
49 : : throw ( xml::sax::SAXException, uno::RuntimeException)
50 : : {
51 : 0 : uno::Reference< xml::sax::XFastContextHandler > xRet;
52 [ # # ]: 0 : AttributeList aAttribs( xAttribs );
53 [ # # # # : 0 : switch( aElementToken )
# # # # ]
54 : : {
55 : : case A_TOKEN( tcBdr ): // CT_TableCellBorderStyle
56 : 0 : break;
57 : : case A_TOKEN( left ): // CT_ThemeableLineStyle
58 : : case A_TOKEN( right ):
59 : : case A_TOKEN( top ):
60 : : case A_TOKEN( bottom ):
61 : : case A_TOKEN( insideH ):
62 : : case A_TOKEN( insideV ):
63 : : case A_TOKEN( tl2br ):
64 : : case A_TOKEN( tr2bl ):
65 : 0 : mnLineType = getBaseToken( aElementToken );
66 : 0 : break;
67 : :
68 : : case A_TOKEN( ln ):
69 : : {
70 [ # # ]: 0 : if ( mnLineType != XML_none )
71 : : {
72 : 0 : std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders();
73 [ # # ][ # # ]: 0 : ::oox::drawingml::LinePropertiesPtr mpLineProperties( new oox::drawingml::LineProperties );
[ # # ]
74 [ # # ][ # # ]: 0 : rLineBorders[ mnLineType ] = mpLineProperties;
75 [ # # ][ # # ]: 0 : xRet = new LinePropertiesContext( *this, xAttribs, *mpLineProperties );
[ # # ]
76 : : }
77 : : }
78 : 0 : break;
79 : : case A_TOKEN( lnRef ):
80 : : {
81 [ # # ]: 0 : if ( mnLineType != XML_none )
82 : : {
83 [ # # ]: 0 : ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
84 [ # # ]: 0 : rLineStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
85 [ # # ][ # # ]: 0 : xRet.set( new ColorContext( *this, rLineStyleRef.maPhClr ) );
[ # # ]
86 : : }
87 : : }
88 : 0 : break;
89 : :
90 : : // EG_ThemeableFillStyle (choice)
91 : : case A_TOKEN( fill ): // CT_FillProperties
92 : : {
93 : 0 : FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties();
94 [ # # ][ # # ]: 0 : rxFillProperties.reset( new FillProperties );
[ # # ]
95 [ # # ][ # # ]: 0 : xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
[ # # ]
96 : : }
97 : 0 : break;
98 : : case A_TOKEN( fillRef ): // CT_StyleMatrixReference
99 : : {
100 [ # # ]: 0 : ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
101 [ # # ]: 0 : rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
102 [ # # ][ # # ]: 0 : xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
[ # # ]
103 : : }
104 : 0 : break;
105 : :
106 : : case A_TOKEN( cell3D ): // CT_Cell3D
107 : 0 : break;
108 : : }
109 [ # # ]: 0 : if( !xRet.is() )
110 : : {
111 [ # # ]: 0 : uno::Reference<XFastContextHandler> xTmp(this);
112 [ # # ]: 0 : xRet.set( xTmp );
113 : : }
114 [ # # ]: 0 : return xRet;
115 : : }
116 : :
117 [ + - ][ + - ]: 285 : } } }
118 : :
119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|