xref: /trunk/main/vcl/inc/regionband.hxx (revision 44c62228)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef _SV_REGIONBAND_HXX
23 #define _SV_REGIONBAND_HXX
24 
25 #include <vcl/regband.hxx>
26 #include <vcl/region.hxx>
27 
28 #ifdef DBG_UTIL
29 const char* ImplDbgTestRegionBand(const void*);
30 #endif
31 
32 //////////////////////////////////////////////////////////////////////////////
33 
34 class RegionBand
35 {
36 private:
37     friend const char* ImplDbgTestRegionBand(const void*);
38 
39 	ImplRegionBand* 	        mpFirstBand;		// root of the list with y-bands
40 	ImplRegionBand* 	        mpLastCheckedBand;
41 
42     void implReset();
43 
44 public:
45     RegionBand();
46     RegionBand(const RegionBand&);
47     RegionBand& operator=(const RegionBand&);
48     RegionBand(const Rectangle&);
49     ~RegionBand();
50 
51     bool operator==( const RegionBand& rRegionBand ) const;
operator !=(const RegionBand & rRegionBand) const52     bool operator!=( const RegionBand& rRegionBand ) const { return !(RegionBand::operator==( rRegionBand )); }
53 
54     void load(SvStream& rIStrm);
55     void save(SvStream& rIStrm) const;
56 
57     bool isSingleRectangle() const;
ImplGetFirstRegionBand() const58     ImplRegionBand* ImplGetFirstRegionBand() const { return mpFirstBand; }
59     void ImplAddMissingBands(const long nTop, const long nBottom);
60     void InsertBand(ImplRegionBand* pPreviousBand, ImplRegionBand* pBandToInsert);
61     void processPoints();
62     void CreateBandRange(long nYTop, long nYBottom);
63     bool InsertLine(const Point& rStartPt, const Point& rEndPt, long nLineId);
64     bool InsertPoint(const Point &rPoint, long nLineID, bool bEndPoint, LineType eLineType);
65     bool OptimizeBandList();
66     void Move(long nHorzMove, long nVertMove);
67     void Scale(double fScaleX, double fScaleY);
68     void InsertBands(long nTop, long nBottom);
69     bool InsertSingleBand(ImplRegionBand* pBand, long nYBandPosition);
70     void Union(long nLeft, long nTop, long nRight, long nBottom);
71     void Intersect(long nLeft, long nTop, long nRight, long nBottom);
72     void Union(const RegionBand& rSource);
73     void Exclude(long nLeft, long nTop, long nRight, long nBottom);
74     void XOr(long nLeft, long nTop, long nRight, long nBottom);
75     void Intersect(const RegionBand& rSource);
76     bool Exclude(const RegionBand& rSource);
77     void XOr(const RegionBand& rSource);
78     Rectangle GetBoundRect() const;
79     bool IsInside(const Point& rPoint) const;
80     sal_uInt32 getRectangleCount() const; // only users are Region::Intersect and PSWriter::ImplBmp
81     void GetRegionRectangles(RectangleVector& rTarget) const;
82 };
83 
84 #endif	// _SV_REGIONBAND_HXX
85 
86 //////////////////////////////////////////////////////////////////////////////
87 //eof
88