2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:15:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 17:17:46 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 17:17:46 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 17:17:46 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 17:17:46 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 17:17:46 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 17:17:46 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 21:41:59 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <hintids.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/urihelper.hxx>
|
2009-10-06 07:38:24 +02:00
|
|
|
#include <unotools/pathoptions.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <tools/stream.hxx>
|
2000-10-06 12:41:54 +00:00
|
|
|
#include <sfx2/docfile.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemiter.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/brshitem.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <tools/resid.hxx>
|
|
|
|
#include <fmtornt.hxx>
|
|
|
|
#include <swtypes.hxx> // Leerstring
|
|
|
|
#include <wrtsh.hxx>
|
|
|
|
#include <uinums.hxx>
|
|
|
|
#include <poolfmt.hxx>
|
|
|
|
#include <charfmt.hxx>
|
|
|
|
#include <frmatr.hxx>
|
|
|
|
|
2007-09-27 10:29:15 +00:00
|
|
|
#include <unomid.h>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
#define VERSION_30B ((USHORT)250)
|
|
|
|
#define VERSION_31B ((USHORT)326)
|
|
|
|
#define VERSION_40A ((USHORT)364)
|
|
|
|
#define VERSION_50A ((USHORT)373)
|
|
|
|
#define VERSION_53A ((USHORT)596)
|
|
|
|
#define ACT_NUM_VERSION VERSION_53A
|
|
|
|
|
|
|
|
#define NUMRULE_FILENAME "numrule.cfg"
|
|
|
|
#define CHAPTER_FILENAME "chapter.cfg"
|
2007-09-27 10:29:15 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
SV_IMPL_PTRARR( _SwNumFmtsAttrs, SfxPoolItem* )
|
|
|
|
|
|
|
|
|
|
|
|
// SwNumRulesWithName ----------------------------------------------------
|
|
|
|
// PUBLIC METHODES -------------------------------------------------------
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
Beschreibung: Speichern einer Regel
|
|
|
|
Parameter: rCopy -- die zu speichernde Regel
|
|
|
|
nIdx -- Position, an der die Regel zu speichern ist.
|
|
|
|
Eine alte Regel an dieser Position wird ueberschrieben.
|
|
|
|
------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwBaseNumRules::SwBaseNumRules( const String& rFileName )
|
2007-09-27 10:29:15 +00:00
|
|
|
:
|
2000-09-18 16:15:01 +00:00
|
|
|
sFileName( rFileName ),
|
2007-09-27 10:29:15 +00:00
|
|
|
nVersion(0),
|
2000-09-18 16:15:01 +00:00
|
|
|
bModified( FALSE )
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwBaseNumRules::~SwBaseNumRules()
|
|
|
|
{
|
|
|
|
if( bModified )
|
|
|
|
{
|
2000-10-06 12:41:54 +00:00
|
|
|
SvtPathOptions aPathOpt;
|
2005-01-11 11:39:26 +00:00
|
|
|
String sNm( aPathOpt.GetUserConfigPath() );
|
2000-09-18 16:15:01 +00:00
|
|
|
sNm += INET_PATH_TOKEN;
|
|
|
|
sNm += sFileName;
|
|
|
|
INetURLObject aTempObj(sNm);
|
|
|
|
sNm = aTempObj.GetFull();
|
2000-10-06 12:41:54 +00:00
|
|
|
SfxMedium aStrm( sNm, STREAM_WRITE | STREAM_TRUNC |
|
|
|
|
STREAM_SHARE_DENYALL, TRUE );
|
|
|
|
Store( *aStrm.GetOutStream() );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for( USHORT i = 0; i < nMaxRules; ++i )
|
|
|
|
delete pNumRules[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwBaseNumRules::Init()
|
|
|
|
{
|
|
|
|
for(USHORT i = 0; i < nMaxRules; ++i )
|
|
|
|
pNumRules[i] = 0;
|
|
|
|
|
|
|
|
String sNm( sFileName );
|
2000-11-13 09:42:42 +00:00
|
|
|
SvtPathOptions aOpt;
|
|
|
|
if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG ))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2000-10-06 12:41:54 +00:00
|
|
|
SfxMedium aStrm( sNm, STREAM_STD_READ, TRUE );
|
|
|
|
Load( *aStrm.GetInStream() );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwBaseNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, USHORT nIdx)
|
|
|
|
{
|
2010-10-20 15:36:15 +01:00
|
|
|
OSL_ENSURE(nIdx < nMaxRules, "Array der NumRules ueberindiziert.");
|
2000-09-18 16:15:01 +00:00
|
|
|
if( !pNumRules[nIdx] )
|
|
|
|
pNumRules[nIdx] = new SwNumRulesWithName( rCopy );
|
|
|
|
else
|
|
|
|
*pNumRules[nIdx] = rCopy;
|
|
|
|
}
|
|
|
|
|
2010-10-20 15:36:15 +01:00
|
|
|
// PROTECTED METHODS ----------------------------------------------------
|
|
|
|
BOOL SwBaseNumRules::Store(SvStream &rStream)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
rStream << ACT_NUM_VERSION;
|
|
|
|
// Schreiben, welche Positionen durch eine Regel belegt sind
|
|
|
|
// Anschliessend Schreiben der einzelnen Rules
|
|
|
|
for(USHORT i = 0; i < nMaxRules; ++i)
|
|
|
|
{
|
|
|
|
if(pNumRules[i])
|
|
|
|
{
|
|
|
|
rStream << (unsigned char) TRUE;
|
|
|
|
pNumRules[i]->Store( rStream );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rStream << (unsigned char) FALSE;
|
|
|
|
}
|
2000-10-12 07:32:44 +00:00
|
|
|
return TRUE;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int SwBaseNumRules::Load(SvStream &rStream)
|
|
|
|
{
|
2000-10-12 07:32:44 +00:00
|
|
|
int rc = 0;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
rStream >> nVersion;
|
|
|
|
|
|
|
|
// wegen eines kleinen aber schweren Fehlers schreibt die PreFinal die
|
|
|
|
// gleiche VERSION_40A wie das SP2 #55402#
|
|
|
|
if(VERSION_40A == nVersion)
|
|
|
|
{
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE(false, "Version 364 is not clear #55402#");
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else if( VERSION_30B == nVersion || VERSION_31B == nVersion ||
|
|
|
|
ACT_NUM_VERSION >= nVersion )
|
|
|
|
{
|
|
|
|
unsigned char bRule = FALSE;
|
|
|
|
for(USHORT i = 0; i < nMaxRules; ++i)
|
|
|
|
{
|
|
|
|
rStream >> bRule;
|
|
|
|
if(bRule)
|
|
|
|
pNumRules[i] = new SwNumRulesWithName( rStream, nVersion );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-10-12 07:32:44 +00:00
|
|
|
rc = 1;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwChapterNumRules::SwChapterNumRules() :
|
|
|
|
SwBaseNumRules(C2S(CHAPTER_FILENAME))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwChapterNumRules::~SwChapterNumRules()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwChapterNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, USHORT nIdx)
|
|
|
|
{
|
|
|
|
bModified = TRUE;
|
|
|
|
SwBaseNumRules::ApplyNumRules(rCopy, nIdx);
|
|
|
|
}
|
|
|
|
|
2008-03-05 16:22:12 +00:00
|
|
|
SwNumRulesWithName::SwNumRulesWithName( const SwNumRule &rCopy,
|
|
|
|
const String &rName )
|
2000-09-18 16:15:01 +00:00
|
|
|
: aName(rName)
|
|
|
|
{
|
2007-09-27 10:29:15 +00:00
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
const SwNumFmt* pFmt = rCopy.GetNumFmt( n );
|
|
|
|
if( pFmt )
|
|
|
|
aFmts[ n ] = new _SwNumFmtGlobal( *pFmt );
|
|
|
|
else
|
|
|
|
aFmts[ n ] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::SwNumRulesWithName( const SwNumRulesWithName& rCopy )
|
|
|
|
{
|
|
|
|
memset( aFmts, 0, sizeof( aFmts ));
|
|
|
|
*this = rCopy;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::~SwNumRulesWithName()
|
|
|
|
{
|
|
|
|
for( int n = 0; n < MAXLEVEL; ++n )
|
|
|
|
delete aFmts[ n ];
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCopy)
|
|
|
|
{
|
|
|
|
if( this != &rCopy )
|
|
|
|
{
|
|
|
|
aName = rCopy.aName;
|
|
|
|
for( int n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
|
|
|
delete aFmts[ n ];
|
|
|
|
|
|
|
|
_SwNumFmtGlobal* pFmt = rCopy.aFmts[ n ];
|
|
|
|
if( pFmt )
|
|
|
|
aFmts[ n ] = new _SwNumFmtGlobal( *pFmt );
|
|
|
|
else
|
|
|
|
aFmts[ n ] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, USHORT nVersion )
|
|
|
|
{
|
|
|
|
CharSet eEncoding = gsl_getSystemTextEncoding();
|
|
|
|
rStream.ReadByteString(aName, eEncoding);
|
|
|
|
|
|
|
|
char c;
|
|
|
|
for(USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
|
|
|
if( VERSION_30B == nVersion )
|
|
|
|
c = 1;
|
|
|
|
// wegen eines kleinen aber schweren Fehlers schreibt die PreFinal die
|
|
|
|
// gleiche VERSION_40A wie das SP2 #55402#
|
|
|
|
else if(nVersion < VERSION_40A && n > 5)
|
|
|
|
c = 0;
|
|
|
|
else
|
|
|
|
rStream >> c;
|
|
|
|
|
|
|
|
if( c )
|
|
|
|
aFmts[ n ] = new _SwNumFmtGlobal( rStream, nVersion );
|
|
|
|
else
|
|
|
|
aFmts[ n ] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const
|
|
|
|
{
|
2010-10-20 15:36:15 +01:00
|
|
|
// #i89178#
|
2008-07-08 07:32:33 +00:00
|
|
|
rChg = SwNumRule( aName, numfunc::GetDefaultPositionAndSpaceMode() );
|
2000-09-18 16:15:01 +00:00
|
|
|
rChg.SetAutoRule( FALSE );
|
|
|
|
_SwNumFmtGlobal* pFmt;
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
if( 0 != ( pFmt = aFmts[ n ] ) )
|
|
|
|
{
|
|
|
|
SwNumFmt aNew;
|
|
|
|
pFmt->ChgNumFmt( rSh, aNew );
|
|
|
|
rChg.Set( n, aNew );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRulesWithName::Store( SvStream &rStream )
|
|
|
|
{
|
|
|
|
CharSet eEncoding = gsl_getSystemTextEncoding();
|
|
|
|
rStream.WriteByteString(aName, eEncoding);
|
|
|
|
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
|
|
|
_SwNumFmtGlobal* pFmt = aFmts[ n ];
|
|
|
|
if( pFmt )
|
|
|
|
{
|
|
|
|
rStream << (char)1;
|
|
|
|
pFmt->Store( rStream );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rStream << (char)0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const SwNumFmt& rFmt )
|
|
|
|
: aFmt( rFmt ), nCharPoolId( USHRT_MAX )
|
|
|
|
{
|
|
|
|
// relative Abstaende ?????
|
|
|
|
|
|
|
|
SwCharFmt* pFmt = rFmt.GetCharFmt();
|
|
|
|
if( pFmt )
|
|
|
|
{
|
|
|
|
sCharFmtName = pFmt->GetName();
|
|
|
|
nCharPoolId = pFmt->GetPoolFmtId();
|
|
|
|
if( pFmt->GetAttrSet().Count() )
|
|
|
|
{
|
|
|
|
SfxItemIter aIter( pFmt->GetAttrSet() );
|
|
|
|
const SfxPoolItem *pCurr = aIter.GetCurItem();
|
|
|
|
while( TRUE )
|
|
|
|
{
|
|
|
|
aItems.Insert( pCurr->Clone(), aItems.Count() );
|
|
|
|
if( aIter.IsAtEnd() )
|
|
|
|
break;
|
|
|
|
pCurr = aIter.NextItem();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aFmt.SetCharFmt( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const _SwNumFmtGlobal& rFmt )
|
2007-09-27 10:29:15 +00:00
|
|
|
:
|
|
|
|
aFmt( rFmt.aFmt ),
|
|
|
|
sCharFmtName( rFmt.sCharFmtName ),
|
|
|
|
nCharPoolId( rFmt.nCharPoolId )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
for( USHORT n = rFmt.aItems.Count(); n; )
|
|
|
|
aItems.Insert( rFmt.aItems[ --n ]->Clone(), aItems.Count() );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
|
|
|
|
USHORT nVersion )
|
|
|
|
: nCharPoolId( USHRT_MAX )
|
|
|
|
{
|
|
|
|
CharSet eEncoding = gsl_getSystemTextEncoding();
|
|
|
|
{
|
|
|
|
USHORT nUS;
|
|
|
|
sal_Char cChar;
|
|
|
|
BOOL bFlag;
|
|
|
|
String sStr;
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream >> nUS; aFmt.SetNumberingType((sal_Int16)nUS );
|
2000-09-18 16:15:01 +00:00
|
|
|
if( VERSION_53A > nVersion )
|
|
|
|
{
|
|
|
|
rStream >> cChar; aFmt.SetBulletChar( cChar );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rStream >> nUS; aFmt.SetBulletChar( nUS );
|
|
|
|
}
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream >> bFlag; aFmt.SetIncludeUpperLevels( bFlag );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( VERSION_30B == nVersion )
|
|
|
|
{
|
|
|
|
long nL;
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream >> cChar; aFmt.SetStart( (USHORT)cChar );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
rStream.ReadByteString(sStr, eEncoding);
|
|
|
|
aFmt.SetPrefix( sStr );
|
|
|
|
rStream.ReadByteString(sStr, eEncoding);
|
2001-02-23 11:45:30 +00:00
|
|
|
aFmt.SetSuffix( sStr );
|
|
|
|
rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream >> nL; aFmt.SetLSpace( lNumIndent );
|
|
|
|
rStream >> nL; aFmt.SetFirstLineOffset( (short)nL );
|
|
|
|
}
|
|
|
|
else // alter StartWert war ein Byte
|
|
|
|
{
|
2011-01-11 11:19:05 +00:00
|
|
|
short nShort;
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream >> nUS; aFmt.SetStart( nUS );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream.ReadByteString(sStr, eEncoding);
|
|
|
|
aFmt.SetPrefix( sStr );
|
|
|
|
rStream.ReadByteString(sStr, eEncoding);
|
2001-02-23 11:45:30 +00:00
|
|
|
aFmt.SetSuffix( sStr );
|
|
|
|
rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream >> nUS; aFmt.SetAbsLSpace( nUS );
|
|
|
|
rStream >> nShort; aFmt.SetFirstLineOffset( nShort );
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream >> nUS; aFmt.SetCharTextDistance( nUS );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream >> nShort; aFmt.SetLSpace( nShort );
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream >> bFlag;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
USHORT nFamily;
|
|
|
|
USHORT nCharSet;
|
|
|
|
short nWidth;
|
|
|
|
short nHeight;
|
|
|
|
USHORT nPitch;
|
|
|
|
String aName;
|
|
|
|
|
|
|
|
rStream.ReadByteString(aName, eEncoding);
|
|
|
|
rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch;
|
|
|
|
|
|
|
|
if( aName.Len() )
|
|
|
|
{
|
|
|
|
Font aFont( nFamily, Size( nWidth, nHeight ) );
|
|
|
|
aFont.SetName( aName );
|
|
|
|
aFont.SetCharSet( (CharSet)nCharSet );
|
|
|
|
aFont.SetPitch( (FontPitch)nPitch );
|
|
|
|
|
|
|
|
aFmt.SetBulletFont( &aFont );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nCharSet = RTL_TEXTENCODING_SYMBOL;
|
|
|
|
|
|
|
|
if( VERSION_53A > nVersion )
|
|
|
|
aFmt.SetBulletChar( ByteString::ConvertToUnicode(
|
2007-09-27 10:29:15 +00:00
|
|
|
sal_Char(aFmt.GetBulletChar()), nCharSet ));
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( VERSION_30B != nVersion )
|
|
|
|
{
|
|
|
|
USHORT nItemCount;
|
|
|
|
rStream >> nCharPoolId;
|
|
|
|
rStream.ReadByteString(sCharFmtName, eEncoding);
|
|
|
|
rStream >> nItemCount;
|
|
|
|
|
|
|
|
while( nItemCount-- )
|
|
|
|
{
|
|
|
|
USHORT nWhich, nVers;
|
|
|
|
rStream >> nWhich >> nVers;
|
|
|
|
aItems.Insert( GetDfltAttr( nWhich )->Create( rStream, nVers ),
|
|
|
|
aItems.Count() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
if( VERSION_40A == nVersion && SVX_NUM_BITMAP == aFmt.GetNumberingType() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
BYTE cF;
|
|
|
|
Size aSz;
|
|
|
|
|
|
|
|
rStream >> aSz.Width() >> aSz.Height();
|
|
|
|
|
|
|
|
rStream >> cF;
|
|
|
|
if( cF )
|
|
|
|
{
|
|
|
|
SvxBrushItem* pBrush = 0;
|
|
|
|
SwFmtVertOrient* pVOrient = 0;
|
|
|
|
USHORT nVer;
|
|
|
|
|
|
|
|
if( cF & 1 )
|
|
|
|
{
|
|
|
|
rStream >> nVer;
|
|
|
|
pBrush = (SvxBrushItem*)GetDfltAttr( RES_BACKGROUND )
|
|
|
|
->Create( rStream, nVer );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( cF & 2 )
|
|
|
|
{
|
|
|
|
rStream >> nVer;
|
|
|
|
pVOrient = (SwFmtVertOrient*)GetDfltAttr( RES_VERT_ORIENT )
|
|
|
|
->Create( rStream, nVer );
|
|
|
|
}
|
2007-09-27 10:29:15 +00:00
|
|
|
sal_Int16 eOrient = text::VertOrientation::NONE;
|
2001-02-23 11:45:30 +00:00
|
|
|
if(pVOrient)
|
2007-09-27 10:29:15 +00:00
|
|
|
eOrient = (sal_Int16)pVOrient->GetVertOrient();
|
2001-02-23 11:45:30 +00:00
|
|
|
aFmt.SetGraphicBrush( pBrush, &aSz, pVOrient ? &eOrient : 0 );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRulesWithName::_SwNumFmtGlobal::~_SwNumFmtGlobal()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRulesWithName::_SwNumFmtGlobal::Store( SvStream& rStream )
|
|
|
|
{
|
|
|
|
CharSet eEncoding = gsl_getSystemTextEncoding();
|
|
|
|
{
|
|
|
|
String aName;
|
|
|
|
USHORT nFamily = FAMILY_DONTKNOW, nCharSet = 0, nPitch = 0;
|
|
|
|
short nWidth = 0, nHeight = 0;
|
|
|
|
|
|
|
|
const Font* pFnt = aFmt.GetBulletFont();
|
|
|
|
if( pFnt )
|
|
|
|
{
|
|
|
|
aName = pFnt->GetName();
|
|
|
|
nFamily = (USHORT)pFnt->GetFamily();
|
|
|
|
nCharSet = (USHORT)pFnt->GetCharSet();
|
|
|
|
nWidth = (short)pFnt->GetSize().Width();
|
|
|
|
nHeight = (short)pFnt->GetSize().Height();
|
|
|
|
nPitch = (USHORT)pFnt->GetPitch();
|
|
|
|
}
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream << USHORT(aFmt.GetNumberingType())
|
2000-09-18 16:15:01 +00:00
|
|
|
<< aFmt.GetBulletChar()
|
2001-02-23 11:45:30 +00:00
|
|
|
<< (aFmt.GetIncludeUpperLevels() > 0)
|
|
|
|
<< aFmt.GetStart();
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream.WriteByteString( aFmt.GetPrefix(), eEncoding );
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream.WriteByteString( aFmt.GetSuffix(), eEncoding );
|
|
|
|
rStream << USHORT( aFmt.GetNumAdjust() )
|
2000-09-18 16:15:01 +00:00
|
|
|
<< aFmt.GetAbsLSpace()
|
|
|
|
<< aFmt.GetFirstLineOffset()
|
2001-02-23 11:45:30 +00:00
|
|
|
<< aFmt.GetCharTextDistance()
|
2000-09-18 16:15:01 +00:00
|
|
|
<< aFmt.GetLSpace()
|
2001-02-23 11:45:30 +00:00
|
|
|
<< FALSE;//aFmt.IsRelLSpace();
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream.WriteByteString( aName, eEncoding );
|
|
|
|
rStream << nFamily
|
|
|
|
<< nCharSet
|
|
|
|
<< nWidth
|
|
|
|
<< nHeight
|
|
|
|
<< nPitch;
|
|
|
|
}
|
|
|
|
rStream << nCharPoolId;
|
|
|
|
rStream.WriteByteString( sCharFmtName, eEncoding );
|
|
|
|
rStream << aItems.Count();
|
|
|
|
|
|
|
|
for( USHORT n = aItems.Count(); n; )
|
|
|
|
{
|
|
|
|
SfxPoolItem* pItem = aItems[ --n ];
|
2001-02-06 14:45:20 +00:00
|
|
|
USHORT nIVers = pItem->GetVersion( SOFFICE_FILEFORMAT_50 );
|
2010-10-20 15:36:15 +01:00
|
|
|
OSL_ENSURE( nIVers != USHRT_MAX,
|
2000-09-18 16:15:01 +00:00
|
|
|
"Was'n das: Item-Version USHRT_MAX in der aktuellen Version" );
|
|
|
|
rStream << pItem->Which()
|
|
|
|
<< nIVers;
|
|
|
|
pItem->Store( rStream, nIVers );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Erweiterungen fuer Version 40A
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
if( SVX_NUM_BITMAP == aFmt.GetNumberingType() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
rStream << (INT32)aFmt.GetGraphicSize().Width()
|
|
|
|
<< (INT32)aFmt.GetGraphicSize().Height();
|
|
|
|
BYTE cFlg = ( 0 != aFmt.GetBrush() ? 1 : 0 ) +
|
|
|
|
( 0 != aFmt.GetGraphicOrientation() ? 2 : 0 );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream << cFlg;
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
if( aFmt.GetBrush() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
USHORT nVersion = aFmt.GetBrush()->GetVersion( SOFFICE_FILEFORMAT_50 );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream << nVersion;
|
2001-02-23 11:45:30 +00:00
|
|
|
aFmt.GetBrush()->Store( rStream, nVersion );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
if( aFmt.GetGraphicOrientation() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
USHORT nVersion = aFmt.GetGraphicOrientation()->GetVersion( SOFFICE_FILEFORMAT_50 );
|
2000-09-18 16:15:01 +00:00
|
|
|
rStream << nVersion;
|
2001-02-23 11:45:30 +00:00
|
|
|
aFmt.GetGraphicOrientation()->Store( rStream, nVersion );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh,
|
|
|
|
SwNumFmt& rNew ) const
|
|
|
|
{
|
|
|
|
SwCharFmt* pFmt = 0;
|
|
|
|
if( sCharFmtName.Len() )
|
|
|
|
{
|
|
|
|
// suche erstmal ueber den Namen
|
|
|
|
USHORT nArrLen = rSh.GetCharFmtCount();
|
|
|
|
for( USHORT i = 1; i < nArrLen; ++i )
|
|
|
|
{
|
|
|
|
pFmt = &rSh.GetCharFmt( i );
|
|
|
|
if( COMPARE_EQUAL == pFmt->GetName().CompareTo( sCharFmtName ))
|
|
|
|
// ist vorhanden, also belasse die Attribute wie sie sind!
|
|
|
|
break;
|
|
|
|
pFmt = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !pFmt )
|
|
|
|
{
|
|
|
|
if( IsPoolUserFmt( nCharPoolId ) )
|
|
|
|
{
|
|
|
|
pFmt = rSh.MakeCharFmt( sCharFmtName );
|
|
|
|
pFmt->SetAuto( FALSE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pFmt = rSh.GetCharFmtFromPool( nCharPoolId );
|
|
|
|
|
|
|
|
if( !pFmt->GetDepends() ) // Attribute setzen
|
|
|
|
for( USHORT n = aItems.Count(); n; )
|
2008-06-13 10:13:49 +00:00
|
|
|
pFmt->SetFmtAttr( *aItems[ --n ] );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
((SwNumFmt&)aFmt).SetCharFmt( pFmt );
|
|
|
|
rNew = aFmt;
|
|
|
|
if( pFmt )
|
|
|
|
((SwNumFmt&)aFmt).SetCharFmt( 0 );
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|