Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_LOTATTR_HXX
30 : : #define SC_LOTATTR_HXX
31 : :
32 : : #include <boost/ptr_container/ptr_vector.hpp>
33 : :
34 : : #include <tools/solar.h>
35 : :
36 : : #include "address.hxx"
37 : : #include "scitems.hxx"
38 : :
39 : : class ScDocumentPool;
40 : : class ScPatternAttr;
41 : : class SvxColorItem;
42 : : class Color;
43 : : class LotAttrTable;
44 : :
45 : : namespace editeng { class SvxBorderLine; }
46 : :
47 : : struct LotAttrWK3
48 : : {
49 : : sal_uInt8 nFont;
50 : : sal_uInt8 nLineStyle;
51 : : sal_uInt8 nFontCol;
52 : : sal_uInt8 nBack;
53 : :
54 : 0 : inline bool HasStyles () const
55 : : {
56 [ # # ][ # # ]: 0 : return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
[ # # ][ # # ]
57 : : // !! ohne Center-Bit!!
58 : : }
59 : :
60 : 0 : inline bool IsCentered () const
61 : : {
62 : 0 : return ( nBack & 0x80 );
63 : : }
64 : : };
65 : :
66 : : class LotAttrCache
67 : : {
68 : : public:
69 : :
70 : : LotAttrCache ();
71 : :
72 : : ~LotAttrCache();
73 : :
74 : : const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
75 : :
76 : : private:
77 : :
78 : : friend class LotAttrTable;
79 : :
80 : : struct ENTRY
81 : : {
82 : : ScPatternAttr* pPattAttr;
83 : : sal_uInt32 nHash0;
84 : :
85 : : ENTRY (ScPatternAttr* p);
86 : :
87 : : ~ENTRY ();
88 : :
89 : : inline bool operator == (const ENTRY &r) const { return nHash0 == r.nHash0; }
90 : :
91 : : inline bool operator == (const sal_uInt32 &r) const { return nHash0 == r; }
92 : : };
93 : :
94 : 0 : inline static void MakeHash( const LotAttrWK3& rAttr, sal_uInt32& rOut )
95 : : {
96 : 0 : ( ( sal_uInt8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
97 : 0 : ( ( sal_uInt8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
98 : 0 : ( ( sal_uInt8* ) &rOut )[ 2 ] = rAttr.nFontCol;
99 : 0 : ( ( sal_uInt8* ) &rOut )[ 3 ] = rAttr.nBack;
100 : 0 : }
101 : :
102 : : static void LotusToScBorderLine( sal_uInt8 nLine, ::editeng::SvxBorderLine& );
103 : :
104 : : const SvxColorItem& GetColorItem( const sal_uInt8 nLotIndex ) const;
105 : :
106 : : const Color& GetColor( const sal_uInt8 nLotIndex ) const;
107 : :
108 : : ScDocumentPool* pDocPool;
109 : : SvxColorItem* ppColorItems[6]; // 0 und 7 fehlen!
110 : : SvxColorItem* pBlack;
111 : : SvxColorItem* pWhite;
112 : : Color* pColTab;
113 : : boost::ptr_vector<ENTRY> aEntries;
114 : : };
115 : :
116 : :
117 : 0 : class LotAttrCol
118 : : {
119 : : public:
120 : :
121 : : void SetAttr (const SCROW nRow, const ScPatternAttr&);
122 : :
123 : : void Apply (const SCCOL nCol, const SCTAB nTab );
124 : : private:
125 : :
126 : : struct ENTRY
127 : : {
128 : : const ScPatternAttr* pPattAttr;
129 : : SCROW nFirstRow;
130 : : SCROW nLastRow;
131 : : };
132 : :
133 : : boost::ptr_vector<ENTRY> aEntries;
134 : : };
135 : :
136 : :
137 [ # # ][ # # ]: 0 : class LotAttrTable
[ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ]
138 : : {
139 : : public:
140 : :
141 : : void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
142 : :
143 : : void Apply( const SCTAB nTabNum );
144 : :
145 : : private:
146 : :
147 : : LotAttrCol pCols[ MAXCOLCOUNT ];
148 : : LotAttrCache aAttrCache;
149 : : };
150 : :
151 : : #endif
152 : :
153 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|