LCOV - code coverage report
Current view: top level - sd/source/filter/eppt - pptx-text.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 741 0.3 %
Date: 2012-08-25 Functions: 2 39 5.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 1284 0.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "text.hxx"
      30                 :            : 
      31                 :            : #include <com/sun/star/awt/CharSet.hpp>
      32                 :            : #include <com/sun/star/awt/FontWeight.hpp>
      33                 :            : #include <com/sun/star/awt/FontUnderline.hpp>
      34                 :            : #include <com/sun/star/beans/XPropertyState.hpp>
      35                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      36                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      37                 :            : #include <com/sun/star/i18n/XBreakIterator.hpp>
      38                 :            : #include <com/sun/star/i18n/ScriptDirection.hpp>
      39                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      40                 :            : #include <com/sun/star/text/FontRelief.hpp>
      41                 :            : #include <com/sun/star/text/XTextField.hpp>
      42                 :            : #include <com/sun/star/text/XTextRange.hpp>
      43                 :            : #include <com/sun/star/style/LineSpacing.hpp>
      44                 :            : #include <com/sun/star/style/LineSpacingMode.hpp>
      45                 :            : #include <com/sun/star/style/ParagraphAdjust.hpp>
      46                 :            : #include <com/sun/star/style/TabStop.hpp>
      47                 :            : 
      48                 :            : #include <comphelper/processfactory.hxx>
      49                 :            : #include <editeng/svxenum.hxx>
      50                 :            : #include <editeng/frmdir.hxx>
      51                 :            : #include <filter/msfilter/util.hxx>
      52                 :            : #include <i18nutil/scripttypedetector.hxx>
      53                 :            : #include <sfx2/app.hxx>
      54                 :            : #include <svl/languageoptions.hxx>
      55                 :            : #include <oox/export/drawingml.hxx> // for SubstituteBullet
      56                 :            : #include <vcl/metric.hxx>
      57                 :            : #include <vcl/outdev.hxx>
      58                 :            : #include <vcl/virdev.hxx>
      59                 :            : 
      60                 :          3 : com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xPPTBreakIter;
      61                 :            : 
      62                 :          0 : PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
      63                 :            :                 FontCollection& rFontCollection ) :
      64                 :            :     mnCharAttrHard      ( 0 ),
      65                 :            :     mnCharAttr          ( 0 ),
      66                 :            :     mnFont              ( 0 ),
      67                 :            :     mnAsianOrComplexFont( 0xffff ),
      68                 :            :     mnTextSize          ( 0 ),
      69                 :            :     mbLastPortion       ( sal_True ),
      70                 :            :     mpText              ( NULL ),
      71                 :          0 :     mpFieldEntry        ( NULL )
      72                 :            : {
      73         [ #  # ]:          0 :     mXPropSet = rXPropSet;
      74                 :            : 
      75         [ #  # ]:          0 :     ImplGetPortionValues( rFontCollection, sal_False );
      76                 :          0 : }
      77                 :            : 
      78                 :          0 : PortionObj::PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRange,
      79                 :            :                             sal_Bool bLast, FontCollection& rFontCollection ) :
      80                 :            :     mnCharAttrHard          ( 0 ),
      81                 :            :     mnCharAttr              ( 0 ),
      82                 :            :     mnFont                  ( 0 ),
      83                 :            :     mnAsianOrComplexFont    ( 0xffff ),
      84                 :            :     mbLastPortion           ( bLast ),
      85                 :            :     mpText                  ( NULL ),
      86                 :          0 :     mpFieldEntry            ( NULL )
      87                 :            : {
      88 [ #  # ][ #  # ]:          0 :     String aString( rXTextRange->getString() );
                 [ #  # ]
      89         [ #  # ]:          0 :     String aURL;
      90                 :          0 :     sal_Bool bRTL_endingParen = sal_False;
      91                 :            : 
      92                 :          0 :     mnTextSize = aString.Len();
      93         [ #  # ]:          0 :     if ( bLast )
      94                 :          0 :         mnTextSize++;
      95                 :            : 
      96         [ #  # ]:          0 :     if ( mnTextSize )
      97                 :            :     {
      98                 :          0 :         mpFieldEntry = NULL;
      99                 :          0 :         sal_uInt32 nFieldType = 0;
     100                 :            : 
     101                 :            :         mXPropSet = ::com::sun::star::uno::Reference<
     102                 :            :             ::com::sun::star::beans::XPropertySet >
     103 [ #  # ][ #  # ]:          0 :                 ( rXTextRange, ::com::sun::star::uno::UNO_QUERY );
     104                 :            :         mXPropState = ::com::sun::star::uno::Reference<
     105                 :            :             ::com::sun::star::beans::XPropertyState >
     106 [ #  # ][ #  # ]:          0 :                 ( rXTextRange, ::com::sun::star::uno::UNO_QUERY );
     107                 :            : 
     108 [ #  # ][ #  # ]:          0 :         sal_Bool bPropSetsValid = ( mXPropSet.is() && mXPropState.is() );
     109         [ #  # ]:          0 :         if ( bPropSetsValid )
     110         [ #  # ]:          0 :             nFieldType = ImplGetTextField( rXTextRange, mXPropSet, aURL );
     111         [ #  # ]:          0 :         if ( nFieldType )
     112                 :            :         {
     113 [ #  # ][ #  # ]:          0 :             mpFieldEntry = new FieldEntry( nFieldType, 0, mnTextSize );
     114         [ #  # ]:          0 :             if ( ( nFieldType >> 28 == 4 ) )
     115                 :            :             {
     116         [ #  # ]:          0 :                 mpFieldEntry->aRepresentation = aString;
     117         [ #  # ]:          0 :                 mpFieldEntry->aFieldUrl = aURL;
     118                 :            :             }
     119                 :            :         }
     120                 :          0 :         sal_Bool bSymbol = sal_False;
     121                 :            : 
     122 [ #  # ][ #  # ]:          0 :         if ( bPropSetsValid && ImplGetPropertyValue( rtl::OUString( "CharFontCharSet" ), sal_False ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
             #  #  #  # ]
     123                 :            :         {
     124                 :          0 :             sal_Int16 nCharset = 0;
     125                 :          0 :             mAny >>= nCharset;
     126         [ #  # ]:          0 :             if ( nCharset == ::com::sun::star::awt::CharSet::SYMBOL )
     127                 :          0 :                 bSymbol = sal_True;
     128                 :            :         }
     129 [ #  # ][ #  # ]:          0 :         if ( mpFieldEntry && ( nFieldType & 0x800000 ) )    // placeholder ?
     130                 :            :         {
     131                 :          0 :             mnTextSize = 1;
     132         [ #  # ]:          0 :             if ( bLast )
     133                 :          0 :                 mnTextSize++;
     134         [ #  # ]:          0 :             mpText = new sal_uInt16[ mnTextSize ];
     135                 :          0 :             mpText[ 0 ] = 0x2a;
     136                 :            :         }
     137                 :            :         else
     138                 :            :         {
     139                 :          0 :             const sal_Unicode* pText = aString.GetBuffer();
     140                 :            :             // For i39516 - a closing parenthesis that ends an RTL string is displayed backwards by PPT
     141                 :            :             // Solution: add a Unicode Right-to-Left Mark, following the method described in i18024
     142 [ #  # ][ #  # ]:          0 :             if ( bLast && pText[ aString.Len() - 1 ] == sal_Unicode(')') && rFontCollection.GetScriptDirection( aString ) == com::sun::star::i18n::ScriptDirection::RIGHT_TO_LEFT )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     143                 :            :             {
     144                 :          0 :                 mnTextSize++;
     145                 :          0 :                 bRTL_endingParen = sal_True;
     146                 :            :             }
     147         [ #  # ]:          0 :             mpText = new sal_uInt16[ mnTextSize ];
     148                 :            :             sal_uInt16 nChar;
     149         [ #  # ]:          0 :             for ( int i = 0; i < aString.Len(); i++ )
     150                 :            :             {
     151                 :          0 :                 nChar = (sal_uInt16)pText[ i ];
     152         [ #  # ]:          0 :                 if ( nChar == 0xa )
     153                 :          0 :                     nChar++;
     154         [ #  # ]:          0 :                 else if ( !bSymbol )
     155                 :            :                 {
     156   [ #  #  #  #  :          0 :                     switch ( nChar )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     157                 :            :                     {
     158                 :            :                         // Currency
     159                 :          0 :                         case 128:   nChar = 0x20AC; break;
     160                 :            :                         // Punctuation and other
     161                 :          0 :                         case 130:   nChar = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK
     162                 :          0 :                         case 131:   nChar = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK
     163                 :          0 :                         case 132:   nChar = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK
     164                 :            :                                                               // LOW DOUBLE PRIME QUOTATION MARK
     165                 :          0 :                         case 133:   nChar = 0x2026; break;// HORIZONTAL ELLIPSES
     166                 :          0 :                         case 134:   nChar = 0x2020; break;// DAGGER
     167                 :          0 :                         case 135:   nChar = 0x2021; break;// DOUBLE DAGGER
     168                 :          0 :                         case 136:   nChar = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT
     169                 :          0 :                         case 137:   nChar = 0x2030; break;// PER MILLE SIGN
     170                 :          0 :                         case 138:   nChar = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON
     171                 :          0 :                         case 139:   nChar = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK
     172                 :          0 :                         case 140:   nChar = 0x0152; break;// LATIN CAPITAL LIGATURE OE
     173                 :          0 :                         case 142:   nChar = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON
     174                 :          0 :                         case 145:   nChar = 0x2018; break;// LEFT SINGLE QUOTATION MARK
     175                 :            :                                                               // MODIFIER LETTER TURNED COMMA
     176                 :          0 :                         case 146:   nChar = 0x2019; break;// RIGHT SINGLE QUOTATION MARK
     177                 :            :                                                               // MODIFIER LETTER APOSTROPHE
     178                 :          0 :                         case 147:   nChar = 0x201C; break;// LEFT DOUBLE QUOTATION MARK
     179                 :            :                                                               // REVERSED DOUBLE PRIME QUOTATION MARK
     180                 :          0 :                         case 148:   nChar = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK
     181                 :            :                                                               // REVERSED DOUBLE PRIME QUOTATION MARK
     182                 :          0 :                         case 149:   nChar = 0x2022; break;// BULLET
     183                 :          0 :                         case 150:   nChar = 0x2013; break;// EN DASH
     184                 :          0 :                         case 151:   nChar = 0x2014; break;// EM DASH
     185                 :          0 :                         case 152:   nChar = 0x02DC; break;// SMALL TILDE
     186                 :          0 :                         case 153:   nChar = 0x2122; break;// TRADE MARK SIGN
     187                 :          0 :                         case 154:   nChar = 0x0161; break;// LATIN SMALL LETTER S WITH CARON
     188                 :          0 :                         case 155:   nChar = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
     189                 :          0 :                         case 156:   nChar = 0x0153; break;// LATIN SMALL LIGATURE OE
     190                 :          0 :                         case 158:   nChar = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON
     191                 :          0 :                         case 159:   nChar = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS
     192                 :            :                     }
     193                 :            :                 }
     194                 :          0 :                 mpText[ i ] = nChar;
     195                 :            :             }
     196                 :            :         }
     197         [ #  # ]:          0 :         if ( bRTL_endingParen )
     198                 :          0 :             mpText[ mnTextSize - 2 ] = 0x200F; // Unicode Right-to-Left mark
     199                 :            : 
     200         [ #  # ]:          0 :         if ( bLast )
     201                 :          0 :             mpText[ mnTextSize - 1 ] = 0xd;
     202                 :            : 
     203         [ #  # ]:          0 :         if ( bPropSetsValid )
     204         [ #  # ]:          0 :             ImplGetPortionValues( rFontCollection, sal_True );
     205 [ #  # ][ #  # ]:          0 :     }
     206                 :          0 : }
     207                 :            : 
     208                 :          0 : PortionObj::PortionObj( const PortionObj& rPortionObj )
     209                 :          0 : : PropStateValue( rPortionObj )
     210                 :            : {
     211         [ #  # ]:          0 :     ImplConstruct( rPortionObj );
     212                 :          0 : }
     213                 :            : 
     214                 :          0 : PortionObj::~PortionObj()
     215                 :            : {
     216         [ #  # ]:          0 :     ImplClear();
     217                 :          0 : }
     218                 :            : 
     219                 :          0 : void PortionObj::Write( SvStream* pStrm, sal_Bool bLast )
     220                 :            : {
     221                 :          0 :     sal_uInt32 nCount = mnTextSize;
     222 [ #  # ][ #  # ]:          0 :     if ( bLast && mbLastPortion )
     223                 :          0 :         nCount--;
     224         [ #  # ]:          0 :     for ( sal_uInt32 i = 0; i < nCount; i++ )
     225                 :          0 :         *pStrm << (sal_uInt16)mpText[ i ];
     226                 :          0 : }
     227                 :            : 
     228                 :          0 : void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue )
     229                 :            : {
     230                 :            : 
     231 [ #  # ][ #  # ]:          0 :     sal_Bool bOk = ImplGetPropertyValue( rtl::OUString( "CharFontName" ), bGetPropStateValue );
                 [ #  # ]
     232                 :          0 :     meFontName = ePropState;
     233         [ #  # ]:          0 :     if ( bOk )
     234                 :            :     {
     235 [ #  # ][ #  # ]:          0 :         FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
                 [ #  # ]
     236         [ #  # ]:          0 :         sal_uInt32  nCount = rFontCollection.GetCount();
     237         [ #  # ]:          0 :         mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
     238         [ #  # ]:          0 :         if ( mnFont == nCount )
     239                 :            :         {
     240         [ #  # ]:          0 :             FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
     241 [ #  # ][ #  # ]:          0 :             if ( ImplGetPropertyValue( rtl::OUString( "CharFontCharSet" ), sal_False ) )
         [ #  # ][ #  # ]
     242                 :          0 :                 mAny >>= rFontDesc.CharSet;
     243 [ #  # ][ #  # ]:          0 :             if ( ImplGetPropertyValue( rtl::OUString( "CharFontFamily" ), sal_False ) )
         [ #  # ][ #  # ]
     244                 :          0 :                 mAny >>= rFontDesc.Family;
     245 [ #  # ][ #  # ]:          0 :             if ( ImplGetPropertyValue( rtl::OUString( "CharFontPitch" ), sal_False ) )
         [ #  # ][ #  # ]
     246                 :          0 :                 mAny >>= rFontDesc.Pitch;
     247         [ #  # ]:          0 :         }
     248                 :            :     }
     249                 :            : 
     250 [ #  # ][ #  # ]:          0 :     sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguage() );
                 [ #  # ]
     251 [ #  # ][ #  # ]:          0 :     if ( mpText && mnTextSize && xPPTBreakIter.is() )
         [ #  # ][ #  # ]
     252                 :            :     {
     253                 :          0 :         rtl::OUString sT( mpText, mnTextSize );
     254 [ #  # ][ #  # ]:          0 :         nScriptType = xPPTBreakIter->getScriptType( sT, 0 );
     255                 :            :     }
     256         [ #  # ]:          0 :     if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX )
     257                 :            :     {
     258 [ #  # ][ #  # ]:          0 :         bOk = ImplGetPropertyValue( rtl::OUString( "CharFontNameAsian" ), bGetPropStateValue );
                 [ #  # ]
     259                 :          0 :         meAsianOrComplexFont = ePropState;
     260         [ #  # ]:          0 :         if ( bOk )
     261                 :            :         {
     262 [ #  # ][ #  # ]:          0 :             FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
                 [ #  # ]
     263         [ #  # ]:          0 :             sal_uInt32  nCount = rFontCollection.GetCount();
     264         [ #  # ]:          0 :             mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
     265         [ #  # ]:          0 :             if ( mnAsianOrComplexFont == nCount )
     266                 :            :             {
     267         [ #  # ]:          0 :                 FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
     268 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( rtl::OUString( "CharFontCharSetAsian" ), sal_False ) )
         [ #  # ][ #  # ]
     269                 :          0 :                     mAny >>= rFontDesc.CharSet;
     270 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( rtl::OUString( "CharFontFamilyAsian" ), sal_False ) )
         [ #  # ][ #  # ]
     271                 :          0 :                     mAny >>= rFontDesc.Family;
     272 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( rtl::OUString( "CharFontPitchAsian" ), sal_False ) )
         [ #  # ][ #  # ]
     273                 :          0 :                     mAny >>= rFontDesc.Pitch;
     274         [ #  # ]:          0 :             }
     275                 :            :         }
     276                 :            :     }
     277                 :            :     else
     278                 :            :     {
     279 [ #  # ][ #  # ]:          0 :         bOk = ImplGetPropertyValue( rtl::OUString( "CharFontNameComplex" ), bGetPropStateValue );
                 [ #  # ]
     280                 :          0 :         meAsianOrComplexFont = ePropState;
     281         [ #  # ]:          0 :         if ( bOk )
     282                 :            :         {
     283 [ #  # ][ #  # ]:          0 :             FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
                 [ #  # ]
     284         [ #  # ]:          0 :             sal_uInt32  nCount = rFontCollection.GetCount();
     285         [ #  # ]:          0 :             mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
     286         [ #  # ]:          0 :             if ( mnAsianOrComplexFont == nCount )
     287                 :            :             {
     288         [ #  # ]:          0 :                 FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
     289 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( rtl::OUString( "CharFontCharSetComplex" ), sal_False ) )
         [ #  # ][ #  # ]
     290                 :          0 :                     mAny >>= rFontDesc.CharSet;
     291 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( rtl::OUString( "CharFontFamilyComplex" ), sal_False ) )
         [ #  # ][ #  # ]
     292                 :          0 :                     mAny >>= rFontDesc.Family;
     293 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( rtl::OUString( "CharFontPitchComplex" ), sal_False ) )
         [ #  # ][ #  # ]
     294                 :          0 :                     mAny >>= rFontDesc.Pitch;
     295         [ #  # ]:          0 :             }
     296                 :            :         }
     297                 :            :     }
     298                 :            : 
     299                 :          0 :     rtl::OUString aCharHeightName, aCharWeightName, aCharLocaleName, aCharPostureName;
     300      [ #  #  # ]:          0 :     switch( nScriptType )
     301                 :            :     {
     302                 :            :         case com::sun::star::i18n::ScriptType::ASIAN :
     303                 :            :         {
     304                 :          0 :             aCharHeightName  = "CharHeightAsian";
     305                 :          0 :             aCharWeightName  = "CharWeightAsian";
     306                 :          0 :             aCharLocaleName  = "CharLocaleAsian";
     307                 :          0 :             aCharPostureName = "CharPostureAsian";
     308                 :          0 :             break;
     309                 :            :         }
     310                 :            :         case com::sun::star::i18n::ScriptType::COMPLEX :
     311                 :            :         {
     312                 :          0 :             aCharHeightName  = "CharHeightComplex";
     313                 :          0 :             aCharWeightName  = "CharWeightComplex";
     314                 :          0 :             aCharLocaleName  = "CharLocaleComplex";
     315                 :          0 :             aCharPostureName = "CharPostureComplex";
     316                 :          0 :             break;
     317                 :            :         }
     318                 :            :         default:
     319                 :            :         {
     320                 :          0 :             aCharHeightName  = "CharHeight";
     321                 :          0 :             aCharWeightName  = "CharWeight";
     322                 :          0 :             aCharLocaleName  = "CharLocale";
     323                 :          0 :             aCharPostureName = "CharPosture";
     324                 :          0 :             break;
     325                 :            :         }
     326                 :            :     }
     327                 :            : 
     328                 :          0 :     mnCharHeight = 24;
     329 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( mAny, mXPropSet, aCharHeightName, sal_False ) )
         [ #  # ][ #  # ]
     330                 :            :     {
     331                 :          0 :         float fVal(0.0);
     332         [ #  # ]:          0 :         if ( mAny >>= fVal )
     333                 :            :         {
     334                 :          0 :             mnCharHeight = (sal_uInt16)( fVal + 0.5 );
     335 [ #  # ][ #  # ]:          0 :             meCharHeight = GetPropertyState( mXPropSet, aCharHeightName );
                 [ #  # ]
     336                 :            :         }
     337                 :            :     }
     338 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( mAny, mXPropSet, aCharWeightName, sal_False ) )
         [ #  # ][ #  # ]
     339                 :            :     {
     340                 :          0 :         float fFloat(0.0);
     341         [ #  # ]:          0 :         if ( mAny >>= fFloat )
     342                 :            :         {
     343         [ #  # ]:          0 :             if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD )
     344                 :          0 :                 mnCharAttr |= 1;
     345 [ #  # ][ #  # ]:          0 :             if ( GetPropertyState( mXPropSet, aCharWeightName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
         [ #  # ][ #  # ]
     346                 :          0 :                 mnCharAttrHard |= 1;
     347                 :            :         }
     348                 :            :     }
     349 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( mAny, mXPropSet, aCharLocaleName, sal_False ) )
         [ #  # ][ #  # ]
     350                 :            :     {
     351                 :          0 :         com::sun::star::lang::Locale eLocale;
     352 [ #  # ][ #  # ]:          0 :         if ( mAny >>= eLocale )
     353                 :          0 :             meCharLocale = eLocale;
     354                 :            :     }
     355 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( mAny, mXPropSet, aCharPostureName, sal_False ) )
         [ #  # ][ #  # ]
     356                 :            :     {
     357                 :            :         ::com::sun::star::awt::FontSlant aFS;
     358 [ #  # ][ #  # ]:          0 :         if ( mAny >>= aFS )
     359                 :            :         {
     360         [ #  # ]:          0 :             switch( aFS )
     361                 :            :             {
     362                 :            :                 case ::com::sun::star::awt::FontSlant_OBLIQUE :
     363                 :            :                 case ::com::sun::star::awt::FontSlant_ITALIC :
     364                 :          0 :                     mnCharAttr |= 2;
     365                 :          0 :                     break;
     366                 :            :                 default:
     367                 :          0 :                     break;
     368                 :            :             }
     369 [ #  # ][ #  # ]:          0 :             if ( GetPropertyState( mXPropSet, aCharPostureName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
         [ #  # ][ #  # ]
     370                 :          0 :                 mnCharAttrHard |= 2;
     371                 :            :         }
     372                 :            :     }
     373                 :            : 
     374 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "CharUnderline" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
     375                 :            :     {
     376                 :          0 :         sal_Int16 nVal(0);
     377                 :          0 :         mAny >>= nVal;
     378         [ #  # ]:          0 :         switch ( nVal )
     379                 :            :         {
     380                 :            :             case ::com::sun::star::awt::FontUnderline::SINGLE :
     381                 :            :             case ::com::sun::star::awt::FontUnderline::DOUBLE :
     382                 :            :             case ::com::sun::star::awt::FontUnderline::DOTTED :
     383                 :          0 :                 mnCharAttr |= 4;
     384                 :            :         }
     385                 :            :     }
     386         [ #  # ]:          0 :     if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     387                 :          0 :         mnCharAttrHard |= 4;
     388                 :            : 
     389 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "CharShadowed" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
     390                 :            :     {
     391                 :          0 :         sal_Bool bBool(sal_False);
     392                 :          0 :         mAny >>= bBool;
     393         [ #  # ]:          0 :         if ( bBool )
     394                 :          0 :             mnCharAttr |= 0x10;
     395                 :            :     }
     396         [ #  # ]:          0 :     if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     397                 :          0 :         mnCharAttrHard |= 16;
     398                 :            : 
     399 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "CharRelief" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
     400                 :            :     {
     401                 :          0 :         sal_Int16 nVal(0);
     402                 :          0 :         mAny >>= nVal;
     403         [ #  # ]:          0 :         if ( nVal != ::com::sun::star::text::FontRelief::NONE )
     404                 :          0 :             mnCharAttr |= 512;
     405                 :            :     }
     406         [ #  # ]:          0 :     if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     407                 :          0 :         mnCharAttrHard |= 512;
     408                 :            : 
     409 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "CharColor" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
     410                 :            :     {
     411                 :          0 :         sal_uInt32 nSOColor = *( (sal_uInt32*)mAny.getValue() );
     412                 :          0 :         mnCharColor = nSOColor & 0xff00ff00;                            // green and hibyte
     413                 :          0 :         mnCharColor |= (sal_uInt8)( nSOColor ) << 16;                   // red and blue is switched
     414                 :          0 :         mnCharColor |= (sal_uInt8)( nSOColor >> 16 );
     415                 :            :     }
     416                 :          0 :     meCharColor = ePropState;
     417                 :            : 
     418                 :          0 :     mnCharEscapement = 0;
     419 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "CharEscapement" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
     420                 :            :     {
     421                 :          0 :         mAny >>= mnCharEscapement;
     422         [ #  # ]:          0 :         if ( mnCharEscapement > 100 )
     423                 :          0 :             mnCharEscapement = 33;
     424         [ #  # ]:          0 :         else if ( mnCharEscapement < -100 )
     425                 :          0 :             mnCharEscapement = -33;
     426                 :            :     }
     427                 :          0 :     meCharEscapement = ePropState;
     428                 :          0 : }
     429                 :            : 
     430                 :          0 : void PortionObj::ImplClear()
     431                 :            : {
     432         [ #  # ]:          0 :     delete (FieldEntry*)mpFieldEntry;
     433         [ #  # ]:          0 :     delete[] mpText;
     434                 :          0 : }
     435                 :            : 
     436                 :          0 : void PortionObj::ImplConstruct( const PortionObj& rPortionObj )
     437                 :            : {
     438                 :          0 :     mbLastPortion = rPortionObj.mbLastPortion;
     439                 :          0 :     mnTextSize = rPortionObj.mnTextSize;
     440                 :          0 :     mnCharColor = rPortionObj.mnCharColor;
     441                 :          0 :     mnCharEscapement = rPortionObj.mnCharEscapement;
     442                 :          0 :     mnCharAttr = rPortionObj.mnCharAttr;
     443                 :          0 :     mnCharHeight = rPortionObj.mnCharHeight;
     444                 :          0 :     mnFont = rPortionObj.mnFont;
     445                 :          0 :     mnAsianOrComplexFont = rPortionObj.mnAsianOrComplexFont;
     446                 :            : 
     447         [ #  # ]:          0 :     if ( rPortionObj.mpText )
     448                 :            :     {
     449                 :          0 :         mpText = new sal_uInt16[ mnTextSize ];
     450                 :          0 :         memcpy( mpText, rPortionObj.mpText, mnTextSize << 1 );
     451                 :            :     }
     452                 :            :     else
     453                 :          0 :         mpText = NULL;
     454                 :            : 
     455         [ #  # ]:          0 :     if ( rPortionObj.mpFieldEntry )
     456         [ #  # ]:          0 :         mpFieldEntry = new FieldEntry( *( rPortionObj.mpFieldEntry ) );
     457                 :            :     else
     458                 :          0 :         mpFieldEntry = NULL;
     459                 :          0 : }
     460                 :            : 
     461                 :          0 : sal_uInt32 PortionObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
     462                 :            : {
     463 [ #  # ][ #  # ]:          0 :     if ( mpFieldEntry && ( !mpFieldEntry->nFieldStartPos ) )
     464                 :            :     {
     465                 :          0 :         mpFieldEntry->nFieldStartPos += nCurrentTextPosition;
     466                 :          0 :         mpFieldEntry->nFieldEndPos += nCurrentTextPosition;
     467                 :            :     }
     468                 :          0 :     return mnTextSize;
     469                 :            : }
     470                 :            : 
     471                 :            : //  -----------------------------------------------------------------------
     472                 :            : // Rueckgabe:                           0 = kein TextField
     473                 :            : //  bit28->31   text field type :
     474                 :            : //                                      1 = Date
     475                 :            : //                                      2 = Time
     476                 :            : //                                      3 = SlideNumber
     477                 :            : //                                      4 = Url
     478                 :            : //                                      5 = DateTime
     479                 :            : //                                      6 = header
     480                 :            : //                                      7 = footer
     481                 :            : //  bit24->27   text field sub type (optional)
     482                 :            : //     23->     PPT Textfield needs a placeholder
     483                 :            : 
     484                 :          0 : sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & ,
     485                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, String& rURL )
     486                 :            : {
     487                 :          0 :     sal_uInt32 nRetValue = 0;
     488                 :            :     sal_Int32 nFormat;
     489                 :          0 :     ::com::sun::star::uno::Any aAny;
     490 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, rXPropSet, rtl::OUString( "TextPortionType" ), sal_True ) )
         [ #  # ][ #  # ]
     491                 :            :     {
     492                 :          0 :         rtl::OUString  aTextFieldType( *(::rtl::OUString*)aAny.getValue() );
     493         [ #  # ]:          0 :         if ( aTextFieldType == "TextField" )
     494                 :            :         {
     495 [ #  # ][ #  # ]:          0 :             if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, sal_True ) )
         [ #  # ][ #  # ]
     496                 :            :             {
     497                 :          0 :                 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > aXTextField;
     498 [ #  # ][ #  # ]:          0 :                 if ( aAny >>= aXTextField )
     499                 :            :                 {
     500         [ #  # ]:          0 :                     if ( aXTextField.is() )
     501                 :            :                     {
     502                 :            :                         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     503         [ #  # ]:          0 :                             xFieldPropSet( aXTextField, ::com::sun::star::uno::UNO_QUERY );
     504         [ #  # ]:          0 :                         if ( xFieldPropSet.is() )
     505                 :            :                         {
     506 [ #  # ][ #  # ]:          0 :                             rtl::OUString aFieldKind( aXTextField->getPresentation( sal_True ) );
     507         [ #  # ]:          0 :                             if ( aFieldKind == "Date" )
     508                 :            :                             {
     509 [ #  # ][ #  # ]:          0 :                                 if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True )
         [ #  # ][ #  # ]
     510                 :            :                                 {
     511                 :          0 :                                     sal_Bool bBool = sal_False;
     512                 :          0 :                                     aAny >>= bBool;
     513         [ #  # ]:          0 :                                     if ( !bBool )  // Fixed DateFields gibt es in PPT nicht
     514                 :            :                                     {
     515 [ #  # ][ #  # ]:          0 :                                         if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "Format" ) ), sal_True )
         [ #  # ][ #  # ]
     516                 :            :                                         {
     517                 :          0 :                                             nFormat = *(sal_Int32*)aAny.getValue();
     518      [ #  #  # ]:          0 :                                             switch ( nFormat )
     519                 :            :                                             {
     520                 :            :                                                 default:
     521                 :            :                                                 case 5 :
     522                 :            :                                                 case 4 :
     523                 :          0 :                                                 case 2 : nFormat = 0; break;
     524                 :            :                                                 case 8 :
     525                 :            :                                                 case 9 :
     526                 :          0 :                                                 case 3 : nFormat = 1; break;
     527                 :            :                                                 case 7 :
     528                 :          0 :                                                 case 6 : nFormat = 2; break;
     529                 :            :                                             }
     530                 :          0 :                                             nRetValue |= ( ( ( 1 << 4 ) | nFormat ) << 24 ) | 0x800000;
     531                 :            :                                         }
     532                 :            :                                     }
     533                 :            :                                 }
     534                 :            :                             }
     535         [ #  # ]:          0 :                             else if ( aFieldKind == "URL" )
     536                 :            :                             {
     537 [ #  # ][ #  # ]:          0 :                                 if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "URL" ) ), sal_True )
         [ #  # ][ #  # ]
     538 [ #  # ][ #  # ]:          0 :                                     rURL = String( *(::rtl::OUString*)aAny.getValue() );
                 [ #  # ]
     539                 :          0 :                                 nRetValue = 4 << 28;
     540                 :            :                             }
     541         [ #  # ]:          0 :                             else if ( aFieldKind == "Page" )
     542                 :            :                             {
     543                 :          0 :                                 nRetValue = 3 << 28 | 0x800000;
     544                 :            :                             }
     545         [ #  # ]:          0 :                             else if ( aFieldKind == "Pages" )
     546                 :            :                             {
     547                 :            : 
     548                 :            :                             }
     549         [ #  # ]:          0 :                             else if ( aFieldKind == "Time" )
     550                 :            :                             {
     551 [ #  # ][ #  # ]:          0 :                                 if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True )
         [ #  # ][ #  # ]
     552                 :            :                                 {
     553                 :          0 :                                     sal_Bool bBool = sal_False;
     554                 :          0 :                                     aAny >>= bBool;
     555         [ #  # ]:          0 :                                     if ( !bBool )
     556                 :            :                                     {
     557 [ #  # ][ #  # ]:          0 :                                         if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True )
         [ #  # ][ #  # ]
     558                 :            :                                         {
     559                 :          0 :                                             nFormat = *(sal_Int32*)aAny.getValue();
     560                 :          0 :                                             nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
     561                 :            :                                         }
     562                 :            :                                     }
     563                 :            :                                 }
     564                 :            :                             }
     565         [ #  # ]:          0 :                             else if ( aFieldKind == "File" )
     566                 :            :                             {
     567                 :            : 
     568                 :            :                             }
     569         [ #  # ]:          0 :                             else if ( aFieldKind == "Table" )
     570                 :            :                             {
     571                 :            : 
     572                 :            :                             }
     573         [ #  # ]:          0 :                             else if ( aFieldKind == "ExtTime" )
     574                 :            :                             {
     575 [ #  # ][ #  # ]:          0 :                                 if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True )
         [ #  # ][ #  # ]
     576                 :            :                                 {
     577                 :          0 :                                     sal_Bool bBool = sal_False;
     578                 :          0 :                                     aAny >>= bBool;
     579         [ #  # ]:          0 :                                     if ( !bBool )
     580                 :            :                                     {
     581 [ #  # ][ #  # ]:          0 :                                         if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "Format" ) ), sal_True )
         [ #  # ][ #  # ]
     582                 :            :                                         {
     583                 :          0 :                                             nFormat = *(sal_Int32*)aAny.getValue();
     584      [ #  #  # ]:          0 :                                             switch ( nFormat )
     585                 :            :                                             {
     586                 :            :                                                 default:
     587                 :            :                                                 case 6 :
     588                 :            :                                                 case 7 :
     589                 :            :                                                 case 8 :
     590                 :          0 :                                                 case 2 : nFormat = 12; break;
     591                 :          0 :                                                 case 3 : nFormat = 9; break;
     592                 :            :                                                 case 5 :
     593                 :          0 :                                                 case 4 : nFormat = 10; break;
     594                 :            : 
     595                 :            :                                             }
     596                 :          0 :                                             nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
     597                 :            :                                         }
     598                 :            :                                     }
     599                 :            :                                 }
     600                 :            :                             }
     601         [ #  # ]:          0 :                             else if ( aFieldKind == "ExtFile" )
     602                 :            :                             {
     603                 :            : 
     604                 :            :                             }
     605         [ #  # ]:          0 :                             else if ( aFieldKind ==  "Author" )
     606                 :            :                             {
     607                 :            : 
     608                 :            :                             }
     609         [ #  # ]:          0 :                             else if ( aFieldKind == "DateTime" )
     610                 :            :                             {
     611                 :          0 :                                 nRetValue = 5 << 28 | 0x800000;
     612                 :            :                             }
     613         [ #  # ]:          0 :                             else if ( aFieldKind == "Header" )
     614                 :            :                             {
     615                 :          0 :                                 nRetValue = 6 << 28 | 0x800000;
     616                 :            :                             }
     617         [ #  # ]:          0 :                             else if ( aFieldKind == "Footer" )
     618                 :            :                             {
     619                 :          0 :                                 nRetValue = 7 << 28 | 0x800000;
     620                 :          0 :                             }
     621                 :          0 :                         }
     622                 :            :                     }
     623                 :          0 :                 }
     624                 :            :             }
     625                 :          0 :         }
     626                 :            :     }
     627                 :          0 :     return nRetValue;
     628                 :            : }
     629                 :            : 
     630                 :          0 : PortionObj& PortionObj::operator=( const PortionObj& rPortionObj )
     631                 :            : {
     632         [ #  # ]:          0 :     if ( this != &rPortionObj )
     633                 :            :     {
     634                 :          0 :         ImplClear();
     635                 :          0 :         ImplConstruct( rPortionObj );
     636                 :            :     }
     637                 :          0 :     return *this;
     638                 :            : }
     639                 :            : 
     640                 :          0 : ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
     641                 :            :                 PPTExBulletProvider& rProv ) :
     642                 :            :     maMapModeSrc        ( MAP_100TH_MM ),
     643 [ #  # ][ #  # ]:          0 :     maMapModeDest       ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     644                 :            : {
     645         [ #  # ]:          0 :     mXPropSet = rXPropSet;
     646                 :            : 
     647                 :          0 :     bExtendedParameters = sal_False;
     648                 :            : 
     649                 :          0 :     nDepth = 0;
     650                 :          0 :     nBulletFlags = 0;
     651                 :          0 :     nParaFlags = 0;
     652                 :            : 
     653         [ #  # ]:          0 :     ImplGetParagraphValues( rProv, sal_False );
     654                 :          0 : }
     655                 :            : 
     656                 :          0 :     ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent,
     657                 :            :                     ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) :
     658                 :            :     maMapModeSrc        ( MAP_100TH_MM ),
     659                 :            :     maMapModeDest       ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ),
     660                 :            :     mbFirstParagraph    ( aParaFlags.bFirstParagraph ),
     661 [ #  # ][ #  # ]:          0 :     mbLastParagraph     ( aParaFlags.bLastParagraph )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     662                 :            : {
     663                 :          0 :     bExtendedParameters = sal_False;
     664                 :            : 
     665                 :          0 :     nDepth = 0;
     666                 :          0 :     nBulletFlags = 0;
     667                 :          0 :     nParaFlags = 0;
     668                 :            : 
     669                 :            :     mXPropSet = ::com::sun::star::uno::Reference<
     670                 :            :         ::com::sun::star::beans::XPropertySet >
     671 [ #  # ][ #  # ]:          0 :             ( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
     672                 :            : 
     673                 :            :     mXPropState = ::com::sun::star::uno::Reference<
     674                 :            :         ::com::sun::star::beans::XPropertyState >
     675 [ #  # ][ #  # ]:          0 :             ( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
     676                 :            : 
     677 [ #  # ][ #  # ]:          0 :     if ( mXPropSet.is() && mXPropState.is() )
                 [ #  # ]
     678                 :            :     {
     679                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
     680         [ #  # ]:          0 :             aXTextPortionEA( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
     681         [ #  # ]:          0 :         if ( aXTextPortionEA.is() )
     682                 :            :         {
     683                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
     684 [ #  # ][ #  # ]:          0 :                 aXTextPortionE( aXTextPortionEA->createEnumeration() );
     685         [ #  # ]:          0 :             if ( aXTextPortionE.is() )
     686                 :            :             {
     687 [ #  # ][ #  # ]:          0 :                 while ( aXTextPortionE->hasMoreElements() )
                 [ #  # ]
     688                 :            :                 {
     689                 :          0 :                     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > aXCursorText;
     690 [ #  # ][ #  # ]:          0 :                     ::com::sun::star::uno::Any aAny( aXTextPortionE->nextElement() );
     691 [ #  # ][ #  # ]:          0 :                     if ( aAny >>= aXCursorText )
     692                 :            :                     {
     693 [ #  # ][ #  # ]:          0 :                         PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection );
         [ #  # ][ #  # ]
     694         [ #  # ]:          0 :                         if ( pPortionObj->Count() )
     695         [ #  # ]:          0 :                             push_back( pPortionObj );
     696                 :            :                         else
     697 [ #  # ][ #  # ]:          0 :                             delete pPortionObj;
     698                 :            :                     }
     699                 :          0 :                 }
     700                 :          0 :             }
     701                 :            :         }
     702         [ #  # ]:          0 :         ImplGetParagraphValues( rProv, sal_True );
     703                 :            :     }
     704                 :          0 : }
     705                 :            : 
     706                 :          0 : ParagraphObj::ParagraphObj( const ParagraphObj& rObj )
     707                 :            : : std::vector<PortionObj*>()
     708                 :            : , PropStateValue()
     709 [ #  # ][ #  # ]:          0 : , SOParagraph()
         [ #  # ][ #  # ]
                 [ #  # ]
     710                 :            : {
     711         [ #  # ]:          0 :     ImplConstruct( rObj );
     712                 :          0 : }
     713                 :            : 
     714 [ #  # ][ #  # ]:          0 : ParagraphObj::~ParagraphObj()
         [ #  # ][ #  # ]
                 [ #  # ]
     715                 :            : {
     716         [ #  # ]:          0 :     ImplClear();
     717                 :          0 : }
     718                 :            : 
     719                 :          0 : void ParagraphObj::Write( SvStream* pStrm )
     720                 :            : {
     721 [ #  # ][ #  # ]:          0 :     for ( const_iterator it = begin(); it != end(); ++it )
                 [ #  # ]
     722         [ #  # ]:          0 :         (*it)->Write( pStrm, mbLastParagraph );
     723                 :          0 : }
     724                 :            : 
     725                 :          0 : void ParagraphObj::ImplClear()
     726                 :            : {
     727 [ #  # ][ #  # ]:          0 :     for ( const_iterator it = begin(); it != end(); ++it )
                 [ #  # ]
     728 [ #  # ][ #  # ]:          0 :         delete *it;
     729                 :          0 : }
     730                 :            : 
     731                 :          0 : void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
     732                 :            : {
     733 [ #  # ][ #  # ]:          0 :     if ( ( (SvxExtNumType)nNumberingType == SVX_NUM_BITMAP ) && ( nBulletId != 0xffff ) )
     734                 :            :     {
     735                 :            :         // calculate the bulletrealsize for this grafik
     736 [ #  # ][ #  # ]:          0 :         if ( aBuGraSize.Width() && aBuGraSize.Height() )
                 [ #  # ]
     737                 :            :         {
     738                 :          0 :             double fCharHeight = nFontHeight;
     739                 :          0 :             double fLen = aBuGraSize.Height();
     740                 :          0 :             fCharHeight = fCharHeight * 0.2540;
     741                 :          0 :             double fQuo = fLen / fCharHeight;
     742                 :          0 :             nBulletRealSize = (sal_Int16)( fQuo + 0.5 );
     743         [ #  # ]:          0 :             if ( (sal_uInt16)nBulletRealSize > 400 )
     744                 :          0 :                 nBulletRealSize = 400;
     745                 :            :         }
     746                 :            :     }
     747                 :          0 : }
     748                 :            : 
     749                 :          0 : void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue )
     750                 :            : {
     751                 :          0 :     ::com::sun::star::uno::Any aAny;
     752 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "ParaLeftMargin" ) ) )
         [ #  # ][ #  # ]
     753                 :            :     {
     754                 :          0 :         sal_Int32 nVal(0);
     755         [ #  # ]:          0 :         if ( aAny >>= nVal )
     756                 :          0 :             nTextOfs = static_cast< sal_Int16 >( nVal / ( 2540.0 / 576 ) + 0.5 ) ;
     757                 :            :     }
     758 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "ParaFirstLineIndent" ) ) )
         [ #  # ][ #  # ]
     759                 :            :     {
     760         [ #  # ]:          0 :         if ( aAny >>= nBulletOfs )
     761                 :          0 :             nBulletOfs = static_cast< sal_Int32 >( nBulletOfs / ( 2540.0 / 576 ) + 0.5 );
     762                 :            :     }
     763 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "NumberingIsNumber" ) ) )
         [ #  # ][ #  # ]
     764                 :          0 :         aAny >>= bNumberingIsNumber;
     765                 :            : 
     766                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > aXIndexReplace;
     767                 :            : 
     768 [ #  # ][ #  # ]:          0 :     if ( bIsBullet && ImplGetPropertyValue( rtl::OUString( "NumberingRules" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
          #  #  #  #  #  
              # ][ #  # ]
     769                 :            :     {
     770 [ #  # ][ #  # ]:          0 :         if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     771                 :            :         {
     772 [ #  # ][ #  # ]:          0 :             mAny <<= aXIndexReplace->getByIndex( nNumberingDepth );
                 [ #  # ]
     773                 :            :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
     774         [ #  # ]:          0 :                 aPropertySequence( *( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>*)mAny.getValue() );
     775                 :            : 
     776         [ #  # ]:          0 :             const ::com::sun::star::beans::PropertyValue* pPropValue = aPropertySequence.getArray();
     777                 :            : 
     778                 :          0 :             sal_Int32 nPropertyCount = aPropertySequence.getLength();
     779         [ #  # ]:          0 :             if ( nPropertyCount )
     780                 :            :             {
     781                 :          0 :                 bExtendedParameters = sal_True;
     782                 :          0 :                 nBulletRealSize = 100;
     783                 :          0 :                 nMappedNumType = 0;
     784                 :            : 
     785         [ #  # ]:          0 :                 String aGraphicURL;
     786         [ #  # ]:          0 :                 for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
     787                 :            :                 {
     788                 :          0 :                     const void* pValue = pPropValue[ i ].Value.getValue();
     789         [ #  # ]:          0 :                     if ( pValue )
     790                 :            :                     {
     791                 :          0 :                         ::rtl::OUString aPropName( pPropValue[ i ].Name );
     792         [ #  # ]:          0 :                         if ( aPropName == "NumberingType" )
     793                 :          0 :                             nNumberingType = *( (sal_Int16*)pValue );
     794         [ #  # ]:          0 :                         else if ( aPropName == "Adjust" )
     795                 :          0 :                             nHorzAdjust = *( (sal_Int16*)pValue );
     796         [ #  # ]:          0 :                         else if ( aPropName == "BulletChar" )
     797                 :            :                         {
     798                 :          0 :                             rtl::OUString aString( *( (::rtl::OUString*)pValue ) );
     799         [ #  # ]:          0 :                             if ( !aString.isEmpty() )
     800                 :          0 :                                 cBulletId = aString[ 0 ];
     801                 :            :                         }
     802         [ #  # ]:          0 :                         else if ( aPropName == "BulletFont" )
     803                 :            :                         {
     804                 :          0 :                             aFontDesc = *( (::com::sun::star::awt::FontDescriptor*)pValue );
     805                 :            : 
     806                 :            :                             // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
     807                 :            :                             // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
     808                 :            :                             // Because there might exist a lot of damaged documemts I added this two lines
     809                 :            :                             // which fixes the bullet problem for the export.
     810         [ #  # ]:          0 :                             if ( aFontDesc.Name == "StarSymbol" )
     811                 :          0 :                                 aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
     812                 :            : 
     813                 :            :                         }
     814         [ #  # ]:          0 :                         else if ( aPropName == "GraphicURL" )
     815         [ #  # ]:          0 :                             aGraphicURL = ( *(::rtl::OUString*)pValue );
     816         [ #  # ]:          0 :                         else if ( aPropName == "GraphicSize" )
     817                 :            :                         {
     818 [ #  # ][ #  # ]:          0 :                             if ( pPropValue[ i ].Value.getValueType() == ::getCppuType( (::com::sun::star::awt::Size*)0) )
     819                 :            :                             {
     820                 :            :                                 // don't cast awt::Size to Size as on 64-bits they are not the same.
     821                 :          0 :                                 ::com::sun::star::awt::Size aSize;
     822         [ #  # ]:          0 :                                 pPropValue[ i ].Value >>= aSize;
     823                 :          0 :                                 aBuGraSize.nA = aSize.Width;
     824                 :          0 :                                 aBuGraSize.nB = aSize.Height;
     825                 :            :                             }
     826                 :            :                         }
     827         [ #  # ]:          0 :                         else if ( aPropName == "StartWith" )
     828                 :          0 :                             nStartWith = *( (sal_Int16*)pValue );
     829         [ #  # ]:          0 :                         else if ( aPropName == "LeftMargin" )
     830                 :          0 :                             nTextOfs = nTextOfs + static_cast< sal_Int16 >( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) );
     831         [ #  # ]:          0 :                         else if ( aPropName == "FirstLineOffset" )
     832                 :          0 :                             nBulletOfs += (sal_Int16)( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) );
     833         [ #  # ]:          0 :                         else if ( aPropName == "BulletColor" )
     834                 :            :                         {
     835                 :          0 :                             sal_uInt32 nSOColor = *( (sal_uInt32*)pValue );
     836                 :          0 :                             nBulletColor = nSOColor & 0xff00ff00;                       // green and hibyte
     837                 :          0 :                             nBulletColor |= (sal_uInt8)( nSOColor ) << 16;              // red
     838                 :          0 :                             nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue
     839                 :            :                         }
     840         [ #  # ]:          0 :                         else if ( aPropName == "BulletRelSize" )
     841                 :            :                         {
     842                 :          0 :                             nBulletRealSize = *( (sal_Int16*)pValue );
     843                 :          0 :                             nParaFlags |= 0x40;
     844                 :          0 :                             nBulletFlags |= 8;
     845                 :            :                         }
     846         [ #  # ]:          0 :                         else if ( aPropName == "Prefix" )
     847         [ #  # ]:          0 :                             sPrefix = ( *(::rtl::OUString*)pValue );
     848         [ #  # ]:          0 :                         else if ( aPropName == "Suffix" )
     849         [ #  # ]:          0 :                             sSuffix = ( *(::rtl::OUString*)pValue );
     850                 :            : #ifdef DBG_UTIL
     851                 :            :                         else if ( ! (
     852                 :            :                                 ( aPropName == "SymbolTextDistance" )
     853                 :            :                             ||  ( aPropName == "Graphic" ) ) )
     854                 :            :                         {
     855                 :            :                             OSL_FAIL( "Unbekanntes Property" );
     856                 :            :                         }
     857                 :            : #endif
     858                 :            :                     }
     859                 :            :                 }
     860                 :            : 
     861         [ #  # ]:          0 :                 if ( aGraphicURL.Len() )
     862                 :            :                 {
     863 [ #  # ][ #  # ]:          0 :                     if ( aBuGraSize.Width() && aBuGraSize.Height() )
                 [ #  # ]
     864                 :            :                     {
     865         [ #  # ]:          0 :                         xub_StrLen nIndex = aGraphicURL.Search( (sal_Unicode)':', 0 );
     866         [ #  # ]:          0 :                         if ( nIndex != STRING_NOTFOUND )
     867                 :            :                         {
     868                 :          0 :                             nIndex++;
     869         [ #  # ]:          0 :                             if ( aGraphicURL.Len() > nIndex  )
     870                 :            :                             {
     871 [ #  # ][ #  # ]:          0 :                                 rtl::OString aUniqueId(rtl::OUStringToOString(aGraphicURL.Copy(nIndex, aGraphicURL.Len() - nIndex), RTL_TEXTENCODING_UTF8));
         [ #  # ][ #  # ]
     872         [ #  # ]:          0 :                                 if ( !aUniqueId.isEmpty() )
     873                 :            :                                 {
     874         [ #  # ]:          0 :                                     nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize );
     875         [ #  # ]:          0 :                                     if ( nBulletId != 0xffff )
     876                 :          0 :                                         bExtendedBulletsUsed = sal_True;
     877                 :          0 :                                 }
     878                 :            :                             }
     879                 :            :                         }
     880                 :            :                     }
     881                 :            :                     else
     882                 :            :                     {
     883                 :          0 :                         nNumberingType = SVX_NUM_NUMBER_NONE;
     884                 :            :                     }
     885                 :            :                 }
     886                 :            : 
     887         [ #  # ]:          0 :                 PortionObj* pPortion = front();
     888         [ #  # ]:          0 :                 CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 );
     889                 :            : 
     890   [ #  #  #  # ]:          0 :                 switch( (SvxExtNumType)nNumberingType )
     891                 :            :                 {
     892                 :          0 :                     case SVX_NUM_NUMBER_NONE : nParaFlags |= 0xf; break;
     893                 :            : 
     894                 :            :                     case SVX_NUM_CHAR_SPECIAL :                           // Bullet
     895                 :            :                     {
     896 [ #  # ][ #  # ]:          0 :                         if ( aFontDesc.Name.equals("starsymbol") || aFontDesc.Name.equals("opensymbol") )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     897                 :            :                         {
     898                 :          0 :                             rtl_TextEncoding eChrSet = aFontDesc.CharSet;
     899         [ #  # ]:          0 :                             cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eChrSet, aFontDesc.Name);
     900                 :          0 :                             aFontDesc.CharSet = eChrSet;
     901                 :            :                         }
     902                 :            : 
     903         [ #  # ]:          0 :                         if ( !aFontDesc.Name.isEmpty() )
     904                 :            :                         {
     905                 :          0 :                             nParaFlags |= 0x90; // wir geben den Font und den Charset vor
     906                 :            :                         }
     907                 :            :                     }
     908                 :            :                     case SVX_NUM_CHARS_UPPER_LETTER :       // zaehlt von a-z, aa - az, ba - bz, ...
     909                 :            :                     case SVX_NUM_CHARS_LOWER_LETTER :
     910                 :            :                     case SVX_NUM_ROMAN_UPPER :
     911                 :            :                     case SVX_NUM_ROMAN_LOWER :
     912                 :            :                     case SVX_NUM_ARABIC :
     913                 :            :                     case SVX_NUM_PAGEDESC :                 // Numerierung aus der Seitenvorlage
     914                 :            :                     case SVX_NUM_BITMAP :
     915                 :            :                     case SVX_NUM_CHARS_UPPER_LETTER_N :     // zaehlt von  a-z, aa-zz, aaa-zzz
     916                 :            :                     case SVX_NUM_CHARS_LOWER_LETTER_N :
     917                 :            :                     {
     918         [ #  # ]:          0 :                         if ( nNumberingType != SVX_NUM_CHAR_SPECIAL )
     919                 :            :                         {
     920                 :          0 :                             bExtendedBulletsUsed = sal_True;
     921         [ #  # ]:          0 :                             if ( nNumberingDepth & 1 )
     922                 :          0 :                                 cBulletId = 0x2013;         // defaulting bullet characters for ppt97
     923         [ #  # ]:          0 :                             else if ( nNumberingDepth == 4 )
     924                 :          0 :                                 cBulletId = 0xbb;
     925                 :            :                             else
     926                 :          0 :                                 cBulletId = 0x2022;
     927                 :            : 
     928   [ #  #  #  #  :          0 :                             switch( (SvxExtNumType)nNumberingType )
                   #  # ]
     929                 :            :                             {
     930                 :            :                                 case SVX_NUM_CHARS_UPPER_LETTER :
     931                 :            :                                 case SVX_NUM_CHARS_UPPER_LETTER_N :
     932                 :            :                                 {
     933 [ #  # ][ #  # ]:          0 :                                     if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
         [ #  # ][ #  # ]
     934                 :            :                                     {
     935 [ #  # ][ #  # ]:          0 :                                         if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
         [ #  # ][ #  # ]
     936                 :          0 :                                             nMappedNumType = 0xa0001;   // (A)
     937                 :            :                                         else
     938                 :          0 :                                             nMappedNumType = 0xb0001;   // A)
     939                 :            :                                     }
     940                 :            :                                     else
     941                 :          0 :                                         nMappedNumType = 0x10001;       // A.
     942                 :            :                                 }
     943                 :          0 :                                 break;
     944                 :            :                                 case SVX_NUM_CHARS_LOWER_LETTER :
     945                 :            :                                 case SVX_NUM_CHARS_LOWER_LETTER_N :
     946                 :            :                                 {
     947 [ #  # ][ #  # ]:          0 :                                     if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
         [ #  # ][ #  # ]
     948                 :            :                                     {
     949 [ #  # ][ #  # ]:          0 :                                         if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
         [ #  # ][ #  # ]
     950                 :          0 :                                             nMappedNumType = 0x80001;   // (a)
     951                 :            :                                         else
     952                 :          0 :                                             nMappedNumType = 0x90001;   // a)
     953                 :            :                                     }
     954                 :            :                                     else
     955                 :          0 :                                         nMappedNumType = 0x00001;       // a.
     956                 :            :                                 }
     957                 :          0 :                                 break;
     958                 :            :                                 case SVX_NUM_ROMAN_UPPER :
     959                 :            :                                 {
     960 [ #  # ][ #  # ]:          0 :                                     if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
         [ #  # ][ #  # ]
     961                 :            :                                     {
     962 [ #  # ][ #  # ]:          0 :                                         if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
         [ #  # ][ #  # ]
     963                 :          0 :                                             nMappedNumType = 0xe0001;   // (I)
     964                 :            :                                         else
     965                 :          0 :                                             nMappedNumType = 0xf0001;   // I)
     966                 :            :                                     }
     967                 :            :                                     else
     968                 :          0 :                                         nMappedNumType = 0x70001;       // I.
     969                 :            :                                 }
     970                 :          0 :                                 break;
     971                 :            :                                 case SVX_NUM_ROMAN_LOWER :
     972                 :            :                                 {
     973 [ #  # ][ #  # ]:          0 :                                     if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
         [ #  # ][ #  # ]
     974                 :            :                                     {
     975 [ #  # ][ #  # ]:          0 :                                         if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
         [ #  # ][ #  # ]
     976                 :          0 :                                             nMappedNumType = 0x40001;   // (i)
     977                 :            :                                         else
     978                 :          0 :                                             nMappedNumType = 0x50001;   // i)
     979                 :            :                                     }
     980                 :            :                                     else
     981                 :          0 :                                         nMappedNumType = 0x60001;       // i.
     982                 :            :                                 }
     983                 :          0 :                                 break;
     984                 :            :                                 case SVX_NUM_ARABIC :
     985                 :            :                                 {
     986 [ #  # ][ #  # ]:          0 :                                     if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
         [ #  # ][ #  # ]
     987                 :            :                                     {
     988 [ #  # ][ #  # ]:          0 :                                         if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
         [ #  # ][ #  # ]
     989                 :          0 :                                             nMappedNumType = 0xc0001;   // (1)
     990                 :            :                                         else
     991                 :          0 :                                             nMappedNumType = 0x20001;   // 1)
     992                 :            :                                     }
     993                 :            :                                     else
     994                 :            :                                     {
     995         [ #  # ]:          0 :                                         if ( ! ( sSuffix.Len() + sPrefix.Len() ) )
     996                 :          0 :                                             nMappedNumType = 0xd0001;   // 1
     997                 :            :                                         else
     998                 :          0 :                                             nMappedNumType = 0x30001;   // 1.
     999                 :            :                                     }
    1000                 :            :                                 }
    1001                 :          0 :                                 break;
    1002                 :            :                                 default:
    1003                 :          0 :                                     break;
    1004                 :            :                             }
    1005                 :            :                         }
    1006                 :          0 :                         nParaFlags |= 0x2f;
    1007                 :          0 :                         nBulletFlags |= 6;
    1008 [ #  # ][ #  # ]:          0 :                         if ( mbIsBullet && bNumberingIsNumber )
    1009                 :          0 :                             nBulletFlags |= 1;
    1010                 :            :                     }
    1011         [ #  # ]:          0 :                 }
    1012         [ #  # ]:          0 :             }
    1013                 :            :         }
    1014                 :            :     }
    1015                 :          0 :     nBulletOfs = nTextOfs + nBulletOfs;
    1016         [ #  # ]:          0 :     if ( nBulletOfs < 0 )
    1017                 :          0 :         nBulletOfs = 0;
    1018                 :          0 : }
    1019                 :            : 
    1020                 :          0 : void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue )
    1021                 :            : {
    1022 [ #  # ][ #  # ]:          0 :     static String sNumberingLevel   ( RTL_CONSTASCII_USTRINGPARAM( "NumberingLevel" ) );
         [ #  # ][ #  # ]
    1023                 :            : 
    1024                 :          0 :     ::com::sun::star::uno::Any aAny;
    1025 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, mXPropSet, sNumberingLevel, sal_True ) )
    1026                 :            :     {
    1027         [ #  # ]:          0 :         if ( bGetPropStateValue )
    1028         [ #  # ]:          0 :             meBullet = GetPropertyState( mXPropSet, sNumberingLevel );
    1029                 :          0 :         nDepth = *( (sal_Int16*)aAny.getValue() );
    1030                 :            : 
    1031         [ #  # ]:          0 :         if ( nDepth < 0 )
    1032                 :            :         {
    1033                 :          0 :             mbIsBullet = sal_False;
    1034                 :          0 :             nDepth = 0;
    1035                 :            :         }
    1036                 :            :         else
    1037                 :            :         {
    1038         [ #  # ]:          0 :             if ( nDepth > 4 )
    1039                 :          0 :                 nDepth = 4;
    1040                 :          0 :             mbIsBullet = sal_True;
    1041                 :            :         }
    1042                 :            :     }
    1043                 :            :     else
    1044                 :            :     {
    1045                 :          0 :         nDepth = 0;
    1046                 :          0 :         mbIsBullet = sal_False;
    1047                 :            :     }
    1048         [ #  # ]:          0 :     ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue );
    1049                 :            : 
    1050 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "ParaTabStops" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1051         [ #  # ]:          0 :         maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue();
    1052                 :          0 :     sal_Int16 eTextAdjust( ::com::sun::star::style::ParagraphAdjust_LEFT );
    1053 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "ParaAdjust" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1054                 :          0 :         aAny >>= eTextAdjust;
    1055   [ #  #  #  # ]:          0 :     switch ( (::com::sun::star::style::ParagraphAdjust)eTextAdjust )
    1056                 :            :     {
    1057                 :            :         case ::com::sun::star::style::ParagraphAdjust_CENTER :
    1058                 :          0 :             mnTextAdjust = 1;
    1059                 :          0 :         break;
    1060                 :            :         case ::com::sun::star::style::ParagraphAdjust_RIGHT :
    1061                 :          0 :             mnTextAdjust = 2;
    1062                 :          0 :         break;
    1063                 :            :         case ::com::sun::star::style::ParagraphAdjust_BLOCK :
    1064                 :          0 :             mnTextAdjust = 3;
    1065                 :          0 :         break;
    1066                 :            :         default :
    1067                 :            :         case ::com::sun::star::style::ParagraphAdjust_LEFT :
    1068                 :          0 :             mnTextAdjust = 0;
    1069                 :          0 :         break;
    1070                 :            :     }
    1071                 :          0 :     meTextAdjust = ePropState;
    1072                 :            : 
    1073 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "ParaLineSpacing" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1074                 :            :     {
    1075                 :            :         ::com::sun::star::style::LineSpacing aLineSpacing
    1076                 :          0 :             = *( (::com::sun::star::style::LineSpacing*)mAny.getValue() );
    1077      [ #  #  # ]:          0 :         switch ( aLineSpacing.Mode )
    1078                 :            :         {
    1079                 :            :             case ::com::sun::star::style::LineSpacingMode::FIX :
    1080                 :          0 :                 mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) );
    1081                 :          0 :                 mbFixedLineSpacing = sal_True;
    1082                 :          0 :                 break;
    1083                 :            :             case ::com::sun::star::style::LineSpacingMode::MINIMUM :
    1084                 :            :             case ::com::sun::star::style::LineSpacingMode::LEADING :
    1085                 :          0 :                 mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) );
    1086                 :          0 :                 mbFixedLineSpacing = sal_False;
    1087                 :          0 :            break;
    1088                 :            : 
    1089                 :            :             case ::com::sun::star::style::LineSpacingMode::PROP :
    1090                 :            :             default:
    1091                 :          0 :                 mnLineSpacing = (sal_Int16)( aLineSpacing.Height );
    1092                 :          0 :             break;
    1093                 :            :         }
    1094                 :            :     }
    1095                 :          0 :     meLineSpacing = ePropState;
    1096                 :            : 
    1097 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "ParaBottomMargin" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1098                 :            :     {
    1099                 :          0 :         double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1;
    1100                 :          0 :         mnLineSpacingBottom = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) );
    1101                 :            :     }
    1102                 :          0 :     meLineSpacingBottom = ePropState;
    1103                 :            : 
    1104 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "ParaTopMargin" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1105                 :            :     {
    1106                 :          0 :         double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1;
    1107                 :          0 :         mnLineSpacingTop = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) );
    1108                 :            :     }
    1109                 :          0 :     meLineSpacingTop = ePropState;
    1110                 :            : 
    1111 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "ParaIsForbiddenRules" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1112                 :          0 :         mAny >>= mbForbiddenRules;
    1113                 :          0 :     meForbiddenRules = ePropState;
    1114                 :            : 
    1115 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "ParaIsHangingPunctuation" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1116                 :          0 :         mAny >>= mbParagraphPunctation;
    1117                 :          0 :     meParagraphPunctation = ePropState;
    1118                 :            : 
    1119                 :          0 :     mnBiDi = 0;
    1120 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( rtl::OUString( "WritingMode" ), bGetPropStateValue ) )
         [ #  # ][ #  # ]
    1121                 :            :     {
    1122                 :          0 :         sal_Int16 nWritingMode = 0;
    1123                 :          0 :         mAny >>= nWritingMode;
    1124                 :            : 
    1125                 :          0 :         SvxFrameDirection eWritingMode( (SvxFrameDirection)nWritingMode );
    1126 [ #  # ][ #  # ]:          0 :         if ( ( eWritingMode == FRMDIR_HORI_RIGHT_TOP )
    1127                 :            :             || ( eWritingMode == FRMDIR_VERT_TOP_RIGHT ) )
    1128                 :            :         {
    1129                 :          0 :             mnBiDi = 1;
    1130                 :            :         }
    1131                 :            :     }
    1132                 :          0 :     meBiDi = ePropState;
    1133                 :          0 : }
    1134                 :            : 
    1135                 :          0 : void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj )
    1136                 :            : {
    1137                 :          0 :     mnTextSize = rParagraphObj.mnTextSize;
    1138                 :          0 :     mnTextAdjust = rParagraphObj.mnTextAdjust;
    1139                 :          0 :     mnLineSpacing = rParagraphObj.mnLineSpacing;
    1140                 :          0 :     mnLineSpacingTop = rParagraphObj.mnLineSpacingTop;
    1141                 :          0 :     mnLineSpacingBottom = rParagraphObj.mnLineSpacingBottom;
    1142                 :          0 :     mbFirstParagraph = rParagraphObj.mbFirstParagraph;
    1143                 :          0 :     mbLastParagraph = rParagraphObj.mbLastParagraph;
    1144                 :          0 :     mbParagraphPunctation = rParagraphObj.mbParagraphPunctation;
    1145                 :          0 :     mbForbiddenRules = rParagraphObj.mbForbiddenRules;
    1146                 :          0 :     mnBiDi = rParagraphObj.mnBiDi;
    1147                 :            : 
    1148 [ #  # ][ #  # ]:          0 :     for ( ParagraphObj::const_iterator it = rParagraphObj.begin(); it != rParagraphObj.end(); ++it )
    1149 [ #  # ][ #  # ]:          0 :         push_back( new PortionObj( **it ) );
                 [ #  # ]
    1150                 :            : 
    1151                 :          0 :     maTabStop = rParagraphObj.maTabStop;
    1152                 :          0 :     bExtendedParameters = rParagraphObj.bExtendedParameters;
    1153                 :          0 :     nParaFlags = rParagraphObj.nParaFlags;
    1154                 :          0 :     nBulletFlags = rParagraphObj.nBulletFlags;
    1155                 :          0 :     sPrefix = rParagraphObj.sPrefix;
    1156                 :          0 :     sSuffix = rParagraphObj.sSuffix;
    1157                 :          0 :     sGraphicUrl = rParagraphObj.sGraphicUrl;            // String auf eine Graphic
    1158                 :          0 :     aBuGraSize = rParagraphObj.aBuGraSize;
    1159                 :          0 :     nNumberingType = rParagraphObj.nNumberingType;      // in wirlichkeit ist dies ein SvxEnum
    1160                 :          0 :     nHorzAdjust = rParagraphObj.nHorzAdjust;
    1161                 :          0 :     nBulletColor = rParagraphObj.nBulletColor;
    1162                 :          0 :     nBulletOfs = rParagraphObj.nBulletOfs;
    1163                 :          0 :     nStartWith = rParagraphObj.nStartWith;              // Start der nummerierung
    1164                 :          0 :     nTextOfs = rParagraphObj.nTextOfs;
    1165                 :          0 :     nBulletRealSize = rParagraphObj.nBulletRealSize;    // GroessenVerhaeltnis in Proz
    1166                 :          0 :     nDepth = rParagraphObj.nDepth;                      // aktuelle tiefe
    1167                 :          0 :     cBulletId = rParagraphObj.cBulletId;                // wenn Numbering Type == CharSpecial
    1168                 :          0 :     aFontDesc = rParagraphObj.aFontDesc;
    1169                 :            : 
    1170                 :          0 :     bExtendedBulletsUsed = rParagraphObj.bExtendedBulletsUsed;
    1171                 :          0 :     nBulletId = rParagraphObj.nBulletId;
    1172                 :          0 : }
    1173                 :            : 
    1174                 :          0 : sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
    1175                 :            : {
    1176                 :          0 :     mnTextSize = 0;
    1177 [ #  # ][ #  # ]:          0 :     for ( const_iterator it = begin(); it != end(); ++it )
                 [ #  # ]
    1178                 :          0 :         mnTextSize += (*it)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize );
    1179                 :          0 :     return mnTextSize;
    1180                 :            : }
    1181                 :            : 
    1182                 :          0 : ParagraphObj& ParagraphObj::operator=( const ParagraphObj& rParagraphObj )
    1183                 :            : {
    1184         [ #  # ]:          0 :     if ( this != &rParagraphObj )
    1185                 :            :     {
    1186                 :          0 :         ImplClear();
    1187                 :          0 :         ImplConstruct( rParagraphObj );
    1188                 :            :     }
    1189                 :          0 :     return *this;
    1190                 :            : }
    1191                 :            : 
    1192                 :          0 : ImplTextObj::ImplTextObj( int nInstance )
    1193                 :          0 :   : maList()
    1194                 :            : {
    1195                 :          0 :     mnRefCount = 1;
    1196                 :          0 :     mnTextSize = 0;
    1197                 :          0 :     mnInstance = nInstance;
    1198                 :          0 :     mbHasExtendedBullets = sal_False;
    1199                 :          0 :     mbFixedCellHeightUsed = sal_False;
    1200                 :          0 : }
    1201                 :            : 
    1202                 :          0 : ImplTextObj::~ImplTextObj()
    1203                 :            : {
    1204 [ #  # ][ #  # ]:          0 :     for ( std::vector<ParagraphObj*>::const_iterator it = maList.begin(); it != maList.end(); ++it )
                 [ #  # ]
    1205 [ #  # ][ #  # ]:          0 :         delete *it;
    1206                 :          0 : }
    1207                 :            : 
    1208                 :          0 : TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & rXTextRef,
    1209                 :            :             int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rProv )
    1210                 :            : {
    1211 [ #  # ][ #  # ]:          0 :     mpImplTextObj = new ImplTextObj( nInstance );
    1212                 :            : 
    1213                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
    1214         [ #  # ]:          0 :         aXTextParagraphEA( rXTextRef, ::com::sun::star::uno::UNO_QUERY );
    1215                 :            : 
    1216         [ #  # ]:          0 :     if ( aXTextParagraphEA.is()  )
    1217                 :            :     {
    1218                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
    1219 [ #  # ][ #  # ]:          0 :             aXTextParagraphE( aXTextParagraphEA->createEnumeration() );
    1220         [ #  # ]:          0 :         if ( aXTextParagraphE.is() )
    1221                 :            :         {
    1222                 :          0 :             ParaFlags aParaFlags;
    1223 [ #  # ][ #  # ]:          0 :             while ( aXTextParagraphE->hasMoreElements() )
                 [ #  # ]
    1224                 :            :             {
    1225                 :          0 :                 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > aXParagraph;
    1226 [ #  # ][ #  # ]:          0 :                 ::com::sun::star::uno::Any aAny( aXTextParagraphE->nextElement() );
    1227 [ #  # ][ #  # ]:          0 :                 if ( aAny >>= aXParagraph )
    1228                 :            :                 {
    1229 [ #  # ][ #  # ]:          0 :                     if ( !aXTextParagraphE->hasMoreElements() )
                 [ #  # ]
    1230                 :          0 :                         aParaFlags.bLastParagraph = sal_True;
    1231 [ #  # ][ #  # ]:          0 :                     ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv );
    1232                 :          0 :                     mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed;
    1233         [ #  # ]:          0 :                     mpImplTextObj->maList.push_back( pPara );
    1234                 :          0 :                     aParaFlags.bFirstParagraph = sal_False;
    1235                 :            :                 }
    1236                 :          0 :             }
    1237                 :          0 :         }
    1238                 :            :     }
    1239         [ #  # ]:          0 :     ImplCalculateTextPositions();
    1240                 :          0 : }
    1241                 :            : 
    1242                 :          0 : TextObj::TextObj( const TextObj& rTextObj )
    1243                 :            : {
    1244                 :          0 :     mpImplTextObj = const_cast<TextObj&>(rTextObj).mpImplTextObj;
    1245                 :          0 :     mpImplTextObj->mnRefCount++;
    1246                 :          0 : }
    1247                 :            : 
    1248                 :          0 : TextObj::~TextObj()
    1249                 :            : {
    1250         [ #  # ]:          0 :     if ( ! ( --mpImplTextObj->mnRefCount ) )
    1251         [ #  # ]:          0 :         delete mpImplTextObj;
    1252                 :          0 : }
    1253                 :            : 
    1254                 :          0 : void TextObj::ImplCalculateTextPositions()
    1255                 :            : {
    1256                 :          0 :     mpImplTextObj->mnTextSize = 0;
    1257         [ #  # ]:          0 :     for ( sal_uInt32 i = 0; i < ParagraphCount(); ++i )
    1258                 :          0 :         mpImplTextObj->mnTextSize += GetParagraph(i)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize );
    1259                 :          0 : }
    1260                 :            : 
    1261                 :          0 : TextObj& TextObj::operator=( TextObj& rTextObj )
    1262                 :            : {
    1263         [ #  # ]:          0 :     if ( this != &rTextObj )
    1264                 :            :     {
    1265         [ #  # ]:          0 :         if ( ! ( --mpImplTextObj->mnRefCount ) )
    1266         [ #  # ]:          0 :             delete mpImplTextObj;
    1267                 :          0 :         mpImplTextObj = rTextObj.mpImplTextObj;
    1268                 :          0 :         mpImplTextObj->mnRefCount++;
    1269                 :            :     }
    1270                 :          0 :     return *this;
    1271                 :            : }
    1272                 :            : 
    1273         [ #  # ]:          0 : FontCollectionEntry::~FontCollectionEntry()
    1274                 :            : {
    1275                 :          0 : }
    1276                 :            : 
    1277                 :          0 : void FontCollectionEntry::ImplInit( const String& rName )
    1278                 :            : {
    1279         [ #  # ]:          0 :     String aSubstName( GetSubsFontName( rName, SUBSFONT_ONLYONE | SUBSFONT_MS ) );
    1280         [ #  # ]:          0 :     if ( aSubstName.Len() )
    1281                 :            :     {
    1282         [ #  # ]:          0 :         Name = aSubstName;
    1283                 :          0 :         bIsConverted = sal_True;
    1284                 :            :     }
    1285                 :            :     else
    1286                 :            :     {
    1287         [ #  # ]:          0 :         Name = rName;
    1288                 :          0 :         bIsConverted = sal_False;
    1289         [ #  # ]:          0 :     }
    1290                 :          0 : }
    1291                 :            : 
    1292                 :          0 : FontCollection::~FontCollection()
    1293                 :            : {
    1294 [ #  # ][ #  # ]:          0 :     delete pVDev;
    1295         [ #  # ]:          0 :     xPPTBreakIter = NULL;
    1296                 :          0 : }
    1297                 :            : 
    1298                 :          0 : FontCollection::FontCollection() :
    1299                 :          0 :     pVDev ( NULL )
    1300                 :            : {
    1301                 :            :     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
    1302         [ #  # ]:          0 :         xMSF = ::comphelper::getProcessServiceFactory();
    1303                 :            :     com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
    1304 [ #  # ][ #  # ]:          0 :         xInterface = xMSF->createInstance( "com.sun.star.i18n.BreakIterator" );
    1305         [ #  # ]:          0 :     if ( xInterface.is() )
    1306                 :            :         xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator >
    1307 [ #  # ][ #  # ]:          0 :             ( xInterface, com::sun::star::uno::UNO_QUERY );
    1308                 :          0 : }
    1309                 :            : 
    1310                 :          0 : short FontCollection::GetScriptDirection( const rtl::OUString& rString ) const
    1311                 :            : {
    1312                 :          0 :     short nRet = ScriptTypeDetector::getScriptDirection( rString, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL );
    1313                 :          0 :     return nRet;
    1314                 :            : }
    1315                 :            : 
    1316                 :          0 : sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
    1317                 :            : {
    1318         [ #  # ]:          0 :     if( rEntry.Name.Len() )
    1319                 :            :     {
    1320                 :          0 :         const sal_uInt32 nFonts = maFonts.size();
    1321                 :            : 
    1322         [ #  # ]:          0 :         for( sal_uInt32 i = 0; i < nFonts; i++ )
    1323                 :            :         {
    1324         [ #  # ]:          0 :             const FontCollectionEntry* pEntry = GetById( i );
    1325 [ #  # ][ #  # ]:          0 :             if( pEntry->Name == rEntry.Name )
    1326                 :          0 :                 return i;
    1327                 :            :         }
    1328         [ #  # ]:          0 :         Font aFont;
    1329         [ #  # ]:          0 :         aFont.SetCharSet( rEntry.CharSet );
    1330 [ #  # ][ #  # ]:          0 :         aFont.SetName( rEntry.Original );
    1331         [ #  # ]:          0 :         aFont.SetHeight( 100 );
    1332                 :            : 
    1333         [ #  # ]:          0 :         if ( !pVDev )
    1334 [ #  # ][ #  # ]:          0 :             pVDev = new VirtualDevice;
    1335                 :            : 
    1336         [ #  # ]:          0 :         pVDev->SetFont( aFont );
    1337         [ #  # ]:          0 :         FontMetric aMetric( pVDev->GetFontMetric() );
    1338                 :            : 
    1339 [ #  # ][ #  # ]:          0 :         sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent();
    1340                 :            : 
    1341         [ #  # ]:          0 :         if ( nTxtHeight )
    1342                 :            :         {
    1343                 :          0 :             double fScaling = (double)nTxtHeight / 120.0;
    1344 [ #  # ][ #  # ]:          0 :             if ( ( fScaling > 0.50 ) && ( fScaling < 1.5 ) )
    1345                 :          0 :                 rEntry.Scaling = fScaling;
    1346                 :            :         }
    1347                 :            : 
    1348 [ #  # ][ #  # ]:          0 :         maFonts.push_back(new FontCollectionEntry(rEntry));
                 [ #  # ]
    1349 [ #  # ][ #  # ]:          0 :         return nFonts;
    1350                 :            :     }
    1351                 :          0 :     return 0;
    1352                 :            : }
    1353                 :            : 
    1354                 :          0 : const FontCollectionEntry* FontCollection::GetById( sal_uInt32 nId )
    1355                 :            : {
    1356         [ #  # ]:          0 :     return nId < maFonts.size() ? &maFonts[nId] : NULL;
    1357 [ +  - ][ +  - ]:          9 : }
    1358                 :            : 
    1359                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10