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

Generated by: LCOV version 1.10