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