1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_VCL_INC_REGBAND_HXX
21 #define INCLUDED_VCL_INC_REGBAND_HXX
23 #include <tools/long.hxx>
29 This class handles one y-band of the region. In this band may contain one
30 or more separations in x-direction. The y-Band do not contain any
31 separation after creation.
33 The separations are modified with basic clipping functions like Union and
34 Intersection - the Class will process the clipping for the actual band.
38 // element for the list with x-separations
39 struct ImplRegionBandSep
41 ImplRegionBandSep
* mpNextSep
;
47 enum class LineType
{ Ascending
, Descending
};
49 // element for the list with x-separations
50 struct ImplRegionBandPoint
52 ImplRegionBandPoint
* mpNextBandPoint
;
62 ImplRegionBand
* mpNextBand
; // pointer to the next element of the list
63 ImplRegionBand
* mpPrevBand
; // pointer to the previous element of the list (only used temporarily)
64 ImplRegionBandSep
* mpFirstSep
; // root of the list with x-separations
65 ImplRegionBandPoint
* mpFirstBandPoint
; // root of the list with lines
66 tools::Long mnYTop
; // actual boundary of the band
67 tools::Long mnYBottom
;
71 // create y-band with boundaries
72 ImplRegionBand( tools::Long nYTop
, tools::Long nYBottom
);
73 /** copy y-band with all data
75 The new ImplRegionBand object will
76 be a copy of this band.
78 When true (the default) the
79 band points pointed to by
80 mpFirstBandPoint are not copied.
81 When false they are copied.
82 You need the points when you are
83 planning to call ProcessPoints()
86 ImplRegionBand( const ImplRegionBand
& theSourceBand
,
87 const bool bIgnorePoints
= true);
90 tools::Long
GetXLeftBoundary() const;
91 tools::Long
GetXRightBoundary() const;
93 // combine overlapping bands
96 // generate separations from lines and process
97 // union with existing separations
99 // insert point in the list for later processing
100 bool InsertPoint( tools::Long nX
, tools::Long nLineID
,
101 bool bEndPoint
, LineType eLineType
);
103 void Union( tools::Long nXLeft
, tools::Long nXRight
);
104 void Intersect( tools::Long nXLeft
, tools::Long nXRight
);
105 void Exclude( tools::Long nXLeft
, tools::Long nXRight
);
106 void XOr( tools::Long nXLeft
, tools::Long nXRight
);
108 void MoveX( tools::Long nHorzMove
);
109 void ScaleX( double fHorzScale
);
111 bool Contains( tools::Long nX
);
113 bool IsEmpty() const { return ((!mpFirstSep
) && (!mpFirstBandPoint
)); }
115 bool operator==( const ImplRegionBand
& rRegionBand
) const;
117 /** Split the called band at the given vertical coordinate. After the
118 split the called band will cover the upper part not including nY.
119 The new band will cover the lower part including nY.
121 The band is split at this y coordinate. The new, lower band
122 will include this very value.
124 Returns the new, lower band.
126 ImplRegionBand
* SplitBand (const sal_Int32 nY
);
129 #endif // INCLUDED_VCL_INC_REGBAND_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */