LCOV - code coverage report
Current view: top level - oox/source/drawingml - themeelementscontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 72 0.0 %
Date: 2014-04-14 Functions: 0 21 0.0 %
Legend: Lines: hit not hit

          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 "oox/drawingml/themeelementscontext.hxx"
      21             : #include "oox/drawingml/clrschemecontext.hxx"
      22             : #include "oox/drawingml/lineproperties.hxx"
      23             : #include "oox/drawingml/linepropertiescontext.hxx"
      24             : #include "oox/drawingml/effectproperties.hxx"
      25             : #include "oox/drawingml/effectpropertiescontext.hxx"
      26             : #include "oox/drawingml/fillproperties.hxx"
      27             : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
      28             : #include "oox/drawingml/theme.hxx"
      29             : #include "oox/helper/attributelist.hxx"
      30             : 
      31             : using namespace ::oox::core;
      32             : using namespace ::com::sun::star::uno;
      33             : using namespace ::com::sun::star::xml::sax;
      34             : 
      35             : namespace oox {
      36             : namespace drawingml {
      37             : 
      38             : 
      39             : 
      40           0 : class FillStyleListContext : public ContextHandler2
      41             : {
      42             : public:
      43             :     FillStyleListContext( ContextHandler2Helper& rParent, FillStyleList& rFillStyleList );
      44             :     virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
      45             : 
      46             : private:
      47             :     FillStyleList& mrFillStyleList;
      48             : };
      49             : 
      50           0 : FillStyleListContext::FillStyleListContext( ContextHandler2Helper& rParent, FillStyleList& rFillStyleList ) :
      51             :     ContextHandler2( rParent ),
      52           0 :     mrFillStyleList( rFillStyleList )
      53             : {
      54           0 : }
      55             : 
      56           0 : ContextHandlerRef FillStyleListContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      57             : {
      58           0 :     switch( nElement )
      59             :     {
      60             :         case A_TOKEN( noFill ):
      61             :         case A_TOKEN( solidFill ):
      62             :         case A_TOKEN( gradFill ):
      63             :         case A_TOKEN( blipFill ):
      64             :         case A_TOKEN( pattFill ):
      65             :         case A_TOKEN( grpFill ):
      66           0 :             mrFillStyleList.push_back( FillPropertiesPtr( new FillProperties ) );
      67           0 :             return FillPropertiesContext::createFillContext( *this, nElement, rAttribs, *mrFillStyleList.back() );
      68             :     }
      69           0 :     return 0;
      70             : }
      71             : 
      72             : 
      73             : 
      74           0 : class LineStyleListContext : public ContextHandler2
      75             : {
      76             : public:
      77             :     LineStyleListContext( ContextHandler2Helper& rParent, LineStyleList& rLineStyleList );
      78             :     virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
      79             : 
      80             : private:
      81             :     LineStyleList& mrLineStyleList;
      82             : };
      83             : 
      84           0 : LineStyleListContext::LineStyleListContext( ContextHandler2Helper& rParent, LineStyleList& rLineStyleList ) :
      85             :     ContextHandler2( rParent ),
      86           0 :     mrLineStyleList( rLineStyleList )
      87             : {
      88           0 : }
      89             : 
      90           0 : ContextHandlerRef LineStyleListContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      91             : {
      92           0 :     switch( nElement )
      93             :     {
      94             :         case A_TOKEN( ln ):
      95           0 :             mrLineStyleList.push_back( LinePropertiesPtr( new LineProperties ) );
      96           0 :             return new LinePropertiesContext( *this, rAttribs, *mrLineStyleList.back() );
      97             :     }
      98           0 :     return 0;
      99             : }
     100             : 
     101             : 
     102             : 
     103           0 : class EffectStyleListContext : public ContextHandler2
     104             : {
     105             : public:
     106             :     EffectStyleListContext( ContextHandler2Helper& rParent, EffectStyleList& rEffectStyleList );
     107             :     virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
     108             : 
     109             : private:
     110             :     EffectStyleList& mrEffectStyleList;
     111             : };
     112             : 
     113           0 : EffectStyleListContext::EffectStyleListContext( ContextHandler2Helper& rParent, EffectStyleList& rEffectStyleList ) :
     114             :     ContextHandler2( rParent ),
     115           0 :     mrEffectStyleList( rEffectStyleList )
     116             : {
     117           0 : }
     118             : 
     119           0 : ContextHandlerRef EffectStyleListContext::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
     120             : {
     121           0 :     switch( nElement )
     122             :     {
     123             :         case A_TOKEN( effectStyle ):
     124           0 :             mrEffectStyleList.push_back( EffectPropertiesPtr( new EffectProperties ) );
     125           0 :             return this;
     126             : 
     127             :         case A_TOKEN( effectLst ):  // CT_EffectList
     128           0 :             if( mrEffectStyleList.back() )
     129           0 :                 return new EffectPropertiesContext( *this, *mrEffectStyleList.back() );
     130           0 :             break;
     131             :     }
     132           0 :     return 0;
     133             : }
     134             : 
     135             : 
     136             : 
     137           0 : class FontSchemeContext : public ContextHandler2
     138             : {
     139             : public:
     140             :     FontSchemeContext( ContextHandler2Helper& rParent, FontScheme& rFontScheme );
     141             :     virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
     142             :     virtual void onEndElement() SAL_OVERRIDE;
     143             : 
     144             : private:
     145             :     FontScheme& mrFontScheme;
     146             :     TextCharacterPropertiesPtr mxCharProps;
     147             : };
     148             : 
     149           0 : FontSchemeContext::FontSchemeContext( ContextHandler2Helper& rParent, FontScheme& rFontScheme ) :
     150             :     ContextHandler2( rParent ),
     151           0 :     mrFontScheme( rFontScheme )
     152             : {
     153           0 : }
     154             : 
     155           0 : ContextHandlerRef FontSchemeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     156             : {
     157           0 :     switch( nElement )
     158             :     {
     159             :         case A_TOKEN( majorFont ):
     160           0 :             mxCharProps.reset( new TextCharacterProperties );
     161           0 :             mrFontScheme[ XML_major ] = mxCharProps;
     162           0 :             return this;
     163             :         case A_TOKEN( minorFont ):
     164           0 :             mxCharProps.reset( new TextCharacterProperties );
     165           0 :             mrFontScheme[ XML_minor ] = mxCharProps;
     166           0 :             return this;
     167             : 
     168             :         case A_TOKEN( latin ):
     169           0 :             if( mxCharProps.get() )
     170           0 :                 mxCharProps->maLatinFont.setAttributes( rAttribs );
     171           0 :         break;
     172             :         case A_TOKEN( ea ):
     173           0 :             if( mxCharProps.get() )
     174           0 :                 mxCharProps->maAsianFont.setAttributes( rAttribs );
     175           0 :         break;
     176             :         case A_TOKEN( cs ):
     177           0 :             if( mxCharProps.get() )
     178           0 :                 mxCharProps->maComplexFont.setAttributes( rAttribs );
     179           0 :         break;
     180             :     }
     181           0 :     return 0;
     182             : }
     183             : 
     184           0 : void FontSchemeContext::onEndElement()
     185             : {
     186           0 :     switch( getCurrentElement() )
     187             :     {
     188             :         case A_TOKEN( majorFont ):
     189             :         case A_TOKEN( minorFont ):
     190           0 :             mxCharProps.reset();
     191           0 :         break;
     192             :     }
     193           0 : }
     194             : 
     195             : 
     196             : 
     197           0 : ThemeElementsContext::ThemeElementsContext( ContextHandler2Helper& rParent, Theme& rTheme ) :
     198             :     ContextHandler2( rParent ),
     199           0 :     mrTheme( rTheme )
     200             : {
     201           0 : }
     202             : 
     203           0 : ContextHandlerRef ThemeElementsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     204             : {
     205             :     // CT_BaseStyles
     206           0 :     switch( nElement )
     207             :     {
     208             :         case A_TOKEN( clrScheme ):  // CT_ColorScheme
     209           0 :             return new clrSchemeContext( *this, mrTheme.getClrScheme() );
     210             :         case A_TOKEN( fontScheme ): // CT_FontScheme
     211           0 :             return new FontSchemeContext( *this, mrTheme.getFontScheme() );
     212             : 
     213             :         case A_TOKEN( fmtScheme ):  // CT_StyleMatrix
     214           0 :             mrTheme.setStyleName( rAttribs.getString( XML_name ).get() );
     215           0 :             return this;
     216             : 
     217             :         case A_TOKEN( fillStyleLst ):   // CT_FillStyleList
     218           0 :             return new FillStyleListContext( *this, mrTheme.getFillStyleList() );
     219             :         case A_TOKEN( lnStyleLst ):    // CT_LineStyleList
     220           0 :             return new LineStyleListContext( *this, mrTheme.getLineStyleList() );
     221             :         case A_TOKEN( effectStyleLst ): // CT_EffectStyleList
     222           0 :             return new EffectStyleListContext( *this, mrTheme.getEffectStyleList() );
     223             :         case A_TOKEN( bgFillStyleLst ): // CT_BackgroundFillStyleList
     224           0 :             return new FillStyleListContext( *this, mrTheme.getBgFillStyleList() );
     225             :     }
     226           0 :     return 0;
     227             : }
     228             : 
     229             : 
     230             : 
     231             : } // namespace drawingml
     232           0 : } // namespace oox
     233             : 
     234             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10