Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/xml/sax/SAXParseException.hpp>
30 : : #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
31 : : #include <com/sun/star/xml/sax/SAXException.hpp>
32 : : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
33 : : #include <com/sun/star/xml/sax/XAttributeList.hpp>
34 : : #include <com/sun/star/xml/sax/XLocator.hpp>
35 : : #include <com/sun/star/container/XNameContainer.hpp>
36 : : #include <com/sun/star/beans/XPropertySet.hpp>
37 : : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
38 : : #include <com/sun/star/style/XAutoStylesSupplier.hpp>
39 : : #include <com/sun/star/style/XAutoStyleFamily.hpp>
40 : : #include "PageMasterPropMapper.hxx"
41 : : #include <tools/debug.hxx>
42 : : #include <svl/itemset.hxx>
43 : : #include <xmloff/nmspmap.hxx>
44 : : #include "xmloff/xmlnmspe.hxx"
45 : : #include <xmloff/xmltoken.hxx>
46 : :
47 : : #include <xmloff/families.hxx>
48 : : #include <xmloff/xmlimp.hxx>
49 : : #include <xmloff/xmlnumi.hxx>
50 : : #include <xmloff/xmlimppr.hxx>
51 : : #include <xmloff/xmlstyle.hxx>
52 : : #include <xmloff/txtstyli.hxx>
53 : : #include <xmloff/txtprmap.hxx>
54 : : #include <xmloff/xmlnumfi.hxx>
55 : : #include "XMLChartStyleContext.hxx"
56 : : #include "XMLChartPropertySetMapper.hxx"
57 : : #include <xmloff/XMLShapeStyleContext.hxx>
58 : : #include "FillStyleContext.hxx"
59 : : #include "XMLFootnoteConfigurationImportContext.hxx"
60 : : #include "XMLIndexBibliographyConfigurationContext.hxx"
61 : : #include "XMLLineNumberingImportContext.hxx"
62 : : #include "PageMasterImportContext.hxx"
63 : : #include "PageMasterImportPropMapper.hxx"
64 : :
65 : : #include <set>
66 : : #include <vector>
67 : :
68 : : using ::rtl::OUString;
69 : : using ::rtl::OUStringBuffer;
70 : : using ::std::vector;
71 : :
72 : : using namespace ::com::sun::star;
73 : : using namespace ::com::sun::star::uno;
74 : : using namespace ::com::sun::star::container;
75 : : using namespace ::com::sun::star::style;
76 : : using namespace ::xmloff::token;
77 : :
78 : : // ---------------------------------------------------------------------
79 : :
80 : : static SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
81 : : {
82 : : { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_STYLE_STYLE },
83 : : { XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, XML_TOK_STYLE_PAGE_MASTER },
84 : : { XML_NAMESPACE_TEXT, XML_LIST_STYLE, XML_TOK_TEXT_LIST_STYLE },
85 : : { XML_NAMESPACE_TEXT, XML_OUTLINE_STYLE, XML_TOK_TEXT_OUTLINE },
86 : : { XML_NAMESPACE_STYLE, XML_DEFAULT_STYLE, XML_TOK_STYLE_DEFAULT_STYLE },
87 : : { XML_NAMESPACE_DRAW, XML_GRADIENT, XML_TOK_STYLES_GRADIENTSTYLES },
88 : : { XML_NAMESPACE_DRAW, XML_HATCH, XML_TOK_STYLES_HATCHSTYLES },
89 : : { XML_NAMESPACE_DRAW, XML_FILL_IMAGE, XML_TOK_STYLES_BITMAPSTYLES },
90 : : { XML_NAMESPACE_DRAW, XML_OPACITY, XML_TOK_STYLES_TRANSGRADIENTSTYLES },
91 : : { XML_NAMESPACE_DRAW, XML_MARKER, XML_TOK_STYLES_MARKERSTYLES },
92 : : { XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_TOK_STYLES_DASHSTYLES },
93 : : { XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION, XML_TOK_TEXT_NOTE_CONFIG },
94 : : { XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY_CONFIGURATION, XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG },
95 : : { XML_NAMESPACE_TEXT, XML_LINENUMBERING_CONFIGURATION,XML_TOK_TEXT_LINENUMBERING_CONFIG },
96 : : { XML_NAMESPACE_STYLE, XML_DEFAULT_PAGE_LAYOUT, XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT },
97 : : XML_TOKEN_MAP_END
98 : : };
99 : :
100 : 4135 : const SvXMLTokenMap& SvXMLStylesContext::GetStyleStylesElemTokenMap()
101 : : {
102 [ + + ]: 4135 : if( !mpStyleStylesElemTokenMap )
103 : : mpStyleStylesElemTokenMap =
104 [ + - ]: 508 : new SvXMLTokenMap( aStyleStylesElemTokenMap );
105 : :
106 : 4135 : return *mpStyleStylesElemTokenMap;
107 : : }
108 : :
109 : : // ---------------------------------------------------------------------
110 : :
111 : 10874 : void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
112 : : const OUString& rLocalName,
113 : : const OUString& rValue )
114 : : {
115 : : // TODO: use a map here
116 [ + + ]: 10874 : if( XML_NAMESPACE_STYLE == nPrefixKey )
117 : : {
118 [ + + ]: 9610 : if( IsXMLToken( rLocalName, XML_FAMILY ) )
119 : : {
120 [ - + ]: 78 : if( IsXMLToken( rValue, XML_PARAGRAPH ) )
121 : 0 : mnFamily = (sal_uInt16)SFX_STYLE_FAMILY_PARA;
122 [ - + ]: 78 : else if( IsXMLToken( rValue, XML_TEXT ) )
123 : 0 : mnFamily = (sal_uInt16)SFX_STYLE_FAMILY_CHAR;
124 : : }
125 [ + + ]: 9532 : else if( IsXMLToken( rLocalName, XML_NAME ) )
126 : : {
127 : 6547 : maName = rValue;
128 : : }
129 [ + + ]: 2985 : else if( IsXMLToken( rLocalName, XML_DISPLAY_NAME ) )
130 : : {
131 : 450 : maDisplayName = rValue;
132 : : }
133 [ + + ]: 2535 : else if( IsXMLToken( rLocalName, XML_PARENT_STYLE_NAME ) )
134 : : {
135 : 1805 : maParentName = rValue;
136 : : }
137 [ + + ]: 730 : else if( IsXMLToken( rLocalName, XML_NEXT_STYLE_NAME ) )
138 : : {
139 : 141 : maFollow = rValue;
140 : : }
141 [ - + ]: 589 : else if( IsXMLToken( rLocalName, XML_HELP_FILE_NAME ) )
142 : : {
143 : 0 : maHelpFile = rValue;
144 : : }
145 [ - + ]: 589 : else if( IsXMLToken( rLocalName, XML_HELP_ID ) )
146 : : {
147 : 0 : sal_Int32 nTmp = rValue.toInt32();
148 : : mnHelpId =
149 : : (nTmp < 0L) ? 0U : ( (nTmp > USHRT_MAX) ? USHRT_MAX
150 [ # # ][ # # ]: 0 : : (sal_uInt16)nTmp );
151 : : }
152 : : }
153 : 10874 : }
154 : :
155 [ + + ][ - + ]: 1149 : TYPEINIT1( SvXMLStyleContext, SvXMLImportContext );
156 : :
157 : 7254 : SvXMLStyleContext::SvXMLStyleContext(
158 : : SvXMLImport& rImp, sal_uInt16 nPrfx,
159 : : const OUString& rLName,
160 : : const uno::Reference< xml::sax::XAttributeList >&,
161 : : sal_uInt16 nFam, sal_Bool bDefault ) :
162 : : SvXMLImportContext( rImp, nPrfx, rLName ),
163 : : mnHelpId( UCHAR_MAX ),
164 : : mnFamily( nFam ),
165 : : mbValid( sal_True ),
166 : : mbNew( sal_True ),
167 : 7254 : mbDefaultStyle( bDefault )
168 : : {
169 : 7254 : }
170 : :
171 : 7254 : SvXMLStyleContext::~SvXMLStyleContext()
172 : : {
173 [ - + ]: 7254 : }
174 : :
175 : 0 : SvXMLImportContext *SvXMLStyleContext::CreateChildContext( sal_uInt16 nPrefix,
176 : : const OUString& rLocalName,
177 : : const uno::Reference< xml::sax::XAttributeList > & )
178 : : {
179 [ # # ]: 0 : return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
180 : : }
181 : :
182 : 6634 : void SvXMLStyleContext::StartElement( const uno::Reference< xml::sax::XAttributeList > & xAttrList )
183 : : {
184 [ + - ]: 6634 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
185 [ + + ]: 25856 : for( sal_Int16 i=0; i < nAttrCount; i++ )
186 : : {
187 [ + - ][ + - ]: 19222 : const OUString& rAttrName = xAttrList->getNameByIndex( i );
188 : 19222 : OUString aLocalName;
189 [ + - ]: 19222 : sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
190 [ + - ][ + - ]: 19222 : const OUString& rValue = xAttrList->getValueByIndex( i );
191 : :
192 [ + - ]: 19222 : SetAttribute( nPrefix, aLocalName, rValue );
193 : 19222 : }
194 : 6634 : }
195 : :
196 : 0 : void SvXMLStyleContext::SetDefaults()
197 : : {
198 : 0 : }
199 : :
200 : 221 : void SvXMLStyleContext::CreateAndInsert( sal_Bool /*bOverwrite*/ )
201 : : {
202 : 221 : }
203 : :
204 : 2197 : void SvXMLStyleContext::CreateAndInsertLate( sal_Bool /*bOverwrite*/ )
205 : : {
206 : 2197 : }
207 : :
208 : 878 : void SvXMLStyleContext::Finish( sal_Bool /*bOverwrite*/ )
209 : : {
210 : 878 : }
211 : :
212 : 6660 : sal_Bool SvXMLStyleContext::IsTransient() const
213 : : {
214 : 6660 : return sal_False;
215 : : }
216 : :
217 : : // ---------------------------------------------------------------------
218 : :
219 : 28438 : class SvXMLStyleIndex_Impl
220 : : {
221 : : OUString sName;
222 : : sal_uInt16 nFamily;
223 : : const SvXMLStyleContext *pStyle;
224 : :
225 : : public:
226 : :
227 : 9066 : SvXMLStyleIndex_Impl( sal_uInt16 nFam, const OUString& rName ) :
228 : : sName( rName ),
229 : : nFamily( nFam ),
230 : 9066 : pStyle ( 0 )
231 : : {
232 : 9066 : }
233 : :
234 : 19372 : SvXMLStyleIndex_Impl( const SvXMLStyleContext *pStl ) :
235 : 19372 : sName( pStl->GetName() ),
236 : 19372 : nFamily( pStl->GetFamily() ),
237 : 19372 : pStyle ( pStl )
238 : : {
239 : 19372 : }
240 : :
241 : 74998 : const OUString& GetName() const { return sName; }
242 : 203886 : sal_uInt16 GetFamily() const { return nFamily; }
243 : 8079 : const SvXMLStyleContext *GetStyle() const { return pStyle; }
244 : : };
245 : :
246 : : struct SvXMLStyleIndexCmp_Impl
247 : : {
248 : 59003 : bool operator()(const SvXMLStyleIndex_Impl& r1, const SvXMLStyleIndex_Impl& r2) const
249 : : {
250 : : sal_Int32 nRet;
251 : :
252 [ + + ]: 59003 : if( (sal_uInt16)r1.GetFamily() < (sal_uInt16)r2.GetFamily() )
253 : 16063 : nRet = -1;
254 [ + + ]: 42940 : else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() )
255 : 5441 : nRet = 1;
256 : : else
257 : 37499 : nRet = r1.GetName().compareTo( r2.GetName() );
258 : :
259 : 59003 : return nRet < 0;
260 : : }
261 : : };
262 : :
263 : : // ---------------------------------------------------------------------
264 : :
265 : : typedef SvXMLStyleContext *SvXMLStyleContextPtr;
266 : : typedef vector< SvXMLStyleContextPtr > SvXMLStyleContexts_Impl;
267 : :
268 : : typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> SvXMLStyleIndices_Impl;
269 : :
270 : : class SvXMLStylesContext_Impl
271 : : {
272 : : SvXMLStyleContexts_Impl aStyles;
273 : : SvXMLStyleIndices_Impl *pIndices;
274 : : sal_Bool bAutomaticStyle;
275 : :
276 : : #ifdef DBG_UTIL
277 : : sal_uInt32 nIndexCreated;
278 : : #endif
279 : :
280 [ + + ]: 8314 : void FlushIndex() { delete pIndices; pIndices = 0; }
281 : :
282 : : public:
283 : : SvXMLStylesContext_Impl( sal_Bool bAuto );
284 : : ~SvXMLStylesContext_Impl();
285 : :
286 : 4055 : size_t GetStyleCount() const { return aStyles.size(); }
287 : :
288 : : const SvXMLStyleContext *GetStyle( size_t i ) const
289 : : {
290 : : return i < aStyles.size() ? aStyles[ i ] : 0;
291 : : }
292 : :
293 : 12170 : SvXMLStyleContext *GetStyle( size_t i )
294 : : {
295 [ + - ]: 12170 : return i < aStyles.size() ? aStyles[ i ] : 0;
296 : : }
297 : :
298 : : inline void AddStyle( SvXMLStyleContext *pStyle );
299 : : void Clear();
300 : :
301 : : const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily,
302 : : const OUString& rName, sal_Bool bCreateIndex ) const;
303 : 3451 : sal_Bool IsAutomaticStyle() const { return bAutomaticStyle; }
304 : : };
305 : :
306 : 996 : SvXMLStylesContext_Impl::SvXMLStylesContext_Impl( sal_Bool bAuto ) :
307 : : pIndices( 0 ),
308 : 996 : bAutomaticStyle( bAuto )
309 : : #ifdef DBG_UTIL
310 : : , nIndexCreated( 0 )
311 : : #endif
312 : 996 : {}
313 : :
314 : 996 : SvXMLStylesContext_Impl::~SvXMLStylesContext_Impl()
315 : : {
316 [ - + ]: 996 : delete pIndices;
317 : :
318 [ + + ]: 1188 : for ( size_t i = 0, n = aStyles.size(); i < n; ++i )
319 : : {
320 [ + - ]: 192 : SvXMLStyleContext *pStyle = aStyles[ i ];
321 [ + - ]: 192 : pStyle->ReleaseRef();
322 : : }
323 : 996 : aStyles.clear();
324 : 996 : }
325 : :
326 : 7084 : inline void SvXMLStylesContext_Impl::AddStyle( SvXMLStyleContext *pStyle )
327 : : {
328 : 7084 : aStyles.push_back( pStyle );
329 : 7084 : pStyle->AddRef();
330 : :
331 : 7084 : FlushIndex();
332 : 7084 : }
333 : :
334 : 1230 : void SvXMLStylesContext_Impl::Clear()
335 : : {
336 : 1230 : FlushIndex();
337 : :
338 [ + + ]: 8122 : for ( size_t i = 0, n = aStyles.size(); i < n; ++i )
339 : : {
340 : 6892 : SvXMLStyleContext *pStyle = aStyles[ i ];
341 : 6892 : pStyle->ReleaseRef();
342 : : }
343 : 1230 : aStyles.clear();
344 : 1230 : }
345 : :
346 : 12471 : const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext(
347 : : sal_uInt16 nFamily,
348 : : const OUString& rName,
349 : : sal_Bool bCreateIndex ) const
350 : : {
351 : 12471 : const SvXMLStyleContext *pStyle = 0;
352 : :
353 [ + + ][ + + ]: 12471 : if( !pIndices && bCreateIndex && !aStyles.empty() )
[ + + ][ + + ]
354 : : {
355 : : #ifdef DBG_UTIL
356 : : DBG_ASSERT( 0==nIndexCreated,
357 : : "Performance warning: sdbcx::Index created multiple times" );
358 : : #endif
359 : : ((SvXMLStylesContext_Impl *)this)->pIndices =
360 [ + - ][ + - ]: 564 : new SvXMLStyleIndices_Impl( aStyles.begin(), aStyles.end() );
361 : : SAL_WARN_IF(pIndices->size() != aStyles.size(), "xmloff", "Here is a duplicate Style");
362 : : #ifdef DBG_UTIL
363 : : ((SvXMLStylesContext_Impl *)this)->nIndexCreated++;
364 : : #endif
365 : : }
366 : :
367 [ + + ]: 12471 : if( pIndices )
368 : : {
369 : 9066 : SvXMLStyleIndex_Impl aIndex( nFamily, rName );
370 [ + - ]: 9066 : SvXMLStyleIndices_Impl::iterator aFind = pIndices->find(aIndex);
371 [ + + ]: 9066 : if( aFind != pIndices->end() )
372 : 9066 : pStyle = aFind->GetStyle();
373 : : }
374 : : else
375 : : {
376 [ + + ][ + + ]: 43213 : for( size_t i = 0; !pStyle && i < aStyles.size(); i++ )
[ + + ]
377 : : {
378 : 39808 : const SvXMLStyleContext *pS = aStyles[ i ];
379 [ + + ]: 52880 : if( pS->GetFamily() == nFamily &&
[ + + + + ]
380 : 13072 : pS->GetName() == rName )
381 : 3262 : pStyle = pS;
382 : : }
383 : : }
384 : 12471 : return pStyle;
385 : : }
386 : :
387 : : // ---------------------------------------------------------------------
388 : :
389 [ # # ][ # # ]: 0 : TYPEINIT1( SvXMLStylesContext, SvXMLImportContext );
390 : :
391 : 4055 : sal_uInt32 SvXMLStylesContext::GetStyleCount() const
392 : : {
393 : 4055 : return mpImpl->GetStyleCount();
394 : : }
395 : :
396 : 9110 : SvXMLStyleContext *SvXMLStylesContext::GetStyle( sal_uInt32 i )
397 : : {
398 : 9110 : return mpImpl->GetStyle( i );
399 : : }
400 : :
401 : 3060 : const SvXMLStyleContext *SvXMLStylesContext::GetStyle( sal_uInt32 i ) const
402 : : {
403 : 3060 : return mpImpl->GetStyle( i );
404 : : }
405 : :
406 : 3451 : sal_Bool SvXMLStylesContext::IsAutomaticStyle() const
407 : : {
408 : 3451 : return mpImpl->IsAutomaticStyle();
409 : : }
410 : :
411 : 4865 : SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
412 : : sal_uInt16 p_nPrefix,
413 : : const OUString& rLocalName,
414 : : const uno::Reference< xml::sax::XAttributeList > & xAttrList )
415 : : {
416 : 4865 : SvXMLStyleContext *pStyle = NULL;
417 : :
418 [ + + ]: 4865 : if(GetImport().GetDataStylesImport())
419 : : {
420 : 4311 : pStyle = GetImport().GetDataStylesImport()->CreateChildContext(GetImport(), p_nPrefix,
421 : 4311 : rLocalName, xAttrList, *this);
422 : : }
423 : :
424 [ + + ]: 4865 : if (!pStyle)
425 : : {
426 : 4135 : const SvXMLTokenMap& rTokenMap = GetStyleStylesElemTokenMap();
427 : 4135 : sal_uInt16 nToken = rTokenMap.Get( p_nPrefix, rLocalName );
428 [ + + + + : 4135 : switch( nToken )
+ + + + +
+ + + +
- ]
429 : : {
430 : : case XML_TOK_STYLE_STYLE:
431 : : case XML_TOK_STYLE_DEFAULT_STYLE:
432 : : {
433 : 3412 : sal_uInt16 nFamily = 0;
434 [ + - ]: 3412 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
435 [ + - ]: 10272 : for( sal_Int16 i=0; i < nAttrCount; i++ )
436 : : {
437 [ + - ][ + - ]: 6860 : const OUString& rAttrName = xAttrList->getNameByIndex( i );
438 : 6860 : OUString aLocalName;
439 : : sal_uInt16 nPrefix =
440 : 6860 : GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
441 [ + - ]: 6860 : &aLocalName );
442 [ + - ][ + + ]: 13720 : if( XML_NAMESPACE_STYLE == nPrefix &&
[ + + ]
443 [ + - ]: 6860 : IsXMLToken( aLocalName, XML_FAMILY ) )
444 : : {
445 [ + - ][ + - ]: 3412 : const OUString& rValue = xAttrList->getValueByIndex( i );
446 [ + - ]: 3412 : nFamily = GetFamily( rValue );
447 : 6860 : break;
448 : : }
449 [ + + ][ + + ]: 6860 : }
450 : : pStyle = XML_TOK_STYLE_STYLE==nToken
451 : : ? CreateStyleStyleChildContext( nFamily, p_nPrefix,
452 : 3047 : rLocalName, xAttrList )
453 : : : CreateDefaultStyleStyleChildContext( nFamily, p_nPrefix,
454 [ + + ]: 3412 : rLocalName, xAttrList );
455 : : }
456 : 3412 : break;
457 : : case XML_TOK_STYLE_PAGE_MASTER:
458 : : case XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT:
459 : : {
460 : : //there is not page family in odf now, so I specify one for it
461 : : sal_Bool bDefaultStyle = XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT == nToken
462 [ + + ]: 297 : ? sal_True: sal_False;
463 : 297 : pStyle = new PageStyleContext( GetImport(), p_nPrefix,
464 [ + - ]: 297 : rLocalName, xAttrList, *this, bDefaultStyle );
465 : : }
466 : 297 : break;
467 : : case XML_TOK_TEXT_LIST_STYLE:
468 : 50 : pStyle = new SvxXMLListStyleContext( GetImport(), p_nPrefix,
469 [ + - ]: 50 : rLocalName, xAttrList );
470 : 50 : break;
471 : : case XML_TOK_TEXT_OUTLINE:
472 : 63 : pStyle = new SvxXMLListStyleContext( GetImport(), p_nPrefix,
473 [ + - ]: 63 : rLocalName, xAttrList, sal_True );
474 : 63 : break;
475 : : case XML_TOK_TEXT_NOTE_CONFIG:
476 : 126 : pStyle = new XMLFootnoteConfigurationImportContext(GetImport(),
477 : : p_nPrefix,
478 : : rLocalName,
479 [ + - ]: 126 : xAttrList);
480 : 126 : break;
481 : :
482 : : case XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG:
483 : : pStyle = new XMLIndexBibliographyConfigurationContext(
484 [ + - ]: 4 : GetImport(), p_nPrefix, rLocalName, xAttrList);
485 : 4 : break;
486 : :
487 : : case XML_TOK_TEXT_LINENUMBERING_CONFIG:
488 : : pStyle = new XMLLineNumberingImportContext(
489 [ + - ]: 63 : GetImport(), p_nPrefix, rLocalName, xAttrList);
490 : 63 : break;
491 : :
492 : : //
493 : : // FillStyles
494 : : //
495 : : case XML_TOK_STYLES_GRADIENTSTYLES:
496 : : {
497 [ + - ]: 33 : pStyle = new XMLGradientStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
498 : 33 : break;
499 : : }
500 : : case XML_TOK_STYLES_HATCHSTYLES:
501 : : {
502 [ + - ]: 36 : pStyle = new XMLHatchStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
503 : 36 : break;
504 : : }
505 : : case XML_TOK_STYLES_BITMAPSTYLES:
506 : : {
507 [ + - ]: 12 : pStyle = new XMLBitmapStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
508 : 12 : break;
509 : : }
510 : : case XML_TOK_STYLES_TRANSGRADIENTSTYLES:
511 : : {
512 [ + - ]: 14 : pStyle = new XMLTransGradientStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
513 : 14 : break;
514 : : }
515 : : case XML_TOK_STYLES_MARKERSTYLES:
516 : : {
517 [ + - ]: 22 : pStyle = new XMLMarkerStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
518 : 22 : break;
519 : : }
520 : : case XML_TOK_STYLES_DASHSTYLES:
521 : : {
522 [ + - ]: 3 : pStyle = new XMLDashStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList );
523 : 4135 : break;
524 : : }
525 : : }
526 : : }
527 : :
528 : 4865 : return pStyle;
529 : : }
530 : :
531 : 2136 : SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
532 : : sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
533 : : const uno::Reference< xml::sax::XAttributeList > & xAttrList )
534 : : {
535 : 2136 : SvXMLStyleContext *pStyle = 0;
536 : :
537 [ + + + + : 2136 : switch( nFamily )
+ ]
538 : : {
539 : : case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
540 : : case XML_STYLE_FAMILY_TEXT_TEXT:
541 : : case XML_STYLE_FAMILY_TEXT_SECTION:
542 : 232 : pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName,
543 [ + - ]: 232 : xAttrList, *this, nFamily );
544 : 232 : break;
545 : :
546 : : case XML_STYLE_FAMILY_TEXT_RUBY:
547 : 14 : pStyle = new XMLPropStyleContext( GetImport(), nPrefix, rLocalName,
548 [ + - ]: 14 : xAttrList, *this, nFamily );
549 : 14 : break;
550 : : case XML_STYLE_FAMILY_SCH_CHART_ID:
551 : 78 : pStyle = new XMLChartStyleContext( GetImport(), nPrefix, rLocalName,
552 [ + - ]: 78 : xAttrList, *this, nFamily );
553 : 78 : break;
554 : :
555 : : case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
556 : : case XML_STYLE_FAMILY_SD_PRESENTATION_ID:
557 : : case XML_STYLE_FAMILY_SD_POOL_ID:
558 : 413 : pStyle = new XMLShapeStyleContext( GetImport(), nPrefix, rLocalName,
559 [ + - ]: 413 : xAttrList, *this, nFamily );
560 : : }
561 : :
562 : 2136 : return pStyle;
563 : : }
564 : :
565 : 102 : SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext(
566 : : sal_uInt16 /*nFamily*/, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/,
567 : : const uno::Reference< xml::sax::XAttributeList > & )
568 : : {
569 : 102 : return 0;
570 : : }
571 : :
572 : :
573 : 3854 : sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const
574 : : {
575 : 3854 : return sal_True;
576 : : }
577 : :
578 : 3412 : sal_uInt16 SvXMLStylesContext::GetFamily(
579 : : const ::rtl::OUString& rValue ) const
580 : : {
581 : 3412 : sal_uInt16 nFamily = 0U;
582 [ + + ]: 3412 : if( IsXMLToken( rValue, XML_PARAGRAPH ) )
583 : : {
584 : 833 : nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH;
585 : : }
586 [ + + ]: 2579 : else if( IsXMLToken( rValue, XML_TEXT ) )
587 : : {
588 : 191 : nFamily = XML_STYLE_FAMILY_TEXT_TEXT;
589 : : }
590 [ - + ]: 2388 : else if( IsXMLToken( rValue, XML_DATA_STYLE ) )
591 : : {
592 : 0 : nFamily = XML_STYLE_FAMILY_DATA_STYLE;
593 : : }
594 [ + + ]: 2388 : else if ( IsXMLToken( rValue, XML_SECTION ) )
595 : : {
596 : 19 : nFamily = XML_STYLE_FAMILY_TEXT_SECTION;
597 : : }
598 [ + + ]: 2369 : else if( IsXMLToken( rValue, XML_TABLE ) )
599 : : {
600 : 163 : nFamily = XML_STYLE_FAMILY_TABLE_TABLE;
601 : : }
602 [ + + ]: 2206 : else if( IsXMLToken( rValue, XML_TABLE_COLUMN ) )
603 : 330 : nFamily = XML_STYLE_FAMILY_TABLE_COLUMN;
604 [ + + ]: 1876 : else if( IsXMLToken( rValue, XML_TABLE_ROW ) )
605 : 196 : nFamily = XML_STYLE_FAMILY_TABLE_ROW;
606 [ + + ]: 1680 : else if( IsXMLToken( rValue, XML_TABLE_CELL ) )
607 : 1016 : nFamily = XML_STYLE_FAMILY_TABLE_CELL;
608 [ + + ]: 664 : else if ( rValue == XML_STYLE_FAMILY_SD_GRAPHICS_NAME )
609 : : {
610 : 402 : nFamily = XML_STYLE_FAMILY_SD_GRAPHICS_ID;
611 : : }
612 [ + + ]: 262 : else if ( rValue == XML_STYLE_FAMILY_SD_PRESENTATION_NAME )
613 : : {
614 : 134 : nFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
615 : : }
616 [ - + ]: 128 : else if ( rValue == XML_STYLE_FAMILY_SD_POOL_NAME )
617 : : {
618 : 0 : nFamily = XML_STYLE_FAMILY_SD_POOL_ID;
619 : : }
620 [ + + ]: 128 : else if ( rValue == XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME )
621 : : {
622 : 36 : nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID;
623 : : }
624 [ + + ]: 92 : else if ( rValue == XML_STYLE_FAMILY_SCH_CHART_NAME )
625 : : {
626 : 78 : nFamily = XML_STYLE_FAMILY_SCH_CHART_ID;
627 : : }
628 [ + - ]: 14 : else if ( IsXMLToken( rValue, XML_RUBY ) )
629 : : {
630 : 14 : nFamily = XML_STYLE_FAMILY_TEXT_RUBY;
631 : : }
632 : :
633 : 3412 : return nFamily;
634 : : }
635 : :
636 : 18742 : UniReference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportPropertyMapper(
637 : : sal_uInt16 nFamily ) const
638 : : {
639 : 18742 : UniReference < SvXMLImportPropertyMapper > xMapper;
640 : :
641 [ + + + + : 18742 : switch( nFamily )
+ + + + ]
642 : : {
643 : : case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
644 [ + + ]: 3229 : if( !mxParaImpPropMapper.is() )
645 : : {
646 : 119 : SvXMLStylesContext * pThis = (SvXMLStylesContext *)this;
647 : : pThis->mxParaImpPropMapper =
648 : 119 : pThis->GetImport().GetTextImport()
649 [ + - ][ + - ]: 119 : ->GetParaImportPropertySetMapper();
[ + - ][ + - ]
[ + - ]
650 : : }
651 [ + - ]: 3229 : xMapper = mxParaImpPropMapper;
652 : 3229 : break;
653 : : case XML_STYLE_FAMILY_TEXT_TEXT:
654 [ + + ]: 564 : if( !mxTextImpPropMapper.is() )
655 : : {
656 : 47 : SvXMLStylesContext * pThis = (SvXMLStylesContext *)this;
657 : : pThis->mxTextImpPropMapper =
658 : 47 : pThis->GetImport().GetTextImport()
659 [ + - ][ + - ]: 47 : ->GetTextImportPropertySetMapper();
[ + - ][ + - ]
[ + - ]
660 : : }
661 [ + - ]: 564 : xMapper = mxTextImpPropMapper;
662 : 564 : break;
663 : :
664 : : case XML_STYLE_FAMILY_TEXT_SECTION:
665 : : // don't cache section mapper, as it's rarely used
666 : : // *sigh*, cast to non-const, because this is a const method,
667 : : // but SvXMLImport::GetTextImport() isn't.
668 : 86 : xMapper = ((SvXMLStylesContext*)this)->GetImport().GetTextImport()->
669 [ + - ][ + - ]: 86 : GetSectionImportPropertySetMapper();
[ + - ][ + - ]
[ + - ]
670 : 86 : break;
671 : :
672 : : case XML_STYLE_FAMILY_TEXT_RUBY:
673 : : // don't cache section mapper, as it's rarely used
674 : : // *sigh*, cast to non-const, because this is a const method,
675 : : // but SvXMLImport::GetTextImport() isn't.
676 : 38 : xMapper = ((SvXMLStylesContext*)this)->GetImport().GetTextImport()->
677 [ + - ][ + - ]: 38 : GetRubyImportPropertySetMapper();
[ + - ][ + - ]
[ + - ]
678 : 38 : break;
679 : :
680 : : case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
681 : : case XML_STYLE_FAMILY_SD_PRESENTATION_ID:
682 : : case XML_STYLE_FAMILY_SD_POOL_ID:
683 [ + + ]: 2530 : if(!mxShapeImpPropMapper.is())
684 : : {
685 [ + - ]: 123 : UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
686 : : ((SvXMLStylesContext*)this)->mxShapeImpPropMapper =
687 [ + - ][ + - ]: 123 : aImpHelper->GetPropertySetMapper();
[ + - ]
688 : : }
689 [ + - ]: 2530 : xMapper = mxShapeImpPropMapper;
690 : 2530 : break;
691 : : case XML_STYLE_FAMILY_SCH_CHART_ID:
692 [ + + ]: 396 : if( ! mxChartImpPropMapper.is() )
693 : : {
694 [ + - ][ + - ]: 6 : XMLPropertySetMapper *pPropMapper = new XMLChartPropertySetMapper();
695 [ + - ][ + - ]: 6 : mxChartImpPropMapper = new XMLChartImportPropertyMapper( pPropMapper, GetImport() );
[ + - ][ + - ]
[ + - ]
696 : : }
697 [ + - ]: 396 : xMapper = mxChartImpPropMapper;
698 : 396 : break;
699 : : case XML_STYLE_FAMILY_PAGE_MASTER:
700 [ + + ]: 1185 : if( ! mxPageImpPropMapper.is() )
701 : : {
702 : : XMLPropertySetMapper *pPropMapper =
703 [ + - ][ + - ]: 162 : new XMLPageMasterPropSetMapper();
704 : : mxPageImpPropMapper =
705 : : new PageMasterImportPropertyMapper( pPropMapper,
706 [ + - ][ + - ]: 162 : ((SvXMLStylesContext*)this)->GetImport() );
[ + - ][ + - ]
[ + - ]
707 : : }
708 [ + - ]: 1185 : xMapper = mxPageImpPropMapper;
709 : 1185 : break;
710 : : }
711 : :
712 : 18742 : return xMapper;
713 : : }
714 : :
715 : 128 : Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFamily ) const
716 : : {
717 : 128 : Reference < XAutoStyleFamily > xAutoStyles;
718 [ + - ][ + + ]: 128 : if( XML_STYLE_FAMILY_TEXT_TEXT == nFamily || XML_STYLE_FAMILY_TEXT_PARAGRAPH == nFamily)
719 : : {
720 : 128 : bool bPara = XML_STYLE_FAMILY_TEXT_PARAGRAPH == nFamily;
721 : 128 : OUString sName;
722 [ - + ][ - + ]: 128 : if( !bPara && mxTextAutoStyles.is() )
[ + + ]
723 [ # # ]: 0 : xAutoStyles = mxTextAutoStyles;
724 [ + + ][ + + ]: 128 : else if( bPara && mxParaAutoStyles.is() )
[ + + ]
725 [ + - ]: 81 : xAutoStyles = mxParaAutoStyles;
726 : : else
727 : : {
728 : : sName = bPara ?
729 : : OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ):
730 [ + + ][ + - ]: 47 : OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
[ + - ]
731 [ + - ]: 47 : Reference< XAutoStylesSupplier > xAutoStylesSupp( GetImport().GetModel(), UNO_QUERY );
732 [ + - ][ + - ]: 47 : Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
733 [ + - ][ + - ]: 47 : if (xAutoStyleFamilies->hasByName(sName))
[ + - ]
734 : : {
735 [ + - ][ + - ]: 47 : Any aAny = xAutoStyleFamilies->getByName( sName );
736 [ + - ]: 47 : xAutoStyles = *(Reference<XAutoStyleFamily>*)aAny.getValue();
737 [ + + ]: 47 : if( bPara )
738 [ + - ]: 34 : ((SvXMLStylesContext *)this)->mxParaAutoStyles = xAutoStyles;
739 : : else
740 [ + - ]: 47 : ((SvXMLStylesContext *)this)->mxTextAutoStyles = xAutoStyles;
741 : 47 : }
742 : 128 : }
743 : : }
744 : 128 : return xAutoStyles;
745 : : }
746 : :
747 : 2600 : Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer(
748 : : sal_uInt16 nFamily ) const
749 : : {
750 : 2600 : Reference < XNameContainer > xStyles;
751 : 2600 : OUString sName;
752 [ + + + ]: 2600 : switch( nFamily )
753 : : {
754 : : case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
755 [ + + ]: 1222 : if( mxParaStyles.is() )
756 [ + - ]: 1159 : xStyles = mxParaStyles;
757 : : else
758 : : sName =
759 [ + - ]: 63 : OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
760 : 1222 : break;
761 : :
762 : : case XML_STYLE_FAMILY_TEXT_TEXT:
763 [ + + ]: 340 : if( mxTextStyles.is() )
764 [ + - ]: 314 : xStyles = mxTextStyles;
765 : : else
766 : : sName =
767 [ + - ]: 26 : OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
768 : 340 : break;
769 : : }
770 [ + + ][ + + ]: 2600 : if( !xStyles.is() && !sName.isEmpty() )
[ + + ]
771 : : {
772 : : Reference< XStyleFamiliesSupplier > xFamiliesSupp(
773 [ + - ]: 89 : GetImport().GetModel(), UNO_QUERY );
774 [ + - ]: 89 : if ( xFamiliesSupp.is() )
775 : : {
776 [ + - ][ + - ]: 89 : Reference< XNameAccess > xFamilies = xFamiliesSupp->getStyleFamilies();
777 [ + - ][ + - ]: 89 : if (xFamilies->hasByName(sName))
[ + - ]
778 : : {
779 [ + - ][ + - ]: 89 : xStyles.set(xFamilies->getByName( sName ),uno::UNO_QUERY);
[ + - ]
780 : :
781 [ + + - ]: 89 : switch( nFamily )
782 : : {
783 : : case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
784 [ + - ]: 63 : ((SvXMLStylesContext *)this)->mxParaStyles = xStyles;
785 : 63 : break;
786 : :
787 : : case XML_STYLE_FAMILY_TEXT_TEXT:
788 [ + - ]: 26 : ((SvXMLStylesContext *)this)->mxTextStyles = xStyles;
789 : 89 : break;
790 : : }
791 : 89 : }
792 : 89 : }
793 : : }
794 : :
795 : 2600 : return xStyles;
796 : : }
797 : :
798 : 262 : OUString SvXMLStylesContext::GetServiceName( sal_uInt16 nFamily ) const
799 : : {
800 [ + - ]: 262 : String sServiceName;
801 [ + + + ]: 262 : switch( nFamily )
802 : : {
803 : : case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
804 [ + - ]: 92 : sServiceName = msParaStyleServiceName;
805 : 92 : break;
806 : : case XML_STYLE_FAMILY_TEXT_TEXT:
807 [ + - ]: 116 : sServiceName = msTextStyleServiceName;
808 : 116 : break;
809 : : }
810 : :
811 [ + - ][ + - ]: 262 : return sServiceName;
812 : : }
813 : :
814 : :
815 : 996 : SvXMLStylesContext::SvXMLStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
816 : : const OUString& rLName,
817 : : const uno::Reference< xml::sax::XAttributeList > &, sal_Bool bAuto ) :
818 : : SvXMLImportContext( rImport, nPrfx, rLName ),
819 : : msParaStyleServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphStyle" ) ),
820 : : msTextStyleServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterStyle" ) ),
821 [ + - ]: 996 : mpImpl( new SvXMLStylesContext_Impl( bAuto ) ),
822 [ + - ][ + - ]: 1992 : mpStyleStylesElemTokenMap( 0 )
[ + - ]
823 : : {
824 : 996 : }
825 : :
826 : :
827 [ + - ][ + - ]: 996 : SvXMLStylesContext::~SvXMLStylesContext()
[ + - ][ + - ]
[ + - ]
828 : : {
829 [ + + ][ + - ]: 996 : delete mpStyleStylesElemTokenMap;
830 [ + - ][ + - ]: 996 : delete mpImpl;
831 [ - + ]: 1008 : }
832 : :
833 : 6780 : SvXMLImportContext *SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix,
834 : : const OUString& rLocalName,
835 : : const uno::Reference< xml::sax::XAttributeList > & xAttrList )
836 : : {
837 : 6780 : SvXMLImportContext *pContext = 0;
838 : :
839 : : SvXMLStyleContext *pStyle =
840 : 6780 : CreateStyleChildContext( nPrefix, rLocalName, xAttrList );
841 [ + - ]: 6780 : if( pStyle )
842 : : {
843 [ + + ]: 6780 : if( !pStyle->IsTransient() )
844 : 6660 : mpImpl->AddStyle( pStyle );
845 : 6780 : pContext = pStyle;
846 : : }
847 : : else
848 : : {
849 : 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix,
850 [ # # ]: 0 : rLocalName );
851 : : }
852 : :
853 : 6780 : return pContext;
854 : : }
855 : :
856 : 618 : void SvXMLStylesContext::EndElement()
857 : : {
858 : 618 : }
859 : :
860 : 424 : void SvXMLStylesContext::AddStyle(SvXMLStyleContext& rNew)
861 : : {
862 : 424 : mpImpl->AddStyle( &rNew );
863 : 424 : }
864 : :
865 : 1230 : void SvXMLStylesContext::Clear()
866 : : {
867 : 1230 : mpImpl->Clear();
868 : 1230 : }
869 : :
870 : 126 : void SvXMLStylesContext::CopyAutoStylesToDoc()
871 : : {
872 : 126 : sal_uInt32 nCount = GetStyleCount();
873 : : sal_uInt32 i;
874 [ + + ]: 479 : for( i = 0; i < nCount; i++ )
875 : : {
876 : 353 : SvXMLStyleContext *pStyle = GetStyle( i );
877 [ + + + + : 918 : if( !pStyle || ( pStyle->GetFamily() != XML_STYLE_FAMILY_TEXT_TEXT &&
+ + ][ + + ]
[ + - ]
878 : 340 : pStyle->GetFamily() != XML_STYLE_FAMILY_TEXT_PARAGRAPH &&
879 : 225 : pStyle->GetFamily() != XML_STYLE_FAMILY_TABLE_CELL ) )
880 : 174 : continue;
881 : 179 : pStyle->CreateAndInsert( sal_False );
882 : : }
883 : 126 : }
884 : :
885 : 157 : void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite,
886 : : sal_Bool bFinish )
887 : : {
888 : : // pass 1: create text, paragraph and frame styles
889 : 157 : sal_uInt32 nCount = GetStyleCount();
890 : : sal_uInt32 i;
891 : :
892 [ + + ]: 2809 : for( i = 0; i < nCount; i++ )
893 : : {
894 : 2652 : SvXMLStyleContext *pStyle = GetStyle( i );
895 [ - + ]: 2652 : if( !pStyle )
896 : 0 : continue;
897 : :
898 [ + + ]: 2652 : if (pStyle->IsDefaultStyle())
899 : 360 : pStyle->SetDefaults();
900 [ + - ]: 2292 : else if( InsertStyleFamily( pStyle->GetFamily() ) )
901 : 2292 : pStyle->CreateAndInsert( bOverwrite );
902 : : }
903 : :
904 : : // pass 2: create list styles (they require char styles)
905 [ + + ]: 2809 : for( i=0; i<nCount; i++ )
906 : : {
907 : 2652 : SvXMLStyleContext *pStyle = GetStyle( i );
908 [ + + ][ + + ]: 2652 : if( !pStyle || pStyle->IsDefaultStyle())
[ + - ]
909 : 360 : continue;
910 : :
911 [ + - ]: 2292 : if( InsertStyleFamily( pStyle->GetFamily() ) )
912 : 2292 : pStyle->CreateAndInsertLate( bOverwrite );
913 : : }
914 : :
915 : : // pass3: finish creation of styles
916 [ + + ]: 157 : if( bFinish )
917 : 94 : FinishStyles( bOverwrite );
918 : 157 : }
919 : :
920 : 335 : void SvXMLStylesContext::FinishStyles( sal_Bool bOverwrite )
921 : : {
922 : 335 : sal_uInt32 nCount = GetStyleCount();
923 [ + + ]: 3543 : for( sal_uInt32 i=0; i<nCount; i++ )
924 : : {
925 : 3208 : SvXMLStyleContext *pStyle = GetStyle( i );
926 [ + - ][ + + ]: 3208 : if( !pStyle || !pStyle->IsValid() || pStyle->IsDefaultStyle() )
[ + + ][ + - ]
927 : 360 : continue;
928 : :
929 [ + - ]: 2848 : if( InsertStyleFamily( pStyle->GetFamily() ) )
930 : 2848 : pStyle->Finish( bOverwrite );
931 : : }
932 : 335 : }
933 : :
934 : :
935 : 12471 : const SvXMLStyleContext *SvXMLStylesContext::FindStyleChildContext(
936 : : sal_uInt16 nFamily,
937 : : const OUString& rName,
938 : : sal_Bool bCreateIndex ) const
939 : : {
940 : 12471 : return mpImpl->FindStyleChildContext( nFamily, rName, bCreateIndex );
941 : : }
942 : :
943 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|