LCOV - code coverage report
Current view: top level - reportdesign/source/core/api - ReportControlModel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 134 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #include "ReportControlModel.hxx"
      29                 :            : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      30                 :            : #include <com/sun/star/beans/XPropertyState.hpp>
      31                 :            : namespace reportdesign
      32                 :            : {
      33                 :            : using namespace com::sun::star;
      34                 :            : using namespace comphelper;
      35                 :            : 
      36                 :          0 : bool operator==( const ::com::sun::star::awt::FontDescriptor& _lhs, const ::com::sun::star::awt::FontDescriptor& _rhs )
      37                 :            : {
      38                 :          0 :     return  ( _lhs.Name           == _rhs.Name )
      39                 :            :         &&  ( _lhs.Height         == _rhs.Height )
      40                 :            :         &&  ( _lhs.Width          == _rhs.Width )
      41                 :          0 :         &&  ( _lhs.StyleName      == _rhs.StyleName )
      42                 :            :         &&  ( _lhs.Family         == _rhs.Family )
      43                 :            :         &&  ( _lhs.CharSet        == _rhs.CharSet )
      44                 :            :         &&  ( _lhs.Pitch          == _rhs.Pitch )
      45                 :            :         &&  ( _lhs.CharacterWidth == _rhs.CharacterWidth )
      46                 :            :         &&  ( _lhs.Weight         == _rhs.Weight )
      47                 :            :         &&  ( _lhs.Slant          == _rhs.Slant )
      48                 :            :         &&  ( _lhs.Underline      == _rhs.Underline )
      49                 :            :         &&  ( _lhs.Strikeout      == _rhs.Strikeout )
      50                 :            :         &&  ( _lhs.Orientation    == _rhs.Orientation )
      51                 :            :         &&  ( _lhs.Kerning        == _rhs.Kerning )
      52                 :            :         &&  ( _lhs.WordLineMode   == _rhs.WordLineMode )
      53         [ #  # ]:          0 :         &&  ( _lhs.Type           == _rhs.Type );
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      54                 :            : }
      55                 :            : 
      56                 :            : // -----------------------------------------------------------------------------
      57                 :            : // XContainer
      58                 :          0 : void OReportControlModel::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException)
      59                 :            : {
      60                 :          0 :     aContainerListeners.addInterface(xListener);
      61                 :          0 : }
      62                 :            : // -----------------------------------------------------------------------------
      63                 :          0 : void OReportControlModel::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException)
      64                 :            : {
      65                 :          0 :     aContainerListeners.removeInterface(xListener);
      66                 :          0 : }
      67                 :            : // -----------------------------------------------------------------------------
      68                 :          0 : ::sal_Bool OReportControlModel::hasElements(  ) throw (uno::RuntimeException)
      69                 :            : {
      70         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_rMutex);
      71         [ #  # ]:          0 :     return !m_aFormatConditions.empty();
      72                 :            : }
      73                 :            : // -----------------------------------------------------------------------------
      74                 :            : // XIndexContainer
      75                 :          0 : void OReportControlModel::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
      76                 :            : {
      77         [ #  # ]:          0 :     uno::Reference<report::XFormatCondition> xElement(Element,uno::UNO_QUERY);
      78         [ #  # ]:          0 :     if ( !xElement.is() )
      79         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
      80                 :            : 
      81                 :          0 :     uno::Reference< container::XContainer > xBroadcaster;
      82                 :            :     {
      83         [ #  # ]:          0 :         ::osl::MutexGuard aGuard(m_rMutex);
      84         [ #  # ]:          0 :         xBroadcaster = m_pOwner;
      85         [ #  # ]:          0 :         if ( Index > static_cast<sal_Int32>(m_aFormatConditions.size()) )
      86         [ #  # ]:          0 :             throw lang::IndexOutOfBoundsException();
      87                 :            : 
      88 [ #  # ][ #  # ]:          0 :         m_aFormatConditions.insert(m_aFormatConditions.begin() + Index,xElement);
                 [ #  # ]
      89                 :            :     }
      90                 :            : 
      91                 :            :     // notify our container listeners
      92 [ #  # ][ #  # ]:          0 :     container::ContainerEvent aEvent(xBroadcaster, uno::makeAny(Index), Element, uno::Any());
      93 [ #  # ][ #  # ]:          0 :     aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
      94                 :          0 : }
      95                 :            : // -----------------------------------------------------------------------------
      96                 :          0 : void OReportControlModel::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
      97                 :            : {
      98                 :          0 :     uno::Any Element;
      99                 :          0 :     uno::Reference< container::XContainer > xBroadcaster;
     100                 :            :     {
     101         [ #  # ]:          0 :         ::osl::MutexGuard aGuard(m_rMutex);
     102         [ #  # ]:          0 :         xBroadcaster = m_pOwner;
     103         [ #  # ]:          0 :         checkIndex(Index);
     104         [ #  # ]:          0 :         Element <<= m_aFormatConditions[Index];
     105 [ #  # ][ #  # ]:          0 :         m_aFormatConditions.erase(m_aFormatConditions.begin() + Index);
                 [ #  # ]
     106                 :            :     }
     107 [ #  # ][ #  # ]:          0 :     container::ContainerEvent aEvent(xBroadcaster, uno::makeAny(Index), Element, uno::Any());
     108 [ #  # ][ #  # ]:          0 :     aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
     109                 :          0 : }
     110                 :            : // -----------------------------------------------------------------------------
     111                 :            : // XIndexReplace
     112                 :          0 : void OReportControlModel::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
     113                 :            : {
     114         [ #  # ]:          0 :     uno::Reference<report::XFormatCondition> xElement(Element,uno::UNO_QUERY);
     115         [ #  # ]:          0 :     if ( !xElement.is() )
     116         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     117                 :          0 :     uno::Reference< container::XContainer > xBroadcaster;
     118                 :            :     {
     119         [ #  # ]:          0 :         ::osl::MutexGuard aGuard(m_rMutex);
     120         [ #  # ]:          0 :         xBroadcaster = m_pOwner;
     121         [ #  # ]:          0 :         checkIndex(Index);
     122 [ #  # ][ #  # ]:          0 :         m_aFormatConditions[Index] = xElement;
     123                 :            :     }
     124 [ #  # ][ #  # ]:          0 :     container::ContainerEvent aEvent(xBroadcaster, uno::makeAny(Index), Element, uno::Any());
     125 [ #  # ][ #  # ]:          0 :     aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,aEvent);
     126                 :          0 : }
     127                 :            : // -----------------------------------------------------------------------------
     128                 :            : // XIndexAccess
     129                 :          0 : ::sal_Int32 OReportControlModel::getCount(  ) throw (uno::RuntimeException)
     130                 :            : {
     131         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_rMutex);
     132         [ #  # ]:          0 :     return m_aFormatConditions.size();
     133                 :            : }
     134                 :            : // -----------------------------------------------------------------------------
     135                 :          0 : uno::Any OReportControlModel::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
     136                 :            : {
     137                 :          0 :     uno::Any aElement;
     138                 :            :     {
     139         [ #  # ]:          0 :         ::osl::MutexGuard aGuard(m_rMutex);
     140         [ #  # ]:          0 :         checkIndex(Index);
     141 [ #  # ][ #  # ]:          0 :         aElement <<= m_aFormatConditions[Index];
     142                 :            :     }
     143                 :          0 :     return aElement;
     144                 :            : }
     145                 :            : // -----------------------------------------------------------------------------
     146                 :          0 : void OReportControlModel::checkIndex(sal_Int32 _nIndex)
     147                 :            : {
     148 [ #  # ][ #  # ]:          0 :     if ( _nIndex < 0 || static_cast<sal_Int32>(m_aFormatConditions.size()) <= _nIndex )
                 [ #  # ]
     149         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     150                 :          0 : }
     151                 :            : // -----------------------------------------------------------------------------
     152                 :          0 : bool OReportControlModel::isInterfaceForbidden(const uno::Type& _rType)
     153                 :            : {
     154 [ #  # ][ #  # ]:          0 :     return (_rType == ::getCppuType((const uno::Reference< beans::XPropertyState>* )0) || _rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet>* )0));
     155                 :            : }
     156                 :            : // -----------------------------------------------------------------------------
     157                 :            : } // reportdesign
     158                 :            : 
     159                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10