LCOV - code coverage report
Current view: top level - oox/source/drawingml - textparagraphproperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 141 276 51.1 %
Date: 2012-08-25 Functions: 14 22 63.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 171 367 46.6 %

           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                 :            : 
      20                 :            : #include "oox/drawingml/textparagraphproperties.hxx"
      21                 :            : 
      22                 :            : #include <com/sun/star/text/XNumberingRulesSupplier.hpp>
      23                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      24                 :            : #include <com/sun/star/text/HoriOrientation.hpp>
      25                 :            : #include <com/sun/star/awt/FontDescriptor.hpp>
      26                 :            : #include <com/sun/star/awt/XBitmap.hpp>
      27                 :            : #include <com/sun/star/graphic/XGraphic.hpp>
      28                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      29                 :            : 
      30                 :            : #include "oox/helper/helper.hxx"
      31                 :            : #include "oox/helper/propertyset.hxx"
      32                 :            : #include "oox/core/xmlfilterbase.hxx"
      33                 :            : #include "oox/drawingml/drawingmltypes.hxx"
      34                 :            : 
      35                 :            : #if OSL_DEBUG_LEVEL > 0
      36                 :            : #include <vcl/unohelp.hxx>
      37                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      38                 :            : #include <com/sun/star/text/XText.hpp>
      39                 :            : #include <com/sun/star/drawing/XShape.hpp>
      40                 :            : #include <comphelper/genericpropertyset.hxx>
      41                 :            : #include <comphelper/processfactory.hxx>
      42                 :            : #include <oox/ppt/pptimport.hxx>
      43                 :            : #include <oox/ppt/slidepersist.hxx>
      44                 :            : #endif
      45                 :            : 
      46                 :            : using rtl::OUString;
      47                 :            : using namespace ::oox::core;
      48                 :            : using namespace ::com::sun::star::uno;
      49                 :            : using namespace ::com::sun::star::beans;
      50                 :            : using namespace ::com::sun::star::style;
      51                 :            : using namespace ::com::sun::star::text;
      52                 :            : using namespace ::com::sun::star::container;
      53                 :            : using ::com::sun::star::awt::FontDescriptor;
      54                 :            : 
      55                 :            : namespace oox { namespace drawingml {
      56                 :            : 
      57                 :      15675 : BulletList::BulletList( )
      58 [ +  - ][ +  - ]:      15675 : : maBulletColorPtr( new Color() )
                 [ +  - ]
      59                 :            : {
      60                 :      15675 : }
      61                 :            : 
      62                 :        375 : bool BulletList::is() const
      63                 :            : {
      64                 :        375 :     return mnNumberingType.hasValue();
      65                 :            : }
      66                 :            : 
      67                 :         81 : void BulletList::setBulletChar( const OUString & sChar )
      68                 :            : {
      69                 :         81 :     mnNumberingType <<= NumberingType::CHAR_SPECIAL;
      70                 :         81 :     msBulletChar <<= sChar;
      71                 :         81 : }
      72                 :            : 
      73                 :          0 : void BulletList::setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic )
      74                 :            : {
      75                 :          0 :     mnNumberingType <<= NumberingType::BITMAP;
      76                 :          0 :     maGraphic <<= rXGraphic;
      77                 :          0 : }
      78                 :            : 
      79                 :         33 : void BulletList::setNone( )
      80                 :            : {
      81                 :         33 :     mnNumberingType <<= NumberingType::NUMBER_NONE;
      82                 :         33 : }
      83                 :            : 
      84                 :          0 : void BulletList::setSuffixParenBoth()
      85                 :            : {
      86         [ #  # ]:          0 :     msNumberingSuffix <<= CREATE_OUSTRING( ")" );
      87         [ #  # ]:          0 :     msNumberingPrefix <<= CREATE_OUSTRING( "(" );
      88                 :          0 : }
      89                 :            : 
      90                 :          0 : void BulletList::setSuffixParenRight()
      91                 :            : {
      92         [ #  # ]:          0 :     msNumberingSuffix <<= CREATE_OUSTRING( ")" );
      93         [ #  # ]:          0 :     msNumberingPrefix <<= OUString();
      94                 :          0 : }
      95                 :            : 
      96                 :          0 : void BulletList::setSuffixPeriod()
      97                 :            : {
      98         [ #  # ]:          0 :     msNumberingSuffix <<= CREATE_OUSTRING( "." );
      99         [ #  # ]:          0 :     msNumberingPrefix <<= OUString();
     100                 :          0 : }
     101                 :            : 
     102                 :          0 : void BulletList::setSuffixNone()
     103                 :            : {
     104         [ #  # ]:          0 :     msNumberingSuffix <<= OUString();
     105         [ #  # ]:          0 :     msNumberingPrefix <<= OUString();
     106                 :          0 : }
     107                 :            : 
     108                 :          0 : void BulletList::setSuffixMinusRight()
     109                 :            : {
     110         [ #  # ]:          0 :     msNumberingSuffix <<= CREATE_OUSTRING( "-" );
     111         [ #  # ]:          0 :     msNumberingPrefix <<= OUString();
     112                 :          0 : }
     113                 :            : 
     114                 :          0 : void BulletList::setType( sal_Int32 nType )
     115                 :            : {
     116                 :            :     OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
     117                 :            : //  OSL_TRACE( "OOX: set list numbering type %d", nType);
     118   [ #  #  #  #  :          0 :     switch( nType )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     119                 :            :     {
     120                 :            :     case XML_alphaLcParenBoth:
     121                 :          0 :         mnNumberingType <<= NumberingType::CHARS_LOWER_LETTER;
     122                 :          0 :         setSuffixParenBoth();
     123                 :          0 :         break;
     124                 :            :     case XML_alphaLcParenR:
     125                 :          0 :         mnNumberingType <<= NumberingType::CHARS_LOWER_LETTER;
     126                 :          0 :         setSuffixParenRight();
     127                 :          0 :         break;
     128                 :            :     case XML_alphaLcPeriod:
     129                 :          0 :         mnNumberingType <<= NumberingType::CHARS_LOWER_LETTER;
     130                 :          0 :         setSuffixPeriod();
     131                 :          0 :         break;
     132                 :            :     case XML_alphaUcParenBoth:
     133                 :          0 :         mnNumberingType <<= NumberingType::CHARS_UPPER_LETTER;
     134                 :          0 :         setSuffixParenBoth();
     135                 :          0 :         break;
     136                 :            :     case XML_alphaUcParenR:
     137                 :          0 :         mnNumberingType <<= NumberingType::CHARS_UPPER_LETTER;
     138                 :          0 :         setSuffixParenRight();
     139                 :          0 :         break;
     140                 :            :     case XML_alphaUcPeriod:
     141                 :          0 :         mnNumberingType <<= NumberingType::CHARS_UPPER_LETTER;
     142                 :          0 :         setSuffixPeriod();
     143                 :          0 :         break;
     144                 :            :     case XML_arabic1Minus:
     145                 :            :     case XML_arabic2Minus:
     146                 :            :     case XML_arabicDbPeriod:
     147                 :            :     case XML_arabicDbPlain:
     148                 :            :         // TODO
     149                 :          0 :         break;
     150                 :            :     case XML_arabicParenBoth:
     151                 :          0 :          mnNumberingType <<= NumberingType::ARABIC;
     152                 :          0 :         setSuffixParenBoth();
     153                 :          0 :         break;
     154                 :            :     case XML_arabicParenR:
     155                 :          0 :          mnNumberingType <<= NumberingType::ARABIC;
     156                 :          0 :         setSuffixParenRight();
     157                 :          0 :         break;
     158                 :            :     case XML_arabicPeriod:
     159                 :          0 :          mnNumberingType <<= NumberingType::ARABIC;
     160                 :          0 :         setSuffixPeriod();
     161                 :          0 :         break;
     162                 :            :     case XML_arabicPlain:
     163                 :          0 :          mnNumberingType <<= NumberingType::ARABIC;
     164                 :          0 :         setSuffixNone();
     165                 :          0 :         break;
     166                 :            :     case XML_circleNumDbPlain:
     167                 :            :     case XML_circleNumWdBlackPlain:
     168                 :            :     case XML_circleNumWdWhitePlain:
     169                 :          0 :         mnNumberingType <<= NumberingType::CIRCLE_NUMBER;
     170                 :          0 :         break;
     171                 :            :     case XML_ea1ChsPeriod:
     172                 :          0 :         mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH;
     173                 :          0 :          setSuffixPeriod();
     174                 :          0 :         break;
     175                 :            :     case XML_ea1ChsPlain:
     176                 :          0 :         mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH;
     177                 :          0 :         setSuffixNone();
     178                 :          0 :         break;
     179                 :            :     case XML_ea1ChtPeriod:
     180                 :          0 :         mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH_TW;
     181                 :          0 :          setSuffixPeriod();
     182                 :          0 :         break;
     183                 :            :     case XML_ea1ChtPlain:
     184                 :          0 :         mnNumberingType <<= NumberingType::NUMBER_UPPER_ZH_TW;
     185                 :          0 :         setSuffixNone();
     186                 :          0 :         break;
     187                 :            :     case XML_ea1JpnChsDbPeriod:
     188                 :            :     case XML_ea1JpnKorPeriod:
     189                 :            :     case XML_ea1JpnKorPlain:
     190                 :          0 :         break;
     191                 :            :     case XML_hebrew2Minus:
     192                 :          0 :         mnNumberingType <<= NumberingType::CHARS_HEBREW;
     193                 :          0 :         setSuffixMinusRight();
     194                 :          0 :         break;
     195                 :            :     case XML_hindiAlpha1Period:
     196                 :            :     case XML_hindiAlphaPeriod:
     197                 :            :     case XML_hindiNumParenR:
     198                 :            :     case XML_hindiNumPeriod:
     199                 :            :         // TODO
     200                 :          0 :         break;
     201                 :            :     case XML_romanLcParenBoth:
     202                 :          0 :         mnNumberingType <<= NumberingType::ROMAN_LOWER;
     203                 :          0 :         setSuffixParenBoth();
     204                 :          0 :         break;
     205                 :            :     case XML_romanLcParenR:
     206                 :          0 :         mnNumberingType <<= NumberingType::ROMAN_LOWER;
     207                 :          0 :         setSuffixParenRight();
     208                 :          0 :         break;
     209                 :            :     case XML_romanLcPeriod:
     210                 :          0 :         mnNumberingType <<= NumberingType::ROMAN_LOWER;
     211                 :          0 :          setSuffixPeriod();
     212                 :          0 :         break;
     213                 :            :     case XML_romanUcParenBoth:
     214                 :          0 :         mnNumberingType <<= NumberingType::ROMAN_UPPER;
     215                 :          0 :         setSuffixParenBoth();
     216                 :          0 :         break;
     217                 :            :     case XML_romanUcParenR:
     218                 :          0 :         mnNumberingType <<= NumberingType::ROMAN_UPPER;
     219                 :          0 :         setSuffixParenRight();
     220                 :          0 :         break;
     221                 :            :     case XML_romanUcPeriod:
     222                 :          0 :         mnNumberingType <<= NumberingType::ROMAN_UPPER;
     223                 :          0 :          setSuffixPeriod();
     224                 :          0 :         break;
     225                 :            :     case XML_thaiAlphaParenBoth:
     226                 :            :     case XML_thaiNumParenBoth:
     227                 :          0 :         mnNumberingType <<= NumberingType::CHARS_THAI;
     228                 :          0 :         setSuffixParenBoth();
     229                 :          0 :         break;
     230                 :            :     case XML_thaiAlphaParenR:
     231                 :            :     case XML_thaiNumParenR:
     232                 :          0 :         mnNumberingType <<= NumberingType::CHARS_THAI;
     233                 :          0 :         setSuffixParenRight();
     234                 :          0 :         break;
     235                 :            :     case XML_thaiAlphaPeriod:
     236                 :            :     case XML_thaiNumPeriod:
     237                 :          0 :         mnNumberingType <<= NumberingType::CHARS_THAI;
     238                 :          0 :          setSuffixPeriod();
     239                 :          0 :         break;
     240                 :            :     }
     241                 :          0 : }
     242                 :            : 
     243                 :         27 : void BulletList::setBulletSize(sal_Int16 nSize)
     244                 :            : {
     245                 :         27 :     mnSize <<= nSize;
     246                 :         27 : }
     247                 :            : 
     248                 :            : 
     249                 :          0 : void BulletList::setFontSize(sal_Int16 nSize)
     250                 :            : {
     251                 :          0 :     mnFontSize <<= nSize;
     252                 :          0 : }
     253                 :            : 
     254                 :       4050 : void BulletList::apply( const BulletList& rSource )
     255                 :            : {
     256         [ -  + ]:       4050 :     if ( rSource.maBulletColorPtr->isUsed() )
     257                 :          0 :         maBulletColorPtr = rSource.maBulletColorPtr;
     258         [ -  + ]:       4050 :     if ( rSource.mbBulletColorFollowText.hasValue() )
     259                 :          0 :         mbBulletColorFollowText = rSource.mbBulletColorFollowText;
     260         [ -  + ]:       4050 :     if ( rSource.mbBulletFontFollowText.hasValue() )
     261                 :          0 :         mbBulletFontFollowText = rSource.mbBulletFontFollowText;
     262                 :       4050 :     maBulletFont.assignIfUsed( rSource.maBulletFont );
     263         [ +  + ]:       4050 :     if ( rSource.msBulletChar.hasValue() )
     264                 :         54 :         msBulletChar = rSource.msBulletChar;
     265         [ -  + ]:       4050 :     if ( rSource.mnStartAt.hasValue() )
     266                 :          0 :         mnStartAt = rSource.mnStartAt;
     267         [ +  + ]:       4050 :     if ( rSource.mnNumberingType.hasValue() )
     268                 :         66 :         mnNumberingType = rSource.mnNumberingType;
     269         [ -  + ]:       4050 :     if ( rSource.msNumberingPrefix.hasValue() )
     270                 :          0 :         msNumberingPrefix = rSource.msNumberingPrefix;
     271         [ -  + ]:       4050 :     if ( rSource.msNumberingSuffix.hasValue() )
     272                 :          0 :         msNumberingSuffix = rSource.msNumberingSuffix;
     273         [ -  + ]:       4050 :     if ( rSource.mnSize.hasValue() )
     274                 :          0 :         mnSize = rSource.mnSize;
     275         [ -  + ]:       4050 :     if ( rSource.mnFontSize.hasValue() )
     276                 :          0 :         mnFontSize = rSource.mnFontSize;
     277         [ +  + ]:       4050 :     if ( rSource.maStyleName.hasValue() )
     278                 :        504 :         maStyleName = rSource.maStyleName;
     279         [ -  + ]:       4050 :     if ( rSource.maGraphic.hasValue() )
     280                 :          0 :         maGraphic = rSource.maGraphic;
     281                 :       4050 : }
     282                 :            : 
     283                 :        102 : void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& rPropMap ) const
     284                 :            : {
     285         [ -  + ]:        102 :     if( msNumberingPrefix.hasValue() )
     286         [ #  # ]:          0 :         rPropMap[ PROP_Prefix ] = msNumberingPrefix;
     287         [ -  + ]:        102 :     if( msNumberingSuffix.hasValue() )
     288         [ #  # ]:          0 :         rPropMap[ PROP_Suffix ] = msNumberingSuffix;
     289         [ -  + ]:        102 :     if( mnStartAt.hasValue() )
     290         [ #  # ]:          0 :         rPropMap[ PROP_StartWith ] = mnStartAt;
     291 [ +  - ][ +  - ]:        102 :     rPropMap[ PROP_Adjust ] <<= HoriOrientation::LEFT;
     292                 :            : 
     293         [ +  + ]:        102 :     if( mnNumberingType.hasValue() )
     294         [ +  - ]:         15 :         rPropMap[ PROP_NumberingType ] = mnNumberingType;
     295                 :            : 
     296                 :        102 :     OUString aBulletFontName;
     297                 :        102 :     sal_Int16 nBulletFontPitch = 0;
     298                 :        102 :     sal_Int16 nBulletFontFamily = 0;
     299                 :        102 :     sal_Bool bSymbolFont = sal_False;
     300         [ +  - ]:        102 :     if( pFilterBase) {
     301 [ +  - ][ +  + ]:        102 :         if (maBulletFont.getFontData( aBulletFontName, nBulletFontPitch, nBulletFontFamily, *pFilterBase ) )
     302                 :            :         {
     303                 :          9 :             FontDescriptor aFontDesc;
     304                 :          9 :             sal_Int16 nFontSize = 0;
     305         [ -  + ]:          9 :             if( mnFontSize >>= nFontSize )
     306                 :          0 :                 aFontDesc.Height = nFontSize;
     307                 :            : 
     308                 :            :             // TODO move the to the TextFont struct.
     309                 :          9 :             aFontDesc.Name = aBulletFontName;
     310                 :          9 :             aFontDesc.Pitch = nBulletFontPitch;
     311                 :          9 :             aFontDesc.Family = nBulletFontFamily;
     312 [ -  + ][ +  -  :         81 :             if ( aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Wingdings")) ||
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  +  -  -  
                      + ]
     313                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Wingdings 2")) ||
     314                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Wingdings 3")) ||
     315                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Monotype Sorts")) ||
     316                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Monotype Sorts 2")) ||
     317                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("Webdings")) ||
     318                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("StarBats")) ||
     319                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("StarMath")) ||
     320                 :          9 :                  aBulletFontName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("ZapfDingbats")) ) {
     321                 :          0 :                 aFontDesc.CharSet = RTL_TEXTENCODING_SYMBOL;
     322                 :          0 :                 bSymbolFont = sal_True;
     323                 :            :             }
     324 [ +  - ][ +  - ]:          9 :             rPropMap[ PROP_BulletFont ] <<= aFontDesc;
     325 [ +  - ][ +  - ]:          9 :             rPropMap[ PROP_BulletFontName ] <<= aBulletFontName;
     326                 :            :         }
     327                 :            :     }
     328         [ +  + ]:        102 :     if ( msBulletChar.hasValue() ) {
     329                 :          9 :         OUString sBuChar;
     330                 :            : 
     331                 :          9 :         msBulletChar >>= sBuChar;
     332                 :            : 
     333 [ +  - ][ +  - ]:          9 :         if( pFilterBase && sBuChar.getLength() == 1 && maBulletFont.getFontData( aBulletFontName, nBulletFontPitch, nBulletFontFamily, *pFilterBase ) && bSymbolFont )
         [ +  - ][ -  + ]
         [ -  + ][ +  - ]
     334                 :            :         {
     335                 :          0 :             sal_Unicode nBuChar = sBuChar.toChar();
     336                 :          0 :             nBuChar &= 0x00ff;
     337                 :          0 :             nBuChar |= 0xf000;
     338                 :          0 :             sBuChar = OUString( &nBuChar, 1 );
     339                 :            :         }
     340                 :            : 
     341 [ +  - ][ +  - ]:          9 :         rPropMap[ PROP_BulletChar ] <<= sBuChar;
     342                 :            :     }
     343         [ -  + ]:        102 :     if ( maGraphic.hasValue() )
     344                 :            :     {
     345         [ #  # ]:          0 :         Reference< com::sun::star::awt::XBitmap > xBitmap( maGraphic, UNO_QUERY );
     346         [ #  # ]:          0 :         if ( xBitmap.is() )
     347 [ #  # ][ #  # ]:          0 :             rPropMap[ PROP_Graphic ] <<= xBitmap;
     348                 :            :     }
     349         [ -  + ]:        102 :     if( mnSize.hasValue() )
     350         [ #  # ]:          0 :         rPropMap[ PROP_BulletRelSize ] = mnSize;
     351         [ +  + ]:        102 :     if ( maStyleName.hasValue() )
     352 [ +  - ][ +  - ]:         66 :         rPropMap[ PROP_CharStyleName ] <<= maStyleName;
     353         [ +  - ]:        102 :     if (pFilterBase ) {
     354         [ -  + ]:        102 :         if ( maBulletColorPtr->isUsed() )
     355 [ #  # ][ #  # ]:          0 :             rPropMap[ PROP_BulletColor ] <<= maBulletColorPtr->getColor( pFilterBase->getGraphicHelper() );
         [ #  # ][ #  # ]
     356                 :        102 :     }
     357                 :        102 : }
     358                 :            : 
     359                 :      15675 : TextParagraphProperties::TextParagraphProperties()
     360 [ +  - ][ +  - ]:      15675 : : mnLevel( 0 )
         [ +  - ][ +  - ]
     361                 :            : {
     362                 :      15675 : }
     363                 :            : 
     364 [ +  - ][ +  - ]:      15675 : TextParagraphProperties::~TextParagraphProperties()
                 [ +  - ]
     365                 :            : {
     366                 :      15675 : }
     367                 :            : 
     368                 :       4050 : void TextParagraphProperties::apply( const TextParagraphProperties& rSourceProps )
     369                 :            : {
     370                 :       4050 :     maTextParagraphPropertyMap.assignAll( rSourceProps.maTextParagraphPropertyMap );
     371                 :       4050 :     maBulletList.apply( rSourceProps.maBulletList );
     372                 :       4050 :     maTextCharacterProperties.assignUsed( rSourceProps.maTextCharacterProperties );
     373         [ +  + ]:       4050 :     if ( rSourceProps.maParaTopMargin.bHasValue )
     374                 :         66 :         maParaTopMargin = rSourceProps.maParaTopMargin;
     375         [ +  + ]:       4050 :     if ( rSourceProps.maParaBottomMargin.bHasValue )
     376                 :        540 :         maParaBottomMargin = rSourceProps.maParaBottomMargin;
     377         [ +  + ]:       4050 :     if ( rSourceProps.moParaLeftMargin )
     378                 :        432 :         moParaLeftMargin = rSourceProps.moParaLeftMargin;
     379         [ +  + ]:       4050 :     if ( rSourceProps.moFirstLineIndentation )
     380                 :         54 :         moFirstLineIndentation = rSourceProps.moFirstLineIndentation;
     381                 :       4050 : }
     382                 :            : 
     383                 :        102 : void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
     384                 :            :     const Reference < XPropertySet >& xPropSet, PropertyMap& rioBulletMap, const BulletList* pMasterBuList, sal_Bool bApplyBulletMap, float fCharacterSize,
     385                 :            :     bool bPushDefaultValues ) const
     386                 :            : {
     387         [ +  - ]:        102 :     PropertySet aPropSet( xPropSet );
     388         [ +  - ]:        102 :     aPropSet.setProperties( maTextParagraphPropertyMap );
     389                 :            : 
     390                 :        102 :     sal_Int32 nNumberingType = NumberingType::NUMBER_NONE;
     391         [ +  + ]:        102 :     if ( maBulletList.mnNumberingType.hasValue() )
     392                 :         15 :         maBulletList.mnNumberingType >>= nNumberingType;
     393 [ +  + ][ +  + ]:         87 :     else if ( pMasterBuList && pMasterBuList->mnNumberingType.hasValue() )
                 [ +  + ]
     394                 :         15 :         pMasterBuList->mnNumberingType >>= nNumberingType;
     395         [ +  + ]:        102 :     if ( nNumberingType == NumberingType::NUMBER_NONE )
     396         [ +  - ]:         84 :         aPropSet.setProperty< sal_Int16 >( PROP_NumberingLevel, -1 );
     397                 :            : 
     398         [ +  - ]:        102 :     maBulletList.pushToPropMap( pFilterBase, rioBulletMap );
     399                 :            : 
     400 [ +  + ][ +  + ]:        102 :     if ( maParaTopMargin.bHasValue || bPushDefaultValues )
     401 [ -  + ][ #  # ]:         54 :         aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 18.0 ) ) );
                 [ +  - ]
     402 [ +  + ][ +  + ]:        102 :     if ( maParaBottomMargin.bHasValue || bPushDefaultValues )
     403 [ -  + ][ #  # ]:         54 :         aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 18.0 ) ) );
                 [ +  - ]
     404         [ -  + ]:        102 :     if ( nNumberingType == NumberingType::BITMAP )
     405                 :            :     {
     406         [ #  # ]:          0 :         fCharacterSize = getCharHeightPoints( fCharacterSize );
     407                 :            : 
     408                 :          0 :         com::sun::star::awt::Size aBulletSize;
     409                 :          0 :         aBulletSize.Width = aBulletSize.Height = static_cast< sal_Int32 >( ( fCharacterSize * ( 2540.0 / 72.0 ) * 0.8 ) );
     410 [ #  # ][ #  # ]:          0 :         rioBulletMap[ PROP_GraphicSize ] <<= aBulletSize;
     411                 :            :     }
     412                 :            : 
     413         [ +  - ]:        102 :     boost::optional< sal_Int32 > noParaLeftMargin( moParaLeftMargin );
     414         [ +  - ]:        102 :     boost::optional< sal_Int32 > noFirstLineIndentation( moFirstLineIndentation );
     415                 :            : 
     416         [ +  + ]:        102 :     if ( nNumberingType != NumberingType::NUMBER_NONE )
     417                 :            :     {
     418 [ +  - ][ +  + ]:         18 :         if ( noParaLeftMargin )
     419                 :            :         {
     420 [ +  - ][ +  - ]:          9 :             rioBulletMap[ PROP_LeftMargin ] <<= static_cast< sal_Int32 >( *noParaLeftMargin );
                 [ +  - ]
     421 [ +  - ][ +  - ]:          9 :             noParaLeftMargin = boost::optional< sal_Int32 >( 0 );
                 [ +  - ]
     422                 :            :         }
     423 [ +  - ][ +  + ]:         18 :         if ( noFirstLineIndentation )
     424                 :            :         {
     425 [ +  - ][ +  - ]:          9 :             rioBulletMap[ PROP_FirstLineOffset ] <<= static_cast< sal_Int32 >( *noFirstLineIndentation );
                 [ +  - ]
     426 [ +  - ][ +  - ]:          9 :             noFirstLineIndentation = boost::optional< sal_Int32 >( 0 );
                 [ +  - ]
     427                 :            :         }
     428 [ +  - ][ +  - ]:         18 :         if ( nNumberingType != NumberingType::BITMAP && !rioBulletMap.hasProperty( PROP_BulletColor ) && pFilterBase )
         [ +  + ][ +  - ]
                 [ +  + ]
     429 [ +  - ][ +  - ]:          9 :             rioBulletMap[ PROP_BulletColor ] <<= static_cast< sal_Int32 >( maTextCharacterProperties.maCharColor.getColor( pFilterBase->getGraphicHelper()));
         [ +  - ][ +  - ]
     430                 :            :     }
     431                 :            : 
     432         [ +  - ]:        102 :     if ( bApplyBulletMap )
     433                 :            :     {
     434                 :        102 :         Reference< XIndexReplace > xNumRule;
     435         [ +  - ]:        102 :         aPropSet.getProperty( xNumRule, PROP_NumberingRules );
     436                 :            :         OSL_ENSURE( xNumRule.is(), "can't get Numbering rules");
     437                 :            : 
     438                 :            :         try
     439                 :            :         {
     440         [ +  - ]:        102 :             if( xNumRule.is() )
     441                 :            :             {
     442         [ +  - ]:        102 :                 if( !rioBulletMap.empty() )
     443                 :            :                 {
     444                 :            :                     // fix default bullet size to be 100%
     445 [ +  - ][ +  + ]:        102 :                     if( rioBulletMap.find( PROP_BulletRelSize ) == rioBulletMap.end() )
     446 [ +  - ][ +  - ]:         57 :                         rioBulletMap[ PROP_BulletRelSize ] <<= static_cast< sal_Int16 >( 100 );
     447         [ +  - ]:        102 :                     Sequence< PropertyValue > aBulletPropSeq = rioBulletMap.makePropertyValueSequence();
     448 [ +  - ][ +  - ]:        102 :                     xNumRule->replaceByIndex( getLevel(), makeAny( aBulletPropSeq ) );
         [ +  + ][ +  - ]
                 [ -  + ]
     449                 :            :                 }
     450                 :            : 
     451         [ +  - ]:         84 :                 aPropSet.setProperty( PROP_NumberingRules, xNumRule );
     452                 :            :             }
     453                 :            :         }
     454         [ +  - ]:         18 :         catch (const Exception &)
     455                 :            :         {
     456                 :            :             // Don't warn for now, expected to fail for Writer.
     457                 :        102 :         }
     458                 :            :     }
     459 [ +  - ][ +  + ]:        102 :     if ( noParaLeftMargin )
     460 [ +  - ][ +  - ]:         24 :         aPropSet.setProperty( PROP_ParaLeftMargin, sal_Int32( *noParaLeftMargin ) );
     461 [ +  - ][ +  + ]:        102 :     if ( noFirstLineIndentation )
     462 [ +  - ][ +  - ]:        102 :         aPropSet.setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation );
         [ +  - ][ +  - ]
                 [ +  - ]
     463                 :        102 : }
     464                 :            : 
     465                 :         45 : float TextParagraphProperties::getCharHeightPoints( float fDefault ) const
     466                 :            : {
     467                 :         45 :     return maTextCharacterProperties.getCharHeightPoints( fDefault );
     468                 :            : }
     469                 :            : 
     470                 :            : #ifdef DBG_UTIL
     471                 :            : // Note: Please don't remove this function. This is required for
     472                 :            : // debugging pptx import problems.
     473                 :            : void TextParagraphProperties::dump() const
     474                 :            : {
     475                 :            :     Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
     476                 :            :     Reference< ::com::sun::star::drawing::XShape > xShape( oox::ppt::PowerPointImport::mpDebugFilterBase->getModelFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.presentation.TitleTextShape" ) ), UNO_QUERY );
     477                 :            :     Reference< ::com::sun::star::text::XText > xText( xShape, UNO_QUERY );
     478                 :            : 
     479                 :            :     Reference< com::sun::star::drawing::XDrawPage > xDebugPage(ppt::SlidePersist::mxDebugPage.get(), UNO_QUERY);
     480                 :            :     if (xDebugPage.is())
     481                 :            :         xDebugPage->add( xShape );
     482                 :            : 
     483                 :            :     PropertyMap emptyMap;
     484                 :            : 
     485                 :            :     const OUString sText = CREATE_OUSTRING("debug");
     486                 :            :     xText->setString( sText );
     487                 :            :     Reference< ::com::sun::star::text::XTextCursor > xStart( xText->createTextCursor(), UNO_QUERY );
     488                 :            :     Reference< ::com::sun::star::text::XTextRange > xRange( xStart, UNO_QUERY );
     489                 :            :     xStart->gotoEnd( sal_True );
     490                 :            :     Reference< XPropertySet > xPropSet( xRange, UNO_QUERY );
     491                 :            :     pushToPropSet( NULL, xPropSet, emptyMap, NULL, false, 0 );
     492                 :            :     PropertySet pSet( xPropSet );
     493                 :            :     pSet.dump();
     494                 :            : }
     495                 :            : #endif
     496 [ +  - ][ +  - ]:        285 : } }
     497                 :            : 
     498                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10