LCOV - code coverage report
Current view: top level - chart2/source/model/main - Wall.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 64 0.0 %
Date: 2014-04-14 Functions: 0 22 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 "Wall.hxx"
      21             : #include "macros.hxx"
      22             : #include "LinePropertiesHelper.hxx"
      23             : #include "FillProperties.hxx"
      24             : #include "UserDefinedProperties.hxx"
      25             : #include "ContainerHelper.hxx"
      26             : #include "PropertyHelper.hxx"
      27             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      28             : #include <com/sun/star/drawing/FillStyle.hpp>
      29             : #include <com/sun/star/awt/Gradient.hpp>
      30             : #include <com/sun/star/drawing/Hatch.hpp>
      31             : #include <com/sun/star/drawing/LineStyle.hpp>
      32             : #include <com/sun/star/drawing/LineDash.hpp>
      33             : #include <com/sun/star/drawing/LineJoint.hpp>
      34             : #include <rtl/uuid.h>
      35             : #include <cppuhelper/queryinterface.hxx>
      36             : 
      37             : #include <vector>
      38             : #include <algorithm>
      39             : 
      40             : using namespace ::com::sun::star;
      41             : using namespace ::com::sun::star::beans::PropertyAttribute;
      42             : 
      43             : using ::com::sun::star::beans::Property;
      44             : using ::osl::MutexGuard;
      45             : 
      46             : namespace
      47             : {
      48             : 
      49             : struct StaticWallDefaults_Initializer
      50             : {
      51           0 :     ::chart::tPropertyValueMap* operator()()
      52             :     {
      53           0 :         static ::chart::tPropertyValueMap aStaticDefaults;
      54           0 :         lcl_AddDefaultsToMap( aStaticDefaults );
      55           0 :         return &aStaticDefaults;
      56             :     }
      57             : private:
      58           0 :     void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
      59             :     {
      60           0 :         ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap );
      61           0 :         ::chart::FillProperties::AddDefaultsToMap( rOutMap );
      62             : 
      63             :         // override other defaults
      64           0 :         ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
      65           0 :     }
      66             : };
      67             : 
      68             : struct StaticWallDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticWallDefaults_Initializer >
      69             : {
      70             : };
      71             : 
      72             : struct StaticWallInfoHelper_Initializer
      73             : {
      74           0 :     ::cppu::OPropertyArrayHelper* operator()()
      75             :     {
      76           0 :         static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
      77           0 :         return &aPropHelper;
      78             :     }
      79             : 
      80             : private:
      81           0 :     uno::Sequence< Property > lcl_GetPropertySequence()
      82             :     {
      83           0 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
      84           0 :         ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
      85           0 :         ::chart::FillProperties::AddPropertiesToVector( aProperties );
      86           0 :         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
      87             : 
      88             :         ::std::sort( aProperties.begin(), aProperties.end(),
      89           0 :                      ::chart::PropertyNameLess() );
      90             : 
      91           0 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
      92             :     }
      93             : 
      94             : };
      95             : 
      96             : struct StaticWallInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticWallInfoHelper_Initializer >
      97             : {
      98             : };
      99             : 
     100             : struct StaticWallInfo_Initializer
     101             : {
     102           0 :     uno::Reference< beans::XPropertySetInfo >* operator()()
     103             :     {
     104             :         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
     105           0 :             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticWallInfoHelper::get() ) );
     106           0 :         return &xPropertySetInfo;
     107             :     }
     108             : };
     109             : 
     110             : struct StaticWallInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticWallInfo_Initializer >
     111             : {
     112             : };
     113             : 
     114             : } // anonymous namespace
     115             : 
     116             : namespace chart
     117             : {
     118             : 
     119           0 : Wall::Wall() :
     120             :         ::property::OPropertySet( m_aMutex ),
     121           0 :     m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
     122           0 : {}
     123             : 
     124           0 : Wall::Wall( const Wall & rOther ) :
     125             :         MutexContainer(),
     126             :         impl::Wall_Base(),
     127             :         ::property::OPropertySet( rOther, m_aMutex ),
     128           0 :     m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
     129           0 : {}
     130             : 
     131           0 : Wall::~Wall()
     132           0 : {}
     133             : 
     134             : // ____ XCloneable ____
     135           0 : uno::Reference< util::XCloneable > SAL_CALL Wall::createClone()
     136             :     throw (uno::RuntimeException, std::exception)
     137             : {
     138           0 :     return uno::Reference< util::XCloneable >( new Wall( *this ));
     139             : }
     140             : 
     141             : // ____ OPropertySet ____
     142           0 : uno::Any Wall::GetDefaultValue( sal_Int32 nHandle ) const
     143             :     throw(beans::UnknownPropertyException)
     144             : {
     145           0 :     const tPropertyValueMap& rStaticDefaults = *StaticWallDefaults::get();
     146           0 :     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
     147           0 :     if( aFound == rStaticDefaults.end() )
     148           0 :         return uno::Any();
     149           0 :     return (*aFound).second;
     150             : }
     151             : 
     152           0 : ::cppu::IPropertyArrayHelper & SAL_CALL Wall::getInfoHelper()
     153             : {
     154           0 :     return *StaticWallInfoHelper::get();
     155             : }
     156             : 
     157             : // ____ XPropertySet ____
     158           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL Wall::getPropertySetInfo()
     159             :     throw (uno::RuntimeException, std::exception)
     160             : {
     161           0 :     return *StaticWallInfo::get();
     162             : }
     163             : 
     164             : // ____ XModifyBroadcaster ____
     165           0 : void SAL_CALL Wall::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
     166             :     throw (uno::RuntimeException, std::exception)
     167             : {
     168             :     try
     169             :     {
     170           0 :         uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
     171           0 :         xBroadcaster->addModifyListener( aListener );
     172             :     }
     173           0 :     catch( const uno::Exception & ex )
     174             :     {
     175             :         ASSERT_EXCEPTION( ex );
     176             :     }
     177           0 : }
     178             : 
     179           0 : void SAL_CALL Wall::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
     180             :     throw (uno::RuntimeException, std::exception)
     181             : {
     182             :     try
     183             :     {
     184           0 :         uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
     185           0 :         xBroadcaster->removeModifyListener( aListener );
     186             :     }
     187           0 :     catch( const uno::Exception & ex )
     188             :     {
     189             :         ASSERT_EXCEPTION( ex );
     190             :     }
     191           0 : }
     192             : 
     193             : // ____ XModifyListener ____
     194           0 : void SAL_CALL Wall::modified( const lang::EventObject& aEvent )
     195             :     throw (uno::RuntimeException, std::exception)
     196             : {
     197           0 :     m_xModifyEventForwarder->modified( aEvent );
     198           0 : }
     199             : 
     200             : // ____ XEventListener (base of XModifyListener) ____
     201           0 : void SAL_CALL Wall::disposing( const lang::EventObject& /* Source */ )
     202             :     throw (uno::RuntimeException, std::exception)
     203             : {
     204             :     // nothing
     205           0 : }
     206             : 
     207             : // ____ OPropertySet ____
     208           0 : void Wall::firePropertyChangeEvent()
     209             : {
     210           0 :     fireModifyEvent();
     211           0 : }
     212             : 
     213           0 : void Wall::fireModifyEvent()
     214             : {
     215           0 :     m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
     216           0 : }
     217             : 
     218             : using impl::Wall_Base;
     219             : 
     220           0 : IMPLEMENT_FORWARD_XINTERFACE2( Wall, Wall_Base, ::property::OPropertySet )
     221             : 
     222             : } //  namespace chart
     223             : 
     224             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10