Update ooo320-m1
[ooovba.git] / sc / source / filter / inc / lotattr.hxx
blob0a0071b7742d7f5436d4bebcd3e6b3aff1860c58
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
9 * $RCSfile: lotattr.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
31 #ifndef SC_LOTATTR_HXX
32 #define SC_LOTATTR_HXX
34 #include <tools/solar.h>
35 #include <tools/list.hxx>
36 #include "patattr.hxx"
37 #include "scitems.hxx"
38 #include "address.hxx"
40 // ----- forwards --------------------------------------------------------
41 class ScDocument;
42 class ScDocumentPool;
43 class SvxBorderLine;
44 class SvxColorItem;
45 class Color;
47 class LotAttrTable;
50 struct LotAttrWK3
52 UINT8 nFont;
53 UINT8 nLineStyle;
54 UINT8 nFontCol;
55 UINT8 nBack;
57 inline BOOL HasStyles( void );
58 inline BOOL IsCentered( void );
62 inline BOOL LotAttrWK3::HasStyles( void )
64 return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
65 // !! ohne Center-Bit!!
69 inline BOOL LotAttrWK3::IsCentered( void )
71 return ( nBack & 0x80 );
75 class LotAttrCache : private List
77 private:
78 friend class LotAttrTable;
80 struct ENTRY
82 ScPatternAttr* pPattAttr;
83 UINT32 nHash0;
85 inline ENTRY( const ScPatternAttr& r ) { pPattAttr = new ScPatternAttr( r ); }
87 inline ENTRY( ScPatternAttr* p ) { pPattAttr = p; }
89 inline ~ENTRY() { delete pPattAttr; }
91 inline BOOL operator ==( const ENTRY& r ) const { return nHash0 == r.nHash0; }
93 inline BOOL operator ==( const UINT32& r ) const { return nHash0 == r; }
96 ScDocumentPool* pDocPool;
97 SvxColorItem* ppColorItems[ 6 ]; // 0 und 7 fehlen!
98 SvxColorItem* pBlack;
99 SvxColorItem* pWhite;
100 Color* pColTab;
102 inline static void MakeHash( const LotAttrWK3& rAttr, UINT32& rOut )
104 ( ( UINT8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
105 ( ( UINT8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
106 ( ( UINT8* ) &rOut )[ 2 ] = rAttr.nFontCol;
107 ( ( UINT8* ) &rOut )[ 3 ] = rAttr.nBack;
109 static void LotusToScBorderLine( UINT8 nLine, SvxBorderLine& );
110 const SvxColorItem& GetColorItem( const UINT8 nLotIndex ) const;
111 const Color& GetColor( const UINT8 nLotIndex ) const;
112 public:
113 LotAttrCache( void );
114 ~LotAttrCache();
116 const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
120 class LotAttrCol : private List
122 private:
123 struct ENTRY
125 const ScPatternAttr* pPattAttr;
126 SCROW nFirstRow;
127 SCROW nLastRow;
130 public:
131 ~LotAttrCol( void );
132 void SetAttr( const SCROW nRow, const ScPatternAttr& );
133 void Apply( const SCCOL nCol, const SCTAB nTab, const BOOL bClear = TRUE );
134 void Clear( void );
138 class LotAttrTable
140 private:
141 LotAttrCol pCols[ MAXCOLCOUNT ];
142 LotAttrCache aAttrCache;
143 public:
144 LotAttrTable( void );
145 ~LotAttrTable();
147 void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
148 void Apply( const SCTAB nTabNum );
155 #endif