merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / source / filter / inc / lotattr.hxx
blob7015136f1be1c51877abd0ed6032808fdbd51209
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_LOTATTR_HXX
29 #define SC_LOTATTR_HXX
31 #include <tools/solar.h>
32 #include <tools/list.hxx>
33 #include "patattr.hxx"
34 #include "scitems.hxx"
35 #include "address.hxx"
37 // ----- forwards --------------------------------------------------------
38 class ScDocument;
39 class ScDocumentPool;
40 class SvxBorderLine;
41 class SvxColorItem;
42 class Color;
44 class LotAttrTable;
47 struct LotAttrWK3
49 UINT8 nFont;
50 UINT8 nLineStyle;
51 UINT8 nFontCol;
52 UINT8 nBack;
54 inline BOOL HasStyles( void );
55 inline BOOL IsCentered( void );
59 inline BOOL LotAttrWK3::HasStyles( void )
61 return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
62 // !! ohne Center-Bit!!
66 inline BOOL LotAttrWK3::IsCentered( void )
68 return ( nBack & 0x80 );
72 class LotAttrCache : private List
74 private:
75 friend class LotAttrTable;
77 struct ENTRY
79 ScPatternAttr* pPattAttr;
80 UINT32 nHash0;
82 inline ENTRY( const ScPatternAttr& r ) { pPattAttr = new ScPatternAttr( r ); }
84 inline ENTRY( ScPatternAttr* p ) { pPattAttr = p; }
86 inline ~ENTRY() { delete pPattAttr; }
88 inline BOOL operator ==( const ENTRY& r ) const { return nHash0 == r.nHash0; }
90 inline BOOL operator ==( const UINT32& r ) const { return nHash0 == r; }
93 ScDocumentPool* pDocPool;
94 SvxColorItem* ppColorItems[ 6 ]; // 0 und 7 fehlen!
95 SvxColorItem* pBlack;
96 SvxColorItem* pWhite;
97 Color* pColTab;
99 inline static void MakeHash( const LotAttrWK3& rAttr, UINT32& rOut )
101 ( ( UINT8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
102 ( ( UINT8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
103 ( ( UINT8* ) &rOut )[ 2 ] = rAttr.nFontCol;
104 ( ( UINT8* ) &rOut )[ 3 ] = rAttr.nBack;
106 static void LotusToScBorderLine( UINT8 nLine, SvxBorderLine& );
107 const SvxColorItem& GetColorItem( const UINT8 nLotIndex ) const;
108 const Color& GetColor( const UINT8 nLotIndex ) const;
109 public:
110 LotAttrCache( void );
111 ~LotAttrCache();
113 const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
117 class LotAttrCol : private List
119 private:
120 struct ENTRY
122 const ScPatternAttr* pPattAttr;
123 SCROW nFirstRow;
124 SCROW nLastRow;
127 public:
128 ~LotAttrCol( void );
129 void SetAttr( const SCROW nRow, const ScPatternAttr& );
130 void Apply( const SCCOL nCol, const SCTAB nTab, const BOOL bClear = TRUE );
131 void Clear( void );
135 class LotAttrTable
137 private:
138 LotAttrCol pCols[ MAXCOLCOUNT ];
139 LotAttrCache aAttrCache;
140 public:
141 LotAttrTable( void );
142 ~LotAttrTable();
144 void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
145 void Apply( const SCTAB nTabNum );
152 #endif