LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/vba - vbaoleobject.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 51 0.0 %
Date: 2012-12-27 Functions: 0 16 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             : 
      20             : #include <com/sun/star/awt/XControlModel.hpp>
      21             : #include <com/sun/star/awt/XWindow2.hpp>
      22             : #include <com/sun/star/view/XControlAccess.hpp>
      23             : #include <com/sun/star/container/XChild.hpp>
      24             : #include <com/sun/star/drawing/XShape.hpp>
      25             : #include <ooo/vba/XControlProvider.hpp>
      26             : 
      27             : #include "vbaoleobject.hxx"
      28             : 
      29             : using namespace com::sun::star;
      30             : using namespace ooo::vba;
      31             : 
      32           0 : ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
      33             :             css::uno::Reference< css::drawing::XControlShape > xControlShape )
      34           0 : : OLEObjectImpl_BASE( xParent, xContext ), m_xControlShape( xControlShape )
      35             : {
      36             :     //init m_xWindowPeer
      37           0 :     uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), css::uno::UNO_QUERY_THROW );
      38           0 :     uno::Reference< container::XChild > xChild( xControlModel, uno::UNO_QUERY_THROW );
      39           0 :     xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
      40           0 :     xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
      41           0 :     css::uno::Reference< css::frame::XModel > xModel( xChild->getParent(), uno::UNO_QUERY_THROW );
      42           0 :     uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
      43           0 :     uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW );
      44           0 :     m_xControl.set( xControlProvider->createControl(  xControlShape, xModel ) );
      45           0 : }
      46             : 
      47             : uno::Reference< uno::XInterface > SAL_CALL
      48           0 : ScVbaOLEObject::getObject() throw (uno::RuntimeException)
      49             : {
      50           0 :     return uno::Reference< uno::XInterface >( m_xControlShape, uno::UNO_QUERY_THROW );
      51             : }
      52             : 
      53             : sal_Bool SAL_CALL
      54           0 : ScVbaOLEObject::getEnabled() throw (uno::RuntimeException)
      55             : {
      56           0 :     return m_xControl->getEnabled();
      57             : }
      58             : 
      59             : void SAL_CALL
      60           0 : ScVbaOLEObject::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
      61             : {
      62           0 :     m_xControl->setEnabled( _enabled );
      63           0 : }
      64             : 
      65             : sal_Bool SAL_CALL
      66           0 : ScVbaOLEObject::getVisible() throw (uno::RuntimeException)
      67             : {
      68             :     OSL_TRACE("OleObject %s returning visible %s", rtl::OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), m_xControl->getVisible() ? "true" : "false" );
      69           0 :     return m_xControl->getVisible();
      70             : }
      71             : 
      72             : void SAL_CALL
      73           0 : ScVbaOLEObject::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
      74             : {
      75             :     OSL_TRACE("OleObject %s set visible %s", rtl::OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), _visible ? "true" : "false" );
      76           0 :     m_xControl->setVisible( _visible );
      77           0 : }
      78             : 
      79             : double SAL_CALL
      80           0 : ScVbaOLEObject::getLeft() throw (uno::RuntimeException)
      81             : {
      82           0 :     return m_xControl->getLeft();
      83             : }
      84             : 
      85             : void SAL_CALL
      86           0 : ScVbaOLEObject::setLeft( double _left ) throw (uno::RuntimeException)
      87             : {
      88           0 :     m_xControl->setLeft( _left );
      89             : 
      90           0 : }
      91             : 
      92             : double SAL_CALL
      93           0 : ScVbaOLEObject::getTop() throw (uno::RuntimeException)
      94             : {
      95           0 :     return m_xControl->getTop();
      96             : }
      97             : 
      98             : void SAL_CALL
      99           0 : ScVbaOLEObject::setTop( double _top ) throw (uno::RuntimeException)
     100             : {
     101           0 :     m_xControl->setTop( _top );
     102           0 : }
     103             : 
     104             : double SAL_CALL
     105           0 : ScVbaOLEObject::getHeight() throw (uno::RuntimeException)
     106             : {
     107           0 :     return m_xControl->getHeight();
     108             : }
     109             : 
     110             : void SAL_CALL
     111           0 : ScVbaOLEObject::setHeight( double _height ) throw (uno::RuntimeException)
     112             : {
     113           0 :     m_xControl->setHeight( _height );
     114           0 : }
     115             : 
     116             : double SAL_CALL
     117           0 : ScVbaOLEObject::getWidth() throw (uno::RuntimeException)
     118             : {
     119           0 :     return m_xControl->getWidth();
     120             : }
     121             : 
     122             : void SAL_CALL
     123           0 : ScVbaOLEObject::setWidth( double _width ) throw (uno::RuntimeException)
     124             : {
     125           0 :     m_xControl->setWidth( _width );
     126           0 : }
     127             : 
     128             : rtl::OUString
     129           0 : ScVbaOLEObject::getServiceImplName()
     130             : {
     131           0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaOLEObject"));
     132             : }
     133             : 
     134             : uno::Sequence< rtl::OUString >
     135           0 : ScVbaOLEObject::getServiceNames()
     136             : {
     137           0 :     static uno::Sequence< rtl::OUString > aServiceNames;
     138           0 :     if ( aServiceNames.getLength() == 0 )
     139             :     {
     140           0 :         aServiceNames.realloc( 1 );
     141           0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.OLEObject" ) );
     142             :     }
     143           0 :     return aServiceNames;
     144             : }
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10