Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / drawingml / table / tablestylecellstylecontext.cxx
blob06bd6187b89d44ea6e14c5db9b6a873ff0092869
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "drawingml/table/tablestylecellstylecontext.hxx"
22 #include "drawingml/misccontexts.hxx"
23 #include "drawingml/linepropertiescontext.hxx"
24 #include "oox/helper/attributelist.hxx"
25 #include <oox/token/namespaces.hxx>
26 #include <oox/token/tokens.hxx>
28 using namespace ::oox::core;
29 using namespace ::com::sun::star;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::xml::sax;
33 namespace oox { namespace drawingml { namespace table {
35 TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler2Helper& rParent, TableStylePart& rTableStylePart )
36 : ContextHandler2( rParent )
37 , mrTableStylePart( rTableStylePart )
38 , mnLineType( XML_none )
42 TableStyleCellStyleContext::~TableStyleCellStyleContext()
46 // CT_TableStyleCellStyle
47 ContextHandlerRef
48 TableStyleCellStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
50 switch( aElementToken )
52 case A_TOKEN( tcBdr ): // CT_TableCellBorderStyle
53 break;
54 case A_TOKEN( left ): // CT_ThemeableLineStyle
55 case A_TOKEN( right ):
56 case A_TOKEN( top ):
57 case A_TOKEN( bottom ):
58 case A_TOKEN( insideH ):
59 case A_TOKEN( insideV ):
60 case A_TOKEN( tl2br ):
61 case A_TOKEN( tr2bl ):
62 mnLineType = getBaseToken( aElementToken );
63 break;
65 case A_TOKEN( ln ):
67 if ( mnLineType != XML_none )
69 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders();
70 ::oox::drawingml::LinePropertiesPtr pLineProperties( new oox::drawingml::LineProperties );
71 rLineBorders[ mnLineType ] = pLineProperties;
72 return new LinePropertiesContext( *this, rAttribs, *pLineProperties );
75 break;
76 case A_TOKEN( lnRef ):
78 if ( mnLineType != XML_none )
80 ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
81 rLineStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 );
82 return new ColorContext( *this, rLineStyleRef.maPhClr );
85 break;
87 // EG_ThemeableFillStyle (choice)
88 case A_TOKEN( fill ): // CT_FillProperties
90 FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties();
91 rxFillProperties.reset( new FillProperties );
92 return new FillPropertiesContext( *this, *rxFillProperties );
94 case A_TOKEN( fillRef ): // CT_StyleMatrixReference
96 ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
97 rStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 );
98 return new ColorContext( *this, rStyleRef.maPhClr );
100 case A_TOKEN( cell3D ): // CT_Cell3D
101 break;
104 return this;
107 } } }
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */