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 : #ifndef SC_LOTFNTBF_HXX
21 : #define SC_LOTFNTBF_HXX
22 :
23 : #include <tools/solar.h>
24 :
25 : #include "scitems.hxx"
26 : #include <editeng/fontitem.hxx>
27 : #include <editeng/fhgtitem.hxx>
28 : #include <editeng/colritem.hxx>
29 :
30 : // ---------------------------------------------------- class LotusFontBuffer -
31 :
32 : // Code in fontbuff.cxx (excel)
33 :
34 2 : class LotusFontBuffer
35 : {
36 : private:
37 : struct ENTRY
38 : {
39 : String* pTmpName;
40 : SvxFontItem* pFont;
41 : SvxFontHeightItem* pHeight;
42 : SvxColorItem* pColor;
43 : sal_Int32 nType; // < 0 -> undefiniert
44 8 : inline ENTRY( void )
45 : {
46 8 : pTmpName = NULL;
47 8 : pFont = NULL;
48 8 : pHeight = NULL;
49 8 : pColor = NULL;
50 8 : nType = -1;
51 8 : }
52 8 : inline ~ENTRY()
53 : {
54 8 : if( pTmpName )
55 0 : delete pTmpName;
56 8 : if( pFont )
57 0 : delete pFont;
58 8 : if( pHeight )
59 0 : delete pHeight;
60 8 : if( pColor )
61 0 : delete pColor;
62 8 : }
63 0 : inline void TmpName( const String &rNew )
64 : {
65 0 : if( pTmpName )
66 0 : *pTmpName = rNew;
67 : else
68 0 : pTmpName = new String( rNew );
69 0 : }
70 : inline void Font( SvxFontItem& rNew )
71 : {
72 : if( pFont )
73 : delete pFont;
74 : pFont = &rNew;
75 : }
76 0 : inline void Height( SvxFontHeightItem& rNew )
77 : {
78 0 : if( pHeight )
79 0 : delete pHeight;
80 0 : pHeight = &rNew;
81 0 : }
82 : inline void Color( SvxColorItem& rNew )
83 : {
84 : if( pColor )
85 : delete pColor;
86 : pColor = &rNew;
87 : }
88 0 : inline void Type( const sal_uInt16 nNew ) { nType = nNew; }
89 : };
90 :
91 : void MakeFont( ENTRY* pEntry );
92 : public:
93 : const static sal_uInt16 nSize = 8;
94 : void Fill( const sal_uInt8 nIndex, SfxItemSet& rItemSet );
95 : void SetName( const sal_uInt16 nIndex, const String& rName );
96 : void SetHeight( const sal_uInt16 nIndex, const sal_uInt16 nHeight );
97 : void SetType( const sal_uInt16 nIndex, const sal_uInt16 nType );
98 : private:
99 : ENTRY pData[ nSize ];
100 : };
101 :
102 :
103 :
104 : #endif
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|