LCOV - code coverage report
Current view: top level - xmloff/source/text - txtstyli.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 226 0.0 %
Date: 2014-04-14 Functions: 0 14 0.0 %
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           0 : void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
      76             :                                         const OUString& rLocalName,
      77             :                                         const OUString& rValue )
      78             : {
      79           0 :     if( XML_NAMESPACE_STYLE == nPrefixKey )
      80             :     {
      81             :         // TODO: use a map here
      82           0 :         if( IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
      83             :         {
      84           0 :             if( IsXMLToken( rValue, XML_TRUE ) )
      85           0 :                 bAutoUpdate = true;
      86             :         }
      87           0 :         else if( IsXMLToken( rLocalName, XML_LIST_STYLE_NAME ) )
      88             :         {
      89           0 :             sListStyleName = rValue;
      90             :             // Inherited paragraph style lost information about unset numbering (#i69523#)
      91           0 :             mbListStyleSet = true;
      92             :         }
      93           0 :         else if( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
      94             :         {
      95           0 :             sMasterPageName = rValue;
      96           0 :             bHasMasterPageName = true;
      97             :         }
      98           0 :         else if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
      99             :         {
     100           0 :             sDataStyleName = rValue;
     101             :         }
     102           0 :         else if( IsXMLToken( rLocalName, XML_CLASS ) )
     103             :         {
     104           0 :             sCategoryVal = rValue;
     105             :         }
     106           0 :         else if( IsXMLToken( rLocalName, XML_DEFAULT_OUTLINE_LEVEL ) )
     107             :         {
     108             :             sal_Int32 nTmp;
     109           0 :             if (::sax::Converter::convertNumber( nTmp, rValue ) &&
     110           0 :                 0 <= nTmp && nTmp <= 10 )
     111           0 :                 nOutlineLevel = static_cast< sal_Int8 >( nTmp );
     112             :         }
     113             :         else
     114             :         {
     115           0 :             XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     116             :         }
     117             :     }
     118             :     else
     119             :     {
     120           0 :         XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     121             :     }
     122           0 : }
     123             : 
     124           0 : TYPEINIT1( XMLTextStyleContext, XMLPropStyleContext );
     125             : 
     126           0 : 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           0 : ,   pEventContext( NULL )
     145             : {
     146           0 : }
     147             : 
     148           0 : XMLTextStyleContext::~XMLTextStyleContext()
     149             : {
     150           0 : }
     151             : 
     152           0 : SvXMLImportContext *XMLTextStyleContext::CreateChildContext(
     153             :         sal_uInt16 nPrefix,
     154             :         const OUString& rLocalName,
     155             :         const Reference< XAttributeList > & xAttrList )
     156             : {
     157           0 :     SvXMLImportContext *pContext = 0;
     158             : 
     159           0 :     if( XML_NAMESPACE_STYLE == nPrefix )
     160             :     {
     161           0 :         sal_uInt32 nFamily = 0;
     162           0 :         if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
     163           0 :             nFamily = XML_TYPE_PROP_TEXT;
     164           0 :         else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
     165           0 :             nFamily = XML_TYPE_PROP_PARAGRAPH;
     166           0 :         else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
     167           0 :             nFamily = XML_TYPE_PROP_SECTION;
     168           0 :         else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
     169           0 :             nFamily = XML_TYPE_PROP_TABLE;
     170           0 :         else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
     171           0 :             nFamily = XML_TYPE_PROP_TABLE_ROW;
     172           0 :         if( nFamily )
     173             :         {
     174             :             UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     175           0 :                 GetStyles()->GetImportPropertyMapper( GetFamily() );
     176           0 :             if( xImpPrMap.is() )
     177           0 :                 pContext = new XMLTextPropertySetContext( GetImport(), nPrefix,
     178             :                                                         rLocalName, xAttrList,
     179             :                                                         nFamily,
     180           0 :                                                         GetProperties(),
     181             :                                                         xImpPrMap,
     182           0 :                                                         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           0 :     if( !pContext )
     197             :         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
     198           0 :                                                           xAttrList );
     199             : 
     200           0 :     return pContext;
     201             : }
     202             : 
     203           0 : void XMLTextStyleContext::CreateAndInsert( bool bOverwrite )
     204             : {
     205           0 :     XMLPropStyleContext::CreateAndInsert( bOverwrite );
     206           0 :     Reference < XStyle > xStyle = GetStyle();
     207           0 :     if( !xStyle.is() || !(bOverwrite || IsNew()) )
     208           0 :         return;
     209             : 
     210           0 :     Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
     211             :     Reference< XPropertySetInfo > xPropSetInfo =
     212           0 :                 xPropSet->getPropertySetInfo();
     213           0 :     if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
     214             :     {
     215           0 :         Any aAny;
     216           0 :         sal_Bool bTmp = bAutoUpdate;
     217           0 :         aAny.setValue( &bTmp, ::getBooleanCppuType() );
     218           0 :         xPropSet->setPropertyValue( sIsAutoUpdate, aAny );
     219             :     }
     220             : 
     221           0 :     sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
     222           0 :     if(  XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() &&
     223           0 :          !sCategoryVal.isEmpty() && xStyle->isUserDefined() &&
     224           0 :          xPropSetInfo->hasPropertyByName( sCategory ) &&
     225           0 :           SvXMLUnitConverter::convertEnum( nCategory, sCategoryVal, aCategoryMap ) )
     226             :     {
     227           0 :         Any aAny;
     228           0 :         aAny <<= (sal_Int16)nCategory;
     229           0 :         xPropSet->setPropertyValue( sCategory, aAny );
     230             :     }
     231             : 
     232             :     // tell the style about it's events (if applicable)
     233           0 :     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           0 :     if ( nOutlineLevel > 0 )
     243             :     {
     244           0 :         GetImport().GetTextImport()->AddOutlineStyleCandidate( nOutlineLevel,
     245           0 :                                                       GetDisplayName() );
     246           0 :     }
     247             : }
     248             : 
     249           0 : void XMLTextStyleContext::SetDefaults( )
     250             : {
     251           0 :     if( ( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ||
     252           0 :         ( GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) ||
     253           0 :         ( GetFamily() == XML_STYLE_FAMILY_TABLE_ROW ) )
     254             :     {
     255           0 :         Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
     256           0 :         if (xFactory.is())
     257             :         {
     258           0 :             Reference < XInterface > xInt = xFactory->createInstance (
     259           0 :                 OUString ( "com.sun.star.text.Defaults" ) );
     260           0 :             Reference < XPropertySet > xProperties ( xInt, UNO_QUERY );
     261           0 :             if ( xProperties.is() )
     262           0 :                 FillPropertySet ( xProperties );
     263           0 :         }
     264             :     }
     265           0 : }
     266             : 
     267           0 : void XMLTextStyleContext::Finish( bool bOverwrite )
     268             : {
     269           0 :     XMLPropStyleContext::Finish( bOverwrite );
     270             : 
     271           0 :     Reference < XStyle > xStyle = GetStyle();
     272             :     // Consider set empty list style (#i69523#)
     273           0 :     if ( !( mbListStyleSet ||
     274           0 :             nOutlineLevel >= 0 ||
     275           0 :             !sDropCapTextStyleName.isEmpty() ||
     276           0 :             bHasMasterPageName ) ||
     277           0 :          !xStyle.is() ||
     278           0 :          !( bOverwrite || IsNew() ) )
     279           0 :         return;
     280             : 
     281           0 :     Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
     282             :     Reference< XPropertySetInfo > xPropSetInfo =
     283           0 :                 xPropSet->getPropertySetInfo();
     284             : 
     285           0 :     if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
     286             :     {
     287           0 :         Any aAny;
     288           0 :         if( nOutlineLevel >= 0 )
     289             :         {
     290           0 :             aAny <<= nOutlineLevel;
     291           0 :             xPropSet->setPropertyValue( sOutlineLevel, aAny );
     292           0 :         }
     293             :     }
     294             : 
     295             :     // Consider set empty list style (#i69523#)
     296           0 :     if ( mbListStyleSet &&
     297           0 :          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           0 :         bool bApplyListStyle( true );
     305           0 :         if ( nOutlineLevel > 0 )
     306             :         {
     307           0 :             if ( GetImport().IsTextDocInOOoFileFormat() )
     308             :             {
     309           0 :                 bApplyListStyle = false;
     310             :             }
     311             :             else
     312             :             {
     313           0 :                 sal_Int32 nUPD( 0 );
     314           0 :                 sal_Int32 nBuild( 0 );
     315             :                 // Check explicitly on certain versions (#i86058#)
     316           0 :                 if ( GetImport().getBuildIds( nUPD, nBuild ) &&
     317           0 :                      ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
     318           0 :                        ( nUPD == 680 && nBuild <= 9073 ) ) ) // OOo 2.0 - OOo 2.0.4
     319             :                 {
     320           0 :                     bApplyListStyle = false;
     321             :                 }
     322             :             }
     323             :         }
     324             : 
     325           0 :         if ( bApplyListStyle )
     326             :         {
     327           0 :             if ( sListStyleName.isEmpty() )
     328             :             {
     329           0 :                 Any aAny;
     330           0 :                 aAny <<= sListStyleName /* empty string */;
     331           0 :                 xPropSet->setPropertyValue( sNumberingStyleName, aAny );
     332             :             }
     333             :             else
     334             :             {
     335             :                 // change list style name to display name
     336             :                 OUString sDisplayListStyleName(
     337           0 :                     GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
     338           0 :                                                   sListStyleName ) );
     339             :                 // The families container must exist
     340             :                 const Reference < XNameContainer >& rNumStyles =
     341           0 :                     GetImport().GetTextImport()->GetNumberingStyles();
     342             :     //            if( rNumStyles.is() && rNumStyles->hasByName( sDisplayListStyleName ) &&
     343             :     //                xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
     344           0 :                 if ( rNumStyles.is() &&
     345           0 :                      rNumStyles->hasByName( sDisplayListStyleName ) )
     346             :                 {
     347           0 :                     Any aAny;
     348           0 :                     aAny <<= sDisplayListStyleName;
     349           0 :                     xPropSet->setPropertyValue( sNumberingStyleName, aAny );
     350           0 :                 }
     351             :             }
     352             :         }
     353             :     }
     354             : 
     355           0 :     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           0 :     if( bHasMasterPageName )
     375             :     {
     376             :         OUString sDisplayName(
     377           0 :             GetImport().GetStyleDisplayName(
     378           0 :                             XML_STYLE_FAMILY_MASTER_PAGE, sMasterPageName ) );
     379             :         // The families cointaner must exist
     380             :         const Reference < XNameContainer >& rPageStyles =
     381           0 :             GetImport().GetTextImport()->GetPageStyles();
     382           0 :         if( ( sDisplayName.isEmpty() ||
     383           0 :               (rPageStyles.is() &&
     384           0 :                rPageStyles->hasByName( sDisplayName )) ) &&
     385           0 :             xPropSetInfo->hasPropertyByName( sPageDescName ) )
     386             :         {
     387           0 :             Any aAny;
     388           0 :             aAny <<= sDisplayName;
     389           0 :             xPropSet->setPropertyValue( sPageDescName, aAny );
     390           0 :         }
     391           0 :     }
     392             : }
     393             : 
     394           0 : 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           0 :         ((SvXMLStylesContext *)GetStyles())->GetImportPropertyMapper(GetFamily());
     403             :     DBG_ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" );
     404           0 :     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           0 :         };
     428             : 
     429             :         // get property set info
     430           0 :         Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW );
     431             : 
     432           0 :         bool bAutomatic = false;
     433           0 :         if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() &&
     434           0 :             ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
     435             :         {
     436           0 :             bAutomatic = true;
     437           0 :             if( !GetAutoName().isEmpty() )
     438             :             {
     439           0 :                 OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
     440             :                     OUString( "CharAutoStyleName" ):
     441           0 :                     OUString( "ParaAutoStyleName" );
     442             :                 try
     443             :                 {
     444           0 :                     if ( xInfo->hasPropertyByName( sAutoProp ) )
     445           0 :                         rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
     446             :                     else
     447           0 :                         bAutomatic = false;
     448             :                 }
     449           0 :                 catch( const RuntimeException& ) { throw; }
     450           0 :                 catch( const Exception& )
     451             :                 {
     452             :                     DBG_UNHANDLED_EXCEPTION();
     453           0 :                     bAutomatic = false;
     454           0 :                 }
     455             :             }
     456             :         }
     457           0 :         if( bAutomatic )
     458           0 :             xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
     459             :         else
     460           0 :             xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
     461             : 
     462             :         // have we found a combined characters
     463           0 :         sal_Int32 nIndex = aContextIDs[0].nIndex;
     464           0 :         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           0 :         if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_ROW )
     477             :         {
     478           0 :             OUString sIsSplitAllowed( "IsSplitAllowed" );
     479             :             DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ),
     480             :                         "property missing?" );
     481           0 :             rPropSet->setPropertyValue( sIsSplitAllowed,
     482           0 :                 (aContextIDs[1].nIndex == -1)
     483             :                 ? makeAny( false )
     484           0 :                 : GetProperties()[aContextIDs[1].nIndex].maValue );
     485             :         }
     486             : 
     487           0 :         if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE )
     488             :         {
     489           0 :             OUString sCollapsingBorders("CollapsingBorders");
     490             :             DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ),
     491             :                         "property missing?" );
     492           0 :             rPropSet->setPropertyValue( sCollapsingBorders,
     493           0 :                 (aContextIDs[2].nIndex == -1)
     494             :                 ? makeAny( false )
     495           0 :                 : GetProperties()[aContextIDs[2].nIndex].maValue );
     496             :         }
     497             : 
     498             : 
     499             :         // check for StarBats and StarMath fonts
     500             : 
     501             :         // iterate over aContextIDs entries 3..6
     502           0 :         for ( sal_Int32 i = 3; i < 7; i++ )
     503             :         {
     504           0 :             nIndex = aContextIDs[i].nIndex;
     505           0 :             if ( nIndex != -1 )
     506             :             {
     507             :                 // Found!
     508           0 :                 struct XMLPropertyState& rState = GetProperties()[nIndex];
     509           0 :                 Any rAny = rState.maValue;
     510           0 :                 sal_Int32 nMapperIndex = rState.mnIndex;
     511             : 
     512             :                 // Now check for font name in rState and set corrected value,
     513             :                 // if necessary.
     514           0 :                 OUString sFontName;
     515           0 :                 rAny >>= sFontName;
     516           0 :                 if ( !sFontName.isEmpty() )
     517             :                 {
     518           0 :                     if ( sFontName.equalsIgnoreAsciiCase( "StarBats" ) ||
     519           0 :                          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           0 :                 }
     540             :                 // else: no style name found -> illegal value -> ignore
     541             :             }
     542           0 :         }
     543           0 :     }
     544           0 : }
     545             : 
     546             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10