LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WallFloorWrapper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 53 0.0 %
Date: 2014-04-14 Functions: 0 18 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 "WallFloorWrapper.hxx"
      21             : #include "macros.hxx"
      22             : #include "Chart2ModelContact.hxx"
      23             : #include "ContainerHelper.hxx"
      24             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      25             : #include <com/sun/star/drawing/FillStyle.hpp>
      26             : 
      27             : #include "FillProperties.hxx"
      28             : #include "LinePropertiesHelper.hxx"
      29             : #include "UserDefinedProperties.hxx"
      30             : #include "WrappedDirectStateProperty.hxx"
      31             : 
      32             : #include <algorithm>
      33             : #include <rtl/ustrbuf.hxx>
      34             : #include <rtl/math.hxx>
      35             : 
      36             : using namespace ::com::sun::star;
      37             : using namespace ::com::sun::star::chart2;
      38             : 
      39             : using ::com::sun::star::beans::Property;
      40             : using ::osl::MutexGuard;
      41             : using ::com::sun::star::uno::Any;
      42             : using ::com::sun::star::uno::Reference;
      43             : using ::com::sun::star::uno::Sequence;
      44             : 
      45             : namespace
      46             : {
      47           0 : static const OUString lcl_aServiceName( "com.sun.star.comp.chart.WallOrFloor" );
      48             : 
      49             : struct StaticWallFloorWrapperPropertyArray_Initializer
      50             : {
      51           0 :     Sequence< Property >* operator()()
      52             :     {
      53           0 :         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
      54           0 :         return &aPropSeq;
      55             :     }
      56             : 
      57             : private:
      58           0 :     Sequence< Property > lcl_GetPropertySequence()
      59             :     {
      60           0 :         ::std::vector< ::com::sun::star::beans::Property > aProperties;
      61           0 :         ::chart::FillProperties::AddPropertiesToVector( aProperties );
      62           0 :         ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
      63           0 :         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
      64             : 
      65             :         ::std::sort( aProperties.begin(), aProperties.end(),
      66           0 :                      ::chart::PropertyNameLess() );
      67             : 
      68           0 :         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
      69             :     }
      70             : };
      71             : 
      72             : struct StaticWallFloorWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticWallFloorWrapperPropertyArray_Initializer >
      73             : {
      74             : };
      75             : 
      76             : } // anonymous namespace
      77             : 
      78             : namespace chart
      79             : {
      80             : namespace wrapper
      81             : {
      82             : 
      83           0 : WallFloorWrapper::WallFloorWrapper( bool bWall,
      84             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
      85             :         m_spChart2ModelContact( spChart2ModelContact ),
      86             :         m_aEventListenerContainer( m_aMutex ),
      87           0 :         m_bWall( bWall )
      88             : 
      89             : {
      90           0 : }
      91             : 
      92           0 : WallFloorWrapper::~WallFloorWrapper()
      93             : {
      94           0 : }
      95             : 
      96             : // ____ XComponent ____
      97           0 : void SAL_CALL WallFloorWrapper::dispose()
      98             :     throw (uno::RuntimeException, std::exception)
      99             : {
     100           0 :     Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
     101           0 :     m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
     102             : 
     103           0 :     MutexGuard aGuard( GetMutex());
     104           0 :     clearWrappedPropertySet();
     105           0 : }
     106             : 
     107           0 : void SAL_CALL WallFloorWrapper::addEventListener(
     108             :     const Reference< lang::XEventListener >& xListener )
     109             :     throw (uno::RuntimeException, std::exception)
     110             : {
     111           0 :     m_aEventListenerContainer.addInterface( xListener );
     112           0 : }
     113             : 
     114           0 : void SAL_CALL WallFloorWrapper::removeEventListener(
     115             :     const Reference< lang::XEventListener >& aListener )
     116             :     throw (uno::RuntimeException, std::exception)
     117             : {
     118           0 :     m_aEventListenerContainer.removeInterface( aListener );
     119           0 : }
     120             : 
     121             : // WrappedPropertySet
     122           0 : Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet()
     123             : {
     124           0 :     Reference< beans::XPropertySet > xRet;
     125             : 
     126           0 :     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
     127           0 :     if( xDiagram.is() )
     128             :     {
     129           0 :         if( m_bWall )
     130           0 :             xRet.set( xDiagram->getWall() );
     131             :         else
     132           0 :             xRet.set( xDiagram->getFloor() );
     133             :     }
     134             : 
     135           0 :     return xRet;
     136             : }
     137             : 
     138           0 : const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence()
     139             : {
     140           0 :     return *StaticWallFloorWrapperPropertyArray::get();
     141             : }
     142             : 
     143           0 : const std::vector< WrappedProperty* > WallFloorWrapper::createWrappedProperties()
     144             : {
     145           0 :     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     146             : 
     147             :     // use direct state always, so that in XML the value is always
     148             :     // exported. Because in the old chart the defaults is as follows:
     149             :     // Floor: SOLID (new and old model default), Wall: NONE, except for some chart types (line, scatter)
     150           0 :     if( m_bWall )
     151           0 :         aWrappedProperties.push_back( new WrappedDirectStateProperty( "FillStyle", "FillStyle" ));
     152           0 :     aWrappedProperties.push_back( new WrappedDirectStateProperty( "FillColor", "FillColor" ));
     153             : 
     154           0 :     return aWrappedProperties;
     155             : }
     156             : 
     157           0 : Sequence< OUString > WallFloorWrapper::getSupportedServiceNames_Static()
     158             : {
     159           0 :     Sequence< OUString > aServices( 4 );
     160           0 :     aServices[ 0 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
     161           0 :     aServices[ 1 ] = "com.sun.star.drawing.FillProperties";
     162           0 :     aServices[ 2 ] = "com.sun.star.drawing.LineProperties";
     163           0 :     aServices[ 3 ] = "com.sun.star.beans.PropertySet";
     164             : 
     165           0 :     return aServices;
     166             : }
     167             : 
     168             : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
     169           0 : APPHELPER_XSERVICEINFO_IMPL( WallFloorWrapper, lcl_aServiceName );
     170             : 
     171             : } //  namespace wrapper
     172           0 : } //  namespace chart
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10