1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/lineproperties.hxx>
24 #include <drawingml/linepropertiescontext.hxx>
25 #include <oox/helper/attributelist.hxx>
26 #include <oox/token/namespaces.hxx>
27 #include <oox/token/tokens.hxx>
29 using namespace ::oox::core
;
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
33 namespace oox::drawingml::table
{
35 TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler2Helper
const & rParent
, TableStylePart
& rTableStylePart
)
36 : ContextHandler2( rParent
)
37 , mrTableStylePart( rTableStylePart
)
38 , mnLineType( XML_none
)
42 TableStyleCellStyleContext::~TableStyleCellStyleContext()
46 // CT_TableStyleCellStyle
48 TableStyleCellStyleContext::onCreateContext( ::sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
50 switch( aElementToken
)
52 case A_TOKEN( tcBdr
): // CT_TableCellBorderStyle
54 case A_TOKEN( left
): // CT_ThemeableLineStyle
55 case A_TOKEN( right
):
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
);
67 if ( mnLineType
!= XML_none
)
69 std::map
< sal_Int32
, ::oox::drawingml::LinePropertiesPtr
>& rLineBorders
= mrTableStylePart
.getLineBorders();
70 ::oox::drawingml::LinePropertiesPtr pLineProperties
= std::make_shared
<oox::drawingml::LineProperties
>();
71 rLineBorders
[ mnLineType
] = pLineProperties
;
72 return new LinePropertiesContext( *this, rAttribs
, *pLineProperties
);
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
);
87 // EG_ThemeableFillStyle (choice)
88 case A_TOKEN( fill
): // CT_FillProperties
90 FillPropertiesPtr
& rxFillProperties
= mrTableStylePart
.getFillProperties();
91 rxFillProperties
= std::make_shared
<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
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */