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

Generated by: LCOV version 1.10