1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_TOOL_H
21 #define INCLUDED_SC_SOURCE_FILTER_INC_TOOL_H
24 #include <document.hxx>
25 #include <osl/diagnose.h>
28 const sal_uInt8 nDezStd
= 0; // Dezimalstellen fuer Standard-Zellen
29 const sal_uInt8 nDezFloat
= 2; // " " Float-Zellen
33 void PutFormString(LotusContext
& rContext
, SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_Char
*pString
);
35 void SetFormat(LotusContext
& rContext
, SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt8 nFormat
, sal_uInt8 nSt
);
37 double SnumToDouble( sal_Int16 nVal
);
39 double Snum32ToDouble( sal_uInt32 nValue
);
41 typedef sal_uInt16 StampTyp
;
43 #define MAKE_STAMP(nF,nS) ((nS&0x0F)+((nF&0x7F)*16))
44 // Bit 0...3 = Bit 0...3 von Stellenzahl
45 // Bit 4...10 = Bit 0...6 von Formatbyte
50 StampTyp nStamp
; // Identifikations-Schluessel
51 SfxUInt32Item
* pAttr
; // zugehoeriges Attribut
59 FormIdent( sal_uInt8 nFormat
, sal_uInt8 nSt
, SfxUInt32Item
& rAttr
)
61 nStamp
= MAKE_STAMP( nFormat
, nSt
);
65 StampTyp
GetStamp( void ) const
70 SfxUInt32Item
* GetAttr( void )
75 void SetStamp( sal_uInt8 nFormat
, sal_uInt8 nSt
)
77 nStamp
= MAKE_STAMP( nFormat
, nSt
);
88 FormIdent aIdents
[ nSize_
]; //gepufferte Formate
89 bool bValid
[ nSize_
];
90 FormIdent aCompareIdent
; // zum Vergleichen
91 sal_uInt8 nDefaultFormat
; // Defaultformat der Datei
92 SvNumberFormatter
* pFormTable
; // Value-Format-Table-Anker
94 LanguageType eLanguage
; // Systemsprache
96 SfxUInt32Item
* NewAttr( sal_uInt8 nFormat
, sal_uInt8 nSt
);
98 FormCache( ScDocument
*, sal_uInt8 nNewDefaultFormat
= 0xFF );
101 inline const SfxUInt32Item
* GetAttr( sal_uInt8 nFormat
, sal_uInt8 nSt
);
105 inline const SfxUInt32Item
* FormCache::GetAttr( sal_uInt8 nFormat
, sal_uInt8 nSt
)
107 // PREC: nFormat = Lotus-Format-Byte
109 // POST: return = zu nFormat und nSt passendes SC-Format
110 SfxUInt32Item
* pAttr
;
113 aCompareIdent
.SetStamp( nFormat
, nSt
);
114 nIndex
= aCompareIdent
.GetStamp();
115 OSL_ENSURE( nIndex
< nSize_
, "FormCache::GetAttr(): Oups... not this way!" );
116 if( bValid
[ nIndex
] )
117 pRet
= aIdents
[ nIndex
].GetAttr();
120 // neues Attribut anlegen
121 pAttr
= NewAttr( nFormat
, nSt
);
122 OSL_ENSURE( pAttr
, "FormCache::GetAttr(): Nothing to save" );
124 aIdents
[ nIndex
] = FormIdent( nFormat
, nSt
, *pAttr
);
125 bValid
[ nIndex
] = true;
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */