Branch data 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 : : using ::rtl::OUString;
31 : :
32 : : namespace oox { namespace drawingml { namespace table {
33 : :
34 : 0 : TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler& rParent,
35 : : const Reference< XFastAttributeList >& xAttribs, TableStylePart& rTableStylePart )
36 : : : ContextHandler( rParent )
37 : 0 : , mrTableStylePart( rTableStylePart )
38 : : {
39 [ # # ][ # # ]: 0 : if( xAttribs->hasAttribute( XML_b ) ) {
[ # # ]
40 [ # # ][ # # ]: 0 : sal_Int32 nB = xAttribs->getOptionalValueToken( XML_b, XML_def );
41 [ # # ]: 0 : if ( nB == XML_on )
42 [ # # ][ # # ]: 0 : mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True );
[ # # ]
43 [ # # ]: 0 : else if ( nB == XML_off )
44 [ # # ][ # # ]: 0 : mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False );
[ # # ]
45 : : }
46 : :
47 [ # # ][ # # ]: 0 : if( xAttribs->hasAttribute( XML_i ) ) {
[ # # ]
48 [ # # ][ # # ]: 0 : sal_Int32 nI = xAttribs->getOptionalValueToken( XML_i, XML_def );
49 [ # # ]: 0 : if ( nI == XML_on )
50 [ # # ][ # # ]: 0 : mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True );
[ # # ]
51 [ # # ]: 0 : else if ( nI == XML_off )
52 [ # # ][ # # ]: 0 : mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_False );
[ # # ]
53 : : }
54 : 0 : }
55 : :
56 : 0 : TableStyleTextStyleContext::~TableStyleTextStyleContext()
57 : : {
58 [ # # ]: 0 : }
59 : :
60 : : // CT_TableStyleTextStyle
61 : : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
62 : 0 : TableStyleTextStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
63 : : throw ( xml::sax::SAXException, uno::RuntimeException)
64 : : {
65 : 0 : uno::Reference< xml::sax::XFastContextHandler > xRet;
66 [ # # ]: 0 : AttributeList aAttribs( xAttribs );
67 : :
68 [ # # # # : 0 : switch( aElementToken )
# # # # ]
69 : : {
70 : : // EG_ThemeableFontStyles (choice)
71 : : case A_TOKEN( font ): // CT_FontCollection
72 [ # # ]: 0 : xRet.set( this );
73 : 0 : break;
74 : : case A_TOKEN( ea ): // CT_TextFont
75 [ # # ]: 0 : mrTableStylePart.getAsianFont().setAttributes( aAttribs );
76 [ # # ]: 0 : return 0;
77 : : case A_TOKEN( cs ): // CT_TextFont
78 [ # # ]: 0 : mrTableStylePart.getComplexFont().setAttributes( aAttribs );
79 [ # # ]: 0 : return 0;
80 : : case A_TOKEN( sym ): // CT_TextFont
81 [ # # ]: 0 : mrTableStylePart.getSymbolFont().setAttributes( aAttribs );
82 [ # # ]: 0 : return 0;
83 : : case A_TOKEN( latin ): // CT_TextFont
84 [ # # ]: 0 : mrTableStylePart.getLatinFont().setAttributes( aAttribs );
85 [ # # ]: 0 : return 0;
86 : :
87 : : case A_TOKEN( fontRef ): // CT_FontReference
88 : : {
89 [ # # ]: 0 : ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ];
90 [ # # ]: 0 : rFontStyle.mnThemedIdx = aAttribs.getToken( XML_idx, XML_none );
91 [ # # ][ # # ]: 0 : xRet.set( new ColorContext( *this, rFontStyle.maPhClr ) );
[ # # ]
92 : : }
93 : 0 : break;
94 : :
95 : : case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
96 : 0 : break;
97 : : }
98 [ # # ]: 0 : if( !xRet.is() )
99 [ # # ][ # # ]: 0 : xRet.set( new ColorValueContext( *this, mrTableStylePart.getTextColor() ) );
[ # # ]
100 : :
101 [ # # ]: 0 : return xRet;
102 : : }
103 : :
104 [ + - ][ + - ]: 285 : } } }
105 : :
106 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|