1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
10 * $Revision: 1.5.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <attrib.hxx> //!!! noch noetig?????
35 #include <document.hxx>
38 const BYTE nDezStd
= 0; // Dezimalstellen fuer Standard-Zellen
39 const BYTE nDezFloat
= 2; // " " Float-Zellen
41 void PutFormString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_Char
*pString
);
43 void SetFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, BYTE nFormat
, BYTE nSt
);
45 void InitPage( void );
47 String
DosToSystem( sal_Char
*pSource
);
49 double SnumToDouble( INT16 nVal
);
51 double Snum32ToDouble( UINT32 nValue
);
53 typedef UINT16 StampTyp
;
55 #define MAKE_STAMP(nF,nS) ((nS&0x0F)+((nF&0x7F)*16))
56 // Bit 0...3 = Bit 0...3 von Stellenzahl
57 // Bit 4...10 = Bit 0...6 von Formatbyte
62 StampTyp nStamp
; // Identifikations-Schluessel
63 SfxUInt32Item
* pAttr
; // zugehoeriges Attribut
71 FormIdent( BYTE nFormat
, BYTE nSt
, SfxUInt32Item
& rAttr
)
73 nStamp
= MAKE_STAMP( nFormat
, nSt
);
77 FormIdent( BYTE nFormat
, BYTE nSt
)
79 nStamp
= MAKE_STAMP( nFormat
, nSt
);
83 BOOL
operator ==( const FormIdent
& rComp
) const
85 return ( nStamp
== rComp
.nStamp
);
88 BOOL
operator ==( const StampTyp
& rStamp
) const
90 return ( nStamp
== rStamp
);
93 StampTyp
GetStamp( void ) const
98 SfxUInt32Item
* GetAttr( void )
103 void SetStamp( BYTE nFormat
, BYTE nSt
)
105 nStamp
= MAKE_STAMP( nFormat
, nSt
);
118 FormIdent aIdents
[ __nSize
]; //gepufferte Formate
119 BOOL bValid
[ __nSize
];
120 FormIdent aCompareIdent
; // zum Vergleichen
121 BYTE nDefaultFormat
; // Defaultformat der Datei
122 SvNumberFormatter
* pFormTable
; // Value-Format-Table-Anker
124 LanguageType eLanguage
; // Systemsprache
126 SfxUInt32Item
* NewAttr( BYTE nFormat
, BYTE nSt
);
128 FormCache( ScDocument
*, BYTE nNewDefaultFormat
= 0xFF );
131 inline const SfxUInt32Item
* GetAttr( BYTE nFormat
, BYTE nSt
);
132 void SetDefaultFormat( BYTE nD
= 0xFF )
139 inline const SfxUInt32Item
* FormCache::GetAttr( BYTE nFormat
, BYTE nSt
)
141 // PREC: nFormat = Lotus-Format-Byte
143 // POST: return = zu nFormat und nSt passendes SC-Format
144 SfxUInt32Item
* pAttr
;
147 aCompareIdent
.SetStamp( nFormat
, nSt
);
148 nIndex
= aCompareIdent
.GetStamp();
149 DBG_ASSERT( nIndex
< __nSize
, "FormCache::GetAttr(): Uuuuuuups... so nicht!" );
150 if( bValid
[ nIndex
] )
151 pRet
= aIdents
[ nIndex
].GetAttr();
154 // neues Attribut anlegen
155 pAttr
= NewAttr( nFormat
, nSt
);
156 DBG_ASSERT( pAttr
, "FormCache::GetAttr(): Nix Speicherus" );
158 aIdents
[ nIndex
] = FormIdent( nFormat
, nSt
, *pAttr
);
159 bValid
[ nIndex
] = TRUE
;