1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_LOTFNTBF_HXX 25 #define SC_LOTFNTBF_HXX 26 27 #include <tools/solar.h> 28 29 #include "scitems.hxx" 30 #include <editeng/fontitem.hxx> 31 #include <editeng/fhgtitem.hxx> 32 #include <editeng/colritem.hxx> 33 34 // ---------------------------------------------------- class LotusFontBuffer - 35 36 // Code in fontbuff.cxx (excel) 37 38 class LotusFontBuffer 39 { 40 private: 41 struct ENTRY 42 { 43 String* pTmpName; 44 SvxFontItem* pFont; 45 SvxFontHeightItem* pHeight; 46 SvxColorItem* pColor; 47 sal_Int32 nType; // < 0 -> undefiniert ENTRYLotusFontBuffer::ENTRY48 inline ENTRY( void ) 49 { 50 pTmpName = NULL; 51 pFont = NULL; 52 pHeight = NULL; 53 pColor = NULL; 54 nType = -1; 55 } ~ENTRYLotusFontBuffer::ENTRY56 inline ~ENTRY() 57 { 58 if( pTmpName ) 59 delete pTmpName; 60 if( pFont ) 61 delete pFont; 62 if( pHeight ) 63 delete pHeight; 64 if( pColor ) 65 delete pColor; 66 } TmpNameLotusFontBuffer::ENTRY67 inline void TmpName( const String &rNew ) 68 { 69 if( pTmpName ) 70 *pTmpName = rNew; 71 else 72 pTmpName = new String( rNew ); 73 } FontLotusFontBuffer::ENTRY74 inline void Font( SvxFontItem& rNew ) 75 { 76 if( pFont ) 77 delete pFont; 78 pFont = &rNew; 79 } HeightLotusFontBuffer::ENTRY80 inline void Height( SvxFontHeightItem& rNew ) 81 { 82 if( pHeight ) 83 delete pHeight; 84 pHeight = &rNew; 85 } ColorLotusFontBuffer::ENTRY86 inline void Color( SvxColorItem& rNew ) 87 { 88 if( pColor ) 89 delete pColor; 90 pColor = &rNew; 91 } TypeLotusFontBuffer::ENTRY92 inline void Type( const sal_uInt16 nNew ) { nType = nNew; } 93 }; 94 95 void MakeFont( ENTRY* pEntry ); 96 public: 97 const static sal_uInt16 nSize = 8; 98 void Fill( const sal_uInt8 nIndex, SfxItemSet& rItemSet ); 99 void SetName( const sal_uInt16 nIndex, const String& rName ); 100 void SetHeight( const sal_uInt16 nIndex, const sal_uInt16 nHeight ); 101 void SetType( const sal_uInt16 nIndex, const sal_uInt16 nType ); 102 private: 103 ENTRY pData[ nSize ]; 104 }; 105 106 107 108 #endif 109