LCOV - code coverage report
Current view: top level - libreoffice/oox/source/shape - ShapeFilterBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 25 35 71.4 %
Date: 2012-12-27 Functions: 13 18 72.2 %
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 "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          21 : ShapeFilterBase::ShapeFilterBase( const uno::Reference< uno::XComponentContext >& rxContext ) throw( uno::RuntimeException ) :
      31             :     XmlFilterBase( rxContext ),
      32          21 :     mxChartConv( new ::oox::drawingml::chart::ChartConverter )
      33             : {
      34          21 : }
      35             : 
      36          42 : ShapeFilterBase::~ShapeFilterBase()
      37             : {
      38          42 : }
      39             : 
      40          15 : const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
      41             : {
      42          15 :     return mpTheme.get();
      43             : }
      44             : 
      45           1 : void ShapeFilterBase::setCurrentTheme(::oox::drawingml::ThemePtr pTheme)
      46             : {
      47           1 :     mpTheme = pTheme;
      48           1 : }
      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          42 : 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          21 : ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
      86          21 :     GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
      87          42 :     mrFilter( rFilter )
      88             : {
      89          21 : }
      90             : 
      91          10 : sal_Int32 ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
      92             : {
      93          10 :     return mrFilter.getSchemeColor( nToken );
      94             : }
      95             : 
      96          21 : GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
      97             : {
      98          21 :     return new ShapeGraphicHelper( *this );
      99             : }
     100             : 
     101          10 : sal_Int32 ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
     102             : {
     103          10 :     sal_Int32 nColor = 0;
     104             : 
     105          10 :     if (mpTheme.get())
     106          10 :         mpTheme->getClrScheme().getColor( nToken, nColor );
     107             : 
     108          10 :     return nColor;
     109             : }
     110             : 
     111             : }
     112          51 : }
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10