LCOV - code coverage report
Current view: top level - sw/source/ui/config - uinums.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 292 0.0 %
Date: 2012-08-25 Functions: 0 24 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 470 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <hintids.hxx>
      31                 :            : #include <svl/urihelper.hxx>
      32                 :            : #include <unotools/pathoptions.hxx>
      33                 :            : #include <tools/stream.hxx>
      34                 :            : #include <sfx2/docfile.hxx>
      35                 :            : #include <svl/itemiter.hxx>
      36                 :            : #include <editeng/brshitem.hxx>
      37                 :            : 
      38                 :            : #include <tools/resid.hxx>
      39                 :            : #include <fmtornt.hxx>
      40                 :            : #include <swtypes.hxx>      // empty string
      41                 :            : #include <wrtsh.hxx>
      42                 :            : #include <uinums.hxx>
      43                 :            : #include <poolfmt.hxx>
      44                 :            : #include <charfmt.hxx>
      45                 :            : #include <frmatr.hxx>
      46                 :            : 
      47                 :            : #include <unomid.h>
      48                 :            : 
      49                 :            : using namespace ::com::sun::star;
      50                 :            : 
      51                 :            : 
      52                 :            : #define VERSION_30B     ((sal_uInt16)250)
      53                 :            : #define VERSION_31B     ((sal_uInt16)326)
      54                 :            : #define VERSION_40A     ((sal_uInt16)364)
      55                 :            : #define VERSION_50A     ((sal_uInt16)373)
      56                 :            : #define VERSION_53A     ((sal_uInt16)596)
      57                 :            : #define ACT_NUM_VERSION VERSION_53A
      58                 :            : 
      59                 :            : #define CHAPTER_FILENAME "chapter.cfg"
      60                 :            : 
      61                 :            : 
      62                 :            : // SwNumRulesWithName ----------------------------------------------------
      63                 :            : // PUBLIC METHODES -------------------------------------------------------
      64                 :            : /*------------------------------------------------------------------------
      65                 :            :  Description:   Saving a rule
      66                 :            :  Parameter:     rCopy -- the rule to save
      67                 :            :                     nIdx -- position, where the rule is to be saved.
      68                 :            :                         An old rule at that position will be overwritten.
      69                 :            : ------------------------------------------------------------------------*/
      70                 :            : 
      71                 :          0 : SwBaseNumRules::SwBaseNumRules( const String& rFileName )
      72                 :            :     :
      73                 :            :     sFileName( rFileName ),
      74                 :            :     nVersion(0),
      75                 :          0 :     bModified( sal_False )
      76                 :            : {
      77         [ #  # ]:          0 :     Init();
      78                 :          0 : }
      79                 :            : 
      80                 :          0 : SwBaseNumRules::~SwBaseNumRules()
      81                 :            : {
      82         [ #  # ]:          0 :     if( bModified )
      83                 :            :     {
      84         [ #  # ]:          0 :         SvtPathOptions aPathOpt;
      85 [ #  # ][ #  # ]:          0 :         String sNm( aPathOpt.GetUserConfigPath() );
      86         [ #  # ]:          0 :         sNm += INET_PATH_TOKEN;
      87         [ #  # ]:          0 :         sNm += sFileName;
      88 [ #  # ][ #  # ]:          0 :         INetURLObject aTempObj(sNm);
      89 [ #  # ][ #  # ]:          0 :         sNm = aTempObj.GetFull();
      90                 :            :         SfxMedium aStrm( sNm, STREAM_WRITE | STREAM_TRUNC |
      91         [ #  # ]:          0 :                                         STREAM_SHARE_DENYALL );
      92 [ #  # ][ #  # ]:          0 :         Store( *aStrm.GetOutStream() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      93                 :            :     }
      94                 :            : 
      95         [ #  # ]:          0 :     for( sal_uInt16 i = 0; i < nMaxRules; ++i )
      96 [ #  # ][ #  # ]:          0 :         delete pNumRules[i];
      97         [ #  # ]:          0 : }
      98                 :            : 
      99                 :          0 : void  SwBaseNumRules::Init()
     100                 :            : {
     101         [ #  # ]:          0 :     for(sal_uInt16 i = 0; i < nMaxRules; ++i )
     102                 :          0 :         pNumRules[i] = 0;
     103                 :            : 
     104         [ #  # ]:          0 :     String sNm( sFileName );
     105         [ #  # ]:          0 :     SvtPathOptions aOpt;
     106 [ #  # ][ #  # ]:          0 :     if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG ))
     107                 :            :     {
     108         [ #  # ]:          0 :         SfxMedium aStrm( sNm, STREAM_STD_READ );
     109 [ #  # ][ #  # ]:          0 :         Load( *aStrm.GetInStream() );
                 [ #  # ]
     110 [ #  # ][ #  # ]:          0 :     }
     111                 :          0 : }
     112                 :            : 
     113                 :          0 : void SwBaseNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, sal_uInt16 nIdx)
     114                 :            : {
     115                 :            :     OSL_ENSURE(nIdx < nMaxRules, "Array der NumRules ueberindiziert.");
     116         [ #  # ]:          0 :     if( !pNumRules[nIdx] )
     117         [ #  # ]:          0 :         pNumRules[nIdx] = new SwNumRulesWithName( rCopy );
     118                 :            :     else
     119                 :          0 :         *pNumRules[nIdx] = rCopy;
     120                 :          0 : }
     121                 :            : 
     122                 :            : // PROTECTED METHODS ----------------------------------------------------
     123                 :          0 : sal_Bool SwBaseNumRules::Store(SvStream &rStream)
     124                 :            : {
     125                 :          0 :     rStream << ACT_NUM_VERSION;
     126                 :            :         // Write, what positions are occupied by a rule
     127                 :            :         // Then write each of the rules
     128         [ #  # ]:          0 :     for(sal_uInt16 i = 0; i < nMaxRules; ++i)
     129                 :            :     {
     130         [ #  # ]:          0 :         if(pNumRules[i])
     131                 :            :         {
     132                 :          0 :             rStream << (unsigned char) sal_True;
     133                 :          0 :             pNumRules[i]->Store( rStream );
     134                 :            :         }
     135                 :            :         else
     136                 :          0 :             rStream << (unsigned char) sal_False;
     137                 :            :     }
     138                 :          0 :     return sal_True;
     139                 :            : }
     140                 :            : 
     141                 :          0 : int SwBaseNumRules::Load(SvStream &rStream)
     142                 :            : {
     143                 :          0 :     int         rc = 0;
     144                 :            : 
     145                 :          0 :     rStream >> nVersion;
     146                 :            : 
     147                 :            :     // due to a small but serious mistake, PreFinal writes the same VERION_40A as SP2
     148                 :            :     // #55402#
     149         [ #  # ]:          0 :     if(VERSION_40A == nVersion)
     150                 :            :     {
     151                 :            :         OSL_FAIL("Version 364 is not clear #55402#");
     152                 :            :     }
     153 [ #  # ][ #  # ]:          0 :     else if( VERSION_30B == nVersion || VERSION_31B == nVersion ||
                 [ #  # ]
     154                 :            :              ACT_NUM_VERSION >= nVersion )
     155                 :            :     {
     156                 :          0 :         unsigned char bRule = sal_False;
     157         [ #  # ]:          0 :         for(sal_uInt16 i = 0; i < nMaxRules; ++i)
     158                 :            :         {
     159         [ #  # ]:          0 :             rStream >> bRule;
     160         [ #  # ]:          0 :             if(bRule)
     161 [ #  # ][ #  # ]:          0 :                 pNumRules[i] = new SwNumRulesWithName( rStream, nVersion );
     162                 :          0 :         }
     163                 :            :     }
     164                 :            :     else
     165                 :            :     {
     166                 :          0 :         rc = 1;
     167                 :            :     }
     168                 :            : 
     169                 :          0 :     return rc;
     170                 :            : }
     171                 :            : 
     172                 :          0 : SwChapterNumRules::SwChapterNumRules() :
     173 [ #  # ][ #  # ]:          0 :     SwBaseNumRules(rtl::OUString(CHAPTER_FILENAME))
                 [ #  # ]
     174                 :            : {
     175                 :          0 : }
     176                 :            : 
     177                 :          0 :  SwChapterNumRules::~SwChapterNumRules()
     178                 :            : {
     179         [ #  # ]:          0 : }
     180                 :            : 
     181                 :          0 : void SwChapterNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, sal_uInt16 nIdx)
     182                 :            : {
     183                 :          0 :     bModified = sal_True;
     184                 :          0 :     SwBaseNumRules::ApplyNumRules(rCopy, nIdx);
     185                 :          0 : }
     186                 :            : 
     187                 :          0 : SwNumRulesWithName::SwNumRulesWithName( const SwNumRule &rCopy,
     188                 :            :                                         const String &rName )
     189                 :          0 :     : maName(rName)
     190                 :            : {
     191         [ #  # ]:          0 :     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     192                 :            :     {
     193         [ #  # ]:          0 :         const SwNumFmt* pFmt = rCopy.GetNumFmt( n );
     194         [ #  # ]:          0 :         if( pFmt )
     195 [ #  # ][ #  # ]:          0 :             aFmts[ n ] = new _SwNumFmtGlobal( *pFmt );
     196                 :            :         else
     197                 :          0 :             aFmts[ n ] = 0;
     198                 :            :     }
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : SwNumRulesWithName::SwNumRulesWithName( const SwNumRulesWithName& rCopy )
     202                 :            : {
     203                 :          0 :     memset( aFmts, 0, sizeof( aFmts ));
     204         [ #  # ]:          0 :     *this = rCopy;
     205                 :          0 : }
     206                 :            : 
     207                 :          0 : SwNumRulesWithName::~SwNumRulesWithName()
     208                 :            : {
     209         [ #  # ]:          0 :     for( int n = 0; n < MAXLEVEL; ++n )
     210 [ #  # ][ #  # ]:          0 :         delete aFmts[ n ];
     211                 :          0 : }
     212                 :            : 
     213                 :          0 : const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCopy)
     214                 :            : {
     215         [ #  # ]:          0 :     if( this != &rCopy )
     216                 :            :     {
     217                 :          0 :         maName = rCopy.maName;
     218         [ #  # ]:          0 :         for( int n = 0; n < MAXLEVEL; ++n )
     219                 :            :         {
     220         [ #  # ]:          0 :             delete aFmts[ n ];
     221                 :            : 
     222                 :          0 :             _SwNumFmtGlobal* pFmt = rCopy.aFmts[ n ];
     223         [ #  # ]:          0 :             if( pFmt )
     224         [ #  # ]:          0 :                 aFmts[ n ] = new _SwNumFmtGlobal( *pFmt );
     225                 :            :             else
     226                 :          0 :                 aFmts[ n ] = 0;
     227                 :            :         }
     228                 :            :     }
     229                 :          0 :     return *this;
     230                 :            : }
     231                 :            : 
     232                 :          0 : SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, sal_uInt16 nVersion )
     233                 :            : {
     234         [ #  # ]:          0 :     CharSet eEncoding = osl_getThreadTextEncoding();
     235 [ #  # ][ #  # ]:          0 :     maName = rStream.ReadUniOrByteString(eEncoding);
     236                 :            : 
     237                 :            :     char c;
     238         [ #  # ]:          0 :     for(sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     239                 :            :     {
     240         [ #  # ]:          0 :         if( VERSION_30B == nVersion )
     241                 :          0 :             c = 1;
     242                 :            :         // due to a small but serious mistake, PreFinal writes the same VERION_40A as SP2
     243                 :            :         // #55402#
     244 [ #  # ][ #  # ]:          0 :         else if(nVersion < VERSION_40A && n > 5)
     245                 :          0 :             c = 0;
     246                 :            :         else
     247         [ #  # ]:          0 :             rStream >> c;
     248                 :            : 
     249         [ #  # ]:          0 :         if( c )
     250 [ #  # ][ #  # ]:          0 :             aFmts[ n ] = new _SwNumFmtGlobal( rStream, nVersion );
     251                 :            :         else
     252                 :          0 :             aFmts[ n ] = 0;
     253                 :            :     }
     254                 :          0 : }
     255                 :            : 
     256                 :          0 : void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const
     257                 :            : {
     258                 :            :     // #i89178#
     259         [ #  # ]:          0 :     rChg = SwNumRule( maName, numfunc::GetDefaultPositionAndSpaceMode() );
     260                 :          0 :     rChg.SetAutoRule( sal_False );
     261                 :            :     _SwNumFmtGlobal* pFmt;
     262         [ #  # ]:          0 :     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     263         [ #  # ]:          0 :         if( 0 != ( pFmt = aFmts[ n ] ) )
     264                 :            :         {
     265         [ #  # ]:          0 :             SwNumFmt aNew;
     266         [ #  # ]:          0 :             pFmt->ChgNumFmt( rSh, aNew );
     267 [ #  # ][ #  # ]:          0 :             rChg.Set( n, aNew );
     268                 :            :         }
     269                 :          0 : }
     270                 :            : 
     271                 :          0 : void SwNumRulesWithName::Store( SvStream &rStream )
     272                 :            : {
     273                 :          0 :     CharSet eEncoding = osl_getThreadTextEncoding();
     274         [ #  # ]:          0 :     rStream.WriteUniOrByteString(maName, eEncoding);
     275                 :            : 
     276         [ #  # ]:          0 :     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     277                 :            :     {
     278                 :          0 :         _SwNumFmtGlobal* pFmt = aFmts[ n ];
     279         [ #  # ]:          0 :         if( pFmt )
     280                 :            :         {
     281                 :          0 :             rStream << (char)1;
     282                 :          0 :             pFmt->Store( rStream );
     283                 :            :         }
     284                 :            :         else
     285                 :          0 :             rStream << (char)0;
     286                 :            :     }
     287                 :          0 : }
     288                 :            : 
     289                 :          0 : SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const SwNumFmt& rFmt )
     290 [ #  # ][ #  # ]:          0 :     : aFmt( rFmt ), nCharPoolId( USHRT_MAX )
     291                 :            : {
     292                 :            :     // relative gaps?????
     293                 :            : 
     294                 :          0 :     SwCharFmt* pFmt = rFmt.GetCharFmt();
     295         [ #  # ]:          0 :     if( pFmt )
     296                 :            :     {
     297         [ #  # ]:          0 :         sCharFmtName = pFmt->GetName();
     298                 :          0 :         nCharPoolId = pFmt->GetPoolFmtId();
     299         [ #  # ]:          0 :         if( pFmt->GetAttrSet().Count() )
     300                 :            :         {
     301         [ #  # ]:          0 :             SfxItemIter aIter( pFmt->GetAttrSet() );
     302                 :          0 :             const SfxPoolItem *pCurr = aIter.GetCurItem();
     303                 :          0 :             while( sal_True )
     304                 :            :             {
     305 [ #  # ][ #  # ]:          0 :                 aItems.push_back( pCurr->Clone() );
     306         [ #  # ]:          0 :                 if( aIter.IsAtEnd() )
     307                 :          0 :                     break;
     308         [ #  # ]:          0 :                 pCurr = aIter.NextItem();
     309         [ #  # ]:          0 :             }
     310                 :            :         }
     311                 :            : 
     312         [ #  # ]:          0 :         aFmt.SetCharFmt( 0 );
     313                 :            :     }
     314                 :          0 : }
     315                 :            : 
     316                 :          0 : SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const _SwNumFmtGlobal& rFmt )
     317                 :            :     :
     318                 :            :     aFmt( rFmt.aFmt ),
     319                 :            :     sCharFmtName( rFmt.sCharFmtName ),
     320 [ #  # ][ #  # ]:          0 :     nCharPoolId( rFmt.nCharPoolId )
     321                 :            : {
     322         [ #  # ]:          0 :     for( sal_uInt16 n = rFmt.aItems.size(); n; )
     323 [ #  # ][ #  # ]:          0 :         aItems.push_back( rFmt.aItems[ --n ].Clone() );
                 [ #  # ]
     324                 :          0 : }
     325                 :            : 
     326                 :          0 : SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
     327                 :            :                                                         sal_uInt16 nVersion )
     328 [ #  # ][ #  # ]:          0 :     : nCharPoolId( USHRT_MAX )
     329                 :            : {
     330         [ #  # ]:          0 :     CharSet eEncoding = osl_getThreadTextEncoding();
     331                 :            :     {
     332                 :            :         sal_uInt16 nUS;
     333                 :            :         short nShort;
     334                 :            :         sal_Char cChar;
     335                 :            :         sal_Bool bFlag;
     336         [ #  # ]:          0 :         String sStr;
     337                 :            : 
     338         [ #  # ]:          0 :         rStream >> nUS;             aFmt.SetNumberingType((sal_Int16)nUS );
     339         [ #  # ]:          0 :         if( VERSION_53A > nVersion )
     340                 :            :         {
     341         [ #  # ]:          0 :             rStream >> cChar;       aFmt.SetBulletChar( cChar );
     342                 :            :         }
     343                 :            :         else
     344                 :            :         {
     345         [ #  # ]:          0 :             rStream >> nUS;         aFmt.SetBulletChar( nUS );
     346                 :            :         }
     347                 :            : 
     348         [ #  # ]:          0 :         rStream >> bFlag;           aFmt.SetIncludeUpperLevels( bFlag );
     349                 :            : 
     350         [ #  # ]:          0 :         if( VERSION_30B == nVersion )
     351                 :            :         {
     352                 :            :             sal_Int32 nL;
     353         [ #  # ]:          0 :             rStream >> cChar;       aFmt.SetStart( (sal_uInt16)cChar );
     354                 :            : 
     355 [ #  # ][ #  # ]:          0 :             sStr = rStream.ReadUniOrByteString(eEncoding);
     356         [ #  # ]:          0 :             aFmt.SetPrefix( sStr );
     357 [ #  # ][ #  # ]:          0 :             sStr = rStream.ReadUniOrByteString(eEncoding);
     358         [ #  # ]:          0 :             aFmt.SetSuffix( sStr );
     359         [ #  # ]:          0 :             rStream >> nUS;         aFmt.SetNumAdjust( SvxAdjust( nUS ) );
     360         [ #  # ]:          0 :             rStream >> nL;          aFmt.SetLSpace( lNumIndent );
     361         [ #  # ]:          0 :             rStream >> nL;          aFmt.SetFirstLineOffset( (short)nL );
     362                 :            :         }
     363                 :            :         else                // old start-value was a Byte
     364                 :            :         {
     365         [ #  # ]:          0 :             rStream >> nUS;         aFmt.SetStart( nUS );
     366 [ #  # ][ #  # ]:          0 :             sStr = rStream.ReadUniOrByteString(eEncoding);
     367         [ #  # ]:          0 :             aFmt.SetPrefix( sStr );
     368 [ #  # ][ #  # ]:          0 :             sStr = rStream.ReadUniOrByteString(eEncoding);
     369         [ #  # ]:          0 :             aFmt.SetSuffix( sStr );
     370         [ #  # ]:          0 :             rStream >> nUS;         aFmt.SetNumAdjust( SvxAdjust( nUS ) );
     371         [ #  # ]:          0 :             rStream >> nUS;         aFmt.SetAbsLSpace( nUS );
     372         [ #  # ]:          0 :             rStream >> nShort;      aFmt.SetFirstLineOffset( nShort );
     373         [ #  # ]:          0 :             rStream >> nUS;         aFmt.SetCharTextDistance( nUS );
     374         [ #  # ]:          0 :             rStream >> nShort;      aFmt.SetLSpace( nShort );
     375         [ #  # ]:          0 :             rStream >> bFlag;
     376                 :            :         }
     377                 :            : 
     378                 :            :         sal_uInt16  nFamily;
     379                 :            :         sal_uInt16  nCharSet;
     380                 :            :         short   nWidth;
     381                 :            :         short   nHeight;
     382                 :            :         sal_uInt16  nPitch;
     383         [ #  # ]:          0 :         String aName;
     384                 :            : 
     385 [ #  # ][ #  # ]:          0 :         aName = rStream.ReadUniOrByteString(eEncoding);
     386 [ #  # ][ #  # ]:          0 :         rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch;
         [ #  # ][ #  # ]
                 [ #  # ]
     387                 :            : 
     388         [ #  # ]:          0 :         if( aName.Len() )
     389                 :            :         {
     390         [ #  # ]:          0 :             Font aFont( static_cast<FontFamily>(nFamily), Size( nWidth, nHeight ) );
     391 [ #  # ][ #  # ]:          0 :             aFont.SetName( aName );
     392         [ #  # ]:          0 :             aFont.SetCharSet( (CharSet)nCharSet );
     393         [ #  # ]:          0 :             aFont.SetPitch( (FontPitch)nPitch );
     394                 :            : 
     395 [ #  # ][ #  # ]:          0 :             aFmt.SetBulletFont( &aFont );
     396                 :            :         }
     397                 :            :         else
     398                 :          0 :             nCharSet = RTL_TEXTENCODING_SYMBOL;
     399                 :            : 
     400         [ #  # ]:          0 :         if( VERSION_53A > nVersion )
     401                 :            :         {
     402                 :          0 :             sal_Char cEncoded(aFmt.GetBulletChar());
     403         [ #  # ]:          0 :             aFmt.SetBulletChar(rtl::OUString(&cEncoded, 1, nCharSet).toChar());
     404 [ #  # ][ #  # ]:          0 :         }
     405                 :            :     }
     406                 :            : 
     407         [ #  # ]:          0 :     if( VERSION_30B != nVersion )
     408                 :            :     {
     409                 :            :         sal_uInt16 nItemCount;
     410         [ #  # ]:          0 :         rStream >> nCharPoolId;
     411 [ #  # ][ #  # ]:          0 :         sCharFmtName = rStream.ReadUniOrByteString(eEncoding);
     412         [ #  # ]:          0 :         rStream >> nItemCount;
     413                 :            : 
     414         [ #  # ]:          0 :         while( nItemCount-- )
     415                 :            :         {
     416                 :            :             sal_uInt16 nWhich, nVers;
     417 [ #  # ][ #  # ]:          0 :             rStream >> nWhich >> nVers;
     418 [ #  # ][ #  # ]:          0 :             aItems.push_back( GetDfltAttr( nWhich )->Create( rStream, nVers ) );
                 [ #  # ]
     419                 :            :         }
     420                 :            :     }
     421                 :            : 
     422 [ #  # ][ #  # ]:          0 :     if( VERSION_40A == nVersion && SVX_NUM_BITMAP == aFmt.GetNumberingType() )
                 [ #  # ]
     423                 :            :     {
     424                 :            :         sal_uInt8 cF;
     425                 :          0 :         sal_Int32 nWidth(0), nHeight(0);
     426                 :            : 
     427 [ #  # ][ #  # ]:          0 :         rStream >> nWidth >> nHeight;
     428                 :            : 
     429                 :          0 :         Size aSz(nWidth, nHeight);
     430                 :            : 
     431         [ #  # ]:          0 :         rStream >> cF;
     432         [ #  # ]:          0 :         if( cF )
     433                 :            :         {
     434                 :          0 :             SvxBrushItem* pBrush = 0;
     435                 :          0 :             SwFmtVertOrient* pVOrient = 0;
     436                 :            :             sal_uInt16 nVer;
     437                 :            : 
     438         [ #  # ]:          0 :             if( cF & 1 )
     439                 :            :             {
     440         [ #  # ]:          0 :                 rStream >> nVer;
     441         [ #  # ]:          0 :                 pBrush = (SvxBrushItem*)GetDfltAttr( RES_BACKGROUND )
     442         [ #  # ]:          0 :                                         ->Create( rStream, nVer );
     443                 :            :             }
     444                 :            : 
     445         [ #  # ]:          0 :             if( cF & 2 )
     446                 :            :             {
     447         [ #  # ]:          0 :                 rStream >> nVer;
     448         [ #  # ]:          0 :                 pVOrient = (SwFmtVertOrient*)GetDfltAttr( RES_VERT_ORIENT )
     449         [ #  # ]:          0 :                                         ->Create( rStream, nVer );
     450                 :            :             }
     451                 :          0 :             sal_Int16 eOrient = text::VertOrientation::NONE;
     452         [ #  # ]:          0 :             if(pVOrient)
     453                 :          0 :                 eOrient = (sal_Int16)pVOrient->GetVertOrient();
     454 [ #  # ][ #  # ]:          0 :             aFmt.SetGraphicBrush( pBrush, &aSz, pVOrient ? &eOrient : 0 );
     455                 :            :         }
     456                 :            :     }
     457                 :          0 : }
     458                 :            : 
     459 [ #  # ][ #  # ]:          0 : SwNumRulesWithName::_SwNumFmtGlobal::~_SwNumFmtGlobal()
     460                 :            : {
     461                 :          0 : }
     462                 :            : 
     463                 :          0 : void SwNumRulesWithName::_SwNumFmtGlobal::Store( SvStream& rStream )
     464                 :            : {
     465                 :          0 :     CharSet eEncoding = osl_getThreadTextEncoding();
     466                 :            :     {
     467         [ #  # ]:          0 :         String aName;
     468                 :          0 :         sal_uInt16 nFamily = FAMILY_DONTKNOW, nCharSet = 0, nPitch = 0;
     469                 :          0 :         short  nWidth = 0, nHeight = 0;
     470                 :            : 
     471                 :          0 :         const Font* pFnt = aFmt.GetBulletFont();
     472         [ #  # ]:          0 :         if( pFnt )
     473                 :            :         {
     474 [ #  # ][ #  # ]:          0 :             aName = pFnt->GetName();
     475         [ #  # ]:          0 :             nFamily = (sal_uInt16)pFnt->GetFamily();
     476         [ #  # ]:          0 :             nCharSet = (sal_uInt16)pFnt->GetCharSet();
     477         [ #  # ]:          0 :             nWidth = (short)pFnt->GetSize().Width();
     478         [ #  # ]:          0 :             nHeight = (short)pFnt->GetSize().Height();
     479         [ #  # ]:          0 :             nPitch = (sal_uInt16)pFnt->GetPitch();
     480                 :            :         }
     481                 :            : 
     482         [ #  # ]:          0 :         rStream << sal_uInt16(aFmt.GetNumberingType())
     483         [ #  # ]:          0 :                 << aFmt.GetBulletChar()
     484         [ #  # ]:          0 :                 << static_cast<sal_Bool>(aFmt.GetIncludeUpperLevels() > 0)
     485         [ #  # ]:          0 :                 << aFmt.GetStart();
     486         [ #  # ]:          0 :         rStream.WriteUniOrByteString( aFmt.GetPrefix(), eEncoding );
     487         [ #  # ]:          0 :         rStream.WriteUniOrByteString( aFmt.GetSuffix(), eEncoding );
     488         [ #  # ]:          0 :         rStream << sal_uInt16( aFmt.GetNumAdjust() )
     489 [ #  # ][ #  # ]:          0 :                 << aFmt.GetAbsLSpace()
     490 [ #  # ][ #  # ]:          0 :                 << aFmt.GetFirstLineOffset()
     491 [ #  # ][ #  # ]:          0 :                 << aFmt.GetCharTextDistance()
     492 [ #  # ][ #  # ]:          0 :                 << aFmt.GetLSpace()
     493         [ #  # ]:          0 :                 << sal_False;//aFmt.IsRelLSpace();
     494 [ #  # ][ #  # ]:          0 :         rStream.WriteUniOrByteString( aName, eEncoding );
     495         [ #  # ]:          0 :         rStream << nFamily
     496         [ #  # ]:          0 :                 << nCharSet
     497         [ #  # ]:          0 :                 << nWidth
     498         [ #  # ]:          0 :                 << nHeight
     499 [ #  # ][ #  # ]:          0 :                 << nPitch;
     500                 :            :     }
     501                 :          0 :     rStream << nCharPoolId;
     502         [ #  # ]:          0 :     rStream.WriteUniOrByteString( sCharFmtName, eEncoding );
     503                 :          0 :     rStream << static_cast<sal_uInt16>(aItems.size());
     504                 :            : 
     505         [ #  # ]:          0 :     for( sal_uInt16 n = aItems.size(); n; )
     506                 :            :     {
     507                 :          0 :         SfxPoolItem* pItem = &aItems[ --n ];
     508                 :          0 :         sal_uInt16 nIVers = pItem->GetVersion( SOFFICE_FILEFORMAT_50 );
     509                 :            :         OSL_ENSURE( nIVers != USHRT_MAX,
     510                 :            :                 "Was'n das: Item-Version USHRT_MAX in der aktuellen Version" );
     511                 :          0 :         rStream << pItem->Which()
     512                 :          0 :                 << nIVers;
     513                 :          0 :         pItem->Store( rStream, nIVers );
     514                 :            :     }
     515                 :            : 
     516                 :            :     // Extensions for 40A
     517                 :            : 
     518         [ #  # ]:          0 :     if( SVX_NUM_BITMAP == aFmt.GetNumberingType() )
     519                 :            :     {
     520                 :          0 :         rStream << (sal_Int32)aFmt.GetGraphicSize().Width()
     521                 :          0 :                 << (sal_Int32)aFmt.GetGraphicSize().Height();
     522                 :          0 :         sal_uInt8 cFlg = ( 0 != aFmt.GetBrush() ? 1 : 0 ) +
     523 [ #  # ][ #  # ]:          0 :                     ( 0 != aFmt.GetGraphicOrientation() ? 2 : 0 );
     524                 :          0 :         rStream << cFlg;
     525                 :            : 
     526         [ #  # ]:          0 :         if( aFmt.GetBrush() )
     527                 :            :         {
     528                 :          0 :             sal_uInt16 nVersion = aFmt.GetBrush()->GetVersion( SOFFICE_FILEFORMAT_50 );
     529                 :          0 :             rStream << nVersion;
     530                 :          0 :             aFmt.GetBrush()->Store( rStream, nVersion );
     531                 :            :         }
     532         [ #  # ]:          0 :         if( aFmt.GetGraphicOrientation() )
     533                 :            :         {
     534                 :          0 :             sal_uInt16 nVersion = aFmt.GetGraphicOrientation()->GetVersion( SOFFICE_FILEFORMAT_50 );
     535                 :          0 :             rStream << nVersion;
     536                 :          0 :             aFmt.GetGraphicOrientation()->Store( rStream, nVersion );
     537                 :            :         }
     538                 :            :     }
     539                 :          0 : }
     540                 :            : 
     541                 :          0 : void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh,
     542                 :            :                             SwNumFmt& rNew ) const
     543                 :            : {
     544                 :          0 :     SwCharFmt* pFmt = 0;
     545         [ #  # ]:          0 :     if( sCharFmtName.Len() )
     546                 :            :     {
     547                 :            :         // at first, look for the name
     548                 :          0 :         sal_uInt16 nArrLen = rSh.GetCharFmtCount();
     549         [ #  # ]:          0 :         for( sal_uInt16 i = 1; i < nArrLen; ++i )
     550                 :            :         {
     551                 :          0 :             pFmt = &rSh.GetCharFmt( i );
     552         [ #  # ]:          0 :             if( COMPARE_EQUAL == pFmt->GetName().CompareTo( sCharFmtName ))
     553                 :            :                 // exists, so leave attributes as they are!
     554                 :          0 :                 break;
     555                 :          0 :             pFmt = 0;
     556                 :            :         }
     557                 :            : 
     558         [ #  # ]:          0 :         if( !pFmt )
     559                 :            :         {
     560         [ #  # ]:          0 :             if( IsPoolUserFmt( nCharPoolId ) )
     561                 :            :             {
     562                 :          0 :                 pFmt = rSh.MakeCharFmt( sCharFmtName );
     563                 :          0 :                 pFmt->SetAuto( sal_False );
     564                 :            :             }
     565                 :            :             else
     566                 :          0 :                 pFmt = rSh.GetCharFmtFromPool( nCharPoolId );
     567                 :            : 
     568         [ #  # ]:          0 :             if( !pFmt->GetDepends() )       // set attributes
     569         [ #  # ]:          0 :                 for( sal_uInt16 n = aItems.size(); n; )
     570                 :          0 :                     pFmt->SetFmtAttr( aItems[ --n ] );
     571                 :            :         }
     572                 :            :     }
     573                 :          0 :     ((SwNumFmt&)aFmt).SetCharFmt( pFmt );
     574                 :          0 :     rNew = aFmt;
     575         [ #  # ]:          0 :     if( pFmt )
     576                 :          0 :         ((SwNumFmt&)aFmt).SetCharFmt( 0 );
     577                 :          0 : }
     578                 :            : 
     579                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10