LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - unopback.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 92 195 47.2 %
Date: 2012-08-25 Functions: 15 24 62.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 117 421 27.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/drawing/BitmapMode.hpp>
      30                 :            : #include <osl/mutex.hxx>
      31                 :            : #include <vcl/svapp.hxx>
      32                 :            : #include <svl/itemset.hxx>
      33                 :            : #include <svx/svdpool.hxx>
      34                 :            : #include <comphelper/extract.hxx>
      35                 :            : #include <svx/xflbstit.hxx>
      36                 :            : #include <svx/xflbmtit.hxx>
      37                 :            : #include <svx/svdobj.hxx>
      38                 :            : #include <svx/unoprov.hxx>
      39                 :            : #include <svx/unoshape.hxx>
      40                 :            : #include <comphelper/serviceinfohelper.hxx>
      41                 :            : 
      42                 :            : #include "unopback.hxx"
      43                 :            : #include "unohelp.hxx"
      44                 :            : #include "drawdoc.hxx"
      45                 :            : #include "unokywds.hxx"
      46                 :            : 
      47                 :            : using namespace ::rtl;
      48                 :            : using namespace ::com::sun::star;
      49                 :            : 
      50                 :         66 : const SvxItemPropertySet* ImplGetPageBackgroundPropertySet()
      51                 :            : {
      52                 :            :     static const SfxItemPropertyMapEntry aPageBackgroundPropertyMap_Impl[] =
      53                 :            :     {
      54 [ +  - ][ +  - ]:          9 :         FILL_PROPERTIES
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      55                 :            :         {0,0,0,0,0,0}
      56 [ +  + ][ +  - ]:         75 :     };
                 [ #  # ]
      57                 :            : 
      58 [ +  + ][ +  - ]:         66 :     static SvxItemPropertySet aPageBackgroundPropertySet_Impl( aPageBackgroundPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
         [ +  - ][ +  - ]
                 [ #  # ]
      59                 :         66 :     return &aPageBackgroundPropertySet_Impl;
      60                 :            : }
      61                 :            : 
      62 [ +  - ][ +  - ]:        144 : UNO3_GETIMPLEMENTATION_IMPL( SdUnoPageBackground );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      63                 :            : 
      64                 :         53 : SdUnoPageBackground::SdUnoPageBackground(
      65                 :            :     SdDrawDocument* pDoc /* = NULL */,
      66                 :            :     const SfxItemSet* pSet /* = NULL */) throw()
      67         [ +  - ]:         53 : :   mpPropSet(ImplGetPageBackgroundPropertySet()),
      68                 :            :     mpSet(NULL),
      69         [ +  - ]:         53 :     mpDoc(pDoc)
      70                 :            : {
      71         [ +  - ]:         53 :     if( pDoc )
      72                 :            :     {
      73         [ +  - ]:         53 :         StartListening( *pDoc );
      74 [ +  - ][ +  - ]:         53 :         mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
      75                 :            : 
      76         [ +  + ]:         53 :         if( pSet )
      77         [ +  - ]:         10 :             mpSet->Put(*pSet);
      78                 :            :     }
      79                 :         53 : }
      80                 :            : 
      81         [ +  - ]:         49 : SdUnoPageBackground::~SdUnoPageBackground() throw()
      82                 :            : {
      83         [ +  + ]:         49 :     if( mpDoc )
      84         [ +  - ]:         47 :         EndListening( *mpDoc );
      85                 :            : 
      86         [ +  + ]:         49 :     if( mpSet )
      87 [ +  - ][ +  - ]:         47 :         delete mpSet;
      88         [ -  + ]:         98 : }
      89                 :            : 
      90                 :        101 : void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint )
      91                 :            : {
      92 [ +  - ][ +  + ]:        101 :     const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
      93                 :            : 
      94         [ +  + ]:        101 :     if( pSdrHint )
      95                 :            :     {
      96                 :            :         // delete item set if document is dying because then the pool
      97                 :            :         // will also die
      98         [ +  + ]:         95 :         if( pSdrHint->GetKind() == HINT_MODELCLEARED )
      99                 :            :         {
     100         [ +  + ]:         12 :             delete mpSet;
     101                 :         12 :             mpSet = NULL;
     102                 :         12 :             mpDoc = NULL;
     103                 :            :         }
     104                 :            :     }
     105                 :            : 
     106                 :        101 : }
     107                 :            : 
     108                 :         36 : void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw()
     109                 :            : {
     110                 :         36 :     rSet.ClearItem();
     111                 :            : 
     112         [ -  + ]:         36 :     if( mpSet == NULL )
     113                 :            :     {
     114                 :          0 :         StartListening( *pDoc );
     115                 :          0 :         mpDoc = pDoc;
     116                 :            : 
     117         [ #  # ]:          0 :         mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
     118                 :            : 
     119         [ #  # ]:          0 :         if( mpPropSet->AreThereOwnUsrAnys() )
     120                 :            :         {
     121                 :            :             uno::Any* pAny;
     122         [ #  # ]:          0 :             PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap()->getPropertyEntries();
     123         [ #  # ]:          0 :             PropertyEntryVector_t::const_iterator aIt = aProperties.begin();
     124                 :            : 
     125 [ #  # ][ #  # ]:          0 :             while( aIt != aProperties.end() )
     126                 :            :             {
     127         [ #  # ]:          0 :                 pAny = mpPropSet->GetUsrAnyForID( aIt->nWID );
     128         [ #  # ]:          0 :                 if( pAny )
     129                 :            :                 {
     130                 :          0 :                     OUString aPropertyName( aIt->sName );
     131   [ #  #  #  # ]:          0 :                     switch( aIt->nWID )
     132                 :            :                     {
     133                 :            :                         case XATTR_FILLFLOATTRANSPARENCE :
     134                 :            :                         case XATTR_FILLGRADIENT :
     135                 :            :                         {
     136         [ #  # ]:          0 :                             if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::awt::Gradient*)0) )
           [ #  #  #  # ]
                 [ #  # ]
     137                 :          0 :                                 && ( aIt->nMemberId == MID_FILLGRADIENT ) )
     138                 :            :                             {
     139         [ #  # ]:          0 :                                 setPropertyValue( aPropertyName, *pAny );
     140                 :            :                             }
     141         [ #  # ]:          0 :                             else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
           [ #  #  #  # ]
                 [ #  # ]
     142                 :          0 :                                         ( aIt->nMemberId == MID_NAME ) )
     143                 :            :                             {
     144         [ #  # ]:          0 :                                 setPropertyValue( aPropertyName, *pAny );
     145                 :            :                             }
     146                 :            :                         }
     147                 :          0 :                         break;
     148                 :            :                         case XATTR_FILLHATCH :
     149                 :            :                         {
     150         [ #  # ]:          0 :                             if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::drawing::Hatch*)0) )
           [ #  #  #  # ]
                 [ #  # ]
     151                 :          0 :                                 && ( aIt->nMemberId == MID_FILLHATCH ) )
     152                 :            :                             {
     153         [ #  # ]:          0 :                                 setPropertyValue( aPropertyName, *pAny );
     154                 :            :                             }
     155         [ #  # ]:          0 :                             else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
           [ #  #  #  # ]
                 [ #  # ]
     156                 :          0 :                                         ( aIt->nMemberId == MID_NAME ) )
     157                 :            :                             {
     158         [ #  # ]:          0 :                                 setPropertyValue( aPropertyName, *pAny );
     159                 :            :                             }
     160                 :            :                         }
     161                 :          0 :                         break;
     162                 :            :                         case XATTR_FILLBITMAP :
     163                 :            :                         {
     164 [ #  # ][ #  #  :          0 :                             if ( ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0) ) ||
             #  #  #  # ]
                 [ #  # ]
     165         [ #  # ]:          0 :                                     ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >*)0) ) ) &&
     166                 :          0 :                                     ( aIt->nMemberId == MID_BITMAP ) )
     167                 :            :                             {
     168         [ #  # ]:          0 :                                 setPropertyValue( aPropertyName, *pAny );
     169                 :            :                             }
     170 [ #  # ][ #  #  :          0 :                             else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
             #  #  #  # ]
                 [ #  # ]
     171                 :          0 :                                         ( ( aIt->nMemberId == MID_NAME ) || ( aIt->nMemberId == MID_GRAFURL ) ) )
     172                 :            :                             {
     173         [ #  # ]:          0 :                                 setPropertyValue( aPropertyName, *pAny );
     174                 :            :                             }
     175                 :            :                         }
     176                 :          0 :                         break;
     177                 :            : 
     178                 :            :                         default:
     179         [ #  # ]:          0 :                             setPropertyValue( aPropertyName, *pAny );
     180                 :          0 :                     }
     181                 :            :                 }
     182                 :          0 :                 ++aIt;
     183                 :          0 :             }
     184                 :            :         }
     185                 :            :     }
     186                 :            : 
     187                 :         36 :     rSet.Put( *mpSet );
     188                 :         36 : }
     189                 :            : 
     190                 :            : // XServiceInfo
     191                 :          0 : OUString SAL_CALL SdUnoPageBackground::getImplementationName()
     192                 :            :     throw(uno::RuntimeException)
     193                 :            : {
     194                 :          0 :     return OUString::createFromAscii( sUNO_SdUnoPageBackground );
     195                 :            : }
     196                 :            : 
     197                 :          0 : sal_Bool SAL_CALL SdUnoPageBackground::supportsService( const OUString& ServiceName )
     198                 :            :     throw(uno::RuntimeException)
     199                 :            : {
     200                 :          0 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
     201                 :            : }
     202                 :            : 
     203                 :          0 : uno::Sequence< OUString > SAL_CALL SdUnoPageBackground::getSupportedServiceNames()
     204                 :            :     throw(uno::RuntimeException)
     205                 :            : {
     206                 :          0 :     uno::Sequence< OUString > aNameSequence( 2 );
     207         [ #  # ]:          0 :     OUString* pStrings = aNameSequence.getArray();
     208                 :            : 
     209                 :          0 :     *pStrings++ = OUString( sUNO_Service_PageBackground );
     210                 :          0 :     *pStrings   = OUString( sUNO_Service_FillProperties );
     211                 :            : 
     212                 :          0 :     return aNameSequence;
     213                 :            : }
     214                 :            : 
     215                 :            : // XPropertySet
     216                 :         58 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SdUnoPageBackground::getPropertySetInfo()
     217                 :            :     throw(uno::RuntimeException)
     218                 :            : {
     219                 :         58 :     return mpPropSet->getPropertySetInfo();
     220                 :            : }
     221                 :            : 
     222                 :         11 : void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
     223                 :            :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     224                 :            : {
     225         [ +  - ]:         11 :     SolarMutexGuard aGuard;
     226                 :            : 
     227                 :         11 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
     228                 :            : 
     229         [ -  + ]:         11 :     if( pEntry == NULL )
     230                 :            :     {
     231         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     232                 :            :     }
     233                 :            :     else
     234                 :            :     {
     235         [ +  - ]:         11 :         if( mpSet )
     236                 :            :         {
     237         [ -  + ]:         11 :             if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
     238                 :            :             {
     239                 :            :                 drawing::BitmapMode eMode;
     240 [ #  # ][ #  # ]:          0 :                 if( aValue >>= eMode )
     241                 :            :                 {
     242 [ #  # ][ #  # ]:          0 :                     mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
                 [ #  # ]
     243 [ #  # ][ #  # ]:          0 :                     mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
                 [ #  # ]
     244                 :         11 :                     return;
     245                 :            :                 }
     246         [ #  # ]:          0 :                 throw lang::IllegalArgumentException();
     247                 :            :             }
     248                 :            : 
     249                 :         11 :             SfxItemPool& rPool = *mpSet->GetPool();
     250         [ +  - ]:         11 :             SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
     251         [ +  - ]:         11 :             aSet.Put( *mpSet );
     252                 :            : 
     253         [ +  - ]:         11 :             if( !aSet.Count() )
     254 [ +  - ][ +  - ]:         11 :                 aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
     255                 :            : 
     256 [ -  + ][ #  # ]:         11 :             if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     257                 :            :             {
     258                 :          0 :                 OUString aName;
     259         [ #  # ]:          0 :                 if(!(aValue >>= aName ))
     260         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
     261                 :            : 
     262         [ #  # ]:          0 :                 SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet );
     263                 :            :             }
     264                 :            :             else
     265                 :            :             {
     266         [ +  - ]:         11 :                 SvxItemPropertySet_setPropertyValue( *mpPropSet, pEntry, aValue, aSet );
     267                 :            :             }
     268                 :            : 
     269 [ +  - ][ +  - ]:         11 :             mpSet->Put( aSet );
     270                 :            :         }
     271                 :            :         else
     272                 :            :         {
     273 [ #  # ][ #  # ]:          0 :             if(pEntry && pEntry->nWID)
     274         [ #  # ]:         11 :                 mpPropSet->setPropertyValue( pEntry, aValue );
     275                 :            :         }
     276 [ +  - ][ +  - ]:         11 :     }
     277                 :            : }
     278                 :            : 
     279                 :         15 : uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& PropertyName )
     280                 :            :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     281                 :            : {
     282         [ +  - ]:         15 :     SolarMutexGuard aGuard;
     283                 :            : 
     284                 :         15 :     uno::Any aAny;
     285                 :         15 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
     286                 :            : 
     287         [ -  + ]:         15 :     if( pEntry == NULL )
     288                 :            :     {
     289         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     290                 :            :     }
     291                 :            :     else
     292                 :            :     {
     293         [ +  - ]:         15 :         if( mpSet )
     294                 :            :         {
     295         [ -  + ]:         15 :             if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
     296                 :            :             {
     297         [ #  # ]:          0 :                 XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)mpSet->GetItem(XATTR_FILLBMP_STRETCH);
     298         [ #  # ]:          0 :                 XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)mpSet->GetItem(XATTR_FILLBMP_TILE);
     299                 :            : 
     300 [ #  # ][ #  # ]:          0 :                 if( pStretchItem && pTileItem )
     301                 :            :                 {
     302         [ #  # ]:          0 :                     if( pTileItem->GetValue() )
     303         [ #  # ]:          0 :                         aAny <<= drawing::BitmapMode_REPEAT;
     304         [ #  # ]:          0 :                     else if( pStretchItem->GetValue() )
     305         [ #  # ]:          0 :                         aAny <<= drawing::BitmapMode_STRETCH;
     306                 :            :                     else
     307         [ #  # ]:          0 :                         aAny <<= drawing::BitmapMode_NO_REPEAT;
     308                 :            :                 }
     309                 :            :             }
     310                 :            :             else
     311                 :            :             {
     312                 :         15 :                 SfxItemPool& rPool = *mpSet->GetPool();
     313         [ +  - ]:         15 :                 SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
     314         [ +  - ]:         15 :                 aSet.Put( *mpSet );
     315                 :            : 
     316         [ -  + ]:         15 :                 if( !aSet.Count() )
     317 [ #  # ][ #  # ]:          0 :                     aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
     318                 :            : 
     319                 :            :                 // Hole Wert aus ItemSet
     320 [ +  - ][ +  - ]:         15 :                 aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
     321                 :            :             }
     322                 :            :         }
     323                 :            :         else
     324                 :            :         {
     325 [ #  # ][ #  # ]:          0 :             if(pEntry && pEntry->nWID)
     326         [ #  # ]:          0 :                 aAny = mpPropSet->getPropertyValue( pEntry );
     327                 :            :         }
     328                 :            :     }
     329         [ +  - ]:         15 :     return aAny;
     330                 :            : }
     331                 :            : 
     332                 :          0 : void SAL_CALL SdUnoPageBackground::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     333                 :          0 : void SAL_CALL SdUnoPageBackground::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     334                 :          0 : void SAL_CALL SdUnoPageBackground::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     335                 :          0 : void SAL_CALL SdUnoPageBackground::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     336                 :            : 
     337                 :            : // XPropertyState
     338                 :        318 : beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUString& PropertyName )
     339                 :            :     throw(beans::UnknownPropertyException, uno::RuntimeException)
     340                 :            : {
     341         [ +  - ]:        318 :     SolarMutexGuard aGuard;
     342                 :            : 
     343                 :        318 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
     344                 :            : 
     345         [ -  + ]:        318 :     if( pEntry == NULL )
     346         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     347                 :            : 
     348         [ +  - ]:        318 :     if( mpSet )
     349                 :            :     {
     350         [ +  + ]:        318 :         if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
     351                 :            :         {
     352 [ +  - ][ +  - ]:         30 :             if( mpSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
         [ -  + ][ -  + ]
     353         [ +  - ]:         15 :                 mpSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
     354                 :            :             {
     355                 :          0 :                 return beans::PropertyState_DIRECT_VALUE;
     356                 :            :             }
     357                 :            :             else
     358                 :            :             {
     359                 :         15 :                 return beans::PropertyState_AMBIGUOUS_VALUE;
     360                 :            :             }
     361                 :            :         }
     362                 :            : 
     363         [ +  - ]:        303 :         switch( mpSet->GetItemState( pEntry->nWID, sal_False ) )
              [ +  +  - ]
     364                 :            :         {
     365                 :            :         case SFX_ITEM_READONLY:
     366                 :            :         case SFX_ITEM_SET:
     367                 :         15 :             return beans::PropertyState_DIRECT_VALUE;
     368                 :            :         case SFX_ITEM_DEFAULT:
     369                 :        288 :             return beans::PropertyState_DEFAULT_VALUE;
     370                 :            :         default:
     371                 :            : //      case SFX_ITEM_DONTCARE:
     372                 :            : //      case SFX_ITEM_DISABLED:
     373                 :          0 :             return beans::PropertyState_AMBIGUOUS_VALUE;
     374                 :            :         }
     375                 :            :     }
     376                 :            :     else
     377                 :            :     {
     378 [ #  # ][ #  # ]:          0 :         if( NULL == mpPropSet->GetUsrAnyForID(pEntry->nWID) )
     379                 :          0 :             return beans::PropertyState_DEFAULT_VALUE;
     380                 :            :         else
     381                 :          0 :             return beans::PropertyState_DIRECT_VALUE;
     382         [ +  - ]:        318 :     }
     383                 :            : }
     384                 :            : 
     385                 :          0 : uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPageBackground::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
     386                 :            :     throw(beans::UnknownPropertyException, uno::RuntimeException)
     387                 :            : {
     388         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     389                 :            : 
     390                 :          0 :     sal_Int32 nCount = aPropertyName.getLength();
     391                 :          0 :     const OUString* pNames = aPropertyName.getConstArray();
     392                 :            : 
     393         [ #  # ]:          0 :     uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount );
     394         [ #  # ]:          0 :     beans::PropertyState* pState = aPropertyStateSequence.getArray();
     395                 :            : 
     396         [ #  # ]:          0 :     while( nCount-- )
     397         [ #  # ]:          0 :         *pState++ = getPropertyState( *pNames++ );
     398                 :            : 
     399         [ #  # ]:          0 :     return aPropertyStateSequence;
     400                 :            : }
     401                 :            : 
     402                 :        175 : void SAL_CALL SdUnoPageBackground::setPropertyToDefault( const OUString& PropertyName )
     403                 :            :     throw(beans::UnknownPropertyException, uno::RuntimeException)
     404                 :            : {
     405         [ +  - ]:        175 :     SolarMutexGuard aGuard;
     406                 :            : 
     407                 :        175 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
     408                 :            : 
     409         [ -  + ]:        175 :     if( pEntry == NULL )
     410         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     411                 :            : 
     412         [ +  - ]:        175 :     if( mpSet )
     413                 :            :     {
     414         [ +  + ]:        175 :         if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
     415                 :            :         {
     416         [ +  - ]:          7 :             mpSet->ClearItem( XATTR_FILLBMP_STRETCH );
     417         [ +  - ]:          7 :             mpSet->ClearItem( XATTR_FILLBMP_TILE );
     418                 :            :         }
     419                 :            :         else
     420                 :            :         {
     421         [ +  - ]:        168 :             mpSet->ClearItem( pEntry->nWID );
     422                 :            :         }
     423         [ +  - ]:        175 :     }
     424                 :        175 : }
     425                 :            : 
     426                 :          0 : uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aPropertyName )
     427                 :            :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     428                 :            : {
     429         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     430                 :            : 
     431                 :          0 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(aPropertyName);
     432 [ #  # ][ #  # ]:          0 :     if( pEntry == NULL || mpSet == NULL )
     433         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     434                 :            : 
     435                 :          0 :     uno::Any aAny;
     436         [ #  # ]:          0 :     if( mpSet )
     437                 :            :     {
     438         [ #  # ]:          0 :         if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
     439                 :            :         {
     440         [ #  # ]:          0 :             aAny <<= drawing::BitmapMode_REPEAT;
     441                 :            :         }
     442                 :            :         else
     443                 :            :         {
     444                 :          0 :             SfxItemPool& rPool = *mpSet->GetPool();
     445         [ #  # ]:          0 :             SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
     446 [ #  # ][ #  # ]:          0 :             aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
     447                 :            : 
     448 [ #  # ][ #  # ]:          0 :             aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
     449                 :            :         }
     450                 :            :     }
     451         [ #  # ]:          0 :     return aAny;
     452                 :            : }
     453                 :            : 
     454                 :            : /** this is used because our property map is not sorted yet */
     455                 :        519 : const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
     456                 :            : {
     457                 :        519 :     return mpPropSet->getPropertyMap()->getByName(rPropertyName);
     458                 :            : }
     459                 :            : 
     460                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10