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
;
29 using namespace ::com::sun::star::uno
;
30 using namespace ::com::sun::star::xml::sax
;
32 namespace oox
{ namespace drawingml
{ namespace table
{
34 TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper
& rParent
,
35 const AttributeList
& rAttribs
, TableStylePart
& rTableStylePart
)
36 : ContextHandler2( rParent
)
37 , mrTableStylePart( rTableStylePart
)
39 if( rAttribs
.hasAttribute( XML_b
) ) {
40 sal_Int32 nB
= rAttribs
.getToken( XML_b
, XML_def
);
42 mrTableStylePart
.getTextBoldStyle() = ::boost::optional
< sal_Bool
>( true );
43 else if ( nB
== XML_off
)
44 mrTableStylePart
.getTextBoldStyle() = ::boost::optional
< sal_Bool
>( false );
47 if( rAttribs
.hasAttribute( XML_i
) ) {
48 sal_Int32 nI
= rAttribs
.getToken( XML_i
, XML_def
);
50 mrTableStylePart
.getTextItalicStyle() = ::boost::optional
< sal_Bool
>( true );
51 else if ( nI
== XML_off
)
52 mrTableStylePart
.getTextItalicStyle() = ::boost::optional
< sal_Bool
>( false );
56 TableStyleTextStyleContext::~TableStyleTextStyleContext()
60 // CT_TableStyleTextStyle
62 TableStyleTextStyleContext::onCreateContext( ::sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
64 switch( aElementToken
)
66 // EG_ThemeableFontStyles (choice)
67 case A_TOKEN( font
): // CT_FontCollection
69 case A_TOKEN( ea
): // CT_TextFont
70 mrTableStylePart
.getAsianFont().setAttributes( rAttribs
);
72 case A_TOKEN( cs
): // CT_TextFont
73 mrTableStylePart
.getComplexFont().setAttributes( rAttribs
);
75 case A_TOKEN( sym
): // CT_TextFont
76 mrTableStylePart
.getSymbolFont().setAttributes( rAttribs
);
78 case A_TOKEN( latin
): // CT_TextFont
79 mrTableStylePart
.getLatinFont().setAttributes( rAttribs
);
82 case A_TOKEN( fontRef
): // CT_FontReference
84 ShapeStyleRef
& rFontStyle
= mrTableStylePart
.getStyleRefs()[ XML_fontRef
];
85 rFontStyle
.mnThemedIdx
= rAttribs
.getToken( XML_idx
, XML_none
);
86 return new ColorContext( *this, rFontStyle
.maPhClr
);
89 case A_TOKEN( extLst
): // CT_OfficeArtExtensionList
93 return new ColorValueContext( *this, mrTableStylePart
.getTextColor() );
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */