LCOV - code coverage report
Current view: top level - libreoffice/svx/source/unodraw - unobtabl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 24 29.2 %
Date: 2012-12-27 Functions: 4 9 44.4 %
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 <svl/itempool.hxx>
      21             : #include <vcl/cvtgrf.hxx>
      22             : #include <svl/itemset.hxx>
      23             : #include <svx/xit.hxx>
      24             : #include "UnoNameItemTable.hxx"
      25             : 
      26             : #include <svx/xbtmpit.hxx>
      27             : #include <svx/svdmodel.hxx>
      28             : #include <svx/xflhtit.hxx>
      29             : #include "svx/unoapi.hxx"
      30             : #include <svx/unomid.hxx>
      31             : #include <editeng/unoprnms.hxx>
      32             : #include "svx/unofill.hxx"
      33             : #include <editeng/memberids.hrc>
      34             : 
      35             : using namespace ::com::sun::star;
      36             : using namespace ::rtl;
      37             : using namespace ::cppu;
      38             : 
      39             : class SvxUnoBitmapTable : public SvxUnoNameItemTable
      40             : {
      41             : public:
      42             :     SvxUnoBitmapTable( SdrModel* pModel ) throw();
      43             :     virtual ~SvxUnoBitmapTable() throw();
      44             : 
      45             :     virtual NameOrIndex* createItem() const throw();
      46             :     virtual bool isValid( const NameOrIndex* pItem ) const;
      47             : 
      48             :     // XServiceInfo
      49             :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
      50             :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
      51             : 
      52             :     // XElementAccess
      53             :     virtual uno::Type SAL_CALL getElementType(  ) throw( uno::RuntimeException);
      54             : };
      55             : 
      56          47 : SvxUnoBitmapTable::SvxUnoBitmapTable( SdrModel* pModel ) throw()
      57          47 : : SvxUnoNameItemTable( pModel, XATTR_FILLBITMAP, MID_GRAFURL )
      58             : {
      59          47 : }
      60             : 
      61          94 : SvxUnoBitmapTable::~SvxUnoBitmapTable() throw()
      62             : {
      63          94 : }
      64             : 
      65           0 : bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const
      66             : {
      67           0 :     if( SvxUnoNameItemTable::isValid( pItem ) )
      68             :     {
      69           0 :         const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem );
      70           0 :         if( pBitmapItem )
      71             :         {
      72           0 :             const GraphicObject& rGraphic = pBitmapItem->GetBitmapValue().GetGraphicObject();
      73           0 :             return rGraphic.GetSizeBytes() > 0;
      74             :         }
      75             :     }
      76             : 
      77           0 :     return false;
      78             : }
      79             : 
      80           0 : OUString SAL_CALL SvxUnoBitmapTable::getImplementationName() throw( uno::RuntimeException )
      81             : {
      82           0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoBitmapTable") );
      83             : }
      84             : 
      85           0 : uno::Sequence< OUString > SAL_CALL SvxUnoBitmapTable::getSupportedServiceNames(  )
      86             :     throw( uno::RuntimeException )
      87             : {
      88           0 :     uno::Sequence< OUString > aSNS( 1 );
      89           0 :     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable" ));
      90           0 :     return aSNS;
      91             : }
      92             : 
      93           0 : NameOrIndex* SvxUnoBitmapTable::createItem() const throw()
      94             : {
      95           0 :     return new XFillBitmapItem();
      96             : }
      97             : 
      98             : // XElementAccess
      99           0 : uno::Type SAL_CALL SvxUnoBitmapTable::getElementType(  )
     100             :     throw( uno::RuntimeException )
     101             : {
     102           0 :     return ::getCppuType( (const ::rtl::OUString*)0 );
     103             : }
     104             : 
     105             : /**
     106             :  * Create a bitmaptable
     107             :  */
     108          47 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoBitmapTable_createInstance( SdrModel* pModel )
     109             : {
     110          47 :     return *new SvxUnoBitmapTable(pModel);
     111             : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10