LCOV - code coverage report
Current view: top level - libreoffice/svx/source/form - fmdpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 34 49 69.4 %
Date: 2012-12-27 Functions: 9 11 81.8 %
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             : 
      20             : #include <svx/fmpage.hxx>
      21             : #include "fmobj.hxx"
      22             : #include <svx/fmglob.hxx>
      23             : #include <svx/fmdpage.hxx>
      24             : #include <svx/unoshape.hxx>
      25             : #include <cppuhelper/queryinterface.hxx>
      26             : #include <cppuhelper/typeprovider.hxx>
      27             : 
      28             : using ::com::sun::star::uno::Any;
      29             : using ::com::sun::star::uno::RuntimeException;
      30             : using ::com::sun::star::form::XFormsSupplier2;
      31             : 
      32             : DBG_NAME(SvxFmDrawPage)
      33         381 : SvxFmDrawPage::SvxFmDrawPage( SdrPage* pInPage ) :
      34         381 :     SvxDrawPage( pInPage )
      35             : {
      36             :     DBG_CTOR(SvxFmDrawPage,NULL);
      37         381 : }
      38             : 
      39         243 : SvxFmDrawPage::~SvxFmDrawPage() throw ()
      40             : {
      41             :     DBG_DTOR(SvxFmDrawPage,NULL);
      42         243 : }
      43             : 
      44           0 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SvxFmDrawPage::getImplementationId() throw(::com::sun::star::uno::RuntimeException)
      45             : {
      46             :     static ::cppu::OImplementationId* pId = 0;
      47           0 :     if (! pId)
      48             :     {
      49           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      50           0 :         if (! pId)
      51             :         {
      52           0 :             static ::cppu::OImplementationId aId;
      53           0 :             pId = &aId;
      54           0 :         }
      55             :     }
      56           0 :     return pId->getImplementationId();
      57             : }
      58             : 
      59        5135 : Any SAL_CALL SvxFmDrawPage::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
      60             : {
      61             :     Any aRet = ::cppu::queryInterface   (   _rType
      62             :                                         ,   static_cast< XFormsSupplier2* >( this )
      63             :                                         ,   static_cast< XFormsSupplier* >( this )
      64        5135 :                                         );
      65        5135 :     if ( !aRet.hasValue() )
      66        5064 :         aRet = SvxDrawPage::queryAggregation( _rType );
      67             : 
      68        5135 :     return aRet;
      69             : }
      70             : 
      71             : /***********************************************************************
      72             : *                                                                      *
      73             : ***********************************************************************/
      74           0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SvxFmDrawPage::getTypes(  ) throw(::com::sun::star::uno::RuntimeException)
      75             : {
      76           0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypes(SvxDrawPage::getTypes());
      77           0 :     aTypes.realloc(aTypes.getLength() + 1);
      78           0 :     ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
      79             : 
      80           0 :     pTypes[aTypes.getLength()-1] = ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier>*)0);
      81           0 :     return aTypes;
      82             : }
      83             : 
      84        3493 : SdrObject *SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xDescr ) throw ()
      85             : {
      86        3493 :     ::rtl::OUString aShapeType( xDescr->getShapeType() );
      87             : 
      88        6986 :     if  (   aShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ShapeControl" ) )   // compatibility
      89        3493 :         ||  aShapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ControlShape" ) )
      90             :         )
      91           0 :         return new FmFormObj();
      92             :     else
      93        3493 :         return SvxDrawPage::_CreateSdrObject( xDescr );
      94             : 
      95             : }
      96             : 
      97        3280 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  SvxFmDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
      98             : {
      99        3280 :     if( FmFormInventor == pObj->GetObjInventor() )
     100             :     {
     101           1 :         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  xShape = (SvxShape*)new SvxShapeControl( pObj );
     102           1 :         return xShape;
     103             :     }
     104             :     else
     105        3279 :         return SvxDrawPage::_CreateShape( pObj );
     106             : }
     107             : 
     108             : // XFormsSupplier
     109           2 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL SvxFmDrawPage::getForms(void) throw( ::com::sun::star::uno::RuntimeException )
     110             : {
     111           2 :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >  xForms;
     112             : 
     113           2 :     FmFormPage *pFmPage = PTR_CAST( FmFormPage, GetSdrPage() );
     114           2 :     if( pFmPage )
     115           2 :         xForms = pFmPage->GetForms();
     116             : 
     117           2 :     return xForms;
     118             : }
     119             : 
     120             : // XFormsSupplier2
     121          61 : sal_Bool SAL_CALL SvxFmDrawPage::hasForms(void) throw( ::com::sun::star::uno::RuntimeException )
     122             : {
     123          61 :     sal_Bool bHas = sal_False;
     124          61 :     FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetSdrPage() );
     125          61 :     if ( pFormPage )
     126          61 :         bHas = pFormPage->GetForms( false ).is();
     127          61 :     return bHas;
     128             : }
     129             : 
     130             : // ::com::sun::star::lang::XServiceInfo
     131          15 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmDrawPage::getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
     132             : {
     133          15 :     return SvxDrawPage::getSupportedServiceNames();
     134             : }
     135             : 
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10