LCOV - code coverage report
Current view: top level - svx/source/unodraw - unobtabl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 17 25 68.0 %
Date: 2014-11-03 Functions: 8 11 72.7 %
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 ::cppu;
      37             : 
      38             : class SvxUnoBitmapTable : public SvxUnoNameItemTable
      39             : {
      40             : public:
      41             :     SvxUnoBitmapTable( SdrModel* pModel ) throw();
      42             :     virtual ~SvxUnoBitmapTable() throw();
      43             : 
      44             :     virtual NameOrIndex* createItem() const throw() SAL_OVERRIDE;
      45             :     virtual bool isValid( const NameOrIndex* pItem ) const SAL_OVERRIDE;
      46             : 
      47             :     // XServiceInfo
      48             :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      49             :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException, std::exception) SAL_OVERRIDE;
      50             : 
      51             :     // XElementAccess
      52             :     virtual uno::Type SAL_CALL getElementType(  ) throw( uno::RuntimeException, std::exception) SAL_OVERRIDE;
      53             : };
      54             : 
      55         830 : SvxUnoBitmapTable::SvxUnoBitmapTable( SdrModel* pModel ) throw()
      56         830 : : SvxUnoNameItemTable( pModel, XATTR_FILLBITMAP, MID_GRAFURL )
      57             : {
      58         830 : }
      59             : 
      60        1544 : SvxUnoBitmapTable::~SvxUnoBitmapTable() throw()
      61             : {
      62        1544 : }
      63             : 
      64        2718 : bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const
      65             : {
      66        2718 :     if( SvxUnoNameItemTable::isValid( pItem ) )
      67             :     {
      68        2414 :         const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem );
      69        2414 :         if( pBitmapItem )
      70             :         {
      71        2414 :             const Graphic& rGraphic = pBitmapItem->GetGraphicObject().GetGraphic();
      72             : 
      73        2414 :             return rGraphic.GetSizeBytes() > 0;
      74             :         }
      75             :     }
      76             : 
      77         304 :     return false;
      78             : }
      79             : 
      80           0 : OUString SAL_CALL SvxUnoBitmapTable::getImplementationName() throw( uno::RuntimeException, std::exception )
      81             : {
      82           0 :     return OUString("SvxUnoBitmapTable");
      83             : }
      84             : 
      85           0 : uno::Sequence< OUString > SAL_CALL SvxUnoBitmapTable::getSupportedServiceNames(  )
      86             :     throw( uno::RuntimeException, std::exception )
      87             : {
      88           0 :     uno::Sequence< OUString > aSNS( 1 );
      89           0 :     aSNS[0] = "com.sun.star.drawing.BitmapTable";
      90           0 :     return aSNS;
      91             : }
      92             : 
      93         248 : NameOrIndex* SvxUnoBitmapTable::createItem() const throw()
      94             : {
      95         248 :     return new XFillBitmapItem();
      96             : }
      97             : 
      98             : // XElementAccess
      99           0 : uno::Type SAL_CALL SvxUnoBitmapTable::getElementType(  )
     100             :     throw( uno::RuntimeException, std::exception )
     101             : {
     102           0 :     return ::cppu::UnoType<OUString>::get();
     103             : }
     104             : 
     105             : /**
     106             :  * Create a bitmaptable
     107             :  */
     108         830 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoBitmapTable_createInstance( SdrModel* pModel )
     109             : {
     110         830 :     return *new SvxUnoBitmapTable(pModel);
     111         651 : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10