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/tablestyletextstylecontext.hxx"
23 : #include "oox/drawingml/colorchoicecontext.hxx"
24 : #include "oox/helper/attributelist.hxx"
25 :
26 : using namespace ::oox::core;
27 : using namespace ::com::sun::star;
28 : using namespace ::com::sun::star::uno;
29 : using namespace ::com::sun::star::xml::sax;
30 :
31 : namespace oox { namespace drawingml { namespace table {
32 :
33 0 : TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper& rParent,
34 : const AttributeList& rAttribs, TableStylePart& rTableStylePart )
35 : : ContextHandler2( rParent )
36 0 : , mrTableStylePart( rTableStylePart )
37 : {
38 0 : if( rAttribs.hasAttribute( XML_b ) ) {
39 0 : sal_Int32 nB = rAttribs.getToken( XML_b, XML_def );
40 0 : if ( nB == XML_on )
41 0 : mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True );
42 0 : else if ( nB == XML_off )
43 0 : mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False );
44 : }
45 :
46 0 : if( rAttribs.hasAttribute( XML_i ) ) {
47 0 : sal_Int32 nI = rAttribs.getToken( XML_i, XML_def );
48 0 : if ( nI == XML_on )
49 0 : mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True );
50 0 : else if ( nI == XML_off )
51 0 : mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_False );
52 : }
53 0 : }
54 :
55 0 : TableStyleTextStyleContext::~TableStyleTextStyleContext()
56 : {
57 0 : }
58 :
59 : // CT_TableStyleTextStyle
60 : ContextHandlerRef
61 0 : TableStyleTextStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
62 : {
63 0 : switch( aElementToken )
64 : {
65 : // EG_ThemeableFontStyles (choice)
66 : case A_TOKEN( font ): // CT_FontCollection
67 0 : return this;
68 : case A_TOKEN( ea ): // CT_TextFont
69 0 : mrTableStylePart.getAsianFont().setAttributes( rAttribs );
70 0 : return 0;
71 : case A_TOKEN( cs ): // CT_TextFont
72 0 : mrTableStylePart.getComplexFont().setAttributes( rAttribs );
73 0 : return 0;
74 : case A_TOKEN( sym ): // CT_TextFont
75 0 : mrTableStylePart.getSymbolFont().setAttributes( rAttribs );
76 0 : return 0;
77 : case A_TOKEN( latin ): // CT_TextFont
78 0 : mrTableStylePart.getLatinFont().setAttributes( rAttribs );
79 0 : return 0;
80 :
81 : case A_TOKEN( fontRef ): // CT_FontReference
82 : {
83 0 : ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ];
84 0 : rFontStyle.mnThemedIdx = rAttribs.getToken( XML_idx, XML_none );
85 0 : return new ColorContext( *this, rFontStyle.maPhClr );
86 : }
87 :
88 : case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
89 0 : break;
90 : }
91 :
92 0 : return new ColorValueContext( *this, mrTableStylePart.getTextColor() );
93 : }
94 :
95 0 : } } }
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|