LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/text - txtstyli.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 177 223 79.4 %
Date: 2012-12-27 Functions: 12 14 85.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10