LCOV - code coverage report
Current view: top level - oox/source/helper - propertymap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 44 72 61.1 %
Date: 2012-08-25 Functions: 12 19 63.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 24 58 41.4 %

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

Generated by: LCOV version 1.10