Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : : #include <resourcemodel/ResourceModelHelper.hxx>
20 : : #include <StyleSheetTable.hxx>
21 : : #include <dmapper/DomainMapper.hxx>
22 : : #include <NumberingManager.hxx>
23 : : #include <ConversionHelper.hxx>
24 : : #include <TblStylePrHandler.hxx>
25 : : #include <BorderHandler.hxx>
26 : : #include <doctok/resourceids.hxx>
27 : : #include <ooxml/resourceids.hxx>
28 : : #include <vector>
29 : : #include <com/sun/star/beans/XMultiPropertySet.hpp>
30 : : #include <com/sun/star/beans/XPropertyState.hpp>
31 : : #include <com/sun/star/beans/PropertyValue.hpp>
32 : : #include <com/sun/star/container/XNameContainer.hpp>
33 : : #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
34 : : #include <com/sun/star/text/XTextDocument.hpp>
35 : : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
36 : : #include <com/sun/star/style/XStyle.hpp>
37 : : #include <com/sun/star/text/WritingMode.hpp>
38 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 : : #include <map>
40 : : #include <stdio.h>
41 : : #include <rtl/ustrbuf.hxx>
42 : :
43 : : #include <dmapperLoggers.hxx>
44 : :
45 : : using namespace ::com::sun::star;
46 : : namespace writerfilter {
47 : : namespace dmapper
48 : : {
49 : :
50 : : typedef ::std::map< OUString, OUString> StringPairMap_t;
51 : :
52 : :
53 : :
54 : 2197 : StyleSheetEntry::StyleSheetEntry() :
55 : : sStyleIdentifierI()
56 : : ,sStyleIdentifierD()
57 : : ,bIsDefaultStyle(false)
58 : : ,bInvalidHeight(false)
59 : : ,bHasUPE(false)
60 : : ,nStyleTypeCode(STYLE_TYPE_UNKNOWN)
61 : : ,sBaseStyleIdentifier()
62 : : ,sNextStyleIdentifier()
63 [ + - ][ + - ]: 2197 : ,pProperties(new StyleSheetPropertyMap)
[ + - ]
64 : : {
65 : : #if OSL_DEBUG_LEVEL > 1
66 : : nStyleTypeCode = STYLE_TYPE_PARA;
67 : : #endif
68 : 2197 : }
69 : :
70 [ + - ]: 2197 : StyleSheetEntry::~StyleSheetEntry()
71 : : {
72 [ - + ]: 4300 : }
73 : :
74 : 94 : TableStyleSheetEntry::TableStyleSheetEntry( StyleSheetEntry& rEntry, StyleSheetTable* pStyles ):
75 : : StyleSheetEntry( ),
76 [ + - ]: 94 : m_pStyleSheet( pStyles )
77 : : {
78 : :
79 : 94 : bIsDefaultStyle = rEntry.bIsDefaultStyle;
80 : 94 : bInvalidHeight = rEntry.bInvalidHeight;
81 : 94 : bHasUPE = rEntry.bHasUPE;
82 : 94 : nStyleTypeCode = STYLE_TYPE_TABLE;
83 : 94 : sBaseStyleIdentifier = rEntry.sBaseStyleIdentifier;
84 : 94 : sNextStyleIdentifier = rEntry.sNextStyleIdentifier;
85 : 94 : sStyleName = rEntry.sStyleName;
86 : 94 : sStyleName1 = rEntry.sStyleName1;
87 : :
88 : 94 : m_nColBandSize = 1;
89 : 94 : m_nRowBandSize = 1;
90 : 94 : }
91 : :
92 : 94 : TableStyleSheetEntry::~TableStyleSheetEntry( )
93 : : {
94 : 94 : m_pStyleSheet = NULL;
95 [ - + ]: 188 : }
96 : :
97 : 0 : void TableStyleSheetEntry::AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps )
98 : : {
99 : : static const TblStyleType pTypesToFix[] =
100 : : {
101 : : TBL_STYLE_FIRSTROW,
102 : : TBL_STYLE_LASTROW,
103 : : TBL_STYLE_FIRSTCOL,
104 : : TBL_STYLE_LASTCOL
105 : : };
106 : :
107 : : static const PropertyIds pPropsToCheck[] =
108 : : {
109 : : PROP_BOTTOM_BORDER,
110 : : PROP_TOP_BORDER,
111 : : PROP_RIGHT_BORDER,
112 : : PROP_LEFT_BORDER
113 : : };
114 : :
115 : 0 : int i = 0;
116 [ # # ]: 0 : while ( i < 4 )
117 : : {
118 [ # # ]: 0 : if ( nType == pTypesToFix[i] )
119 : : {
120 : 0 : PropertyIds nChecked = pPropsToCheck[i];
121 [ # # ]: 0 : PropertyMap::iterator pCheckedIt = pProps->find( PropertyDefinition( nChecked, false ) );
122 : :
123 [ # # ]: 0 : PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER;
124 [ # # ]: 0 : PropertyMap::iterator pInsideIt = pProps->find( PropertyDefinition( nInsideProp, false ) );
125 : :
126 : 0 : bool bHasChecked = pCheckedIt != pProps->end( );
127 : 0 : bool bHasInside = pInsideIt != pProps->end( );
128 : :
129 [ # # ][ # # ]: 0 : if ( bHasChecked && bHasInside )
130 : : {
131 : : // In this case, remove the inside border
132 [ # # ]: 0 : pProps->erase( pInsideIt );
133 : : }
134 : :
135 : 0 : i = 4; // Stop looping stupidly
136 : : }
137 : 0 : i++;
138 : : }
139 : :
140 : : // Append the tblStylePr
141 : 0 : m_aStyles[nType] = pProps;
142 : 0 : }
143 : :
144 : 0 : PropertyMapPtr TableStyleSheetEntry::GetProperties( sal_Int32 nMask, StyleSheetEntryDequePtr pStack )
145 : : {
146 [ # # ][ # # ]: 0 : PropertyMapPtr pProps( new PropertyMap );
[ # # ]
147 : :
148 : : // First get the parent properties
149 [ # # ]: 0 : StyleSheetEntryPtr pEntry = m_pStyleSheet->FindParentStyleSheet( sBaseStyleIdentifier );
150 : :
151 [ # # ]: 0 : if ( pEntry.get( ) )
152 : : {
153 [ # # ]: 0 : if (pStack.get() == NULL)
154 [ # # ][ # # ]: 0 : pStack.reset(new StyleSheetEntryDeque());
[ # # ]
155 : :
156 [ # # ]: 0 : StyleSheetEntryDeque::const_iterator aIt = find(pStack->begin(), pStack->end(), pEntry);
157 : :
158 [ # # ][ # # ]: 0 : if (aIt != pStack->end())
159 : : {
160 [ # # ]: 0 : pStack->push_back(pEntry);
161 : :
162 : 0 : TableStyleSheetEntry* pParent = static_cast<TableStyleSheetEntry *>( pEntry.get( ) );
163 [ # # ][ # # ]: 0 : pProps->insert( pParent->GetProperties( nMask ), pStack );
[ # # ][ # # ]
[ # # ]
164 : :
165 [ # # ]: 0 : pStack->pop_back();
166 : : }
167 : : }
168 : :
169 : : // And finally get the mask ones
170 [ # # ][ # # ]: 0 : pProps->insert( GetLocalPropertiesFromMask( nMask ) );
[ # # ]
171 : :
172 [ # # ]: 0 : return pProps;
173 : : }
174 : :
175 : 0 : void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleType nStyleId )
176 : : {
177 : : static const PropertyIds pPropsToCheck[] =
178 : : {
179 : : PROP_BOTTOM_BORDER,
180 : : PROP_TOP_BORDER,
181 : : PROP_RIGHT_BORDER,
182 : : PROP_LEFT_BORDER,
183 : : };
184 : :
185 : : bool pRemoveInside[] =
186 : : {
187 : : ( nStyleId == TBL_STYLE_FIRSTROW ),
188 : : ( nStyleId == TBL_STYLE_LASTROW ),
189 : : ( nStyleId == TBL_STYLE_LASTCOL ),
190 : : ( nStyleId == TBL_STYLE_FIRSTCOL )
191 : 0 : };
192 : :
193 [ # # ]: 0 : for ( unsigned i = 0 ; i != sizeof(pPropsToCheck) / sizeof(PropertyIds); i++ )
194 : : {
195 : 0 : PropertyIds nId = pPropsToCheck[i];
196 : 0 : PropertyDefinition aProp( nId, false );
197 [ # # ]: 0 : PropertyMap::iterator pIt = pToAdd->find( aProp );
198 : :
199 [ # # ]: 0 : if ( pIt != pToAdd->end( ) )
200 : : {
201 [ # # ]: 0 : PropertyMap::iterator pDestIt = pToFill->find( aProp );
202 : :
203 [ # # ]: 0 : if ( pRemoveInside[i] )
204 : : {
205 : : // Remove the insideH and insideV depending on the cell pos
206 [ # # ]: 0 : PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER;
207 [ # # ]: 0 : pDestIt = pToFill->find( PropertyDefinition( nInsideProp, false ) );
208 [ # # ]: 0 : if ( pDestIt != pToFill->end( ) )
209 [ # # ]: 0 : pToFill->erase( pDestIt );
210 : : }
211 : : }
212 : : }
213 : :
214 [ # # ][ # # ]: 0 : pToFill->insert( pToAdd );
[ # # ]
215 : 0 : }
216 : :
217 : 0 : PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( sal_Int32 nMask )
218 : : {
219 : : // Order from right to left
220 : : static const TblStyleType aBitsOrder[] =
221 : : {
222 : : TBL_STYLE_SWCELL,
223 : : TBL_STYLE_SECELL,
224 : : TBL_STYLE_NWCELL,
225 : : TBL_STYLE_NECELL,
226 : : TBL_STYLE_BAND2HORZ,
227 : : TBL_STYLE_BAND1HORZ,
228 : : TBL_STYLE_BAND2VERT,
229 : : TBL_STYLE_BAND1VERT,
230 : : TBL_STYLE_LASTCOL,
231 : : TBL_STYLE_FIRSTCOL,
232 : : TBL_STYLE_LASTROW,
233 : : TBL_STYLE_FIRSTROW,
234 : : TBL_STYLE_UNKNOWN
235 : : };
236 : :
237 : : // Get the properties applying according to the mask
238 [ # # ][ # # ]: 0 : PropertyMapPtr pProps( new PropertyMap( ) );
239 : 0 : short nBit = 0;
240 [ # # ]: 0 : do
241 : : {
242 : 0 : TblStyleType nStyleId = aBitsOrder[nBit];
243 [ # # ]: 0 : TblStylePrs::iterator pIt = m_aStyles.find( nStyleId );
244 : :
245 : 0 : short nTestBit = 1 << nBit;
246 : 0 : sal_Int32 nBitMask = sal_Int32( nTestBit );
247 [ # # ][ # # ]: 0 : if ( ( nMask & nBitMask ) && ( pIt != m_aStyles.end( ) ) )
[ # # ][ # # ]
248 [ # # ][ # # ]: 0 : lcl_mergeProps( pProps, pIt->second, nStyleId );
[ # # ][ # # ]
[ # # ]
249 : :
250 : 0 : nBit++;
251 : : }
252 : : while ( nBit < 13 );
253 : :
254 : 0 : return pProps;
255 : : }
256 : :
257 : :
258 : :
259 [ + - ]: 114 : struct ListCharStylePropertyMap_t
260 : : {
261 : : OUString sCharStyleName;
262 : : PropertyValueVector_t aPropertyValues;
263 : :
264 : 24 : ListCharStylePropertyMap_t(const OUString& rCharStyleName, const PropertyValueVector_t& rPropertyValues):
265 : : sCharStyleName( rCharStyleName ),
266 [ + - ]: 24 : aPropertyValues( rPropertyValues )
267 : 24 : {}
268 : : };
269 : : typedef std::vector< ListCharStylePropertyMap_t > ListCharStylePropertyVector_t;
270 : :
271 : :
272 [ + - ][ + - ]: 497 : struct StyleSheetTable_Impl
[ + - ][ + - ]
273 : : {
274 : : DomainMapper& m_rDMapper;
275 : : uno::Reference< text::XTextDocument> m_xTextDocument;
276 : : uno::Reference< beans::XPropertySet> m_xTextDefaults;
277 : : std::vector< StyleSheetEntryPtr > m_aStyleSheetEntries;
278 : : StyleSheetEntryPtr m_pCurrentEntry;
279 : : PropertyMapPtr m_pDefaultParaProps, m_pDefaultCharProps;
280 : : PropertyMapPtr m_pCurrentProps;
281 : : StringPairMap_t m_aStyleNameMap;
282 : : ListCharStylePropertyVector_t m_aListCharStylePropertyVector;
283 : :
284 : : StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument);
285 : :
286 : : OUString HasListCharStyle( const PropertyValueVector_t& rCharProperties );
287 : : };
288 : :
289 : :
290 : 497 : StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument ) :
291 : : m_rDMapper( rDMapper ),
292 : : m_xTextDocument( xTextDocument ),
293 : : m_pCurrentEntry(),
294 [ + - ]: 497 : m_pDefaultParaProps(new PropertyMap),
295 [ + - ][ + - ]: 994 : m_pDefaultCharProps(new PropertyMap)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
296 : : {
297 : : //set font height default to 10pt
298 [ + - ]: 497 : uno::Any aVal = uno::makeAny( double(10.) );
299 [ + - ]: 497 : m_pDefaultCharProps->Insert( PROP_CHAR_HEIGHT, true, aVal );
300 [ + - ]: 497 : m_pDefaultCharProps->Insert( PROP_CHAR_HEIGHT_ASIAN, true, aVal );
301 [ + - ]: 497 : m_pDefaultCharProps->Insert( PROP_CHAR_HEIGHT_COMPLEX, true, aVal );
302 : 497 : }
303 : :
304 : :
305 : 111 : OUString StyleSheetTable_Impl::HasListCharStyle( const PropertyValueVector_t& rPropValues )
306 : : {
307 : 111 : OUString sRet;
308 [ + - ]: 111 : ListCharStylePropertyVector_t::const_iterator aListVectorIter = m_aListCharStylePropertyVector.begin();
309 [ + - ][ + + ]: 354 : while( aListVectorIter != m_aListCharStylePropertyVector.end() )
310 : : {
311 : : //if size is identical
312 [ + + ]: 330 : if( aListVectorIter->aPropertyValues.size() == rPropValues.size() )
313 : : {
314 : 90 : bool bBreak = false;
315 : : //then search for all contained properties
316 : 90 : PropertyValueVector_t::const_iterator aList1Iter = rPropValues.begin();
317 [ + - ][ + + ]: 204 : while( aList1Iter != rPropValues.end() && !bBreak)
[ + + ][ + - ]
[ + + # # ]
318 : : {
319 : : //find the property
320 : 114 : bool bElementFound = false;
321 : 114 : PropertyValueVector_t::const_iterator aList2Iter = aListVectorIter->aPropertyValues.begin();
322 [ + - ][ + - ]: 171 : while( aList2Iter != aListVectorIter->aPropertyValues.end() && !bBreak )
[ + - ][ + - ]
[ + - # # ]
323 : : {
324 [ + + ]: 171 : if( aList2Iter->Name == aList1Iter->Name )
325 : : {
326 : 114 : bElementFound = true;
327 [ + + ]: 114 : if( aList2Iter->Value != aList1Iter->Value )
328 : 3 : bBreak = true;
329 : 114 : break;
330 : : }
331 : 57 : ++aList2Iter;
332 : : }
333 : : //set break flag if property hasn't been found
334 [ - + ]: 114 : if(!bElementFound )
335 : : {
336 : 0 : bBreak = true;
337 : : break;
338 : : }
339 : 114 : ++aList1Iter;
340 : : }
341 [ + + ]: 90 : if( !bBreak )
342 : 90 : return aListVectorIter->sCharStyleName;
343 : : }
344 : 243 : ++aListVectorIter;
345 : : }
346 : 111 : return sRet;
347 : : }
348 : :
349 : :
350 : 497 : StyleSheetTable::StyleSheetTable(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument)
351 : : : LoggedProperties(dmapper_logger, "StyleSheetTable")
352 : : , LoggedTable(dmapper_logger, "StyleSheetTable")
353 [ + - ][ + - ]: 497 : , m_pImpl( new StyleSheetTable_Impl(rDMapper, xTextDocument) )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
354 : : {
355 : 497 : }
356 : :
357 : :
358 [ + - ]: 497 : StyleSheetTable::~StyleSheetTable()
359 : : {
360 [ + - ][ + - ]: 497 : delete m_pImpl;
361 [ - + ]: 994 : }
362 : :
363 : :
364 : 6406 : void StyleSheetTable::lcl_attribute(Id Name, Value & val)
365 : : {
366 : : OSL_ENSURE( m_pImpl->m_pCurrentEntry, "current entry has to be set here");
367 [ + - ]: 6406 : if(!m_pImpl->m_pCurrentEntry)
368 : 6406 : return ;
369 [ + - ]: 6406 : int nIntValue = val.getInt();
370 : : (void)nIntValue;
371 [ + - ]: 6406 : OUString sValue = val.getString();
372 : :
373 [ + - + + : 6406 : switch(Name)
+ - - + -
+ + + + -
- + ]
374 : : {
375 : : case NS_rtf::LN_ISTD:
376 : 705 : m_pImpl->m_pCurrentEntry->sStyleIdentifierD = OUString::valueOf(static_cast<sal_Int32>(nIntValue), 16);
377 : 705 : break;
378 : : case NS_rtf::LN_STI:
379 : : {
380 : 0 : OUString tempStyleIdentifier = GetStyleIdFromIndex(static_cast<sal_uInt32>(nIntValue));
381 [ # # ]: 0 : if (!tempStyleIdentifier.isEmpty())
382 : 0 : m_pImpl->m_pCurrentEntry->sStyleIdentifierI = tempStyleIdentifier;
383 [ # # ][ # # ]: 0 : if (nIntValue == 0 || nIntValue == 65)
384 : 0 : m_pImpl->m_pCurrentEntry->bIsDefaultStyle = true;
385 : : }
386 : 0 : break;
387 : : case NS_rtf::LN_SGC:
388 : 705 : m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
389 : 705 : break;
390 : : case NS_rtf::LN_ISTDBASE:
391 [ + - ]: 534 : if (static_cast<sal_uInt32>(nIntValue) != 0xfff)
392 : 534 : m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier = OUString::valueOf(static_cast<sal_Int32>(nIntValue), 16);
393 : 534 : break;
394 : : case NS_rtf::LN_ISTDNEXT:
395 [ + - ]: 594 : if (static_cast<sal_uInt32>(nIntValue) != 0xfff)
396 : 594 : m_pImpl->m_pCurrentEntry->sNextStyleIdentifier = OUString::valueOf(static_cast<sal_Int32>(nIntValue), 16);
397 : 594 : break;
398 : : case NS_rtf::LN_FSCRATCH:
399 : : case NS_rtf::LN_FINVALHEIGHT:
400 : : case NS_rtf::LN_FHASUPE:
401 : : case NS_rtf::LN_FMASSCOPY:
402 : : case NS_rtf::LN_CUPX:
403 : : case NS_rtf::LN_BCHUPE:
404 : : case NS_rtf::LN_FAUTOREDEF:
405 : : case NS_rtf::LN_FHIDDEN:
406 : : case NS_rtf::LN_UNUSED8_3:
407 : : //noone seems to care about it
408 : 0 : break;
409 : : case NS_rtf::LN_XSTZNAME:
410 : 0 : m_pImpl->m_pCurrentEntry->sStyleName1 = sValue;
411 [ # # ]: 0 : if (!m_pImpl->m_pCurrentEntry->sStyleIdentifierI.isEmpty())
412 : 0 : m_pImpl->m_pCurrentEntry->sStyleIdentifierI = sValue;
413 : 0 : break;
414 : : case NS_rtf::LN_XSTZNAME1:
415 : 717 : m_pImpl->m_pCurrentEntry->sStyleName = sValue;
416 [ - + ]: 717 : if (!m_pImpl->m_pCurrentEntry->sStyleIdentifierI.isEmpty())
417 : 0 : m_pImpl->m_pCurrentEntry->sStyleIdentifierI = sValue;
418 : 717 : break;
419 : : case NS_rtf::LN_UPX:
420 [ # # ]: 0 : resolveAttributeProperties(val);
421 : 0 : break;
422 : : case NS_ooxml::LN_CT_Style_type:
423 : : {
424 : 1306 : StyleType nType = ( StyleType ) nIntValue;
425 [ + + ]: 1306 : if ( nType == STYLE_TYPE_TABLE )
426 : : {
427 [ + - ]: 94 : StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
428 [ + - ][ + - ]: 94 : TableStyleSheetEntryPtr pTableEntry( new TableStyleSheetEntry( *pEntry.get( ), this ) );
[ + - ]
429 [ + - ][ + - ]: 94 : m_pImpl->m_pCurrentEntry = pTableEntry;
[ + - ]
430 : : }
431 : : else
432 : 1212 : m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
433 : : }
434 : 1306 : break;
435 : : case NS_ooxml::LN_CT_Style_default:
436 : 323 : m_pImpl->m_pCurrentEntry->bIsDefaultStyle = (nIntValue != 0);
437 : 323 : break;
438 : : case NS_ooxml::LN_CT_Style_customStyle:
439 : 129 : break;
440 : : case NS_ooxml::LN_CT_Style_styleId:
441 : 1306 : m_pImpl->m_pCurrentEntry->sStyleIdentifierI = sValue;
442 : 1306 : m_pImpl->m_pCurrentEntry->sStyleIdentifierD = sValue;
443 : 1306 : break;
444 : : case NS_ooxml::LN_CT_TblWidth_w:
445 [ # # ]: 0 : dynamic_cast< StyleSheetPropertyMap* >( m_pImpl->m_pCurrentEntry->pProperties.get() )->SetCT_TblWidth_w( nIntValue );
446 : 0 : break;
447 : : case NS_ooxml::LN_CT_TblWidth_type:
448 [ # # ]: 0 : dynamic_cast< StyleSheetPropertyMap* >( m_pImpl->m_pCurrentEntry->pProperties.get() )->SetCT_TblWidth_type( nIntValue );
449 : 0 : break;
450 : : default:
451 : : {
452 : : #ifdef DEBUG_DOMAINMAPPER
453 : : dmapper_logger->element("unhandled");
454 : : #endif
455 : : }
456 : 87 : break;
457 : 6406 : }
458 : : }
459 : :
460 : :
461 : 9743 : void StyleSheetTable::lcl_sprm(Sprm & rSprm)
462 : : {
463 [ + - ]: 9743 : sal_uInt32 nSprmId = rSprm.getId();
464 [ + - ][ + - ]: 9743 : Value::Pointer_t pValue = rSprm.getValue();
465 [ + - ][ + - ]: 9743 : sal_Int32 nIntValue = pValue.get() ? pValue->getInt() : 0;
466 : : (void)nIntValue;
467 [ + - ][ + - ]: 9743 : OUString sStringValue = pValue.get() ? pValue->getString() : OUString();
468 : :
469 [ + + + + : 9743 : switch(nSprmId)
+ + + - -
- - - + ]
470 : : {
471 : : case NS_ooxml::LN_CT_Style_name:
472 : : //this is only a UI name!
473 : 1306 : m_pImpl->m_pCurrentEntry->sStyleName = sStringValue;
474 : 1306 : m_pImpl->m_pCurrentEntry->sStyleName1 = sStringValue;
475 : 1306 : break;
476 : : case NS_ooxml::LN_CT_Style_basedOn:
477 : 854 : m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier = sStringValue;
478 : 854 : break;
479 : : case NS_ooxml::LN_CT_Style_next:
480 : 762 : m_pImpl->m_pCurrentEntry->sNextStyleIdentifier = sStringValue;
481 : 762 : break;
482 : : case NS_ooxml::LN_CT_Style_aliases:
483 : : case NS_ooxml::LN_CT_Style_link:
484 : : case NS_ooxml::LN_CT_Style_autoRedefine:
485 : : case NS_ooxml::LN_CT_Style_hidden:
486 : : case NS_ooxml::LN_CT_Style_uiPriority:
487 : : case NS_ooxml::LN_CT_Style_semiHidden:
488 : : case NS_ooxml::LN_CT_Style_unhideWhenUsed:
489 : : case NS_ooxml::LN_CT_Style_qFormat:
490 : : case NS_ooxml::LN_CT_Style_locked:
491 : : case NS_ooxml::LN_CT_Style_personal:
492 : : case NS_ooxml::LN_CT_Style_personalCompose:
493 : : case NS_ooxml::LN_CT_Style_personalReply:
494 : : case NS_ooxml::LN_CT_Style_rsid:
495 : : case NS_ooxml::LN_CT_Style_trPr:
496 : : case NS_ooxml::LN_CT_Style_tcPr:
497 : 1774 : break;
498 : : case NS_ooxml::LN_CT_Style_tblPr: //contains table properties
499 : : case NS_ooxml::LN_CT_Style_tblStylePr: //contains to table properties
500 : : case NS_ooxml::LN_CT_TblPrBase_tblInd: //table properties - at least width value and type
501 : : case NS_ooxml::LN_EG_RPrBase_rFonts: //table fonts
502 : : {
503 [ + - ]: 94 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
504 [ + - ]: 94 : if( pProperties.get())
505 : : {
506 [ + - ][ + - ]: 94 : TblStylePrHandlerPtr pTblStylePrHandler( new TblStylePrHandler( m_pImpl->m_rDMapper ) );
[ + - ]
507 [ + - ]: 94 : pProperties->resolve( *pTblStylePrHandler );
508 : :
509 : : // Add the properties to the table style
510 : 94 : TblStyleType nType = pTblStylePrHandler->getType( );
511 [ + - ]: 94 : PropertyMapPtr pProps = pTblStylePrHandler->getProperties( );
512 : 94 : StyleSheetEntry * pEntry = m_pImpl->m_pCurrentEntry.get();
513 : :
514 [ + - ]: 94 : if (nType == TBL_STYLE_UNKNOWN)
515 : : {
516 [ + - ][ + - ]: 94 : pEntry->pProperties->insert(pProps);
[ + - ]
517 : : }
518 : : else
519 : : {
520 [ # # ]: 0 : TableStyleSheetEntry * pTableEntry = dynamic_cast<TableStyleSheetEntry*>( pEntry );
521 [ # # ]: 0 : if (pTableEntry != NULL)
522 [ # # ][ # # ]: 0 : pTableEntry->AddTblStylePr( nType, pProps );
[ # # ]
523 [ + - ][ + - ]: 94 : }
524 : : }
525 [ + - ]: 94 : break;
526 : : }
527 : : case NS_ooxml::LN_CT_PPrDefault_pPr:
528 : : case NS_ooxml::LN_CT_DocDefaults_pPrDefault:
529 [ + - ][ + - ]: 80 : m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pDefaultParaProps );
[ + - ]
530 [ + - ]: 80 : resourcemodel::resolveSprmProps( m_pImpl->m_rDMapper, rSprm );
531 [ + - ]: 80 : m_pImpl->m_rDMapper.PopStyleSheetProperties();
532 [ + - ]: 80 : applyDefaults( true );
533 : 80 : break;
534 : : case NS_ooxml::LN_CT_RPrDefault_rPr:
535 : : case NS_ooxml::LN_CT_DocDefaults_rPrDefault:
536 [ + - ][ + - ]: 80 : m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pDefaultCharProps );
[ + - ]
537 [ + - ]: 80 : resourcemodel::resolveSprmProps( m_pImpl->m_rDMapper, rSprm );
538 [ + - ]: 80 : m_pImpl->m_rDMapper.PopStyleSheetProperties();
539 [ + - ]: 80 : applyDefaults( false );
540 : 80 : break;
541 : : case NS_ooxml::LN_CT_TblPrBase_jc: //table alignment - row properties!
542 : 0 : m_pImpl->m_pCurrentEntry->pProperties->Insert( PROP_HORI_ORIENT, false,
543 [ # # ]: 0 : uno::makeAny( ConversionHelper::convertTableJustification( nIntValue )));
[ # # # # ]
544 : 0 : break;
545 : : case NS_ooxml::LN_CT_TrPrBase_jc: //table alignment - row properties!
546 [ # # ]: 0 : dynamic_cast< StyleSheetPropertyMap* >( m_pImpl->m_pCurrentEntry->pProperties.get() )->SetCT_TrPrBase_jc(nIntValue);
547 : 0 : break;
548 : : case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style
549 : : {
550 [ # # ]: 0 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
551 [ # # ]: 0 : if( pProperties.get())
552 : : {
553 [ # # ][ # # ]: 0 : BorderHandlerPtr pBorderHandler( new BorderHandler(m_pImpl->m_rDMapper.IsOOXMLImport()) );
[ # # ][ # # ]
554 [ # # ]: 0 : pProperties->resolve(*pBorderHandler);
555 [ # # ][ # # ]: 0 : m_pImpl->m_pCurrentEntry->pProperties->insert( pBorderHandler->getProperties(), true );
[ # # ][ # # ]
556 [ # # ]: 0 : }
557 : : }
558 : 0 : break;
559 : : case NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize:
560 : : case NS_ooxml::LN_CT_TblPrBase_tblStyleColBandSize:
561 : : {
562 : 0 : StyleSheetEntry* pEntry = m_pImpl->m_pCurrentEntry.get( );
563 : 0 : TableStyleSheetEntry *pTEntry = static_cast<TableStyleSheetEntry*>( pEntry );
564 [ # # ]: 0 : if ( pTEntry )
565 : : {
566 [ # # ]: 0 : if ( nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize )
567 : 0 : pTEntry->m_nRowBandSize = nIntValue;
568 : : else
569 : 0 : pTEntry->m_nColBandSize = nIntValue;
570 : : }
571 : : }
572 : 0 : break;
573 : : case NS_ooxml::LN_CT_TblPrBase_tblCellMar:
574 : : //no cell margins in styles
575 : 0 : break;
576 : : case NS_ooxml::LN_CT_Style_pPr:
577 : : // no break
578 : : case NS_ooxml::LN_CT_Style_rPr:
579 : : // no break
580 : : default:
581 : : {
582 [ + - ]: 4793 : if (!m_pImpl->m_pCurrentEntry)
583 : : break;
584 : :
585 [ + - ][ + - ]: 4793 : TablePropertiesHandlerPtr pTblHandler( new TablePropertiesHandler( true ) );
[ + - ]
586 [ + - ][ + - ]: 4793 : pTblHandler->SetProperties( m_pImpl->m_pCurrentEntry->pProperties );
[ + - ]
587 [ + - ][ + - ]: 4793 : if ( !pTblHandler->sprm( rSprm ) )
588 : : {
589 [ + - ][ + - ]: 4793 : m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pCurrentEntry->pProperties );
[ + - ]
590 : :
591 [ + - ][ + - ]: 4793 : PropertyMapPtr pProps(new PropertyMap());
[ + - ]
592 [ + - ][ + - ]: 4793 : m_pImpl->m_rDMapper.sprmWithProps( rSprm, pProps );
[ + - ]
593 : :
594 [ + - ][ + - ]: 4793 : m_pImpl->m_pCurrentEntry->pProperties->insert(pProps);
[ + - ]
595 : :
596 [ + - ][ + - ]: 4793 : m_pImpl->m_rDMapper.PopStyleSheetProperties( );
597 [ + - ]: 4793 : }
598 : : }
599 : 4793 : break;
600 [ + - ]: 9743 : }
601 : 9743 : }
602 : :
603 : :
604 : 2103 : void StyleSheetTable::lcl_entry(int /*pos*/, writerfilter::Reference<Properties>::Pointer_t ref)
605 : : {
606 : : //create a new style entry
607 : : OSL_ENSURE( !m_pImpl->m_pCurrentEntry, "current entry has to be NULL here");
608 [ + - ][ + - ]: 2103 : StyleSheetEntryPtr pNewEntry( new StyleSheetEntry );
[ + - ]
609 [ + - ]: 2103 : m_pImpl->m_pCurrentEntry = pNewEntry;
610 [ + - ][ + - ]: 2103 : m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pCurrentEntry->pProperties );
[ + - ]
611 [ + - ]: 2103 : ref->resolve(*this);
612 : : //append it to the table
613 [ + - ]: 2103 : m_pImpl->m_rDMapper.PopStyleSheetProperties();
614 [ + - ][ + + ]: 2103 : if( !m_pImpl->m_rDMapper.IsOOXMLImport() || !m_pImpl->m_pCurrentEntry->sStyleName.isEmpty())
[ + + ][ + + ]
615 : : {
616 [ + - ]: 2023 : m_pImpl->m_pCurrentEntry->sConvertedStyleName = ConvertStyleName( m_pImpl->m_pCurrentEntry->sStyleName );
617 [ + - ]: 2023 : m_pImpl->m_aStyleSheetEntries.push_back( m_pImpl->m_pCurrentEntry );
618 : : }
619 : : else
620 : : {
621 : : //TODO: this entry contains the default settings - they have to be added to the settings
622 : : }
623 : :
624 [ + - ]: 2103 : StyleSheetEntryPtr pEmptyEntry;
625 [ + - ][ + - ]: 2103 : m_pImpl->m_pCurrentEntry = pEmptyEntry;
[ + - ]
626 : 2103 : }
627 : : /*-------------------------------------------------------------------------
628 : : sorting helper
629 : : -----------------------------------------------------------------------*/
630 : : typedef std::vector< beans::PropertyValue > _PropValVector;
631 : 1511 : class PropValVector : public _PropValVector
632 : : {
633 : : public:
634 : 1511 : PropValVector(){}
635 : :
636 : : void Insert( beans::PropertyValue aVal );
637 : : uno::Sequence< uno::Any > getValues();
638 : : uno::Sequence< OUString > getNames();
639 : : };
640 : 13389 : void PropValVector::Insert( beans::PropertyValue aVal )
641 : : {
642 : 13389 : _PropValVector::iterator aIt = begin();
643 [ + - ][ + + ]: 82146 : while(aIt != end())
644 : : {
645 [ + + ]: 70250 : if(aIt->Name > aVal.Name)
646 : : {
647 [ + - ]: 1493 : insert( aIt, aVal );
648 : 13389 : return;
649 : : }
650 : 68757 : ++aIt;
651 : : }
652 [ + - ]: 11896 : push_back( aVal );
653 : : }
654 : 1511 : uno::Sequence< uno::Any > PropValVector::getValues()
655 : : {
656 [ + - ]: 1511 : uno::Sequence< uno::Any > aRet( size() );
657 [ + - ]: 1511 : uno::Any* pValues = aRet.getArray();
658 : 1511 : sal_Int32 nVal = 0;
659 : 1511 : _PropValVector::iterator aIt = begin();
660 [ + - ][ + + ]: 14900 : while(aIt != end())
661 : : {
662 : 13389 : pValues[nVal++] = aIt->Value;
663 : 13389 : ++aIt;
664 : : }
665 : 1511 : return aRet;
666 : : }
667 : 1511 : uno::Sequence< OUString > PropValVector::getNames()
668 : : {
669 [ + - ]: 1511 : uno::Sequence< OUString > aRet( size() );
670 [ + - ]: 1511 : OUString* pNames = aRet.getArray();
671 : 1511 : sal_Int32 nVal = 0;
672 : 1511 : _PropValVector::iterator aIt = begin();
673 [ + - ][ + + ]: 14900 : while(aIt != end())
674 : : {
675 : 13389 : pNames[nVal++] = aIt->Name;
676 : 13389 : ++aIt;
677 : : }
678 : 1511 : return aRet;
679 : : }
680 : :
681 : :
682 : 305 : void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
683 : : {
684 : : try
685 : : {
686 [ + + ]: 305 : uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier( m_pImpl->m_xTextDocument, uno::UNO_QUERY_THROW );
687 [ + - ]: 287 : uno::Reference< lang::XMultiServiceFactory > xDocFactory( m_pImpl->m_xTextDocument, uno::UNO_QUERY_THROW );
688 [ + - ][ + - ]: 287 : uno::Reference< container::XNameAccess > xStyleFamilies = xStylesSupplier->getStyleFamilies();
689 : 287 : uno::Reference<container::XNameContainer> xCharStyles;
690 : 287 : uno::Reference<container::XNameContainer> xParaStyles;
691 : :
692 [ + - ]: 287 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
693 [ + - ][ + - ]: 287 : xStyleFamilies->getByName(rPropNameSupplier.GetName( PROP_CHARACTER_STYLES )) >>= xCharStyles;
[ + - ][ + - ]
694 [ + - ][ + - ]: 287 : xStyleFamilies->getByName(rPropNameSupplier.GetName( PROP_PARAGRAPH_STYLES )) >>= xParaStyles;
[ + - ][ + - ]
695 [ + - ][ + - ]: 287 : if(xCharStyles.is() && xParaStyles.is())
[ + - ]
696 : : {
697 : 287 : std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
698 [ + - ][ + + ]: 2079 : while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
699 : : {
700 [ + - ]: 1792 : StyleSheetEntryPtr pEntry = *aIt;
701 [ + + ][ + + ]: 1792 : if( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR || pEntry->nStyleTypeCode == STYLE_TYPE_PARA )
[ + + ]
702 : : {
703 : 1612 : bool bParaStyle = pEntry->nStyleTypeCode == STYLE_TYPE_PARA;
704 : 1612 : bool bInsert = false;
705 [ + + ]: 1612 : uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : xCharStyles;
706 : 1612 : uno::Reference< style::XStyle > xStyle;
707 [ + - ]: 1612 : OUString sConvertedStyleName = ConvertStyleName( pEntry->sStyleName );
708 [ + - ][ + - ]: 1612 : if(xStyles->hasByName( sConvertedStyleName ))
[ + + ]
709 [ + - ][ + - ]: 1319 : xStyles->getByName( sConvertedStyleName ) >>= xStyle;
[ + - ]
710 : : else
711 : : {
712 : 293 : bInsert = true;
713 [ + - ]: 293 : xStyle = uno::Reference< style::XStyle >(xDocFactory->createInstance(
714 : : bParaStyle ?
715 : : rPropNameSupplier.GetName( PROP_SERVICE_PARA_STYLE ) :
716 : 293 : rPropNameSupplier.GetName( PROP_SERVICE_CHAR_STYLE )),
717 [ + + ][ + - ]: 293 : uno::UNO_QUERY_THROW);
[ + - ][ + - ]
[ + - ][ + - ]
718 : : }
719 [ + + ]: 1612 : if( !pEntry->sBaseStyleIdentifier.isEmpty() )
720 : : {
721 : : try
722 : : {
723 : : //TODO: Handle cases where a paragraph <> character style relation is needed
724 [ + - ]: 1233 : StyleSheetEntryPtr pParent = FindStyleSheetByISTD( pEntry->sBaseStyleIdentifier );
725 [ + + ]: 1233 : if (pParent.get() != NULL)
726 [ + - ][ + - ]: 1233 : xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName ));
[ + - ][ + - ]
[ # # ]
727 : : }
728 [ # # ]: 0 : catch( const uno::RuntimeException& )
729 : : {
730 : : OSL_FAIL( "Styles parent could not be set");
731 : : }
732 : : }
733 [ + + ]: 379 : else if( bParaStyle )
734 : : {
735 : : //now it's time to set the default parameters - for paragraph styles
736 : : //Fonts: Western first entry in font table
737 : : //CJK: second entry
738 : : //CTL: third entry, if it exists
739 : :
740 [ + - ]: 281 : sal_uInt32 nFontCount = rFontTable->size();
741 [ + - ][ + + ]: 281 : if( !m_pImpl->m_rDMapper.IsOOXMLImport() && nFontCount > 2 )
[ + + ][ + + ]
742 : : {
743 [ + - ]: 78 : uno::Any aTwoHundredFortyTwip = uno::makeAny(12.);
744 : : // font size to 240 twip (12 pts) for all if not set
745 [ + - ]: 78 : pEntry->pProperties->Insert(PROP_CHAR_HEIGHT, true, aTwoHundredFortyTwip, false);
746 : : // western font not already set -> apply first font
747 [ + - ]: 78 : const FontEntry::Pointer_t pWesternFontEntry(rFontTable->getFontEntry( 0 ));
748 : 78 : OUString sWesternFontName = pWesternFontEntry->sFontName;
749 [ + - ][ + - ]: 78 : pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( sWesternFontName ), false);
750 : :
751 : : // CJK ... apply second font
752 [ + - ]: 78 : const FontEntry::Pointer_t pCJKFontEntry(rFontTable->getFontEntry( 2 ));
753 [ + - ][ + - ]: 78 : pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME_ASIAN, true, uno::makeAny( pCJKFontEntry->sFontName ), false);
754 [ + - ]: 78 : pEntry->pProperties->Insert(PROP_CHAR_HEIGHT_ASIAN, true, aTwoHundredFortyTwip, false);
755 : : // CTL ... apply third font, if available
756 [ + - ]: 78 : if( nFontCount > 3 )
757 : : {
758 [ + - ]: 78 : const FontEntry::Pointer_t pCTLFontEntry(rFontTable->getFontEntry( 3 ));
759 [ + - ][ + - ]: 78 : pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME_COMPLEX, true, uno::makeAny( pCTLFontEntry->sFontName ), false);
760 [ + - ][ + - ]: 78 : pEntry->pProperties->Insert(PROP_CHAR_HEIGHT_COMPLEX, true, aTwoHundredFortyTwip, false);
761 [ + - ][ + - ]: 78 : }
762 : : }
763 : : // Widow/Orphan -> set both to two if not already set
764 [ + - ]: 281 : uno::Any aTwo = uno::makeAny(sal_Int8(2));
765 [ + - ]: 281 : pEntry->pProperties->Insert(PROP_PARA_WIDOWS, true, aTwo, false);
766 [ + - ]: 281 : pEntry->pProperties->Insert(PROP_PARA_ORPHANS, true, aTwo, false);
767 : : // Left-to-right direction if not already set
768 [ + - ][ + - ]: 281 : pEntry->pProperties->Insert(PROP_WRITING_MODE, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
769 : : // font color COL_AUTO if not already set
770 [ + - ][ + - ]: 281 : pEntry->pProperties->Insert(PROP_CHAR_COLOR, true, uno::makeAny( sal_Int32(0xffffffff) ), false);
771 : : }
772 : :
773 [ + - ]: 1612 : uno::Sequence< beans::PropertyValue > aPropValues = pEntry->pProperties->GetPropertyValues();
774 : 1612 : bool bAddFollowStyle = false;
775 [ + + ][ + + ]: 1612 : if(bParaStyle && pEntry->sNextStyleIdentifier.isEmpty() )
[ + + ]
776 : : {
777 : 188 : bAddFollowStyle = true;
778 : : }
779 : : //remove Left/RightMargin values from TOX heading styles
780 [ + + ]: 1612 : if( bParaStyle )
781 : : {
782 : : // Set the outline levels
783 [ + - ][ - + ]: 1394 : const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
784 [ + - ]: 1394 : if ( pStyleSheetProperties )
785 : : {
786 [ + - ]: 1394 : aPropValues.realloc( aPropValues.getLength( ) + 1 );
787 : :
788 [ + - ]: 1394 : beans::PropertyValue aLvlVal( rPropNameSupplier.GetName( PROP_OUTLINE_LEVEL ), 0,
789 : 1394 : uno::makeAny( sal_Int16( pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ),
790 [ + - ]: 2788 : beans::PropertyState_DIRECT_VALUE );
791 [ + - ]: 1394 : aPropValues[ aPropValues.getLength( ) - 1 ] = aLvlVal;
792 : :
793 [ + + ]: 1394 : if ( pStyleSheetProperties->GetOutlineLevel( ) == 0 )
794 : : {
795 [ + - ]: 15 : aPropValues.realloc( aPropValues.getLength( ) + 1 );
796 [ + - ]: 15 : beans::PropertyValue aStyleVal( rPropNameSupplier.GetName( PROP_NUMBERING_STYLE_NAME ), 0,
797 : : uno::makeAny( OUString() ),
798 [ + - ]: 30 : beans::PropertyState_DIRECT_VALUE );
799 [ + - ]: 15 : aPropValues[ aPropValues.getLength( ) - 1 ] = aStyleVal;
800 : 1394 : }
801 : : }
802 : :
803 [ + - ]: 1394 : uno::Reference< beans::XPropertyState >xState( xStyle, uno::UNO_QUERY_THROW );
804 [ + - + - : 4182 : if( sConvertedStyleName == "Contents Heading" ||
- + ][ - + ]
805 : 1394 : sConvertedStyleName == "User Index Heading" ||
806 : 1394 : sConvertedStyleName == "Index Heading" )
807 : : {
808 : : //left margin is set to NULL by default
809 [ # # ]: 0 : uno::Reference< beans::XPropertyState >xState1( xStyle, uno::UNO_QUERY_THROW );
810 [ # # ][ # # ]: 0 : xState1->setPropertyToDefault(rPropNameSupplier.GetName( PROP_PARA_LEFT_MARGIN ));
[ # # ]
811 : : }
812 [ + + ]: 1394 : else if ( sConvertedStyleName == "Text body" )
813 [ + - ][ + - ]: 195 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_PARA_BOTTOM_MARGIN ));
[ + - ]
814 [ + + + + : 10536 : else if( sConvertedStyleName == "Heading 1" ||
+ + + + +
+ + + + +
+ + + + ]
[ + + ]
815 : 1187 : sConvertedStyleName == "Heading 2" ||
816 : 1178 : sConvertedStyleName == "Heading 3" ||
817 : 1172 : sConvertedStyleName == "Heading 4" ||
818 : 1166 : sConvertedStyleName == "Heading 5" ||
819 : 1163 : sConvertedStyleName == "Heading 6" ||
820 : 1160 : sConvertedStyleName == "Heading 7" ||
821 : 1157 : sConvertedStyleName == "Heading 8" ||
822 : 1154 : sConvertedStyleName == "Heading 9" )
823 : : {
824 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_WEIGHT ));
[ + - ]
825 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_WEIGHT_ASIAN ));
[ + - ]
826 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_WEIGHT_COMPLEX ));
[ + - ]
827 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_POSTURE ));
[ + - ]
828 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_POSTURE_ASIAN ));
[ + - ]
829 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_POSTURE_COMPLEX ));
[ + - ]
830 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_PROP_HEIGHT ));
[ + - ]
831 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_PROP_HEIGHT_ASIAN ));
[ + - ]
832 [ + - ][ + - ]: 48 : xState->setPropertyToDefault(rPropNameSupplier.GetName( PROP_CHAR_PROP_HEIGHT_COMPLEX));
[ + - ]
833 : :
834 : 1394 : }
835 : : }
836 : :
837 [ + + ][ + + ]: 1612 : if(bAddFollowStyle || aPropValues.getLength())
[ + + ]
838 : : {
839 [ + - ]: 1511 : PropValVector aSortedPropVals;
840 [ + + ]: 14900 : for( sal_Int32 nProp = 0; nProp < aPropValues.getLength(); ++nProp)
841 : : {
842 : : // Don't add the style name properties
843 [ + - ]: 13389 : bool bIsParaStyleName = aPropValues[nProp].Name == "ParaStyleName";
844 [ + - ]: 13389 : bool bIsCharStyleName = aPropValues[nProp].Name == "CharStyleName";
845 [ + - ][ + - ]: 13389 : if ( !bIsParaStyleName && !bIsCharStyleName )
846 : : {
847 [ + - ][ + - ]: 13389 : aSortedPropVals.Insert( aPropValues[nProp] );
848 : : }
849 : : }
850 [ + + ]: 1511 : if(bAddFollowStyle)
851 : : {
852 : : //find the name of the Next style
853 : 188 : std::vector< StyleSheetEntryPtr >::iterator aNextStyleIt = m_pImpl->m_aStyleSheetEntries.begin();
854 [ + - ][ + + ]: 2280 : for( ; aNextStyleIt != m_pImpl->m_aStyleSheetEntries.end(); ++aNextStyleIt )
855 : : {
856 [ + - - + ]: 4184 : if( !( *aNextStyleIt )->sStyleName.isEmpty() &&
[ - + ]
857 : 2092 : ( *aNextStyleIt )->sStyleName == pEntry->sNextStyleIdentifier)
858 : : {
859 : 0 : beans::PropertyValue aNew;
860 : 0 : aNew.Name = "FollowStyle";
861 [ # # ][ # # ]: 0 : aNew.Value = uno::makeAny(ConvertStyleName( ( *aNextStyleIt )->sStyleIdentifierD ));
862 [ # # ]: 0 : aSortedPropVals.Insert( aNew );
863 : 0 : break;
864 : : }
865 : : }
866 : : }
867 : :
868 : : try
869 : : {
870 [ + - ]: 1511 : uno::Reference< beans::XMultiPropertySet > xMultiPropertySet( xStyle, uno::UNO_QUERY_THROW);
871 [ + - ][ + - ]: 1511 : xMultiPropertySet->setPropertyValues( aSortedPropVals.getNames(), aSortedPropVals.getValues() );
[ + - ][ + - ]
[ + - ][ + - ]
[ # # # ]
872 : : }
873 [ # # ]: 0 : catch( const lang::WrappedTargetException& rWrapped)
874 : : {
875 : : (void) rWrapped;
876 : 0 : OString aMessage("Some style properties could not be set");
877 : : #if OSL_DEBUG_LEVEL > 0
878 : : beans::UnknownPropertyException aUnknownPropertyException;
879 : :
880 : : if( rWrapped.TargetException >>= aUnknownPropertyException )
881 : : {
882 : : aMessage += ": ";
883 : : OString sTemp;
884 : : aUnknownPropertyException.Message.convertToString(&sTemp, RTL_TEXTENCODING_ASCII_US, 0 );
885 : : aMessage += sTemp;
886 : : }
887 : : #endif
888 : 0 : SAL_WARN("writerfilter", aMessage.getStr());
889 : : }
890 [ # # ]: 0 : catch( const uno::Exception& rEx)
891 : : {
892 : : (void) rEx;
893 : : OSL_FAIL( "Some style properties could not be set");
894 : 1511 : }
895 : : }
896 [ + + ]: 1612 : if(bInsert)
897 : : {
898 [ + - ][ + - ]: 293 : xStyles->insertByName( sConvertedStyleName, uno::makeAny( xStyle) );
[ + - ]
899 [ + - ]: 1612 : }
900 : : }
901 : 1792 : ++aIt;
902 [ + - ]: 1792 : }
903 [ - + ]: 305 : }
904 : : }
905 : 18 : catch( const uno::Exception& )
906 : : {
907 : : OSL_FAIL( "Styles could not be imported completely");
908 : : }
909 : 305 : }
910 : :
911 : :
912 : 2783 : const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByISTD(const OUString& sIndex)
913 : : {
914 : 2783 : StyleSheetEntryPtr pRet;
915 [ + + ]: 10152 : for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
916 : : {
917 [ + + ]: 9457 : if( m_pImpl->m_aStyleSheetEntries[nPos]->sStyleIdentifierD == sIndex)
918 : : {
919 [ + - ]: 2088 : pRet = m_pImpl->m_aStyleSheetEntries[nPos];
920 : 2088 : break;
921 : : }
922 : : }
923 : 2783 : return pRet;
924 : : }
925 : :
926 : :
927 : 21 : const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByStyleName(const OUString& sIndex)
928 : : {
929 : 21 : StyleSheetEntryPtr pRet;
930 [ + + ]: 156 : for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
931 : : {
932 [ + + ]: 144 : if( m_pImpl->m_aStyleSheetEntries[nPos]->sStyleName == sIndex)
933 : : {
934 [ + - ]: 9 : pRet = m_pImpl->m_aStyleSheetEntries[nPos];
935 : 9 : break;
936 : : }
937 : : }
938 : 21 : return pRet;
939 : : }
940 : :
941 : :
942 : 15 : const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByConvertedStyleName(const OUString& sIndex)
943 : : {
944 : 15 : StyleSheetEntryPtr pRet;
945 [ - + ]: 15 : for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
946 : : {
947 [ # # ]: 0 : if( m_pImpl->m_aStyleSheetEntries[nPos]->sConvertedStyleName == sIndex)
948 : : {
949 [ # # ]: 0 : pRet = m_pImpl->m_aStyleSheetEntries[nPos];
950 : 0 : break;
951 : : }
952 : : }
953 : 15 : return pRet;
954 : : }
955 : :
956 : :
957 : :
958 : 15 : const StyleSheetEntryPtr StyleSheetTable::FindParentStyleSheet(OUString sBaseStyle)
959 : : {
960 [ + + ]: 15 : if( sBaseStyle.isEmpty() )
961 : : {
962 [ + - ]: 6 : StyleSheetEntryPtr pEmptyPtr;
963 [ + - ][ + - ]: 6 : return pEmptyPtr;
964 : : }
965 [ - + ]: 9 : if( m_pImpl->m_pCurrentEntry)
966 : 0 : sBaseStyle = m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier;
967 : :
968 : 15 : return FindStyleSheetByISTD( sBaseStyle );
969 : : }
970 : :
971 : :
972 : : static const sal_Char* const aStyleNamePairs[] =
973 : : {
974 : : "Normal", "Standard",
975 : : "heading 1", "Heading 1",
976 : : "heading 2", "Heading 2",
977 : : "heading 3", "Heading 3",
978 : : "heading 4", "Heading 4",
979 : : "heading 5", "Heading 5",
980 : : "heading 6", "Heading 6",
981 : : "heading 7", "Heading 7",
982 : : "heading 8", "Heading 8",
983 : : "heading 9", "Heading 9",
984 : : "Heading1", "Heading 1",
985 : : "Heading2", "Heading 2",
986 : : "Heading3", "Heading 3",
987 : : "Heading4", "Heading 4",
988 : : "Heading5", "Heading 5",
989 : : "Heading6", "Heading 6",
990 : : "Heading7", "Heading 7",
991 : : "Heading8", "Heading 8",
992 : : "Heading9", "Heading 9",
993 : : "Heading 1", "Heading 1",
994 : : "Heading 2", "Heading 2",
995 : : "Heading 3", "Heading 3",
996 : : "Heading 4", "Heading 4",
997 : : "Heading 5", "Heading 5",
998 : : "Heading 6", "Heading 6",
999 : : "Heading 7", "Heading 7",
1000 : : "Heading 8", "Heading 8",
1001 : : "Heading 9", "Heading 9",
1002 : : "Index 1", "Index 1",
1003 : : "Index 2", "Index 2",
1004 : : "Index 3", "Index 3",
1005 : : "Index 4", "",
1006 : : "Index 5", "",
1007 : : "Index 6", "",
1008 : : "Index 7", "",
1009 : : "Index 8", "",
1010 : : "Index 9", "",
1011 : : "TOC 1", "Contents 1",
1012 : : "TOC 2", "Contents 2",
1013 : : "TOC 3", "Contents 3",
1014 : : "TOC 4", "Contents 4",
1015 : : "TOC 5", "Contents 5",
1016 : : "TOC 6", "Contents 6",
1017 : : "TOC 7", "Contents 7",
1018 : : "TOC 8", "Contents 8",
1019 : : "TOC 9", "Contents 9",
1020 : : "TOC Heading", "Contents Heading",
1021 : : "TOCHeading", "Contents Heading",
1022 : : "toc 1", "Contents 1",
1023 : : "toc 2", "Contents 2",
1024 : : "toc 3", "Contents 3",
1025 : : "toc 4", "Contents 4",
1026 : : "toc 5", "Contents 5",
1027 : : "toc 6", "Contents 6",
1028 : : "toc 7", "Contents 7",
1029 : : "toc 8", "Contents 8",
1030 : : "toc 9", "Contents 9",
1031 : : "TOC1", "Contents 1",
1032 : : "TOC2", "Contents 2",
1033 : : "TOC3", "Contents 3",
1034 : : "TOC4", "Contents 4",
1035 : : "TOC5", "Contents 5",
1036 : : "TOC6", "Contents 6",
1037 : : "TOC7", "Contents 7",
1038 : : "TOC8", "Contents 8",
1039 : : "TOC9", "Contents 9",
1040 : : "Normal Indent", "",
1041 : : "Footnote Text", "Footnote",
1042 : : "Annotation Text", "",
1043 : : "Header", "Header",
1044 : : "header", "Header",
1045 : : "Footer", "Footer",
1046 : : "footer", "Footer",
1047 : : "Index Heading", "Index Heading",
1048 : : "Caption", "",
1049 : : "Table of Figures", "",
1050 : : "Envelope Address", "Addressee",
1051 : : "Envelope Return", "Sender",
1052 : : "Footnote Reference", "Footnote anchor",
1053 : : "Annotation Reference", "",
1054 : : "Line Number", "Line numbering",
1055 : : "Page Number", "Page Number",
1056 : : "Endnote Reference", "Endnote anchor",
1057 : : "Endnote Text", "Endnote Symbol",
1058 : : "Table of Authorities", "",
1059 : : "Macro Text", "",
1060 : : "TOA Heading", "",
1061 : : "List", "List",
1062 : : "List 2", "",
1063 : : "List 3", "",
1064 : : "List 4", "",
1065 : : "List 5", "",
1066 : : "List Bullet", "",
1067 : : "List Bullet 2", "",
1068 : : "List Bullet 3", "",
1069 : : "List Bullet 4", "",
1070 : : "List Bullet 5", "",
1071 : : "List Number", "",
1072 : : "List Number 2", "",
1073 : : "List Number 3", "",
1074 : : "List Number 4", "",
1075 : : "List Number 5", "",
1076 : : "Title", "Title",
1077 : : "Closing", "",
1078 : : "Signature", "Signature",
1079 : : "Default Paragraph Font", "",
1080 : : "DefaultParagraphFont", "Default Paragraph Font",
1081 : : "Body Text", "Text body",
1082 : : "BodyText", "Text body",
1083 : : "BodyTextIndentItalic", "Text body indent italic",
1084 : : "Body Text Indent", "Text body indent",
1085 : : "BodyTextIndent", "Text body indent",
1086 : : "BodyTextIndent2", "Text body indent2",
1087 : : "List Continue", "",
1088 : : "List Continue 2", "",
1089 : : "List Continue 3", "",
1090 : : "List Continue 4", "",
1091 : : "List Continue 5", "",
1092 : : "Message Header", "",
1093 : : "Subtitle", "Subtitle",
1094 : : "Salutation", "",
1095 : : "Date", "",
1096 : : "Body Text First Indent", "Body Text Indent",
1097 : : "Body Text First Indent 2", "",
1098 : : "Note Heading", "",
1099 : : "Body Text 2", "",
1100 : : "Body Text 3", "",
1101 : : "Body Text Indent 2", "",
1102 : : "Body Text Indent 3", "",
1103 : : "Block Text", "",
1104 : : "Hyperlink", "Internet link",
1105 : : "Followed Hyperlink", "Visited Internet Link",
1106 : : "Strong", "Strong Emphasis",
1107 : : "Emphasis", "Emphasis",
1108 : : "Document Map", "",
1109 : : "Plain Text", "",
1110 : : "NoList", "No List",
1111 : : "AbstractHeading", "Abstract Heading",
1112 : : "AbstractBody", "Abstract Body",
1113 : : "PageNumber", "page number"
1114 : : "TableNormal", "Normal Table",
1115 : : "DocumentMap", "Document Map"
1116 : : };
1117 : :
1118 : :
1119 : 5423 : OUString StyleSheetTable::ConvertStyleName( const OUString& rWWName, bool bExtendedSearch)
1120 : : {
1121 : 5423 : OUString sRet( rWWName );
1122 [ + + ]: 5423 : if( bExtendedSearch )
1123 : : {
1124 : : //search for the rWWName in the IdentifierD of the existing styles and convert the sStyleName member
1125 : 258 : std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
1126 : : //TODO: performance issue - put styles list into a map sorted by it's sStyleIdentifierD members
1127 [ + - ][ + + ]: 2754 : while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
1128 : : {
1129 [ + + ]: 2496 : if( rWWName == ( *aIt )->sStyleIdentifierD )
1130 : 258 : sRet = ( *aIt )->sStyleName;
1131 : 2496 : ++aIt;
1132 : : }
1133 : : }
1134 [ + + ]: 5423 : if(!m_pImpl->m_aStyleNameMap.size())
1135 : : {
1136 [ + + ]: 43310 : for( sal_uInt32 nPair = 0; nPair < sizeof(aStyleNamePairs) / sizeof( sal_Char*) / 2; ++nPair)
1137 : : {
1138 : : m_pImpl->m_aStyleNameMap.insert( StringPairMap_t::value_type(
1139 : 43005 : OUString::createFromAscii(aStyleNamePairs[2 * nPair]),
1140 [ + - ]: 43005 : OUString::createFromAscii(aStyleNamePairs[2 * nPair + 1]) ));
1141 : : }
1142 : : }
1143 [ + - ]: 5423 : StringPairMap_t::iterator aIt = m_pImpl->m_aStyleNameMap.find( sRet );
1144 [ + + ][ + + ]: 5423 : if(aIt != m_pImpl->m_aStyleNameMap.end() && !aIt->second.isEmpty())
[ + - ][ + + ]
1145 : 5423 : sRet = aIt->second;
1146 : 5423 : return sRet;
1147 : : }
1148 : :
1149 : 0 : OUString StyleSheetTable::GetStyleIdFromIndex(const sal_uInt32 sti)
1150 : : {
1151 : 0 : OUString sRet;
1152 [ # # ]: 0 : if (sti >= (sizeof(aStyleNamePairs) / sizeof( sal_Char*) / 2))
1153 : 0 : sRet = OUString();
1154 : : else
1155 : 0 : sRet = OUString::createFromAscii(aStyleNamePairs[2 * sti]);
1156 : 0 : return sRet;
1157 : : }
1158 : :
1159 : 0 : void StyleSheetTable::resolveAttributeProperties(Value & val)
1160 : : {
1161 [ # # ]: 0 : writerfilter::Reference<Properties>::Pointer_t pProperties = val.getProperties();
1162 [ # # ]: 0 : if( pProperties.get())
1163 [ # # ][ # # ]: 0 : pProperties->resolve(*this);
1164 : 0 : }
1165 : :
1166 : :
1167 : 160 : void StyleSheetTable::applyDefaults(bool bParaProperties)
1168 : : {
1169 : : try{
1170 [ + + ]: 160 : if(!m_pImpl->m_xTextDefaults.is())
1171 : : {
1172 : : m_pImpl->m_xTextDefaults = uno::Reference< beans::XPropertySet>(
1173 [ + - ]: 160 : m_pImpl->m_rDMapper.GetTextFactory()->createInstance("com.sun.star.text.Defaults"),
[ + - # # ]
1174 [ + - ][ + - ]: 80 : uno::UNO_QUERY_THROW );
[ + - ]
1175 : : }
1176 [ + - ]: 160 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
1177 [ + + ][ + - ]: 160 : if( bParaProperties && m_pImpl->m_pDefaultParaProps.get() && m_pImpl->m_pDefaultParaProps->size())
[ + + ][ + + ]
1178 : : {
1179 : 54 : PropertyMap::iterator aMapIter = m_pImpl->m_pDefaultParaProps->begin();
1180 [ + + ]: 162 : for( ; aMapIter != m_pImpl->m_pDefaultParaProps->end(); ++aMapIter )
1181 : : {
1182 : : try
1183 : : {
1184 [ + - ][ + - ]: 108 : m_pImpl->m_xTextDefaults->setPropertyValue(rPropNameSupplier.GetName( aMapIter->first.eId ), aMapIter->second);
[ + - ]
1185 : : }
1186 [ # # # # ]: 0 : catch( const uno::Exception& )
1187 : : {
1188 : : OSL_FAIL( "setPropertyValue exception");
1189 : : }
1190 : : }
1191 : : }
1192 [ + + ][ + - ]: 160 : if( !bParaProperties && m_pImpl->m_pDefaultCharProps.get() && m_pImpl->m_pDefaultCharProps->size())
[ + - ][ + + ]
1193 : : {
1194 : 80 : PropertyMap::iterator aMapIter = m_pImpl->m_pDefaultCharProps->begin();
1195 [ + + ]: 740 : for( ; aMapIter != m_pImpl->m_pDefaultCharProps->end(); ++aMapIter )
1196 : : {
1197 : : try
1198 : : {
1199 [ + - ][ + - ]: 660 : m_pImpl->m_xTextDefaults->setPropertyValue(rPropNameSupplier.GetName( aMapIter->first.eId ), aMapIter->second);
[ + - ]
1200 : : }
1201 [ # # # # ]: 0 : catch( const uno::Exception& )
1202 : : {
1203 : : OSL_FAIL( "setPropertyValue exception");
1204 : : }
1205 : : }
1206 : : }
1207 : : }
1208 : 0 : catch( const uno::Exception& )
1209 : : {
1210 : : }
1211 : 160 : }
1212 : :
1213 : :
1214 : 111 : OUString StyleSheetTable::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties )
1215 : : {
1216 : : //find out if any of the styles already has the required properties then return it's name
1217 [ + - ]: 111 : OUString sListLabel = m_pImpl->HasListCharStyle(rCharProperties);
1218 [ + + ]: 111 : if( !sListLabel.isEmpty() )
1219 : : return sListLabel;
1220 : 24 : const char cListLabel[] = "ListLabel ";
1221 [ + - ]: 24 : uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier( m_pImpl->m_xTextDocument, uno::UNO_QUERY_THROW );
1222 [ + - ][ + - ]: 24 : uno::Reference< container::XNameAccess > xStyleFamilies = xStylesSupplier->getStyleFamilies();
1223 : 24 : uno::Reference<container::XNameContainer> xCharStyles;
1224 [ + - ][ + - ]: 24 : xStyleFamilies->getByName("CharacterStyles") >>= xCharStyles;
[ + - ]
1225 : : //search for all character styles with the name sListLabel + <index>
1226 : 24 : sal_Int32 nStyleFound = 0;
1227 [ + - ][ + - ]: 24 : uno::Sequence< OUString > aStyleNames = xCharStyles->getElementNames();
1228 : 24 : const OUString* pStyleNames = aStyleNames.getConstArray();
1229 [ + + ]: 873 : for( sal_Int32 nStyle = 0; nStyle < aStyleNames.getLength(); ++nStyle )
1230 : : {
1231 [ + + ]: 849 : if( pStyleNames[nStyle].matchAsciiL( cListLabel, sizeof( cListLabel ) - 1 ))
1232 : : {
1233 : 45 : OUString sSuffix = pStyleNames[nStyle].copy( sizeof( cListLabel ) - 1 );
1234 : 45 : sal_Int32 nSuffix = sSuffix.toInt32();
1235 [ + - ]: 45 : if( nSuffix > 0 )
1236 : : {
1237 [ + - ]: 45 : if( nSuffix > nStyleFound )
1238 : 45 : nStyleFound = nSuffix;
1239 : 45 : }
1240 : : }
1241 : : }
1242 : 24 : sListLabel = OUString::createFromAscii( cListLabel );
1243 : 24 : sListLabel += OUString::valueOf( ++nStyleFound );
1244 : : //create a new one otherwise
1245 [ + - ]: 24 : uno::Reference< lang::XMultiServiceFactory > xDocFactory( m_pImpl->m_xTextDocument, uno::UNO_QUERY_THROW );
1246 [ + - ]: 24 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
1247 : : try
1248 : : {
1249 [ + - ]: 24 : uno::Reference< style::XStyle > xStyle( xDocFactory->createInstance(
1250 [ + - ][ + - ]: 24 : rPropNameSupplier.GetName( PROP_SERVICE_CHAR_STYLE )), uno::UNO_QUERY_THROW);
[ + - ]
1251 [ + - ]: 24 : uno::Reference< beans::XPropertySet > xStyleProps(xStyle, uno::UNO_QUERY_THROW );
1252 [ + - # # ]: 24 : PropertyValueVector_t::const_iterator aCharPropIter = rCharProperties.begin();
1253 [ + - ][ + + ]: 117 : while( aCharPropIter != rCharProperties.end())
1254 : : {
1255 : : try
1256 : : {
1257 [ + - ][ + - ]: 93 : xStyleProps->setPropertyValue( aCharPropIter->Name, aCharPropIter->Value );
1258 : : }
1259 [ # # ]: 0 : catch( const uno::Exception& rEx )
1260 : : {
1261 : : (void)rEx;
1262 : : OSL_FAIL( "Exception in StyleSheetTable::getOrCreateCharStyle - Style::setPropertyValue");
1263 : : }
1264 : 93 : ++aCharPropIter;
1265 : : }
1266 [ + - ][ + - ]: 24 : xCharStyles->insertByName( sListLabel, uno::makeAny( xStyle) );
[ + - ]
1267 [ + - ][ # # ]: 24 : m_pImpl->m_aListCharStylePropertyVector.push_back( ListCharStylePropertyMap_t( sListLabel, rCharProperties ));
[ + - ]
1268 : : }
1269 [ # # ]: 0 : catch( const uno::Exception& rEx )
1270 : : {
1271 : : (void)rEx;
1272 : : OSL_FAIL( "Exception in StyleSheetTable::getOrCreateCharStyle");
1273 : : }
1274 : :
1275 [ + - ]: 111 : return sListLabel;
1276 : : }
1277 : :
1278 : : }//namespace dmapper
1279 [ + - ][ + - ]: 60 : }//namespace writerfilter
1280 : :
1281 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|