LCOV - code coverage report
Current view: top level - reportdesign/source/core/api - Group.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 150 0.0 %
Date: 2014-04-14 Functions: 0 45 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             : #include "Group.hxx"
      20             : #include "Section.hxx"
      21             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      22             : #include <com/sun/star/report/GroupOn.hpp>
      23             : #include <com/sun/star/report/KeepTogether.hpp>
      24             : #include "corestrings.hrc"
      25             : #include "core_resource.hrc"
      26             : #include "core_resource.hxx"
      27             : #include "Tools.hxx"
      28             : #include <tools/debug.hxx>
      29             : #include <comphelper/property.hxx>
      30             : #include <cppuhelper/supportsservice.hxx>
      31             : #include "Functions.hxx"
      32             : 
      33             : 
      34             : namespace reportdesign
      35             : {
      36             : 
      37             :     using namespace com::sun::star;
      38             :     using namespace comphelper;
      39             : 
      40           0 : OGroup::OGroup(const uno::Reference< report::XGroups >& _xParent
      41             :                ,const uno::Reference< uno::XComponentContext >& _xContext)
      42             : :GroupBase(m_aMutex)
      43             : ,GroupPropertySet(_xContext,static_cast< GroupPropertySet::Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >())
      44             : ,m_xContext(_xContext)
      45           0 : ,m_xParent(_xParent)
      46             : {
      47           0 :     osl_atomic_increment(&m_refCount);
      48             :     {
      49           0 :         m_xFunctions = new OFunctions(this,m_xContext);
      50             :     }
      51           0 :     osl_atomic_decrement( &m_refCount );
      52           0 : }
      53             : 
      54             : // TODO: VirtualFunctionFinder: This is virtual function!
      55             : 
      56           0 : OGroup::~OGroup()
      57             : {
      58           0 : }
      59             : 
      60           0 : void OGroup::copyGroup(const uno::Reference< report::XGroup >& _xSource)
      61             : {
      62           0 :     ::comphelper::copyProperties(_xSource.get(),static_cast<GroupPropertySet*>(this));
      63             : 
      64           0 :     if ( _xSource->getHeaderOn() )
      65             :     {
      66           0 :         setHeaderOn(sal_True);
      67           0 :         OSection::lcl_copySection(_xSource->getHeader(),m_xHeader);
      68             :     }
      69             : 
      70           0 :     if ( _xSource->getFooterOn() )
      71             :     {
      72           0 :         setFooterOn(sal_True);
      73           0 :         OSection::lcl_copySection(_xSource->getFooter(),m_xFooter);
      74             :     }
      75           0 : }
      76             : 
      77           0 : IMPLEMENT_FORWARD_XINTERFACE2(OGroup,GroupBase,GroupPropertySet)
      78             : 
      79           0 : OUString SAL_CALL OGroup::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
      80             : {
      81           0 :     return OUString("com.sun.star.comp.report.Group");
      82             : }
      83             : 
      84           0 : uno::Sequence< OUString> OGroup::getSupportedServiceNames_Static(void) throw( uno::RuntimeException )
      85             : {
      86           0 :     uno::Sequence< OUString> aSupported(1);
      87           0 :     aSupported.getArray()[0] = SERVICE_GROUP;
      88           0 :     return aSupported;
      89             : }
      90             : 
      91           0 : uno::Sequence< OUString> SAL_CALL OGroup::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
      92             : {
      93           0 :     return getSupportedServiceNames_Static();
      94             : }
      95             : 
      96           0 : sal_Bool SAL_CALL OGroup::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
      97             : {
      98           0 :     return cppu::supportsService(this, _rServiceName);
      99             : }
     100             : 
     101           0 : void SAL_CALL OGroup::dispose() throw(uno::RuntimeException, std::exception)
     102             : {
     103           0 :     GroupPropertySet::dispose();
     104           0 :     cppu::WeakComponentImplHelperBase::dispose();
     105           0 : }
     106             : 
     107             : // TODO: VirtualFunctionFinder: This is virtual function!
     108             : 
     109           0 : void SAL_CALL OGroup::disposing()
     110             : {
     111           0 :     m_xHeader.clear();
     112           0 :     m_xFooter.clear();
     113           0 :     ::comphelper::disposeComponent(m_xFunctions);
     114           0 :     m_xContext.clear();
     115           0 : }
     116             : 
     117             : // XGroup
     118           0 : sal_Bool SAL_CALL OGroup::getSortAscending() throw (uno::RuntimeException, std::exception)
     119             : {
     120           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     121           0 :     return m_aProps.m_eSortAscending;
     122             : }
     123             : 
     124           0 : void SAL_CALL OGroup::setSortAscending( sal_Bool _sortascending ) throw (uno::RuntimeException, std::exception)
     125             : {
     126           0 :     set(PROPERTY_SORTASCENDING,_sortascending,m_aProps.m_eSortAscending);
     127           0 : }
     128             : 
     129           0 : sal_Bool SAL_CALL OGroup::getHeaderOn() throw (uno::RuntimeException, std::exception)
     130             : {
     131           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     132           0 :     return m_xHeader.is();
     133             : }
     134             : 
     135           0 : void SAL_CALL OGroup::setHeaderOn( sal_Bool _headeron ) throw (uno::RuntimeException, std::exception)
     136             : {
     137           0 :     if ( bool(_headeron) != m_xHeader.is() )
     138             :     {
     139           0 :         OUString sName(RPT_RESSTRING(RID_STR_GROUP_HEADER,m_xContext->getServiceManager()));
     140           0 :         setSection(PROPERTY_HEADERON,_headeron,sName,m_xHeader);
     141             :     }
     142           0 : }
     143             : 
     144           0 : sal_Bool SAL_CALL OGroup::getFooterOn() throw (uno::RuntimeException, std::exception)
     145             : {
     146           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     147           0 :     return m_xFooter.is();
     148             : }
     149             : 
     150           0 : void SAL_CALL OGroup::setFooterOn( sal_Bool _footeron ) throw (uno::RuntimeException, std::exception)
     151             : {
     152           0 :     if ( bool(_footeron) != m_xFooter.is() )
     153             :     {
     154           0 :         OUString sName(RPT_RESSTRING(RID_STR_GROUP_FOOTER,m_xContext->getServiceManager()));
     155           0 :         setSection(PROPERTY_FOOTERON,_footeron,sName,m_xFooter);
     156             :     }
     157           0 : }
     158             : 
     159           0 : uno::Reference< report::XSection > SAL_CALL OGroup::getHeader() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
     160             : {
     161           0 :     uno::Reference< report::XSection > xRet;
     162             :     {
     163           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     164           0 :         xRet = m_xHeader;
     165             :     }
     166             : 
     167           0 :     if ( !xRet.is() )
     168           0 :         throw container::NoSuchElementException();
     169           0 :     return xRet;
     170             : }
     171             : 
     172           0 : uno::Reference< report::XSection > SAL_CALL OGroup::getFooter() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
     173             : {
     174           0 :     uno::Reference< report::XSection > xRet;
     175             :     {
     176           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     177           0 :         xRet = m_xFooter;
     178             :     }
     179             : 
     180           0 :     if ( !xRet.is() )
     181           0 :         throw container::NoSuchElementException();
     182           0 :     return xRet;
     183             : }
     184             : 
     185           0 : ::sal_Int16 SAL_CALL OGroup::getGroupOn() throw (uno::RuntimeException, std::exception)
     186             : {
     187           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     188           0 :     return m_aProps.m_nGroupOn;
     189             : }
     190             : 
     191           0 : void SAL_CALL OGroup::setGroupOn( ::sal_Int16 _groupon ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     192             : {
     193           0 :     if ( _groupon < report::GroupOn::DEFAULT || _groupon > report::GroupOn::INTERVAL )
     194             :         throwIllegallArgumentException("com::sun::star::report::GroupOn"
     195             :                         ,*this
     196             :                         ,1
     197           0 :                         ,m_xContext);
     198           0 :     set(PROPERTY_GROUPON,_groupon,m_aProps.m_nGroupOn);
     199           0 : }
     200             : 
     201           0 : ::sal_Int32 SAL_CALL OGroup::getGroupInterval() throw (uno::RuntimeException, std::exception)
     202             : {
     203           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     204           0 :     return m_aProps.m_nGroupInterval;
     205             : }
     206             : 
     207           0 : void SAL_CALL OGroup::setGroupInterval( ::sal_Int32 _groupinterval ) throw (uno::RuntimeException, std::exception)
     208             : {
     209           0 :     set(PROPERTY_GROUPINTERVAL,_groupinterval,m_aProps.m_nGroupInterval);
     210           0 : }
     211             : 
     212           0 : ::sal_Int16 SAL_CALL OGroup::getKeepTogether() throw (uno::RuntimeException, std::exception)
     213             : {
     214           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     215           0 :     return m_aProps.m_nKeepTogether;
     216             : }
     217             : 
     218           0 : void SAL_CALL OGroup::setKeepTogether( ::sal_Int16 _keeptogether ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     219             : {
     220           0 :     if ( _keeptogether < report::KeepTogether::NO || _keeptogether > report::KeepTogether::WITH_FIRST_DETAIL )
     221             :         throwIllegallArgumentException("com::sun::star::report::KeepTogether"
     222             :                         ,*this
     223             :                         ,1
     224           0 :                         ,m_xContext);
     225           0 :     set(PROPERTY_KEEPTOGETHER,_keeptogether,m_aProps.m_nKeepTogether);
     226           0 : }
     227             : 
     228           0 : uno::Reference< report::XGroups > SAL_CALL OGroup::getGroups() throw (uno::RuntimeException, std::exception)
     229             : {
     230           0 :     return m_xParent;
     231             : }
     232             : 
     233           0 : OUString SAL_CALL OGroup::getExpression() throw (uno::RuntimeException, std::exception)
     234             : {
     235           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     236           0 :     return m_aProps.m_sExpression;
     237             : }
     238             : 
     239           0 : void SAL_CALL OGroup::setExpression( const OUString& _expression ) throw (uno::RuntimeException, std::exception)
     240             : {
     241           0 :     set(PROPERTY_EXPRESSION,_expression,m_aProps.m_sExpression);
     242           0 : }
     243             : 
     244           0 : sal_Bool SAL_CALL OGroup::getStartNewColumn() throw (uno::RuntimeException, std::exception)
     245             : {
     246           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     247           0 :     return m_aProps.m_bStartNewColumn;
     248             : }
     249             : 
     250           0 : void SAL_CALL OGroup::setStartNewColumn( sal_Bool _startnewcolumn ) throw (uno::RuntimeException, std::exception)
     251             : {
     252           0 :     set(PROPERTY_STARTNEWCOLUMN,_startnewcolumn,m_aProps.m_bStartNewColumn);
     253           0 : }
     254             : 
     255             : 
     256           0 : sal_Bool SAL_CALL OGroup::getResetPageNumber() throw (uno::RuntimeException, std::exception)
     257             : {
     258           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     259           0 :     return m_aProps.m_bResetPageNumber;
     260             : }
     261             : 
     262           0 : void SAL_CALL OGroup::setResetPageNumber( sal_Bool _resetpagenumber ) throw (uno::RuntimeException, std::exception)
     263             : {
     264           0 :     set(PROPERTY_RESETPAGENUMBER,_resetpagenumber,m_aProps.m_bResetPageNumber);
     265           0 : }
     266             : 
     267             : // XChild
     268           0 : uno::Reference< uno::XInterface > SAL_CALL OGroup::getParent(  ) throw (uno::RuntimeException, std::exception)
     269             : {
     270           0 :     return m_xParent;
     271             : }
     272             : 
     273           0 : void SAL_CALL OGroup::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
     274             : {
     275           0 :     throw lang::NoSupportException();
     276             : }
     277             : 
     278           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     279             : {
     280           0 :     return GroupPropertySet::getPropertySetInfo();
     281             : }
     282             : 
     283           0 : void SAL_CALL OGroup::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     284             : {
     285           0 :     GroupPropertySet::setPropertyValue( aPropertyName, aValue );
     286           0 : }
     287             : 
     288           0 : uno::Any SAL_CALL OGroup::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     289             : {
     290           0 :     return GroupPropertySet::getPropertyValue( PropertyName);
     291             : }
     292             : 
     293           0 : void SAL_CALL OGroup::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     294             : {
     295           0 :     GroupPropertySet::addPropertyChangeListener( aPropertyName, xListener );
     296           0 : }
     297             : 
     298           0 : void SAL_CALL OGroup::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     299             : {
     300           0 :     GroupPropertySet::removePropertyChangeListener( aPropertyName, aListener );
     301           0 : }
     302             : 
     303           0 : void SAL_CALL OGroup::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     304             : {
     305           0 :     GroupPropertySet::addVetoableChangeListener( PropertyName, aListener );
     306           0 : }
     307             : 
     308           0 : void SAL_CALL OGroup::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     309             : {
     310           0 :     GroupPropertySet::removeVetoableChangeListener( PropertyName, aListener );
     311           0 : }
     312             : 
     313           0 : void OGroup::setSection(     const OUString& _sProperty
     314             :                             ,const sal_Bool& _bOn
     315             :                             ,const OUString& _sName
     316             :                             ,uno::Reference< report::XSection>& _member)
     317             : {
     318           0 :     BoundListeners l;
     319             :     {
     320           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     321           0 :         prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l);
     322           0 :         lcl_createSectionIfNeeded(_bOn ,this,_member);
     323           0 :         if ( _member.is() )
     324           0 :             _member->setName(_sName);
     325             :     }
     326           0 :     l.notify();
     327           0 : }
     328             : 
     329           0 : uno::Reference< report::XFunctions > SAL_CALL OGroup::getFunctions() throw (uno::RuntimeException, std::exception)
     330             : {
     331           0 :     return m_xFunctions;
     332             : }
     333             : 
     334             : } // namespace reportdesign
     335             : 
     336             : 
     337             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10