LCOV - code coverage report
Current view: top level - svx/source/unodraw - tableshape.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 59 0.0 %
Date: 2014-04-14 Functions: 0 7 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 <sal/config.h>
      21             : 
      22             : #include "UnoGraphicExporter.hxx"
      23             : #include "shapeimpl.hxx"
      24             : #include "svx/unoshprp.hxx"
      25             : #include "svx/svdotable.hxx"
      26             : #include <svx/svdpool.hxx>
      27             : 
      28             : 
      29             : 
      30             : 
      31             : using namespace ::osl;
      32             : using namespace ::cppu;
      33             : using namespace ::sdr::table;
      34             : using namespace ::com::sun::star;
      35             : using namespace ::com::sun::star::uno;
      36             : using namespace ::com::sun::star::lang;
      37             : using namespace ::com::sun::star::container;
      38             : using namespace ::com::sun::star::beans;
      39             : 
      40           0 : SvxTableShape::SvxTableShape( SdrObject* pObj ) throw()
      41           0 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_TABLE), getSvxMapProvider().GetPropertySet(SVXMAP_TABLE, SdrObject::GetGlobalDrawObjectItemPool()) )
      42             : {
      43           0 :     SetShapeType( OUString( "com.sun.star.drawing.TableShape" ) );
      44           0 : }
      45             : 
      46             : 
      47           0 : SvxTableShape::~SvxTableShape() throw()
      48             : {
      49           0 : }
      50             : 
      51             : 
      52             : 
      53           0 : bool SvxTableShape::setPropertyValueImpl(
      54             :     const OUString& rName,
      55             :     const SfxItemPropertySimpleEntry* pProperty,
      56             :     const ::com::sun::star::uno::Any& rValue )
      57             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
      58             : {
      59           0 :     switch( pProperty->nWID )
      60             :     {
      61             :     case OWN_ATTR_TABLETEMPLATE:
      62             :     {
      63           0 :         Reference< XIndexAccess > xTemplate;
      64             : 
      65           0 :         if( !(rValue >>= xTemplate) )
      66           0 :             throw IllegalArgumentException();
      67             : 
      68           0 :         if( mpObj.is() )
      69           0 :             static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->setTableStyle(xTemplate);
      70             : 
      71           0 :         return true;
      72             :     }
      73             :     case OWN_ATTR_TABLETEMPLATE_FIRSTROW:
      74             :     case OWN_ATTR_TABLETEMPLATE_LASTROW:
      75             :     case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN:
      76             :     case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN:
      77             :     case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:
      78             :     case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:
      79             :     {
      80           0 :         if( mpObj.is() )
      81             :         {
      82           0 :             TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyleSettings() );
      83             : 
      84           0 :             switch( pProperty->nWID )
      85             :             {
      86           0 :             case OWN_ATTR_TABLETEMPLATE_FIRSTROW:           rValue >>= aSettings.mbUseFirstRow; break;
      87           0 :             case OWN_ATTR_TABLETEMPLATE_LASTROW:            rValue >>= aSettings.mbUseLastRow; break;
      88           0 :             case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN:        rValue >>= aSettings.mbUseFirstColumn; break;
      89           0 :             case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN:         rValue >>= aSettings.mbUseLastColumn; break;
      90           0 :             case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:        rValue >>= aSettings.mbUseRowBanding; break;
      91           0 :             case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:    rValue >>= aSettings.mbUseColumnBanding; break;
      92             :             }
      93             : 
      94           0 :             static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->setTableStyleSettings(aSettings);
      95             :         }
      96             : 
      97           0 :         return true;
      98             :     }
      99             :     default:
     100             :     {
     101           0 :         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
     102             :     }
     103             :     }
     104             : }
     105             : 
     106           0 : bool SvxTableShape::getPropertyValueImpl(
     107             :     const OUString& rName,
     108             :     const SfxItemPropertySimpleEntry* pProperty,
     109             :     ::com::sun::star::uno::Any& rValue )
     110             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     111             : {
     112           0 :     switch( pProperty->nWID )
     113             :     {
     114             :     case OWN_ATTR_OLEMODEL:
     115             :     {
     116           0 :         if( mpObj.is() )
     117             :         {
     118           0 :             rValue <<= static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTable();
     119             :         }
     120           0 :         return true;
     121             :     }
     122             :     case OWN_ATTR_TABLETEMPLATE:
     123             :     {
     124           0 :         if( mpObj.is() )
     125             :         {
     126           0 :             rValue <<= static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyle();
     127             :         }
     128           0 :         return true;
     129             :     }
     130             :     case OWN_ATTR_BITMAP:
     131             :     {
     132           0 :         if( mpObj.is() )
     133             :         {
     134           0 :             Graphic aGraphic( SvxGetGraphicForShape( *mpObj.get(), true ) );
     135           0 :             rValue <<= aGraphic.GetXGraphic();
     136             :         }
     137           0 :         return true;
     138             :     }
     139             :     case OWN_ATTR_TABLETEMPLATE_FIRSTROW:
     140             :     case OWN_ATTR_TABLETEMPLATE_LASTROW:
     141             :     case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN:
     142             :     case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN:
     143             :     case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:
     144             :     case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:
     145             :     {
     146           0 :         if( mpObj.is() )
     147             :         {
     148           0 :             TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyleSettings() );
     149             : 
     150           0 :             switch( pProperty->nWID )
     151             :             {
     152           0 :             case OWN_ATTR_TABLETEMPLATE_FIRSTROW:           rValue <<= aSettings.mbUseFirstRow; break;
     153           0 :             case OWN_ATTR_TABLETEMPLATE_LASTROW:            rValue <<= aSettings.mbUseLastRow; break;
     154           0 :             case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN:        rValue <<= aSettings.mbUseFirstColumn; break;
     155           0 :             case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN:         rValue <<= aSettings.mbUseLastColumn; break;
     156           0 :             case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:        rValue <<= aSettings.mbUseRowBanding; break;
     157           0 :             case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:    rValue <<= aSettings.mbUseColumnBanding; break;
     158             :             }
     159             :         }
     160             : 
     161           0 :         return true;
     162             :     }
     163             :     default:
     164             :     {
     165           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
     166             :     }
     167             :     }
     168             : }
     169             : 
     170           0 : void SvxTableShape::lock()
     171             : {
     172           0 :     SvxShape::lock();
     173           0 :     if( mpObj.is() )
     174           0 :         static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->uno_lock();
     175           0 : }
     176             : 
     177           0 : void SvxTableShape::unlock()
     178             : {
     179           0 :     if( mpObj.is() )
     180           0 :         static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->uno_unlock();
     181           0 :     SvxShape::unlock();
     182           0 : }
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10