LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/text - txtstyli.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 177 223 79.4 %
Date: 2012-12-17 Functions: 12 14 85.7 %
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             : 
      21             : #include "XMLTextPropertySetContext.hxx"
      22             : #include "xmloff/xmlnmspe.hxx"
      23             : #include "xmloff/XMLEventsImportContext.hxx"
      24             : #include "xmloff/attrlist.hxx"
      25             : #include "xmloff/families.hxx"
      26             : #include "xmloff/txtprmap.hxx"
      27             : #include "xmloff/txtstyli.hxx"
      28             : #include "xmloff/xmlimp.hxx"
      29             : #include "xmloff/xmltkmap.hxx"
      30             : #include "xmloff/xmltoken.hxx"
      31             : #include "xmloff/xmluconv.hxx"
      32             : 
      33             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      34             : #include <com/sun/star/container/XNameContainer.hpp>
      35             : #include <com/sun/star/document/XEventsSupplier.hpp>
      36             : #include <com/sun/star/frame/XModel.hpp>
      37             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      38             : #include <com/sun/star/style/ParagraphStyleCategory.hpp>
      39             : #include <com/sun/star/style/XStyle.hpp>
      40             : 
      41             : #include <sax/tools/converter.hxx>
      42             : 
      43             : #include <tools/debug.hxx>
      44             : #include <tools/diagnose_ex.h>
      45             : 
      46             : // STL includes
      47             : #include <algorithm>
      48             : #include <functional>
      49             : #include <utility>
      50             : #include <vector>
      51             : 
      52             : using ::rtl::OUString;
      53             : using ::rtl::OUStringBuffer;
      54             : 
      55             : using namespace ::std;
      56             : using namespace ::com::sun::star;
      57             : using namespace ::com::sun::star::uno;
      58             : using namespace ::com::sun::star::xml::sax;
      59             : using namespace ::com::sun::star::style;
      60             : using namespace ::com::sun::star::frame;
      61             : using namespace ::com::sun::star::beans;
      62             : using namespace ::com::sun::star::lang;
      63             : using namespace ::com::sun::star::container;
      64             : using namespace ::xmloff::token;
      65             : 
      66             : static SvXMLEnumMapEntry aCategoryMap[] =
      67             : {
      68             :     { XML_TEXT,     ParagraphStyleCategory::TEXT },
      69             :     { XML_CHAPTER,  ParagraphStyleCategory::CHAPTER },
      70             :     { XML_LIST,     ParagraphStyleCategory::LIST },
      71             :     { XML_INDEX,    ParagraphStyleCategory::INDEX },
      72             :     { XML_EXTRA,    ParagraphStyleCategory::EXTRA },
      73             :     { XML_HTML,     ParagraphStyleCategory::HTML },
      74             :     { XML_TOKEN_INVALID, 0 }
      75             : };
      76             : 
      77        2462 : void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
      78             :                                         const OUString& rLocalName,
      79             :                                         const OUString& rValue )
      80             : {
      81        2462 :     if( XML_NAMESPACE_STYLE == nPrefixKey )
      82             :     {
      83             :         // TODO: use a map here
      84        2462 :         if( IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
      85             :         {
      86           0 :             if( IsXMLToken( rValue, XML_TRUE ) )
      87           0 :                 bAutoUpdate = sal_True;
      88             :         }
      89        2462 :         else if( IsXMLToken( rLocalName, XML_LIST_STYLE_NAME ) )
      90             :         {
      91          47 :             sListStyleName = rValue;
      92             :             // Inherited paragraph style lost information about unset numbering (#i69523#)
      93          47 :             mbListStyleSet = sal_True;
      94             :         }
      95        2415 :         else if( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
      96             :         {
      97          36 :             sMasterPageName = rValue;
      98          36 :             bHasMasterPageName = sal_True;
      99             :         }
     100        2379 :         else if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
     101             :         {
     102           0 :             sDataStyleName = rValue;
     103             :         }
     104        2379 :         else if( IsXMLToken( rLocalName, XML_CLASS ) )
     105             :         {
     106         300 :             sCategoryVal = rValue;
     107             :         }
     108        2079 :         else if( IsXMLToken( rLocalName, XML_DEFAULT_OUTLINE_LEVEL ) )
     109             :         {
     110             :             sal_Int32 nTmp;
     111          28 :             if (::sax::Converter::convertNumber( nTmp, rValue ) &&
     112             :                 0 <= nTmp && nTmp <= 10 )
     113          28 :                 nOutlineLevel = static_cast< sal_Int8 >( nTmp );
     114             :         }
     115             :         else
     116             :         {
     117        2051 :             XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     118             :         }
     119             :     }
     120             :     else
     121             :     {
     122           0 :         XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     123             :     }
     124        2462 : }
     125             : 
     126        2021 : TYPEINIT1( XMLTextStyleContext, XMLPropStyleContext );
     127             : 
     128         716 : XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
     129             :         sal_uInt16 nPrfx, const OUString& rLName,
     130             :         const Reference< XAttributeList > & xAttrList,
     131             :         SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
     132             :         sal_Bool bDefaultStyle )
     133             : :   XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle )
     134             : ,   sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) )
     135             : ,   sCategory( RTL_CONSTASCII_USTRINGPARAM( "Category" ) )
     136             : ,   sNumberingStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyleName" ) )
     137             : ,       sOutlineLevel(RTL_CONSTASCII_USTRINGPARAM( "OutlineLevel" ) )
     138             : ,   sDropCapCharStyleName( RTL_CONSTASCII_USTRINGPARAM( "DropCapCharStyleName" ) )
     139             : ,   sPageDescName( RTL_CONSTASCII_USTRINGPARAM( "PageDescName" ) )
     140             : ,   nOutlineLevel( -1 )
     141             : ,   bAutoUpdate( sal_False )
     142             : ,   bHasMasterPageName( sal_False )
     143             : ,   bHasCombinedCharactersLetter( sal_False )
     144             : // Inherited paragraph style lost information about unset numbering (#i69523#)
     145             : ,   mbListStyleSet( sal_False )
     146         716 : ,   pEventContext( NULL )
     147             : {
     148         716 : }
     149             : 
     150        1000 : XMLTextStyleContext::~XMLTextStyleContext()
     151             : {
     152        1000 : }
     153             : 
     154         858 : SvXMLImportContext *XMLTextStyleContext::CreateChildContext(
     155             :         sal_uInt16 nPrefix,
     156             :         const OUString& rLocalName,
     157             :         const Reference< XAttributeList > & xAttrList )
     158             : {
     159         858 :     SvXMLImportContext *pContext = 0;
     160             : 
     161         858 :     if( XML_NAMESPACE_STYLE == nPrefix )
     162             :     {
     163         858 :         sal_uInt32 nFamily = 0;
     164         858 :         if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
     165         423 :             nFamily = XML_TYPE_PROP_TEXT;
     166         435 :         else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
     167         363 :             nFamily = XML_TYPE_PROP_PARAGRAPH;
     168          72 :         else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
     169           2 :             nFamily = XML_TYPE_PROP_SECTION;
     170          70 :         else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
     171          35 :             nFamily = XML_TYPE_PROP_TABLE;
     172          35 :         else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
     173          35 :             nFamily = XML_TYPE_PROP_TABLE_ROW;
     174         858 :         if( nFamily )
     175             :         {
     176             :             UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     177         858 :                 GetStyles()->GetImportPropertyMapper( GetFamily() );
     178         858 :             if( xImpPrMap.is() )
     179         858 :                 pContext = new XMLTextPropertySetContext( GetImport(), nPrefix,
     180             :                                                         rLocalName, xAttrList,
     181             :                                                         nFamily,
     182         858 :                                                         GetProperties(),
     183             :                                                         xImpPrMap,
     184        1716 :                                                         sDropCapTextStyleName );
     185             :         }
     186             :     }
     187           0 :     else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
     188           0 :               IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
     189             :     {
     190             :         // create and remember events import context
     191             :         // (for delayed processing of events)
     192           0 :         pEventContext = new XMLEventsImportContext( GetImport(), nPrefix,
     193           0 :                                                    rLocalName);
     194           0 :         pEventContext->AddRef();
     195           0 :         pContext = pEventContext;
     196             :     }
     197             : 
     198         858 :     if( !pContext )
     199             :         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
     200           0 :                                                           xAttrList );
     201             : 
     202         858 :     return pContext;
     203             : }
     204             : 
     205         545 : void XMLTextStyleContext::CreateAndInsert( sal_Bool bOverwrite )
     206             : {
     207         545 :     XMLPropStyleContext::CreateAndInsert( bOverwrite );
     208         545 :     Reference < XStyle > xStyle = GetStyle();
     209         545 :     if( !xStyle.is() || !(bOverwrite || IsNew()) )
     210         545 :         return;
     211             : 
     212         462 :     Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
     213             :     Reference< XPropertySetInfo > xPropSetInfo =
     214         462 :                 xPropSet->getPropertySetInfo();
     215         462 :     if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
     216             :     {
     217         352 :         Any aAny;
     218         352 :         sal_Bool bTmp = bAutoUpdate;
     219         352 :         aAny.setValue( &bTmp, ::getBooleanCppuType() );
     220         352 :         xPropSet->setPropertyValue( sIsAutoUpdate, aAny );
     221             :     }
     222             : 
     223         462 :     sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
     224        1130 :     if(  XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() &&
     225         652 :          !sCategoryVal.isEmpty() && xStyle->isUserDefined() &&
     226           8 :          xPropSetInfo->hasPropertyByName( sCategory ) &&
     227           8 :           SvXMLUnitConverter::convertEnum( nCategory, sCategoryVal, aCategoryMap ) )
     228             :     {
     229           8 :         Any aAny;
     230           8 :         aAny <<= (sal_Int16)nCategory;
     231           8 :         xPropSet->setPropertyValue( sCategory, aAny );
     232             :     }
     233             : 
     234             :     // tell the style about it's events (if applicable)
     235         462 :     if (NULL != pEventContext)
     236             :     {
     237             :         // set event suppplier and release reference to context
     238           0 :         Reference<document::XEventsSupplier> xEventsSupplier(xStyle,UNO_QUERY);
     239           0 :         pEventContext->SetEvents(xEventsSupplier);
     240           0 :         pEventContext->ReleaseRef();
     241             :     }
     242             : 
     243             :     // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
     244         462 :     if ( nOutlineLevel > 0 )
     245             :     {
     246           8 :         GetImport().GetTextImport()->AddOutlineStyleCandidate( nOutlineLevel,
     247          16 :                                                       GetDisplayName() );
     248         462 :     }
     249             : }
     250             : 
     251         105 : void XMLTextStyleContext::SetDefaults( )
     252             : {
     253         210 :     if( ( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ||
     254          70 :         ( GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) ||
     255          35 :         ( GetFamily() == XML_STYLE_FAMILY_TABLE_ROW ) )
     256             :     {
     257         105 :         Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
     258         105 :         if (xFactory.is())
     259             :         {
     260         105 :             Reference < XInterface > xInt = xFactory->createInstance (
     261         105 :                 OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.Defaults" ) ) );
     262         105 :             Reference < XPropertySet > xProperties ( xInt, UNO_QUERY );
     263         105 :             if ( xProperties.is() )
     264         105 :                 FillPropertySet ( xProperties );
     265         105 :         }
     266             :     }
     267         105 : }
     268             : 
     269         518 : void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
     270             : {
     271         518 :     XMLPropStyleContext::Finish( bOverwrite );
     272             : 
     273         518 :     Reference < XStyle > xStyle = GetStyle();
     274             :     // Consider set empty list style (#i69523#)
     275        1036 :     if ( !( mbListStyleSet ||
     276             :             nOutlineLevel >= 0 ||
     277         474 :             !sDropCapTextStyleName.isEmpty() ||
     278        1492 :             bHasMasterPageName ) ||
     279          60 :          !xStyle.is() ||
     280           0 :          !( bOverwrite || IsNew() ) )
     281         518 :         return;
     282             : 
     283          60 :     Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
     284             :     Reference< XPropertySetInfo > xPropSetInfo =
     285          60 :                 xPropSet->getPropertySetInfo();
     286             : 
     287          60 :     if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
     288             :     {
     289          60 :         Any aAny;
     290          60 :         if( nOutlineLevel >= 0 )
     291             :         {
     292          28 :             aAny <<= nOutlineLevel;
     293          28 :             xPropSet->setPropertyValue( sOutlineLevel, aAny );
     294          60 :         }
     295             :     }
     296             : 
     297             :     // Consider set empty list style (#i69523#)
     298          78 :     if ( mbListStyleSet &&
     299          18 :          xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
     300             :     {
     301             :         /* Only for text document from version prior OOo 2.1 resp. SO 8 PU5:
     302             :            - Do not apply list style, if paragraph style has a default outline
     303             :              level > 0 and thus, will be assigned to the corresponding list
     304             :              level of the outline style. (#i70223#)
     305             :         */
     306          18 :         bool bApplyListStyle( true );
     307          18 :         if ( nOutlineLevel > 0 )
     308             :         {
     309           2 :             if ( GetImport().IsTextDocInOOoFileFormat() )
     310             :             {
     311           0 :                 bApplyListStyle = false;
     312             :             }
     313             :             else
     314             :             {
     315           2 :                 sal_Int32 nUPD( 0 );
     316           2 :                 sal_Int32 nBuild( 0 );
     317             :                 // Check explicitly on certain versions (#i86058#)
     318           2 :                 if ( GetImport().getBuildIds( nUPD, nBuild ) &&
     319             :                      ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
     320             :                        ( nUPD == 680 && nBuild <= 9073 ) ) ) // OOo 2.0 - OOo 2.0.4
     321             :                 {
     322           0 :                     bApplyListStyle = false;
     323             :                 }
     324             :             }
     325             :         }
     326             : 
     327          18 :         if ( bApplyListStyle )
     328             :         {
     329          18 :             if ( sListStyleName.isEmpty() )
     330             :             {
     331           0 :                 Any aAny;
     332           0 :                 aAny <<= sListStyleName /* empty string */;
     333           0 :                 xPropSet->setPropertyValue( sNumberingStyleName, aAny );
     334             :             }
     335             :             else
     336             :             {
     337             :                 // change list style name to display name
     338             :                 OUString sDisplayListStyleName(
     339          18 :                     GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
     340          36 :                                                   sListStyleName ) );
     341             :                 // The families container must exist
     342             :                 const Reference < XNameContainer >& rNumStyles =
     343          18 :                     GetImport().GetTextImport()->GetNumberingStyles();
     344             :     //            if( rNumStyles.is() && rNumStyles->hasByName( sDisplayListStyleName ) &&
     345             :     //                xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
     346          36 :                 if ( rNumStyles.is() &&
     347          18 :                      rNumStyles->hasByName( sDisplayListStyleName ) )
     348             :                 {
     349          18 :                     Any aAny;
     350          18 :                     aAny <<= sDisplayListStyleName;
     351          18 :                     xPropSet->setPropertyValue( sNumberingStyleName, aAny );
     352          18 :                 }
     353             :             }
     354             :         }
     355             :     }
     356             : 
     357          60 :     if( !sDropCapTextStyleName.isEmpty() )
     358             :     {
     359             :         // change list style name to display name
     360             :         OUString sDisplayDropCapTextStyleName(
     361           0 :             GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_TEXT,
     362           0 :                                           sDropCapTextStyleName ) );
     363             :         // The families cointaner must exist
     364             :         const Reference < XNameContainer >& rTextStyles =
     365           0 :             GetImport().GetTextImport()->GetTextStyles();
     366           0 :         if( rTextStyles.is() &&
     367           0 :             rTextStyles->hasByName( sDisplayDropCapTextStyleName ) &&
     368           0 :             xPropSetInfo->hasPropertyByName( sDropCapCharStyleName ) )
     369             :         {
     370           0 :             Any aAny;
     371           0 :             aAny <<= sDisplayDropCapTextStyleName;
     372           0 :             xPropSet->setPropertyValue( sDropCapCharStyleName, aAny );
     373           0 :         }
     374             :     }
     375             : 
     376          60 :     if( bHasMasterPageName )
     377             :     {
     378             :         OUString sDisplayName(
     379          16 :             GetImport().GetStyleDisplayName(
     380          32 :                             XML_STYLE_FAMILY_MASTER_PAGE, sMasterPageName ) );
     381             :         // The families cointaner must exist
     382             :         const Reference < XNameContainer >& rPageStyles =
     383          16 :             GetImport().GetTextImport()->GetPageStyles();
     384          32 :         if( ( sDisplayName.isEmpty() ||
     385           0 :               (rPageStyles.is() &&
     386           0 :                rPageStyles->hasByName( sDisplayName )) ) &&
     387          16 :             xPropSetInfo->hasPropertyByName( sPageDescName ) )
     388             :         {
     389          16 :             Any aAny;
     390          16 :             aAny <<= sDisplayName;
     391          16 :             xPropSet->setPropertyValue( sPageDescName, aAny );
     392          16 :         }
     393          60 :     }
     394             : }
     395             : 
     396        1110 : void XMLTextStyleContext::FillPropertySet(
     397             :     const Reference<XPropertySet > & rPropSet )
     398             : {
     399             :     // imitate the FillPropertySet of the super class, so we get a chance to
     400             :     // catch the combined characters attribute
     401             : 
     402             :     // imitate XMLPropStyleContext::FillPropertySet(...)
     403             :     UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     404        1110 :         ((SvXMLStylesContext *)GetStyles())->GetImportPropertyMapper(GetFamily());
     405             :     DBG_ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" );
     406        1110 :     if( xImpPrMap.is() )
     407             :     {
     408             : 
     409             :         // imitate SvXMLImportPropertyMapper::FillPropertySet(...)
     410             : 
     411             :         // The reason for this is that we have no other way to
     412             :         // efficiently intercept the value of combined characters. To
     413             :         // get that value, we could iterate through the map once more,
     414             :         // but instead we chose to insert the code into this
     415             :         // iteration. I haven't been able to come up with a much more
     416             :         // intelligent solution.
     417             : 
     418             : 
     419             :         struct _ContextID_Index_Pair aContextIDs[] =
     420             :         {
     421             :             { CTF_COMBINED_CHARACTERS_FIELD, -1 },
     422             :             { CTF_KEEP_TOGETHER, -1 },
     423             :             { CTF_BORDER_MODEL, -1 },
     424             :             { CTF_TEXT_DISPLAY, -1 },
     425             :             { CTF_FONTFAMILYNAME, -1 },
     426             :             { CTF_FONTFAMILYNAME_CJK, -1 },
     427             :             { CTF_FONTFAMILYNAME_CTL, -1 },
     428             :             { -1, -1 }
     429        1110 :         };
     430             : 
     431             :         // get property set info
     432        1110 :         Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW );
     433             : 
     434        1110 :         bool bAutomatic = false;
     435        1372 :         if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() &&
     436         262 :             ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
     437             :         {
     438         137 :             bAutomatic = true;
     439         137 :             if( !GetAutoName().isEmpty() )
     440             :             {
     441         104 :                 OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
     442             :                     OUString( RTL_CONSTASCII_USTRINGPARAM("CharAutoStyleName") ):
     443         104 :                     OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAutoStyleName") );
     444             :                 try
     445             :                 {
     446         104 :                     if ( xInfo->hasPropertyByName( sAutoProp ) )
     447          96 :                         rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
     448             :                     else
     449           8 :                         bAutomatic = false;
     450             :                 }
     451           0 :                 catch( const RuntimeException& ) { throw; }
     452           0 :                 catch( const Exception& )
     453             :                 {
     454             :                     DBG_UNHANDLED_EXCEPTION();
     455           0 :                     bAutomatic = false;
     456         104 :                 }
     457             :             }
     458             :         }
     459        1110 :         if( bAutomatic )
     460         129 :             xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
     461             :         else
     462         981 :             xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
     463             : 
     464             :         // have we found a combined characters
     465        1110 :         sal_Int32 nIndex = aContextIDs[0].nIndex;
     466        1110 :         if ( nIndex != -1 )
     467             :         {
     468           0 :             Any& rAny = GetProperties()[nIndex].maValue;
     469           0 :             sal_Bool bVal = *(sal_Bool*)rAny.getValue();
     470           0 :             bHasCombinedCharactersLetter = bVal;
     471             :         }
     472             : 
     473             :         // keep-together: the application default is different from
     474             :         // the file format default. Hence, if we always set this
     475             :         // value; if we didn't find one, we'll set to false, the file
     476             :         // format default.
     477             :         // border-model: same
     478        1110 :         if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_ROW )
     479             :         {
     480             :             OUString sIsSplitAllowed =
     481          35 :                 OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSplitAllowed" ) );
     482             :             DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ),
     483             :                         "property missing?" );
     484          35 :             rPropSet->setPropertyValue( sIsSplitAllowed,
     485             :                 (aContextIDs[1].nIndex == -1)
     486             :                 ? makeAny( false )
     487          35 :                 : GetProperties()[aContextIDs[1].nIndex].maValue );
     488             :         }
     489             : 
     490        1110 :         if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE )
     491             :         {
     492             :             OUString sCollapsingBorders(
     493          35 :                 OUString( RTL_CONSTASCII_USTRINGPARAM( "CollapsingBorders" ) ) );
     494             :             DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ),
     495             :                         "property missing?" );
     496          35 :             rPropSet->setPropertyValue( sCollapsingBorders,
     497             :                 (aContextIDs[2].nIndex == -1)
     498             :                 ? makeAny( false )
     499          35 :                 : GetProperties()[aContextIDs[2].nIndex].maValue );
     500             :         }
     501             : 
     502             : 
     503             :         // check for StarBats and StarMath fonts
     504             : 
     505             :         // iterate over aContextIDs entries 3..6
     506        5550 :         for ( sal_Int32 i = 3; i < 7; i++ )
     507             :         {
     508        4440 :             nIndex = aContextIDs[i].nIndex;
     509        4440 :             if ( nIndex != -1 )
     510             :             {
     511             :                 // Found!
     512         526 :                 struct XMLPropertyState& rState = GetProperties()[nIndex];
     513         526 :                 Any rAny = rState.maValue;
     514         526 :                 sal_Int32 nMapperIndex = rState.mnIndex;
     515             : 
     516             :                 // Now check for font name in rState and set corrected value,
     517             :                 // if necessary.
     518         526 :                 OUString sFontName;
     519         526 :                 rAny >>= sFontName;
     520         526 :                 if ( !sFontName.isEmpty() )
     521             :                 {
     522         526 :                     OUString sStarBats( RTL_CONSTASCII_USTRINGPARAM("StarBats" ) );
     523         526 :                     OUString sStarMath( RTL_CONSTASCII_USTRINGPARAM("StarMath" ) );
     524        1052 :                     if ( sFontName.equalsIgnoreAsciiCase( sStarBats ) ||
     525         526 :                          sFontName.equalsIgnoreAsciiCase( sStarMath ) )
     526             :                     {
     527             :                         // construct new value
     528             :                         sFontName = OUString(
     529           0 :                             RTL_CONSTASCII_USTRINGPARAM("StarSymbol") );
     530           0 :                         Any aAny( rAny );
     531           0 :                         aAny <<= sFontName;
     532             : 
     533             :                         // get property set mapper
     534             :                         UniReference<XMLPropertySetMapper> rPropMapper =
     535           0 :                             xImpPrMap->getPropertySetMapper();
     536             : 
     537             :                         // set property
     538             :                         OUString rPropertyName(
     539           0 :                             rPropMapper->GetEntryAPIName(nMapperIndex) );
     540           0 :                         if ( xInfo->hasPropertyByName( rPropertyName ) )
     541             :                         {
     542           0 :                             rPropSet->setPropertyValue( rPropertyName, aAny );
     543           0 :                         }
     544         526 :                     }
     545             :                     // else: "normal" style name -> no correction is necessary
     546         526 :                 }
     547             :                 // else: no style name found -> illegal value -> ignore
     548             :             }
     549        1110 :         }
     550        1110 :     }
     551        1110 : }
     552             : 
     553             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10