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

Generated by: LCOV version 1.10