bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / source / style / prstylei.cxx
blob47f19100bac028868d9aa8372fad901c7064be80
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <tools/debug.hxx>
21 #include <osl/diagnose.h>
22 #include <set>
23 #include <xmloff/xmlnmspe.hxx>
24 #include <xmloff/xmltoken.hxx>
25 #include <xmloff/xmlprcon.hxx>
26 #include <com/sun/star/style/XStyle.hpp>
27 #include <com/sun/star/style/XAutoStyleFamily.hpp>
28 #include <com/sun/star/container/XNameContainer.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/XPropertyState.hpp>
31 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <xmloff/xmlimp.hxx>
34 #include <xmloff/prstylei.hxx>
35 #include <xmloff/attrlist.hxx>
36 #include <xmloff/xmlerror.hxx>
37 #include <xmloff/xmltypes.hxx>
38 #include <xmloff/maptype.hxx>
40 //UUUU
41 #include <com/sun/star/drawing/FillStyle.hpp>
43 using namespace ::com::sun::star;
44 using namespace ::com::sun::star::uno;
45 using namespace ::com::sun::star::xml::sax;
46 using namespace ::com::sun::star::style;
47 using namespace ::com::sun::star::container;
48 using namespace ::com::sun::star::beans;
49 using namespace ::com::sun::star::lang;
50 using namespace ::xmloff::token;
52 //UUUU
53 using namespace com::sun::star::drawing;
55 void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
56 const OUString& rLocalName,
57 const OUString& rValue )
59 if( XML_NAMESPACE_STYLE == nPrefixKey && IsXMLToken( rLocalName, XML_FAMILY ) )
61 DBG_ASSERT( GetFamily() == static_cast<SvXMLStylesContext *>(&mxStyles)->GetFamily( rValue ), "unexpected style family" );
63 else
65 SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
69 TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext );
71 //UUUU
72 OldFillStyleDefinitionSet XMLPropStyleContext::maStandardSet;
73 OldFillStyleDefinitionSet XMLPropStyleContext::maHeaderSet;
74 OldFillStyleDefinitionSet XMLPropStyleContext::maFooterSet;
75 OldFillStyleDefinitionSet XMLPropStyleContext::maParaSet;
77 XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
78 sal_uInt16 nPrfx, const OUString& rLName,
79 const Reference< XAttributeList > & xAttrList,
80 SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
81 bool bDefault )
82 : SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, nFamily, bDefault )
83 , msIsPhysical( "IsPhysical" )
84 , msFollowStyle( "FollowStyle" )
85 , mxStyles( &rStyles )
89 XMLPropStyleContext::~XMLPropStyleContext()
93 const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet()
95 if(maStandardSet.empty())
97 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB")));
98 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackTransparent")));
99 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency")));
100 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL")));
101 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter")));
102 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation")));
103 maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency")));
106 return maStandardSet;
109 const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet()
111 if(maHeaderSet.empty())
113 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackColorRGB")));
114 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackTransparent")));
115 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackColorTransparency")));
116 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicURL")));
117 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicFilter")));
118 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicLocation")));
119 maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicTransparency")));
122 return maHeaderSet;
125 const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet()
127 if(maFooterSet.empty())
129 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackColorRGB")));
130 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackTransparent")));
131 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackColorTransparency")));
132 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicURL")));
133 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicFilter")));
134 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicLocation")));
135 maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicTransparency")));
138 return maFooterSet;
141 const OldFillStyleDefinitionSet& XMLPropStyleContext::getParaSet()
143 if(maParaSet.empty())
145 // Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
146 // 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
147 maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor")));
148 maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackTransparent")));
149 maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicLocation")));
150 maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicFilter")));
151 maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicURL")));
153 // These are not used in aXMLParaPropMap definition, thus not needed here
154 // maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColorTransparency")));
155 // maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicTransparency")));
158 return maParaSet;
161 SvXMLImportContext *XMLPropStyleContext::CreateChildContext(
162 sal_uInt16 nPrefix,
163 const OUString& rLocalName,
164 const Reference< XAttributeList > & xAttrList )
166 SvXMLImportContext *pContext = 0;
168 sal_uInt32 nFamily = 0;
169 if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
171 if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
172 nFamily = XML_TYPE_PROP_GRAPHIC;
173 else if( IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
174 nFamily = XML_TYPE_PROP_DRAWING_PAGE;
175 else if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
176 nFamily = XML_TYPE_PROP_TEXT;
177 else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) )
178 nFamily = XML_TYPE_PROP_PARAGRAPH;
179 else if( IsXMLToken( rLocalName, XML_RUBY_PROPERTIES ) )
180 nFamily = XML_TYPE_PROP_RUBY;
181 else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) )
182 nFamily = XML_TYPE_PROP_SECTION;
183 else if( IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) )
184 nFamily = XML_TYPE_PROP_TABLE;
185 else if( IsXMLToken( rLocalName, XML_TABLE_COLUMN_PROPERTIES ) )
186 nFamily = XML_TYPE_PROP_TABLE_COLUMN;
187 else if( IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) )
188 nFamily = XML_TYPE_PROP_TABLE_ROW;
189 else if( IsXMLToken( rLocalName, XML_TABLE_CELL_PROPERTIES ) )
190 nFamily = XML_TYPE_PROP_TABLE_CELL;
191 else if( IsXMLToken( rLocalName, XML_CHART_PROPERTIES ) )
192 nFamily = XML_TYPE_PROP_CHART;
194 if( nFamily )
196 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
197 static_cast<SvXMLStylesContext *>(&mxStyles)->GetImportPropertyMapper(
198 GetFamily() );
199 if( xImpPrMap.is() )
200 pContext = new SvXMLPropertySetContext( GetImport(), nPrefix,
201 rLocalName, xAttrList,
202 nFamily,
203 maProperties,
204 xImpPrMap );
207 if( !pContext )
208 pContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
209 xAttrList );
211 return pContext;
214 void XMLPropStyleContext::FillPropertySet(
215 const Reference< XPropertySet > & rPropSet )
217 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
218 static_cast<SvXMLStylesContext *>(&mxStyles)->GetImportPropertyMapper(
219 GetFamily() );
220 DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
221 if( xImpPrMap.is() )
222 xImpPrMap->FillPropertySet( maProperties, rPropSet );
225 void XMLPropStyleContext::SetDefaults()
229 Reference < XStyle > XMLPropStyleContext::Create()
231 Reference < XStyle > xNewStyle;
233 OUString sServiceName(
234 static_cast<SvXMLStylesContext *>(&mxStyles)->GetServiceName( GetFamily() ) );
235 if( !sServiceName.isEmpty() )
237 Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
238 UNO_QUERY );
239 if( xFactory.is() )
241 Reference < XInterface > xIfc =
242 xFactory->createInstance( sServiceName );
243 if( xIfc.is() )
244 xNewStyle = Reference < XStyle >( xIfc, UNO_QUERY );
248 return xNewStyle;
251 typedef ::std::set < OUString > PropertyNameSet;
253 void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
255 SvXMLStylesContext* pSvXMLStylesContext = static_cast< SvXMLStylesContext* >(&mxStyles);
256 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
257 OSL_ENSURE(xImpPrMap.is(), "There is no import prop mapper");
259 //UUUU need to filter out old fill definitions when the new ones are used. The new
260 // ones are used when a FillStyle is defined
261 const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH);
262 bool bDrawingLayerFillStylesUsed(false);
264 if(bTakeCareOfDrawingLayerFillStyle)
266 // check if new FillStyles are used and if so mark old ones with -1
267 static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
269 if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
271 deactivateOldFillStyleDefinitions(getParaSet());
272 bDrawingLayerFillStylesUsed = true;
276 if( pSvXMLStylesContext->IsAutomaticStyle()
277 && ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
279 //UUUU Need to translate StyleName from temp MapNames to names
280 // used in already imported items (already exist in the pool). This
281 // is required for AutomaticStyles since these do *not* use FillPropertySet
282 // and thus just trigger CheckSpecialContext in XMLTextStyleContext::FillPropertySet
283 // (which may be double action anyways). The mechanism there to use _ContextID_Index_Pair
284 // is not working for AutomaticStyles and is already too late, too (this
285 // method is already called before XMLTextStyleContext::FillPropertySet gets called)
286 if(bDrawingLayerFillStylesUsed)
288 translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();
291 Reference < XAutoStyleFamily > xAutoFamily = pSvXMLStylesContext->GetAutoStyles( GetFamily() );
292 if( !xAutoFamily.is() )
293 return;
294 if( xImpPrMap.is() )
296 Sequence< PropertyValue > aValues;
297 xImpPrMap->FillPropertySequence( maProperties, aValues );
299 sal_Int32 nLen = aValues.getLength();
300 if( nLen )
302 if( GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH )
304 aValues.realloc( nLen + 2 );
305 PropertyValue *pProps = aValues.getArray() + nLen;
306 pProps->Name = "ParaStyleName";
307 OUString sParent( GetParentName() );
308 if( !sParent.isEmpty() )
309 sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
310 else
311 sParent = "Standard";
312 pProps->Value <<= sParent;
313 ++pProps;
314 pProps->Name = "ParaConditionalStyleName";
315 pProps->Value <<= sParent;
318 Reference < XAutoStyle > xAutoStyle = xAutoFamily->insertStyle( aValues );
319 if( xAutoStyle.is() )
321 Sequence< OUString > aPropNames(1);
322 aPropNames[0] = GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ?
323 OUString("ParaAutoStyleName") :
324 OUString("CharAutoStyleName");
325 Sequence< Any > aAny = xAutoStyle->getPropertyValues( aPropNames );
326 if( aAny.hasElements() )
328 OUString aName;
329 aAny[0] >>= aName;
330 SetAutoName( aName );
336 else
338 const OUString& rName = GetDisplayName();
339 if( rName.isEmpty() || IsDefaultStyle() )
340 return;
342 Reference < XNameContainer > xFamilies = pSvXMLStylesContext->GetStylesContainer( GetFamily() );
343 if( !xFamilies.is() )
344 return;
346 bool bNew = false;
347 if( xFamilies->hasByName( rName ) )
349 Any aAny = xFamilies->getByName( rName );
350 aAny >>= mxStyle;
352 else
354 mxStyle = Create();
355 if( !mxStyle.is() )
356 return;
358 Any aAny;
359 aAny <<= mxStyle;
360 xFamilies->insertByName( rName, aAny );
361 bNew = true;
364 Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
365 Reference< XPropertySetInfo > xPropSetInfo =
366 xPropSet->getPropertySetInfo();
367 if( !bNew && xPropSetInfo->hasPropertyByName( msIsPhysical ) )
369 Any aAny = xPropSet->getPropertyValue( msIsPhysical );
370 bNew = !*static_cast<sal_Bool const *>(aAny.getValue());
372 SetNew( bNew );
373 if( rName != GetName() )
374 GetImport().AddStyleDisplayName( GetFamily(), GetName(), rName );
377 if( bOverwrite || bNew )
379 Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
381 rtl::Reference < XMLPropertySetMapper > xPrMap;
382 if( xImpPrMap.is() )
383 xPrMap = xImpPrMap->getPropertySetMapper();
384 if( xPrMap.is() )
386 Reference < XMultiPropertyStates > xMultiStates( xPropSet,
387 UNO_QUERY );
388 if( xMultiStates.is() )
390 xMultiStates->setAllPropertiesToDefault();
392 else
394 PropertyNameSet aNameSet;
395 sal_Int32 nCount = xPrMap->GetEntryCount();
396 sal_Int32 i;
397 for( i = 0; i < nCount; i++ )
399 const OUString& rPrName = xPrMap->GetEntryAPIName( i );
400 if( xPropSetInfo->hasPropertyByName( rPrName ) )
401 aNameSet.insert( rPrName );
404 nCount = aNameSet.size();
405 Sequence < OUString > aNames( nCount );
406 OUString *pNames = aNames.getArray();
407 PropertyNameSet::iterator aIter = aNameSet.begin();
408 while( aIter != aNameSet.end() )
409 *pNames++ = *aIter++;
411 Sequence < PropertyState > aStates(
412 xPropState->getPropertyStates( aNames ) );
413 const PropertyState *pStates = aStates.getConstArray();
414 pNames = aNames.getArray();
416 for( i = 0; i < nCount; i++ )
418 if( PropertyState_DIRECT_VALUE == *pStates++ )
419 xPropState->setPropertyToDefault( pNames[i] );
424 if (mxStyle.is())
425 mxStyle->setParentStyle(OUString());
427 FillPropertySet( xPropSet );
429 else
431 SetValid( false );
436 void XMLPropStyleContext::Finish( bool bOverwrite )
438 if( mxStyle.is() && (IsNew() || bOverwrite) )
440 // The families cintaner must exist
441 Reference < XNameContainer > xFamilies =
442 static_cast<SvXMLStylesContext *>(&mxStyles)->GetStylesContainer( GetFamily() );
443 DBG_ASSERT( xFamilies.is(), "Families lost" );
444 if( !xFamilies.is() )
445 return;
447 // connect parent
448 OUString sParent( GetParentName() );
449 if( !sParent.isEmpty() )
450 sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
451 if( !sParent.isEmpty() && !xFamilies->hasByName( sParent ) )
452 sParent.clear();
454 if( sParent != mxStyle->getParentStyle() )
456 // this may except if setting the parent style forms a
457 // circle in the style depencies; especially if the parent
458 // style is the same as the current style
461 mxStyle->setParentStyle( sParent );
463 catch(const uno::Exception& e)
465 // according to the API definition, I would expect a
466 // container::NoSuchElementException. But it throws an
467 // uno::RuntimeException instead. I catch
468 // uno::Exception in order to process both of them.
470 // We can't set the parent style. For a proper
471 // Error-Message, we should pass in the name of the
472 // style, as well as the desired parent style.
473 Sequence<OUString> aSequence(2);
475 // getName() throws no non-Runtime exception:
476 aSequence[0] = mxStyle->getName();
477 aSequence[1] = sParent;
479 GetImport().SetError(
480 XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
481 aSequence, e.Message, NULL );
485 // connect follow
486 OUString sFollow( GetFollow() );
487 if( !sFollow.isEmpty() )
488 sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
489 if( sFollow.isEmpty() || !xFamilies->hasByName( sFollow ) )
490 sFollow = mxStyle->getName();
492 Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
493 Reference< XPropertySetInfo > xPropSetInfo =
494 xPropSet->getPropertySetInfo();
495 if( xPropSetInfo->hasPropertyByName( msFollowStyle ) )
497 Any aAny = xPropSet->getPropertyValue( msFollowStyle );
498 OUString sCurrFollow;
499 aAny >>= sCurrFollow;
500 if( sCurrFollow != sFollow )
502 aAny <<= sFollow;
503 xPropSet->setPropertyValue( msFollowStyle, aAny );
507 if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
509 xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
515 //UUUU
516 bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
517 const OUString& rFillStyleTag) const
519 if(maProperties.size() && rFillStyleTag.getLength())
521 const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
523 if(rMapper.is())
525 for(::std::vector< XMLPropertyState >::const_iterator a = maProperties.begin(); a != maProperties.end(); ++a)
527 if(a->mnIndex != -1)
529 const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
531 if(rPropName == rFillStyleTag)
533 FillStyle eFillStyle(FillStyle_NONE);
535 if(a->maValue >>= eFillStyle)
537 // okay, type was good, FillStyle is set
539 else
541 // also try an int (see XFillStyleItem::PutValue)
542 sal_Int32 nFillStyle(0);
544 if(a->maValue >>= nFillStyle)
546 eFillStyle = static_cast< FillStyle >(nFillStyle);
550 // we found the entry, check it
551 return FillStyle_NONE != eFillStyle;
558 return false;
561 //UUUU
562 bool XMLPropStyleContext::deactivateOldFillStyleDefinitions(
563 const OldFillStyleDefinitionSet& rHashSetOfTags)
565 bool bRetval(false);
567 if(!rHashSetOfTags.empty() && maProperties.size())
569 const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
571 if(rMapper.is())
573 for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); ++a)
575 if(a->mnIndex != -1)
577 const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
579 if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end())
581 // mark entry as inactive
582 a->mnIndex = -1;
583 bRetval = true;
590 return bRetval;
593 //UUUU
594 bool XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames()
596 bool bRetval(false);
598 if(maProperties.size())
600 const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
602 if(rMapper.is())
604 static OUString s_FillGradientName(RTL_CONSTASCII_USTRINGPARAM("FillGradientName"));
605 static OUString s_FillHatchName(RTL_CONSTASCII_USTRINGPARAM("FillHatchName"));
606 static OUString s_FillBitmapName(RTL_CONSTASCII_USTRINGPARAM("FillBitmapName"));
607 static OUString s_FillTransparenceGradientName(RTL_CONSTASCII_USTRINGPARAM("FillTransparenceGradientName"));
609 for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); ++a)
611 if(a->mnIndex != -1)
613 const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
614 sal_uInt16 aStyleFamily(0);
616 if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName)
618 aStyleFamily = XML_STYLE_FAMILY_SD_GRADIENT_ID;
620 else if(rPropName == s_FillHatchName)
622 aStyleFamily = XML_STYLE_FAMILY_SD_HATCH_ID;
624 else if(rPropName == s_FillBitmapName)
626 aStyleFamily = XML_STYLE_FAMILY_SD_FILL_IMAGE_ID;
629 if(aStyleFamily)
631 OUString sStyleName;
633 a->maValue >>= sStyleName;
634 sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName );
635 a->maValue <<= sStyleName;
636 bRetval = true;
643 return bRetval;
646 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */