LCOV - code coverage report
Current view: top level - reportdesign/source/core/api - Section.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 286 0.3 %
Date: 2015-06-13 12:38:46 Functions: 2 73 2.7 %
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 "Section.hxx"
      20             : #include <comphelper/enumhelper.hxx>
      21             : #include <connectivity/dbtools.hxx>
      22             : #include <cppuhelper/supportsservice.hxx>
      23             : #include <com/sun/star/report/XReportComponent.hpp>
      24             : #include <com/sun/star/report/ForceNewPage.hpp>
      25             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      26             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      27             : #include "corestrings.hrc"
      28             : #include "core_resource.hxx"
      29             : #include "core_resource.hrc"
      30             : #include <tools/debug.hxx>
      31             : #include "Tools.hxx"
      32             : #include "RptModel.hxx"
      33             : #include "RptPage.hxx"
      34             : #include "ReportDefinition.hxx"
      35             : #include "Shape.hxx"
      36             : #include <svx/unoshape.hxx>
      37             : #include <vcl/svapp.hxx>
      38             : #include "RptObject.hxx"
      39             : #include "ReportDrawPage.hxx"
      40             : #include <comphelper/property.hxx>
      41             : 
      42             : namespace reportdesign
      43             : {
      44             : 
      45             :     using namespace com::sun::star;
      46             :     using namespace comphelper;
      47             : 
      48             : 
      49           0 : uno::Sequence< OUString> lcl_getGroupAbsent()
      50             : {
      51             :     OUString pProps[] = {
      52             :                 OUString(PROPERTY_CANGROW)
      53             :                 ,OUString(PROPERTY_CANSHRINK)
      54           0 :         };
      55             : 
      56           0 :     return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
      57             : }
      58             : 
      59             : 
      60           0 : uno::Sequence< OUString> lcl_getAbsent(bool _bPageSection)
      61             : {
      62           0 :     if ( _bPageSection )
      63             :     {
      64             :         OUString pProps[] = {
      65             :                 OUString(PROPERTY_FORCENEWPAGE)
      66             :                 ,OUString(PROPERTY_NEWROWORCOL)
      67             :                 ,OUString(PROPERTY_KEEPTOGETHER)
      68             :                 ,OUString(PROPERTY_CANGROW)
      69             :                 ,OUString(PROPERTY_CANSHRINK)
      70             :                 ,OUString(PROPERTY_REPEATSECTION)
      71           0 :         };
      72           0 :         return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
      73             :     }
      74             : 
      75             :     OUString pProps[] = {
      76             :                 OUString(PROPERTY_CANGROW)
      77             :                 ,OUString(PROPERTY_CANSHRINK)
      78             :                 ,OUString(PROPERTY_REPEATSECTION)
      79           0 :         };
      80             : 
      81           0 :     return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
      82             : }
      83             : 
      84           0 : uno::Reference<report::XSection> OSection::createOSection(
      85             :     const uno::Reference< report::XReportDefinition >& xParentDef,
      86             :     const uno::Reference< uno::XComponentContext >& context,
      87             :     bool const bPageSection)
      88             : {
      89             :     OSection *const pNew =
      90           0 :         new OSection(xParentDef, 0, context, lcl_getAbsent(bPageSection));
      91           0 :     pNew->init();
      92           0 :     return pNew;
      93             : }
      94             : 
      95           0 : uno::Reference<report::XSection> OSection::createOSection(
      96             :     const uno::Reference< report::XGroup >& xParentGroup,
      97             :     const uno::Reference< uno::XComponentContext >& context,
      98             :     bool const)
      99             : {
     100             :     OSection *const pNew =
     101           0 :         new OSection(0, xParentGroup, context, lcl_getGroupAbsent());
     102           0 :     pNew->init();
     103           0 :     return pNew;
     104             : }
     105             : 
     106             : 
     107           0 : OSection::OSection(const uno::Reference< report::XReportDefinition >& xParentDef
     108             :                    ,const uno::Reference< report::XGroup >& xParentGroup
     109             :                    ,const uno::Reference< uno::XComponentContext >& context
     110             :                    ,uno::Sequence< OUString> const& rStrings)
     111             : :SectionBase(m_aMutex)
     112             : ,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,rStrings)
     113             : ,m_aContainerListeners(m_aMutex)
     114             : ,m_xContext(context)
     115             : ,m_xGroup(xParentGroup)
     116             : ,m_xReportDefinition(xParentDef)
     117             : ,m_nHeight(3000)
     118             : ,m_nBackgroundColor(COL_TRANSPARENT)
     119             : ,m_nForceNewPage(report::ForceNewPage::NONE)
     120             : ,m_nNewRowOrCol(report::ForceNewPage::NONE)
     121             : ,m_bKeepTogether(false)
     122             : ,m_bRepeatSection(false)
     123             : ,m_bVisible(true)
     124             : ,m_bBacktransparent(true)
     125             : ,m_bInRemoveNotify(false)
     126           0 : ,m_bInInsertNotify(false)
     127             : {
     128           0 : }
     129             : 
     130             : // TODO: VirtualFunctionFinder: This is virtual function!
     131             : 
     132           0 : OSection::~OSection()
     133             : {
     134           0 : }
     135             : 
     136             : //IMPLEMENT_FORWARD_XINTERFACE2(OSection,SectionBase,SectionPropertySet)
     137           0 : IMPLEMENT_FORWARD_REFCOUNT( OSection, SectionBase )
     138             : 
     139           0 : uno::Any SAL_CALL OSection::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException, std::exception)
     140             : {
     141           0 :     uno::Any aReturn = SectionBase::queryInterface(_rType);
     142           0 :     if ( !aReturn.hasValue() )
     143           0 :         aReturn = SectionPropertySet::queryInterface(_rType);
     144             : 
     145           0 :     if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
     146           0 :         return aReturn;
     147             : 
     148           0 :     return aReturn;
     149             : }
     150             : 
     151             : 
     152           0 : void SAL_CALL OSection::dispose() throw(uno::RuntimeException, std::exception)
     153             : {
     154             :     OSL_ENSURE(!rBHelper.bDisposed,"Already disposed!");
     155           0 :     SectionPropertySet::dispose();
     156             :     uno::Reference<lang::XComponent> const xPageComponent(m_xDrawPage,
     157           0 :             uno::UNO_QUERY);
     158           0 :     if (xPageComponent.is())
     159             :     {
     160           0 :         xPageComponent->dispose();
     161             :     }
     162           0 :     cppu::WeakComponentImplHelperBase::dispose();
     163             : 
     164           0 : }
     165             : 
     166             : // TODO: VirtualFunctionFinder: This is virtual function!
     167             : 
     168           0 : void SAL_CALL OSection::disposing()
     169             : {
     170           0 :     lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
     171           0 :     m_aContainerListeners.disposeAndClear( aDisposeEvent );
     172           0 :     m_xContext.clear();
     173           0 : }
     174             : 
     175           0 : OUString SAL_CALL OSection::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
     176             : {
     177           0 :     return OUString("com.sun.star.comp.report.Section");
     178             : }
     179             : 
     180           0 : uno::Sequence< OUString> OSection::getSupportedServiceNames_Static() throw( uno::RuntimeException )
     181             : {
     182           0 :     uno::Sequence< OUString> aSupported(1);
     183           0 :     aSupported.getArray()[0] = SERVICE_SECTION;
     184           0 :     return aSupported;
     185             : }
     186             : 
     187           0 : uno::Sequence< OUString> SAL_CALL OSection::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
     188             : {
     189           0 :     return getSupportedServiceNames_Static();
     190             : }
     191             : 
     192           0 : sal_Bool SAL_CALL OSection::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
     193             : {
     194           0 :     return cppu::supportsService(this, _rServiceName);
     195             : }
     196             : 
     197           0 : void OSection::init()
     198             : {
     199           0 :     SolarMutexGuard g; // lock while manipulating SdrModel
     200           0 :     uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
     201           0 :     ::boost::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
     202             :     assert(pModel && "No model set at the report definition!");
     203           0 :     if ( pModel )
     204             :     {
     205           0 :         uno::Reference<report::XSection> const xSection(this);
     206           0 :         SdrPage & rSdrPage(*pModel->createNewPage(xSection));
     207           0 :         m_xDrawPage.set(rSdrPage.getUnoPage(), uno::UNO_QUERY_THROW);
     208           0 :         m_xDrawPage_ShapeGrouper.set(m_xDrawPage, uno::UNO_QUERY_THROW);
     209             :         // apparently we may also get OReportDrawPage which doesn't support this
     210           0 :         m_xDrawPage_FormSupplier.set(m_xDrawPage, uno::UNO_QUERY);
     211           0 :         m_xDrawPage_Tunnel.set(m_xDrawPage, uno::UNO_QUERY_THROW);
     212             :         // fdo#53872: now also exchange the XDrawPage in the SdrPage so that
     213             :         // rSdrPage.getUnoPage returns this
     214           0 :         rSdrPage.SetUnoPage(this);
     215             :         // createNewPage _should_ have stored away 2 uno::References to this,
     216             :         // so our ref count cannot be 1 here, so this isn't destroyed here
     217           0 :         assert(m_refCount > 1);
     218           0 :     }
     219           0 : }
     220             : 
     221             : // XSection
     222             : 
     223           0 : sal_Bool SAL_CALL OSection::getVisible() throw (uno::RuntimeException, std::exception)
     224             : {
     225           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     226           0 :     return m_bVisible;
     227             : }
     228             : 
     229           0 : void SAL_CALL OSection::setVisible( sal_Bool _visible ) throw (uno::RuntimeException, std::exception)
     230             : {
     231           0 :     set(PROPERTY_VISIBLE,_visible,m_bVisible);
     232           0 : }
     233             : 
     234           0 : OUString SAL_CALL OSection::getName() throw (uno::RuntimeException, std::exception)
     235             : {
     236           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     237           0 :     return m_sName;
     238             : }
     239             : 
     240           0 : void SAL_CALL OSection::setName( const OUString& _name ) throw (uno::RuntimeException, std::exception)
     241             : {
     242           0 :     set(PROPERTY_NAME,_name,m_sName);
     243           0 : }
     244             : 
     245           0 : ::sal_uInt32 SAL_CALL OSection::getHeight() throw (uno::RuntimeException, std::exception)
     246             : {
     247           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     248           0 :     return m_nHeight;
     249             : }
     250             : 
     251           0 : void SAL_CALL OSection::setHeight( ::sal_uInt32 _height ) throw (uno::RuntimeException, std::exception)
     252             : {
     253           0 :     set(PROPERTY_HEIGHT,_height,m_nHeight);
     254           0 : }
     255             : 
     256           0 : ::sal_Int32 SAL_CALL OSection::getBackColor() throw (uno::RuntimeException, std::exception)
     257             : {
     258           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     259           0 :     return m_bBacktransparent ? COL_TRANSPARENT : m_nBackgroundColor;
     260             : }
     261             : 
     262           0 : void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException, std::exception)
     263             : {
     264           0 :     bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT);
     265           0 :     setBackTransparent(bTransparent);
     266           0 :     if ( !bTransparent )
     267           0 :         set(PROPERTY_BACKCOLOR,_backgroundcolor,m_nBackgroundColor);
     268           0 : }
     269             : 
     270           0 : sal_Bool SAL_CALL OSection::getBackTransparent() throw (uno::RuntimeException, std::exception)
     271             : {
     272           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     273           0 :     return m_bBacktransparent;
     274             : }
     275             : 
     276           0 : void SAL_CALL OSection::setBackTransparent( sal_Bool _backtransparent ) throw (uno::RuntimeException, std::exception)
     277             : {
     278           0 :     set(PROPERTY_BACKTRANSPARENT,_backtransparent,m_bBacktransparent);
     279           0 :     if ( _backtransparent )
     280           0 :         set(PROPERTY_BACKCOLOR,static_cast<sal_Int32>(COL_TRANSPARENT),m_nBackgroundColor);
     281           0 : }
     282             : 
     283           0 : OUString SAL_CALL OSection::getConditionalPrintExpression() throw (uno::RuntimeException, std::exception)
     284             : {
     285           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     286           0 :     return m_sConditionalPrintExpression;
     287             : }
     288             : 
     289           0 : void SAL_CALL OSection::setConditionalPrintExpression( const OUString& _conditionalprintexpression ) throw (uno::RuntimeException, std::exception)
     290             : {
     291           0 :     set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_sConditionalPrintExpression);
     292           0 : }
     293             : 
     294           0 : void OSection::checkNotPageHeaderFooter()
     295             : {
     296           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     297           0 :     uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
     298           0 :     if ( xRet.is() )
     299             :     {
     300           0 :         if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *this )
     301           0 :             throw beans::UnknownPropertyException();
     302           0 :         if ( xRet->getPageFooterOn() && xRet->getPageFooter() == *this )
     303           0 :             throw beans::UnknownPropertyException();
     304           0 :     }
     305           0 : }
     306             : 
     307           0 : ::sal_Int16 SAL_CALL OSection::getForceNewPage() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     308             : {
     309           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     310             : 
     311           0 :     checkNotPageHeaderFooter();
     312           0 :     return m_nForceNewPage;
     313             : }
     314             : 
     315           0 : void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     316             : {
     317           0 :     if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION )
     318             :         throwIllegallArgumentException("com::sun::star::report::ForceNewPage"
     319             :                         ,*this
     320             :                         ,1
     321           0 :                         ,m_xContext);
     322           0 :     checkNotPageHeaderFooter();
     323           0 :     set(PROPERTY_FORCENEWPAGE,_forcenewpage,m_nForceNewPage);
     324           0 : }
     325             : 
     326           0 : ::sal_Int16 SAL_CALL OSection::getNewRowOrCol() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     327             : {
     328           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     329           0 :     checkNotPageHeaderFooter();
     330           0 :     return m_nNewRowOrCol;
     331             : }
     332             : 
     333           0 : void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     334             : {
     335           0 :     if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION )
     336             :         throwIllegallArgumentException("com::sun::star::report::ForceNewPage"
     337             :                         ,*this
     338             :                         ,1
     339           0 :                         ,m_xContext);
     340           0 :     checkNotPageHeaderFooter();
     341             : 
     342           0 :     set(PROPERTY_NEWROWORCOL,_newroworcol,m_nNewRowOrCol);
     343           0 : }
     344             : 
     345           0 : sal_Bool SAL_CALL OSection::getKeepTogether() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     346             : {
     347           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     348           0 :     checkNotPageHeaderFooter();
     349           0 :     return m_bKeepTogether;
     350             : }
     351             : 
     352           0 : void SAL_CALL OSection::setKeepTogether( sal_Bool _keeptogether ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     353             : {
     354             :     {
     355           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     356           0 :         checkNotPageHeaderFooter();
     357             :     }
     358             : 
     359           0 :     set(PROPERTY_KEEPTOGETHER,_keeptogether,m_bKeepTogether);
     360           0 : }
     361             : 
     362           0 : sal_Bool SAL_CALL OSection::getCanGrow() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     363             : {
     364           0 :     throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
     365             : }
     366             : 
     367           0 : void SAL_CALL OSection::setCanGrow( sal_Bool /*_cangrow*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     368             : {
     369           0 :     throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
     370             : }
     371             : 
     372           0 : sal_Bool SAL_CALL OSection::getCanShrink() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     373             : {
     374           0 :     throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
     375             : }
     376             : 
     377           0 : void SAL_CALL OSection::setCanShrink( sal_Bool /*_canshrink*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     378             : {
     379           0 :     throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
     380             : }
     381             : 
     382           0 : sal_Bool SAL_CALL OSection::getRepeatSection() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     383             : {
     384           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     385           0 :     uno::Reference< report::XGroup > xGroup = m_xGroup;
     386           0 :     if ( !xGroup.is() )
     387           0 :         throw beans::UnknownPropertyException();
     388           0 :     return m_bRepeatSection;
     389             : }
     390             : 
     391           0 : void SAL_CALL OSection::setRepeatSection( sal_Bool _repeatsection ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     392             : {
     393             :     {
     394           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     395           0 :         uno::Reference< report::XGroup > xGroup = m_xGroup;
     396           0 :         if ( !xGroup.is() )
     397           0 :             throw beans::UnknownPropertyException();
     398             :     }
     399           0 :     set(PROPERTY_REPEATSECTION,_repeatsection,m_bRepeatSection);
     400           0 : }
     401             : 
     402           0 : uno::Reference< report::XGroup > SAL_CALL OSection::getGroup() throw (uno::RuntimeException, std::exception)
     403             : {
     404           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     405           0 :     return m_xGroup;
     406             : }
     407             : 
     408           0 : uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition() throw (uno::RuntimeException, std::exception)
     409             : {
     410           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     411           0 :     uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
     412           0 :     uno::Reference< report::XGroup > xGroup = m_xGroup;
     413           0 :     if ( !xRet.is() && xGroup.is() )
     414             :     {
     415           0 :         uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
     416           0 :         if ( xGroups.is() )
     417           0 :             xRet = xGroups->getReportDefinition();
     418             :     }
     419             : 
     420           0 :     return xRet;
     421             : }
     422             : 
     423             : // XChild
     424           0 : uno::Reference< uno::XInterface > SAL_CALL OSection::getParent(  ) throw (uno::RuntimeException, std::exception)
     425             : {
     426           0 :     uno::Reference< uno::XInterface > xRet;
     427             :     {
     428           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     429           0 :         xRet = m_xReportDefinition;
     430           0 :         if ( !xRet.is() )
     431           0 :             xRet = m_xGroup;
     432             :     }
     433           0 :     return  xRet;
     434             : }
     435             : 
     436           0 : void SAL_CALL OSection::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
     437             : {
     438           0 :     throw lang::NoSupportException();
     439             : }
     440             : 
     441             : // XContainer
     442           0 : void SAL_CALL OSection::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
     443             : {
     444           0 :     m_aContainerListeners.addInterface(xListener);
     445           0 : }
     446             : 
     447           0 : void SAL_CALL OSection::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
     448             : {
     449           0 :     m_aContainerListeners.removeInterface(xListener);
     450           0 : }
     451             : 
     452             : // XElementAccess
     453           0 : uno::Type SAL_CALL OSection::getElementType(  ) throw (uno::RuntimeException, std::exception)
     454             : {
     455           0 :     return cppu::UnoType<report::XReportComponent>::get();
     456             : }
     457             : 
     458           0 : sal_Bool SAL_CALL OSection::hasElements(  ) throw (uno::RuntimeException, std::exception)
     459             : {
     460           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     461           0 :     return m_xDrawPage.is() ? m_xDrawPage->hasElements() : sal_False;
     462             : }
     463             : 
     464             : // XIndexAccess
     465           0 : ::sal_Int32 SAL_CALL OSection::getCount(  ) throw (uno::RuntimeException, std::exception)
     466             : {
     467           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     468           0 :     return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0;
     469             : }
     470             : 
     471           0 : uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     472             : {
     473           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     474           0 :     return m_xDrawPage.is() ? m_xDrawPage->getByIndex(Index) : uno::Any();
     475             : }
     476             : 
     477             : // XEnumerationAccess
     478           0 : uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration(  ) throw (uno::RuntimeException, std::exception)
     479             : {
     480           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     481           0 :     return new ::comphelper::OEnumerationByIndex(static_cast<XSection*>(this));
     482             : }
     483             : 
     484           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     485             : {
     486           0 :     return SectionPropertySet::getPropertySetInfo();
     487             : }
     488             : 
     489           0 : void SAL_CALL OSection::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     490             : {
     491           0 :     SectionPropertySet::setPropertyValue( aPropertyName, aValue );
     492           0 : }
     493             : 
     494           0 : uno::Any SAL_CALL OSection::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     495             : {
     496           0 :     return SectionPropertySet::getPropertyValue( PropertyName);
     497             : }
     498             : 
     499           0 : void SAL_CALL OSection::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     500             : {
     501           0 :     SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
     502           0 : }
     503             : 
     504           0 : void SAL_CALL OSection::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     505             : {
     506           0 :     SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
     507           0 : }
     508             : 
     509           0 : void SAL_CALL OSection::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     510             : {
     511           0 :     SectionPropertySet::addVetoableChangeListener( PropertyName, aListener );
     512           0 : }
     513             : 
     514           0 : void SAL_CALL OSection::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     515             : {
     516           0 :     SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
     517           0 : }
     518             : 
     519           0 : void SAL_CALL OSection::add( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException, std::exception)
     520             : {
     521             :     {
     522           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     523           0 :         m_bInInsertNotify = true;
     524             :         OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
     525           0 :         m_xDrawPage->add(xShape);
     526           0 :         m_bInInsertNotify = false;
     527             :     }
     528           0 :     notifyElementAdded(xShape);
     529           0 : }
     530             : 
     531           0 : void SAL_CALL OSection::remove( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException, std::exception)
     532             : {
     533             :     {
     534           0 :         ::osl::MutexGuard aGuard(m_aMutex);
     535           0 :         m_bInRemoveNotify = true;
     536             :         OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
     537           0 :         m_xDrawPage->remove(xShape);
     538           0 :         m_bInRemoveNotify = false;
     539             :     }
     540           0 :     notifyElementRemoved(xShape);
     541           0 : }
     542             : 
     543             : // XShapeGrouper
     544             : uno::Reference< drawing::XShapeGroup > SAL_CALL
     545           0 : OSection::group(uno::Reference< drawing::XShapes > const& xShapes)
     546             :     throw (uno::RuntimeException, std::exception)
     547             : {
     548             :     // no lock because m_xDrawPage_ShapeGrouper is const
     549           0 :     return (m_xDrawPage_ShapeGrouper.is())
     550           0 :         ? m_xDrawPage_ShapeGrouper->group(xShapes)
     551           0 :         : 0;
     552             : }
     553             : void SAL_CALL
     554           0 : OSection::ungroup(uno::Reference<drawing::XShapeGroup> const& xGroup)
     555             :     throw (uno::RuntimeException, std::exception)
     556             : {
     557             :     // no lock because m_xDrawPage_ShapeGrouper is const
     558           0 :     if (m_xDrawPage_ShapeGrouper.is()) {
     559           0 :         m_xDrawPage_ShapeGrouper->ungroup(xGroup);
     560             :     }
     561           0 : }
     562             : 
     563             : // XFormsSupplier
     564           0 : uno::Reference<container::XNameContainer> SAL_CALL OSection::getForms()
     565             :     throw (uno::RuntimeException, std::exception)
     566             : {
     567             :     // no lock because m_xDrawPage_FormSupplier is const
     568           0 :     return (m_xDrawPage_FormSupplier.is())
     569           0 :         ? m_xDrawPage_FormSupplier->getForms()
     570           0 :         : 0;
     571             : }
     572             : // XFormsSupplier2
     573           0 : sal_Bool SAL_CALL OSection::hasForms() throw (uno::RuntimeException, std::exception)
     574             : {
     575             :     // no lock because m_xDrawPage_FormSupplier is const
     576           0 :     return (m_xDrawPage_FormSupplier.is())
     577           0 :         && m_xDrawPage_FormSupplier->hasForms();
     578             : }
     579             : 
     580             : 
     581             : // com::sun::star::lang::XUnoTunnel
     582             : 
     583           0 : sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw (uno::RuntimeException, std::exception)
     584             : {
     585           0 :     if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
     586           0 :         return reinterpret_cast<sal_Int64>(this);
     587           0 :     return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0;
     588             : }
     589             : 
     590             : 
     591           0 : OSection* OSection::getImplementation( const uno::Reference< uno::XInterface >& _rxComponent )
     592             : {
     593           0 :     OSection* pContent( NULL );
     594             : 
     595           0 :     uno::Reference< lang::XUnoTunnel > xUnoTunnel( _rxComponent, uno::UNO_QUERY );
     596           0 :     if ( xUnoTunnel.is() )
     597           0 :         pContent = reinterpret_cast< OSection* >( xUnoTunnel->getSomething( getUnoTunnelImplementationId() ) );
     598             : 
     599           0 :     return pContent;
     600             : }
     601             : 
     602           0 : uno::Sequence< sal_Int8 > OSection::getUnoTunnelImplementationId()
     603             : {
     604             :     static ::cppu::OImplementationId * pId = 0;
     605           0 :     if (! pId)
     606             :     {
     607           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     608           0 :         if (! pId)
     609             :         {
     610           0 :             static ::cppu::OImplementationId aId;
     611           0 :             pId = &aId;
     612           0 :         }
     613             :     }
     614           0 :     return pId->getImplementationId();
     615             : }
     616             : 
     617           0 : void OSection::notifyElementAdded(const uno::Reference< drawing::XShape >& xShape )
     618             : {
     619           0 :     if ( !m_bInInsertNotify )
     620             :     {
     621           0 :         container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
     622           0 :         m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
     623             :     }
     624           0 : }
     625             : 
     626           0 : void OSection::notifyElementRemoved(const uno::Reference< drawing::XShape >& xShape)
     627             : {
     628           0 :     if ( !m_bInRemoveNotify )
     629             :     {
     630             :         // notify our container listeners
     631           0 :         container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
     632           0 :         m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
     633             :     }
     634           0 : }
     635             : 
     636           3 : } // namespace reportdesign
     637             : 
     638             : 
     639             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11