fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / inc / lotattr.hxx
blob8069ce3f231b22a1d396ba8385565c08f59197d8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_LOTATTR_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_LOTATTR_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
25 #include "address.hxx"
26 #include "scitems.hxx"
28 class ScDocumentPool;
29 class ScPatternAttr;
30 class SvxColorItem;
31 class Color;
32 class LotAttrTable;
33 struct LOTUS_ROOT;
35 namespace editeng { class SvxBorderLine; }
37 struct LotAttrWK3
39 sal_uInt8 nFont;
40 sal_uInt8 nLineStyle;
41 sal_uInt8 nFontCol;
42 sal_uInt8 nBack;
44 inline bool HasStyles () const
46 return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
47 // !! ohne Center-Bit!!
50 inline bool IsCentered () const
52 return ( nBack & 0x80 );
56 class LotAttrCache
58 public:
60 LotAttrCache(LOTUS_ROOT* pLotRoot);
62 ~LotAttrCache();
64 const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
66 private:
68 friend class LotAttrTable;
70 struct ENTRY
72 ScPatternAttr* pPattAttr;
73 sal_uInt32 nHash0;
75 ENTRY (ScPatternAttr* p);
77 ~ENTRY ();
79 inline bool operator == (const ENTRY &r) const { return nHash0 == r.nHash0; }
81 inline bool operator == (const sal_uInt32 &r) const { return nHash0 == r; }
84 inline static void MakeHash( const LotAttrWK3& rAttr, sal_uInt32& rOut )
86 reinterpret_cast<sal_uInt8*>(&rOut)[ 0 ] = rAttr.nFont & 0x7F;
87 reinterpret_cast<sal_uInt8*>(&rOut)[ 1 ] = rAttr.nLineStyle;
88 reinterpret_cast<sal_uInt8*>(&rOut)[ 2 ] = rAttr.nFontCol;
89 reinterpret_cast<sal_uInt8*>(&rOut)[ 3 ] = rAttr.nBack;
92 static void LotusToScBorderLine( sal_uInt8 nLine, ::editeng::SvxBorderLine& );
94 const SvxColorItem& GetColorItem( const sal_uInt8 nLotIndex ) const;
96 const Color& GetColor( const sal_uInt8 nLotIndex ) const;
98 ScDocumentPool* pDocPool;
99 SvxColorItem* ppColorItems[6]; // 0 und 7 fehlen!
100 SvxColorItem* pBlack;
101 SvxColorItem* pWhite;
102 Color* pColTab;
103 boost::ptr_vector<ENTRY> aEntries;
105 LOTUS_ROOT* mpLotusRoot;
108 class LotAttrCol
110 public:
111 void SetAttr (const SCROW nRow, const ScPatternAttr&);
113 void Apply(LOTUS_ROOT* pLotRoot, const SCCOL nCol, const SCTAB nTab);
114 private:
116 struct ENTRY
118 const ScPatternAttr* pPattAttr;
119 SCROW nFirstRow;
120 SCROW nLastRow;
123 boost::ptr_vector<ENTRY> aEntries;
126 class LotAttrTable
128 public:
129 LotAttrTable(LOTUS_ROOT* pLotRoot);
131 void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
133 void Apply(LOTUS_ROOT* pLotRoot, const SCTAB nTabNum);
135 private:
137 LotAttrCol pCols[ MAXCOLCOUNT ];
138 LotAttrCache aAttrCache;
141 #endif
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */