merge the formfield patch from ooo-build
[ooovba.git] / writerfilter / source / dmapper / PropertyMap.cxx
blobc5ab25624d8290b404fad1ed86d14351c12d1810
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PropertyMap.cxx,v $
11 * $Revision: 1.25 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
31 #include <PropertyMap.hxx>
32 #include <ooxml/resourceids.hxx>
33 #include <DomainMapper_Impl.hxx>
34 #include <ConversionHelper.hxx>
35 #include <i18npool/paper.hxx>
36 #include <com/sun/star/beans/PropertyValue.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <com/sun/star/table/BorderLine.hpp>
39 #include <com/sun/star/container/XEnumeration.hpp>
40 #include <com/sun/star/container/XEnumerationAccess.hpp>
41 #include <com/sun/star/container/XNameContainer.hpp>
42 #include <com/sun/star/style/BreakType.hpp>
43 #include <com/sun/star/text/RelOrientation.hpp>
44 #include <com/sun/star/text/WritingMode.hpp>
45 #include <com/sun/star/text/XTextColumns.hpp>
46 #include <com/sun/star/text/XText.hpp>
47 #include <com/sun/star/text/XTextCopy.hpp>
49 using namespace ::com::sun::star;
51 namespace writerfilter {
52 namespace dmapper{
54 /*-- 21.06.2006 09:30:56---------------------------------------------------
56 -----------------------------------------------------------------------*/
57 PropertyMap::PropertyMap() :
58 m_cFootnoteSymbol( 0 ),
59 m_nFootnoteFontId( -1 )
62 /*-- 21.06.2006 09:30:56---------------------------------------------------
64 -----------------------------------------------------------------------*/
65 PropertyMap::~PropertyMap()
68 /*-- 20.06.2006 10:23:55---------------------------------------------------
70 -----------------------------------------------------------------------*/
71 uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues()
73 if(!m_aValues.getLength() && size())
75 m_aValues.realloc( size() );
76 ::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray();
77 //style names have to be the first elements within the property sequence
78 //otherwise they will overwrite 'hard' attributes
79 sal_Int32 nValue = 0;
80 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
81 PropertyMap::iterator aParaStyleIter = find(PropertyDefinition( PROP_PARA_STYLE_NAME, false ) );
82 if( aParaStyleIter != end())
84 pValues[nValue].Name = rPropNameSupplier.GetName( aParaStyleIter->first.eId );
85 pValues[nValue].Value = aParaStyleIter->second;
86 ++nValue;
89 PropertyMap::iterator aCharStyleIter = find(PropertyDefinition( PROP_CHAR_STYLE_NAME, false ));
90 if( aCharStyleIter != end())
92 pValues[nValue].Name = rPropNameSupplier.GetName( aCharStyleIter->first.eId );
93 pValues[nValue].Value = aCharStyleIter->second;
94 ++nValue;
96 PropertyMap::iterator aNumRuleIter = find(PropertyDefinition( PROP_NUMBERING_RULES, false ) );
97 if( aNumRuleIter != end())
99 pValues[nValue].Name = rPropNameSupplier.GetName( aNumRuleIter->first.eId );
100 pValues[nValue].Value = aNumRuleIter->second;
101 ++nValue;
103 PropertyMap::iterator aMapIter = begin();
104 for( ; nValue < m_aValues.getLength(); ++aMapIter )
106 if( aMapIter != aParaStyleIter && aMapIter != aCharStyleIter && aMapIter != aNumRuleIter )
108 pValues[nValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId );
109 pValues[nValue].Value = aMapIter->second;
110 ++nValue;
114 return m_aValues;
116 /*-------------------------------------------------------------------------
118 -----------------------------------------------------------------------*/
119 void PropertyMap::Insert( PropertyIds eId, bool bIsTextProperty, const uno::Any& rAny, bool bOverwrite )
121 // const ::rtl::OUString& rInsert = PropertyNameSupplier::
122 // GetPropertyNameSupplier().GetName(eId);
123 PropertyMap::iterator aElement = find(PropertyDefinition( eId, bIsTextProperty ) );
124 if( aElement != end())
126 if(!bOverwrite)
127 return;
128 erase( aElement );
130 _PropertyMap::insert( PropertyMap::value_type
131 (PropertyDefinition( eId, bIsTextProperty),
132 rAny ));
133 Invalidate();
135 /*-- 13.12.2006 10:46:42---------------------------------------------------
137 -----------------------------------------------------------------------*/
138 template<class T>
139 struct removeExistingElements : public ::std::unary_function<T, void>
141 PropertyMap& rMap;
143 removeExistingElements(PropertyMap& _rMap ) : rMap(_rMap) {}
144 void operator() (T x)
146 PropertyMap::iterator aElement = rMap.find(x.first);
147 if( aElement != rMap.end())
148 rMap.erase( aElement );
151 /*-- 13.12.2006 10:46:42---------------------------------------------------
153 -----------------------------------------------------------------------*/
154 void PropertyMap::insert( const PropertyMapPtr pMap, bool bOverwrite )
156 if( pMap.get() )
158 if( bOverwrite )
159 ::std::for_each( pMap->begin(), pMap->end(), removeExistingElements<PropertyMap::value_type>(*this) );
160 _PropertyMap::insert(pMap->begin(), pMap->end());
161 insertTableProperties(pMap.get());
164 /*-- 06.06.2007 15:49:09---------------------------------------------------
166 -----------------------------------------------------------------------*/
167 const uno::Reference< text::XFootnote>& PropertyMap::GetFootnote() const
169 return m_xFootnote;
171 /*-- 18.02.2008 11:23:28---------------------------------------------------
173 -----------------------------------------------------------------------*/
174 void PropertyMap::insertTableProperties( const PropertyMap* )
177 /*-- 24.07.2006 08:29:01---------------------------------------------------
179 -----------------------------------------------------------------------*/
180 SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
181 m_bIsFirstSection( bIsFirstSection )
182 ,m_nBorderParams( 0 )
183 ,m_bTitlePage( false )
184 ,m_nColumnCount( 0 )
185 ,m_nColumnDistance( 1249 )
186 ,m_bSeparatorLineIsOn( false )
187 ,m_bEvenlySpaced( false )
188 ,m_bIsLandscape( false )
189 ,m_bPageNoRestart( false )
190 ,m_nPageNumber( -1 )
191 ,m_nBreakType( -1 )
192 ,m_nPaperBin( -1 )
193 ,m_nFirstPaperBin( -1 )
194 ,m_nLeftMargin( 3175 ) //page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
195 ,m_nRightMargin( 3175 )//page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
196 ,m_nTopMargin( 2540 )
197 ,m_nBottomMargin( 2540 )
198 ,m_nHeaderTop( 1270 ) //720 twip
199 ,m_nHeaderBottom( 1270 )//720 twip
200 ,m_nDzaGutter( 0 )
201 ,m_bGutterRTL( false )
202 ,m_bSFBiDi( false )
203 ,m_nGridLinePitch( 1 )
204 ,m_nDxtCharSpace( 0 )
205 ,m_nLnnMod( 0 )
206 ,m_nLnc( 0 )
207 ,m_ndxaLnn( 0 )
208 ,m_nLnnMin( 0 )
210 static sal_Int32 nNumber = 0;
211 nSectionNumber = nNumber++;
212 memset(&m_pBorderLines, 0x00, sizeof(m_pBorderLines));
213 for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
214 m_nBorderDistances[ nBorder ] = -1;
215 //todo: set defaults in ApplyPropertiesToPageStyles
216 //initialize defaults
217 PaperInfo aLetter(PAPER_LETTER);
218 //page height, 1/100mm
219 Insert( PROP_HEIGHT, false, uno::makeAny( (sal_Int32) aLetter.getHeight() ) );
220 //page width, 1/100mm
221 Insert( PROP_WIDTH, false, uno::makeAny( (sal_Int32) aLetter.getWidth() ) );
222 //page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
223 Insert( PROP_LEFT_MARGIN, false, uno::makeAny( (sal_Int32) 3175 ) );
224 //page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
225 Insert( PROP_RIGHT_MARGIN, false, uno::makeAny( (sal_Int32) 3175 ) );
226 //page top margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
227 Insert( PROP_TOP_MARGIN, false, uno::makeAny( (sal_Int32)2540 ) );
228 //page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
229 Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( (sal_Int32) 2540 ) );
230 uno::Any aFalse( ::uno::makeAny( false ) );
231 Insert( PROP_GRID_DISPLAY, false, aFalse);
232 Insert( PROP_GRID_PRINT, false, aFalse);
236 if( m_bIsFirstSection )
238 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
239 m_sFirstPageStyleName = rPropNameSupplier.GetName( PROP_FIRST_PAGE );
240 m_sFollowPageStyleName = rPropNameSupplier.GetName( PROP_STANDARD );
243 /*-- 24.07.2006 08:29:02---------------------------------------------------
245 -----------------------------------------------------------------------*/
246 SectionPropertyMap::~SectionPropertyMap()
248 for( sal_Int16 ePos = BORDER_LEFT; ePos <= BORDER_BOTTOM; ++ePos)
249 delete m_pBorderLines[ePos];
251 /*-- 24.07.2006 08:31:07---------------------------------------------------
253 -----------------------------------------------------------------------*/
254 const ::rtl::OUString& SectionPropertyMap::GetPageStyleName( bool bFirst )
256 return bFirst ? m_sFirstPageStyleName : m_sFollowPageStyleName;
258 /*-- 24.07.2006 08:31:07---------------------------------------------------
260 -----------------------------------------------------------------------*/
261 void SectionPropertyMap::SetPageStyleName( bool bFirst, const ::rtl::OUString& rName)
263 if( bFirst )
264 m_sFirstPageStyleName = rName;
265 else
266 m_sFollowPageStyleName = rName;
268 /*-- 24.07.2006 09:41:20---------------------------------------------------
270 -----------------------------------------------------------------------*/
271 ::rtl::OUString lcl_FindUnusedPageStyleName(const uno::Sequence< ::rtl::OUString >& rPageStyleNames)
273 static const sal_Char cDefaultStyle[] = "Converted";
274 //find the hightest number x in each style with the name "cDefaultStyle+x" and
275 //return an incremented name
276 sal_Int32 nMaxIndex = 0;
277 const sal_Int32 nDefaultLength = sizeof(cDefaultStyle)/sizeof(sal_Char) - 1;
278 const ::rtl::OUString sDefaultStyle( cDefaultStyle, nDefaultLength, RTL_TEXTENCODING_ASCII_US );
280 const ::rtl::OUString* pStyleNames = rPageStyleNames.getConstArray();
281 for( sal_Int32 nStyle = 0; nStyle < rPageStyleNames.getLength(); ++nStyle)
283 if( pStyleNames[nStyle].getLength() > nDefaultLength &&
284 !rtl_ustr_compare_WithLength( sDefaultStyle, nDefaultLength, pStyleNames[nStyle], nDefaultLength))
286 sal_Int32 nIndex = pStyleNames[nStyle].copy( nDefaultLength ).toInt32();
287 if( nIndex > nMaxIndex)
288 nMaxIndex = nIndex;
291 ::rtl::OUString sRet( sDefaultStyle );
292 sRet += rtl::OUString::valueOf( nMaxIndex + 1);
293 return sRet;
296 /*-- 28.07.2006 13:00:43---------------------------------------------------
298 -----------------------------------------------------------------------*/
299 uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
300 const uno::Reference< container::XNameContainer >& xPageStyles,
301 const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
302 bool bFirst )
304 uno::Reference< beans::XPropertySet > xRet;
307 if( bFirst )
309 if( !m_sFirstPageStyleName.getLength() )
311 uno::Sequence< ::rtl::OUString > aPageStyleNames = xPageStyles->getElementNames();
312 m_sFirstPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
313 m_aFirstPageStyle = uno::Reference< beans::XPropertySet > (
314 xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle") )),
315 uno::UNO_QUERY);
316 xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
318 else if( !m_aFirstPageStyle.is() )
320 xPageStyles->getByName(m_sFirstPageStyleName) >>= m_aFirstPageStyle;
322 xRet = m_aFirstPageStyle;
324 else
326 if( !m_sFollowPageStyleName.getLength() )
328 uno::Sequence< ::rtl::OUString > aPageStyleNames = xPageStyles->getElementNames();
329 m_sFollowPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
330 m_aFollowPageStyle = uno::Reference< beans::XPropertySet > (
331 xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle") )),
332 uno::UNO_QUERY);
333 xPageStyles->insertByName( m_sFollowPageStyleName, uno::makeAny(m_aFollowPageStyle) );
335 else if(!m_aFollowPageStyle.is() )
337 xPageStyles->getByName(m_sFollowPageStyleName) >>= m_aFollowPageStyle;
339 xRet = m_aFollowPageStyle;
343 catch( const uno::Exception& )
347 return xRet;
349 /*-- 28.07.2006 10:56:26---------------------------------------------------
351 -----------------------------------------------------------------------*/
352 void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine& rBorderLine )
354 delete m_pBorderLines[ePos];
355 m_pBorderLines[ePos] = new table::BorderLine( rBorderLine );
356 m_nBorderDistances[ePos] = nLineDistance;
358 /*-- 28.07.2006 10:56:27---------------------------------------------------
360 -----------------------------------------------------------------------*/
361 void SectionPropertyMap::ApplyBorderToPageStyles(
362 const uno::Reference< container::XNameContainer >& xPageStyles,
363 const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
364 sal_Int32 nValue )
367 page border applies to:
368 nIntValue & 0x07 ->
369 0 all pages in this section
370 1 first page in this section
371 2 all pages in this section but first
372 3 whole document (all sections)
373 nIntValue & 0x18 -> page border depth 0 - in front 1- in back
374 nIntValue & 0xe0 ->
375 page border offset from:
376 0 offset from text
377 1 offset from edge of page
379 uno::Reference< beans::XPropertySet > xFirst;
380 uno::Reference< beans::XPropertySet > xSecond;
381 sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
382 //sal_Int32 bPageDepth = (nValue & 0x0018) >> 3; //unused infromation: 0 - in front 1 - in back
383 //todo: negative spacing (from ww8par6.cxx)
384 switch( nValue & 0x07)
386 case 0: /*all styles*/
387 if ( m_sFollowPageStyleName.getLength( ) > 0 )
388 xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
389 if ( m_sFirstPageStyleName.getLength( ) > 0 )
390 xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
391 break;
392 case 1: /*first page*/
393 if ( m_sFirstPageStyleName.getLength( ) > 0 )
394 xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
395 break;
396 case 2: /*left and right*/
397 if ( m_sFollowPageStyleName.getLength( ) > 0 )
398 xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
399 break;
400 case 3: //whole document?
401 //todo: how to apply a border to the whole document - find all sections or access all page styles?
402 default:
403 return;
405 //has to be sorted like enum BorderPosition: l-r-t-b
406 static const PropertyIds aBorderIds[4] =
408 PROP_LEFT_BORDER,
409 PROP_RIGHT_BORDER,
410 PROP_TOP_BORDER,
411 PROP_BOTTOM_BORDER
413 static const PropertyIds aBorderDistanceIds[4] =
415 PROP_LEFT_BORDER_DISTANCE,
416 PROP_RIGHT_BORDER_DISTANCE,
417 PROP_TOP_BORDER_DISTANCE,
418 PROP_BOTTOM_BORDER_DISTANCE
420 static const PropertyIds aMarginIds[4] =
422 PROP_LEFT_MARGIN,
423 PROP_RIGHT_MARGIN,
424 PROP_TOP_MARGIN,
425 PROP_BOTTOM_MARGIN
428 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
429 for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
431 if( m_pBorderLines[nBorder] )
433 const ::rtl::OUString sBorderName = rPropNameSupplier.GetName( aBorderIds[nBorder] );
434 xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
435 if(xSecond.is())
436 xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
438 if( m_nBorderDistances[nBorder] >= 0 )
440 SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
441 m_nBorderDistances[nBorder], nOffsetFrom );
442 if(xSecond.is())
443 SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
444 m_nBorderDistances[nBorder], nOffsetFrom );
449 void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle,
450 PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom )
452 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
454 sal_Int32 nDist = nDistance;
455 if( nOffsetFrom == 1 )
457 const ::rtl::OUString sMarginName = rPropNameSupplier.GetName( eMarginId );
458 uno::Any aMargin = xStyle->getPropertyValue( sMarginName );
459 sal_Int32 nMargin;
460 aMargin >>= nMargin;
462 // Change the margins with the border distance
463 xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance ) );
465 // Set the distance to ( Margin - distance )
466 nDist = nMargin - nDistance;
468 const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( eDistId );
469 xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
472 /*-- 14.12.2006 12:50:06---------------------------------------------------
474 -----------------------------------------------------------------------*/
475 uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
476 uno::Reference< beans::XPropertySet > xColumnContainer )
478 uno::Reference< text::XTextColumns > xColumns;
481 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
482 const ::rtl::OUString sTextColumns = rPropNameSupplier.GetName( PROP_TEXT_COLUMNS );
483 xColumnContainer->getPropertyValue(sTextColumns) >>= xColumns;
484 uno::Reference< beans::XPropertySet > xColumnPropSet( xColumns, uno::UNO_QUERY_THROW );
485 if( !m_bEvenlySpaced &&
486 (sal_Int32(m_aColWidth.size()) == (m_nColumnCount + 1 )) &&
487 (sal_Int32(m_aColDistance.size()) == m_nColumnCount))
489 //the column width in word is an absolute value, in OOo it's relative
490 //the distances are both absolute
491 sal_Int32 nColSum = 0;
492 for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)
494 nColSum += m_aColWidth[nCol];
495 if(nCol)
496 nColSum += m_aColDistance[nCol -1];
499 sal_Int32 nRefValue = xColumns->getReferenceValue();
500 double fRel = double( nRefValue ) / double( nColSum );
501 uno::Sequence< text::TextColumn > aColumns( m_nColumnCount + 1 );
502 text::TextColumn* pColumn = aColumns.getArray();
504 nColSum = 0;
505 for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)
507 //nColSum : nRefValue == (nAbsColWidth + colDist /2) : nRelColWidth;
508 pColumn[nCol].LeftMargin = nCol ? m_aColDistance[nCol - 1 ] / 2 : 0;
509 pColumn[nCol].RightMargin = nCol == m_nColumnCount ? 0 : m_aColDistance[nCol] / 2;
510 pColumn[nCol].Width = sal_Int32((double( m_aColWidth[nCol] + pColumn[nCol].RightMargin + pColumn[nCol].LeftMargin ) + 0.5 ) * fRel );
511 nColSum += pColumn[nCol].Width;
513 if( nColSum != nRefValue )
514 pColumn[m_nColumnCount].Width -= ( nColSum - nRefValue );
515 xColumns->setColumns( aColumns );
517 else
519 xColumns->setColumnCount( m_nColumnCount + 1 );
520 xColumnPropSet->setPropertyValue( rPropNameSupplier.GetName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( m_nColumnDistance ));
523 if(m_bSeparatorLineIsOn)
524 xColumnPropSet->setPropertyValue(
525 rPropNameSupplier.GetName( PROP_SEPARATOR_LINE_IS_ON ),
526 uno::makeAny( m_bSeparatorLineIsOn ));
527 xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) );
529 catch( const uno::Exception& )
531 OSL_ENSURE( false, "Exception in SectionPropertyMap::ApplyColumnProperties");
533 return xColumns;
536 /*-- 20.12.2006 09:44:16---------------------------------------------------
538 -----------------------------------------------------------------------*/
539 bool SectionPropertyMap::HasHeader(bool bFirstPage) const
541 bool bRet = false;
542 if( (bFirstPage && m_aFirstPageStyle.is()) ||( !bFirstPage && m_aFollowPageStyle.is()) )
544 if( bFirstPage )
545 m_aFirstPageStyle->getPropertyValue(
546 PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_HEADER_IS_ON) ) >>= bRet;
547 else
548 m_aFollowPageStyle->getPropertyValue(
549 PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_HEADER_IS_ON) ) >>= bRet;
551 return bRet;
553 /*-- 20.12.2006 09:44:16---------------------------------------------------
555 -----------------------------------------------------------------------*/
556 bool SectionPropertyMap::HasFooter(bool bFirstPage) const
558 bool bRet = false;
559 if( (bFirstPage && m_aFirstPageStyle.is()) ||( !bFirstPage && m_aFollowPageStyle.is()) )
561 if( bFirstPage )
562 m_aFirstPageStyle->getPropertyValue(
563 PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_FOOTER_IS_ON) ) >>= bRet;
564 else
565 m_aFollowPageStyle->getPropertyValue(
566 PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_FOOTER_IS_ON) ) >>= bRet;
568 return bRet;
570 /*-- 20.12.2006 09:41:56---------------------------------------------------
572 -----------------------------------------------------------------------*/
573 #define MIN_HEAD_FOOT_HEIGHT 100 //minimum header/footer height
575 void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl )
577 #if DEBUG
578 clog << "START>>> SectionPropertyMap::CopyLastHeaderFooter()" << endl;
579 #endif
580 SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext( );
581 if ( pLastContext )
583 uno::Reference< beans::XPropertySet > xPrevStyle = pLastContext->GetPageStyle(
584 rDM_Impl.GetPageStyles(),
585 rDM_Impl.GetTextFactory(),
586 bFirstPage );
587 uno::Reference< beans::XPropertySet > xStyle = GetPageStyle(
588 rDM_Impl.GetPageStyles(),
589 rDM_Impl.GetTextFactory(),
590 bFirstPage );
592 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
594 try {
595 // Loop over the Header and Footer properties to copy them
596 static PropertyIds aProperties[] =
598 PROP_HEADER_TEXT,
599 PROP_FOOTER_TEXT,
602 bool bHasPrevHeader = false;
603 bool bHasHeader = false;
605 rtl::OUString sHeaderIsOn = rPropNameSupplier.GetName( PROP_HEADER_IS_ON );
606 xPrevStyle->getPropertyValue( sHeaderIsOn ) >>= bHasPrevHeader;
607 xStyle->getPropertyValue( sHeaderIsOn ) >>= bHasHeader;
608 bool bCopyHeader = bHasPrevHeader && !bHasHeader;
610 if ( bCopyHeader )
611 xStyle->setPropertyValue( sHeaderIsOn, uno::makeAny( sal_True ) );
613 bool bHasPrevFooter = false;
614 bool bHasFooter = false;
616 rtl::OUString sFooterIsOn = rPropNameSupplier.GetName( PROP_FOOTER_IS_ON );
617 xPrevStyle->getPropertyValue( sFooterIsOn ) >>= bHasPrevFooter;
618 xStyle->getPropertyValue( sFooterIsOn ) >>= bHasFooter;
619 bool bCopyFooter = bHasPrevFooter && !bHasFooter;
621 if ( bCopyFooter )
622 xStyle->setPropertyValue( sFooterIsOn, uno::makeAny( sal_True ) );
624 // Copying the text properties
625 for ( int i = 0, nNbProps = 2; i < nNbProps; i++ )
627 bool bIsHeader = ( i < nNbProps / 2 );
628 PropertyIds aPropId = aProperties[i];
629 rtl::OUString sName = rPropNameSupplier.GetName( aPropId );
631 if ( ( bIsHeader && bCopyHeader ) || ( !bIsHeader && bCopyFooter ) )
633 #if DEBUG
634 clog << "Copying ";
635 clog << rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
636 #endif
637 // TODO has to be copied
638 uno::Reference< text::XTextCopy > xTxt(
639 xStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
641 uno::Reference< text::XTextCopy > xPrevTxt(
642 xPrevStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
644 xTxt->copyText( xPrevTxt );
648 catch ( const uno::Exception& e )
650 #if DEBUG
651 clog << "An exception occured in SectionPropertyMap::CopyLastHeaderFooter( ) - ";
652 clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
653 #endif
656 #if DEBUG
657 clog << "END>>> SectionPropertyMap::CopyLastHeaderFooter()" << endl;
658 #endif
661 void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
663 sal_Int32 nTopMargin = m_nTopMargin;
664 if(HasHeader(bFirstPage))
666 m_nTopMargin = m_nHeaderTop;
667 if( nTopMargin > 0 && nTopMargin > m_nHeaderTop )
668 m_nHeaderTop = nTopMargin - m_nHeaderTop;
669 else
670 m_nHeaderTop = 0;
672 //minimum header height 1mm
673 if( m_nHeaderTop < MIN_HEAD_FOOT_HEIGHT )
674 m_nHeaderTop = MIN_HEAD_FOOT_HEIGHT;
678 if( nTopMargin >= 0 ) //fixed height header -> see WW8Par6.hxx
680 operator[]( PropertyDefinition( PROP_HEADER_IS_DYNAMIC_HEIGHT, false )) = uno::makeAny( true );
681 operator[]( PropertyDefinition( PROP_HEADER_DYNAMIC_SPACING, false )) = uno::makeAny( true );
682 operator[]( PropertyDefinition( PROP_HEADER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderTop - MIN_HEAD_FOOT_HEIGHT );// ULSpace.Top()
683 operator[]( PropertyDefinition( PROP_HEADER_HEIGHT, false )) = uno::makeAny( m_nHeaderTop );
686 else
688 //todo: old filter fakes a frame into the header/footer to support overlapping
689 //current setting is completely wrong!
690 operator[]( PropertyDefinition( PROP_HEADER_HEIGHT, false )) = uno::makeAny( m_nHeaderTop );
691 operator[]( PropertyDefinition( PROP_HEADER_BODY_DISTANCE, false )) = uno::makeAny( nTopMargin - m_nHeaderTop );
692 operator[]( PropertyDefinition( PROP_HEADER_IS_DYNAMIC_HEIGHT, false)) = uno::makeAny( false );
693 operator[]( PropertyDefinition( PROP_HEADER_DYNAMIC_SPACING, false)) = uno::makeAny( false );
696 sal_Int32 nBottomMargin = m_nBottomMargin;
697 if( HasFooter( bFirstPage ) )
699 m_nBottomMargin = m_nHeaderBottom;
700 if( nBottomMargin > 0 && nBottomMargin > m_nHeaderBottom )
701 m_nHeaderBottom = nBottomMargin - m_nHeaderBottom;
702 else
703 m_nHeaderBottom = 0;
704 if( m_nHeaderBottom < MIN_HEAD_FOOT_HEIGHT )
705 m_nHeaderBottom = MIN_HEAD_FOOT_HEIGHT;
708 if( nBottomMargin >= 0 ) //fixed height footer -> see WW8Par6.hxx
710 operator[]( PropertyDefinition( PROP_FOOTER_IS_DYNAMIC_HEIGHT, false )) = uno::makeAny( true );
711 operator[]( PropertyDefinition( PROP_FOOTER_DYNAMIC_SPACING, false )) = uno::makeAny( true );
712 operator[]( PropertyDefinition( PROP_FOOTER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderBottom - MIN_HEAD_FOOT_HEIGHT);
713 operator[]( PropertyDefinition( PROP_FOOTER_HEIGHT, false )) = uno::makeAny( m_nHeaderBottom );
715 else
717 //todo: old filter fakes a frame into the header/footer to support overlapping
718 //current setting is completely wrong!
719 operator[]( PropertyDefinition( PROP_FOOTER_IS_DYNAMIC_HEIGHT, false)) = uno::makeAny( false );
720 operator[]( PropertyDefinition( PROP_FOOTER_DYNAMIC_SPACING, false)) = uno::makeAny( false );
721 operator[]( PropertyDefinition( PROP_FOOTER_HEIGHT, false )) = uno::makeAny( nBottomMargin - m_nHeaderBottom );
722 operator[]( PropertyDefinition( PROP_FOOTER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderBottom );
725 //now set the top/bottom margin for the follow page style
726 operator[]( PropertyDefinition( PROP_TOP_MARGIN, false )) = uno::makeAny( m_nTopMargin );
727 operator[]( PropertyDefinition( PROP_BOTTOM_MARGIN, false )) = uno::makeAny( m_nBottomMargin );
729 /*-- 11.12.2006 08:31:46---------------------------------------------------
731 -----------------------------------------------------------------------*/
732 void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
734 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
735 if( m_nLnnMod )
737 bool bFirst = rDM_Impl.IsLineNumberingSet();
738 rDM_Impl.SetLineNumbering( m_nLnnMod, m_nLnc, m_ndxaLnn );
739 if( m_nLnnMin > 0 || (bFirst && m_nLnc == 1))
741 //set the starting value at the beginning of the section
744 uno::Reference< beans::XPropertySet > xRangeProperties;
745 if( m_xStartingRange.is() )
747 xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
749 else
751 //set the start value at the beginning of the document
752 xRangeProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW );
754 xRangeProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin + 1 ));
756 catch( const uno::Exception& )
758 OSL_ENSURE( false, "Exception in SectionPropertyMap::CloseSectionGroup");
763 //depending on the break type no page styles should be created
764 if(m_nBreakType == 0)
766 //todo: insert a section or access the already inserted section
767 //-->debug
768 // ::rtl::OUString sSelection = m_xStartingRange->getString();
769 // sSelection.getLength();
770 //-->debug
771 uno::Reference< beans::XPropertySet > xSection =
772 rDM_Impl.appendTextSectionAfter( m_xStartingRange );
773 if( m_nColumnCount > 0 && xSection.is())
774 ApplyColumnProperties( xSection );
776 else
778 //get the properties and create appropriate page styles
779 uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false );
781 if( m_nDzaGutter > 0 )
783 //todo: iGutterPos from DocProperties are missing
784 // if( m_iGutterPos > 0 ) m_nTopMargin += m_nDzaGutter; else
785 if( m_bGutterRTL )
786 m_nRightMargin += m_nDzaGutter;
787 else
788 m_nLeftMargin += m_nDzaGutter;
790 operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) = uno::makeAny( m_nLeftMargin );
791 operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = uno::makeAny( m_nRightMargin );
793 // if( iGutterPos && fRTLGutter )
794 // m_nTopMargin += nGutter
796 /*** if headers/footers are available then the top/bottom margins of the
797 header/footer are copied to the top/bottom margin of the page
799 CopyLastHeaderFooter( false, rDM_Impl );
800 PrepareHeaderFooterProperties( false );
802 const ::rtl::OUString sTrayIndex = rPropNameSupplier.GetName( PROP_PRINTER_PAPER_TRAY_INDEX );
803 if( m_nPaperBin >= 0 )
804 xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) );
805 uno::Reference< text::XTextColumns > xColumns;
806 if( m_nColumnCount > 0 )
807 xColumns = ApplyColumnProperties( xFollowPageStyle );
809 //prepare text grid properties
810 sal_Int32 nHeight = 1;
811 PropertyMap::iterator aElement = find(PropertyDefinition( PROP_HEIGHT, false ));
812 if( aElement != end())
813 aElement->second >>= nHeight;
815 sal_Int32 nWidth = 1;
816 aElement = find(PropertyDefinition( PROP_WIDTH, false ));
817 if( aElement != end())
818 aElement->second >>= nWidth;
820 text::WritingMode eWritingMode = text::WritingMode_LR_TB;
821 aElement = find(PropertyDefinition( PROP_WRITING_MODE, false ));
822 if( aElement != end())
823 aElement->second >>= eWritingMode;
827 sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ?
828 nHeight - m_nTopMargin - m_nBottomMargin :
829 nWidth - m_nLeftMargin - m_nRightMargin;
831 operator[]( PropertyDefinition( PROP_GRID_LINES, false )) =
832 uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/m_nGridLinePitch));
834 sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
835 //todo: is '0' the right index here?
836 const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16));
837 if( pEntry.get( ) )
839 PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false ));
840 if( aElement_ != pEntry->pProperties->end())
842 double fHeight = 0;
843 if( aElement_->second >>= fHeight )
844 nCharWidth = ConversionHelper::convertTwipToMM100( (long)( fHeight * 20.0 + 0.5 ));
848 //dxtCharSpace
849 if(m_nDxtCharSpace)
851 sal_Int32 nCharSpace = m_nDxtCharSpace;
852 //main lives in top 20 bits, and is signed.
853 sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
854 nMain /= 0x1000;
855 nCharWidth += ConversionHelper::convertTwipToMM100( nMain * 20 );
857 sal_Int32 nFraction = (nCharSpace & 0x00000FFF);
858 nFraction = (nFraction * 20)/0xFFF;
859 nCharWidth += ConversionHelper::convertTwipToMM100( nFraction );
861 operator[]( PropertyDefinition( PROP_GRID_BASE_HEIGHT, false )) = uno::makeAny( nCharWidth );
862 sal_Int32 nRubyHeight = m_nGridLinePitch - nCharWidth;
863 if(nRubyHeight < 0 )
864 nRubyHeight = 0;
865 operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight );
867 _ApplyProperties( xFollowPageStyle );
869 //todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_
870 if( m_bTitlePage )
872 CopyLastHeaderFooter( true, rDM_Impl );
873 PrepareHeaderFooterProperties( true );
874 uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
875 rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
876 _ApplyProperties( xFirstPageStyle );
878 sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
879 if( nPaperBin )
880 xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
881 if( xColumns.is() )
882 xFollowPageStyle->setPropertyValue(
883 rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
886 ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
890 // if( m_xStartingRange.is() )
892 //now apply this break at the first paragraph of this section
893 uno::Reference< beans::XPropertySet > xRangeProperties;
894 if( m_bIsFirstSection )
896 uno::Reference< container::XEnumerationAccess > xEnumAccess( rDM_Impl.GetBodyText( ), uno::UNO_QUERY_THROW );
897 uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration( );
898 xRangeProperties = uno::Reference< beans::XPropertySet >( xEnum->nextElement( ), uno::UNO_QUERY_THROW );
900 else
901 xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
902 /* break type
903 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */
904 xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
905 uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
906 // todo: page breaks with odd/even page numbering are not available - find out current page number to check how to change the number
907 // or add even/odd page break types
908 if(m_bPageNoRestart || m_nPageNumber >= 0)
910 sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
911 xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
912 uno::makeAny( nPageNumber ));
916 catch( const uno::Exception& rEx)
918 OSL_ENSURE( false, "Exception in SectionPropertyMap::CloseSectionGroup");
919 (void)rEx;
923 /*-- 11.12.2006 08:31:46---------------------------------------------------
925 -----------------------------------------------------------------------*/
926 void SectionPropertyMap::_ApplyProperties( uno::Reference< beans::XPropertySet > xStyle )
928 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
929 PropertyMap::iterator aMapIter = begin();
930 while( aMapIter != end())
934 xStyle->setPropertyValue( rPropNameSupplier.GetName( aMapIter->first.eId ), aMapIter->second );
936 catch( const uno::Exception& )
938 OSL_ENSURE( false, "Exception in <PageStyle>::setPropertyValue");
940 ++aMapIter;
943 sal_Int32 lcl_AlignPaperBin( sal_Int32 nSet )
945 //default tray numbers are above 0xff
946 if( nSet > 0xff )
947 nSet = nSet >> 8;
948 //there are some special numbers which can't be handled easily
949 //1, 4, 15, manual tray, upper tray, auto select? see ww8atr.cxx
950 //todo: find out appropriate conversion
951 return nSet;
953 /*-- 13.12.2006 15:34:01---------------------------------------------------
955 -----------------------------------------------------------------------*/
956 void SectionPropertyMap::SetPaperBin( sal_Int32 nSet )
958 m_nPaperBin = lcl_AlignPaperBin( nSet );
960 /*-- 13.12.2006 15:34:01---------------------------------------------------
962 -----------------------------------------------------------------------*/
963 void SectionPropertyMap::SetFirstPaperBin( sal_Int32 nSet )
965 m_nFirstPaperBin = lcl_AlignPaperBin( nSet );
967 /*-- 14.06.2007 13:57:42---------------------------------------------------
969 -----------------------------------------------------------------------*/
970 StyleSheetPropertyMap::StyleSheetPropertyMap() :
971 // mnCT_Spacing_after( 0 ),
972 mnCT_Spacing_line( 0 ),
973 mnCT_Spacing_lineRule( 0 ),
974 mbCT_TrPrBase_tblHeader( false ),
975 mnCT_TrPrBase_jc( 0 ),
976 mnCT_TcPrBase_vAlign( 0 ),
977 mnCT_TblWidth_w( 0 ),
978 mnCT_TblWidth_type( 0 ),
979 // mbCT_Spacing_afterSet( false ),
980 mbCT_Spacing_lineSet( false ),
981 mbCT_Spacing_lineRuleSet( false ),
982 mbCT_TrPrBase_tblHeaderSet( false ),
983 mbCT_TrPrBase_jcSet( false ),
984 mbCT_TcPrBase_vAlignSet( false ),
985 mbCT_TblWidth_wSet( false ),
986 mbCT_TblWidth_typeSet( false ),
987 mnListId( -1 ),
988 mnListLevel( -1 ),
989 mnOutlineLevel( -1 )
992 /*-- 14.06.2007 13:57:43---------------------------------------------------
994 -----------------------------------------------------------------------*/
995 StyleSheetPropertyMap::~StyleSheetPropertyMap()
998 /*-- 28.12.2007 08:19:00---------------------------------------------------
1000 -----------------------------------------------------------------------*/
1001 ParagraphProperties::ParagraphProperties() :
1002 m_bFrameMode( false ),
1003 m_nDropCap(NS_ooxml::LN_Value_wordprocessingml_ST_DropCap_none),
1004 m_nLines(0),
1005 m_w(-1),
1006 m_h(-1),
1007 m_nWrap(-1),
1008 m_hAnchor(-1),
1009 m_vAnchor(text::RelOrientation::FRAME),
1010 m_x(-1),
1011 m_bxValid( false ),
1012 m_y(-1),
1013 m_byValid( false ),
1014 m_hSpace(-1),
1015 m_vSpace(-1),
1016 m_hRule(-1),
1017 m_xAlign(-1),
1018 m_yAlign(-1),
1019 m_bAnchorLock(false),
1020 m_nDropCapLength(0)
1023 /*-- 28.12.2007 08:28:24---------------------------------------------------
1025 -----------------------------------------------------------------------*/
1026 ParagraphProperties::ParagraphProperties(const ParagraphProperties& rCopy) :
1027 m_bFrameMode ( rCopy.m_bFrameMode),
1028 m_nDropCap ( rCopy.m_nDropCap),
1029 m_nLines ( rCopy.m_nLines),
1030 m_w ( rCopy.m_w),
1031 m_h ( rCopy.m_h),
1032 m_nWrap ( rCopy.m_nWrap),
1033 m_hAnchor ( rCopy.m_hAnchor),
1034 m_vAnchor ( rCopy.m_vAnchor),
1035 m_x ( rCopy.m_x),
1036 m_bxValid ( rCopy.m_bxValid),
1037 m_y ( rCopy.m_y),
1038 m_byValid ( rCopy.m_byValid),
1039 m_hSpace ( rCopy.m_hSpace),
1040 m_vSpace ( rCopy.m_vSpace),
1041 m_hRule ( rCopy.m_hRule),
1042 m_xAlign ( rCopy.m_xAlign),
1043 m_yAlign ( rCopy.m_yAlign),
1044 m_bAnchorLock( rCopy.m_bAnchorLock),
1045 m_nDropCapLength( rCopy.m_nDropCapLength ),
1046 m_sParaStyleName( rCopy.m_sParaStyleName),
1047 m_xStartingRange( rCopy.m_xStartingRange ),
1048 m_xEndingRange( rCopy.m_xEndingRange)
1051 /*-- 28.12.2007 11:29:18---------------------------------------------------
1053 -----------------------------------------------------------------------*/
1054 ParagraphProperties::~ParagraphProperties()
1057 /*-- 28.12.2007 09:05:45---------------------------------------------------
1059 -----------------------------------------------------------------------*/
1060 int ParagraphProperties::operator==(const ParagraphProperties& rCompare)
1062 return
1063 m_bFrameMode == rCompare.m_bFrameMode &&
1064 m_nDropCap == rCompare.m_nDropCap &&
1065 m_nLines == rCompare.m_nLines &&
1066 m_w == rCompare.m_w &&
1067 m_h == rCompare.m_h &&
1068 m_nWrap == rCompare.m_nWrap &&
1069 m_hAnchor == rCompare.m_hAnchor &&
1070 m_vAnchor == rCompare.m_vAnchor &&
1071 m_x == rCompare.m_x &&
1072 m_bxValid == rCompare.m_bxValid &&
1073 m_y == rCompare.m_y &&
1074 m_byValid == rCompare.m_byValid &&
1075 m_hSpace == rCompare.m_hSpace &&
1076 m_vSpace == rCompare.m_vSpace &&
1077 m_hRule == rCompare.m_hRule &&
1078 m_xAlign == rCompare.m_xAlign &&
1079 m_yAlign == rCompare.m_yAlign &&
1080 m_bAnchorLock== rCompare.m_bAnchorLock;
1082 /*-- 27.12.2007 13:32:36---------------------------------------------------
1084 -----------------------------------------------------------------------*/
1085 ParagraphPropertyMap::ParagraphPropertyMap()
1088 /*-- 27.12.2007 13:32:36---------------------------------------------------
1090 -----------------------------------------------------------------------*/
1091 ParagraphPropertyMap::~ParagraphPropertyMap()
1094 /*-- 15.02.2008 16:10:39---------------------------------------------------
1096 -----------------------------------------------------------------------*/
1097 TablePropertyMap::TablePropertyMap()
1100 /*-- 15.02.2008 16:10:39---------------------------------------------------
1102 -----------------------------------------------------------------------*/
1103 TablePropertyMap::~TablePropertyMap()
1106 /*-- 18.02.2008 10:06:30---------------------------------------------------
1108 -----------------------------------------------------------------------*/
1109 bool TablePropertyMap::getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill )
1111 if( eWhich < TablePropertyMapTarget_MAX )
1113 if(m_aValidValues[eWhich].bValid)
1114 nFill = m_aValidValues[eWhich].nValue;
1115 return m_aValidValues[eWhich].bValid;
1117 else
1119 OSL_ENSURE( false, "invalid TablePropertyMapTarget");
1120 return false;
1123 /*-- 18.02.2008 10:07:11---------------------------------------------------
1125 -----------------------------------------------------------------------*/
1126 void TablePropertyMap::setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet )
1128 if( eWhich < TablePropertyMapTarget_MAX )
1130 m_aValidValues[eWhich].bValid = true;
1131 m_aValidValues[eWhich].nValue = nSet;
1133 else
1134 OSL_ENSURE( false, "invalid TablePropertyMapTarget");
1136 /*-- 18.02.2008 11:23:28---------------------------------------------------
1138 -----------------------------------------------------------------------*/
1139 void TablePropertyMap::insertTableProperties( const PropertyMap* pMap )
1141 const TablePropertyMap* pSource = dynamic_cast< const TablePropertyMap* >(pMap);
1142 if( pSource )
1144 for( sal_Int32 eTarget = TablePropertyMapTarget_START;
1145 eTarget < TablePropertyMapTarget_MAX; ++eTarget )
1147 if( pSource->m_aValidValues[eTarget].bValid )
1149 m_aValidValues[eTarget].bValid = true;
1150 m_aValidValues[eTarget].nValue = pSource->m_aValidValues[eTarget].nValue;
1157 }//namespace dmapper
1158 }//namespace writerfilter