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

Generated by: LCOV version 1.11