LCOV - code coverage report
Current view: top level - svx/source/form - fmdpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 34 49 69.4 %
Date: 2012-08-25 Functions: 9 11 81.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 24 68 35.3 %

           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                 :            : 
      29                 :            : #include <svx/fmpage.hxx>
      30                 :            : #include "fmobj.hxx"
      31                 :            : #include <svx/fmglob.hxx>
      32                 :            : #include <svx/fmdpage.hxx>
      33                 :            : #include <svx/unoshape.hxx>
      34                 :            : #include <cppuhelper/queryinterface.hxx>
      35                 :            : #include <cppuhelper/typeprovider.hxx>
      36                 :            : 
      37                 :            : using ::com::sun::star::uno::Any;
      38                 :            : using ::com::sun::star::uno::RuntimeException;
      39                 :            : using ::com::sun::star::form::XFormsSupplier2;
      40                 :            : 
      41                 :            : DBG_NAME(SvxFmDrawPage)
      42                 :       2274 : SvxFmDrawPage::SvxFmDrawPage( SdrPage* pInPage ) :
      43                 :       2274 :     SvxDrawPage( pInPage )
      44                 :            : {
      45                 :            :     DBG_CTOR(SvxFmDrawPage,NULL);
      46                 :       2274 : }
      47                 :            : 
      48                 :       2172 : SvxFmDrawPage::~SvxFmDrawPage() throw ()
      49                 :            : {
      50                 :            :     DBG_DTOR(SvxFmDrawPage,NULL);
      51         [ -  + ]:       2231 : }
      52                 :            : 
      53                 :          0 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SvxFmDrawPage::getImplementationId() throw(::com::sun::star::uno::RuntimeException)
      54                 :            : {
      55                 :            :     static ::cppu::OImplementationId* pId = 0;
      56         [ #  # ]:          0 :     if (! pId)
      57                 :            :     {
      58 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      59         [ #  # ]:          0 :         if (! pId)
      60                 :            :         {
      61 [ #  # ][ #  # ]:          0 :             static ::cppu::OImplementationId aId;
      62                 :          0 :             pId = &aId;
      63         [ #  # ]:          0 :         }
      64                 :            :     }
      65                 :          0 :     return pId->getImplementationId();
      66                 :            : }
      67                 :            : 
      68                 :      94680 : Any SAL_CALL SvxFmDrawPage::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
      69                 :            : {
      70                 :            :     Any aRet = ::cppu::queryInterface   (   _rType
      71                 :            :                                         ,   static_cast< XFormsSupplier2* >( this )
      72                 :            :                                         ,   static_cast< XFormsSupplier* >( this )
      73                 :      94680 :                                         );
      74         [ +  + ]:      94680 :     if ( !aRet.hasValue() )
      75         [ +  - ]:      94059 :         aRet = SvxDrawPage::queryAggregation( _rType );
      76                 :            : 
      77                 :      94680 :     return aRet;
      78                 :            : }
      79                 :            : 
      80                 :            : /***********************************************************************
      81                 :            : *                                                                      *
      82                 :            : ***********************************************************************/
      83                 :          0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SvxFmDrawPage::getTypes(  ) throw(::com::sun::star::uno::RuntimeException)
      84                 :            : {
      85                 :          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypes(SvxDrawPage::getTypes());
      86         [ #  # ]:          0 :     aTypes.realloc(aTypes.getLength() + 1);
      87         [ #  # ]:          0 :     ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
      88                 :            : 
      89         [ #  # ]:          0 :     pTypes[aTypes.getLength()-1] = ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier>*)0);
      90                 :          0 :     return aTypes;
      91                 :            : }
      92                 :            : 
      93                 :      89098 : SdrObject *SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xDescr ) throw ()
      94                 :            : {
      95 [ +  - ][ +  - ]:      89098 :     ::rtl::OUString aShapeType( xDescr->getShapeType() );
      96                 :            : 
      97   [ +  -  -  + ]:     178196 :     if  (   aShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ShapeControl" ) )   // compatibility
                 [ -  + ]
      98                 :      89098 :         ||  aShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ControlShape" ) )
      99                 :            :         )
     100 [ #  # ][ #  # ]:          0 :         return new FmFormObj();
     101                 :            :     else
     102                 :      89098 :         return SvxDrawPage::_CreateSdrObject( xDescr );
     103                 :            : 
     104                 :            : }
     105                 :            : 
     106                 :      63385 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  SvxFmDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
     107                 :            : {
     108         [ +  + ]:      63385 :     if( FmFormInventor == pObj->GetObjInventor() )
     109                 :            :     {
     110 [ +  - ][ +  - ]:          8 :         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  xShape = (SvxShape*)new SvxShapeControl( pObj );
                 [ +  - ]
     111                 :          8 :         return xShape;
     112                 :            :     }
     113                 :            :     else
     114                 :      63385 :         return SvxDrawPage::_CreateShape( pObj );
     115                 :            : }
     116                 :            : 
     117                 :            : // XFormsSupplier
     118                 :        355 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL SvxFmDrawPage::getForms(void) throw( ::com::sun::star::uno::RuntimeException )
     119                 :            : {
     120                 :        355 :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >  xForms;
     121                 :            : 
     122 [ +  - ][ +  - ]:        355 :     FmFormPage *pFmPage = PTR_CAST( FmFormPage, GetSdrPage() );
         [ +  - ][ +  - ]
     123         [ +  - ]:        355 :     if( pFmPage )
     124 [ +  - ][ +  - ]:        355 :         xForms = pFmPage->GetForms();
     125                 :            : 
     126                 :        355 :     return xForms;
     127                 :            : }
     128                 :            : 
     129                 :            : // XFormsSupplier2
     130                 :        386 : sal_Bool SAL_CALL SvxFmDrawPage::hasForms(void) throw( ::com::sun::star::uno::RuntimeException )
     131                 :            : {
     132                 :        386 :     sal_Bool bHas = sal_False;
     133 [ +  - ][ +  - ]:        386 :     FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetSdrPage() );
     134         [ +  - ]:        386 :     if ( pFormPage )
     135                 :        386 :         bHas = pFormPage->GetForms( false ).is();
     136                 :        386 :     return bHas;
     137                 :            : }
     138                 :            : 
     139                 :            : // ::com::sun::star::lang::XServiceInfo
     140                 :        101 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmDrawPage::getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
     141                 :            : {
     142                 :        101 :     return SvxDrawPage::getSupportedServiceNames();
     143                 :            : }
     144                 :            : 
     145                 :            : 
     146                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10