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