tdf#151341 Use lzfse compression instead of bzip2
[LibreOffice.git] / vcl / inc / regband.hxx
blobb0135fa560861dd2b28663e18c085a0e23dec003
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_VCL_INC_REGBAND_HXX
21 #define INCLUDED_VCL_INC_REGBAND_HXX
25 class ImplRegionBand
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.
31 The separations are modified with basic clipping functions like Union and
32 Intersection - the Class will process the clipping for the actual band.
36 // element for the list with x-separations
37 struct ImplRegionBandSep
39 ImplRegionBandSep* mpNextSep;
40 tools::Long mnXLeft;
41 tools::Long mnXRight;
42 bool mbRemoved;
45 enum class LineType { Ascending, Descending };
47 // element for the list with x-separations
48 struct ImplRegionBandPoint
50 ImplRegionBandPoint* mpNextBandPoint;
51 tools::Long mnX;
52 tools::Long mnLineId;
53 bool mbEndPoint;
54 LineType meLineType;
57 class ImplRegionBand
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 tools::Long mnYTop; // actual boundary of the band
65 tools::Long mnYBottom;
67 bool mbTouched : 1;
69 // create y-band with boundaries
70 ImplRegionBand( tools::Long nYTop, tools::Long nYBottom );
71 /** copy y-band with all data
72 @param theSourceBand
73 The new ImplRegionBand object will
74 be a copy of this band.
75 @param bIgnorePoints
76 When true (the default) the
77 band points pointed to by
78 mpFirstBandPoint are not copied.
79 When false they are copied.
80 You need the points when you are
81 planning to call ProcessPoints()
82 later on.
84 ImplRegionBand( const ImplRegionBand & theSourceBand,
85 const bool bIgnorePoints = true);
86 ~ImplRegionBand();
88 tools::Long GetXLeftBoundary() const;
89 tools::Long GetXRightBoundary() const;
91 // combine overlapping bands
92 void OptimizeBand();
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( tools::Long nX, tools::Long nLineID,
99 bool bEndPoint, LineType eLineType );
101 void Union( tools::Long nXLeft, tools::Long nXRight );
102 void Intersect( tools::Long nXLeft, tools::Long nXRight );
103 void Exclude( tools::Long nXLeft, tools::Long nXRight );
104 void XOr( tools::Long nXLeft, tools::Long nXRight );
106 void MoveX( tools::Long nHorzMove );
107 void ScaleX( double fHorzScale );
109 bool Contains( tools::Long nX );
111 bool IsEmpty() const { return ((!mpFirstSep) && (!mpFirstBandPoint)); }
113 bool operator==( const ImplRegionBand& rRegionBand ) const;
115 /** Split the called band at the given vertical coordinate. After the
116 split the called band will cover the upper part not including nY.
117 The new band will cover the lower part including nY.
118 @param nY
119 The band is split at this y coordinate. The new, lower band
120 will include this very value.
121 @return
122 Returns the new, lower band.
124 ImplRegionBand* SplitBand (const sal_Int32 nY);
127 #endif // INCLUDED_VCL_INC_REGBAND_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */