1*ca5ec200SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ca5ec200SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ca5ec200SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ca5ec200SAndrew Rist * distributed with this work for additional information 6*ca5ec200SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ca5ec200SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ca5ec200SAndrew Rist * "License"); you may not use this file except in compliance 9*ca5ec200SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*ca5ec200SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*ca5ec200SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ca5ec200SAndrew Rist * software distributed under the License is distributed on an 15*ca5ec200SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ca5ec200SAndrew Rist * KIND, either express or implied. See the License for the 17*ca5ec200SAndrew Rist * specific language governing permissions and limitations 18*ca5ec200SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*ca5ec200SAndrew Rist *************************************************************/ 21*ca5ec200SAndrew Rist 22*ca5ec200SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "oox/drawingml/textparagraphproperties.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/text/XNumberingRulesSupplier.hpp> 27cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp> 28cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp> 29cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 30cdf0e10cSrcweir #include <com/sun/star/awt/XBitmap.hpp> 31cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp> 32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include "oox/helper/helper.hxx" 35cdf0e10cSrcweir #include "oox/helper/propertyset.hxx" 36cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx" 37cdf0e10cSrcweir #include "oox/drawingml/drawingmltypes.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir using rtl::OUString; 40cdf0e10cSrcweir using namespace ::oox::core; 41cdf0e10cSrcweir using namespace ::com::sun::star::uno; 42cdf0e10cSrcweir using namespace ::com::sun::star::beans; 43cdf0e10cSrcweir using namespace ::com::sun::star::style; 44cdf0e10cSrcweir using namespace ::com::sun::star::text; 45cdf0e10cSrcweir using namespace ::com::sun::star::container; 46cdf0e10cSrcweir using ::com::sun::star::awt::FontDescriptor; 47cdf0e10cSrcweir 48cdf0e10cSrcweir namespace oox { namespace drawingml { 49cdf0e10cSrcweir 50cdf0e10cSrcweir BulletList::BulletList( ) 51cdf0e10cSrcweir : maBulletColorPtr( new Color() ) 52cdf0e10cSrcweir { 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir bool BulletList::is() const 56cdf0e10cSrcweir { 57cdf0e10cSrcweir return mnNumberingType.hasValue(); 58cdf0e10cSrcweir } 59cdf0e10cSrcweir 60cdf0e10cSrcweir void BulletList::setBulletChar( const ::rtl::OUString & sChar ) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHAR_SPECIAL; 63cdf0e10cSrcweir msBulletChar <<= sChar; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir void BulletList::setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic ) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir mnNumberingType <<= NumberingType::BITMAP; 69cdf0e10cSrcweir maGraphic <<= rXGraphic; 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir void BulletList::setNone( ) 73cdf0e10cSrcweir { 74cdf0e10cSrcweir mnNumberingType <<= NumberingType::NUMBER_NONE; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir 77cdf0e10cSrcweir void BulletList::setSuffixParenBoth() 78cdf0e10cSrcweir { 79cdf0e10cSrcweir msNumberingSuffix <<= CREATE_OUSTRING( ")" ); 80cdf0e10cSrcweir msNumberingPrefix <<= CREATE_OUSTRING( "(" ); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir void BulletList::setSuffixParenRight() 84cdf0e10cSrcweir { 85cdf0e10cSrcweir msNumberingSuffix <<= CREATE_OUSTRING( ")" ); 86cdf0e10cSrcweir msNumberingPrefix <<= OUString(); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir void BulletList::setSuffixPeriod() 90cdf0e10cSrcweir { 91cdf0e10cSrcweir msNumberingSuffix <<= CREATE_OUSTRING( "." ); 92cdf0e10cSrcweir msNumberingPrefix <<= OUString(); 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir void BulletList::setSuffixNone() 96cdf0e10cSrcweir { 97cdf0e10cSrcweir msNumberingSuffix <<= OUString(); 98cdf0e10cSrcweir msNumberingPrefix <<= OUString(); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir void BulletList::setSuffixMinusRight() 102cdf0e10cSrcweir { 103cdf0e10cSrcweir msNumberingSuffix <<= CREATE_OUSTRING( "-" ); 104cdf0e10cSrcweir msNumberingPrefix <<= OUString(); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir void BulletList::setType( sal_Int32 nType ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir // OSL_TRACE( "OOX: set list numbering type %d", nType); 110cdf0e10cSrcweir switch( nType ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir case XML_alphaLcParenBoth: 113cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_LOWER_LETTER; 114cdf0e10cSrcweir setSuffixParenBoth(); 115cdf0e10cSrcweir break; 116cdf0e10cSrcweir case XML_alphaLcParenR: 117cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_LOWER_LETTER; 118cdf0e10cSrcweir setSuffixParenRight(); 119cdf0e10cSrcweir break; 120cdf0e10cSrcweir case XML_alphaLcPeriod: 121cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_LOWER_LETTER; 122cdf0e10cSrcweir setSuffixPeriod(); 123cdf0e10cSrcweir break; 124cdf0e10cSrcweir case XML_alphaUcParenBoth: 125cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_UPPER_LETTER; 126cdf0e10cSrcweir setSuffixParenBoth(); 127cdf0e10cSrcweir break; 128cdf0e10cSrcweir case XML_alphaUcParenR: 129cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_UPPER_LETTER; 130cdf0e10cSrcweir setSuffixParenRight(); 131cdf0e10cSrcweir break; 132cdf0e10cSrcweir case XML_alphaUcPeriod: 133cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_UPPER_LETTER; 134cdf0e10cSrcweir setSuffixPeriod(); 135cdf0e10cSrcweir break; 136cdf0e10cSrcweir case XML_arabic1Minus: 137cdf0e10cSrcweir case XML_arabic2Minus: 138cdf0e10cSrcweir case XML_arabicDbPeriod: 139cdf0e10cSrcweir case XML_arabicDbPlain: 140cdf0e10cSrcweir // TODO 141cdf0e10cSrcweir break; 142cdf0e10cSrcweir case XML_arabicParenBoth: 143cdf0e10cSrcweir mnNumberingType <<= NumberingType::ARABIC; 144cdf0e10cSrcweir setSuffixParenBoth(); 145cdf0e10cSrcweir break; 146cdf0e10cSrcweir case XML_arabicParenR: 147cdf0e10cSrcweir mnNumberingType <<= NumberingType::ARABIC; 148cdf0e10cSrcweir setSuffixParenRight(); 149cdf0e10cSrcweir break; 150cdf0e10cSrcweir case XML_arabicPeriod: 151cdf0e10cSrcweir mnNumberingType <<= NumberingType::ARABIC; 152cdf0e10cSrcweir setSuffixPeriod(); 153cdf0e10cSrcweir break; 154cdf0e10cSrcweir case XML_arabicPlain: 155cdf0e10cSrcweir mnNumberingType <<= NumberingType::ARABIC; 156cdf0e10cSrcweir setSuffixNone(); 157cdf0e10cSrcweir break; 158cdf0e10cSrcweir case XML_circleNumDbPlain: 159cdf0e10cSrcweir case XML_circleNumWdBlackPlain: 160cdf0e10cSrcweir case XML_circleNumWdWhitePlain: 161cdf0e10cSrcweir mnNumberingType <<= NumberingType::CIRCLE_NUMBER; 162cdf0e10cSrcweir break; 163cdf0e10cSrcweir case XML_ea1ChsPeriod: 164cdf0e10cSrcweir mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH; 165cdf0e10cSrcweir setSuffixPeriod(); 166cdf0e10cSrcweir break; 167cdf0e10cSrcweir case XML_ea1ChsPlain: 168cdf0e10cSrcweir mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH; 169cdf0e10cSrcweir setSuffixNone(); 170cdf0e10cSrcweir break; 171cdf0e10cSrcweir case XML_ea1ChtPeriod: 172cdf0e10cSrcweir mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH_TW; 173cdf0e10cSrcweir setSuffixPeriod(); 174cdf0e10cSrcweir break; 175cdf0e10cSrcweir case XML_ea1ChtPlain: 176cdf0e10cSrcweir mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH_TW; 177cdf0e10cSrcweir setSuffixNone(); 178cdf0e10cSrcweir break; 179cdf0e10cSrcweir case XML_ea1JpnChsDbPeriod: 180cdf0e10cSrcweir case XML_ea1JpnKorPeriod: 181cdf0e10cSrcweir case XML_ea1JpnKorPlain: 182cdf0e10cSrcweir break; 183cdf0e10cSrcweir case XML_hebrew2Minus: 184cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_HEBREW; 185cdf0e10cSrcweir setSuffixMinusRight(); 186cdf0e10cSrcweir break; 187cdf0e10cSrcweir case XML_hindiAlpha1Period: 188cdf0e10cSrcweir case XML_hindiAlphaPeriod: 189cdf0e10cSrcweir case XML_hindiNumParenR: 190cdf0e10cSrcweir case XML_hindiNumPeriod: 191cdf0e10cSrcweir // TODO 192cdf0e10cSrcweir break; 193cdf0e10cSrcweir case XML_romanLcParenBoth: 194cdf0e10cSrcweir mnNumberingType <<= NumberingType::ROMAN_LOWER; 195cdf0e10cSrcweir setSuffixParenBoth(); 196cdf0e10cSrcweir break; 197cdf0e10cSrcweir case XML_romanLcParenR: 198cdf0e10cSrcweir mnNumberingType <<= NumberingType::ROMAN_LOWER; 199cdf0e10cSrcweir setSuffixParenRight(); 200cdf0e10cSrcweir break; 201cdf0e10cSrcweir case XML_romanLcPeriod: 202cdf0e10cSrcweir mnNumberingType <<= NumberingType::ROMAN_LOWER; 203cdf0e10cSrcweir setSuffixPeriod(); 204cdf0e10cSrcweir break; 205cdf0e10cSrcweir case XML_romanUcParenBoth: 206cdf0e10cSrcweir mnNumberingType <<= NumberingType::ROMAN_UPPER; 207cdf0e10cSrcweir setSuffixParenBoth(); 208cdf0e10cSrcweir break; 209cdf0e10cSrcweir case XML_romanUcParenR: 210cdf0e10cSrcweir mnNumberingType <<= NumberingType::ROMAN_UPPER; 211cdf0e10cSrcweir setSuffixParenRight(); 212cdf0e10cSrcweir break; 213cdf0e10cSrcweir case XML_romanUcPeriod: 214cdf0e10cSrcweir mnNumberingType <<= NumberingType::ROMAN_UPPER; 215cdf0e10cSrcweir setSuffixPeriod(); 216cdf0e10cSrcweir break; 217cdf0e10cSrcweir case XML_thaiAlphaParenBoth: 218cdf0e10cSrcweir case XML_thaiNumParenBoth: 219cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_THAI; 220cdf0e10cSrcweir setSuffixParenBoth(); 221cdf0e10cSrcweir break; 222cdf0e10cSrcweir case XML_thaiAlphaParenR: 223cdf0e10cSrcweir case XML_thaiNumParenR: 224cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_THAI; 225cdf0e10cSrcweir setSuffixParenRight(); 226cdf0e10cSrcweir break; 227cdf0e10cSrcweir case XML_thaiAlphaPeriod: 228cdf0e10cSrcweir case XML_thaiNumPeriod: 229cdf0e10cSrcweir mnNumberingType <<= NumberingType::CHARS_THAI; 230cdf0e10cSrcweir setSuffixPeriod(); 231cdf0e10cSrcweir break; 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir 235cdf0e10cSrcweir void BulletList::setBulletSize(sal_Int16 nSize) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir mnSize <<= nSize; 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir 241cdf0e10cSrcweir void BulletList::setFontSize(sal_Int16 nSize) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir mnFontSize <<= nSize; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir void BulletList::apply( const BulletList& rSource ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir if ( rSource.maBulletColorPtr->isUsed() ) 249cdf0e10cSrcweir maBulletColorPtr = rSource.maBulletColorPtr; 250cdf0e10cSrcweir if ( rSource.mbBulletColorFollowText.hasValue() ) 251cdf0e10cSrcweir mbBulletColorFollowText = rSource.mbBulletColorFollowText; 252cdf0e10cSrcweir if ( rSource.mbBulletFontFollowText.hasValue() ) 253cdf0e10cSrcweir mbBulletFontFollowText = rSource.mbBulletFontFollowText; 254cdf0e10cSrcweir maBulletFont.assignIfUsed( rSource.maBulletFont ); 255cdf0e10cSrcweir if ( rSource.msBulletChar.hasValue() ) 256cdf0e10cSrcweir msBulletChar = rSource.msBulletChar; 257cdf0e10cSrcweir if ( rSource.mnStartAt.hasValue() ) 258cdf0e10cSrcweir mnStartAt = rSource.mnStartAt; 259cdf0e10cSrcweir if ( rSource.mnNumberingType.hasValue() ) 260cdf0e10cSrcweir mnNumberingType = rSource.mnNumberingType; 261cdf0e10cSrcweir if ( rSource.msNumberingPrefix.hasValue() ) 262cdf0e10cSrcweir msNumberingPrefix = rSource.msNumberingPrefix; 263cdf0e10cSrcweir if ( rSource.msNumberingSuffix.hasValue() ) 264cdf0e10cSrcweir msNumberingSuffix = rSource.msNumberingSuffix; 265cdf0e10cSrcweir if ( rSource.mnSize.hasValue() ) 266cdf0e10cSrcweir mnSize = rSource.mnSize; 267cdf0e10cSrcweir if ( rSource.mnFontSize.hasValue() ) 268cdf0e10cSrcweir mnFontSize = rSource.mnFontSize; 269cdf0e10cSrcweir if ( rSource.maStyleName.hasValue() ) 270cdf0e10cSrcweir maStyleName = rSource.maStyleName; 271cdf0e10cSrcweir if ( rSource.maGraphic.hasValue() ) 272cdf0e10cSrcweir maGraphic = rSource.maGraphic; 273cdf0e10cSrcweir } 274cdf0e10cSrcweir 275cdf0e10cSrcweir void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase& rFilterBase, PropertyMap& rPropMap ) const 276cdf0e10cSrcweir { 277cdf0e10cSrcweir if( msNumberingPrefix.hasValue() ) 278cdf0e10cSrcweir rPropMap[ PROP_Prefix ] = msNumberingPrefix; 279cdf0e10cSrcweir if( msNumberingSuffix.hasValue() ) 280cdf0e10cSrcweir rPropMap[ PROP_Suffix ] = msNumberingSuffix; 281cdf0e10cSrcweir if( mnStartAt.hasValue() ) 282cdf0e10cSrcweir rPropMap[ PROP_StartWith ] = mnStartAt; 283cdf0e10cSrcweir rPropMap[ PROP_Adjust ] <<= HoriOrientation::LEFT; 284cdf0e10cSrcweir 285cdf0e10cSrcweir if( mnNumberingType.hasValue() ) 286cdf0e10cSrcweir rPropMap[ PROP_NumberingType ] = mnNumberingType; 287cdf0e10cSrcweir 288cdf0e10cSrcweir OUString aBulletFontName; 289cdf0e10cSrcweir sal_Int16 nBulletFontPitch = 0; 290cdf0e10cSrcweir sal_Int16 nBulletFontFamily = 0; 291cdf0e10cSrcweir if( maBulletFont.getFontData( aBulletFontName, nBulletFontPitch, nBulletFontFamily, rFilterBase ) ) 292cdf0e10cSrcweir { 293cdf0e10cSrcweir FontDescriptor aFontDesc; 294cdf0e10cSrcweir sal_Int16 nFontSize = 0; 295cdf0e10cSrcweir if( mnFontSize >>= nFontSize ) 296cdf0e10cSrcweir aFontDesc.Height = nFontSize; 297cdf0e10cSrcweir 298cdf0e10cSrcweir // TODO move the to the TextFont struct. 299cdf0e10cSrcweir aFontDesc.Name = aBulletFontName; 300cdf0e10cSrcweir aFontDesc.Pitch = nBulletFontPitch; 301cdf0e10cSrcweir aFontDesc.Family = nBulletFontFamily; 302cdf0e10cSrcweir rPropMap[ PROP_BulletFont ] <<= aFontDesc; 303cdf0e10cSrcweir rPropMap[ PROP_BulletFontName ] <<= aBulletFontName; 304cdf0e10cSrcweir } 305cdf0e10cSrcweir if ( msBulletChar.hasValue() ) 306cdf0e10cSrcweir rPropMap[ PROP_BulletChar ] = msBulletChar; 307cdf0e10cSrcweir if ( maGraphic.hasValue() ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir Reference< com::sun::star::awt::XBitmap > xBitmap( maGraphic, UNO_QUERY ); 310cdf0e10cSrcweir if ( xBitmap.is() ) 311cdf0e10cSrcweir rPropMap[ PROP_Graphic ] <<= xBitmap; 312cdf0e10cSrcweir } 313cdf0e10cSrcweir if( mnSize.hasValue() ) 314cdf0e10cSrcweir rPropMap[ PROP_BulletRelSize ] = mnSize; 315cdf0e10cSrcweir if ( maStyleName.hasValue() ) 316cdf0e10cSrcweir rPropMap[ PROP_CharStyleName ] <<= maStyleName; 317cdf0e10cSrcweir if ( maBulletColorPtr->isUsed() ) 318cdf0e10cSrcweir rPropMap[ PROP_BulletColor ] <<= maBulletColorPtr->getColor( rFilterBase.getGraphicHelper() ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir TextParagraphProperties::TextParagraphProperties() 322cdf0e10cSrcweir : mnLevel( 0 ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir } 325cdf0e10cSrcweir 326cdf0e10cSrcweir TextParagraphProperties::~TextParagraphProperties() 327cdf0e10cSrcweir { 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir void TextParagraphProperties::apply( const TextParagraphProperties& rSourceProps ) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir maTextParagraphPropertyMap.insert( rSourceProps.maTextParagraphPropertyMap.begin(), rSourceProps.maTextParagraphPropertyMap.end() ); 333cdf0e10cSrcweir maBulletList.apply( rSourceProps.maBulletList ); 334cdf0e10cSrcweir maTextCharacterProperties.assignUsed( rSourceProps.maTextCharacterProperties ); 335cdf0e10cSrcweir if ( rSourceProps.maParaTopMargin.bHasValue ) 336cdf0e10cSrcweir maParaTopMargin = rSourceProps.maParaTopMargin; 337cdf0e10cSrcweir if ( rSourceProps.maParaBottomMargin.bHasValue ) 338cdf0e10cSrcweir maParaBottomMargin = rSourceProps.maParaBottomMargin; 339cdf0e10cSrcweir if ( rSourceProps.moParaLeftMargin ) 340cdf0e10cSrcweir moParaLeftMargin = rSourceProps.moParaLeftMargin; 341cdf0e10cSrcweir if ( rSourceProps.moFirstLineIndentation ) 342cdf0e10cSrcweir moFirstLineIndentation = rSourceProps.moFirstLineIndentation; 343cdf0e10cSrcweir } 344cdf0e10cSrcweir 345cdf0e10cSrcweir void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase, 346cdf0e10cSrcweir const Reference < XPropertySet >& xPropSet, PropertyMap& rioBulletMap, const BulletList* pMasterBuList, sal_Bool bApplyBulletMap, float fCharacterSize ) const 347cdf0e10cSrcweir { 348cdf0e10cSrcweir PropertySet aPropSet( xPropSet ); 349cdf0e10cSrcweir aPropSet.setProperties( maTextParagraphPropertyMap ); 350cdf0e10cSrcweir 351cdf0e10cSrcweir sal_Int32 nNumberingType = NumberingType::NUMBER_NONE; 352cdf0e10cSrcweir if ( maBulletList.mnNumberingType.hasValue() ) 353cdf0e10cSrcweir maBulletList.mnNumberingType >>= nNumberingType; 354cdf0e10cSrcweir else if ( pMasterBuList && pMasterBuList->mnNumberingType.hasValue() ) 355cdf0e10cSrcweir pMasterBuList->mnNumberingType >>= nNumberingType; 356cdf0e10cSrcweir if ( nNumberingType == NumberingType::NUMBER_NONE ) 357cdf0e10cSrcweir aPropSet.setProperty< sal_Int16 >( PROP_NumberingLevel, -1 ); 358cdf0e10cSrcweir 359cdf0e10cSrcweir maBulletList.pushToPropMap( rFilterBase, rioBulletMap ); 360cdf0e10cSrcweir 361cdf0e10cSrcweir if ( maParaTopMargin.bHasValue ) 362cdf0e10cSrcweir aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( getCharHeightPoints( 18.0 ) ) ); 363cdf0e10cSrcweir if ( maParaBottomMargin.bHasValue ) 364cdf0e10cSrcweir aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( getCharHeightPoints( 18.0 ) ) ); 365cdf0e10cSrcweir if ( nNumberingType == NumberingType::BITMAP ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir fCharacterSize = getCharHeightPoints( fCharacterSize ); 368cdf0e10cSrcweir 369cdf0e10cSrcweir com::sun::star::awt::Size aBulletSize; 370cdf0e10cSrcweir aBulletSize.Width = aBulletSize.Height = static_cast< sal_Int32 >( ( fCharacterSize * ( 2540.0 / 72.0 ) * 0.8 ) ); 371cdf0e10cSrcweir rioBulletMap[ PROP_GraphicSize ] <<= aBulletSize; 372cdf0e10cSrcweir } 373cdf0e10cSrcweir 374cdf0e10cSrcweir boost::optional< sal_Int32 > noParaLeftMargin( moParaLeftMargin ); 375cdf0e10cSrcweir boost::optional< sal_Int32 > noFirstLineIndentation( moFirstLineIndentation ); 376cdf0e10cSrcweir 377cdf0e10cSrcweir if ( nNumberingType != NumberingType::NUMBER_NONE ) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir if ( noParaLeftMargin ) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir rioBulletMap[ PROP_LeftMargin ] <<= static_cast< sal_Int32 >( *noParaLeftMargin ); 382cdf0e10cSrcweir noParaLeftMargin = boost::optional< sal_Int32 >( 0 ); 383cdf0e10cSrcweir } 384cdf0e10cSrcweir if ( noFirstLineIndentation ) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir rioBulletMap[ PROP_FirstLineOffset ] <<= static_cast< sal_Int32 >( *noFirstLineIndentation ); 387cdf0e10cSrcweir noFirstLineIndentation = boost::optional< sal_Int32 >( 0 ); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir } 390cdf0e10cSrcweir 391cdf0e10cSrcweir if ( bApplyBulletMap ) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir Reference< XIndexReplace > xNumRule; 394cdf0e10cSrcweir aPropSet.getProperty( xNumRule, PROP_NumberingRules ); 395cdf0e10cSrcweir OSL_ENSURE( xNumRule.is(), "can't get Numbering rules"); 396cdf0e10cSrcweir 397cdf0e10cSrcweir if( xNumRule.is() ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir if( !rioBulletMap.empty() ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir Sequence< PropertyValue > aBulletPropSeq = rioBulletMap.makePropertyValueSequence(); 402cdf0e10cSrcweir xNumRule->replaceByIndex( getLevel(), makeAny( aBulletPropSeq ) ); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir 405cdf0e10cSrcweir aPropSet.setProperty( PROP_NumberingRules, xNumRule ); 406cdf0e10cSrcweir } 407cdf0e10cSrcweir } 408cdf0e10cSrcweir if ( noParaLeftMargin ) 409cdf0e10cSrcweir aPropSet.setProperty( PROP_ParaLeftMargin, *noParaLeftMargin ); 410cdf0e10cSrcweir if ( noFirstLineIndentation ) 411cdf0e10cSrcweir aPropSet.setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation ); 412cdf0e10cSrcweir } 413cdf0e10cSrcweir 414cdf0e10cSrcweir float TextParagraphProperties::getCharHeightPoints( float fDefault ) const 415cdf0e10cSrcweir { 416cdf0e10cSrcweir return maTextCharacterProperties.getCharHeightPoints( fDefault ); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir 419cdf0e10cSrcweir } } 420