LCOV - code coverage report
Current view: top level - sfx2/source/doc - objitem.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 37 0.0 %
Date: 2014-04-14 Functions: 0 18 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             : 
      21             : #include <sfx2/objsh.hxx>
      22             : #include <sfx2/objitem.hxx>
      23             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      24             : 
      25             : 
      26             : 
      27           0 : TYPEINIT1_AUTOFACTORY(SfxObjectShellItem,SfxPoolItem)
      28           0 : TYPEINIT1_AUTOFACTORY(SfxObjectItem,SfxPoolItem)
      29             : 
      30             : 
      31             : 
      32           0 : bool SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const
      33             : {
      34           0 :      return PTR_CAST(SfxObjectShellItem, &rItem)->pObjSh == pObjSh;
      35             : }
      36             : 
      37             : 
      38             : 
      39           0 : OUString SfxObjectShellItem::GetValueText() const
      40             : {
      41           0 :     return OUString();
      42             : }
      43             : 
      44             : 
      45             : 
      46           0 : SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const
      47             : {
      48           0 :     return new SfxObjectShellItem( Which(), pObjSh );
      49             : }
      50             : 
      51             : 
      52             : 
      53           0 : bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
      54             : {
      55           0 :     if ( pObjSh )
      56             :     {
      57             :         // This item MUST provide a model. Please don't change this, there are UNO-based
      58             :         // implementations which need it!!
      59           0 :         rVal <<= pObjSh->GetModel();
      60             :     }
      61             :     else
      62             :     {
      63           0 :         rVal <<= ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >();
      64             :     }
      65           0 :     return true;
      66             : }
      67             : 
      68             : 
      69             : 
      70           0 : bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
      71             : {
      72             :     // This item MUST have a model. Please don't change this, there are UNO-based
      73             :     // implementations which need it!!
      74           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel;
      75             : 
      76           0 :     if ( rVal >>= xModel )
      77             :     {
      78           0 :         if ( xModel.is() )
      79             :         {
      80             :             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xTunnel(
      81           0 :                 xModel, ::com::sun::star::uno::UNO_QUERY );
      82           0 :             if ( xTunnel.is() )
      83             :             {
      84           0 :                 ::com::sun::star::uno::Sequence < sal_Int8 > aSeq( (sal_Int8*) SvGlobalName( SFX_GLOBAL_CLASSID ).GetBytes(), 16 );
      85           0 :                 sal_Int64 nHandle = xTunnel->getSomething( aSeq );
      86           0 :                 if ( nHandle )
      87             :                 {
      88           0 :                     pObjSh = reinterpret_cast< SfxObjectShell* >(sal::static_int_cast<sal_IntPtr>( nHandle ));
      89           0 :                     return true;
      90           0 :                 }
      91           0 :             }
      92             :         }
      93             : 
      94           0 :         pObjSh = 0;
      95           0 :         return true;
      96             :     }
      97             : 
      98           0 :     return true;
      99             : }
     100             : 
     101             : 
     102             : 
     103           0 : SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh )
     104             : :   SfxPoolItem( nWhichId ),
     105           0 :     _pSh( pSh )
     106           0 : {}
     107             : 
     108             : 
     109             : 
     110           0 : bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
     111             : {
     112           0 :      SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem);
     113           0 :      return pOther->_pSh == _pSh;
     114             : }
     115             : 
     116             : 
     117             : 
     118           0 : SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const
     119             : {
     120           0 :     return new SfxObjectItem( Which(), _pSh );
     121             : }
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10