LibreOffice Module vcl (master)  1
regband.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_VCL_INC_REGBAND_HXX
21 #define INCLUDED_VCL_INC_REGBAND_HXX
22 
23 /*
24 
25 class ImplRegionBand
26 
27 This class handles one y-band of the region. In this band may contain one
28 or more separations in x-direction. The y-Band do not contain any
29 separation after creation.
30 
31 The separations are modified with basic clipping functions like Union and
32 Intersection - the Class will process the clipping for the actual band.
33 
34 */
35 
36 // element for the list with x-separations
38 {
40  long mnXLeft;
41  long mnXRight;
42  bool mbRemoved;
43 };
44 
45 enum class LineType { Ascending, Descending };
46 
47 // element for the list with x-separations
49 {
51  long mnX;
52  long mnLineId;
53  bool mbEndPoint;
55 };
56 
58 {
59 public:
60  ImplRegionBand* mpNextBand; // pointer to the next element of the list
61  ImplRegionBand* mpPrevBand; // pointer to the previous element of the list (only used temporarily)
62  ImplRegionBandSep* mpFirstSep; // root of the list with x-separations
63  ImplRegionBandPoint* mpFirstBandPoint; // root of the list with lines
64  long mnYTop; // actual boundary of the band
65  long mnYBottom;
66 
67  bool mbTouched : 1;
68 
69  // create y-band with boundaries
70  ImplRegionBand( long nYTop, long nYBottom );
84  ImplRegionBand( const ImplRegionBand & theSourceBand,
85  const bool bIgnorePoints = true);
87 
88  long GetXLeftBoundary() const;
89  long GetXRightBoundary() const;
90 
91  // combine overlapping bands
92  void OptimizeBand();
93 
94  // generate separations from lines and process
95  // union with existing separations
96  void ProcessPoints();
97  // insert point in the list for later processing
98  bool InsertPoint( long nX, long nLineID,
99  bool bEndPoint, LineType eLineType );
100 
101  void Union( long nXLeft, long nXRight );
102  void Intersect( long nXLeft, long nXRight );
103  void Exclude( long nXLeft, long nXRight );
104  void XOr( long nXLeft, long nXRight );
105 
106  void MoveX( long nHorzMove );
107  void ScaleX( double fHorzScale );
108 
109  bool IsInside( long nX );
110 
111  bool IsEmpty() const { return ((!mpFirstSep) && (!mpFirstBandPoint)); }
112 
113  bool operator==( const ImplRegionBand& rRegionBand ) const;
114 
124  ImplRegionBand* SplitBand (const sal_Int32 nY);
125 };
126 
127 #endif // INCLUDED_VCL_INC_REGBAND_HXX
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetXRightBoundary() const
Definition: regband.cxx:823
bool operator==(const ImplRegionBand &rRegionBand) const
Definition: regband.cxx:834
bool IsEmpty() const
Definition: regband.hxx:111
ImplRegionBandSep * mpFirstSep
Definition: regband.hxx:62
ImplRegionBand * mpPrevBand
Definition: regband.hxx:61
long GetXLeftBoundary() const
Definition: regband.cxx:816
bool IsInside(long nX)
Definition: regband.cxx:802
void ProcessPoints()
Definition: regband.cxx:141
void Union(long nXLeft, long nXRight)
Definition: regband.cxx:364
ImplRegionBandPoint * mpFirstBandPoint
Definition: regband.hxx:63
long mnYBottom
Definition: regband.hxx:65
void ScaleX(double fHorzScale)
Definition: regband.cxx:312
ImplRegionBandPoint * mpNextBandPoint
Definition: regband.hxx:50
ImplRegionBand * SplitBand(const sal_Int32 nY)
Split the called band at the given vertical coordinate.
Definition: regband.cxx:862
LineType meLineType
Definition: regband.hxx:54
ImplRegionBand(long nYTop, long nYBottom)
Definition: regband.cxx:40
bool mbTouched
Definition: regband.hxx:67
ImplRegionBandSep * mpNextSep
Definition: regband.hxx:39
bool InsertPoint(long nX, long nLineID, bool bEndPoint, LineType eLineType)
Definition: regband.cxx:192
void MoveX(long nHorzMove)
Definition: regband.cxx:300
void Exclude(long nXLeft, long nXRight)
Definition: regband.cxx:481
void Intersect(long nXLeft, long nXRight)
Definition: regband.cxx:436
void OptimizeBand()
Definition: regband.cxx:325
void XOr(long nXLeft, long nXRight)
Definition: regband.cxx:559
LineType
ImplRegionBand * mpNextBand
Definition: regband.hxx:60