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 --------------------------------------------------------
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
75 friend class LotAttrTable
;
79 ScPatternAttr
* pPattAttr
;
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!
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;
110 LotAttrCache( void );
113 const ScPatternAttr
& GetPattAttr( const LotAttrWK3
& );
117 class LotAttrCol
: private List
122 const ScPatternAttr
* pPattAttr
;
129 void SetAttr( const SCROW nRow
, const ScPatternAttr
& );
130 void Apply( const SCCOL nCol
, const SCTAB nTab
, const BOOL bClear
= TRUE
);
138 LotAttrCol pCols
[ MAXCOLCOUNT
];
139 LotAttrCache aAttrCache
;
141 LotAttrTable( void );
144 void SetAttr( const SCCOL nColFirst
, const SCCOL nColLast
, const SCROW nRow
, const LotAttrWK3
& );
145 void Apply( const SCTAB nTabNum
);