LCOV - code coverage report
Current view: top level - oox/source/helper - propertymap.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 92 0.0 %
Date: 2014-04-14 Functions: 0 26 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 "oox/helper/propertymap.hxx"
      21             : #include "oox/helper/helper.hxx"
      22             : 
      23             : #if OSL_DEBUG_LEVEL > 0
      24             : # include <cstdio>
      25             : # include <com/sun/star/style/LineSpacing.hpp>
      26             : # include <com/sun/star/style/LineSpacingMode.hpp>
      27             : # include <com/sun/star/text/WritingMode.hpp>
      28             : using ::com::sun::star::style::LineSpacing;
      29             : using ::com::sun::star::text::WritingMode;
      30             : #endif
      31             : 
      32             : #include <com/sun/star/beans/PropertyValue.hpp>
      33             : #include <com/sun/star/beans/XPropertySet.hpp>
      34             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      35             : #include <com/sun/star/container/XIndexReplace.hpp>
      36             : #include <com/sun/star/awt/Rectangle.hpp>
      37             : #include <com/sun/star/awt/Size.hpp>
      38             : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
      39             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      40             : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      41             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      42             : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
      43             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      44             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
      45             : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
      46             : #include <cppuhelper/implbase2.hxx>
      47             : #include <osl/mutex.hxx>
      48             : #include "oox/token/propertynames.hxx"
      49             : using ::com::sun::star::uno::Any;
      50             : using ::com::sun::star::uno::Reference;
      51             : using ::com::sun::star::uno::RuntimeException;
      52             : using ::com::sun::star::uno::Sequence;
      53             : using ::com::sun::star::lang::IllegalArgumentException;
      54             : using ::com::sun::star::lang::WrappedTargetException;
      55             : using ::com::sun::star::beans::Property;
      56             : using ::com::sun::star::beans::PropertyValue;
      57             : using ::com::sun::star::beans::PropertyVetoException;
      58             : using ::com::sun::star::beans::UnknownPropertyException;
      59             : using ::com::sun::star::beans::XPropertyChangeListener;
      60             : using ::com::sun::star::beans::XPropertySet;
      61             : using ::com::sun::star::beans::XPropertySetInfo;
      62             : using ::com::sun::star::beans::XVetoableChangeListener;
      63             : using ::com::sun::star::container::XIndexReplace;
      64             : 
      65             : #if OSL_DEBUG_LEVEL > 0
      66             : #include <cstdio>
      67             : #include <com/sun/star/style/LineSpacing.hpp>
      68             : #include <com/sun/star/style/LineSpacingMode.hpp>
      69             : #include <com/sun/star/text/WritingMode.hpp>
      70             : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
      71             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      72             : #define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
      73             : using namespace ::com::sun::star;
      74             : using namespace ::com::sun::star::drawing;
      75             : using namespace ::com::sun::star::uno;
      76             : using ::com::sun::star::style::LineSpacing;
      77             : using ::com::sun::star::text::WritingMode;
      78             : using ::com::sun::star::drawing::TextHorizontalAdjust;
      79             : using ::com::sun::star::drawing::TextVerticalAdjust;
      80             : #endif
      81             : 
      82             : namespace oox {
      83             : using ::com::sun::star::container::XIndexReplace;
      84             : 
      85             : using namespace ::com::sun::star::beans;
      86             : using namespace ::com::sun::star::lang;
      87             : using namespace ::com::sun::star::drawing;
      88             : using namespace ::com::sun::star::uno;
      89             : using ::com::sun::star::drawing::TextHorizontalAdjust;
      90             : using ::com::sun::star::drawing::TextVerticalAdjust;
      91             : 
      92             : namespace {
      93             : 
      94             : typedef ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo > GenericPropertySetBase;
      95             : 
      96             : /** This class implements a generic XPropertySet.
      97             : 
      98             :     Properties of all names and types can be set and later retrieved.
      99             :     TODO: move this to comphelper or better find an existing implementation
     100             :  */
     101           0 : class GenericPropertySet : public GenericPropertySetBase
     102             : {
     103             : public:
     104             :     explicit            GenericPropertySet( const PropertyMap& rPropMap );
     105             : 
     106             :     // XPropertySet
     107             :     virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     108             :     virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     110             :     virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     114             : 
     115             :     // XPropertySetInfo
     116             :     virtual Sequence< Property > SAL_CALL getProperties() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     117             :     virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException, std::exception) SAL_OVERRIDE;
     118             :     virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             : private:
     121             :     osl::Mutex mMutex;
     122             :     PropertyNameMap     maPropMap;
     123             : };
     124             : 
     125           0 : GenericPropertySet::GenericPropertySet( const PropertyMap& rPropMap )
     126             : {
     127           0 :     rPropMap.fillPropertyNameMap(maPropMap);
     128           0 : }
     129             : 
     130           0 : Reference< XPropertySetInfo > SAL_CALL GenericPropertySet::getPropertySetInfo() throw (RuntimeException, std::exception)
     131             : {
     132           0 :     return this;
     133             : }
     134             : 
     135           0 : void SAL_CALL GenericPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
     136             : {
     137           0 :     ::osl::MutexGuard aGuard( mMutex );
     138           0 :     maPropMap[ rPropertyName ] = rValue;
     139           0 : }
     140             : 
     141           0 : Any SAL_CALL GenericPropertySet::getPropertyValue( const OUString& rPropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
     142             : {
     143           0 :     PropertyNameMap::iterator aIt = maPropMap.find( rPropertyName );
     144           0 :     if( aIt == maPropMap.end() )
     145           0 :         throw UnknownPropertyException();
     146           0 :     return aIt->second;
     147             : }
     148             : 
     149             : // listeners are not supported by this implementation
     150           0 : void SAL_CALL GenericPropertySet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) {}
     151           0 : void SAL_CALL GenericPropertySet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >&  ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) {}
     152           0 : void SAL_CALL GenericPropertySet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >&  ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) {}
     153           0 : void SAL_CALL GenericPropertySet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >&  ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) {}
     154             : 
     155             : // XPropertySetInfo
     156           0 : Sequence< Property > SAL_CALL GenericPropertySet::getProperties() throw (RuntimeException, std::exception)
     157             : {
     158           0 :     Sequence< Property > aSeq( static_cast< sal_Int32 >( maPropMap.size() ) );
     159           0 :     Property* pProperty = aSeq.getArray();
     160           0 :     for( PropertyNameMap::iterator aIt = maPropMap.begin(), aEnd = maPropMap.end(); aIt != aEnd; ++aIt, ++pProperty )
     161             :     {
     162           0 :         pProperty->Name = aIt->first;
     163           0 :         pProperty->Handle = 0;
     164           0 :         pProperty->Type = aIt->second.getValueType();
     165           0 :         pProperty->Attributes = 0;
     166             :     }
     167           0 :     return aSeq;
     168             : }
     169             : 
     170           0 : Property SAL_CALL GenericPropertySet::getPropertyByName( const OUString& rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
     171             : {
     172           0 :     PropertyNameMap::iterator aIt = maPropMap.find( rPropertyName );
     173           0 :     if( aIt == maPropMap.end() )
     174           0 :         throw UnknownPropertyException();
     175           0 :     Property aProperty;
     176           0 :     aProperty.Name = aIt->first;
     177           0 :     aProperty.Handle = 0;
     178           0 :     aProperty.Type = aIt->second.getValueType();
     179           0 :     aProperty.Attributes = 0;
     180           0 :     return aProperty;
     181             : }
     182             : 
     183           0 : sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rPropertyName ) throw (RuntimeException, std::exception)
     184             : {
     185           0 :     return maPropMap.find( rPropertyName ) != maPropMap.end();
     186             : }
     187             : 
     188             : } // namespace
     189             : 
     190           0 : PropertyMap::PropertyMap() :
     191           0 :     mpPropNames( &StaticPropertyNameVector::get() ) // pointer instead reference to get compiler generated copy c'tor and operator=
     192             : {
     193           0 : }
     194             : 
     195           0 : bool PropertyMap::hasProperty( sal_Int32 nPropId ) const
     196             : {
     197           0 :     return maProperties.find( nPropId ) != maProperties.end();
     198             : }
     199             : 
     200           0 : bool PropertyMap::setAnyProperty( sal_Int32 nPropId, const Any& rValue )
     201             : {
     202           0 :     if( nPropId < 0 )
     203           0 :         return false;
     204             : 
     205           0 :     maProperties[ nPropId ] = rValue;
     206           0 :     return true;
     207             : }
     208             : 
     209           0 : Any PropertyMap::getProperty( sal_Int32 nPropId )
     210             : {
     211           0 :     return maProperties[ nPropId ];
     212             : }
     213             : 
     214           0 : void PropertyMap::erase( sal_Int32 nPropId )
     215             : {
     216           0 :     maProperties.erase(nPropId);
     217           0 : }
     218             : 
     219           0 : bool PropertyMap::empty() const
     220             : {
     221           0 :     return maProperties.empty();
     222             : }
     223             : 
     224           0 : void PropertyMap::assignUsed( const PropertyMap& rPropMap )
     225             : {
     226           0 :     maProperties.insert(rPropMap.maProperties.begin(), rPropMap.maProperties.end());
     227           0 : }
     228             : 
     229           0 : const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
     230             : {
     231             :     OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
     232           0 :     return StaticPropertyNameVector::get()[ nPropId ];
     233             : }
     234             : 
     235           0 : void PropertyMap::assignAll( const PropertyMap& rPropMap )
     236             : {
     237           0 :     for( PropertyMapType::const_iterator it=rPropMap.maProperties.begin(); it != rPropMap.maProperties.end(); ++it )
     238           0 :         maProperties[it->first] = it->second;
     239           0 : }
     240             : 
     241           0 : Sequence< PropertyValue > PropertyMap::makePropertyValueSequence() const
     242             : {
     243           0 :     Sequence< PropertyValue > aSeq( static_cast< sal_Int32 >( maProperties.size() ) );
     244           0 :     if( !maProperties.empty() )
     245             :     {
     246           0 :         PropertyValue* pValues = aSeq.getArray();
     247           0 :         for( PropertyMapType::const_iterator aIt = maProperties.begin(), aEnd = maProperties.end(); aIt != aEnd; ++aIt, ++pValues )
     248             :         {
     249             :             OSL_ENSURE( (0 <= aIt->first) && (aIt->first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" );
     250           0 :             pValues->Name = (*mpPropNames)[ aIt->first ];
     251           0 :             pValues->Value = aIt->second;
     252           0 :             pValues->State = PropertyState_DIRECT_VALUE;
     253             :         }
     254             :     }
     255           0 :     return aSeq;
     256             : }
     257             : 
     258           0 : void PropertyMap::fillSequences( Sequence< OUString >& rNames, Sequence< Any >& rValues ) const
     259             : {
     260           0 :     rNames.realloc( static_cast< sal_Int32 >( maProperties.size() ) );
     261           0 :     rValues.realloc( static_cast< sal_Int32 >( maProperties.size() ) );
     262           0 :     if( !maProperties.empty() )
     263             :     {
     264           0 :         OUString* pNames = rNames.getArray();
     265           0 :         Any* pValues = rValues.getArray();
     266           0 :         for( PropertyMapType::const_iterator aIt = maProperties.begin(), aEnd = maProperties.end(); aIt != aEnd; ++aIt, ++pNames, ++pValues )
     267             :         {
     268             :             OSL_ENSURE( (0 <= aIt->first) && (aIt->first < PROP_COUNT), "PropertyMap::fillSequences - invalid property identifier" );
     269           0 :             *pNames = (*mpPropNames)[ aIt->first ];
     270           0 :             *pValues = aIt->second;
     271             :         }
     272             :     }
     273           0 : }
     274             : 
     275           0 : void PropertyMap::fillPropertyNameMap(PropertyNameMap& rMap) const
     276             : {
     277           0 :     for(PropertyMapType::const_iterator itr = maProperties.begin(),
     278           0 :             itrEnd = maProperties.end(); itr != itrEnd; ++itr)
     279             :     {
     280           0 :         rMap.insert(std::pair<OUString, Any>((*mpPropNames)[itr->first], itr->second));
     281             :     }
     282           0 : }
     283             : 
     284           0 : Reference< XPropertySet > PropertyMap::makePropertySet() const
     285             : {
     286           0 :     return new GenericPropertySet( *this );
     287             : }
     288             : 
     289             : #if OSL_DEBUG_LEVEL > 0
     290             : static void lclDumpAnyValue( Any value)
     291             : {
     292             :         OUString strValue;
     293             :         Sequence< OUString > strArray;
     294             :         Sequence< Any > anyArray;
     295             :         Sequence< PropertyValue > propArray;
     296             :         Sequence< Sequence< PropertyValue > > propArrayArray;
     297             :         Sequence< EnhancedCustomShapeAdjustmentValue > adjArray;
     298             :         Sequence< EnhancedCustomShapeSegment > segArray;
     299             :         Sequence< EnhancedCustomShapeParameterPair > ppArray;
     300             :         EnhancedCustomShapeSegment segment;
     301             :         EnhancedCustomShapeParameterPair pp;
     302             :         EnhancedCustomShapeParameter par;
     303             :         HomogenMatrix3 aMatrix;
     304             :         sal_Int32 intValue = 0;
     305             :         sal_uInt32 uintValue = 0;
     306             :         sal_Int16 int16Value = 0;
     307             :         sal_uInt16 uint16Value = 0;
     308             :         float floatValue = 0;
     309             :         bool boolValue = false;
     310             :     LineSpacing spacing;
     311             : //         RectanglePoint pointValue;
     312             :     WritingMode aWritingMode;
     313             :     TextVerticalAdjust aTextVertAdj;
     314             :     TextHorizontalAdjust aTextHorizAdj;
     315             :     Reference< XIndexReplace > xNumRule;
     316             : 
     317             :         if( value >>= strValue )
     318             :             fprintf (stderr,"\"%s\"\n", USS( strValue ) );
     319             :         else if( value >>= strArray ) {
     320             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     321             :             for( int i=0; i<strArray.getLength(); i++ )
     322             :                 fprintf (stderr,"\t\t\t[%3d] \"%s\"\n", i, USS( strArray[i] ) );
     323             :         } else if( value >>= propArray ) {
     324             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     325             :             for( int i=0; i<propArray.getLength(); i++ ) {
     326             :                 fprintf (stderr,"\t\t\t[%3d] %s (%s) ", i, USS( propArray[i].Name ), USS(propArray[i].Value.getValueTypeName()) );
     327             :                 lclDumpAnyValue( propArray[i].Value );
     328             :             }
     329             :         } else if( value >>= propArrayArray ) {
     330             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     331             :             for( int i=0; i<propArrayArray.getLength(); i++ ) {
     332             :                 fprintf (stderr,"\t\t\t[%3d] ", i);
     333             :                 lclDumpAnyValue( makeAny (propArrayArray[i]) );
     334             :             }
     335             :         } else if( value >>= anyArray ) {
     336             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     337             :             for( int i=0; i<anyArray.getLength(); i++ ) {
     338             :                 fprintf (stderr,"\t\t\t[%3d] (%s) ", i, USS(value.getValueTypeName()) );
     339             :                 lclDumpAnyValue( anyArray[i] );
     340             :             }
     341             :         } else if( value >>= adjArray ) {
     342             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     343             :             for( int i=0; i<adjArray.getLength(); i++ ) {
     344             :                 fprintf (stderr,"\t\t\t[%3d] (%s) ", i, USS(adjArray[i].Value.getValueTypeName()) );
     345             :                 lclDumpAnyValue( adjArray[i].Value );
     346             :             }
     347             :         } else if( value >>= segArray ) {
     348             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     349             :             for( int i=0; i<segArray.getLength(); i++ ) {
     350             :                 fprintf (stderr,"\t\t\t[%3d] ", i );
     351             :                 lclDumpAnyValue( makeAny( segArray[i] ) );
     352             :             }
     353             :         } else if( value >>= ppArray ) {
     354             :             fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     355             :             for( int i=0; i<ppArray.getLength(); i++ ) {
     356             :                 fprintf (stderr,"\t\t\t[%3d] ", i );
     357             :                 lclDumpAnyValue( makeAny( ppArray[i] ) );
     358             :             }
     359             :         } else if( value >>= segment ) {
     360             :             fprintf (stderr,"Command: %d Count: %d\n", segment.Command, segment.Count);
     361             :         } else if( value >>= pp ) {
     362             :             fprintf (stderr,"First: ");
     363             :             lclDumpAnyValue( makeAny (pp.First) );
     364             :             fprintf (stderr,"\t\t\t      Second: ");
     365             :             lclDumpAnyValue( makeAny (pp.Second) );
     366             :         } else if( value >>= par ) {
     367             :             fprintf (stderr,"Parameter (%s): ", USS(par.Value.getValueTypeName()));
     368             :             lclDumpAnyValue( par.Value );
     369             :         } else if( value >>= aMatrix ) {
     370             :             fprintf (stderr,"Matrix\n%f %f %f\n%f %f %f\n%f %f %f\n", aMatrix.Line1.Column1, aMatrix.Line1.Column2, aMatrix.Line1.Column3, aMatrix.Line2.Column1, aMatrix.Line2.Column2, aMatrix.Line2.Column3, aMatrix.Line3.Column1, aMatrix.Line3.Column2, aMatrix.Line3.Column3);
     371             :         } else if( value >>= intValue )
     372             :             fprintf (stderr,"%" SAL_PRIdINT32 "            (hex: %" SAL_PRIxUINT32 ")\n", intValue, intValue);
     373             :         else if( value >>= uintValue )
     374             :             fprintf (stderr,"%" SAL_PRIuUINT32 "            (hex: %" SAL_PRIxUINT32 ")\n", uintValue, uintValue);
     375             :         else if( value >>= int16Value )
     376             :             fprintf (stderr,"%d            (hex: %x)\n", int16Value, int16Value);
     377             :         else if( value >>= uint16Value )
     378             :             fprintf (stderr,"%d            (hex: %x)\n", uint16Value, uint16Value);
     379             :         else if( value >>= floatValue )
     380             :             fprintf (stderr,"%f\n", floatValue);
     381             :         else if( value >>= boolValue )
     382             :             fprintf (stderr,"%d            (bool)\n", boolValue);
     383             :         else if( value >>= xNumRule ) {
     384             :             fprintf (stderr, "XIndexReplace\n");
     385             :             if (xNumRule.is()) {
     386             :                 for (int k=0; k<xNumRule->getCount(); k++) {
     387             :                     Sequence< PropertyValue > aBulletPropSeq;
     388             :                     fprintf (stderr, "level %d\n", k);
     389             :                     if (xNumRule->getByIndex (k) >>= aBulletPropSeq) {
     390             :                         for (int j=0; j<aBulletPropSeq.getLength(); j++) {
     391             :                             fprintf(stderr, "%46s = ", USS (aBulletPropSeq[j].Name));
     392             :                             lclDumpAnyValue (aBulletPropSeq[j].Value);
     393             :                         }
     394             :                     }
     395             :                 }
     396             :             } else {
     397             :                 fprintf (stderr, "empty reference\n");
     398             :             }
     399             :         } else if( value >>= aWritingMode )
     400             :             fprintf (stderr, "%d writing mode\n", aWritingMode);
     401             :         else if( value >>= aTextVertAdj ) {
     402             :             const char* s = "unknown";
     403             :             switch( aTextVertAdj ) {
     404             :             case TextVerticalAdjust_TOP:
     405             :                 s = "top";
     406             :                 break;
     407             :             case TextVerticalAdjust_CENTER:
     408             :                 s = "center";
     409             :                 break;
     410             :             case TextVerticalAdjust_BOTTOM:
     411             :                 s = "bottom";
     412             :                 break;
     413             :             case TextVerticalAdjust_BLOCK:
     414             :                 s = "block";
     415             :                 break;
     416             :             case TextVerticalAdjust_MAKE_FIXED_SIZE:
     417             :                 s = "make_fixed_size";
     418             :                 break;
     419             :         }
     420             :         fprintf (stderr, "%s\n", s);
     421             :     } else if( value >>= aTextHorizAdj ) {
     422             :         const char* s = "unknown";
     423             :         switch( aTextHorizAdj ) {
     424             :             case TextHorizontalAdjust_LEFT:
     425             :                 s = "left";
     426             :                 break;
     427             :             case TextHorizontalAdjust_CENTER:
     428             :                 s = "center";
     429             :                 break;
     430             :             case TextHorizontalAdjust_RIGHT:
     431             :                 s = "right";
     432             :                 break;
     433             :             case TextHorizontalAdjust_BLOCK:
     434             :                 s = "block";
     435             :                 break;
     436             :             case TextHorizontalAdjust_MAKE_FIXED_SIZE:
     437             :                 s = "make_fixed_size";
     438             :                 break;
     439             :         }
     440             :         fprintf (stderr, "%s\n", s);
     441             :     } else if( value >>= spacing ) {
     442             :         fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
     443             :     } else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) {
     444             :         fprintf (stderr,"is extractable to int32\n");
     445             :     }
     446             : //         else if( value >>= pointValue )
     447             : //             fprintf (stderr,"%d            (RectanglePoint)\n", pointValue);
     448             :         else
     449             :       fprintf (stderr,"???           <unhandled type %s>\n", USS(value.getValueTypeName()));
     450             : }
     451             : 
     452             : #ifdef DBG_UTIL
     453             : void PropertyMap::dump( Reference< XPropertySet > rXPropSet )
     454             : {
     455             :     Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
     456             :     Sequence< Property > props = info->getProperties ();
     457             : 
     458             :     OSL_TRACE("dump props, len: %d", props.getLength ());
     459             : 
     460             :     for (int i=0; i < props.getLength (); i++) {
     461             :         OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
     462             :         fprintf (stderr,"%30s = ", name.getStr() );
     463             : 
     464             :         try {
     465             :             lclDumpAnyValue (rXPropSet->getPropertyValue( props [i].Name ));
     466             :         } catch (const Exception&) {
     467             :             fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
     468             :         }
     469             :     }
     470             : }
     471             : #endif
     472             : 
     473             : static void printLevel (int level)
     474             : {
     475             :     for (int i=0; i<level; i++)
     476             :         fprintf (stderr, "    ");
     477             : }
     478             : 
     479             : static const char *lclGetEnhancedParameterType( sal_uInt16 nType )
     480             : {
     481             :     const char* type;
     482             :     switch (nType) {
     483             :     case EnhancedCustomShapeParameterType::NORMAL:
     484             :         type = "EnhancedCustomShapeParameterType::NORMAL";
     485             :         break;
     486             :     case EnhancedCustomShapeParameterType::EQUATION:
     487             :         type = "EnhancedCustomShapeParameterType::EQUATION";
     488             :         break;
     489             :     case EnhancedCustomShapeParameterType::ADJUSTMENT:
     490             :         type = "EnhancedCustomShapeParameterType::ADJUSTMENT";
     491             :         break;
     492             :     case EnhancedCustomShapeParameterType::LEFT:
     493             :         type = "EnhancedCustomShapeParameterType::LEFT";
     494             :         break;
     495             :     case EnhancedCustomShapeParameterType::TOP:
     496             :         type = "EnhancedCustomShapeParameterType::TOP";
     497             :         break;
     498             :     case EnhancedCustomShapeParameterType::RIGHT:
     499             :         type = "EnhancedCustomShapeParameterType::RIGHT";
     500             :         break;
     501             :     case EnhancedCustomShapeParameterType::BOTTOM:
     502             :         type = "EnhancedCustomShapeParameterType::BOTTOM";
     503             :         break;
     504             :     case EnhancedCustomShapeParameterType::XSTRETCH:
     505             :         type = "EnhancedCustomShapeParameterType::XSTRETCH";
     506             :         break;
     507             :     case EnhancedCustomShapeParameterType::YSTRETCH:
     508             :         type = "EnhancedCustomShapeParameterType::YSTRETCH";
     509             :         break;
     510             :     case EnhancedCustomShapeParameterType::HASSTROKE:
     511             :         type = "EnhancedCustomShapeParameterType::HASSTROKE";
     512             :         break;
     513             :     case EnhancedCustomShapeParameterType::HASFILL:
     514             :         type = "EnhancedCustomShapeParameterType::HASFILL";
     515             :         break;
     516             :     case EnhancedCustomShapeParameterType::WIDTH:
     517             :         type = "EnhancedCustomShapeParameterType::WIDTH";
     518             :         break;
     519             :     case EnhancedCustomShapeParameterType::HEIGHT:
     520             :         type = "EnhancedCustomShapeParameterType::HEIGHT";
     521             :         break;
     522             :     case EnhancedCustomShapeParameterType::LOGWIDTH:
     523             :         type = "EnhancedCustomShapeParameterType::LOGWIDTH";
     524             :         break;
     525             :     case EnhancedCustomShapeParameterType::LOGHEIGHT:
     526             :         type = "EnhancedCustomShapeParameterType::LOGHEIGHT";
     527             :         break;
     528             :     default:
     529             :         type = "unknown";
     530             :         break;
     531             :     }
     532             :     return type;
     533             : }
     534             : 
     535             : static void printParameterPairData(int level, EnhancedCustomShapeParameterPair &pp)
     536             : {
     537             :     // These are always sal_Int32s so lets depend on that for our packing ...
     538             :     sal_Int32 nFirstValue, nSecondValue;
     539             :     if (!(pp.First.Value >>= nFirstValue))
     540             :         assert (false);
     541             :     if (!(pp.Second.Value >>= nSecondValue))
     542             :         assert (false);
     543             : 
     544             :     printLevel (level);
     545             :     fprintf (stderr, "{\n");
     546             :     printLevel (level + 1);
     547             :     fprintf (stderr, "%s,\n", lclGetEnhancedParameterType(pp.First.Type));
     548             :     printLevel (level + 1);
     549             :     fprintf (stderr, "%s,\n", lclGetEnhancedParameterType(pp.Second.Type));
     550             :     printLevel (level + 1);
     551             :     fprintf (stderr, "%d, %d\n", (int)nFirstValue, (int)nSecondValue);
     552             :     printLevel (level);
     553             :     fprintf (stderr, "}");
     554             : }
     555             : 
     556             : static const char* lclDumpAnyValueCode( Any value, int level = 0)
     557             : {
     558             :     OUString strValue;
     559             :     Sequence< OUString > strArray;
     560             :     Sequence< Any > anyArray;
     561             :     Sequence< awt::Size > sizeArray;
     562             :     Sequence< PropertyValue > propArray;
     563             :     Sequence< Sequence< PropertyValue > > propArrayArray;
     564             :     Sequence< EnhancedCustomShapeAdjustmentValue > adjArray;
     565             :     Sequence< EnhancedCustomShapeTextFrame > segTextFrame;
     566             :     Sequence< EnhancedCustomShapeSegment > segArray;
     567             :     Sequence< EnhancedCustomShapeParameterPair > ppArray;
     568             :     EnhancedCustomShapeSegment segment;
     569             :     EnhancedCustomShapeTextFrame textFrame;
     570             :     EnhancedCustomShapeParameterPair pp;
     571             :     EnhancedCustomShapeParameter par;
     572             :     awt::Rectangle rect;
     573             :     awt::Size size;
     574             :     sal_Int32 intValue;
     575             :     sal_uInt32 uintValue;
     576             :     sal_Int16 int16Value;
     577             :     sal_uInt16 uint16Value;
     578             :     long longValue;
     579             :     float floatValue = 0;
     580             :     bool boolValue;
     581             :     LineSpacing spacing;
     582             : //         RectanglePoint pointValue;
     583             :     WritingMode aWritingMode;
     584             :     TextVerticalAdjust aTextVertAdj;
     585             :     TextHorizontalAdjust aTextHorizAdj;
     586             :     Reference< XIndexReplace > xNumRule;
     587             : 
     588             :     if( value >>= strValue )
     589             :     {
     590             :         printLevel (level);
     591             :         fprintf (stderr,"OUString str = \"%s\";\n", USS( strValue ) );
     592             :         return "Any (str)";
     593             :     }
     594             :     else if( value >>= strArray )
     595             :     {
     596             :         if (strArray.getLength() == 0)
     597             :             return "Sequence< OUString >(0)";
     598             : 
     599             :         printLevel (level);
     600             :         fprintf (stderr,"static const char *aStrings[] = {\n");
     601             :         for( int i=0; i<strArray.getLength(); i++ ) {
     602             :             printLevel (level + 1);
     603             :             fprintf (stderr,"\"%s\"%s\n", USS( strArray[i] ), i < strArray.getLength() - 1 ? "," : "" );
     604             :         }
     605             :         printLevel (level);
     606             :         fprintf (stderr,"};\n");
     607             :         return "createStringSequence( SAL_N_ELEMENTS( aStrings ), aStrings )";
     608             :     }
     609             :     else if( value >>= propArray )
     610             :     {
     611             :         printLevel (level);
     612             :         fprintf (stderr,"Sequence< PropertyValue > aPropSequence (%" SAL_PRIdINT32 ");\n", propArray.getLength());
     613             :         for( int i=0; i<propArray.getLength(); i++ ) {
     614             :             printLevel (level);
     615             :             fprintf (stderr, "{\n");
     616             :             printLevel (level + 1);
     617             :             fprintf (stderr, "aPropSequence [%d].Name = \"%s\";\n", i, USS( propArray[i].Name ));
     618             :             const char *var = lclDumpAnyValueCode( propArray[i].Value, level + 1 );
     619             :             printLevel (level + 1);
     620             :             fprintf (stderr, "aPropSequence [%d].Value = makeAny (%s);\n", i, var);
     621             :             printLevel (level);
     622             :             fprintf (stderr, "}\n");
     623             :         }
     624             :         return "aPropSequence";
     625             :     }
     626             :     else if( value >>= sizeArray )
     627             :     {
     628             :         printLevel (level);
     629             :         fprintf (stderr, "Sequence< awt::Size > aSizeSequence (%" SAL_PRIdINT32 ");\n", sizeArray.getLength());
     630             :         for( int i=0; i<sizeArray.getLength(); i++ ) {
     631             :             printLevel (level);
     632             :             fprintf (stderr, "{\n");
     633             :             const char *var = lclDumpAnyValueCode (makeAny (sizeArray[i]), level + 1);
     634             :             printLevel (level + 1);
     635             :             fprintf (stderr, "aSizeSequence [%d] = %s;\n", i, var);
     636             :             printLevel (level);
     637             :             fprintf (stderr, "}\n");
     638             :         }
     639             :         return "aSizeSequence";
     640             :     }
     641             :     else if( value >>= propArrayArray )
     642             :     {
     643             :         printLevel (level);
     644             :         fprintf (stderr,"Sequence< Sequence < PropertyValue > > aPropSequenceSequence (%" SAL_PRIdINT32 ");\n", propArrayArray.getLength());
     645             :         for( int i=0; i<propArrayArray.getLength(); i++ ) {
     646             :             printLevel (level);
     647             :             fprintf (stderr, "{\n");
     648             :             const char *var = lclDumpAnyValueCode( makeAny (propArrayArray[i]), level + 1 );
     649             :             printLevel (level + 1);
     650             :             fprintf (stderr, "aPropSequenceSequence [%d] = %s;\n", i, var);
     651             :             printLevel (level);
     652             :             fprintf (stderr, "}\n");
     653             :         }
     654             :         return "aPropSequenceSequence";
     655             :     }
     656             :     else if( value >>= anyArray )
     657             :     {
     658             :         fprintf (stderr,"%s\n", USS(value.getValueTypeName()));
     659             :         for( int i=0; i<anyArray.getLength(); i++ ) {
     660             :             fprintf (stderr,"\t\t\t[%3d] (%s) ", i, USS(value.getValueTypeName()) );
     661             :             lclDumpAnyValue( anyArray[i] );
     662             :         }
     663             :     }
     664             :     else if( value >>= adjArray )
     665             :     {
     666             :         printLevel (level);
     667             :         fprintf (stderr,"Sequence< EnhancedCustomShapeAdjustmentValue > aAdjSequence (%" SAL_PRIdINT32 ");\n", adjArray.getLength());
     668             :         for( int i=0; i<adjArray.getLength(); i++ ) {
     669             :             printLevel (level);
     670             :             fprintf (stderr, "{\n");
     671             :             const char *var = lclDumpAnyValueCode( makeAny (adjArray[i].Value), level + 1 );
     672             :             printLevel (level + 1);
     673             :             fprintf (stderr, "aAdjSequence [%d].Value = %s;\n", i, var);
     674             :             if (adjArray[i].Name.getLength() > 0) {
     675             :                 printLevel (level + 1);
     676             :                 fprintf (stderr, "aAdjSequence [%d].Name = \"%s\";\n", i, USS (adjArray[i].Name));
     677             :             }
     678             :             printLevel (level);
     679             :             fprintf (stderr, "}\n");
     680             :         }
     681             :         return "aAdjSequence";
     682             :     }
     683             :     else if( value >>= segArray )
     684             :     {
     685             :         if (segArray.getLength() == 0)
     686             :             return "Sequence< EnhancedCustomShapeSegment >(0)";
     687             : 
     688             :         printLevel (level);
     689             :         fprintf (stderr,"static const sal_uInt16 nValues[] = {\n");
     690             :         printLevel (level);
     691             :         fprintf (stderr,"// Command, Count\n");
     692             :         for( int i = 0; i < segArray.getLength(); i++ ) {
     693             :             printLevel (level + 1);
     694             :             fprintf (stderr,"%d,%d%s\n", segArray[i].Command,
     695             :                     segArray[i].Count, i < segArray.getLength() - 1 ? "," : "");
     696             :         }
     697             :         printLevel (level);
     698             :         fprintf (stderr,"};\n");
     699             :         return "createSegmentSequence( SAL_N_ELEMENTS( nValues ), nValues )";
     700             :     }
     701             :     else if( value >>= segTextFrame )
     702             :     {
     703             :         printLevel (level);
     704             :         fprintf (stderr, "Sequence< EnhancedCustomShapeTextFrame > aTextFrameSeq (%" SAL_PRIdINT32 ");\n", segTextFrame.getLength());
     705             :         for( int i=0; i<segTextFrame.getLength(); i++ ) {
     706             :             printLevel (level);
     707             :             fprintf (stderr, "{\n");
     708             :             const char *var = lclDumpAnyValueCode (makeAny (segTextFrame[i]), level + 1);
     709             :             printLevel (level + 1);
     710             :             fprintf (stderr, "aTextFrameSeq [%d] = %s;\n", i, var);
     711             :             printLevel (level);
     712             :             fprintf (stderr, "}\n");
     713             :         }
     714             :         return "aTextFrameSeq";
     715             :     }
     716             :     else if( value >>= ppArray )
     717             :     {
     718             :         printLevel (level);
     719             :         if (ppArray.getLength() == 0)
     720             :             return "Sequence< EnhancedCustomShapeParameterPair >(0)";
     721             : 
     722             :         fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData[] = {\n");
     723             :         for( int i = 0; i < ppArray.getLength(); i++ ) {
     724             :             printParameterPairData(level + 1, ppArray[i]);
     725             :             fprintf (stderr,"%s\n", i < ppArray.getLength() - 1 ? "," : "");
     726             :         }
     727             :         printLevel (level);
     728             :         fprintf (stderr,"};\n");
     729             : 
     730             :         return "createParameterPairSequence(SAL_N_ELEMENTS(aData), aData)";
     731             :     }
     732             :     else if( value >>= segment )
     733             :     {
     734             :         printLevel (level);
     735             :         fprintf (stderr, "EnhancedCustomShapeSegment aSegment;\n");
     736             :         printLevel (level);
     737             :         // TODO: use EnhancedCustomShapeSegmentCommand constants
     738             :         fprintf (stderr, "aSegment.Command = %d;\n", segment.Command);
     739             :         printLevel (level);
     740             :         fprintf (stderr, "aSegment.Count = %d;\n", segment.Count);
     741             :         return "aSegment";
     742             :     }
     743             :     else if( value >>= textFrame )
     744             :     {
     745             :         printLevel (level);
     746             :         fprintf (stderr, "EnhancedCustomShapeTextFrame aTextFrame;\n");
     747             :         printLevel (level);
     748             :         fprintf (stderr, "{\n");
     749             :         {
     750             :             const char* var = lclDumpAnyValueCode( makeAny (textFrame.TopLeft), level + 1 );
     751             :             printLevel (level + 1);
     752             :             fprintf (stderr, "aTextFrame.TopLeft = %s;\n", var);
     753             :         }
     754             :         printLevel (level);
     755             :         fprintf (stderr, "}\n");
     756             : 
     757             :         printLevel (level);
     758             :         fprintf (stderr, "{\n");
     759             :         {
     760             :             const char* var = lclDumpAnyValueCode( makeAny (textFrame.BottomRight), level + 1 );
     761             :             printLevel (level + 1);
     762             :             fprintf (stderr, "aTextFrame.BottomRight = %s;\n", var);
     763             :         }
     764             :         printLevel (level);
     765             :         fprintf (stderr, "}\n");
     766             : 
     767             :         return "aTextFrame";
     768             :     }
     769             :     else if( value >>= pp )
     770             :     {
     771             :         printLevel (level);
     772             :         fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData =\n");
     773             :         printParameterPairData(level, pp);
     774             :         fprintf (stderr, ";\n");
     775             : 
     776             :         return "createParameterPair(&aData)";
     777             :     }
     778             :     else if( value >>= par )
     779             :     {
     780             :         printLevel (level);
     781             :         fprintf (stderr,"EnhancedCustomShapeParameter aParameter;\n");
     782             :         const char* var = lclDumpAnyValueCode( par.Value, level );
     783             :         printLevel (level);
     784             :         fprintf (stderr,"aParameter.Value = %s;\n", var);
     785             :         printLevel (level);
     786             :         fprintf (stderr,"aParameter.Type = %s;\n",
     787             :                 lclGetEnhancedParameterType(par.Type));
     788             :         return "aParameter";
     789             :     }
     790             :     else if( value >>= longValue )
     791             :     {
     792             :         printLevel (level);
     793             :         fprintf (stderr,"Any aAny ((sal_Int32) %ld);\n", longValue);
     794             :         return "aAny";
     795             :     }
     796             :     else if( value >>= intValue )
     797             :         fprintf (stderr,"%" SAL_PRIdINT32 "            (hex: %" SAL_PRIxUINT32 ")\n", intValue, intValue);
     798             :     else if( value >>= uintValue )
     799             :         fprintf (stderr,"%" SAL_PRIdINT32 "            (hex: %" SAL_PRIxUINT32 ")\n", uintValue, uintValue);
     800             :     else if( value >>= int16Value )
     801             :         fprintf (stderr,"%d            (hex: %x)\n", int16Value, int16Value);
     802             :     else if( value >>= uint16Value )
     803             :         fprintf (stderr,"%d            (hex: %x)\n", uint16Value, uint16Value);
     804             :     else if( value >>= floatValue )
     805             :         fprintf (stderr,"%f\n", floatValue);
     806             :     else if( value >>= boolValue ) {
     807             :         if (boolValue)
     808             :             return "(sal_Bool) sal_True";
     809             :         else
     810             :             return "(sal_Bool) sal_False";
     811             :     }
     812             :     else if( value >>= xNumRule ) {
     813             :         fprintf (stderr, "XIndexReplace\n");
     814             :         for (int k=0; k<xNumRule->getCount(); k++) {
     815             :             Sequence< PropertyValue > aBulletPropSeq;
     816             :             fprintf (stderr, "level %d\n", k);
     817             :             if (xNumRule->getByIndex (k) >>= aBulletPropSeq) {
     818             :                 for (int j=0; j<aBulletPropSeq.getLength(); j++) {
     819             :                     fprintf(stderr, "%46s = ", USS (aBulletPropSeq[j].Name));
     820             :                     lclDumpAnyValue (aBulletPropSeq[j].Value);
     821             :                 }
     822             :             }
     823             :         }
     824             :     }
     825             :     else if( value >>= aWritingMode )
     826             :         fprintf (stderr, "%d writing mode\n", aWritingMode);
     827             :     else if( value >>= aTextVertAdj ) {
     828             :         const char* s = "unknown";
     829             :         switch( aTextVertAdj ) {
     830             :             case TextVerticalAdjust_TOP:
     831             :                 s = "top";
     832             :                 break;
     833             :             case TextVerticalAdjust_CENTER:
     834             :                 s = "center";
     835             :                 break;
     836             :             case TextVerticalAdjust_BOTTOM:
     837             :                 s = "bottom";
     838             :                 break;
     839             :             case TextVerticalAdjust_BLOCK:
     840             :                 s = "block";
     841             :                 break;
     842             :             case TextVerticalAdjust_MAKE_FIXED_SIZE:
     843             :                 s = "make_fixed_size";
     844             :                 break;
     845             :         }
     846             :         fprintf (stderr, "%s\n", s);
     847             :     }
     848             :     else if( value >>= aTextHorizAdj ) {
     849             :         const char* s = "unknown";
     850             :         switch( aTextHorizAdj ) {
     851             :             case TextHorizontalAdjust_LEFT:
     852             :                 s = "left";
     853             :                 break;
     854             :             case TextHorizontalAdjust_CENTER:
     855             :                 s = "center";
     856             :                 break;
     857             :             case TextHorizontalAdjust_RIGHT:
     858             :                 s = "right";
     859             :                 break;
     860             :             case TextHorizontalAdjust_BLOCK:
     861             :                 s = "block";
     862             :                 break;
     863             :             case TextHorizontalAdjust_MAKE_FIXED_SIZE:
     864             :                 s = "make_fixed_size";
     865             :                 break;
     866             :         }
     867             :         fprintf (stderr, "%s\n", s);
     868             :     }
     869             :     else if( value >>= spacing ) {
     870             :         fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
     871             :     }
     872             :     else if( value >>= rect ) {
     873             :         printLevel (level);
     874             :         fprintf (stderr, "awt::Rectangle aRectangle;\n");
     875             :         printLevel (level);
     876             :         fprintf (stderr, "aRectangle.X = %" SAL_PRIdINT32 ";\n", rect.X);
     877             :         printLevel (level);
     878             :         fprintf (stderr, "aRectangle.Y = %" SAL_PRIdINT32 ";\n", rect.Y);
     879             :         printLevel (level);
     880             :         fprintf (stderr, "aRectangle.Width = %" SAL_PRIdINT32 ";\n", rect.Width);
     881             :         printLevel (level);
     882             :         fprintf (stderr, "aRectangle.Height = %" SAL_PRIdINT32 ";\n", rect.Height);
     883             :         return "aRectangle";
     884             :     }
     885             :     else if( value >>= size ) {
     886             :         printLevel (level);
     887             :         fprintf (stderr, "awt::Size aSize;\n");
     888             :         printLevel (level);
     889             :         fprintf (stderr, "aSize.Width = %" SAL_PRIdINT32 ";\n", size.Width);
     890             :         printLevel (level);
     891             :         fprintf (stderr, "aSize.Height = %" SAL_PRIdINT32 ";\n", size.Height);
     892             :         return "aSize";
     893             :     }
     894             :     else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) {
     895             :         fprintf (stderr,"is extractable to int32\n");
     896             :     }
     897             :     else
     898             :         fprintf (stderr,"???           <unhandled type %s>\n", USS(value.getValueTypeName()));
     899             : 
     900             :     return "";
     901             : }
     902             : 
     903             : void PropertyMap::dumpCode( Reference< XPropertySet > rXPropSet )
     904             : {
     905             :     Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
     906             :     Sequence< Property > props = info->getProperties ();
     907             :     const OUString sType = "Type";
     908             : 
     909             :     for (int i=0; i < props.getLength (); i++) {
     910             : 
     911             :         // ignore Type, it is set elsewhere
     912             :         if (props[i].Name.equals (sType))
     913             :             continue;
     914             : 
     915             :         OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
     916             :         int level = 1;
     917             : 
     918             :         try {
     919             :             printLevel (level);
     920             :             fprintf (stderr, "{\n");
     921             :             const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (props [i].Name), level + 1);
     922             :             printLevel (level + 1);
     923             :             fprintf (stderr,"aPropertyMap.setProperty(PROP_%s, %s);\n", name.getStr(), var);
     924             :             printLevel (level);
     925             :             fprintf (stderr, "}\n");
     926             :         } catch (const Exception&) {
     927             :             fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
     928             :         }
     929             :     }
     930             : }
     931             : 
     932             : void PropertyMap::dumpCode()
     933             : {
     934             :     dumpCode( Reference< XPropertySet >( makePropertySet(), UNO_QUERY ) );
     935             : }
     936             : #endif
     937             : 
     938             : } // namespace oox
     939             : 
     940             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10