LCOV - code coverage report
Current view: top level - chart2/source/tools - FillProperties.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 65 65 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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 "FillProperties.hxx"
      21             : #include "macros.hxx"
      22             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      23             : #include <com/sun/star/drawing/BitmapMode.hpp>
      24             : #include <com/sun/star/drawing/FillStyle.hpp>
      25             : #include <com/sun/star/drawing/RectanglePoint.hpp>
      26             : 
      27             : using namespace ::com::sun::star;
      28             : 
      29             : using ::com::sun::star::beans::Property;
      30             : 
      31             : namespace chart
      32             : {
      33             : 
      34             : namespace
      35             : {
      36             : 
      37         124 : void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
      38             : {
      39             :     rOutProperties.push_back(
      40             :         Property( "FillStyle",
      41             :                   FillProperties::PROP_FILL_STYLE,
      42         124 :                   cppu::UnoType<drawing::FillStyle>::get(),
      43             :                   beans::PropertyAttribute::BOUND
      44         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      45             : 
      46             :     rOutProperties.push_back(
      47             :         Property( "FillColor",
      48             :                   FillProperties::PROP_FILL_COLOR,
      49         124 :                   cppu::UnoType<sal_Int32>::get(),
      50             :                   beans::PropertyAttribute::BOUND
      51             :                   | beans::PropertyAttribute::MAYBEVOID         // "maybe auto"
      52         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      53             : 
      54             :     rOutProperties.push_back(
      55             :         Property( "FillTransparence",
      56             :                   FillProperties::PROP_FILL_TRANSPARENCE,
      57         124 :                   cppu::UnoType<sal_Int16>::get(),
      58             :                   beans::PropertyAttribute::BOUND
      59         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      60             : 
      61             :     rOutProperties.push_back(
      62             :         Property( "FillTransparenceGradientName",
      63             :                   FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME,
      64         124 :                   cppu::UnoType<OUString>::get(),
      65             :                   beans::PropertyAttribute::BOUND
      66             :                   | beans::PropertyAttribute::MAYBEVOID
      67         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      68             : 
      69             :     rOutProperties.push_back(
      70             :         Property( "FillGradientName",
      71             :                   FillProperties::PROP_FILL_GRADIENT_NAME,
      72         124 :                   cppu::UnoType<OUString>::get(),
      73             :                   beans::PropertyAttribute::BOUND
      74             :                   | beans::PropertyAttribute::MAYBEVOID
      75         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      76             : 
      77             :     rOutProperties.push_back(
      78             :         beans::Property( "FillGradientStepCount",
      79             :                   FillProperties::PROP_FILL_GRADIENT_STEPCOUNT,
      80         124 :                   cppu::UnoType<sal_Int16>::get(),
      81             :                   beans::PropertyAttribute::BOUND
      82         248 :                   | beans::PropertyAttribute::MAYBEVOID ));
      83             : 
      84             :     rOutProperties.push_back(
      85             :         Property( "FillHatchName",
      86             :                   FillProperties::PROP_FILL_HATCH_NAME,
      87         124 :                   cppu::UnoType<OUString>::get(),
      88             :                   beans::PropertyAttribute::BOUND
      89             :                   | beans::PropertyAttribute::MAYBEVOID
      90         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
      91             : 
      92             :     //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
      93             : 
      94             :     rOutProperties.push_back(
      95             :         Property( "FillBackground",
      96             :                   FillProperties::PROP_FILL_BACKGROUND,
      97         124 :                   cppu::UnoType<sal_Bool>::get(),
      98             :                   beans::PropertyAttribute::BOUND
      99         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     100         124 : }
     101             : 
     102         124 : void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
     103             : {
     104             :     rOutProperties.push_back(
     105             :         Property( "FillBitmapName",
     106             :                   FillProperties::PROP_FILL_BITMAP_NAME,
     107         124 :                   cppu::UnoType<OUString>::get(),
     108             :                   beans::PropertyAttribute::BOUND
     109             :                   | beans::PropertyAttribute::MAYBEVOID
     110         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     111             : 
     112             :     rOutProperties.push_back(
     113             :         Property( "FillBitmapOffsetX",
     114             :                   FillProperties::PROP_FILL_BITMAP_OFFSETX,
     115         124 :                   cppu::UnoType<sal_Int16>::get(),
     116             :                   beans::PropertyAttribute::BOUND
     117         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     118             : 
     119             :     rOutProperties.push_back(
     120             :         Property( "FillBitmapOffsetY",
     121             :                   FillProperties::PROP_FILL_BITMAP_OFFSETY,
     122         124 :                   cppu::UnoType<sal_Int16>::get(),
     123             :                   beans::PropertyAttribute::BOUND
     124         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     125             : 
     126             :     rOutProperties.push_back(
     127             :         Property( "FillBitmapPositionOffsetX",
     128             :                   FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
     129         124 :                   cppu::UnoType<sal_Int16>::get(),
     130             :                   beans::PropertyAttribute::BOUND
     131         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     132             : 
     133             :     rOutProperties.push_back(
     134             :         Property( "FillBitmapPositionOffsetY",
     135             :                   FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
     136         124 :                   cppu::UnoType<sal_Int16>::get(),
     137             :                   beans::PropertyAttribute::BOUND
     138         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     139             : 
     140             :     rOutProperties.push_back(
     141             :         Property( "FillBitmapRectanglePoint",
     142             :                   FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
     143         124 :                   cppu::UnoType<drawing::RectanglePoint>::get(),
     144             :                   beans::PropertyAttribute::BOUND
     145         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     146             : 
     147             :     rOutProperties.push_back(
     148             :         Property( "FillBitmapLogicalSize",
     149             :                   FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
     150         124 :                   cppu::UnoType<sal_Bool>::get(),
     151             :                   beans::PropertyAttribute::BOUND
     152         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     153             : 
     154             :     rOutProperties.push_back(
     155             :         Property( "FillBitmapSizeX",
     156             :                   FillProperties::PROP_FILL_BITMAP_SIZEX,
     157         124 :                   cppu::UnoType<sal_Int32>::get(),
     158             :                   beans::PropertyAttribute::BOUND
     159         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     160             : 
     161             :     rOutProperties.push_back(
     162             :         Property( "FillBitmapSizeY",
     163             :                   FillProperties::PROP_FILL_BITMAP_SIZEY,
     164         124 :                   cppu::UnoType<sal_Int32>::get(),
     165             :                   beans::PropertyAttribute::BOUND
     166         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     167             : 
     168             :     rOutProperties.push_back(
     169             :         Property( "FillBitmapMode",
     170             :                   FillProperties::PROP_FILL_BITMAP_MODE,
     171         124 :                   cppu::UnoType<drawing::BitmapMode>::get(),
     172             :                   beans::PropertyAttribute::BOUND
     173         248 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
     174         124 : }
     175             : 
     176          59 : void lcl_AddDefaultsToMap_without_BitmapProperties(
     177             :     ::chart::tPropertyValueMap & rOutMap )
     178             : {
     179          59 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_STYLE, drawing::FillStyle_SOLID );
     180          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_COLOR, 0xd9d9d9 ); // gray85
     181          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, 0 );
     182          59 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BACKGROUND, false );
     183          59 : }
     184             : 
     185          59 : void lcl_AddDefaultsToMap_only_BitmapProperties(
     186             :     ::chart::tPropertyValueMap & rOutMap )
     187             : {
     188          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
     189          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
     190          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
     191          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
     192             : 
     193          59 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
     194          59 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
     195          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
     196          59 :     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
     197          59 :     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
     198          59 : }
     199             : 
     200             : }//end anonymous namespace
     201             : 
     202         124 : void FillProperties::AddPropertiesToVector(
     203             :     ::std::vector< Property > & rOutProperties )
     204             : {
     205             :     // Fill Properties see service drawing::FillProperties
     206         124 :     lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties );
     207         124 :     lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties );
     208         124 : }
     209             : 
     210          59 : void FillProperties::AddDefaultsToMap(
     211             :     ::chart::tPropertyValueMap & rOutMap )
     212             : {
     213          59 :     lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap );
     214          59 :     lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap );
     215          59 : }
     216             : 
     217             : } //  namespace chart
     218             : 
     219             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11