LCOV - code coverage report
Current view: top level - svx/source/unodraw - XPropertyTable.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 125 287 43.6 %
Date: 2012-08-25 Functions: 41 67 61.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 81 342 23.7 %

           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                 :            : 
      30                 :            : #include "svx/XPropertyTable.hxx"
      31                 :            : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      32                 :            : #include <com/sun/star/drawing/LineDash.hpp>
      33                 :            : #include <com/sun/star/awt/Gradient.hpp>
      34                 :            : #include <com/sun/star/drawing/Hatch.hpp>
      35                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      36                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      37                 :            : #include <osl/mutex.hxx>
      38                 :            : #include <vcl/svapp.hxx>
      39                 :            : 
      40                 :            : #include <cppuhelper/implbase2.hxx>
      41                 :            : #include <svx/xdef.hxx>
      42                 :            : 
      43                 :            : #include "svx/unoapi.hxx"
      44                 :            : #include <editeng/unoprnms.hxx>
      45                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      46                 :            : #include <basegfx/tools/unotools.hxx>
      47                 :            : 
      48                 :            : using namespace com::sun::star;
      49                 :            : using namespace ::cppu;
      50                 :            : using namespace ::rtl;
      51                 :            : 
      52                 :            : class SvxUnoXPropertyTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
      53                 :            : {
      54                 :            : private:
      55                 :            :     XPropertyList*  mpList;
      56                 :            :     sal_Int16 mnWhich;
      57                 :            : 
      58         [ #  # ]:          0 :     long getCount() const { return mpList ? mpList->Count() : 0; }
      59                 :            :     XPropertyEntry* get( long index ) const;
      60                 :            : public:
      61                 :            :     SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw();
      62                 :            : 
      63                 :            :     virtual ~SvxUnoXPropertyTable() throw();
      64                 :            : 
      65                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() = 0;
      66                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() = 0;
      67                 :            : 
      68                 :            :     // XServiceInfo
      69                 :            :     virtual sal_Bool SAL_CALL supportsService( const  OUString& ServiceName ) throw( uno::RuntimeException);
      70                 :            : 
      71                 :            :     // XNameContainer
      72                 :            :     virtual void SAL_CALL insertByName( const  OUString& aName, const  uno::Any& aElement ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
      73                 :            :     virtual void SAL_CALL removeByName( const  OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
      74                 :            : 
      75                 :            :     // XNameReplace
      76                 :            :     virtual void SAL_CALL replaceByName( const  OUString& aName, const  uno::Any& aElement ) throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
      77                 :            : 
      78                 :            :     // XNameAccess
      79                 :            :     virtual uno::Any SAL_CALL getByName( const  OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
      80                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getElementNames(  ) throw( uno::RuntimeException);
      81                 :            :     virtual sal_Bool SAL_CALL hasByName( const  OUString& aName ) throw( uno::RuntimeException);
      82                 :            : 
      83                 :            :     // XElementAccess
      84                 :            :     virtual sal_Bool SAL_CALL hasElements(  ) throw( uno::RuntimeException);
      85                 :            : };
      86                 :            : 
      87                 :        306 : SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw()
      88                 :        306 : : mpList( pList ), mnWhich( nWhich )
      89                 :            : {
      90                 :        306 : }
      91                 :            : 
      92                 :        306 : SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw()
      93                 :            : {
      94         [ -  + ]:        306 : }
      95                 :            : 
      96                 :    1299870 : XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const
      97                 :            : {
      98         [ +  - ]:    1299870 :     if( mpList )
      99                 :    1299870 :         return mpList->Get( index, 0 );
     100                 :            :     else
     101                 :    1299870 :         return NULL;
     102                 :            : }
     103                 :            : 
     104                 :            : // XServiceInfo
     105                 :          0 : sal_Bool SAL_CALL SvxUnoXPropertyTable::supportsService( const  OUString& ServiceName )
     106                 :            :     throw( uno::RuntimeException)
     107                 :            : {
     108         [ #  # ]:          0 :     const uno::Sequence< OUString > aServices( getSupportedServiceNames() );
     109                 :          0 :     const OUString* pServices = aServices.getConstArray();
     110                 :          0 :     const sal_Int32 nCount = aServices.getLength();
     111                 :            :     sal_Int32 i;
     112         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     113                 :            :     {
     114         [ #  # ]:          0 :         if( *pServices++ == ServiceName )
     115                 :          0 :             return sal_True;
     116                 :            :     }
     117                 :            : 
     118         [ #  # ]:          0 :     return sal_False;
     119                 :            : }
     120                 :            : 
     121                 :            : // XNameContainer
     122                 :      14825 : void SAL_CALL SvxUnoXPropertyTable::insertByName( const  OUString& aName, const  uno::Any& aElement )
     123                 :            :     throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
     124                 :            : {
     125         [ +  - ]:      14825 :     SolarMutexGuard aGuard;
     126                 :            : 
     127         [ -  + ]:      14825 :     if( NULL == mpList )
     128         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     129                 :            : 
     130 [ +  - ][ -  + ]:      14825 :     if( hasByName( aName ) )
     131         [ #  # ]:          0 :         throw container::ElementExistException();
     132                 :            : 
     133         [ +  - ]:      14825 :     String aInternalName;
     134                 :      14825 :     SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
     135                 :            : 
     136         [ +  - ]:      14825 :     XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement );
     137         [ -  + ]:      14825 :     if( NULL == pNewEntry )
     138         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     139                 :            : 
     140         [ +  - ]:      14825 :     if( mpList )
     141 [ +  - ][ +  - ]:      14825 :         mpList->Insert( pNewEntry );
                 [ +  - ]
     142                 :      14825 : }
     143                 :            : 
     144                 :          0 : void SAL_CALL SvxUnoXPropertyTable::removeByName( const  OUString& Name )
     145                 :            :     throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
     146                 :            : {
     147         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     148                 :            : 
     149         [ #  # ]:          0 :     String aInternalName;
     150                 :          0 :     SvxUnogetInternalNameForItem( mnWhich, Name, aInternalName );
     151                 :            : 
     152         [ #  # ]:          0 :     const long nCount = getCount();
     153                 :            :     long i;
     154                 :            :     XPropertyEntry* pEntry;
     155         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     156                 :            :     {
     157         [ #  # ]:          0 :         pEntry = get( i );
     158 [ #  # ][ #  # ]:          0 :         if( pEntry && pEntry->GetName() == aInternalName )
         [ #  # ][ #  # ]
     159                 :            :         {
     160         [ #  # ]:          0 :             if( mpList )
     161 [ #  # ][ #  # ]:          0 :                 delete mpList->Remove( i );
                 [ #  # ]
     162                 :          0 :             return;
     163                 :            :         }
     164                 :            :     }
     165                 :            : 
     166 [ #  # ][ #  # ]:          0 :     throw container::NoSuchElementException();
                 [ #  # ]
     167                 :            : }
     168                 :            : 
     169                 :            : // XNameReplace
     170                 :          0 : void SAL_CALL SvxUnoXPropertyTable::replaceByName( const  OUString& aName, const  uno::Any& aElement )
     171                 :            :     throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
     172                 :            : {
     173         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     174                 :            : 
     175         [ #  # ]:          0 :     String aInternalName;
     176                 :          0 :     SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
     177                 :            : 
     178         [ #  # ]:          0 :     const long nCount = getCount();
     179                 :            :     long i;
     180                 :            :     XPropertyEntry* pEntry;
     181         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     182                 :            :     {
     183         [ #  # ]:          0 :         pEntry = get( i );
     184 [ #  # ][ #  # ]:          0 :         if( pEntry && pEntry->GetName() == aInternalName )
         [ #  # ][ #  # ]
     185                 :            :         {
     186         [ #  # ]:          0 :             XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement );
     187         [ #  # ]:          0 :             if( NULL == pNewEntry )
     188         [ #  # ]:          0 :                 throw lang::IllegalArgumentException();
     189                 :            : 
     190         [ #  # ]:          0 :             if( mpList )
     191 [ #  # ][ #  # ]:          0 :                 delete mpList->Replace( pNewEntry, i );
                 [ #  # ]
     192                 :          0 :             return;
     193                 :            :         }
     194                 :            :     }
     195                 :            : 
     196 [ #  # ][ #  # ]:          0 :     throw container::NoSuchElementException();
                 [ #  # ]
     197                 :            : }
     198                 :            : 
     199                 :            : // XNameAccess
     200                 :          0 : uno::Any SAL_CALL SvxUnoXPropertyTable::getByName( const  OUString& aName )
     201                 :            :     throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
     202                 :            : {
     203         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     204                 :            : 
     205         [ #  # ]:          0 :     String aInternalName;
     206                 :          0 :     SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
     207                 :            : 
     208         [ #  # ]:          0 :     const long nCount = getCount();
     209                 :            :     long i;
     210                 :            :     XPropertyEntry* pEntry;
     211         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     212                 :            :     {
     213         [ #  # ]:          0 :         pEntry = get( i );
     214                 :            : 
     215 [ #  # ][ #  # ]:          0 :         if( pEntry && pEntry->GetName() == aInternalName )
         [ #  # ][ #  # ]
     216                 :          0 :             return getAny( pEntry );
     217                 :            :     }
     218                 :            : 
     219 [ #  # ][ #  # ]:          0 :     throw container::NoSuchElementException();
                 [ #  # ]
     220                 :            : }
     221                 :            : 
     222                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXPropertyTable::getElementNames()
     223                 :            :     throw( uno::RuntimeException)
     224                 :            : {
     225         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     226                 :            : 
     227         [ #  # ]:          0 :     const long nCount = getCount();
     228         [ #  # ]:          0 :     uno::Sequence< OUString > aNames( nCount );
     229         [ #  # ]:          0 :     OUString* pNames = aNames.getArray();
     230                 :            :     long i;
     231                 :            :     XPropertyEntry* pEntry;
     232         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     233                 :            :     {
     234         [ #  # ]:          0 :         pEntry = get( i );
     235                 :            : 
     236         [ #  # ]:          0 :         if( pEntry )
     237                 :            :         {
     238                 :          0 :             SvxUnogetApiNameForItem( mnWhich, pEntry->GetName(), *pNames );
     239                 :          0 :             pNames++;
     240                 :            :         }
     241                 :            :     }
     242                 :            : 
     243         [ #  # ]:          0 :     return aNames;
     244                 :            : }
     245                 :            : 
     246                 :      29650 : sal_Bool SAL_CALL SvxUnoXPropertyTable::hasByName( const  OUString& aName )
     247                 :            :     throw( uno::RuntimeException)
     248                 :            : {
     249         [ +  - ]:      29650 :     SolarMutexGuard aGuard;
     250                 :            : 
     251         [ +  - ]:      29650 :     String aInternalName;
     252                 :      29650 :     SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
     253                 :            : 
     254 [ +  - ][ +  - ]:      29650 :     const long nCount = mpList?mpList->Count():0;
     255                 :            :     long i;
     256                 :            :     XPropertyEntry* pEntry;
     257         [ +  + ]:    1329520 :     for( i = 0; i < nCount; i++ )
     258                 :            :     {
     259         [ +  - ]:    1299870 :         pEntry = get( i );
     260 [ +  - ][ +  - ]:    1299870 :         if( pEntry && pEntry->GetName() == aInternalName )
         [ -  + ][ -  + ]
     261                 :          0 :             return sal_True;
     262                 :            :     }
     263                 :            : 
     264 [ +  - ][ +  - ]:      29650 :     return sal_False;
     265                 :            : }
     266                 :            : 
     267                 :            : // XElementAccess
     268                 :          0 : sal_Bool SAL_CALL SvxUnoXPropertyTable::hasElements(  )
     269                 :            :     throw( uno::RuntimeException)
     270                 :            : {
     271         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     272                 :            : 
     273 [ #  # ][ #  # ]:          0 :     return getCount() != 0;
     274                 :            : }
     275                 :            : 
     276                 :            : ///////////////////////////////////////////////////////////////////////
     277                 :            : 
     278         [ -  + ]:        264 : class SvxUnoXColorTable : public SvxUnoXPropertyTable
     279                 :            : {
     280                 :            : public:
     281                 :        132 :     SvxUnoXColorTable( XPropertyList* pList ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pList ) {};
     282                 :            : 
     283                 :            :     // SvxUnoXPropertyTable
     284                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
     285                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
     286                 :            : 
     287                 :            :     // XElementAccess
     288                 :            :     virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
     289                 :            : 
     290                 :            :     // XServiceInfo
     291                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
     292                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
     293                 :            : };
     294                 :            : 
     295                 :        132 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyList* pList ) throw()
     296                 :            : {
     297                 :        132 :     return (OWeakObject*) new SvxUnoXColorTable( pList );
     298                 :            : }
     299                 :            : 
     300                 :            : // SvxUnoXPropertyTable
     301                 :          0 : uno::Any SvxUnoXColorTable::getAny( const XPropertyEntry* pEntry ) const throw()
     302                 :            : {
     303                 :          0 :     uno::Any aAny;
     304         [ #  # ]:          0 :     aAny <<= (sal_Int32)((XColorEntry*)pEntry)->GetColor().GetColor();
     305                 :          0 :     return aAny;
     306                 :            : }
     307                 :            : 
     308                 :      12900 : XPropertyEntry* SvxUnoXColorTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
     309                 :            : {
     310                 :      12900 :     sal_Int32 nColor = 0;
     311         [ -  + ]:      12900 :     if( !(rAny >>= nColor) )
     312                 :          0 :         return NULL;
     313                 :            : 
     314                 :      12900 :     const Color aColor( (ColorData)nColor );
     315         [ +  - ]:      12900 :     const String aName( rName );
     316 [ +  - ][ +  - ]:      12900 :     return new XColorEntry( aColor, aName );
                 [ +  - ]
     317                 :            : }
     318                 :            : 
     319                 :            : // XElementAccess
     320                 :        129 : uno::Type SAL_CALL SvxUnoXColorTable::getElementType()
     321                 :            :     throw( uno::RuntimeException )
     322                 :            : {
     323                 :        129 :     return ::getCppuType((const sal_Int32*)0);
     324                 :            : }
     325                 :            : 
     326                 :            : // XServiceInfo
     327                 :          0 : OUString SAL_CALL SvxUnoXColorTable::getImplementationName(  ) throw( uno::RuntimeException )
     328                 :            : {
     329                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXColorTable" ) );
     330                 :            : }
     331                 :            : 
     332                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXColorTable::getSupportedServiceNames(  ) throw( uno::RuntimeException)
     333                 :            : {
     334         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ColorTable" ) );
     335         [ #  # ]:          0 :     uno::Sequence< OUString > aServices( &aServiceName, 1 );
     336                 :          0 :     return aServices;
     337                 :            : }
     338                 :            : 
     339                 :            : ///////////////////////////////////////////////////////////////////////
     340                 :            : 
     341         [ -  + ]:         22 : class SvxUnoXLineEndTable : public SvxUnoXPropertyTable
     342                 :            : {
     343                 :            : public:
     344                 :         11 :     SvxUnoXLineEndTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINEEND, pTable ) {};
     345                 :            : 
     346                 :            :     // SvxUnoXPropertyTable
     347                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
     348                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
     349                 :            : 
     350                 :            :     // XElementAccess
     351                 :            :     virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
     352                 :            : 
     353                 :            :     // XServiceInfo
     354                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
     355                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
     356                 :            : };
     357                 :            : 
     358                 :         11 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pTable ) throw()
     359                 :            : {
     360                 :         11 :     return (OWeakObject*)new SvxUnoXLineEndTable( pTable );
     361                 :            : }
     362                 :            : 
     363                 :            : // SvxUnoXPropertyTable
     364                 :          0 : uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw()
     365                 :            : {
     366                 :            : 
     367                 :          0 :     uno::Any aAny;
     368         [ #  # ]:          0 :     drawing::PolyPolygonBezierCoords aBezier;
     369                 :          0 :     basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( ((XLineEndEntry*)pEntry)->GetLineEnd(),
     370         [ #  # ]:          0 :                                                           aBezier );
     371         [ #  # ]:          0 :     aAny <<= aBezier;
     372         [ #  # ]:          0 :     return aAny;
     373                 :            : }
     374                 :            : 
     375                 :        160 : XPropertyEntry* SvxUnoXLineEndTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
     376                 :            : {
     377                 :            : 
     378 [ +  - ][ +  - ]:        160 :     if( !rAny.getValue() || rAny.getValueType() != ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
         [ -  + ][ -  + ]
     379                 :          0 :         return NULL;
     380                 :            : 
     381         [ +  - ]:        160 :     basegfx::B2DPolyPolygon aPolyPolygon;
     382                 :        160 :     drawing::PolyPolygonBezierCoords* pCoords = (drawing::PolyPolygonBezierCoords*)rAny.getValue();
     383         [ +  - ]:        160 :     if( pCoords->Coordinates.getLength() > 0 )
     384 [ +  - ][ +  - ]:        160 :         aPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
                 [ +  - ]
     385                 :            : 
     386                 :            :     // #86265# make sure polygon is closed
     387         [ +  - ]:        160 :     aPolyPolygon.setClosed(true);
     388                 :            : 
     389         [ +  - ]:        160 :     const String aName( rName );
     390 [ +  - ][ +  - ]:        160 :     return new XLineEndEntry( aPolyPolygon, aName );
         [ +  - ][ +  - ]
     391                 :            : }
     392                 :            : 
     393                 :            : // XElementAccess
     394                 :          8 : uno::Type SAL_CALL SvxUnoXLineEndTable::getElementType()
     395                 :            :     throw( uno::RuntimeException )
     396                 :            : {
     397                 :          8 :     return ::getCppuType((const drawing::PolyPolygonBezierCoords*)0);
     398                 :            : }
     399                 :            : 
     400                 :            : // XServiceInfo
     401                 :          0 : OUString SAL_CALL SvxUnoXLineEndTable::getImplementationName(  ) throw( uno::RuntimeException )
     402                 :            : {
     403                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXLineEndTable" ) );
     404                 :            : }
     405                 :            : 
     406                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXLineEndTable::getSupportedServiceNames(  ) throw( uno::RuntimeException)
     407                 :            : {
     408         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineEndTable" ) );
     409         [ #  # ]:          0 :     uno::Sequence< OUString > aServices( &aServiceName, 1 );
     410                 :          0 :     return aServices;
     411                 :            : }
     412                 :            : 
     413                 :            : ///////////////////////////////////////////////////////////////////////
     414                 :            : 
     415         [ -  + ]:        260 : class SvxUnoXDashTable : public SvxUnoXPropertyTable
     416                 :            : {
     417                 :            : public:
     418                 :        130 :     SvxUnoXDashTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINEDASH, pTable ) {};
     419                 :            : 
     420                 :            :     // SvxUnoXPropertyTable
     421                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
     422                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
     423                 :            : 
     424                 :            :     // XElementAccess
     425                 :            :     virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
     426                 :            : 
     427                 :            :     // XServiceInfo
     428                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
     429                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
     430                 :            : };
     431                 :            : 
     432                 :        130 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pTable ) throw()
     433                 :            : {
     434                 :        130 :     return (OWeakObject*)new SvxUnoXDashTable( pTable );
     435                 :            : }
     436                 :            : 
     437                 :            : // SvxUnoXPropertyTable
     438                 :          0 : uno::Any SvxUnoXDashTable::getAny( const XPropertyEntry* pEntry ) const throw()
     439                 :            : {
     440                 :          0 :     const XDash& rXD = ((XDashEntry*)pEntry)->GetDash();
     441                 :            : 
     442                 :          0 :     drawing::LineDash aLineDash;
     443                 :            : 
     444                 :          0 :     aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
     445                 :          0 :     aLineDash.Dots = rXD.GetDots();
     446                 :          0 :     aLineDash.DotLen = rXD.GetDotLen();
     447                 :          0 :     aLineDash.Dashes = rXD.GetDashes();
     448                 :          0 :     aLineDash.DashLen = rXD.GetDashLen();
     449                 :          0 :     aLineDash.Distance = rXD.GetDistance();
     450                 :            : 
     451                 :          0 :     uno::Any aAny;
     452         [ #  # ]:          0 :     aAny <<= aLineDash;
     453                 :          0 :     return aAny;
     454                 :            : }
     455                 :            : 
     456                 :       1397 : XPropertyEntry* SvxUnoXDashTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
     457                 :            : {
     458                 :       1397 :     drawing::LineDash aLineDash;
     459 [ -  + ][ +  - ]:       1397 :     if(!(rAny >>= aLineDash))
     460                 :          0 :         return NULL;
     461                 :            : 
     462         [ +  - ]:       1397 :     XDash aXDash;
     463                 :            : 
     464                 :       1397 :     aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
     465                 :       1397 :     aXDash.SetDots(aLineDash.Dots);
     466                 :       1397 :     aXDash.SetDotLen(aLineDash.DotLen);
     467                 :       1397 :     aXDash.SetDashes(aLineDash.Dashes);
     468                 :       1397 :     aXDash.SetDashLen(aLineDash.DashLen);
     469                 :       1397 :     aXDash.SetDistance(aLineDash.Distance);
     470                 :            : 
     471         [ +  - ]:       1397 :     const String aName( rName );
     472 [ +  - ][ +  - ]:       1397 :     return new XDashEntry( aXDash, aName );
                 [ +  - ]
     473                 :            : }
     474                 :            : 
     475                 :            : // XElementAccess
     476                 :        127 : uno::Type SAL_CALL SvxUnoXDashTable::getElementType()
     477                 :            :     throw( uno::RuntimeException )
     478                 :            : {
     479                 :        127 :     return ::getCppuType((const drawing::LineDash*)0);
     480                 :            : }
     481                 :            : 
     482                 :            : // XServiceInfo
     483                 :          0 : OUString SAL_CALL SvxUnoXDashTable::getImplementationName(  ) throw( uno::RuntimeException )
     484                 :            : {
     485                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXDashTable" ) );
     486                 :            : }
     487                 :            : 
     488                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXDashTable::getSupportedServiceNames(  ) throw( uno::RuntimeException)
     489                 :            : {
     490         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) );
     491         [ #  # ]:          0 :     uno::Sequence< OUString > aServices( &aServiceName, 1 );
     492                 :          0 :     return aServices;
     493                 :            : }
     494                 :            : 
     495                 :            : ///////////////////////////////////////////////////////////////////////
     496                 :            : 
     497         [ -  + ]:         22 : class SvxUnoXHatchTable : public SvxUnoXPropertyTable
     498                 :            : {
     499                 :            : public:
     500                 :         11 :     SvxUnoXHatchTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLHATCH, pTable ) {};
     501                 :            : 
     502                 :            :     // SvxUnoXPropertyTable
     503                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
     504                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
     505                 :            : 
     506                 :            :     // XElementAccess
     507                 :            :     virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
     508                 :            : 
     509                 :            :     // XServiceInfo
     510                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
     511                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
     512                 :            : };
     513                 :            : 
     514                 :         11 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pTable ) throw()
     515                 :            : {
     516                 :         11 :     return (OWeakObject*)new SvxUnoXHatchTable( pTable );
     517                 :            : }
     518                 :            : 
     519                 :            : // SvxUnoXPropertyTable
     520                 :          0 : uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw()
     521                 :            : {
     522                 :          0 :     const XHatch& aHatch = ((XHatchEntry*)pEntry)->GetHatch();
     523                 :            : 
     524                 :          0 :     drawing::Hatch aUnoHatch;
     525                 :            : 
     526                 :          0 :     aUnoHatch.Style = (drawing::HatchStyle)aHatch.GetHatchStyle();
     527                 :          0 :     aUnoHatch.Color = aHatch.GetColor().GetColor();
     528                 :          0 :     aUnoHatch.Distance = aHatch.GetDistance();
     529                 :          0 :     aUnoHatch.Angle = aHatch.GetAngle();
     530                 :            : 
     531                 :          0 :     uno::Any aAny;
     532         [ #  # ]:          0 :     aAny <<= aUnoHatch;
     533                 :          0 :     return aAny;
     534                 :            : }
     535                 :            : 
     536                 :         80 : XPropertyEntry* SvxUnoXHatchTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
     537                 :            : {
     538                 :         80 :     drawing::Hatch aUnoHatch;
     539 [ -  + ][ +  - ]:         80 :     if(!(rAny >>= aUnoHatch))
     540                 :          0 :         return NULL;
     541                 :            : 
     542                 :         80 :     XHatch aXHatch;
     543                 :         80 :     aXHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
     544                 :         80 :     aXHatch.SetColor( aUnoHatch.Color );
     545                 :         80 :     aXHatch.SetDistance( aUnoHatch.Distance );
     546                 :         80 :     aXHatch.SetAngle( aUnoHatch.Angle );
     547                 :            : 
     548         [ +  - ]:         80 :     const String aName( rName );
     549 [ +  - ][ +  - ]:         80 :     return new XHatchEntry( aXHatch, aName );
                 [ +  - ]
     550                 :            : }
     551                 :            : 
     552                 :            : // XElementAccess
     553                 :          8 : uno::Type SAL_CALL SvxUnoXHatchTable::getElementType()
     554                 :            :     throw( uno::RuntimeException )
     555                 :            : {
     556                 :          8 :     return ::getCppuType((const drawing::Hatch*)0);
     557                 :            : }
     558                 :            : 
     559                 :            : // XServiceInfo
     560                 :          0 : OUString SAL_CALL SvxUnoXHatchTable::getImplementationName(  ) throw( uno::RuntimeException )
     561                 :            : {
     562                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXHatchTable" ) );
     563                 :            : }
     564                 :            : 
     565                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXHatchTable::getSupportedServiceNames(  ) throw( uno::RuntimeException)
     566                 :            : {
     567         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) );
     568         [ #  # ]:          0 :     uno::Sequence< OUString > aServices( &aServiceName, 1 );
     569                 :          0 :     return aServices;
     570                 :            : }
     571                 :            : 
     572                 :            : ///////////////////////////////////////////////////////////////////////
     573                 :            : 
     574         [ -  + ]:         22 : class SvxUnoXGradientTable : public SvxUnoXPropertyTable
     575                 :            : {
     576                 :            : public:
     577                 :         11 :     SvxUnoXGradientTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLGRADIENT, pTable ) {};
     578                 :            : 
     579                 :            :     // SvxUnoXPropertyTable
     580                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
     581                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
     582                 :            : 
     583                 :            :     // XElementAccess
     584                 :            :     virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
     585                 :            : 
     586                 :            :     // XServiceInfo
     587                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
     588                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
     589                 :            : };
     590                 :            : 
     591                 :         11 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pTable ) throw()
     592                 :            : {
     593                 :         11 :     return (OWeakObject*)new SvxUnoXGradientTable( pTable );
     594                 :            : }
     595                 :            : 
     596                 :            : // SvxUnoXPropertyTable
     597                 :          0 : uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const throw()
     598                 :            : {
     599                 :          0 :     const XGradient& aXGradient = ((XGradientEntry*)pEntry)->GetGradient();
     600                 :          0 :     awt::Gradient aGradient;
     601                 :            : 
     602                 :          0 :     aGradient.Style = (awt::GradientStyle) aXGradient.GetGradientStyle();
     603                 :          0 :     aGradient.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
     604                 :          0 :     aGradient.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
     605                 :          0 :     aGradient.Angle = (short)aXGradient.GetAngle();
     606                 :          0 :     aGradient.Border = aXGradient.GetBorder();
     607                 :          0 :     aGradient.XOffset = aXGradient.GetXOffset();
     608                 :          0 :     aGradient.YOffset = aXGradient.GetYOffset();
     609                 :          0 :     aGradient.StartIntensity = aXGradient.GetStartIntens();
     610                 :          0 :     aGradient.EndIntensity = aXGradient.GetEndIntens();
     611                 :          0 :     aGradient.StepCount = aXGradient.GetSteps();
     612                 :            : 
     613                 :          0 :     uno::Any aAny;
     614         [ #  # ]:          0 :     aAny <<= aGradient;
     615                 :          0 :     return aAny;
     616                 :            : }
     617                 :            : 
     618                 :        120 : XPropertyEntry* SvxUnoXGradientTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
     619                 :            : {
     620                 :        120 :     awt::Gradient aGradient;
     621 [ -  + ][ +  - ]:        120 :     if(!(rAny >>= aGradient))
     622                 :          0 :         return NULL;
     623                 :            : 
     624         [ +  - ]:        120 :     XGradient aXGradient;
     625                 :            : 
     626                 :        120 :     aXGradient.SetGradientStyle( (XGradientStyle) aGradient.Style );
     627                 :        120 :     aXGradient.SetStartColor( aGradient.StartColor );
     628                 :        120 :     aXGradient.SetEndColor( aGradient.EndColor );
     629                 :        120 :     aXGradient.SetAngle( aGradient.Angle );
     630                 :        120 :     aXGradient.SetBorder( aGradient.Border );
     631                 :        120 :     aXGradient.SetXOffset( aGradient.XOffset );
     632                 :        120 :     aXGradient.SetYOffset( aGradient.YOffset );
     633                 :        120 :     aXGradient.SetStartIntens( aGradient.StartIntensity );
     634                 :        120 :     aXGradient.SetEndIntens( aGradient.EndIntensity );
     635                 :        120 :     aXGradient.SetSteps( aGradient.StepCount );
     636                 :            : 
     637         [ +  - ]:        120 :     const String aName( rName );
     638 [ +  - ][ +  - ]:        120 :     return new XGradientEntry( aXGradient, aName );
                 [ +  - ]
     639                 :            : }
     640                 :            : 
     641                 :            : // XElementAccess
     642                 :          8 : uno::Type SAL_CALL SvxUnoXGradientTable::getElementType()
     643                 :            :     throw( uno::RuntimeException )
     644                 :            : {
     645                 :          8 :     return ::getCppuType((const awt::Gradient*)0);
     646                 :            : }
     647                 :            : 
     648                 :            : // XServiceInfo
     649                 :          0 : OUString SAL_CALL SvxUnoXGradientTable::getImplementationName(  ) throw( uno::RuntimeException )
     650                 :            : {
     651                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXGradientTable" ) );
     652                 :            : }
     653                 :            : 
     654                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXGradientTable::getSupportedServiceNames(  ) throw( uno::RuntimeException)
     655                 :            : {
     656         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) );
     657         [ #  # ]:          0 :     uno::Sequence< OUString > aServices( &aServiceName, 1 );
     658                 :          0 :     return aServices;
     659                 :            : }
     660                 :            : 
     661                 :            : ///////////////////////////////////////////////////////////////////////
     662                 :            : 
     663         [ -  + ]:         22 : class SvxUnoXBitmapTable : public SvxUnoXPropertyTable
     664                 :            : {
     665                 :            : public:
     666                 :         11 :     SvxUnoXBitmapTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLBITMAP, pTable ) {};
     667                 :            : 
     668                 :            :     // SvxUnoXPropertyTable
     669                 :            :     virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
     670                 :            :     virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
     671                 :            : 
     672                 :            :     // XElementAccess
     673                 :            :     virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
     674                 :            : 
     675                 :            :     // XServiceInfo
     676                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
     677                 :            :     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
     678                 :            : };
     679                 :            : 
     680                 :         11 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pTable ) throw()
     681                 :            : {
     682                 :         11 :     return (OWeakObject*)new SvxUnoXBitmapTable( pTable );
     683                 :            : }
     684                 :            : 
     685                 :            : // SvxUnoXPropertyTable
     686                 :          0 : uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw()
     687                 :            : {
     688         [ #  # ]:          0 :     OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
     689                 :            :     aURL += OStringToOUString(
     690         [ #  # ]:          0 :         ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID(),
     691 [ #  # ][ #  # ]:          0 :         RTL_TEXTENCODING_ASCII_US);
     692                 :            : 
     693                 :          0 :     uno::Any aAny;
     694         [ #  # ]:          0 :     aAny <<= aURL;
     695                 :          0 :     return aAny;
     696                 :            : }
     697                 :            : 
     698                 :        168 : XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
     699                 :            : {
     700                 :        168 :     OUString aURL;
     701         [ -  + ]:        168 :     if(!(rAny >>= aURL))
     702                 :          0 :         return NULL;
     703                 :            : 
     704         [ +  - ]:        168 :     GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
     705         [ +  - ]:        168 :     XOBitmap aBMP( aGrafObj );
     706                 :            : 
     707         [ +  - ]:        168 :     const String aName( rName );
     708 [ +  - ][ +  - ]:        168 :     return new XBitmapEntry( aBMP, aName );
         [ +  - ][ +  - ]
                 [ +  - ]
     709                 :            : }
     710                 :            : 
     711                 :            : // XElementAccess
     712                 :          8 : uno::Type SAL_CALL SvxUnoXBitmapTable::getElementType()
     713                 :            :     throw( uno::RuntimeException )
     714                 :            : {
     715                 :          8 :     return ::getCppuType((const OUString*)0);
     716                 :            : }
     717                 :            : 
     718                 :            : // XServiceInfo
     719                 :          0 : OUString SAL_CALL SvxUnoXBitmapTable::getImplementationName(  ) throw( uno::RuntimeException )
     720                 :            : {
     721                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXBitmapTable" ) );
     722                 :            : }
     723                 :            : 
     724                 :          0 : uno::Sequence<  OUString > SAL_CALL SvxUnoXBitmapTable::getSupportedServiceNames(  ) throw( uno::RuntimeException)
     725                 :            : {
     726         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) );
     727         [ #  # ]:          0 :     uno::Sequence< OUString > aServices( &aServiceName, 1 );
     728                 :          0 :     return aServices;
     729                 :            : }
     730                 :            : 
     731                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10