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 $
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 --------------------------------------------------------
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
78 friend class LotAttrTable
;
82 ScPatternAttr
* pPattAttr
;
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!
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;
113 LotAttrCache( void );
116 const ScPatternAttr
& GetPattAttr( const LotAttrWK3
& );
120 class LotAttrCol
: private List
125 const ScPatternAttr
* pPattAttr
;
132 void SetAttr( const SCROW nRow
, const ScPatternAttr
& );
133 void Apply( const SCCOL nCol
, const SCTAB nTab
, const BOOL bClear
= TRUE
);
141 LotAttrCol pCols
[ MAXCOLCOUNT
];
142 LotAttrCache aAttrCache
;
144 LotAttrTable( void );
147 void SetAttr( const SCCOL nColFirst
, const SCCOL nColLast
, const SCROW nRow
, const LotAttrWK3
& );
148 void Apply( const SCTAB nTabNum
);