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 <PropertyMap.hxx>
20 : : #include <ooxml/resourceids.hxx>
21 : : #include <DomainMapper_Impl.hxx>
22 : : #include <ConversionHelper.hxx>
23 : : #include <i18nutil/paper.hxx>
24 : : #include <rtl/oustringostreaminserter.hxx>
25 : : #include <com/sun/star/beans/PropertyValue.hpp>
26 : : #include <com/sun/star/beans/XMultiPropertySet.hpp>
27 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 : : #include <com/sun/star/table/BorderLine2.hpp>
29 : : #include <com/sun/star/container/XEnumeration.hpp>
30 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
31 : : #include <com/sun/star/container/XNameContainer.hpp>
32 : : #include <com/sun/star/style/BreakType.hpp>
33 : : #include <com/sun/star/style/PageStyleLayout.hpp>
34 : : #include <com/sun/star/text/RelOrientation.hpp>
35 : : #include <com/sun/star/text/WritingMode.hpp>
36 : : #include <com/sun/star/text/XTextColumns.hpp>
37 : : #include <com/sun/star/text/XText.hpp>
38 : : #include <com/sun/star/text/TextGridMode.hpp>
39 : : #include <com/sun/star/text/XTextCopy.hpp>
40 : : #include "dmapperLoggers.hxx"
41 : : #include "PropertyMapHelper.hxx"
42 : :
43 : : using namespace ::com::sun::star;
44 : :
45 : : namespace writerfilter {
46 : : namespace dmapper{
47 : :
48 : :
49 : :
50 : 29642 : PropertyMap::PropertyMap() :
51 : : m_cFootnoteSymbol( 0 ),
52 [ + - ]: 29642 : m_nFootnoteFontId( -1 )
53 : : {
54 : 29642 : }
55 : :
56 : :
57 [ + - ]: 29642 : PropertyMap::~PropertyMap()
58 : : {
59 [ - + ]: 51961 : }
60 : :
61 : :
62 : 5216 : uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues()
63 : : {
64 [ + + ][ + + ]: 5216 : if(!m_aValues.getLength() && size())
[ + + ]
65 : : {
66 [ + - ]: 4397 : m_aValues.realloc( size() );
67 [ + - ]: 4397 : ::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray();
68 : : //style names have to be the first elements within the property sequence
69 : : //otherwise they will overwrite 'hard' attributes
70 : 4397 : sal_Int32 nValue = 0;
71 [ + - ]: 4397 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
72 [ + - ]: 4397 : PropertyMap::iterator aParaStyleIter = find(PropertyDefinition( PROP_PARA_STYLE_NAME, false ) );
73 [ + + ]: 4397 : if( aParaStyleIter != end())
74 : : {
75 [ + - ]: 1468 : pValues[nValue].Name = rPropNameSupplier.GetName( aParaStyleIter->first.eId );
76 : 1468 : pValues[nValue].Value = aParaStyleIter->second;
77 : 1468 : ++nValue;
78 : : }
79 : :
80 [ + - ]: 4397 : PropertyMap::iterator aCharStyleIter = find(PropertyDefinition( PROP_CHAR_STYLE_NAME, false ));
81 [ + + ]: 4397 : if( aCharStyleIter != end())
82 : : {
83 [ + - ]: 3 : pValues[nValue].Name = rPropNameSupplier.GetName( aCharStyleIter->first.eId );
84 : 3 : pValues[nValue].Value = aCharStyleIter->second;
85 : 3 : ++nValue;
86 : : }
87 [ + - ]: 4397 : PropertyMap::iterator aNumRuleIter = find(PropertyDefinition( PROP_NUMBERING_RULES, false ) );
88 [ + + ]: 4397 : if( aNumRuleIter != end())
89 : : {
90 [ + - ]: 66 : pValues[nValue].Name = rPropNameSupplier.GetName( aNumRuleIter->first.eId );
91 : 66 : pValues[nValue].Value = aNumRuleIter->second;
92 : 66 : ++nValue;
93 : : }
94 : 4397 : PropertyMap::iterator aMapIter = begin();
95 [ + + ]: 34031 : for( ; nValue < m_aValues.getLength(); ++aMapIter )
96 : : {
97 [ + + ][ + - ]: 29634 : if( aMapIter != aParaStyleIter && aMapIter != aCharStyleIter && aMapIter != aNumRuleIter )
[ + + ][ + + ]
98 : : {
99 [ + - ]: 29163 : pValues[nValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId );
100 : 29163 : pValues[nValue].Value = aMapIter->second;
101 : 29163 : ++nValue;
102 : : }
103 : : }
104 : : }
105 : 5216 : return m_aValues;
106 : : }
107 : :
108 : : #ifdef DEBUG_DMAPPER_PROPERTY_MAP
109 : : static void lcl_AnyToTag(const uno::Any & rAny)
110 : : {
111 : : try {
112 : : sal_Int32 aInt = 0;
113 : : rAny >>= aInt;
114 : : dmapper_logger->attribute("value", aInt);
115 : :
116 : : sal_uInt32 auInt = 0;
117 : : rAny >>= auInt;
118 : : dmapper_logger->attribute("unsignedValue", auInt);
119 : :
120 : : float aFloat = 0.0f;
121 : : rAny >>= aFloat;
122 : : dmapper_logger->attribute("floatValue", aFloat);
123 : :
124 : : OUString aStr;
125 : : rAny >>= aStr;
126 : : dmapper_logger->attribute("stringValue", aStr);
127 : : }
128 : : catch (...) {
129 : : }
130 : : }
131 : : #endif
132 : :
133 : 120033 : void PropertyMap::Insert( PropertyIds eId, bool bIsTextProperty, const uno::Any& rAny, bool bOverwrite )
134 : : {
135 : : #ifdef DEBUG_DMAPPER_PROPERTY_MAP
136 : : const OUString& rInsert = PropertyNameSupplier::
137 : : GetPropertyNameSupplier().GetName(eId);
138 : :
139 : : dmapper_logger->startElement("propertyMap.insert");
140 : : dmapper_logger->attribute("name", rInsert);
141 : : lcl_AnyToTag(rAny);
142 : : dmapper_logger->endElement();
143 : : #endif
144 : :
145 [ + - ]: 120033 : PropertyMap::iterator aElement = find(PropertyDefinition( eId, bIsTextProperty ) );
146 [ + + ]: 120033 : if( aElement != end())
147 : : {
148 [ + + ]: 5421 : if(!bOverwrite)
149 : 120033 : return;
150 [ + - ]: 3406 : erase( aElement );
151 : : }
152 : : _PropertyMap::insert( PropertyMap::value_type
153 : : (PropertyDefinition( eId, bIsTextProperty),
154 [ + - ]: 118018 : rAny ));
155 [ + - ]: 120033 : Invalidate();
156 : : }
157 : :
158 : : #if OSL_DEBUG_LEVEL > 1
159 : : void PropertyMap::dumpXml( const TagLogger::Pointer_t pLogger ) const
160 : : {
161 : : pLogger->startElement("PropertyMap");
162 : :
163 : : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
164 : : PropertyMap::const_iterator aMapIter = begin();
165 : : while (aMapIter != end())
166 : : {
167 : : pLogger->startElement("property");
168 : :
169 : : pLogger->attribute("name", rPropNameSupplier.GetName( aMapIter->first.eId ));
170 : :
171 : : switch (aMapIter->first.eId)
172 : : {
173 : : case PROP_TABLE_COLUMN_SEPARATORS:
174 : : lcl_DumpTableColumnSeparators(pLogger, aMapIter->second);
175 : : break;
176 : : default:
177 : : {
178 : : try {
179 : : sal_Int32 aInt = 0;
180 : : aMapIter->second >>= aInt;
181 : : pLogger->attribute("value", aInt);
182 : :
183 : : sal_uInt32 auInt = 0;
184 : : aMapIter->second >>= auInt;
185 : : pLogger->attribute("unsignedValue", auInt);
186 : :
187 : : float aFloat = 0.0;
188 : : aMapIter->second >>= aFloat;
189 : : pLogger->attribute("floatValue", aFloat);
190 : :
191 : : OUString aStr;
192 : : aMapIter->second >>= auInt;
193 : : pLogger->attribute("stringValue", aStr);
194 : : }
195 : : catch (...) {
196 : : }
197 : : }
198 : : break;
199 : : }
200 : :
201 : : pLogger->endElement();
202 : :
203 : : ++aMapIter;
204 : : }
205 : :
206 : : pLogger->endElement();
207 : : }
208 : : #endif
209 : :
210 : :
211 : :
212 : : template<class T>
213 : : struct removeExistingElements : public ::std::unary_function<T, void>
214 : : {
215 : : PropertyMap& rMap;
216 : :
217 : 6158 : removeExistingElements(PropertyMap& _rMap ) : rMap(_rMap) {}
218 : 7700 : void operator() (T x)
219 : : {
220 [ + - ]: 7700 : PropertyMap::iterator aElement = rMap.find(x.first);
221 [ + + ]: 7700 : if( aElement != rMap.end())
222 [ + - ]: 290 : rMap.erase( aElement );
223 : 7700 : }
224 : : };
225 : :
226 : :
227 : 6158 : void PropertyMap::insert( const PropertyMapPtr pMap, bool bOverwrite )
228 : : {
229 [ + - ]: 6158 : if( pMap.get() )
230 : : {
231 [ + - ]: 6158 : if( bOverwrite )
232 [ + - ]: 6158 : ::std::for_each( pMap->begin(), pMap->end(), removeExistingElements<PropertyMap::value_type>(*this) );
233 : 6158 : _PropertyMap::insert(pMap->begin(), pMap->end());
234 : 6158 : insertTableProperties(pMap.get());
235 : :
236 : 6158 : Invalidate();
237 : : }
238 : 6158 : }
239 : :
240 : :
241 : 25730 : const uno::Reference< text::XFootnote>& PropertyMap::GetFootnote() const
242 : : {
243 : 25730 : return m_xFootnote;
244 : : }
245 : :
246 : :
247 : 5819 : void PropertyMap::insertTableProperties( const PropertyMap* )
248 : : {
249 : : #ifdef DEBUG_DOMAINMAPPER
250 : : dmapper_logger->element("PropertyMap.insertTableProperties");
251 : : #endif
252 : 5819 : }
253 : :
254 : :
255 : 530 : SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
256 : : m_bIsFirstSection( bIsFirstSection )
257 : : ,m_nBorderParams( 0 )
258 : : ,m_bTitlePage( false )
259 : : ,m_nColumnCount( 0 )
260 : : ,m_nColumnDistance( 1249 )
261 : : ,m_bSeparatorLineIsOn( false )
262 : : ,m_bEvenlySpaced( false )
263 : : ,m_bIsLandscape( false )
264 : : ,m_bPageNoRestart( false )
265 : : ,m_nPageNumber( -1 )
266 : : ,m_nBreakType( -1 )
267 : : ,m_nPaperBin( -1 )
268 : : ,m_nFirstPaperBin( -1 )
269 : : ,m_nLeftMargin( 3175 ) //page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
270 : : ,m_nRightMargin( 3175 )//page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
271 : : ,m_nTopMargin( 2540 )
272 : : ,m_nBottomMargin( 2540 )
273 : : ,m_nHeaderTop( 1270 ) //720 twip
274 : : ,m_nHeaderBottom( 1270 )//720 twip
275 : : ,m_nDzaGutter( 0 )
276 : : ,m_bGutterRTL( false )
277 : : ,m_bSFBiDi( false )
278 : : ,m_nGridType(0)
279 : : ,m_nGridLinePitch( 1 )
280 : : ,m_nDxtCharSpace( 0 )
281 : : ,m_nLnnMod( 0 )
282 : : ,m_nLnc( 0 )
283 : : ,m_ndxaLnn( 0 )
284 [ + - ][ + - ]: 530 : ,m_nLnnMin( 0 )
285 : : {
286 : : static sal_Int32 nNumber = 0;
287 : 530 : nSectionNumber = nNumber++;
288 : 530 : memset(&m_pBorderLines, 0x00, sizeof(m_pBorderLines));
289 [ + + ]: 2650 : for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
290 : 2120 : m_nBorderDistances[ nBorder ] = -1;
291 : : //todo: set defaults in ApplyPropertiesToPageStyles
292 : : //initialize defaults
293 [ + - ]: 530 : PaperInfo aLetter(PAPER_LETTER);
294 : : //page height, 1/100mm
295 [ + - ][ + - ]: 530 : Insert( PROP_HEIGHT, false, uno::makeAny( (sal_Int32) aLetter.getHeight() ) );
296 : : //page width, 1/100mm
297 [ + - ][ + - ]: 530 : Insert( PROP_WIDTH, false, uno::makeAny( (sal_Int32) aLetter.getWidth() ) );
298 : : //page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
299 [ + - ][ + - ]: 530 : Insert( PROP_LEFT_MARGIN, false, uno::makeAny( (sal_Int32) 3175 ) );
300 : : //page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
301 [ + - ][ + - ]: 530 : Insert( PROP_RIGHT_MARGIN, false, uno::makeAny( (sal_Int32) 3175 ) );
302 : : //page top margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
303 [ + - ][ + - ]: 530 : Insert( PROP_TOP_MARGIN, false, uno::makeAny( (sal_Int32)2540 ) );
304 : : //page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
305 [ + - ][ + - ]: 530 : Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( (sal_Int32) 2540 ) );
306 [ + - ]: 530 : uno::Any aFalse( ::uno::makeAny( false ) );
307 [ + - ]: 530 : Insert( PROP_GRID_DISPLAY, false, aFalse);
308 [ + - ]: 530 : Insert( PROP_GRID_PRINT, false, aFalse);
309 [ + - ][ + - ]: 530 : Insert( PROP_GRID_MODE, false, uno::makeAny(text::TextGridMode::NONE));
310 : :
311 : :
312 [ + + ]: 530 : if( m_bIsFirstSection )
313 : : {
314 [ + - ]: 497 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
315 [ + - ]: 497 : m_sFirstPageStyleName = rPropNameSupplier.GetName( PROP_FIRST_PAGE );
316 [ + - ]: 497 : m_sFollowPageStyleName = rPropNameSupplier.GetName( PROP_STANDARD );
317 : 530 : }
318 : 530 : }
319 : :
320 : :
321 : 530 : SectionPropertyMap::~SectionPropertyMap()
322 : : {
323 [ + + ]: 2650 : for( sal_Int16 ePos = BORDER_LEFT; ePos <= BORDER_BOTTOM; ++ePos)
324 : 2120 : delete m_pBorderLines[ePos];
325 [ - + ]: 1060 : }
326 : :
327 : :
328 : 33 : OUString lcl_FindUnusedPageStyleName(const uno::Sequence< OUString >& rPageStyleNames)
329 : : {
330 : : static const sal_Char cDefaultStyle[] = "Converted";
331 : : //find the hightest number x in each style with the name "cDefaultStyle+x" and
332 : : //return an incremented name
333 : 33 : sal_Int32 nMaxIndex = 0;
334 : 33 : const sal_Int32 nDefaultLength = sizeof(cDefaultStyle)/sizeof(sal_Char) - 1;
335 [ + - ]: 33 : const OUString sDefaultStyle( cDefaultStyle, nDefaultLength, RTL_TEXTENCODING_ASCII_US );
336 : :
337 : 33 : const OUString* pStyleNames = rPageStyleNames.getConstArray();
338 [ + + ]: 378 : for( sal_Int32 nStyle = 0; nStyle < rPageStyleNames.getLength(); ++nStyle)
339 : : {
340 [ + + + + ]: 426 : if( pStyleNames[nStyle].getLength() > nDefaultLength &&
[ + + ]
341 : 81 : !rtl_ustr_compare_WithLength( sDefaultStyle.getStr(), nDefaultLength, pStyleNames[nStyle].getStr(), nDefaultLength))
342 : : {
343 : 15 : sal_Int32 nIndex = pStyleNames[nStyle].copy( nDefaultLength ).toInt32();
344 [ + - ]: 15 : if( nIndex > nMaxIndex)
345 : 15 : nMaxIndex = nIndex;
346 : : }
347 : : }
348 : 33 : OUString sRet( sDefaultStyle );
349 : 33 : sRet += OUString::valueOf( nMaxIndex + 1);
350 : 33 : return sRet;
351 : : }
352 : :
353 : :
354 : :
355 : 1653 : uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
356 : : const uno::Reference< container::XNameContainer >& xPageStyles,
357 : : const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
358 : : bool bFirst )
359 : : {
360 : 1653 : uno::Reference< beans::XPropertySet > xRet;
361 : : try
362 : : {
363 [ + + ]: 1653 : if( bFirst )
364 : : {
365 [ + + ][ + - ]: 521 : if( m_sFirstPageStyleName.isEmpty() && xPageStyles.is() )
[ + + ]
366 : : {
367 [ + - ][ + - ]: 3 : uno::Sequence< OUString > aPageStyleNames = xPageStyles->getElementNames();
368 [ + - ]: 3 : m_sFirstPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
369 : : m_aFirstPageStyle = uno::Reference< beans::XPropertySet > (
370 [ + - ]: 3 : xTextFactory->createInstance("com.sun.star.style.PageStyle"),
371 [ + - ][ + - ]: 3 : uno::UNO_QUERY);
[ + - ]
372 [ + - ]: 3 : if (xPageStyles.is())
373 [ + - ][ + - ]: 3 : xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
[ + - ][ + - ]
374 : : }
375 [ + + ][ + + ]: 518 : else if( !m_aFirstPageStyle.is() && xPageStyles.is() )
[ + + ]
376 : : {
377 [ + - ][ + - ]: 467 : xPageStyles->getByName(m_sFirstPageStyleName) >>= m_aFirstPageStyle;
[ + - ]
378 : : }
379 [ + - ]: 521 : xRet = m_aFirstPageStyle;
380 : : }
381 : : else
382 : : {
383 [ + + ][ + - ]: 1132 : if( m_sFollowPageStyleName.isEmpty() && xPageStyles.is() )
[ + + ]
384 : : {
385 [ + - ][ + - ]: 30 : uno::Sequence< OUString > aPageStyleNames = xPageStyles->getElementNames();
386 [ + - ]: 30 : m_sFollowPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
387 : : m_aFollowPageStyle = uno::Reference< beans::XPropertySet > (
388 [ + - ]: 30 : xTextFactory->createInstance("com.sun.star.style.PageStyle"),
389 [ + - ][ + - ]: 30 : uno::UNO_QUERY);
[ + - ]
390 [ + - ][ + - ]: 30 : xPageStyles->insertByName( m_sFollowPageStyleName, uno::makeAny(m_aFollowPageStyle) );
[ + - ][ + - ]
391 : : }
392 [ + + ][ + + ]: 1102 : else if(!m_aFollowPageStyle.is() && xPageStyles.is() )
[ + + ]
393 : : {
394 [ + - ][ + - ]: 470 : xPageStyles->getByName(m_sFollowPageStyleName) >>= m_aFollowPageStyle;
[ + - ][ # # ]
395 : : }
396 [ + - ]: 1132 : xRet = m_aFollowPageStyle;
397 : : }
398 : :
399 : : }
400 [ # # ]: 0 : catch( const uno::Exception& )
401 : : {
402 : : }
403 : :
404 : 1653 : return xRet;
405 : : }
406 : :
407 : :
408 : 24 : void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine2& rBorderLine )
409 : : {
410 : 24 : delete m_pBorderLines[ePos];
411 : 24 : m_pBorderLines[ePos] = new table::BorderLine2( rBorderLine );
412 : 24 : m_nBorderDistances[ePos] = nLineDistance;
413 : 24 : }
414 : :
415 : :
416 : 518 : void SectionPropertyMap::ApplyBorderToPageStyles(
417 : : const uno::Reference< container::XNameContainer >& xPageStyles,
418 : : const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
419 : : sal_Int32 nValue )
420 : : {
421 : : /*
422 : : page border applies to:
423 : : nIntValue & 0x07 ->
424 : : 0 all pages in this section
425 : : 1 first page in this section
426 : : 2 all pages in this section but first
427 : : 3 whole document (all sections)
428 : : nIntValue & 0x18 -> page border depth 0 - in front 1- in back
429 : : nIntValue & 0xe0 ->
430 : : page border offset from:
431 : : 0 offset from text
432 : : 1 offset from edge of page
433 : : */
434 : 518 : uno::Reference< beans::XPropertySet > xFirst;
435 : 518 : uno::Reference< beans::XPropertySet > xSecond;
436 : 518 : sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
437 : : //todo: negative spacing (from ww8par6.cxx)
438 [ + - - - ]: 518 : switch( nValue & 0x07)
439 : : {
440 : : case 0: /*all styles*/
441 [ + - ]: 518 : if ( !m_sFollowPageStyleName.isEmpty() )
442 [ + - ][ + - ]: 518 : xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
443 [ + + ]: 518 : if ( !m_sFirstPageStyleName.isEmpty() )
444 [ + - ][ + - ]: 491 : xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
445 : 518 : break;
446 : : case 1: /*first page*/
447 [ # # ]: 0 : if ( !m_sFirstPageStyleName.isEmpty() )
448 [ # # ][ # # ]: 0 : xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
449 : 0 : break;
450 : : case 2: /*left and right*/
451 [ # # ]: 0 : if ( !m_sFollowPageStyleName.isEmpty() )
452 [ # # ][ # # ]: 0 : xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
453 : 0 : break;
454 : : case 3: //whole document?
455 : : //todo: how to apply a border to the whole document - find all sections or access all page styles?
456 : : default:
457 : 518 : return;
458 : : }
459 : : //has to be sorted like enum BorderPosition: l-r-t-b
460 : : static const PropertyIds aBorderIds[4] =
461 : : {
462 : : PROP_LEFT_BORDER,
463 : : PROP_RIGHT_BORDER,
464 : : PROP_TOP_BORDER,
465 : : PROP_BOTTOM_BORDER
466 : : };
467 : : static const PropertyIds aBorderDistanceIds[4] =
468 : : {
469 : : PROP_LEFT_BORDER_DISTANCE,
470 : : PROP_RIGHT_BORDER_DISTANCE,
471 : : PROP_TOP_BORDER_DISTANCE,
472 : : PROP_BOTTOM_BORDER_DISTANCE
473 : : };
474 : : static const PropertyIds aMarginIds[4] =
475 : : {
476 : : PROP_LEFT_MARGIN,
477 : : PROP_RIGHT_MARGIN,
478 : : PROP_TOP_MARGIN,
479 : : PROP_BOTTOM_MARGIN
480 : : };
481 : :
482 [ + - ]: 518 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
483 [ + + ]: 2590 : for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
484 : : {
485 [ + + ]: 2072 : if( m_pBorderLines[nBorder] )
486 : : {
487 [ + - ]: 24 : const OUString sBorderName = rPropNameSupplier.GetName( aBorderIds[nBorder] );
488 [ + - ]: 24 : if (xFirst.is())
489 [ + - ][ + - ]: 24 : xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
[ + - ]
490 [ + - ]: 24 : if(xSecond.is())
491 [ + - ][ + - ]: 24 : xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
[ + - ]
492 : : }
493 [ + + ]: 2072 : if( m_nBorderDistances[nBorder] >= 0 )
494 : : {
495 : 24 : sal_uInt32 nLineWidth = 0;
496 [ + - ]: 24 : if (m_pBorderLines[nBorder])
497 : 24 : nLineWidth = m_pBorderLines[nBorder]->LineWidth;
498 : 24 : SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
499 [ + - ]: 24 : m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
500 [ + - ]: 24 : if(xSecond.is())
501 : 24 : SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
502 [ + - ]: 24 : m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
503 : : }
504 [ - + ][ + - ]: 518 : }
505 : : }
506 : :
507 : 48 : void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle,
508 : : PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth )
509 : : {
510 [ + - ]: 48 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
511 : :
512 : 48 : sal_Int32 nDist = nDistance;
513 [ + - ]: 48 : if( nOffsetFrom == 1 )
514 : : {
515 [ + - ]: 48 : const OUString sMarginName = rPropNameSupplier.GetName( eMarginId );
516 [ + - ][ + - ]: 48 : uno::Any aMargin = xStyle->getPropertyValue( sMarginName );
517 : 48 : sal_Int32 nMargin = 0;
518 : 48 : aMargin >>= nMargin;
519 : :
520 : : // Change the margins with the ( border distance - line width )
521 [ + - ][ + - ]: 48 : xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance - nLineWidth ) );
[ + - ]
522 : :
523 : : // Set the distance to ( Margin - distance )
524 : 48 : nDist = nMargin - nDistance;
525 : : }
526 [ + - ]: 48 : const OUString sBorderDistanceName = rPropNameSupplier.GetName( eDistId );
527 [ + - ]: 48 : if (xStyle.is())
528 [ + - ][ + - ]: 48 : xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
[ + - ]
529 : 48 : }
530 : :
531 : :
532 : :
533 : 3 : uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
534 : : uno::Reference< beans::XPropertySet > xColumnContainer )
535 : : {
536 : 3 : uno::Reference< text::XTextColumns > xColumns;
537 : : try
538 : : {
539 [ + - ]: 3 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
540 [ + - ]: 3 : const OUString sTextColumns = rPropNameSupplier.GetName( PROP_TEXT_COLUMNS );
541 [ + - ]: 3 : if (xColumnContainer.is())
542 [ + - ][ + - ]: 3 : xColumnContainer->getPropertyValue(sTextColumns) >>= xColumns;
[ + - ]
543 [ + - ]: 3 : uno::Reference< beans::XPropertySet > xColumnPropSet( xColumns, uno::UNO_QUERY_THROW );
544 [ + - + - : 9 : if( !m_bEvenlySpaced &&
+ - ][ + - ]
545 : 3 : (sal_Int32(m_aColWidth.size()) == (m_nColumnCount + 1 )) &&
546 : 3 : (sal_Int32(m_aColDistance.size()) == m_nColumnCount))
547 : : {
548 : : //the column width in word is an absolute value, in OOo it's relative
549 : : //the distances are both absolute
550 : 3 : sal_Int32 nColSum = 0;
551 [ + + ]: 9 : for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)
552 : : {
553 [ + - ]: 6 : nColSum += m_aColWidth[nCol];
554 [ + + ]: 6 : if(nCol)
555 [ + - ]: 3 : nColSum += m_aColDistance[nCol -1];
556 : : }
557 : :
558 [ + - ][ + - ]: 3 : sal_Int32 nRefValue = xColumns->getReferenceValue();
559 : 3 : double fRel = double( nRefValue ) / double( nColSum );
560 [ + - ]: 3 : uno::Sequence< text::TextColumn > aColumns( m_nColumnCount + 1 );
561 [ + - ]: 3 : text::TextColumn* pColumn = aColumns.getArray();
562 : :
563 : 3 : nColSum = 0;
564 [ + + ]: 9 : for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)
565 : : {
566 [ + + ][ + - ]: 6 : pColumn[nCol].LeftMargin = nCol ? m_aColDistance[nCol - 1 ] / 2 : 0;
567 [ + + ][ + - ]: 6 : pColumn[nCol].RightMargin = nCol == m_nColumnCount ? 0 : m_aColDistance[nCol] / 2;
568 [ + - ]: 6 : pColumn[nCol].Width = sal_Int32((double( m_aColWidth[nCol] + pColumn[nCol].RightMargin + pColumn[nCol].LeftMargin ) + 0.5 ) * fRel );
569 : 6 : nColSum += pColumn[nCol].Width;
570 : : }
571 [ + - ]: 3 : if( nColSum != nRefValue )
572 : 3 : pColumn[m_nColumnCount].Width -= ( nColSum - nRefValue );
573 [ + - ][ + - ]: 3 : xColumns->setColumns( aColumns );
[ + - ]
574 : : }
575 : : else
576 : : {
577 [ # # ][ # # ]: 0 : xColumns->setColumnCount( m_nColumnCount + 1 );
578 [ # # ][ # # ]: 0 : xColumnPropSet->setPropertyValue( rPropNameSupplier.GetName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( m_nColumnDistance ));
[ # # ][ # # ]
579 : : }
580 : :
581 [ - + ]: 3 : if(m_bSeparatorLineIsOn)
582 [ # # ]: 0 : xColumnPropSet->setPropertyValue(
583 [ # # ]: 0 : rPropNameSupplier.GetName( PROP_SEPARATOR_LINE_IS_ON ),
584 [ # # ][ # # ]: 0 : uno::makeAny( m_bSeparatorLineIsOn ));
585 [ + - ][ + - ]: 3 : xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) );
[ + - ][ # # ]
586 : : }
587 [ # # ]: 0 : catch( const uno::Exception& )
588 : : {
589 : : OSL_FAIL( "Exception in SectionPropertyMap::ApplyColumnProperties");
590 : : }
591 : 3 : return xColumns;
592 : : }
593 : :
594 : :
595 : :
596 : 536 : bool SectionPropertyMap::HasHeader(bool bFirstPage) const
597 : : {
598 : 536 : bool bRet = false;
599 [ + + ][ + + ]: 536 : if( (bFirstPage && m_aFirstPageStyle.is()) ||( !bFirstPage && m_aFollowPageStyle.is()) )
[ + + ][ + + ]
[ + + ]
600 : : {
601 [ + + ]: 500 : if( bFirstPage )
602 [ + - ]: 3 : m_aFirstPageStyle->getPropertyValue(
603 [ + - ][ + - ]: 3 : PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_HEADER_IS_ON) ) >>= bRet;
[ + - ]
604 : : else
605 [ + - ]: 497 : m_aFollowPageStyle->getPropertyValue(
606 [ + - ][ + - ]: 497 : PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_HEADER_IS_ON) ) >>= bRet;
[ + - ]
607 : : }
608 : 536 : return bRet;
609 : : }
610 : :
611 : :
612 : 536 : bool SectionPropertyMap::HasFooter(bool bFirstPage) const
613 : : {
614 : 536 : bool bRet = false;
615 [ + + ][ + + ]: 536 : if( (bFirstPage && m_aFirstPageStyle.is()) ||( !bFirstPage && m_aFollowPageStyle.is()) )
[ + + ][ + + ]
[ + + ]
616 : : {
617 [ + + ]: 500 : if( bFirstPage )
618 [ + - ]: 3 : m_aFirstPageStyle->getPropertyValue(
619 [ + - ][ + - ]: 3 : PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_FOOTER_IS_ON) ) >>= bRet;
[ + - ]
620 : : else
621 [ + - ]: 497 : m_aFollowPageStyle->getPropertyValue(
622 [ + - ][ + - ]: 497 : PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_FOOTER_IS_ON) ) >>= bRet;
[ + - ]
623 : : }
624 : 536 : return bRet;
625 : : }
626 : :
627 : :
628 : : #define MIN_HEAD_FOOT_HEIGHT 100 //minimum header/footer height
629 : :
630 : 536 : void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl )
631 : : {
632 : : SAL_INFO("writerfilter", "START>>> SectionPropertyMap::CopyLastHeaderFooter()");
633 : 536 : SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext( );
634 [ + + ]: 536 : if ( pLastContext )
635 : : {
636 : : uno::Reference< beans::XPropertySet > xPrevStyle = pLastContext->GetPageStyle(
637 : : rDM_Impl.GetPageStyles(),
638 : : rDM_Impl.GetTextFactory(),
639 [ + - ][ + - ]: 33 : bFirstPage );
[ + - ]
640 : : uno::Reference< beans::XPropertySet > xStyle = GetPageStyle(
641 : : rDM_Impl.GetPageStyles(),
642 : : rDM_Impl.GetTextFactory(),
643 [ + - ][ + - ]: 33 : bFirstPage );
[ + - ]
644 : :
645 [ + - ]: 33 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
646 : :
647 : : try {
648 : : // Loop over the Header and Footer properties to copy them
649 : : static PropertyIds aProperties[] =
650 : : {
651 : : PROP_HEADER_TEXT,
652 : : PROP_FOOTER_TEXT,
653 : : };
654 : :
655 : 33 : bool bHasPrevHeader = false;
656 : 33 : bool bHasHeader = false;
657 : :
658 [ + - ]: 33 : OUString sHeaderIsOn = rPropNameSupplier.GetName( PROP_HEADER_IS_ON );
659 [ + - ]: 33 : if (xPrevStyle.is())
660 [ + - ][ + - ]: 33 : xPrevStyle->getPropertyValue( sHeaderIsOn ) >>= bHasPrevHeader;
661 [ + - ]: 33 : if (xStyle.is())
662 [ + - ][ + - ]: 33 : xStyle->getPropertyValue( sHeaderIsOn ) >>= bHasHeader;
663 [ + + ][ - + ]: 33 : bool bCopyHeader = bHasPrevHeader && !bHasHeader;
664 : :
665 [ - + ]: 33 : if ( bCopyHeader )
666 [ # # ][ # # ]: 0 : xStyle->setPropertyValue( sHeaderIsOn, uno::makeAny( sal_True ) );
[ # # ]
667 : :
668 : 33 : bool bHasPrevFooter = false;
669 : 33 : bool bHasFooter = false;
670 : :
671 [ + - ]: 33 : OUString sFooterIsOn = rPropNameSupplier.GetName( PROP_FOOTER_IS_ON );
672 [ + - ]: 33 : if (xPrevStyle.is())
673 [ + - ][ + - ]: 33 : xPrevStyle->getPropertyValue( sFooterIsOn ) >>= bHasPrevFooter;
674 [ + - ]: 33 : if (xStyle.is())
675 [ + - ][ + - ]: 33 : xStyle->getPropertyValue( sFooterIsOn ) >>= bHasFooter;
676 [ + + ][ + - ]: 33 : bool bCopyFooter = bHasPrevFooter && !bHasFooter;
677 : :
678 [ + + ][ + - ]: 33 : if ( bCopyFooter && xStyle.is() )
[ + + ]
679 [ + - ][ + - ]: 9 : xStyle->setPropertyValue( sFooterIsOn, uno::makeAny( sal_True ) );
[ + - ]
680 : :
681 : : // Copying the text properties
682 [ + + ]: 99 : for ( int i = 0, nNbProps = 2; i < nNbProps; i++ )
683 : : {
684 : 66 : bool bIsHeader = ( i < nNbProps / 2 );
685 : 66 : PropertyIds aPropId = aProperties[i];
686 [ + - ]: 66 : OUString sName = rPropNameSupplier.GetName( aPropId );
687 : :
688 [ + - ][ + + ]: 66 : if ( ( bIsHeader && bCopyHeader ) || ( !bIsHeader && bCopyFooter ) )
[ + + ][ + + ]
689 : : {
690 : : SAL_INFO("writerfilter", "Copying " << sName);
691 : : // TODO has to be copied
692 : 9 : uno::Reference< text::XTextCopy > xTxt;
693 [ + - ]: 9 : if (xStyle.is())
694 [ + - ][ + - ]: 9 : xTxt.set(xStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
[ + - ]
695 : :
696 : 9 : uno::Reference< text::XTextCopy > xPrevTxt;
697 [ + - ]: 9 : if (xPrevStyle.is())
698 [ + - ][ + - ]: 9 : xPrevTxt.set(xPrevStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
[ + - ]
699 : :
700 [ + - ][ + - ]: 9 : xTxt->copyText( xPrevTxt );
701 : : }
702 [ # # ]: 99 : }
703 : : }
704 [ # # ]: 0 : catch ( const uno::Exception& e )
705 : : {
706 : : SAL_INFO("writerfilter", "An exception occurred in SectionPropertyMap::CopyLastHeaderFooter( ) - " << e.Message);
707 : 33 : }
708 : : }
709 : : SAL_INFO("writerfilter", "END>>> SectionPropertyMap::CopyLastHeaderFooter()");
710 : 536 : }
711 : :
712 : 536 : void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
713 : : {
714 : 536 : sal_Int32 nTopMargin = m_nTopMargin;
715 [ + + ]: 536 : if(HasHeader(bFirstPage))
716 : : {
717 : 27 : m_nTopMargin = m_nHeaderTop;
718 [ + - ][ + + ]: 27 : if( nTopMargin > 0 && nTopMargin > m_nHeaderTop )
719 : 24 : m_nHeaderTop = nTopMargin - m_nHeaderTop;
720 : : else
721 : 3 : m_nHeaderTop = 0;
722 : :
723 : : //minimum header height 1mm
724 [ + + ]: 27 : if( m_nHeaderTop < MIN_HEAD_FOOT_HEIGHT )
725 : 3 : m_nHeaderTop = MIN_HEAD_FOOT_HEIGHT;
726 : : }
727 : :
728 : :
729 [ + - ]: 536 : if( nTopMargin >= 0 ) //fixed height header -> see WW8Par6.hxx
730 : : {
731 [ + - ][ + - ]: 536 : operator[]( PropertyDefinition( PROP_HEADER_IS_DYNAMIC_HEIGHT, false )) = uno::makeAny( true );
732 [ + - ][ + - ]: 536 : operator[]( PropertyDefinition( PROP_HEADER_DYNAMIC_SPACING, false )) = uno::makeAny( true );
733 [ + - ][ + - ]: 536 : operator[]( PropertyDefinition( PROP_HEADER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderTop - MIN_HEAD_FOOT_HEIGHT );// ULSpace.Top()
734 [ + - ]: 536 : operator[]( PropertyDefinition( PROP_HEADER_HEIGHT, false )) = uno::makeAny( m_nHeaderTop );
735 : :
736 : : }
737 : : else
738 : : {
739 : : //todo: old filter fakes a frame into the header/footer to support overlapping
740 : : //current setting is completely wrong!
741 [ # # ]: 0 : operator[]( PropertyDefinition( PROP_HEADER_HEIGHT, false )) = uno::makeAny( m_nHeaderTop );
742 [ # # ][ # # ]: 0 : operator[]( PropertyDefinition( PROP_HEADER_BODY_DISTANCE, false )) = uno::makeAny( nTopMargin - m_nHeaderTop );
743 [ # # ][ # # ]: 0 : operator[]( PropertyDefinition( PROP_HEADER_IS_DYNAMIC_HEIGHT, false)) = uno::makeAny( false );
744 [ # # ][ # # ]: 0 : operator[]( PropertyDefinition( PROP_HEADER_DYNAMIC_SPACING, false)) = uno::makeAny( false );
745 : : }
746 : :
747 : 536 : sal_Int32 nBottomMargin = m_nBottomMargin;
748 [ + + ]: 536 : if( HasFooter( bFirstPage ) )
749 : : {
750 : 12 : m_nBottomMargin = m_nHeaderBottom;
751 [ + - ][ + - ]: 12 : if( nBottomMargin > 0 && nBottomMargin > m_nHeaderBottom )
752 : 12 : m_nHeaderBottom = nBottomMargin - m_nHeaderBottom;
753 : : else
754 : 0 : m_nHeaderBottom = 0;
755 [ - + ]: 12 : if( m_nHeaderBottom < MIN_HEAD_FOOT_HEIGHT )
756 : 0 : m_nHeaderBottom = MIN_HEAD_FOOT_HEIGHT;
757 : : }
758 : :
759 [ + - ]: 536 : if( nBottomMargin >= 0 ) //fixed height footer -> see WW8Par6.hxx
760 : : {
761 [ + - ][ + - ]: 536 : operator[]( PropertyDefinition( PROP_FOOTER_IS_DYNAMIC_HEIGHT, false )) = uno::makeAny( true );
762 [ + - ][ + - ]: 536 : operator[]( PropertyDefinition( PROP_FOOTER_DYNAMIC_SPACING, false )) = uno::makeAny( true );
763 [ + - ][ + - ]: 536 : operator[]( PropertyDefinition( PROP_FOOTER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderBottom - MIN_HEAD_FOOT_HEIGHT);
764 [ + - ]: 536 : operator[]( PropertyDefinition( PROP_FOOTER_HEIGHT, false )) = uno::makeAny( m_nHeaderBottom );
765 : : }
766 : : else
767 : : {
768 : : //todo: old filter fakes a frame into the header/footer to support overlapping
769 : : //current setting is completely wrong!
770 [ # # ][ # # ]: 0 : operator[]( PropertyDefinition( PROP_FOOTER_IS_DYNAMIC_HEIGHT, false)) = uno::makeAny( false );
771 [ # # ][ # # ]: 0 : operator[]( PropertyDefinition( PROP_FOOTER_DYNAMIC_SPACING, false)) = uno::makeAny( false );
772 [ # # ][ # # ]: 0 : operator[]( PropertyDefinition( PROP_FOOTER_HEIGHT, false )) = uno::makeAny( nBottomMargin - m_nHeaderBottom );
773 [ # # ]: 0 : operator[]( PropertyDefinition( PROP_FOOTER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderBottom );
774 : : }
775 : :
776 : : //now set the top/bottom margin for the follow page style
777 [ + - ]: 536 : operator[]( PropertyDefinition( PROP_TOP_MARGIN, false )) = uno::makeAny( m_nTopMargin );
778 [ + - ]: 536 : operator[]( PropertyDefinition( PROP_BOTTOM_MARGIN, false )) = uno::makeAny( m_nBottomMargin );
779 : :
780 : : // Restore original top margin, so we don't end up with a smaller margin in case we have to produce two page styles from one Word section.
781 : 536 : m_nTopMargin = nTopMargin;
782 : 536 : }
783 : :
784 : 521 : uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection, DomainMapper_Impl& rDM_Impl, uno::Reference<text::XTextRange> xStartingRange)
785 : : {
786 : 521 : uno::Reference< beans::XPropertySet > xRangeProperties;
787 [ + + ]: 521 : if (bIsFirstSection)
788 : : {
789 [ + - ][ + + ]: 491 : uno::Reference<container::XEnumerationAccess> xEnumAccess(rDM_Impl.GetBodyText(), uno::UNO_QUERY_THROW);
790 [ + - ][ + - ]: 470 : uno::Reference<container::XEnumeration> xEnum = xEnumAccess->createEnumeration();
791 [ + - ][ + - ]: 491 : xRangeProperties = uno::Reference<beans::XPropertySet>(xEnum->nextElement(), uno::UNO_QUERY_THROW);
[ + - ][ + - ]
792 : : }
793 : : else
794 [ + - ][ + - ]: 30 : xRangeProperties = uno::Reference<beans::XPropertySet>(xStartingRange, uno::UNO_QUERY_THROW);
795 : 521 : return xRangeProperties;
796 : : }
797 : :
798 : 524 : void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
799 : : {
800 : 524 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
801 [ - + ]: 524 : if( m_nLnnMod )
802 : : {
803 : 0 : bool bFirst = rDM_Impl.IsLineNumberingSet();
804 : 0 : rDM_Impl.SetLineNumbering( m_nLnnMod, m_nLnc, m_ndxaLnn );
805 [ # # ][ # # ]: 0 : if( m_nLnnMin > 0 || (bFirst && m_nLnc == 1))
[ # # ]
806 : : {
807 : : //set the starting value at the beginning of the section
808 : : try
809 : : {
810 : 0 : uno::Reference< beans::XPropertySet > xRangeProperties;
811 [ # # ]: 0 : if( m_xStartingRange.is() )
812 : : {
813 [ # # ][ # # ]: 0 : xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
814 : : }
815 : : else
816 : : {
817 : : //set the start value at the beginning of the document
818 [ # # ][ # # ]: 0 : xRangeProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
819 : : }
820 [ # # ][ # # ]: 0 : xRangeProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin + 1 ));
[ # # ][ # # ]
[ # # ]
821 : : }
822 : 0 : catch( const uno::Exception& )
823 : : {
824 : : OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup");
825 : : }
826 : : }
827 : : }
828 : :
829 : : //depending on the break type no page styles should be created
830 [ + + ]: 524 : if(m_nBreakType == 0)
831 : : {
832 : : //todo: insert a section or access the already inserted section
833 : : uno::Reference< beans::XPropertySet > xSection =
834 [ + - ]: 3 : rDM_Impl.appendTextSectionAfter( m_xStartingRange );
835 [ - + ][ # # ]: 3 : if( m_nColumnCount > 0 && xSection.is())
[ - + ]
836 [ # # ]: 0 : ApplyColumnProperties( xSection );
837 [ + - ]: 3 : uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
838 [ + - ][ + - ]: 3 : xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName));
[ + - ][ + - ]
[ + - ]
839 : : }
840 : : // If the section is of type "New column" (0x01), then simply insert a column break.
841 : : // But only if there actually are columns on the page, otherwise a column break
842 : : // seems to be handled like a page break by MSO.
843 [ + + ][ + + ]: 521 : else if(m_nBreakType == 1 && m_nColumnCount > 0 )
844 : : {
845 : 3 : uno::Reference< beans::XPropertySet > xRangeProperties;
846 [ + - ]: 3 : if( m_xStartingRange.is() )
847 : : {
848 [ + - ][ + - ]: 3 : xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
849 : : }
850 : : else
851 : : {
852 : : //set the start value at the beginning of the document
853 [ # # ][ # # ]: 0 : xRangeProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
854 : : }
855 [ + - ][ + - ]: 6 : xRangeProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_BREAK_TYPE ),
856 [ + - ][ + - ]: 6 : uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE));
857 : : }
858 : : else
859 : : {
860 : : //get the properties and create appropriate page styles
861 [ + - ][ + - ]: 518 : uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false );
[ + - ]
862 : :
863 [ - + ]: 518 : if( m_nDzaGutter > 0 )
864 : : {
865 : : //todo: iGutterPos from DocProperties are missing
866 [ # # ]: 0 : if( m_bGutterRTL )
867 : 0 : m_nRightMargin += m_nDzaGutter;
868 : : else
869 : 0 : m_nLeftMargin += m_nDzaGutter;
870 : : }
871 [ + - ][ + - ]: 518 : operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) = uno::makeAny( m_nLeftMargin );
872 [ + - ][ + - ]: 518 : operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = uno::makeAny( m_nRightMargin );
873 : :
874 : : /*** if headers/footers are available then the top/bottom margins of the
875 : : header/footer are copied to the top/bottom margin of the page
876 : : */
877 [ + - ]: 518 : CopyLastHeaderFooter( false, rDM_Impl );
878 [ + - ]: 518 : PrepareHeaderFooterProperties( false );
879 : :
880 [ + - ]: 518 : const OUString sTrayIndex = rPropNameSupplier.GetName( PROP_PRINTER_PAPER_TRAY_INDEX );
881 [ - + ]: 518 : if( m_nPaperBin >= 0 )
882 [ # # ][ # # ]: 0 : xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) );
[ # # ]
883 : 518 : uno::Reference< text::XTextColumns > xColumns;
884 [ + + ]: 518 : if( m_nColumnCount > 0 )
885 [ + - ][ + - ]: 3 : xColumns = ApplyColumnProperties( xFollowPageStyle );
886 : :
887 : : //prepare text grid properties
888 : 518 : sal_Int32 nHeight = 1;
889 [ + - ]: 518 : PropertyMap::iterator aElement = find(PropertyDefinition( PROP_HEIGHT, false ));
890 [ + - ]: 518 : if( aElement != end())
891 : 518 : aElement->second >>= nHeight;
892 : :
893 : 518 : sal_Int32 nWidth = 1;
894 [ + - ]: 518 : aElement = find(PropertyDefinition( PROP_WIDTH, false ));
895 [ + - ]: 518 : if( aElement != end())
896 : 518 : aElement->second >>= nWidth;
897 : :
898 : 518 : text::WritingMode eWritingMode = text::WritingMode_LR_TB;
899 [ + - ]: 518 : aElement = find(PropertyDefinition( PROP_WRITING_MODE, false ));
900 [ + + ]: 518 : if( aElement != end())
901 [ + - ]: 102 : aElement->second >>= eWritingMode;
902 : :
903 : :
904 : :
905 : : sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ?
906 : : nHeight - m_nTopMargin - m_nBottomMargin :
907 [ + - ]: 518 : nWidth - m_nLeftMargin - m_nRightMargin;
908 : :
909 [ + - ]: 518 : operator[]( PropertyDefinition( PROP_GRID_LINES, false )) =
910 [ + - ]: 1036 : uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/m_nGridLinePitch));
911 : :
912 : 518 : sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
913 : : //todo: is '0' the right index here?
914 [ + - ][ + - ]: 518 : const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(OUString::valueOf(static_cast<sal_Int32>(0), 16));
[ + - ]
915 [ + + ]: 518 : if( pEntry.get( ) )
916 : : {
917 [ + - ]: 87 : PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false ));
918 [ + - ]: 87 : if( aElement_ != pEntry->pProperties->end())
919 : : {
920 : 87 : double fHeight = 0;
921 [ + - ]: 87 : if( aElement_->second >>= fHeight )
922 [ + - ]: 87 : nCharWidth = ConversionHelper::convertTwipToMM100( (long)( fHeight * 20.0 + 0.5 ));
923 : : }
924 : : }
925 : :
926 : : //dxtCharSpace
927 [ + + ]: 518 : if(m_nDxtCharSpace)
928 : : {
929 : 9 : sal_Int32 nCharSpace = m_nDxtCharSpace;
930 : : //main lives in top 20 bits, and is signed.
931 : 9 : sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
932 : 9 : nMain /= 0x1000;
933 [ + - ]: 9 : nCharWidth += ConversionHelper::convertTwipToMM100( nMain * 20 );
934 : :
935 : 9 : sal_Int32 nFraction = (nCharSpace & 0x00000FFF);
936 : 9 : nFraction = (nFraction * 20)/0xFFF;
937 [ + - ]: 9 : nCharWidth += ConversionHelper::convertTwipToMM100( nFraction );
938 : : }
939 [ + - ][ + - ]: 518 : operator[]( PropertyDefinition( PROP_GRID_BASE_HEIGHT, false )) = uno::makeAny( nCharWidth );
940 : 518 : sal_Int32 nRubyHeight = m_nGridLinePitch - nCharWidth;
941 [ + + ]: 518 : if(nRubyHeight < 0 )
942 : 345 : nRubyHeight = 0;
943 [ + - ][ + - ]: 518 : operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight );
944 : :
945 : 518 : sal_Int16 nGridMode = text::TextGridMode::NONE;
946 : :
947 [ - - + ]: 518 : switch (m_nGridType)
948 : : {
949 : : case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines:
950 : 0 : nGridMode = text::TextGridMode::LINES;
951 : 0 : break;
952 : : case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars:
953 : 0 : nGridMode = text::TextGridMode::LINES_AND_CHARS;
954 : 0 : break;
955 : : default:
956 : 518 : break;
957 : : }
958 : :
959 [ + - ][ + - ]: 518 : operator[](PropertyDefinition(PROP_GRID_MODE, false)) = uno::makeAny(nGridMode);
960 : :
961 [ + - ]: 518 : _ApplyProperties( xFollowPageStyle );
962 : :
963 : : //todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_
964 [ + + ]: 518 : if( m_bTitlePage )
965 : : {
966 [ + - ]: 18 : CopyLastHeaderFooter( true, rDM_Impl );
967 [ + - ]: 18 : PrepareHeaderFooterProperties( true );
968 : : uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
969 [ + - ][ + - ]: 18 : rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
[ + - ]
970 [ + - ]: 18 : _ApplyProperties( xFirstPageStyle );
971 : :
972 [ - + ]: 18 : sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
973 [ - + ]: 18 : if( nPaperBin )
974 [ # # ][ # # ]: 0 : xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
[ # # ]
975 [ - + ]: 18 : if( xColumns.is() )
976 [ # # ]: 0 : xFollowPageStyle->setPropertyValue(
977 [ # # ][ # # ]: 18 : rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
[ # # ]
978 : : }
979 : :
980 [ + - ][ + - ]: 518 : ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
[ + - ]
981 : :
982 : : try
983 : : {
984 : : {
985 : : //now apply this break at the first paragraph of this section
986 [ + + ]: 518 : uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
987 : : /* break type
988 : : 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */
989 [ + - ][ + - ]: 994 : xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
990 [ + + ][ + - ]: 994 : uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
[ + + ]
991 : : // handle page breaks with odd/even page numbering
992 : 491 : style::PageStyleLayout nPageStyleLayout(style::PageStyleLayout_ALL);
993 [ + + ]: 491 : if (m_nBreakType == 3)
994 : 3 : nPageStyleLayout = style::PageStyleLayout_LEFT;
995 [ + + ]: 488 : else if (m_nBreakType == 4)
996 : 3 : nPageStyleLayout = style::PageStyleLayout_RIGHT;
997 [ + + ]: 491 : if (nPageStyleLayout)
998 [ + - ][ + - ]: 6 : xFollowPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_STYLE_LAYOUT), uno::makeAny(nPageStyleLayout));
[ + - ][ + - ]
999 [ + - ][ - + ]: 491 : if(m_bPageNoRestart || m_nPageNumber >= 0)
1000 : : {
1001 [ # # ]: 0 : sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
1002 [ # # ][ # # ]: 0 : xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
1003 [ # # ][ # # ]: 0 : uno::makeAny( nPageNumber ));
1004 [ - + ]: 518 : }
1005 : : }
1006 : : }
1007 [ + - ]: 27 : catch (const uno::Exception&)
1008 : : {
1009 : : OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup");
1010 [ + - ]: 518 : }
1011 : : }
1012 : 524 : rDM_Impl.SetIsFirstParagraphInSection(true);
1013 : 524 : }
1014 : :
1015 : :
1016 : 536 : void SectionPropertyMap::_ApplyProperties( uno::Reference< beans::XPropertySet > xStyle )
1017 : : {
1018 [ + - ]: 536 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
1019 : : uno::Reference<beans::XMultiPropertySet> const xMultiSet(xStyle,
1020 [ + - ]: 536 : uno::UNO_QUERY);
1021 [ + + ]: 536 : if (xMultiSet.is())
1022 : : { // FIXME why is "this" a STL container???
1023 [ + - ]: 515 : uno::Sequence<OUString> names(this->size());
1024 [ + - ]: 515 : uno::Sequence<uno::Any> values(this->size());
1025 : 515 : PropertyMap::iterator it = this->begin();
1026 [ + + ]: 11234 : for (size_t i = 0; it != this->end(); ++it, ++i)
1027 : : {
1028 [ + - ][ + - ]: 10719 : names[i] = rPropNameSupplier.GetName(it->first.eId);
1029 [ + - ]: 10719 : values[i] = it->second;
1030 : : }
1031 : : try
1032 : : {
1033 [ + - ][ + - ]: 515 : xMultiSet->setPropertyValues(names, values);
1034 : : }
1035 [ # # ]: 0 : catch( const uno::Exception& )
1036 : : {
1037 : : OSL_FAIL( "Exception in <PageStyle>::setPropertyValue");
1038 : : }
1039 [ + - ][ + - ]: 1051 : return;
[ # # # # ]
1040 : : }
1041 : 21 : PropertyMap::iterator aMapIter = begin();
1042 [ + + ]: 456 : while( aMapIter != end())
1043 : : {
1044 : : try
1045 : : {
1046 [ - + ]: 435 : if (xStyle.is())
1047 [ # # ][ # # ]: 0 : xStyle->setPropertyValue( rPropNameSupplier.GetName( aMapIter->first.eId ), aMapIter->second );
[ # # ]
1048 : : }
1049 [ # # ]: 0 : catch( const uno::Exception& )
1050 : : {
1051 : : OSL_FAIL( "Exception in <PageStyle>::setPropertyValue");
1052 : : }
1053 : 435 : ++aMapIter;
1054 [ + + ]: 536 : }
1055 : : }
1056 : 0 : sal_Int32 lcl_AlignPaperBin( sal_Int32 nSet )
1057 : : {
1058 : : //default tray numbers are above 0xff
1059 [ # # ]: 0 : if( nSet > 0xff )
1060 : 0 : nSet = nSet >> 8;
1061 : : //there are some special numbers which can't be handled easily
1062 : : //1, 4, 15, manual tray, upper tray, auto select? see ww8atr.cxx
1063 : : //todo: find out appropriate conversion
1064 : 0 : return nSet;
1065 : : }
1066 : :
1067 : :
1068 : 0 : void SectionPropertyMap::SetPaperBin( sal_Int32 nSet )
1069 : : {
1070 : 0 : m_nPaperBin = lcl_AlignPaperBin( nSet );
1071 : 0 : }
1072 : :
1073 : :
1074 : 0 : void SectionPropertyMap::SetFirstPaperBin( sal_Int32 nSet )
1075 : : {
1076 : 0 : m_nFirstPaperBin = lcl_AlignPaperBin( nSet );
1077 : 0 : }
1078 : :
1079 : :
1080 : 2197 : StyleSheetPropertyMap::StyleSheetPropertyMap() :
1081 : : mnCT_Spacing_line( 0 ),
1082 : : mnCT_Spacing_lineRule( 0 ),
1083 : : mbCT_TrPrBase_tblHeader( false ),
1084 : : mnCT_TrPrBase_jc( 0 ),
1085 : : mnCT_TcPrBase_vAlign( 0 ),
1086 : : mnCT_TblWidth_w( 0 ),
1087 : : mnCT_TblWidth_type( 0 ),
1088 : : mbCT_Spacing_lineSet( false ),
1089 : : mbCT_Spacing_lineRuleSet( false ),
1090 : : mbCT_TrPrBase_tblHeaderSet( false ),
1091 : : mbCT_TrPrBase_jcSet( false ),
1092 : : mbCT_TcPrBase_vAlignSet( false ),
1093 : : mbCT_TblWidth_wSet( false ),
1094 : : mbCT_TblWidth_typeSet( false ),
1095 : : mnListId( -1 ),
1096 : : mnListLevel( -1 ),
1097 [ + - ]: 2197 : mnOutlineLevel( -1 )
1098 : : {
1099 : 2197 : }
1100 : :
1101 : :
1102 [ + - ]: 2197 : StyleSheetPropertyMap::~StyleSheetPropertyMap()
1103 : : {
1104 [ - + ]: 4394 : }
1105 : :
1106 : :
1107 : 4788 : ParagraphProperties::ParagraphProperties() :
1108 : : m_bFrameMode( false ),
1109 : : m_nDropCap(NS_ooxml::LN_Value_wordprocessingml_ST_DropCap_none),
1110 : : m_nLines(0),
1111 : : m_w(-1),
1112 : : m_h(-1),
1113 : : m_nWrap(-1),
1114 : : m_hAnchor(-1),
1115 : : m_vAnchor(text::RelOrientation::FRAME),
1116 : : m_x(-1),
1117 : : m_bxValid( false ),
1118 : : m_y(-1),
1119 : : m_byValid( false ),
1120 : : m_hSpace(-1),
1121 : : m_vSpace(-1),
1122 : : m_hRule(-1),
1123 : : m_xAlign(-1),
1124 : : m_yAlign(-1),
1125 : : m_bAnchorLock(false),
1126 : 4788 : m_nDropCapLength(0)
1127 : : {
1128 : 4788 : }
1129 : :
1130 : :
1131 : 15 : ParagraphProperties::ParagraphProperties(const ParagraphProperties& rCopy) :
1132 : : m_bFrameMode ( rCopy.m_bFrameMode),
1133 : : m_nDropCap ( rCopy.m_nDropCap),
1134 : : m_nLines ( rCopy.m_nLines),
1135 : : m_w ( rCopy.m_w),
1136 : : m_h ( rCopy.m_h),
1137 : : m_nWrap ( rCopy.m_nWrap),
1138 : : m_hAnchor ( rCopy.m_hAnchor),
1139 : : m_vAnchor ( rCopy.m_vAnchor),
1140 : : m_x ( rCopy.m_x),
1141 : : m_bxValid ( rCopy.m_bxValid),
1142 : : m_y ( rCopy.m_y),
1143 : : m_byValid ( rCopy.m_byValid),
1144 : : m_hSpace ( rCopy.m_hSpace),
1145 : : m_vSpace ( rCopy.m_vSpace),
1146 : : m_hRule ( rCopy.m_hRule),
1147 : : m_xAlign ( rCopy.m_xAlign),
1148 : : m_yAlign ( rCopy.m_yAlign),
1149 : : m_bAnchorLock( rCopy.m_bAnchorLock),
1150 : : m_nDropCapLength( rCopy.m_nDropCapLength ),
1151 : : m_sParaStyleName( rCopy.m_sParaStyleName),
1152 : : m_xStartingRange( rCopy.m_xStartingRange ),
1153 : 15 : m_xEndingRange( rCopy.m_xEndingRange)
1154 : : {
1155 : 15 : }
1156 : :
1157 : :
1158 : 4803 : ParagraphProperties::~ParagraphProperties()
1159 : : {
1160 : 4803 : }
1161 : :
1162 : :
1163 : 18 : int ParagraphProperties::operator==(const ParagraphProperties& rCompare)
1164 : : {
1165 : : return
1166 : : m_bFrameMode == rCompare.m_bFrameMode &&
1167 : : m_nDropCap == rCompare.m_nDropCap &&
1168 : : m_nLines == rCompare.m_nLines &&
1169 : : m_w == rCompare.m_w &&
1170 : : m_h == rCompare.m_h &&
1171 : : m_nWrap == rCompare.m_nWrap &&
1172 : : m_hAnchor == rCompare.m_hAnchor &&
1173 : : m_vAnchor == rCompare.m_vAnchor &&
1174 : : m_x == rCompare.m_x &&
1175 : : m_bxValid == rCompare.m_bxValid &&
1176 : : m_y == rCompare.m_y &&
1177 : : m_byValid == rCompare.m_byValid &&
1178 : : m_hSpace == rCompare.m_hSpace &&
1179 : : m_vSpace == rCompare.m_vSpace &&
1180 : : m_hRule == rCompare.m_hRule &&
1181 : : m_xAlign == rCompare.m_xAlign &&
1182 : : m_yAlign == rCompare.m_yAlign &&
1183 [ + + ][ + - ]: 18 : m_bAnchorLock== rCompare.m_bAnchorLock;
[ + - ][ + + ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
1184 : : }
1185 : :
1186 : 1474 : void ParagraphProperties::ResetFrameProperties()
1187 : : {
1188 : 1474 : m_bFrameMode = false;
1189 : 1474 : m_nDropCap = NS_ooxml::LN_Value_wordprocessingml_ST_DropCap_none;
1190 : 1474 : m_nLines = 0;
1191 : 1474 : m_w = -1;
1192 : 1474 : m_h = -1;
1193 : 1474 : m_nWrap = -1;
1194 : 1474 : m_hAnchor = -1;
1195 : 1474 : m_vAnchor = text::RelOrientation::FRAME;
1196 : 1474 : m_x = -1;
1197 : 1474 : m_bxValid = false;
1198 : 1474 : m_y = -1;
1199 : 1474 : m_byValid = false;
1200 : 1474 : m_hSpace = -1;
1201 : 1474 : m_vSpace = -1;
1202 : 1474 : m_hRule = -1;
1203 : 1474 : m_xAlign = -1;
1204 : 1474 : m_yAlign = -1;
1205 : 1474 : m_bAnchorLock = false;
1206 : 1474 : m_nDropCapLength = 0;
1207 : 1474 : }
1208 : :
1209 : :
1210 [ + - ]: 2591 : ParagraphPropertyMap::ParagraphPropertyMap()
1211 : : {
1212 : 2591 : }
1213 : :
1214 : :
1215 [ + - ]: 2591 : ParagraphPropertyMap::~ParagraphPropertyMap()
1216 : : {
1217 [ - + ]: 5182 : }
1218 : :
1219 : :
1220 [ + + ]: 12537 : TablePropertyMap::TablePropertyMap()
1221 : : {
1222 : 1393 : }
1223 : :
1224 : :
1225 : 1393 : TablePropertyMap::~TablePropertyMap()
1226 : : {
1227 [ - + ]: 2786 : }
1228 : :
1229 : :
1230 : 696 : bool TablePropertyMap::getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill )
1231 : : {
1232 [ + - ]: 696 : if( eWhich < TablePropertyMapTarget_MAX )
1233 : : {
1234 [ + + ]: 696 : if(m_aValidValues[eWhich].bValid)
1235 : 87 : nFill = m_aValidValues[eWhich].nValue;
1236 : 696 : return m_aValidValues[eWhich].bValid;
1237 : : }
1238 : : else
1239 : : {
1240 : : OSL_FAIL( "invalid TablePropertyMapTarget");
1241 : 696 : return false;
1242 : : }
1243 : : }
1244 : :
1245 : :
1246 : 572 : void TablePropertyMap::setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet )
1247 : : {
1248 [ + - ]: 572 : if( eWhich < TablePropertyMapTarget_MAX )
1249 : : {
1250 : 572 : m_aValidValues[eWhich].bValid = true;
1251 : 572 : m_aValidValues[eWhich].nValue = nSet;
1252 : : }
1253 : : else
1254 : : OSL_FAIL( "invalid TablePropertyMapTarget");
1255 : 572 : }
1256 : :
1257 : :
1258 : 339 : void TablePropertyMap::insertTableProperties( const PropertyMap* pMap )
1259 : : {
1260 : : #ifdef DEBUG_DOMAINMAPPER
1261 : : dmapper_logger->startElement("TablePropertyMap.insertTableProperties");
1262 : : pMap->dumpXml(dmapper_logger);
1263 : : #endif
1264 : :
1265 [ - + ]: 339 : const TablePropertyMap* pSource = dynamic_cast< const TablePropertyMap* >(pMap);
1266 [ + + ]: 339 : if( pSource )
1267 : : {
1268 [ + + ]: 2736 : for( sal_Int32 eTarget = TablePropertyMapTarget_START;
1269 : : eTarget < TablePropertyMapTarget_MAX; ++eTarget )
1270 : : {
1271 [ + + ]: 2432 : if( pSource->m_aValidValues[eTarget].bValid )
1272 : : {
1273 : 51 : m_aValidValues[eTarget].bValid = true;
1274 : 51 : m_aValidValues[eTarget].nValue = pSource->m_aValidValues[eTarget].nValue;
1275 : : }
1276 : : }
1277 : : }
1278 : : #ifdef DEBUG_DOMAINMAPPER
1279 : : dumpXml( dmapper_logger );
1280 : : dmapper_logger->endElement();
1281 : : #endif
1282 : 339 : }
1283 : :
1284 : :
1285 : : }//namespace dmapper
1286 [ + - ][ + - ]: 60 : }//namespace writerfilter
1287 : :
1288 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|