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 #include <sal/config.h>
21
22 #include <o3tl/any.hxx>
23 #include <osl/diagnose.h>
24 #include <sal/log.hxx>
25 #include <set>
26 #include <xmloff/xmlnamespace.hxx>
27 #include <xmloff/xmltoken.hxx>
28 #include <xmloff/xmlprcon.hxx>
29 #include <com/sun/star/frame/XModel.hpp>
30 #include <com/sun/star/style/XStyle.hpp>
31 #include <com/sun/star/style/XAutoStyleFamily.hpp>
32 #include <com/sun/star/container/XNameContainer.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/beans/XPropertyState.hpp>
35 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <xmloff/xmlimp.hxx>
38 #include <xmloff/prstylei.hxx>
39 #include <xmloff/xmlerror.hxx>
40 #include <xmloff/xmltypes.hxx>
41 #include <xmloff/maptype.hxx>
42 #include <xmloff/xmlimppr.hxx>
43 #include <xmloff/xmlprmap.hxx>
44 #include <comphelper/sequence.hxx>
45 #include <com/sun/star/drawing/FillStyle.hpp>
46
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::uno;
49 using namespace ::com::sun::star::xml::sax;
50 using namespace ::com::sun::star::style;
51 using namespace ::com::sun::star::container;
52 using namespace ::com::sun::star::beans;
53 using namespace ::com::sun::star::lang;
54 using namespace ::xmloff::token;
55 using namespace com::sun::star::drawing;
56
SetAttribute(sal_Int32 nElement,const OUString & rValue)57 void XMLPropStyleContext::SetAttribute( sal_Int32 nElement,
58 const OUString& rValue )
59 {
60 if( nElement == XML_ELEMENT(STYLE, XML_FAMILY) )
61 {
62 SAL_WARN_IF( GetFamily() != SvXMLStylesContext::GetFamily( rValue ), "xmloff", "unexpected style family" );
63 }
64 else
65 {
66 SvXMLStyleContext::SetAttribute( nElement, rValue );
67 }
68 }
69
70
71 namespace
72 {
73 struct theStandardSet :
74 public rtl::StaticWithInit<OldFillStyleDefinitionSet, theStandardSet>
75 {
operator ()__anonc70888a50111::theStandardSet76 OldFillStyleDefinitionSet operator () ()
77 {
78 OldFillStyleDefinitionSet aSet;
79 aSet.insert("BackColorRGB");
80 aSet.insert("BackTransparent");
81 aSet.insert("BackColorTransparency");
82 aSet.insert("BackGraphic");
83 aSet.insert("BackGraphicFilter");
84 aSet.insert("BackGraphicLocation");
85 aSet.insert("BackGraphicTransparency");
86 return aSet;
87 }
88 };
89 struct theHeaderSet :
90 public rtl::StaticWithInit<OldFillStyleDefinitionSet, theHeaderSet>
91 {
operator ()__anonc70888a50111::theHeaderSet92 OldFillStyleDefinitionSet operator () ()
93 {
94 OldFillStyleDefinitionSet aSet;
95 aSet.insert("HeaderBackColorRGB");
96 aSet.insert("HeaderBackTransparent");
97 aSet.insert("HeaderBackColorTransparency");
98 aSet.insert("HeaderBackGraphic");
99 aSet.insert("HeaderBackGraphicFilter");
100 aSet.insert("HeaderBackGraphicLocation");
101 aSet.insert("HeaderBackGraphicTransparency");
102 return aSet;
103 }
104 };
105 struct theFooterSet :
106 public rtl::StaticWithInit<OldFillStyleDefinitionSet, theFooterSet>
107 {
operator ()__anonc70888a50111::theFooterSet108 OldFillStyleDefinitionSet operator () ()
109 {
110 OldFillStyleDefinitionSet aSet;
111 aSet.insert("FooterBackColorRGB");
112 aSet.insert("FooterBackTransparent");
113 aSet.insert("FooterBackColorTransparency");
114 aSet.insert("FooterBackGraphic");
115 aSet.insert("FooterBackGraphicFilter");
116 aSet.insert("FooterBackGraphicLocation");
117 aSet.insert("FooterBackGraphicTransparency");
118 return aSet;
119 }
120 };
121 struct theParaSet :
122 public rtl::StaticWithInit<OldFillStyleDefinitionSet, theParaSet>
123 {
operator ()__anonc70888a50111::theParaSet124 OldFillStyleDefinitionSet operator () ()
125 {
126 OldFillStyleDefinitionSet aSet;
127 // Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
128 // 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
129 aSet.insert("ParaBackColor");
130 aSet.insert("ParaBackTransparent");
131 aSet.insert("ParaBackGraphicLocation");
132 aSet.insert("ParaBackGraphicFilter");
133 aSet.insert("ParaBackGraphic");
134
135 // These are not used in aXMLParaPropMap definition, thus not needed here
136 // aSet.insert("ParaBackColorTransparency");
137 // aSet.insert("ParaBackGraphicTransparency");
138 return aSet;
139 }
140 };
141 }
142
143
144
145 constexpr OUStringLiteral gsIsPhysical( u"IsPhysical" );
146 constexpr OUStringLiteral gsFollowStyle( u"FollowStyle" );
147
XMLPropStyleContext(SvXMLImport & rImport,SvXMLStylesContext & rStyles,XmlStyleFamily nFamily,bool bDefault)148 XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
149 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily,
150 bool bDefault )
151 : SvXMLStyleContext( rImport, nFamily, bDefault )
152 , mxStyles( &rStyles )
153 {
154 }
155
~XMLPropStyleContext()156 XMLPropStyleContext::~XMLPropStyleContext()
157 {
158 }
159
getStandardSet()160 const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet()
161 {
162 return theStandardSet::get();
163 }
164
getHeaderSet()165 const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet()
166 {
167 return theHeaderSet::get();
168 }
169
getFooterSet()170 const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet()
171 {
172 return theFooterSet::get();
173 }
174
createFastChildContext(sal_Int32 nElement,const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList)175 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLPropStyleContext::createFastChildContext(
176 sal_Int32 nElement,
177 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
178 {
179 sal_uInt32 nFamily = 0;
180 if( IsTokenInNamespace(nElement, XML_NAMESPACE_STYLE) ||
181 IsTokenInNamespace(nElement, XML_NAMESPACE_LO_EXT) )
182 {
183 sal_Int32 nLocalName = nElement & TOKEN_MASK;
184 if( nLocalName == XML_GRAPHIC_PROPERTIES )
185 nFamily = XML_TYPE_PROP_GRAPHIC;
186 else if( nLocalName == XML_DRAWING_PAGE_PROPERTIES )
187 nFamily = XML_TYPE_PROP_DRAWING_PAGE;
188 else if( nLocalName == XML_TEXT_PROPERTIES )
189 nFamily = XML_TYPE_PROP_TEXT;
190 else if( nLocalName == XML_PARAGRAPH_PROPERTIES )
191 nFamily = XML_TYPE_PROP_PARAGRAPH;
192 else if( nLocalName == XML_RUBY_PROPERTIES )
193 nFamily = XML_TYPE_PROP_RUBY;
194 else if( nLocalName == XML_SECTION_PROPERTIES )
195 nFamily = XML_TYPE_PROP_SECTION;
196 else if( nLocalName == XML_TABLE_PROPERTIES )
197 nFamily = XML_TYPE_PROP_TABLE;
198 else if( nLocalName == XML_TABLE_COLUMN_PROPERTIES )
199 nFamily = XML_TYPE_PROP_TABLE_COLUMN;
200 else if( nLocalName ==XML_TABLE_ROW_PROPERTIES )
201 nFamily = XML_TYPE_PROP_TABLE_ROW;
202 else if( nLocalName == XML_TABLE_CELL_PROPERTIES )
203 nFamily = XML_TYPE_PROP_TABLE_CELL;
204 else if( nLocalName == XML_CHART_PROPERTIES )
205 nFamily = XML_TYPE_PROP_CHART;
206 }
207 if( nFamily )
208 {
209 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
210 mxStyles->GetImportPropertyMapper( GetFamily() );
211 if( xImpPrMap.is() )
212 return new SvXMLPropertySetContext( GetImport(), nElement,
213 xAttrList,
214 nFamily,
215 maProperties,
216 xImpPrMap );
217 }
218 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
219 return nullptr;
220 }
221
FillPropertySet(const Reference<XPropertySet> & rPropSet)222 void XMLPropStyleContext::FillPropertySet(
223 const Reference< XPropertySet > & rPropSet )
224 {
225 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
226 mxStyles->GetImportPropertyMapper( GetFamily() );
227 SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" );
228 if( xImpPrMap.is() )
229 xImpPrMap->FillPropertySet( maProperties, rPropSet );
230 }
231
SetDefaults()232 void XMLPropStyleContext::SetDefaults()
233 {
234 }
235
Create()236 Reference < XStyle > XMLPropStyleContext::Create()
237 {
238 Reference < XStyle > xNewStyle;
239
240 OUString sServiceName = mxStyles->GetServiceName( GetFamily() );
241 if( !sServiceName.isEmpty() )
242 {
243 Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
244 UNO_QUERY );
245 if( xFactory.is() )
246 {
247 Reference < XInterface > xIfc =
248 xFactory->createInstance( sServiceName );
249 if( xIfc.is() )
250 xNewStyle.set( xIfc, UNO_QUERY );
251 }
252 }
253
254 return xNewStyle;
255 }
256
CreateAndInsert(bool bOverwrite)257 void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
258 {
259 SvXMLStylesContext* pSvXMLStylesContext = mxStyles.get();
260 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
261 OSL_ENSURE(xImpPrMap.is(), "There is no import prop mapper");
262
263 // need to filter out old fill definitions when the new ones are used. The new
264 // ones are used when a FillStyle is defined
265 const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH);
266 bool bDrawingLayerFillStylesUsed(false);
267
268 if(bTakeCareOfDrawingLayerFillStyle)
269 {
270 // check if new FillStyles are used and if so mark old ones with -1
271 static OUString s_FillStyle("FillStyle");
272
273 if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
274 {
275 deactivateOldFillStyleDefinitions(theParaSet::get());
276 bDrawingLayerFillStylesUsed = true;
277 }
278 }
279
280 if( pSvXMLStylesContext->IsAutomaticStyle()
281 && ( GetFamily() == XmlStyleFamily::TEXT_TEXT || GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ) )
282 {
283 // Need to translate StyleName from temp MapNames to names
284 // used in already imported items (already exist in the pool). This
285 // is required for AutomaticStyles since these do *not* use FillPropertySet
286 // and thus just trigger CheckSpecialContext in XMLTextStyleContext::FillPropertySet
287 // (which may be double action anyways). The mechanism there to use _ContextID_Index_Pair
288 // is not working for AutomaticStyles and is already too late, too (this
289 // method is already called before XMLTextStyleContext::FillPropertySet gets called)
290 if(bDrawingLayerFillStylesUsed)
291 {
292 translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();
293 }
294
295 Reference < XAutoStyleFamily > xAutoFamily = pSvXMLStylesContext->GetAutoStyles( GetFamily() );
296 if( !xAutoFamily.is() )
297 return;
298 if( xImpPrMap.is() )
299 {
300 Sequence< PropertyValue > aValues;
301 xImpPrMap->FillPropertySequence( maProperties, aValues );
302
303 sal_Int32 nLen = aValues.getLength();
304 if( nLen )
305 {
306 if( GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH )
307 {
308 aValues.realloc( nLen + 2 );
309 PropertyValue *pProps = aValues.getArray() + nLen;
310 pProps->Name = "ParaStyleName";
311 OUString sParent( GetParentName() );
312 if( !sParent.isEmpty() )
313 {
314 sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
315 Reference < XNameContainer > xFamilies = pSvXMLStylesContext->GetStylesContainer( GetFamily() );
316 if(xFamilies.is() && xFamilies->hasByName( sParent ) )
317 {
318 css::uno::Reference< css::style::XStyle > xStyle;
319 Any aAny = xFamilies->getByName( sParent );
320 aAny >>= xStyle;
321 sParent = xStyle->getName() ;
322 }
323 }
324 else
325 sParent = "Standard";
326 pProps->Value <<= sParent;
327 ++pProps;
328 pProps->Name = "ParaConditionalStyleName";
329 pProps->Value <<= sParent;
330 }
331
332 Reference < XAutoStyle > xAutoStyle = xAutoFamily->insertStyle( aValues );
333 if( xAutoStyle.is() )
334 {
335 Sequence< OUString > aPropNames(1);
336 aPropNames[0] = GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ?
337 OUStringLiteral(u"ParaAutoStyleName") :
338 OUStringLiteral(u"CharAutoStyleName");
339 Sequence< Any > aAny = xAutoStyle->getPropertyValues( aPropNames );
340 if( aAny.hasElements() )
341 {
342 OUString aName;
343 aAny[0] >>= aName;
344 SetAutoName( aName );
345 }
346 }
347 }
348 }
349 }
350 else
351 {
352 const OUString& rName = GetDisplayName();
353 if( rName.isEmpty() || IsDefaultStyle() )
354 return;
355
356 Reference < XNameContainer > xFamilies = pSvXMLStylesContext->GetStylesContainer( GetFamily() );
357 if( !xFamilies.is() )
358 {
359 SAL_WARN("xmloff", "no styles container for family " << static_cast<int>(GetFamily()));
360 return;
361 }
362
363 bool bNew = false;
364 if( xFamilies->hasByName( rName ) )
365 {
366 Any aAny = xFamilies->getByName( rName );
367 aAny >>= mxStyle;
368 }
369 else
370 {
371 mxStyle = Create();
372 if( !mxStyle.is() )
373 return;
374
375 xFamilies->insertByName( rName, Any(mxStyle) );
376 bNew = true;
377 }
378
379 Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
380 Reference< XPropertySetInfo > xPropSetInfo =
381 xPropSet->getPropertySetInfo();
382 if( !bNew && xPropSetInfo->hasPropertyByName( gsIsPhysical ) )
383 {
384 Any aAny = xPropSet->getPropertyValue( gsIsPhysical );
385 bNew = !*o3tl::doAccess<bool>(aAny);
386 }
387 SetNew( bNew );
388 if( rName != GetName() )
389 GetImport().AddStyleDisplayName( GetFamily(), GetName(), rName );
390
391
392 if( bOverwrite || bNew )
393 {
394 rtl::Reference < XMLPropertySetMapper > xPrMap;
395 if( xImpPrMap.is() )
396 xPrMap = xImpPrMap->getPropertySetMapper();
397 if( xPrMap.is() )
398 {
399 Reference < XMultiPropertyStates > xMultiStates( xPropSet,
400 UNO_QUERY );
401 if( xMultiStates.is() )
402 {
403 xMultiStates->setAllPropertiesToDefault();
404 }
405 else
406 {
407 std::set < OUString > aNameSet;
408 sal_Int32 nCount = xPrMap->GetEntryCount();
409 sal_Int32 i;
410 for( i = 0; i < nCount; i++ )
411 {
412 const OUString& rPrName = xPrMap->GetEntryAPIName( i );
413 if( xPropSetInfo->hasPropertyByName( rPrName ) )
414 aNameSet.insert( rPrName );
415 }
416 Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
417 if (xPropState.is())
418 {
419 nCount = aNameSet.size();
420 Sequence<OUString> aNames( comphelper::containerToSequence(aNameSet) );
421 Sequence < PropertyState > aStates( xPropState->getPropertyStates(aNames) );
422 const PropertyState *pStates = aStates.getConstArray();
423 OUString* pNames = aNames.getArray();
424
425 for( i = 0; i < nCount; i++ )
426 {
427 if( PropertyState_DIRECT_VALUE == *pStates++ )
428 xPropState->setPropertyToDefault( pNames[i] );
429 }
430 }
431 }
432 }
433
434 if (mxStyle.is())
435 mxStyle->setParentStyle(OUString());
436
437 FillPropertySet( xPropSet );
438 }
439 else
440 {
441 SetValid( false );
442 }
443 }
444 }
445
Finish(bool bOverwrite)446 void XMLPropStyleContext::Finish( bool bOverwrite )
447 {
448 if( !mxStyle.is() || !(IsNew() || bOverwrite) )
449 return;
450
451 // The families container must exist
452 Reference < XNameContainer > xFamilies = mxStyles->GetStylesContainer( GetFamily() );
453 SAL_WARN_IF( !xFamilies.is(), "xmloff", "Families lost" );
454 if( !xFamilies.is() )
455 return;
456
457 // connect parent
458 OUString sParent( GetParentName() );
459 if( !sParent.isEmpty() )
460 sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
461 if( !sParent.isEmpty() && !xFamilies->hasByName( sParent ) )
462 sParent.clear();
463
464 if( sParent != mxStyle->getParentStyle() )
465 {
466 // this may except if setting the parent style forms a
467 // circle in the style dependencies; especially if the parent
468 // style is the same as the current style
469 try
470 {
471 mxStyle->setParentStyle( sParent );
472 }
473 catch(const uno::Exception& e)
474 {
475 // according to the API definition, I would expect a
476 // container::NoSuchElementException. But it throws an
477 // uno::RuntimeException instead. I catch
478 // uno::Exception in order to process both of them.
479
480 // We can't set the parent style. For a proper
481 // Error-Message, we should pass in the name of the
482 // style, as well as the desired parent style.
483
484 // getName() throws no non-Runtime exception:
485 GetImport().SetError(
486 XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
487 { mxStyle->getName(), sParent }, e.Message, nullptr );
488 }
489 }
490
491 // connect follow
492 OUString sFollow( GetFollow() );
493 if( !sFollow.isEmpty() )
494 sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
495 if( sFollow.isEmpty() || !xFamilies->hasByName( sFollow ) )
496 sFollow = mxStyle->getName();
497
498 Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
499 Reference< XPropertySetInfo > xPropSetInfo =
500 xPropSet->getPropertySetInfo();
501 if( xPropSetInfo->hasPropertyByName( gsFollowStyle ) )
502 {
503 Any aAny = xPropSet->getPropertyValue( gsFollowStyle );
504 OUString sCurrFollow;
505 aAny >>= sCurrFollow;
506 if( sCurrFollow != sFollow )
507 {
508 xPropSet->setPropertyValue( gsFollowStyle, Any(sFollow) );
509 }
510 }
511
512 if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
513 {
514 xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
515 }
516
517 }
518
doNewDrawingLayerFillStyleDefinitionsExist(const OUString & rFillStyleTag) const519 bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
520 const OUString& rFillStyleTag) const
521 {
522 if(!maProperties.empty() && rFillStyleTag.getLength())
523 {
524 // no & to avoid non-obvious UAF due to the 2nd temp Reference
525 const rtl::Reference<XMLPropertySetMapper> rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
526
527 if(rMapper.is())
528 {
529 for(const auto& a : maProperties)
530 {
531 if(a.mnIndex != -1)
532 {
533 const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
534
535 if(rPropName == rFillStyleTag)
536 {
537 FillStyle eFillStyle(FillStyle_NONE);
538
539 if(a.maValue >>= eFillStyle)
540 {
541 // okay, type was good, FillStyle is set
542 }
543 else
544 {
545 // also try an int (see XFillStyleItem::PutValue)
546 sal_Int32 nFillStyle(0);
547
548 if(a.maValue >>= nFillStyle)
549 {
550 eFillStyle = static_cast< FillStyle >(nFillStyle);
551 }
552 }
553
554 // we found the entry, check it
555 return FillStyle_NONE != eFillStyle;
556 }
557 }
558 }
559 }
560 }
561
562 return false;
563 }
564
deactivateOldFillStyleDefinitions(const OldFillStyleDefinitionSet & rHashSetOfTags)565 void XMLPropStyleContext::deactivateOldFillStyleDefinitions(
566 const OldFillStyleDefinitionSet& rHashSetOfTags)
567 {
568 if(rHashSetOfTags.empty() || maProperties.empty())
569 return;
570
571 const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
572
573 if(!rMapper.is())
574 return;
575
576 for(auto& a : maProperties)
577 {
578 if(a.mnIndex != -1)
579 {
580 const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
581
582 if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end())
583 {
584 // mark entry as inactive
585 a.mnIndex = -1;
586 }
587 }
588 }
589 }
590
translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames()591 void XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames()
592 {
593 if(maProperties.empty())
594 return;
595
596 const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
597
598 if(!rMapper.is())
599 return;
600
601 static OUString s_FillGradientName("FillGradientName");
602 static OUString s_FillHatchName("FillHatchName");
603 static OUString s_FillBitmapName("FillBitmapName");
604 static OUString s_FillTransparenceGradientName("FillTransparenceGradientName");
605
606 for(auto& a : maProperties)
607 {
608 if(a.mnIndex != -1)
609 {
610 const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
611 XmlStyleFamily aStyleFamily(XmlStyleFamily::DATA_STYLE);
612
613 if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName)
614 {
615 aStyleFamily = XmlStyleFamily::SD_GRADIENT_ID;
616 }
617 else if(rPropName == s_FillHatchName)
618 {
619 aStyleFamily = XmlStyleFamily::SD_HATCH_ID;
620 }
621 else if(rPropName == s_FillBitmapName)
622 {
623 aStyleFamily = XmlStyleFamily::SD_FILL_IMAGE_ID;
624 }
625
626 if(aStyleFamily != XmlStyleFamily::DATA_STYLE)
627 {
628 OUString sStyleName;
629
630 a.maValue >>= sStyleName;
631 sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName );
632 a.maValue <<= sStyleName;
633 }
634 }
635 }
636 }
637
638 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
639