diff options
author | Daniel Rentz <dr@openoffice.org> | 2001-11-29 13:37:05 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2001-11-29 13:37:05 +0000 |
commit | b2a14966c45380de98cd3761776657421ceb921d (patch) | |
tree | 9304c3f749ac71514a4e27872a889cde900d9e68 /sc | |
parent | 2303ace2ba99201dc7f5a4cd8bb4e4875f6aa637 (diff) |
#95354# Adding new auto formats
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/autoform.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/autoform.cxx | 32 |
2 files changed, 24 insertions, 14 deletions
diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx index dd53f335cf1f..e5e60f4c6a99 100644 --- a/sc/inc/autoform.hxx +++ b/sc/inc/autoform.hxx @@ -2,9 +2,9 @@ * * $RCSfile: autoform.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dr $ $Date: 2001-11-19 13:28:26 $ + * last change: $Author: dr $ $Date: 2001-11-29 14:36:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -273,7 +273,7 @@ private: BOOL bIncludeValueFormat : 1; BOOL bIncludeWidthHeight : 1; - ScAutoFormatDataField aDataField[ 16 ]; + ScAutoFormatDataField** ppDataField; ScAutoFormatDataField& GetField( USHORT nIndex ); const ScAutoFormatDataField& GetField( USHORT nIndex ) const; diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index e20d47f40f83..e146363f24f3 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -2,9 +2,9 @@ * * $RCSfile: autoform.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dr $ $Date: 2001-11-19 13:30:31 $ + * last change: $Author: dr $ $Date: 2001-11-29 14:37:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -452,6 +452,10 @@ ScAutoFormatData::ScAutoFormatData() bIncludeFrame = bIncludeBackground = bIncludeWidthHeight = TRUE; + + ppDataField = new ScAutoFormatDataField*[ 16 ]; + for( USHORT nIndex = 0; nIndex < 16; ++nIndex ) + ppDataField[ nIndex ] = new ScAutoFormatDataField; } ScAutoFormatData::ScAutoFormatData( const ScAutoFormatData& rData ) : @@ -464,22 +468,30 @@ ScAutoFormatData::ScAutoFormatData( const ScAutoFormatData& rData ) : bIncludeBackground( rData.bIncludeBackground ), bIncludeWidthHeight( rData.bIncludeWidthHeight ) { + ppDataField = new ScAutoFormatDataField*[ 16 ]; + for( USHORT nIndex = 0; nIndex < 16; ++nIndex ) + ppDataField[ nIndex ] = new ScAutoFormatDataField( rData.GetField( nIndex ) ); } ScAutoFormatData::~ScAutoFormatData() { + for( USHORT nIndex = 0; nIndex < 16; ++nIndex ) + delete ppDataField[ nIndex ]; + delete[] ppDataField; } ScAutoFormatDataField& ScAutoFormatData::GetField( USHORT nIndex ) { DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::GetField - illegal index" ); - return aDataField[ nIndex ]; + DBG_ASSERT( ppDataField && ppDataField[ nIndex ], "ScAutoFormatData::GetField - no data" ); + return *ppDataField[ nIndex ]; } const ScAutoFormatDataField& ScAutoFormatData::GetField( USHORT nIndex ) const { DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::GetField - illegal index" ); - return aDataField[ nIndex ]; + DBG_ASSERT( ppDataField && ppDataField[ nIndex ], "ScAutoFormatData::GetField - no data" ); + return *ppDataField[ nIndex ]; } const SfxPoolItem* ScAutoFormatData::GetItem( USHORT nIndex, USHORT nWhich ) const @@ -626,8 +638,7 @@ BOOL ScAutoFormatData::IsEqualData( USHORT nIndex1, USHORT nIndex2 ) const void ScAutoFormatData::FillToItemSet( USHORT nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const { - DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::FillToItemSet - illegal index" ); - const ScAutoFormatDataField& rField = aDataField[ nIndex ]; + const ScAutoFormatDataField& rField = GetField( nIndex ); if( bIncludeValueFormat ) { @@ -675,8 +686,7 @@ void ScAutoFormatData::FillToItemSet( USHORT nIndex, SfxItemSet& rItemSet, ScDoc void ScAutoFormatData::GetFromItemSet( USHORT nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat ) { - DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::GetFromItemSet - illegal index" ); - ScAutoFormatDataField& rField = aDataField[ nIndex ]; + ScAutoFormatDataField& rField = GetField( nIndex ); rField.SetNumFormat ( rNumFormat); rField.SetFont ( (const SvxFontItem&) rItemSet.Get( ATTR_FONT ) ); @@ -742,7 +752,7 @@ BOOL ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions ) bRet = 0 == rStream.GetError(); for( USHORT i = 0; bRet && i < 16; ++i ) - bRet = aDataField[ i ].Load( rStream, rVersions, nVer ); + bRet = GetField( i ).Load( rStream, rVersions, nVer ); } else bRet = FALSE; @@ -769,7 +779,7 @@ BOOL ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVersions bRet = 0 == rStream.GetError(); for (USHORT i=0; bRet && i < 16; i++) - bRet = aDataField[ i ].LoadOld( rStream, rVersions ); + bRet = GetField( i ).LoadOld( rStream, rVersions ); } else bRet = FALSE; @@ -819,7 +829,7 @@ BOOL ScAutoFormatData::Save(SvStream& rStream) BOOL bRet = 0 == rStream.GetError(); for (USHORT i = 0; bRet && (i < 16); i++) - bRet = aDataField[ i ].Save( rStream ); + bRet = GetField( i ).Save( rStream ); return bRet; } |