LCOV - code coverage report
Current view: top level - sd/source/filter/eppt - pptx-stylesheet.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 240 303 79.2 %
Date: 2015-06-13 12:38:46 Functions: 11 11 100.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 <epptbase.hxx>
      21             : #include <epptdef.hxx>
      22             : #include <text.hxx>
      23             : #include <tools/color.hxx>
      24             : #include <editeng/svxenum.hxx>
      25             : 
      26             : using namespace ::com::sun::star;
      27             : 
      28         232 : PPTExCharSheet::PPTExCharSheet( int nInstance )
      29             : {
      30         232 :     sal_uInt16 nFontHeight = 24;
      31             : 
      32        1392 :     for ( int nDepth = 0; nDepth < 5; nDepth++ )
      33             :     {
      34        1160 :         PPTExCharLevel& rLev = maCharLevel[ nDepth ];
      35        1160 :         switch ( nInstance )
      36             :         {
      37             :             case EPP_TEXTTYPE_Title :
      38             :             case EPP_TEXTTYPE_CenterTitle :
      39         290 :                 nFontHeight = 44;
      40         290 :             break;
      41             :             case EPP_TEXTTYPE_Body :
      42             :             case EPP_TEXTTYPE_CenterBody :
      43             :             case EPP_TEXTTYPE_HalfBody :
      44             :             case EPP_TEXTTYPE_QuarterBody :
      45             :             {
      46         580 :                 switch ( nDepth )
      47             :                 {
      48         116 :                     case 0 : nFontHeight = 32; break;
      49         116 :                     case 1 : nFontHeight = 28; break;
      50         116 :                     case 2 : nFontHeight = 24; break;
      51         232 :                     default :nFontHeight = 20; break;
      52             :                 }
      53             :             }
      54         580 :             break;
      55             :             case EPP_TEXTTYPE_Notes :
      56         145 :                 nFontHeight = 12;
      57         145 :             break;
      58             :             case EPP_TEXTTYPE_notUsed :
      59             :             case EPP_TEXTTYPE_Other :
      60         145 :                 nFontHeight = 24;
      61         145 :             break;
      62             :         }
      63        1160 :         rLev.mnFlags = 0;
      64        1160 :         rLev.mnFont = 0;
      65        1160 :         rLev.mnAsianOrComplexFont = 0xffff;
      66        1160 :         rLev.mnFontHeight = nFontHeight;
      67        1160 :         rLev.mnFontColor = 0;
      68        1160 :         rLev.mnEscapement = 0;
      69             :     }
      70         232 : }
      71             : 
      72         725 : void PPTExCharSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
      73             :                                     FontCollection& rFontCollection, int nLevel )
      74             : {
      75         725 :     PortionObj  aPortionObj( rXPropSet, rFontCollection );
      76             : 
      77         725 :     PPTExCharLevel& rLev = maCharLevel[ nLevel ];
      78             : 
      79         725 :     if ( aPortionObj.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
      80         725 :         rLev.mnFontColor = aPortionObj.mnCharColor;
      81         725 :     if ( aPortionObj.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
      82         725 :         rLev.mnEscapement = aPortionObj.mnCharEscapement;
      83         725 :     if ( aPortionObj.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
      84         725 :         rLev.mnFontHeight = aPortionObj.mnCharHeight;
      85         725 :     if ( aPortionObj.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
      86         725 :         rLev.mnFont = aPortionObj.mnFont;
      87         725 :     if ( aPortionObj.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
      88         725 :         rLev.mnAsianOrComplexFont = aPortionObj.mnAsianOrComplexFont;
      89         725 :     rLev.mnFlags = aPortionObj.mnCharAttr;
      90         725 : }
      91             : 
      92         135 : void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool, bool bSimpleText,
      93             :     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
      94             : {
      95         135 :     const PPTExCharLevel& rLev = maCharLevel[ nLev ];
      96             : 
      97         135 :     sal_uInt32 nCharFlags = 0xefffff;
      98         135 :     if ( bSimpleText )
      99          60 :         nCharFlags = 0x7ffff;
     100             : 
     101         135 :     rSt.WriteUInt32( nCharFlags )
     102         270 :        .WriteUInt16( rLev.mnFlags )
     103         270 :        .WriteUInt16( rLev.mnFont );
     104             : 
     105         135 :     sal_uInt32 nFontColor = rLev.mnFontColor;
     106         135 :     if ( nFontColor == COL_AUTO )
     107             :     {
     108          90 :         bool bIsDark = false;
     109          90 :         ::com::sun::star::uno::Any aAny;
     110          90 :         if ( PropValue::GetPropertyValue( aAny, rPagePropSet, OUString( "IsBackgroundDark" ), true ) )
     111          90 :             aAny >>= bIsDark;
     112          90 :         nFontColor = bIsDark ? 0xffffff : 0x000000;
     113             :     }
     114         135 :     nFontColor &= 0xffffff;
     115         135 :     nFontColor |= 0xfe000000;
     116         135 :     if ( bSimpleText )
     117             :     {
     118          60 :         rSt.WriteUInt16( rLev.mnFontHeight )
     119          60 :            .WriteUInt32( nFontColor );
     120             :     }
     121             :     else
     122             :     {
     123          75 :         rSt.WriteUInt16( rLev.mnAsianOrComplexFont )
     124          75 :            .WriteUInt16( 0xffff )       // unknown
     125          75 :            .WriteUInt16( 0xffff )       // unknown
     126         150 :            .WriteUInt16( rLev.mnFontHeight )
     127          75 :            .WriteUInt32( nFontColor )
     128         150 :            .WriteUInt16( rLev.mnEscapement );
     129             :     }
     130         135 : }
     131             : 
     132         232 : PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider* pProv ) :
     133             :     pBuProv     ( pProv ),
     134         232 :     mnInstance  ( nInstance )
     135             : {
     136         232 :     bool bHasBullet = false;
     137             : 
     138         232 :     sal_uInt16 nUpperDist = 0;
     139         232 :     sal_uInt16 nBulletChar = 0x2022;
     140         232 :     sal_uInt16 nBulletOfs = 0;
     141         232 :     sal_uInt16 nTextOfs = 0;
     142             : 
     143        1392 :     for ( int nDepth = 0; nDepth < 5; nDepth++ )
     144             :     {
     145        1160 :         PPTExParaLevel& rLev = maParaLevel[ nDepth ];
     146        1160 :         switch ( nInstance )
     147             :         {
     148             :             case EPP_TEXTTYPE_Title :
     149             :             case EPP_TEXTTYPE_CenterTitle :
     150         290 :             break;
     151             :             case EPP_TEXTTYPE_Body :
     152             :             case EPP_TEXTTYPE_CenterBody :
     153             :             case EPP_TEXTTYPE_HalfBody :
     154             :             case EPP_TEXTTYPE_QuarterBody :
     155             :             {
     156         580 :                 bHasBullet = true;
     157         580 :                 nUpperDist = 0x14;
     158             :             }
     159         580 :             break;
     160             :             case EPP_TEXTTYPE_Notes :
     161         145 :                 nUpperDist = 0x1e;
     162         145 :             break;
     163             : 
     164             :         }
     165        1160 :         switch ( nDepth )
     166             :         {
     167             :             case 0 :
     168             :             {
     169         232 :                 nBulletChar = 0x2022;
     170         232 :                 nBulletOfs = 0;
     171         232 :                 nTextOfs = ( bHasBullet ) ? 0xd8 : 0;
     172             :             }
     173         232 :             break;
     174             :             case 1 :
     175             :             {
     176         232 :                 nBulletChar = 0x2013;
     177         232 :                 nBulletOfs = 0x120;
     178         232 :                 nTextOfs = 0x1d4;
     179             :             }
     180         232 :             break;
     181             :             case 2 :
     182             :             {
     183         232 :                 nBulletChar = 0x2022;
     184         232 :                 nBulletOfs = 0x240;
     185         232 :                 nTextOfs = 0x2d0;
     186             :             }
     187         232 :             break;
     188             :             case 3 :
     189             :             {
     190         232 :                 nBulletChar = 0x2013;
     191         232 :                 nBulletOfs = 0x360;
     192         232 :                 nTextOfs = 0x3f0;
     193             :             }
     194         232 :             break;
     195             :             case 4 :
     196             :             {
     197         232 :                 nBulletChar = 0xbb;
     198         232 :                 nBulletOfs = 0x480;
     199         232 :                 nTextOfs = 0x510;
     200             :             }
     201         232 :             break;
     202             :         }
     203        1160 :         rLev.mbIsBullet = bHasBullet;
     204        1160 :         rLev.mnBulletChar = nBulletChar;
     205        1160 :         rLev.mnBulletFont = 0;
     206        1160 :         rLev.mnBulletHeight = 100;
     207        1160 :         rLev.mnBulletColor = 0;
     208        1160 :         rLev.mnAdjust = 0;
     209        1160 :         rLev.mnLineFeed = 100;
     210        1160 :         rLev.mnLowerDist = 0;
     211        1160 :         rLev.mnUpperDist = nUpperDist;
     212        1160 :         rLev.mnTextOfs = nTextOfs;
     213        1160 :         rLev.mnBulletOfs = nBulletOfs;
     214        1160 :         rLev.mnDefaultTab = nDefaultTab;
     215        1160 :         rLev.mnAsianSettings = 2;
     216        1160 :         rLev.mnBiDi = 0;
     217             : 
     218        1160 :         rLev.mbExtendedBulletsUsed = false;
     219        1160 :         rLev.mnBulletId = 0xffff;
     220        1160 :         rLev.mnBulletStart = 0;
     221        1160 :         rLev.mnMappedNumType = 0;
     222        1160 :         rLev.mnNumberingType = 0;
     223             :     }
     224         232 : }
     225             : 
     226         725 : void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
     227             :                                         FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel )
     228             : {
     229         725 :     ParagraphObj aParagraphObj( rXPropSet, pBuProv );
     230         725 :     aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight );
     231         725 :     PPTExParaLevel& rLev = maParaLevel[ nLevel ];
     232             : 
     233         725 :     if ( aParagraphObj.meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     234         725 :         rLev.mnAdjust = aParagraphObj.mnTextAdjust;
     235         725 :     if ( aParagraphObj.meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     236             :     {
     237         725 :         sal_Int16 nLineSpacing = aParagraphObj.mnLineSpacing;
     238         725 :         if ( nLineSpacing > 0 ) // if nLinespacing is < 0 the linespacing is an absolute spacing
     239             :         {
     240         725 :             bool bFixedLineSpacing = false;
     241         725 :             uno::Any aAny = rXPropSet->getPropertyValue("FontIndependentLineSpacing");
     242         725 :             if( !(aAny >>= bFixedLineSpacing) || !bFixedLineSpacing )
     243             :             {
     244         700 :                 const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
     245         700 :                 if ( pDesc )
     246         700 :                     nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
     247         725 :             }
     248             :         }
     249             :         else
     250             :         {
     251           0 :             if ( rCharLevel.mnFontHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
     252             :             {
     253           0 :                 const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
     254           0 :                 if ( pDesc )
     255           0 :                      nLineSpacing = (sal_Int16)( (double)100.0 * pDesc->Scaling + 0.5 );
     256             :                 else
     257           0 :                     nLineSpacing = 100;
     258             :             }
     259             :             else
     260           0 :                 nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
     261             :         }
     262         725 :         rLev.mnLineFeed = nLineSpacing;
     263             :     }
     264         725 :     if ( aParagraphObj.meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     265         725 :         rLev.mnLowerDist = aParagraphObj.mnLineSpacingBottom;
     266         725 :     if ( aParagraphObj.meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     267         725 :         rLev.mnUpperDist = aParagraphObj.mnLineSpacingTop;
     268         725 :     if ( aParagraphObj.meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     269             :     {
     270         725 :         rLev.mnAsianSettings &=~1;
     271         725 :         if ( aParagraphObj.mbForbiddenRules )
     272         725 :             rLev.mnAsianSettings |= 1;
     273             :     }
     274         725 :     if ( aParagraphObj.meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     275             :     {
     276         725 :         rLev.mnAsianSettings &=~4;
     277         725 :         if ( aParagraphObj.mbParagraphPunctation )
     278         210 :             rLev.mnAsianSettings |= 4;
     279             :     }
     280             : 
     281         725 :     if ( aParagraphObj.meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
     282         725 :         rLev.mnBiDi = aParagraphObj.mnBiDi;
     283             : 
     284         725 :     rLev.mbIsBullet = aParagraphObj.mbIsBullet; //( ( aParagraphObj.nBulletFlags & 1 ) != 0 );
     285             : 
     286         725 :     if ( !nLevel )
     287             :     {
     288         145 :         if (aParagraphObj.bExtendedParameters &&
     289           0 :              aParagraphObj.meBullet == ::com::sun::star::beans::PropertyState_DIRECT_VALUE)
     290             :         {
     291           0 :             for ( sal_Int16 i = 0; i < 5; i++ )
     292             :             {
     293           0 :                 PPTExParaLevel& rLevel = maParaLevel[ i ];
     294           0 :                 if ( i )
     295           0 :                     aParagraphObj.ImplGetNumberingLevel( pBuProv, i, false );
     296           0 :                 rLevel.mnTextOfs = aParagraphObj.nTextOfs;
     297           0 :                 rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs;
     298           0 :                 rLevel.mnBulletChar = aParagraphObj.cBulletId;
     299             :                 FontCollectionEntry aFontDescEntry( aParagraphObj.aFontDesc.Name, aParagraphObj.aFontDesc.Family,
     300           0 :                                                         aParagraphObj.aFontDesc.Pitch, aParagraphObj.aFontDesc.CharSet );
     301           0 :                 rLevel.mnBulletFont = (sal_uInt16)rFontCollection.GetId( aFontDescEntry );
     302           0 :                 rLevel.mnBulletHeight = aParagraphObj.nBulletRealSize;
     303           0 :                 rLevel.mnBulletColor = aParagraphObj.nBulletColor;
     304             : 
     305           0 :                 rLevel.mbExtendedBulletsUsed = aParagraphObj.bExtendedBulletsUsed;
     306           0 :                 rLevel.mnBulletId = aParagraphObj.nBulletId;
     307           0 :                 rLevel.mnNumberingType = aParagraphObj.nNumberingType;
     308           0 :                 rLevel.mnBulletStart = aParagraphObj.nStartWith;
     309           0 :                 rLevel.mnMappedNumType = aParagraphObj.nMappedNumType;
     310           0 :             }
     311             :         }
     312         725 :     }
     313         725 : }
     314             : 
     315         135 : void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, bool, bool bSimpleText,
     316             :     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
     317             : {
     318         135 :     const PPTExParaLevel& rLev = maParaLevel[ nLev ];
     319             : 
     320         135 :     if ( maParaLevel[ 0 ].mbExtendedBulletsUsed || maParaLevel[ 1 ].mbExtendedBulletsUsed ||
     321         135 :             maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed ||
     322             :                 maParaLevel[ 4 ].mbExtendedBulletsUsed )
     323             :     {
     324           0 :         SvStream& rOut = pBuProv->aBuExMasterStream;
     325           0 :         if ( !nLev )
     326             :         {
     327           0 :             rOut.WriteUInt32( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) )
     328           0 :                 .WriteUInt32( 5 * 16 + 2 )
     329           0 :                 .WriteUInt16( 5 );              // depth
     330             :         }
     331           0 :         sal_uInt16 nBulletId = rLev.mnBulletId;
     332           0 :         if ( rLev.mnNumberingType != SVX_NUM_BITMAP )
     333           0 :             nBulletId = 0xffff;
     334           0 :         rOut.WriteUInt32( 0x03800000 )
     335           0 :             .WriteUInt16( nBulletId )
     336           0 :             .WriteUInt32( rLev.mnMappedNumType )
     337           0 :             .WriteUInt16( rLev.mnBulletStart )
     338           0 :             .WriteUInt32( 0 );
     339             :     }
     340             : 
     341         135 :     sal_uInt32 nParaFlags = 0x3ffdff;
     342         135 :     sal_uInt16 nBulletFlags = ( rLev.mbIsBullet ) ? 0xf : 0xe;
     343             : 
     344         135 :     if ( nLev )
     345         108 :         nParaFlags &= 0x207fff;
     346         135 :     if ( bSimpleText )
     347          60 :         nParaFlags &= 0x7fff;
     348         135 :     sal_uInt32 nBulletColor = rLev.mnBulletColor;
     349         135 :     if ( nBulletColor == COL_AUTO )
     350             :     {
     351           0 :         bool bIsDark = false;
     352           0 :         ::com::sun::star::uno::Any aAny;
     353           0 :         if ( PropValue::GetPropertyValue( aAny, rPagePropSet, OUString( "IsBackgroundDark" ), true ) )
     354           0 :             aAny >>= bIsDark;
     355           0 :         nBulletColor = bIsDark ? 0xffffff : 0x000000;
     356             :     }
     357         135 :     nBulletColor &= 0xffffff;
     358         135 :     nBulletColor |= 0xfe000000;
     359         135 :     rSt.WriteUInt32( nParaFlags )
     360         270 :        .WriteUInt16( nBulletFlags )
     361         270 :        .WriteUInt16( rLev.mnBulletChar )
     362         270 :        .WriteUInt16( rLev.mnBulletFont )
     363         270 :        .WriteUInt16( rLev.mnBulletHeight )
     364         135 :        .WriteUInt32( nBulletColor )
     365         270 :        .WriteUInt16( rLev.mnAdjust )
     366         270 :        .WriteUInt16( rLev.mnLineFeed )
     367         270 :        .WriteUInt16( rLev.mnUpperDist )
     368         270 :        .WriteUInt16( rLev.mnLowerDist )
     369         270 :        .WriteUInt16( rLev.mnTextOfs )
     370         270 :        .WriteUInt16( rLev.mnBulletOfs );
     371             : 
     372         135 :     if ( bSimpleText || nLev )
     373             :     {
     374         240 :         if ( nParaFlags & 0x200000 )
     375          60 :             rSt.WriteUInt16( rLev.mnBiDi );
     376             :     }
     377             :     else
     378             :     {
     379          15 :         rSt.WriteUInt16( rLev.mnDefaultTab )
     380          15 :            .WriteUInt16( 0 )
     381          15 :            .WriteUInt16( 0 )
     382          30 :            .WriteUInt16( rLev.mnAsianSettings )
     383          30 :            .WriteUInt16( rLev.mnBiDi );
     384             :     }
     385         135 : }
     386             : 
     387          29 : PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider* pBuProv )
     388             : {
     389         290 :     for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
     390             :     {
     391         261 :         mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, pBuProv );
     392         261 :         mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance );
     393             :     }
     394          29 : }
     395             : 
     396           3 : PPTExStyleSheet::~PPTExStyleSheet()
     397             : {
     398          30 :     for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
     399             :     {
     400          27 :         if ( nInstance == EPP_TEXTTYPE_notUsed )
     401           3 :             continue;
     402             : 
     403          24 :         delete mpParaSheet[ nInstance ];
     404          24 :         delete mpCharSheet[ nInstance ];
     405             :     }
     406           3 : }
     407             : 
     408         725 : void PPTExStyleSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
     409             :                                         FontCollection& rFontCollection, int nInstance, int nLevel )
     410             : {
     411         725 :     if ( nInstance == EPP_TEXTTYPE_notUsed )
     412         725 :         return;
     413         725 :     mpCharSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel );
     414         725 :     mpParaSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel, mpCharSheet[ nInstance ]->maCharLevel[ nLevel ] );
     415             : }
     416             : 
     417         252 : bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue )
     418             : {
     419         252 :     const PPTExParaLevel& rPara = mpParaSheet[ nInstance ]->maParaLevel[ nLevel ];
     420         252 :     const PPTExCharLevel& rChar = mpCharSheet[ nInstance ]->maCharLevel[ nLevel ];
     421             : 
     422         252 :     sal_uInt32 nFlag = 0;
     423             : 
     424         252 :     switch ( eAttr )
     425             :     {
     426           0 :         case ParaAttr_BulletOn : return ( rPara.mbIsBullet ) ? nValue == 0 : nValue != 0;
     427             :         case ParaAttr_BuHardFont :
     428           0 :         case ParaAttr_BulletFont : return ( rPara.mnBulletFont != nValue );
     429             :         case ParaAttr_BuHardColor :
     430           0 :         case ParaAttr_BulletColor : return ( rPara.mnBulletColor != nValue );
     431             :         case ParaAttr_BuHardHeight :
     432           0 :         case ParaAttr_BulletHeight : return ( rPara.mnBulletHeight != nValue );
     433           0 :         case ParaAttr_BulletChar : return ( rPara.mnBulletChar != nValue );
     434          21 :         case ParaAttr_Adjust : return ( rPara.mnAdjust != nValue );
     435           0 :         case ParaAttr_LineFeed : return ( rPara.mnLineFeed != nValue );
     436          63 :         case ParaAttr_UpperDist : return ( rPara.mnUpperDist != nValue );
     437          21 :         case ParaAttr_LowerDist : return ( rPara.mnLowerDist != nValue );
     438          21 :         case ParaAttr_TextOfs : return ( rPara.mnTextOfs != nValue );
     439          21 :         case ParaAttr_BulletOfs : return ( rPara.mnBulletOfs != nValue );
     440           0 :         case ParaAttr_DefaultTab : return ( rPara.mnDefaultTab != nValue );
     441          21 :         case ParaAttr_BiDi : return ( rPara.mnBiDi != nValue );
     442           0 :         case CharAttr_Bold : nFlag = 1; break;
     443           0 :         case CharAttr_Italic : nFlag = 2; break;
     444           0 :         case CharAttr_Underline : nFlag = 4; break;
     445           0 :         case CharAttr_Shadow : nFlag = 16; break;
     446           0 :         case CharAttr_Strikeout : nFlag = 256; break;
     447           0 :         case CharAttr_Embossed : nFlag = 512; break;
     448          21 :         case CharAttr_Font : return ( rChar.mnFont != nValue );
     449          21 :         case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue );
     450           0 :         case CharAttr_Symbol : return true;
     451           0 :         case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue );
     452          21 :         case CharAttr_FontColor : return ( rChar.mnFontColor != nValue );
     453          21 :         case CharAttr_Escapement : return ( rChar.mnEscapement != nValue );
     454             :         default:
     455           0 :             break;
     456             :     }
     457           0 :     if ( nFlag )
     458             :     {
     459           0 :         if ( rChar.mnFlags & nFlag )
     460           0 :             return ( ( nValue & nFlag ) == 0 );
     461             :         else
     462           0 :             return ( ( nValue & nFlag ) != 0 );
     463             :     }
     464           0 :     return true;
     465             : }
     466             : 
     467             : // the TxCFStyleAtom stores the text properties that are used
     468             : // when creating new objects in PowerPoint.
     469             : 
     470           3 : void PPTExStyleSheet::WriteTxCFStyleAtom( SvStream& rSt )
     471             : {
     472           3 :     const PPTExCharLevel& rCharStyle = mpCharSheet[ EPP_TEXTTYPE_Other ]->maCharLevel[ 0 ];
     473             : 
     474             :     sal_uInt16 nFlags = 0x60        // ??
     475             :                       | 0x02        // fontsize;
     476           3 :                       | 0x04;       // fontcolor
     477             : 
     478           3 :     sal_uInt32 nCharFlags = rCharStyle.mnFlags;
     479           3 :     nCharFlags &= CharAttr_Italic | CharAttr_Bold | CharAttr_Underline | CharAttr_Shadow;
     480             : 
     481           3 :     rSt.WriteUInt32( EPP_TxCFStyleAtom << 16 )  // recordheader
     482           6 :        .WriteUInt32( SizeOfTxCFStyleAtom() - 8 )
     483           6 :        .WriteUInt16( 0x80 | nCharFlags )
     484           6 :        .WriteUInt16( nFlags )
     485           6 :        .WriteUInt16( nCharFlags )
     486           3 :        .WriteInt32( -1 )                            // ?
     487           6 :        .WriteUInt16( rCharStyle.mnFontHeight )
     488           6 :        .WriteUInt32( rCharStyle.mnFontColor );
     489           3 : }
     490             : 
     491             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11