LCOV - code coverage report
Current view: top level - sd/source/filter/eppt - pptx-text.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 775 0.0 %
Date: 2014-04-14 Functions: 0 41 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10