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

Generated by: LCOV version 1.11