LCOV - code coverage report
Current view: top level - oox/source/shape - ShapeFilterBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 25 35 71.4 %
Date: 2012-08-25 Functions: 13 18 72.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 36 44.4 %

           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 "ShapeFilterBase.hxx"
      21                 :            : #include "oox/drawingml/chart/chartconverter.hxx"
      22                 :            : #include "oox/ole/vbaproject.hxx"
      23                 :            : #include "oox/drawingml/theme.hxx"
      24                 :            : 
      25                 :            : namespace oox {
      26                 :            : namespace shape {
      27                 :            : 
      28                 :            : using namespace ::com::sun::star;
      29                 :            : 
      30                 :         33 : ShapeFilterBase::ShapeFilterBase( const uno::Reference< uno::XComponentContext >& rxContext ) throw( uno::RuntimeException ) :
      31                 :            :     XmlFilterBase( rxContext ),
      32 [ +  - ][ +  - ]:         33 :     mxChartConv( new ::oox::drawingml::chart::ChartConverter )
         [ +  - ][ +  - ]
      33                 :            : {
      34                 :         33 : }
      35                 :            : 
      36 [ +  - ][ +  - ]:         33 : ShapeFilterBase::~ShapeFilterBase()
      37                 :            : {
      38         [ -  + ]:         66 : }
      39                 :            : 
      40                 :         54 : const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
      41                 :            : {
      42                 :         54 :     return mpTheme.get();
      43                 :            : }
      44                 :            : 
      45                 :          3 : void ShapeFilterBase::setCurrentTheme(::oox::drawingml::ThemePtr pTheme)
      46                 :            : {
      47                 :          3 :     mpTheme = pTheme;
      48                 :          3 : }
      49                 :            : 
      50                 :          0 : ::oox::vml::Drawing* ShapeFilterBase::getVmlDrawing()
      51                 :            : {
      52                 :          0 :     return 0;
      53                 :            : }
      54                 :            : 
      55                 :          0 : const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles()
      56                 :            : {
      57                 :          0 :     return ::oox::drawingml::table::TableStyleListPtr();
      58                 :            : }
      59                 :            : 
      60                 :          0 : ::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
      61                 :            : {
      62                 :          0 :     return mxChartConv.get();
      63                 :            : }
      64                 :            : 
      65                 :          0 : ::oox::ole::VbaProject* ShapeFilterBase::implCreateVbaProject() const
      66                 :            : {
      67 [ #  # ][ #  # ]:          0 :     return new ::oox::ole::VbaProject( getComponentContext(), getModel(), CREATE_OUSTRING( "Writer" ) );
      68                 :            : }
      69                 :            : 
      70                 :          0 : ::rtl::OUString ShapeFilterBase::implGetImplementationName() const
      71                 :            : {
      72                 :          0 :     return ::rtl::OUString();
      73                 :            : }
      74                 :            : 
      75                 :            : /// Graphic helper for shapes, that can manage color schemes.
      76         [ -  + ]:         66 : class ShapeGraphicHelper : public GraphicHelper
      77                 :            : {
      78                 :            : public:
      79                 :            :     explicit            ShapeGraphicHelper( const ShapeFilterBase& rFilter );
      80                 :            :     virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const;
      81                 :            : private:
      82                 :            :     const ShapeFilterBase& mrFilter;
      83                 :            : };
      84                 :            : 
      85                 :         33 : ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
      86 [ +  - ][ +  - ]:         33 :     GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
      87         [ +  - ]:         66 :     mrFilter( rFilter )
      88                 :            : {
      89                 :         33 : }
      90                 :            : 
      91                 :         30 : sal_Int32 ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
      92                 :            : {
      93                 :         30 :     return mrFilter.getSchemeColor( nToken );
      94                 :            : }
      95                 :            : 
      96                 :         33 : GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
      97                 :            : {
      98         [ +  - ]:         33 :     return new ShapeGraphicHelper( *this );
      99                 :            : }
     100                 :            : 
     101                 :         30 : sal_Int32 ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
     102                 :            : {
     103                 :         30 :     sal_Int32 nColor = 0;
     104                 :            : 
     105         [ +  - ]:         30 :     if (mpTheme.get())
     106         [ +  - ]:         30 :         mpTheme->getClrScheme().getColor( nToken, nColor );
     107                 :            : 
     108                 :         30 :     return nColor;
     109                 :            : }
     110                 :            : 
     111                 :            : }
     112 [ +  - ][ +  - ]:        285 : }
     113                 :            : 
     114                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10