LCOV - code coverage report
Current view: top level - xmloff/source/style - xmlexppr.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 357 428 83.4 %
Date: 2014-04-11 Functions: 34 35 97.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 <com/sun/star/container/XNameContainer.hpp>
      21             : #include <com/sun/star/xml/AttributeData.hpp>
      22             : #include <com/sun/star/beans/XPropertySet.hpp>
      23             : #include <com/sun/star/beans/XPropertyState.hpp>
      24             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      25             : #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
      26             : #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
      27             : #include <rtl/ustrbuf.hxx>
      28             : #include <list>
      29             : #include <map>
      30             : 
      31             : #include <xmloff/xmlexppr.hxx>
      32             : #include <xmloff/xmltoken.hxx>
      33             : #include <xmloff/attrlist.hxx>
      34             : #include <xmloff/nmspmap.hxx>
      35             : #include <xmloff/xmlnmspe.hxx>
      36             : #include <xmloff/xmlexp.hxx>
      37             : #include <xmloff/xmlprmap.hxx>
      38             : 
      39             : using namespace ::std;
      40             : using namespace ::com::sun::star;
      41             : using namespace ::com::sun::star::beans;
      42             : using namespace ::com::sun::star::uno;
      43             : using namespace ::com::sun::star::lang;
      44             : using namespace ::xmloff::token;
      45             : 
      46             : #define GET_PROP_TYPE( f ) static_cast<sal_uInt16>((f & XML_TYPE_PROP_MASK) >> XML_TYPE_PROP_SHIFT)
      47             : #define ENTRY(t) { GET_PROP_TYPE(XML_TYPE_PROP_##t), XML_##t##_PROPERTIES }
      48             : 
      49             : namespace {
      50             : 
      51             : struct XMLPropTokens_Impl
      52             : {
      53             :     sal_uInt16 nType;
      54             :     XMLTokenEnum eToken;
      55             : };
      56             : 
      57             : const sal_uInt16 MAX_PROP_TYPES =
      58             :     (XML_TYPE_PROP_END >> XML_TYPE_PROP_SHIFT) -
      59             :     (XML_TYPE_PROP_START >> XML_TYPE_PROP_SHIFT);
      60             : 
      61             : XMLPropTokens_Impl aPropTokens[MAX_PROP_TYPES] =
      62             : {
      63             :     ENTRY(CHART),
      64             :     ENTRY(GRAPHIC),
      65             :     ENTRY(TABLE),
      66             :     ENTRY(TABLE_COLUMN),
      67             :     ENTRY(TABLE_ROW),
      68             :     ENTRY(TABLE_CELL),
      69             :     ENTRY(LIST_LEVEL),
      70             :     ENTRY(PARAGRAPH),
      71             :     ENTRY(TEXT),
      72             :     ENTRY(DRAWING_PAGE),
      73             :     ENTRY(PAGE_LAYOUT),
      74             :     ENTRY(HEADER_FOOTER),
      75             :     ENTRY(RUBY),
      76             :     ENTRY(SECTION)
      77             : };
      78             : 
      79             : // public methods
      80             : 
      81             : // Take all properties of the XPropertySet which are also found in the
      82             : // XMLPropertyMapEntry-array and which are not set to their default-value,
      83             : // if a state is available.
      84             : // After that I call the method 'ContextFilter'.
      85             : 
      86             : typedef std::list<XMLPropertyState> XMLPropertyStateList_Impl;
      87             : 
      88        9317 : class XMLPropertyStates_Impl
      89             : {
      90             :     XMLPropertyStateList_Impl           aPropStates;
      91             :     XMLPropertyStateList_Impl::iterator aLastItr;
      92             :     sal_uInt32                          nCount;
      93             : public:
      94             :     XMLPropertyStates_Impl();
      95             :     void AddPropertyState(const XMLPropertyState& rPropState);
      96             :     void FillPropertyStateVector(std::vector<XMLPropertyState>& rVector);
      97             : };
      98             : 
      99        9317 : XMLPropertyStates_Impl::XMLPropertyStates_Impl() :
     100             :     aPropStates(),
     101        9317 :     nCount(0)
     102             : {
     103        9317 :     aLastItr = aPropStates.begin();
     104        9317 : }
     105             : 
     106       71586 : void XMLPropertyStates_Impl::AddPropertyState(
     107             :         const XMLPropertyState& rPropState)
     108             : {
     109       71586 :     XMLPropertyStateList_Impl::iterator aItr = aPropStates.begin();
     110       71586 :     sal_Bool bInserted(sal_False);
     111       71586 :     if (nCount)
     112             :     {
     113       65345 :         if (aLastItr->mnIndex < rPropState.mnIndex)
     114       41575 :             aItr = ++aLastItr;
     115             :     }
     116      427174 :     do
     117             :     {
     118             :         // TODO: one path required only
     119      177794 :         if (aItr == aPropStates.end())
     120             :         {
     121       27817 :             aLastItr = aPropStates.insert(aPropStates.end(), rPropState);
     122       27817 :             bInserted = sal_True;
     123       27817 :             nCount++;
     124             :         }
     125      149977 :         else if (aItr->mnIndex > rPropState.mnIndex)
     126             :         {
     127       43769 :             aLastItr = aPropStates.insert(aItr, rPropState);
     128       43769 :             bInserted = sal_True;
     129       43769 :             nCount++;
     130             :         }
     131             :     }
     132      461796 :     while(!bInserted && (aItr++ != aPropStates.end()));
     133       71586 : }
     134             : 
     135        9317 : void XMLPropertyStates_Impl::FillPropertyStateVector(
     136             :         std::vector<XMLPropertyState>& rVector)
     137             : {
     138        9317 :     if (nCount)
     139             :     {
     140        6241 :         rVector.resize(nCount, XMLPropertyState(-1));
     141        6241 :         ::std::copy( aPropStates.begin(), aPropStates.end(), rVector.begin() );
     142             :     }
     143        9317 : }
     144             : 
     145      982479 : class FilterPropertyInfo_Impl
     146             : {
     147             :     const OUString     sApiName;
     148             :     std::list<sal_uInt32>   aIndexes;
     149             : 
     150             : public:
     151             : 
     152             :     FilterPropertyInfo_Impl( const OUString& rApiName,
     153             :                              const sal_uInt32 nIndex);
     154             : 
     155     4282170 :     const OUString& GetApiName() const { return sApiName; }
     156      247417 :     std::list<sal_uInt32>& GetIndexes() { return aIndexes; }
     157             : 
     158             :     // for sort
     159     1654629 :     sal_Bool operator< ( const FilterPropertyInfo_Impl& rArg ) const
     160             :     {
     161     1654629 :         return (GetApiName() < rArg.GetApiName());
     162             :     }
     163             : };
     164             : 
     165      327506 : FilterPropertyInfo_Impl::FilterPropertyInfo_Impl(
     166             :         const OUString& rApiName,
     167             :         const sal_uInt32 nIndex ) :
     168      327506 :     sApiName( rApiName )
     169             : {
     170      327506 :     aIndexes.push_back(nIndex);
     171      327506 : }
     172             : 
     173             : typedef std::list<FilterPropertyInfo_Impl> FilterPropertyInfoList_Impl;
     174             : 
     175             : class FilterPropertiesInfo_Impl
     176             : {
     177             :     sal_uInt32                              nCount;
     178             :     FilterPropertyInfoList_Impl             aPropInfos;
     179             :     FilterPropertyInfoList_Impl::iterator   aLastItr;
     180             : 
     181             :     Sequence <OUString>                     *pApiNames;
     182             : 
     183             : public:
     184             :     FilterPropertiesInfo_Impl();
     185             :     ~FilterPropertiesInfo_Impl();
     186             : 
     187             :     void AddProperty(const OUString& rApiName, const sal_uInt32 nIndex);
     188             :     const uno::Sequence<OUString>& GetApiNames();
     189             :     void FillPropertyStateArray(
     190             :             vector< XMLPropertyState >& rPropStates,
     191             :             const Reference< XPropertySet >& xPropSet,
     192             :             const UniReference< XMLPropertySetMapper >& maPropMapper,
     193             :             const sal_Bool bDefault = sal_False);
     194        9339 :     sal_uInt32 GetPropertyCount() const { return nCount; }
     195             : };
     196             : 
     197        3671 : FilterPropertiesInfo_Impl::FilterPropertiesInfo_Impl() :
     198             :     nCount(0),
     199             :     aPropInfos(),
     200        3671 :     pApiNames( 0 )
     201             : {
     202        3671 :     aLastItr = aPropInfos.begin();
     203        3671 : }
     204             : 
     205        7336 : FilterPropertiesInfo_Impl::~FilterPropertiesInfo_Impl()
     206             : {
     207        3668 :     delete pApiNames;
     208        3668 : }
     209             : 
     210      327506 : void FilterPropertiesInfo_Impl::AddProperty(
     211             :         const OUString& rApiName, const sal_uInt32 nIndex)
     212             : {
     213      327506 :     aPropInfos.push_back(FilterPropertyInfo_Impl(rApiName, nIndex));
     214      327506 :     nCount++;
     215             : 
     216             :     OSL_ENSURE( !pApiNames, "perfomance warning: API names already retrieved" );
     217      327506 :     if( pApiNames )
     218             :     {
     219           0 :         delete pApiNames;
     220           0 :         pApiNames = NULL;
     221             :     }
     222      327506 : }
     223             : 
     224        9317 : const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames()
     225             : {
     226             :     OSL_ENSURE(nCount == aPropInfos.size(), "wrong property count");
     227        9317 :     if( !pApiNames )
     228             :     {
     229             :         // we have to do three things:
     230             :         // 1) sort API names,
     231             :         // 2) merge duplicates,
     232             :         // 3) construct sequence
     233             : 
     234             :         // sort names
     235        3665 :         aPropInfos.sort();
     236             : 
     237             :         // merge duplicates
     238        3665 :         if ( nCount > 1 )
     239             :         {
     240        3603 :             FilterPropertyInfoList_Impl::iterator aOld = aPropInfos.begin();
     241        3603 :             FilterPropertyInfoList_Impl::iterator aEnd = aPropInfos.end();
     242        3603 :             FilterPropertyInfoList_Impl::iterator aCurrent = aOld;
     243        3603 :             ++aCurrent;
     244             : 
     245      331047 :             while ( aCurrent != aEnd )
     246             :             {
     247             :                 // equal to next element?
     248      323841 :                 if ( aOld->GetApiName().equals( aCurrent->GetApiName() ) )
     249             :                 {
     250             :                     // if equal: merge index lists
     251       71747 :                     aOld->GetIndexes().merge( aCurrent->GetIndexes() );
     252             :                     // erase element, and continue with next
     253       71747 :                     aCurrent = aPropInfos.erase( aCurrent );
     254       71747 :                     nCount--;
     255             :                 }
     256             :                 else
     257             :                 {
     258             :                     // remember old element and continue with next
     259      252094 :                     aOld = aCurrent;
     260      252094 :                     ++aCurrent;
     261             :                 }
     262             :             }
     263             :         }
     264             : 
     265             :         // construct sequence
     266        3665 :         pApiNames = new Sequence < OUString >( nCount );
     267        3665 :         OUString *pNames = pApiNames->getArray();
     268        3665 :         FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
     269        3665 :         FilterPropertyInfoList_Impl::iterator aEnd = aPropInfos.end();
     270      259424 :         for ( ; aItr != aEnd; ++aItr, ++pNames)
     271      255759 :             *pNames = aItr->GetApiName();
     272             :     }
     273             : 
     274        9317 :     return *pApiNames;
     275             : }
     276             : 
     277        9317 : void FilterPropertiesInfo_Impl::FillPropertyStateArray(
     278             :         vector< XMLPropertyState >& rPropStates,
     279             :         const Reference< XPropertySet >& rPropSet,
     280             :         const UniReference< XMLPropertySetMapper >& rPropMapper,
     281             :         const sal_Bool bDefault )
     282             : {
     283        9317 :     XMLPropertyStates_Impl aPropStates;
     284             : 
     285        9317 :     const uno::Sequence<OUString>& rApiNames = GetApiNames();
     286             : 
     287       18634 :     Reference < XTolerantMultiPropertySet > xTolPropSet( rPropSet, UNO_QUERY );
     288        9317 :     if (xTolPropSet.is())
     289             :     {
     290        2284 :         if (!bDefault)
     291             :         {
     292        2284 :             Sequence < beans::GetDirectPropertyTolerantResult > aResults(xTolPropSet->getDirectPropertyValuesTolerant(rApiNames));
     293        2284 :             sal_Int32 nResultCount(aResults.getLength());
     294        2284 :             if (nResultCount > 0)
     295             :             {
     296         233 :                 const beans::GetDirectPropertyTolerantResult *pResults = aResults.getConstArray();
     297         233 :                 FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin());
     298         233 :                 XMLPropertyState aNewProperty( -1 );
     299         233 :                 sal_uInt32 i = 0;
     300        7507 :                 while (nResultCount > 0 && i < nCount)
     301             :                 {
     302        7041 :                     if (pResults->Name == aPropIter->GetApiName())
     303             :                     {
     304         590 :                         aNewProperty.mnIndex = -1;
     305         590 :                         aNewProperty.maValue = pResults->Value;
     306             : 
     307        3774 :                         for( std::list<sal_uInt32>::iterator aIndexItr(aPropIter->GetIndexes().begin());
     308        2516 :                             aIndexItr != aPropIter->GetIndexes().end();
     309             :                             ++aIndexItr )
     310             :                         {
     311         668 :                             aNewProperty.mnIndex = *aIndexItr;
     312         668 :                             aPropStates.AddPropertyState( aNewProperty );
     313             :                         }
     314         590 :                         ++pResults;
     315         590 :                         --nResultCount;
     316             :                     }
     317        7041 :                     ++aPropIter;
     318        7041 :                     ++i;
     319         233 :                 }
     320        2284 :             }
     321             :         }
     322             :         else
     323             :         {
     324           0 :             Sequence < beans::GetPropertyTolerantResult > aResults(xTolPropSet->getPropertyValuesTolerant(rApiNames));
     325             :             OSL_ENSURE( rApiNames.getLength() == aResults.getLength(), "wrong implemented XTolerantMultiPropertySet" );
     326           0 :             const beans::GetPropertyTolerantResult *pResults = aResults.getConstArray();
     327           0 :             FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin());
     328           0 :             XMLPropertyState aNewProperty( -1 );
     329           0 :             sal_uInt32 nResultCount(aResults.getLength());
     330             :             OSL_ENSURE( nCount == nResultCount, "wrong implemented XTolerantMultiPropertySet??" );
     331           0 :             for( sal_uInt32 i = 0; i < nResultCount; ++i )
     332             :             {
     333           0 :                 if ((pResults->Result == beans::TolerantPropertySetResultType::SUCCESS) &&
     334           0 :                     ((pResults->State == PropertyState_DIRECT_VALUE) || (pResults->State == PropertyState_DEFAULT_VALUE)))
     335             :                 {
     336           0 :                     aNewProperty.mnIndex = -1;
     337           0 :                     aNewProperty.maValue = pResults->Value;
     338             : 
     339           0 :                     for( std::list<sal_uInt32>::iterator aIndexItr(aPropIter->GetIndexes().begin());
     340           0 :                         aIndexItr != aPropIter->GetIndexes().end();
     341             :                         ++aIndexItr )
     342             :                     {
     343           0 :                         aNewProperty.mnIndex = *aIndexItr;
     344           0 :                         aPropStates.AddPropertyState( aNewProperty );
     345             :                     }
     346             :                 }
     347           0 :                 ++pResults;
     348           0 :                 ++aPropIter;
     349           0 :             }
     350             :         }
     351             :     }
     352             :     else
     353             :     {
     354        7033 :         Sequence < PropertyState > aStates;
     355        7033 :         const PropertyState *pStates = 0;
     356       14066 :         Reference< XPropertyState > xPropState( rPropSet, UNO_QUERY );
     357        7033 :         if( xPropState.is() )
     358             :         {
     359        7004 :             aStates = xPropState->getPropertyStates( rApiNames );
     360        7004 :             pStates = aStates.getConstArray();
     361             :         }
     362             : 
     363       14066 :         Reference < XMultiPropertySet > xMultiPropSet( rPropSet, UNO_QUERY );
     364        7033 :         if( xMultiPropSet.is() && !bDefault )
     365             :         {
     366        6422 :             Sequence < Any > aValues;
     367        6422 :             if( pStates )
     368             :             {
     369             :                 // step 1: get value count
     370        6393 :                 sal_uInt32 nValueCount = 0;
     371             :                 sal_uInt32 i;
     372             : 
     373      413871 :                 for( i = 0; i < nCount; ++i, ++pStates )
     374             :                 {
     375      407478 :                     if( (*pStates == PropertyState_DIRECT_VALUE)/* || (bDefault && (*pStates == PropertyState_DEFAULT_VALUE))*/ )
     376       54889 :                         nValueCount++;
     377             :                 }
     378             : 
     379        6393 :                 if( nValueCount )
     380             :                 {
     381             :                     // step 2: collect property names
     382        5394 :                     Sequence < OUString > aAPINames( nValueCount );
     383        5394 :                     OUString *pAPINames = aAPINames.getArray();
     384             : 
     385       10788 :                     ::std::vector< FilterPropertyInfoList_Impl::iterator > aPropIters;
     386        5394 :                     aPropIters.reserve( nValueCount );
     387             : 
     388        5394 :                     FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
     389             :                     OSL_ENSURE(aItr != aPropInfos.end(),"Invalid iterator!");
     390             : 
     391        5394 :                     pStates = aStates.getConstArray();
     392        5394 :                     i = 0;
     393      325313 :                     while( i < nValueCount )
     394             :                     {
     395      314525 :                         if( (*pStates == PropertyState_DIRECT_VALUE)/* || (bDefault && (*pStates == PropertyState_DEFAULT_VALUE))*/ )
     396             :                         {
     397       54889 :                             *pAPINames++ = aItr->GetApiName();
     398       54889 :                             aPropIters.push_back( aItr );
     399       54889 :                             ++i;
     400             :                         }
     401      314525 :                         ++aItr;
     402      314525 :                         ++pStates;
     403             :                     }
     404             : 
     405        5394 :                     aValues = xMultiPropSet->getPropertyValues( aAPINames );
     406        5394 :                     const Any *pValues = aValues.getConstArray();
     407             : 
     408             :                     ::std::vector< FilterPropertyInfoList_Impl::iterator >::const_iterator
     409        5394 :                         pPropIter = aPropIters.begin();
     410             : 
     411       10788 :                     XMLPropertyState aNewProperty( -1 );
     412       60283 :                     for( i = 0; i < nValueCount; ++i )
     413             :                     {
     414       54889 :                         aNewProperty.mnIndex = -1;
     415       54889 :                         aNewProperty.maValue = *pValues;
     416             : 
     417       54889 :                         const ::std::list< sal_uInt32 >& rIndexes( (*pPropIter)->GetIndexes() );
     418      348339 :                         for (   std::list<sal_uInt32>::const_iterator aIndexItr = rIndexes.begin();
     419      232226 :                                 aIndexItr != rIndexes.end();
     420             :                                 ++aIndexItr
     421             :                             )
     422             :                         {
     423       61224 :                             aNewProperty.mnIndex = *aIndexItr;
     424       61224 :                             aPropStates.AddPropertyState( aNewProperty );
     425             :                         }
     426             : 
     427       54889 :                         ++pPropIter;
     428       54889 :                         ++pValues;
     429        5394 :                     }
     430             :                 }
     431             :             }
     432             :             else
     433             :             {
     434          29 :                 aValues = xMultiPropSet->getPropertyValues( rApiNames );
     435          29 :                 const Any *pValues = aValues.getConstArray();
     436             : 
     437          29 :                 FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
     438         112 :                 for(sal_uInt32 i = 0; i < nCount; ++i)
     439             :                 {
     440             :                     // The value is stored in the PropertySet itself, add to list.
     441          83 :                     XMLPropertyState aNewProperty( -1 );
     442          83 :                     aNewProperty.maValue = *pValues;
     443          83 :                     ++pValues;
     444         498 :                     for( std::list<sal_uInt32>::iterator aIndexItr =
     445          83 :                             aItr->GetIndexes().begin();
     446         332 :                         aIndexItr != aItr->GetIndexes().end();
     447             :                         ++aIndexItr )
     448             :                     {
     449          83 :                         aNewProperty.mnIndex = *aIndexItr;
     450          83 :                         aPropStates.AddPropertyState( aNewProperty );
     451             :                     }
     452          83 :                     ++aItr;
     453          83 :                 }
     454        6422 :             }
     455             :         }
     456             :         else
     457             :         {
     458         611 :             FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
     459       70800 :             for(sal_uInt32 i = 0; i < nCount; ++i)
     460             :             {
     461             :                 sal_Bool bDirectValue =
     462       70189 :                     !pStates || *pStates == PropertyState_DIRECT_VALUE;
     463       70189 :                 if( bDirectValue || bDefault )
     464             :                 {
     465             :                     // The value is stored in the PropertySet itself, add to list.
     466       14477 :                     sal_Bool bGotValue = sal_False;
     467       14477 :                     XMLPropertyState aNewProperty( -1 );
     468       97380 :                     for( std::list<sal_uInt32>::const_iterator aIndexItr =
     469       14477 :                             aItr->GetIndexes().begin();
     470       64920 :                         aIndexItr != aItr->GetIndexes().end();
     471             :                         ++aIndexItr )
     472             :                     {
     473       26661 :                         if( bDirectValue ||
     474        8678 :                             (rPropMapper->GetEntryFlags( *aIndexItr ) &
     475             :                                             MID_FLAG_DEFAULT_ITEM_EXPORT) != 0 )
     476             :                         {
     477             :                             try
     478             :                             {
     479        9611 :                                 if( !bGotValue )
     480             :                                 {
     481       15082 :                                     aNewProperty.maValue =
     482       15082 :                                         rPropSet->getPropertyValue( aItr->GetApiName() );
     483        7541 :                                     bGotValue = sal_True;
     484             :                                 }
     485        9611 :                                 aNewProperty.mnIndex = *aIndexItr;
     486        9611 :                                 aPropStates.AddPropertyState( aNewProperty );
     487             :                             }
     488           0 :                             catch( UnknownPropertyException& )
     489             :                             {
     490             :                                 // might be a problem of getImplemenetationId
     491             :                                 OSL_ENSURE( !this, "unknown property in getPropertyValue" );
     492             :                             }
     493             : 
     494             :                         }
     495       14477 :                     }
     496             :                 }
     497             : 
     498       70189 :                 ++aItr;
     499       70189 :                 if( pStates )
     500       70189 :                     ++pStates;
     501             :             }
     502        7033 :         }
     503             :     }
     504       18634 :     aPropStates.FillPropertyStateVector(rPropStates);
     505        9317 : }
     506             : 
     507             : }
     508             : 
     509        8747 : struct SvXMLExportPropertyMapper::Impl
     510             : {
     511             :     typedef std::map<css::uno::Reference<css::beans::XPropertySetInfo>, FilterPropertiesInfo_Impl*> CacheType;
     512             :     CacheType maCache;
     513             : 
     514             :     UniReference<SvXMLExportPropertyMapper> mxNextMapper;
     515             :     UniReference<XMLPropertySetMapper> mxPropMapper;
     516             : 
     517             :     OUString maStyleName;
     518             : 
     519        8732 :     ~Impl()
     520        8732 :     {
     521        8732 :         CacheType::iterator it = maCache.begin(), itEnd = maCache.end();
     522       12392 :         for (; it != itEnd; ++it)
     523        3660 :             delete it->second;
     524        8732 :     }
     525             : };
     526             : 
     527             : // ctor/dtor , class SvXMLExportPropertyMapper
     528             : 
     529        8747 : SvXMLExportPropertyMapper::SvXMLExportPropertyMapper(
     530             :         const UniReference< XMLPropertySetMapper >& rMapper ) :
     531        8747 :     mpImpl(new Impl)
     532             : {
     533        8747 :     mpImpl->mxPropMapper = rMapper;
     534        8747 : }
     535             : 
     536       18940 : SvXMLExportPropertyMapper::~SvXMLExportPropertyMapper()
     537             : {
     538        8732 :     delete mpImpl;
     539       10208 : }
     540             : 
     541        1634 : void SvXMLExportPropertyMapper::ChainExportMapper(
     542             :         const UniReference< SvXMLExportPropertyMapper>& rMapper )
     543             : {
     544             :     // add map entries from rMapper to current map
     545        1634 :     mpImpl->mxPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() );
     546             :     // rMapper uses the same map as 'this'
     547        1634 :     rMapper->mpImpl->mxPropMapper = mpImpl->mxPropMapper;
     548             : 
     549             :     // set rMapper as last mapper in current chain
     550        1634 :     UniReference< SvXMLExportPropertyMapper > xNext = mpImpl->mxNextMapper;
     551        1634 :     if( xNext.is())
     552             :     {
     553        1132 :         while (xNext->mpImpl->mxNextMapper.is())
     554           0 :             xNext = xNext->mpImpl->mxNextMapper;
     555         566 :         xNext->mpImpl->mxNextMapper = rMapper;
     556             :     }
     557             :     else
     558        1068 :         mpImpl->mxNextMapper = rMapper;
     559             : 
     560             :     // if rMapper was already chained, correct
     561             :     // map pointer of successors
     562        1634 :     xNext = rMapper;
     563             : 
     564        3268 :     while (xNext->mpImpl->mxNextMapper.is())
     565             :     {
     566           0 :         xNext = xNext->mpImpl->mxNextMapper;
     567           0 :         xNext->mpImpl->mxPropMapper = mpImpl->mxPropMapper;
     568        1634 :     }
     569        1634 : }
     570             : 
     571        9339 : vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
     572             :         const Reference< XPropertySet > xPropSet,
     573             :         bool bDefault, bool bEnableFoFontFamily) const
     574             : {
     575        9339 :     vector< XMLPropertyState > aPropStateArray;
     576             : 
     577             :     // Retrieve XPropertySetInfo and XPropertyState
     578       18678 :     Reference< XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
     579        9339 :     if( !xInfo.is() )
     580           0 :         return aPropStateArray;
     581             : 
     582        9339 :     sal_Int32 nProps = mpImpl->mxPropMapper->GetEntryCount();
     583             : 
     584        9339 :     FilterPropertiesInfo_Impl *pFilterInfo = 0;
     585             : 
     586        9339 :     Impl::CacheType::iterator aIter = mpImpl->maCache.find(xInfo);
     587        9339 :     if (aIter != mpImpl->maCache.end())
     588        5668 :         pFilterInfo = (*aIter).second;
     589             : 
     590        9339 :     sal_Bool bDelInfo = sal_False;
     591        9339 :     if( !pFilterInfo )
     592             :     {
     593        3671 :         pFilterInfo = new FilterPropertiesInfo_Impl;
     594     1405262 :         for( sal_Int32 i=0; i < nProps; i++ )
     595             :         {
     596             :             // Are we allowed to ask for the property? (MID_FLAG_NO_PROP..)
     597             :             // Does the PropertySet contain name of mpEntries-array ?
     598     1401591 :             const OUString& rAPIName = mpImpl->mxPropMapper->GetEntryAPIName( i );
     599     1401591 :             const sal_Int32 nFlags = mpImpl->mxPropMapper->GetEntryFlags( i );
     600     3114444 :             if( (0 == (nFlags & MID_FLAG_NO_PROPERTY_EXPORT)) &&
     601     2770694 :                 ( (0 != (nFlags & MID_FLAG_MUST_EXIST)) ||
     602     1385347 :                   xInfo->hasPropertyByName( rAPIName ) ) )
     603             :             {
     604      327506 :                 const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
     605             :                 const SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport(
     606      327506 :                         mpImpl->mxPropMapper->GetEarliestODFVersionForExport(i));
     607      327506 :                 if( nCurrentVersion >= nEarliestODFVersionForExport
     608           0 :                         || nCurrentVersion == SvtSaveOptions::ODFVER_UNKNOWN
     609           0 :                         || nEarliestODFVersionForExport == SvtSaveOptions::ODFVER_UNKNOWN )
     610      327506 :                     pFilterInfo->AddProperty(rAPIName, i);
     611             :             }
     612             :         }
     613             : 
     614             :         // Check whether the property set info is destroyed if it is assigned to
     615             :         // a weak reference only; If it is destroyed, then every instance of
     616             :         // getPropertySetInfo returns a new object; such property set infos must
     617             :         // not be cached:
     618        3671 :         WeakReference < XPropertySetInfo > xWeakInfo( xInfo );
     619        3671 :         xInfo = 0;
     620        3671 :         xInfo = xWeakInfo;
     621        3671 :         if( xInfo.is() )
     622             :         {
     623        3663 :             mpImpl->maCache.insert(Impl::CacheType::value_type(xInfo, pFilterInfo));
     624             :         }
     625             :         else
     626           8 :             bDelInfo = true;
     627             :     }
     628             : 
     629        9339 :     if( pFilterInfo->GetPropertyCount() )
     630             :     {
     631             :         try
     632             :         {
     633             :             pFilterInfo->FillPropertyStateArray(
     634        9317 :                 aPropStateArray, xPropSet, mpImpl->mxPropMapper, bDefault);
     635             :         }
     636           0 :         catch( UnknownPropertyException& )
     637             :         {
     638             :             // might be a problem of getImplemenetationId
     639             :             OSL_ENSURE( !this, "unknown property in getPropertyStates" );
     640             :         }
     641             :     }
     642             : 
     643             :     // Call centext-filter
     644        9339 :     if( !aPropStateArray.empty() )
     645        6241 :         ContextFilter(bEnableFoFontFamily, aPropStateArray, xPropSet);
     646             : 
     647             :     // Have to do if we change from a vector to a list or something like that
     648             : 
     649        9339 :     if( bDelInfo )
     650           8 :         delete pFilterInfo;
     651             : 
     652        9339 :     return aPropStateArray;
     653             : }
     654             : 
     655       16762 : void SvXMLExportPropertyMapper::ContextFilter(
     656             :         bool bEnableFoFontFamily,
     657             :         vector< XMLPropertyState >& rProperties,
     658             :         Reference< XPropertySet > rPropSet ) const
     659             : {
     660             :     // Derived class could implement this.
     661       16762 :     if (mpImpl->mxNextMapper.is())
     662       10570 :         mpImpl->mxNextMapper->ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
     663       16762 : }
     664             : 
     665             : // Compares two Sequences of XMLPropertyState:
     666             : //  1.Number of elements equal ?
     667             : //  2.Index of each element equal ? (So I know whether the propertynames are the same)
     668             : //  3.Value of each element equal ?
     669        2276 : bool SvXMLExportPropertyMapper::Equals(
     670             :         const vector< XMLPropertyState >& aProperties1,
     671             :         const vector< XMLPropertyState >& aProperties2 ) const
     672             : {
     673        2276 :     bool bRet = true;
     674        2276 :     sal_uInt32 nCount = aProperties1.size();
     675             : 
     676        2276 :     if( nCount == aProperties2.size() )
     677             :     {
     678        2276 :         sal_uInt32 nIndex = 0;
     679       13256 :         while( bRet && nIndex < nCount )
     680             :         {
     681        8704 :             const XMLPropertyState& rProp1 = aProperties1[ nIndex ];
     682        8704 :             const XMLPropertyState& rProp2 = aProperties2[ nIndex ];
     683             : 
     684             :             // Compare index. If equal, compare value
     685        8704 :             if( rProp1.mnIndex == rProp2.mnIndex )
     686             :             {
     687        7969 :                 if( rProp1.mnIndex != -1 )
     688             :                 {
     689             :                     // Now compare values
     690        7062 :                     if ( (mpImpl->mxPropMapper->GetEntryType( rProp1.mnIndex ) &
     691             :                           XML_TYPE_BUILDIN_CMP ) != 0 )
     692             :                         // simple type ( binary compare )
     693        3871 :                         bRet = ( rProp1.maValue == rProp2.maValue );
     694             :                     else
     695             :                         // complex type ( ask for compare-function )
     696             :                         bRet = mpImpl->mxPropMapper->GetPropertyHandler(
     697        3191 :                                     rProp1.mnIndex )->equals( rProp1.maValue,
     698        3191 :                                                               rProp2.maValue );
     699             :                 }
     700             :             }
     701             :             else
     702         735 :                 bRet = false;
     703             : 
     704        8704 :             nIndex++;
     705             :         }
     706             :     }
     707             :     else
     708           0 :         bRet = false;
     709             : 
     710        2276 :     return bRet;
     711             : }
     712             : 
     713             : /** fills the given attribute list with the items in the given set
     714             : void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
     715             :         const ::std::vector< XMLPropertyState >& rProperties,
     716             :         const SvXMLUnitConverter& rUnitConverter,
     717             :         const SvXMLNamespaceMap& rNamespaceMap,
     718             :         sal_uInt16 nFlags ) const
     719             : {
     720             :     _exportXML( rAttrList, rProperties, rUnitConverter, rNamespaceMap,
     721             :                 nFlags, 0, -1, -1 );
     722             : }
     723             : 
     724             : void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
     725             :         const ::std::vector< XMLPropertyState >& rProperties,
     726             :         const SvXMLUnitConverter& rUnitConverter,
     727             :         const SvXMLNamespaceMap& rNamespaceMap,
     728             :         sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
     729             :         sal_uInt16 nFlags ) const
     730             : {
     731             :     _exportXML( rAttrList, rProperties, rUnitConverter, rNamespaceMap,
     732             :                 nFlags, 0, nPropMapStartIdx, nPropMapEndIdx );
     733             : }
     734             : */
     735             : 
     736         876 : void SvXMLExportPropertyMapper::exportXML(
     737             :         SvXMLExport& rExport,
     738             :         const ::std::vector< XMLPropertyState >& rProperties,
     739             :         sal_uInt16 nFlags ) const
     740             : {
     741         876 :     exportXML( rExport, rProperties, -1, -1,  nFlags );
     742         876 : }
     743             : 
     744        3428 : void SvXMLExportPropertyMapper::exportXML(
     745             :         SvXMLExport& rExport,
     746             :         const ::std::vector< XMLPropertyState >& rProperties,
     747             :         sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
     748             :         sal_uInt16 nFlags ) const
     749             : {
     750        3428 :     sal_uInt16 nPropTypeFlags = 0;
     751       51420 :     for( sal_uInt16 i=0; i<MAX_PROP_TYPES; ++i )
     752             :     {
     753       47992 :         sal_uInt16 nPropType = aPropTokens[i].nType;
     754       47992 :         if( 0==i || (nPropTypeFlags & (1 << nPropType)) != 0 )
     755             :         {
     756        8364 :             std::vector<sal_uInt16> aIndexArray;
     757             : 
     758             :             _exportXML( nPropType, nPropTypeFlags,
     759        8364 :                         rExport.GetAttrList(), rProperties,
     760        8364 :                         rExport.GetMM100UnitConverter(),
     761        8364 :                         rExport.GetNamespaceMap(),
     762             :                         nFlags, &aIndexArray,
     763       16728 :                         nPropMapStartIdx, nPropMapEndIdx );
     764             : 
     765       18853 :             if( rExport.GetAttrList().getLength() > 0L ||
     766       10489 :                 (nFlags & XML_EXPORT_FLAG_EMPTY) != 0 ||
     767        2125 :                 !aIndexArray.empty() )
     768             :             {
     769             :                 SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE,
     770             :                                   aPropTokens[i].eToken,
     771        6245 :                                   (nFlags & XML_EXPORT_FLAG_IGN_WS) != 0,
     772        6245 :                                   false );
     773             : 
     774        6245 :                 exportElementItems( rExport, rProperties, nFlags, aIndexArray );
     775        8364 :             }
     776             :         }
     777             :     }
     778        3428 : }
     779             : 
     780             : /** this method is called for every item that has the
     781             :     MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
     782           0 : void SvXMLExportPropertyMapper::handleSpecialItem(
     783             :         SvXMLAttributeList& rAttrList,
     784             :         const XMLPropertyState& rProperty,
     785             :         const SvXMLUnitConverter& rUnitConverter,
     786             :         const SvXMLNamespaceMap& rNamespaceMap,
     787             :         const ::std::vector< XMLPropertyState > *pProperties,
     788             :         sal_uInt32 nIdx ) const
     789             : {
     790             :     OSL_ENSURE(mpImpl->mxNextMapper.is(), "special item not handled in xml export");
     791           0 :     if (mpImpl->mxNextMapper.is())
     792           0 :         mpImpl->mxNextMapper->handleSpecialItem(
     793           0 :             rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx);
     794           0 : }
     795             : 
     796             : /** this method is called for every item that has the
     797             :     MID_FLAG_ELEMENT_EXPORT flag set */
     798          48 : void SvXMLExportPropertyMapper::handleElementItem(
     799             :         SvXMLExport& rExport,
     800             :         const XMLPropertyState& rProperty,
     801             :         sal_uInt16 nFlags,
     802             :         const ::std::vector< XMLPropertyState > *pProperties,
     803             :         sal_uInt32 nIdx ) const
     804             : {
     805             :     OSL_ENSURE(mpImpl->mxNextMapper.is(), "element item not handled in xml export");
     806          48 :     if (mpImpl->mxNextMapper.is())
     807          48 :         mpImpl->mxNextMapper->handleElementItem(rExport, rProperty, nFlags, pProperties, nIdx);
     808          48 : }
     809             : 
     810             : // protected methods
     811             : 
     812             : /** fills the given attribute list with the items in the given set */
     813        8364 : void SvXMLExportPropertyMapper::_exportXML(
     814             :         sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
     815             :         SvXMLAttributeList& rAttrList,
     816             :         const ::std::vector< XMLPropertyState >& rProperties,
     817             :         const SvXMLUnitConverter& rUnitConverter,
     818             :         const SvXMLNamespaceMap& rNamespaceMap,
     819             :         sal_uInt16 nFlags,
     820             :         std::vector<sal_uInt16>* pIndexArray,
     821             :         sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const
     822             : {
     823        8364 :     const sal_uInt32 nCount = rProperties.size();
     824        8364 :     sal_uInt32 nIndex = 0;
     825             : 
     826        8364 :     if( -1 == nPropMapStartIdx )
     827        8042 :         nPropMapStartIdx = 0;
     828        8364 :     if( -1 == nPropMapEndIdx )
     829        8042 :         nPropMapEndIdx = mpImpl->mxPropMapper->GetEntryCount();
     830             : 
     831      140392 :     while( nIndex < nCount )
     832             :     {
     833      123664 :         sal_Int32 nPropMapIdx = rProperties[nIndex].mnIndex;
     834      123664 :         if( nPropMapIdx >= nPropMapStartIdx &&
     835             :             nPropMapIdx < nPropMapEndIdx  )// valid entry?
     836             :         {
     837       96094 :             sal_uInt32 nEFlags = mpImpl->mxPropMapper->GetEntryFlags(nPropMapIdx);
     838       96094 :             sal_uInt16 nEPType = GET_PROP_TYPE(nEFlags);
     839             :             OSL_ENSURE( nEPType >= (XML_TYPE_PROP_START>>XML_TYPE_PROP_SHIFT),
     840             :                         "no prop type sepcified" );
     841       96094 :             rPropTypeFlags |= (1 << nEPType);
     842       96094 :             if( nEPType == nPropType )
     843             :             {
     844             :                 // we have a valid map entry here, so lets use it...
     845       33898 :                 if( ( nEFlags & MID_FLAG_ELEMENT_ITEM_EXPORT ) != 0 )
     846             :                 {
     847             :                     // element items do not add any properties,
     848             :                     // we export it later
     849         393 :                     if( pIndexArray )
     850             :                     {
     851         393 :                         pIndexArray->push_back( (sal_uInt16)nIndex );
     852             :                     }
     853             :                 }
     854             :                 else
     855             :                 {
     856       33505 :                     _exportXML( rAttrList, rProperties[nIndex], rUnitConverter,
     857       67010 :                                 rNamespaceMap, nFlags, &rProperties, nIndex );
     858             :                 }
     859             :             }
     860             :         }
     861             : 
     862      123664 :         nIndex++;
     863             :     }
     864        8364 : }
     865             : 
     866       33505 : void SvXMLExportPropertyMapper::_exportXML(
     867             :         SvXMLAttributeList& rAttrList,
     868             :         const XMLPropertyState& rProperty,
     869             :         const SvXMLUnitConverter& rUnitConverter,
     870             :         const SvXMLNamespaceMap& rNamespaceMap,
     871             :         sal_uInt16 /*nFlags*/,
     872             :         const ::std::vector< XMLPropertyState > *pProperties,
     873             :         sal_uInt32 nIdx ) const
     874             : {
     875       33505 :     if ((mpImpl->mxPropMapper->GetEntryFlags(rProperty.mnIndex) & MID_FLAG_SPECIAL_ITEM_EXPORT) != 0)
     876             :     {
     877        2022 :         uno::Reference< container::XNameContainer > xAttrContainer;
     878        2022 :         if( (rProperty.maValue >>= xAttrContainer) && xAttrContainer.is() )
     879             :         {
     880          34 :             SvXMLNamespaceMap *pNewNamespaceMap = 0;
     881          34 :             const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap;
     882             : 
     883          34 :             uno::Sequence< OUString > aAttribNames( xAttrContainer->getElementNames() );
     884          34 :             const OUString* pAttribName = aAttribNames.getConstArray();
     885             : 
     886          34 :             const sal_Int32 nCount = aAttribNames.getLength();
     887             : 
     888          68 :             OUStringBuffer sNameBuffer;
     889          68 :             xml::AttributeData aData;
     890          34 :             for( sal_Int32 i=0; i < nCount; i++, pAttribName++ )
     891             :             {
     892           0 :                 xAttrContainer->getByName( *pAttribName ) >>= aData;
     893           0 :                 OUString sAttribName( *pAttribName );
     894             : 
     895             :                 // extract namespace prefix from attribute name if it exists
     896           0 :                 OUString sPrefix;
     897             :                 const sal_Int32 nColonPos =
     898           0 :                     pAttribName->indexOf( ':' );
     899           0 :                 if( nColonPos != -1 )
     900           0 :                     sPrefix = pAttribName->copy( 0, nColonPos );
     901             : 
     902           0 :                 if( !sPrefix.isEmpty() )
     903             :                 {
     904           0 :                     OUString sNamespace( aData.Namespace );
     905             : 
     906             :                     // if the prefix isn't defined yet or has another meaning,
     907             :                     // we have to redefine it now.
     908           0 :                     sal_uInt16 nKey = pNamespaceMap->GetKeyByPrefix( sPrefix );
     909           0 :                     if( USHRT_MAX == nKey || pNamespaceMap->GetNameByKey( nKey ) != sNamespace )
     910             :                     {
     911           0 :                         sal_Bool bAddNamespace = sal_False;
     912           0 :                         if( USHRT_MAX == nKey )
     913             :                         {
     914             :                             // The prefix is unused, so it is sufficient
     915             :                             // to add it to the namespace map.
     916           0 :                             bAddNamespace = sal_True;
     917             :                         }
     918             :                         else
     919             :                         {
     920             :                             // check if there is a prefix registered for the
     921             :                             // namepsace URI
     922           0 :                             nKey = pNamespaceMap->GetKeyByName( sNamespace );
     923           0 :                             if( XML_NAMESPACE_UNKNOWN == nKey )
     924             :                             {
     925             :                                 // There is no prefix for the namespace, so
     926             :                                 // we have to generate one and have to add it.
     927           0 :                                 sal_Int32 n=0;
     928           0 :                                 OUString sOrigPrefix( sPrefix );
     929           0 :                                 do
     930             :                                 {
     931           0 :                                     sNameBuffer.append( sOrigPrefix );
     932           0 :                                     sNameBuffer.append( ++n );
     933           0 :                                     sPrefix = sNameBuffer.makeStringAndClear();
     934           0 :                                     nKey = pNamespaceMap->GetKeyByPrefix( sPrefix );
     935             :                                 }
     936             :                                 while( nKey != USHRT_MAX );
     937             : 
     938           0 :                                 bAddNamespace = sal_True;
     939             :                             }
     940             :                             else
     941             :                             {
     942             :                                 // If there is a prefix for the namespace,
     943             :                                 // we reuse that.
     944           0 :                                 sPrefix = pNamespaceMap->GetPrefixByKey( nKey );
     945             :                             }
     946             :                             // In any case, the attribute name has to be adapted.
     947           0 :                             sNameBuffer.append( sPrefix + ":" + pAttribName->copy( nColonPos+1 ) );
     948           0 :                             sAttribName = sNameBuffer.makeStringAndClear();
     949             :                         }
     950             : 
     951           0 :                         if( bAddNamespace )
     952             :                         {
     953           0 :                             if( !pNewNamespaceMap )
     954             :                             {
     955           0 :                                 pNewNamespaceMap = new SvXMLNamespaceMap( rNamespaceMap );
     956           0 :                                 pNamespaceMap = pNewNamespaceMap;
     957             :                             }
     958           0 :                             pNewNamespaceMap->Add( sPrefix, sNamespace );
     959           0 :                             sNameBuffer.append( GetXMLToken(XML_XMLNS) + ":" + sPrefix );
     960             :                             rAttrList.AddAttribute( sNameBuffer.makeStringAndClear(),
     961           0 :                                                     sNamespace );
     962             :                         }
     963           0 :                     }
     964             :                 }
     965           0 :                 OUString sOldValue( rAttrList.getValueByName( sAttribName ) );
     966             :                 OSL_ENSURE( sOldValue.isEmpty(), "alien attribute exists already" );
     967             :                 OSL_ENSURE(aData.Type == GetXMLToken(XML_CDATA), "different type to our default type which should be written out");
     968           0 :                 if( sOldValue.isEmpty() )
     969           0 :                     rAttrList.AddAttribute( sAttribName, aData.Value );
     970           0 :             }
     971             : 
     972          68 :             delete pNewNamespaceMap;
     973             :         }
     974             :         else
     975             :         {
     976             :             handleSpecialItem( rAttrList, rProperty, rUnitConverter,
     977        1988 :                                rNamespaceMap, pProperties, nIdx );
     978        2022 :         }
     979             :     }
     980       31483 :     else if ((mpImpl->mxPropMapper->GetEntryFlags(rProperty.mnIndex) & MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0)
     981             :     {
     982       31483 :         OUString aValue;
     983             :         const OUString sName = rNamespaceMap.GetQNameByKey(
     984       31483 :             mpImpl->mxPropMapper->GetEntryNameSpace(rProperty.mnIndex),
     985       94449 :             mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex));
     986             : 
     987       31483 :         sal_Bool bRemove = sal_False;
     988       31483 :         if ((mpImpl->mxPropMapper->GetEntryFlags( rProperty.mnIndex ) & MID_FLAG_MERGE_ATTRIBUTE) != 0)
     989             :         {
     990        2531 :             aValue = rAttrList.getValueByName( sName );
     991        2531 :             bRemove = sal_True;
     992             :         }
     993             : 
     994       31483 :         if (mpImpl->mxPropMapper->exportXML(aValue, rProperty, rUnitConverter))
     995             :         {
     996       25970 :             if( bRemove )
     997        2151 :                 rAttrList.RemoveAttribute( sName );
     998       25970 :             rAttrList.AddAttribute( sName, aValue );
     999       31483 :         }
    1000             :     }
    1001       33505 : }
    1002             : 
    1003        6245 : void SvXMLExportPropertyMapper::exportElementItems(
    1004             :         SvXMLExport& rExport,
    1005             :         const ::std::vector< XMLPropertyState >& rProperties,
    1006             :         sal_uInt16 nFlags,
    1007             :         const std::vector<sal_uInt16>& rIndexArray ) const
    1008             : {
    1009        6245 :     const sal_uInt16 nCount = rIndexArray.size();
    1010             : 
    1011        6245 :     sal_Bool bItemsExported = sal_False;
    1012        6638 :     for( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
    1013             :     {
    1014         393 :         const sal_uInt16 nElement = rIndexArray[nIndex];
    1015             : 
    1016             :         OSL_ENSURE( 0 != (mpImpl->mxPropMapper->GetEntryFlags(
    1017             :                 rProperties[nElement].mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT),
    1018             :                 "wrong mid flag!" );
    1019             : 
    1020         393 :         rExport.IgnorableWhitespace();
    1021         393 :         handleElementItem( rExport, rProperties[nElement],
    1022         786 :                            nFlags, &rProperties, nElement );
    1023         393 :         bItemsExported = sal_True;
    1024             :     }
    1025             : 
    1026        6245 :     if( bItemsExported )
    1027         368 :         rExport.IgnorableWhitespace();
    1028        6245 : }
    1029             : 
    1030      191877 : const UniReference<XMLPropertySetMapper>& SvXMLExportPropertyMapper::getPropertySetMapper() const
    1031             : {
    1032      191877 :     return mpImpl->mxPropMapper;
    1033             : }
    1034             : 
    1035        1480 : void SvXMLExportPropertyMapper::SetStyleName( const OUString& rStyleName )
    1036             : {
    1037        1480 :     mpImpl->maStyleName = rStyleName;
    1038        1480 : }
    1039             : 
    1040          31 : const OUString& SvXMLExportPropertyMapper::GetStyleName() const
    1041             : {
    1042          31 :     return mpImpl->maStyleName;
    1043             : }
    1044             : 
    1045             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10