LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmloff/source/text - txtstyli.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 182 229 79.5 %
Date: 2013-07-09 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 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        2918 : void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
      76             :                                         const OUString& rLocalName,
      77             :                                         const OUString& rValue )
      78             : {
      79        2918 :     if( XML_NAMESPACE_STYLE == nPrefixKey )
      80             :     {
      81             :         // TODO: use a map here
      82        2918 :         if( IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
      83             :         {
      84           0 :             if( IsXMLToken( rValue, XML_TRUE ) )
      85           0 :                 bAutoUpdate = sal_True;
      86             :         }
      87        2918 :         else if( IsXMLToken( rLocalName, XML_LIST_STYLE_NAME ) )
      88             :         {
      89          36 :             sListStyleName = rValue;
      90             :             // Inherited paragraph style lost information about unset numbering (#i69523#)
      91          36 :             mbListStyleSet = sal_True;
      92             :         }
      93        2882 :         else if( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
      94             :         {
      95          23 :             sMasterPageName = rValue;
      96          23 :             bHasMasterPageName = sal_True;
      97             :         }
      98        2859 :         else if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
      99             :         {
     100           0 :             sDataStyleName = rValue;
     101             :         }
     102        2859 :         else if( IsXMLToken( rLocalName, XML_CLASS ) )
     103             :         {
     104         388 :             sCategoryVal = rValue;
     105             :         }
     106        2471 :         else if( IsXMLToken( rLocalName, XML_DEFAULT_OUTLINE_LEVEL ) )
     107             :         {
     108             :             sal_Int32 nTmp;
     109         120 :             if (::sax::Converter::convertNumber( nTmp, rValue ) &&
     110          80 :                 0 <= nTmp && nTmp <= 10 )
     111          40 :                 nOutlineLevel = static_cast< sal_Int8 >( nTmp );
     112             :         }
     113             :         else
     114             :         {
     115        2431 :             XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     116             :         }
     117             :     }
     118             :     else
     119             :     {
     120           0 :         XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     121             :     }
     122        2918 : }
     123             : 
     124        2138 : TYPEINIT1( XMLTextStyleContext, XMLPropStyleContext );
     125             : 
     126         892 : XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
     127             :         sal_uInt16 nPrfx, const OUString& rLName,
     128             :         const Reference< XAttributeList > & xAttrList,
     129             :         SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
     130             :         sal_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( sal_False )
     140             : ,   bHasMasterPageName( sal_False )
     141             : ,   bHasCombinedCharactersLetter( sal_False )
     142             : // Inherited paragraph style lost information about unset numbering (#i69523#)
     143             : ,   mbListStyleSet( sal_False )
     144         892 : ,   pEventContext( NULL )
     145             : {
     146         892 : }
     147             : 
     148        1211 : XMLTextStyleContext::~XMLTextStyleContext()
     149             : {
     150        1211 : }
     151             : 
     152        1089 : SvXMLImportContext *XMLTextStyleContext::CreateChildContext(
     153             :         sal_uInt16 nPrefix,
     154             :         const OUString& rLocalName,
     155             :         const Reference< XAttributeList > & xAttrList )
     156             : {
     157        1089 :     SvXMLImportContext *pContext = 0;
     158             : 
     159        1089 :     if( XML_NAMESPACE_STYLE == nPrefix )
     160             :     {
     161        1089 :         sal_uInt32 nFamily = 0;
     162        1089 :         if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
     163         532 :             nFamily = XML_TYPE_PROP_TEXT;
     164         557 :         else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
     165         447 :             nFamily = XML_TYPE_PROP_PARAGRAPH;
     166         110 :         else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
     167          10 :             nFamily = XML_TYPE_PROP_SECTION;
     168         100 :         else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
     169          50 :             nFamily = XML_TYPE_PROP_TABLE;
     170          50 :         else if( IsDefaultStyle() && IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
     171          50 :             nFamily = XML_TYPE_PROP_TABLE_ROW;
     172        1089 :         if( nFamily )
     173             :         {
     174             :             UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     175        1089 :                 GetStyles()->GetImportPropertyMapper( GetFamily() );
     176        1089 :             if( xImpPrMap.is() )
     177        1089 :                 pContext = new XMLTextPropertySetContext( GetImport(), nPrefix,
     178             :                                                         rLocalName, xAttrList,
     179             :                                                         nFamily,
     180        1089 :                                                         GetProperties(),
     181             :                                                         xImpPrMap,
     182        2178 :                                                         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        1089 :     if( !pContext )
     197             :         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
     198           0 :                                                           xAttrList );
     199             : 
     200        1089 :     return pContext;
     201             : }
     202             : 
     203         660 : void XMLTextStyleContext::CreateAndInsert( sal_Bool bOverwrite )
     204             : {
     205         660 :     XMLPropStyleContext::CreateAndInsert( bOverwrite );
     206         660 :     Reference < XStyle > xStyle = GetStyle();
     207         660 :     if( !xStyle.is() || !(bOverwrite || IsNew()) )
     208         789 :         return;
     209             : 
     210        1062 :     Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
     211             :     Reference< XPropertySetInfo > xPropSetInfo =
     212        1062 :                 xPropSet->getPropertySetInfo();
     213         531 :     if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
     214             :     {
     215         433 :         Any aAny;
     216         433 :         sal_Bool bTmp = bAutoUpdate;
     217         433 :         aAny.setValue( &bTmp, ::getBooleanCppuType() );
     218         433 :         xPropSet->setPropertyValue( sIsAutoUpdate, aAny );
     219             :     }
     220             : 
     221         531 :     sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
     222        1495 :     if(  XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() &&
     223         825 :          !sCategoryVal.isEmpty() && xStyle->isUserDefined() &&
     224         539 :          xPropSetInfo->hasPropertyByName( sCategory ) &&
     225           4 :           SvXMLUnitConverter::convertEnum( nCategory, sCategoryVal, aCategoryMap ) )
     226             :     {
     227           4 :         Any aAny;
     228           4 :         aAny <<= (sal_Int16)nCategory;
     229           4 :         xPropSet->setPropertyValue( sCategory, aAny );
     230             :     }
     231             : 
     232             :     // tell the style about it's events (if applicable)
     233         531 :     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         531 :     if ( nOutlineLevel > 0 )
     243             :     {
     244           6 :         GetImport().GetTextImport()->AddOutlineStyleCandidate( nOutlineLevel,
     245          12 :                                                       GetDisplayName() );
     246         531 :     }
     247             : }
     248             : 
     249         151 : void XMLTextStyleContext::SetDefaults( )
     250             : {
     251         402 :     if( ( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ||
     252         201 :         ( GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) ||
     253          50 :         ( GetFamily() == XML_STYLE_FAMILY_TABLE_ROW ) )
     254             :     {
     255         151 :         Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
     256         151 :         if (xFactory.is())
     257             :         {
     258         151 :             Reference < XInterface > xInt = xFactory->createInstance (
     259         151 :                 OUString ( "com.sun.star.text.Defaults" ) );
     260         302 :             Reference < XPropertySet > xProperties ( xInt, UNO_QUERY );
     261         151 :             if ( xProperties.is() )
     262         302 :                 FillPropertySet ( xProperties );
     263         151 :         }
     264             :     }
     265         151 : }
     266             : 
     267         569 : void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
     268             : {
     269         569 :     XMLPropStyleContext::Finish( bOverwrite );
     270             : 
     271         569 :     Reference < XStyle > xStyle = GetStyle();
     272             :     // Consider set empty list style (#i69523#)
     273        1698 :     if ( !( mbListStyleSet ||
     274        1081 :             nOutlineLevel >= 0 ||
     275         521 :             !sDropCapTextStyleName.isEmpty() ||
     276         577 :             bHasMasterPageName ) ||
     277        1194 :          !xStyle.is() ||
     278           0 :          !( bOverwrite || IsNew() ) )
     279        1082 :         return;
     280             : 
     281         112 :     Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
     282             :     Reference< XPropertySetInfo > xPropSetInfo =
     283         112 :                 xPropSet->getPropertySetInfo();
     284             : 
     285          56 :     if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
     286             :     {
     287          56 :         Any aAny;
     288          56 :         if( nOutlineLevel >= 0 )
     289             :         {
     290          40 :             aAny <<= nOutlineLevel;
     291          40 :             xPropSet->setPropertyValue( sOutlineLevel, aAny );
     292          56 :         }
     293             :     }
     294             : 
     295             :     // Consider set empty list style (#i69523#)
     296          65 :     if ( mbListStyleSet &&
     297           9 :          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           9 :         bool bApplyListStyle( true );
     305           9 :         if ( nOutlineLevel > 0 )
     306             :         {
     307           1 :             if ( GetImport().IsTextDocInOOoFileFormat() )
     308             :             {
     309           0 :                 bApplyListStyle = false;
     310             :             }
     311             :             else
     312             :             {
     313           1 :                 sal_Int32 nUPD( 0 );
     314           1 :                 sal_Int32 nBuild( 0 );
     315             :                 // Check explicitly on certain versions (#i86058#)
     316           1 :                 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           9 :         if ( bApplyListStyle )
     326             :         {
     327           9 :             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           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          56 :     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          56 :     if( bHasMasterPageName )
     375             :     {
     376             :         OUString sDisplayName(
     377           8 :             GetImport().GetStyleDisplayName(
     378          16 :                             XML_STYLE_FAMILY_MASTER_PAGE, sMasterPageName ) );
     379             :         // The families cointaner must exist
     380             :         const Reference < XNameContainer >& rPageStyles =
     381           8 :             GetImport().GetTextImport()->GetPageStyles();
     382          16 :         if( ( sDisplayName.isEmpty() ||
     383           0 :               (rPageStyles.is() &&
     384          16 :                rPageStyles->hasByName( sDisplayName )) ) &&
     385           8 :             xPropSetInfo->hasPropertyByName( sPageDescName ) )
     386             :         {
     387           8 :             Any aAny;
     388           8 :             aAny <<= sDisplayName;
     389           8 :             xPropSet->setPropertyValue( sPageDescName, aAny );
     390           8 :         }
     391          56 :     }
     392             : }
     393             : 
     394        1300 : 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        1300 :         ((SvXMLStylesContext *)GetStyles())->GetImportPropertyMapper(GetFamily());
     403             :     DBG_ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" );
     404        1300 :     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        1300 :         };
     428             : 
     429             :         // get property set info
     430        1300 :         Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW );
     431             : 
     432        1300 :         bool bAutomatic = false;
     433        1830 :         if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() &&
     434         525 :             ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
     435             :         {
     436         248 :             bAutomatic = true;
     437         248 :             if( !GetAutoName().isEmpty() )
     438             :             {
     439         185 :                 OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
     440             :                     OUString( "CharAutoStyleName" ):
     441         185 :                     OUString( "ParaAutoStyleName" );
     442             :                 try
     443             :                 {
     444         185 :                     if ( xInfo->hasPropertyByName( sAutoProp ) )
     445         170 :                         rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
     446             :                     else
     447          15 :                         bAutomatic = false;
     448             :                 }
     449           0 :                 catch( const RuntimeException& ) { throw; }
     450           0 :                 catch( const Exception& )
     451             :                 {
     452             :                     DBG_UNHANDLED_EXCEPTION();
     453           0 :                     bAutomatic = false;
     454         185 :                 }
     455             :             }
     456             :         }
     457        1300 :         if( bAutomatic )
     458         233 :             xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
     459             :         else
     460        1067 :             xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
     461             : 
     462             :         // have we found a combined characters
     463        1300 :         sal_Int32 nIndex = aContextIDs[0].nIndex;
     464        1300 :         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        1300 :         if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_ROW )
     477             :         {
     478          50 :             OUString sIsSplitAllowed( "IsSplitAllowed" );
     479             :             DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ),
     480             :                         "property missing?" );
     481          50 :             rPropSet->setPropertyValue( sIsSplitAllowed,
     482          50 :                 (aContextIDs[1].nIndex == -1)
     483             :                 ? makeAny( false )
     484         100 :                 : GetProperties()[aContextIDs[1].nIndex].maValue );
     485             :         }
     486             : 
     487        1300 :         if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE )
     488             :         {
     489          50 :             OUString sCollapsingBorders("CollapsingBorders");
     490             :             DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ),
     491             :                         "property missing?" );
     492          50 :             rPropSet->setPropertyValue( sCollapsingBorders,
     493          50 :                 (aContextIDs[2].nIndex == -1)
     494             :                 ? makeAny( false )
     495         100 :                 : GetProperties()[aContextIDs[2].nIndex].maValue );
     496             :         }
     497             : 
     498             : 
     499             :         // check for StarBats and StarMath fonts
     500             : 
     501             :         // iterate over aContextIDs entries 3..6
     502        6500 :         for ( sal_Int32 i = 3; i < 7; i++ )
     503             :         {
     504        5200 :             nIndex = aContextIDs[i].nIndex;
     505        5200 :             if ( nIndex != -1 )
     506             :             {
     507             :                 // Found!
     508         890 :                 struct XMLPropertyState& rState = GetProperties()[nIndex];
     509         890 :                 Any rAny = rState.maValue;
     510         890 :                 sal_Int32 nMapperIndex = rState.mnIndex;
     511             : 
     512             :                 // Now check for font name in rState and set corrected value,
     513             :                 // if necessary.
     514        1780 :                 OUString sFontName;
     515         890 :                 rAny >>= sFontName;
     516         890 :                 if ( !sFontName.isEmpty() )
     517             :                 {
     518         883 :                     OUString sStarBats( "StarBats" );
     519        1766 :                     OUString sStarMath( "StarMath" );
     520        1766 :                     if ( sFontName.equalsIgnoreAsciiCase( sStarBats ) ||
     521         883 :                          sFontName.equalsIgnoreAsciiCase( sStarMath ) )
     522             :                     {
     523             :                         // construct new value
     524           0 :                         sFontName = OUString("StarSymbol");
     525           0 :                         Any aAny( rAny );
     526           0 :                         aAny <<= sFontName;
     527             : 
     528             :                         // get property set mapper
     529             :                         UniReference<XMLPropertySetMapper> rPropMapper =
     530           0 :                             xImpPrMap->getPropertySetMapper();
     531             : 
     532             :                         // set property
     533             :                         OUString rPropertyName(
     534           0 :                             rPropMapper->GetEntryAPIName(nMapperIndex) );
     535           0 :                         if ( xInfo->hasPropertyByName( rPropertyName ) )
     536             :                         {
     537           0 :                             rPropSet->setPropertyValue( rPropertyName, aAny );
     538           0 :                         }
     539         883 :                     }
     540             :                     // else: "normal" style name -> no correction is necessary
     541         890 :                 }
     542             :                 // else: no style name found -> illegal value -> ignore
     543             :             }
     544        1300 :         }
     545        1300 :     }
     546        1300 : }
     547             : 
     548             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10