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/tablestyletextstylecontext.hxx>
22 #include <drawingml/colorchoicecontext.hxx>
23 #include <oox/helper/attributelist.hxx>
24 #include <oox/token/namespaces.hxx>
25 #include <oox/token/tokens.hxx>
27 using namespace ::oox::core
;
28 using namespace ::com::sun::star
;
30 namespace oox::drawingml::table
{
32 TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper
const & rParent
,
33 const AttributeList
& rAttribs
, TableStylePart
& rTableStylePart
)
34 : ContextHandler2( rParent
)
35 , mrTableStylePart( rTableStylePart
)
37 if( rAttribs
.hasAttribute( XML_b
) ) {
38 sal_Int32 nB
= rAttribs
.getToken( XML_b
, XML_def
);
40 mrTableStylePart
.getTextBoldStyle() = true;
41 else if ( nB
== XML_off
)
42 mrTableStylePart
.getTextBoldStyle() = false;
45 if( rAttribs
.hasAttribute( XML_i
) ) {
46 sal_Int32 nI
= rAttribs
.getToken( XML_i
, XML_def
);
48 mrTableStylePart
.getTextItalicStyle() = true;
49 else if ( nI
== XML_off
)
50 mrTableStylePart
.getTextItalicStyle() = false;
54 TableStyleTextStyleContext::~TableStyleTextStyleContext()
58 // CT_TableStyleTextStyle
60 TableStyleTextStyleContext::onCreateContext( ::sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
62 switch( aElementToken
)
64 // EG_ThemeableFontStyles (choice)
65 case A_TOKEN( font
): // CT_FontCollection
67 case A_TOKEN( ea
): // CT_TextFont
68 mrTableStylePart
.getAsianFont().setAttributes( rAttribs
);
70 case A_TOKEN( cs
): // CT_TextFont
71 mrTableStylePart
.getComplexFont().setAttributes( rAttribs
);
73 case A_TOKEN( sym
): // CT_TextFont
74 mrTableStylePart
.getSymbolFont().setAttributes( rAttribs
);
76 case A_TOKEN( latin
): // CT_TextFont
77 mrTableStylePart
.getLatinFont().setAttributes( rAttribs
);
80 case A_TOKEN( fontRef
): // CT_FontReference
82 ShapeStyleRef
& rFontStyle
= mrTableStylePart
.getStyleRefs()[ XML_fontRef
];
83 rFontStyle
.mnThemedIdx
= rAttribs
.getToken( XML_idx
, XML_none
);
84 return new ColorContext( *this, rFontStyle
.maPhClr
);
87 case A_TOKEN( extLst
): // CT_OfficeArtExtensionList
91 return new ColorValueContext( *this, mrTableStylePart
.getTextColor() );
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */