re-enabled user-defined numeric fields for dBase export
[LibreOffice.git] / sc / source / filter / inc / lotattr.hxx
bloba608be56bc7347148f0f3d03d6141360bae74699
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 SC_LOTATTR_HXX
21 #define SC_LOTATTR_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
25 #include <tools/solar.h>
27 #include "address.hxx"
28 #include "scitems.hxx"
30 class ScDocumentPool;
31 class ScPatternAttr;
32 class SvxColorItem;
33 class Color;
34 class LotAttrTable;
35 struct LOTUS_ROOT;
37 namespace editeng { class SvxBorderLine; }
39 struct LotAttrWK3
41 sal_uInt8 nFont;
42 sal_uInt8 nLineStyle;
43 sal_uInt8 nFontCol;
44 sal_uInt8 nBack;
46 inline bool HasStyles () const
48 return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
49 // !! ohne Center-Bit!!
52 inline bool IsCentered () const
54 return ( nBack & 0x80 );
58 class LotAttrCache
60 public:
62 LotAttrCache(LOTUS_ROOT* pLotRoot);
64 ~LotAttrCache();
66 const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
68 private:
70 friend class LotAttrTable;
72 struct ENTRY
74 ScPatternAttr* pPattAttr;
75 sal_uInt32 nHash0;
77 ENTRY (ScPatternAttr* p);
79 ~ENTRY ();
81 inline bool operator == (const ENTRY &r) const { return nHash0 == r.nHash0; }
83 inline bool operator == (const sal_uInt32 &r) const { return nHash0 == r; }
86 inline static void MakeHash( const LotAttrWK3& rAttr, sal_uInt32& rOut )
88 ( ( sal_uInt8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
89 ( ( sal_uInt8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
90 ( ( sal_uInt8* ) &rOut )[ 2 ] = rAttr.nFontCol;
91 ( ( sal_uInt8* ) &rOut )[ 3 ] = rAttr.nBack;
94 static void LotusToScBorderLine( sal_uInt8 nLine, ::editeng::SvxBorderLine& );
96 const SvxColorItem& GetColorItem( const sal_uInt8 nLotIndex ) const;
98 const Color& GetColor( const sal_uInt8 nLotIndex ) const;
100 ScDocumentPool* pDocPool;
101 SvxColorItem* ppColorItems[6]; // 0 und 7 fehlen!
102 SvxColorItem* pBlack;
103 SvxColorItem* pWhite;
104 Color* pColTab;
105 boost::ptr_vector<ENTRY> aEntries;
107 LOTUS_ROOT* mpLotusRoot;
111 class LotAttrCol
113 public:
114 void SetAttr (const SCROW nRow, const ScPatternAttr&);
116 void Apply (const SCCOL nCol, const SCTAB nTab );
117 private:
119 struct ENTRY
121 const ScPatternAttr* pPattAttr;
122 SCROW nFirstRow;
123 SCROW nLastRow;
126 boost::ptr_vector<ENTRY> aEntries;
130 class LotAttrTable
132 public:
133 LotAttrTable(LOTUS_ROOT* pLotRoot);
135 void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
137 void Apply( const SCTAB nTabNum );
139 private:
141 LotAttrCol pCols[ MAXCOLCOUNT ];
142 LotAttrCache aAttrCache;
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */