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 {
42  bool mbRemoved;
43 };
44 
45 enum class LineType { Ascending, Descending };
46 
47 // element for the list with x-separations
49 {
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  tools::Long mnYTop; // actual boundary of the band
66 
67  bool mbTouched : 1;
68 
69  // create y-band with boundaries
70  ImplRegionBand( tools::Long nYTop, tools::Long nYBottom );
84  ImplRegionBand( const ImplRegionBand & theSourceBand,
85  const bool bIgnorePoints = true);
87 
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( tools::Long nX, tools::Long nLineID,
99  bool bEndPoint, LineType eLineType );
100 
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 );
105 
106  void MoveX( tools::Long nHorzMove );
107  void ScaleX( double fHorzScale );
108 
109  bool IsInside( tools::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: */
bool operator==(const ImplRegionBand &rRegionBand) const
Definition: regband.cxx:834
void Intersect(tools::Long nXLeft, tools::Long nXRight)
Definition: regband.cxx:436
bool IsEmpty() const
Definition: regband.hxx:111
ImplRegionBandSep * mpFirstSep
Definition: regband.hxx:62
tools::Long mnX
Definition: regband.hxx:51
ImplRegionBand * mpPrevBand
Definition: regband.hxx:61
tools::Long mnYTop
Definition: regband.hxx:64
long Long
void MoveX(tools::Long nHorzMove)
Definition: regband.cxx:300
void ProcessPoints()
Definition: regband.cxx:141
ImplRegionBand(tools::Long nYTop, tools::Long nYBottom)
Definition: regband.cxx:40
ImplRegionBandPoint * mpFirstBandPoint
Definition: regband.hxx:63
tools::Long mnLineId
Definition: regband.hxx:52
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
void Exclude(tools::Long nXLeft, tools::Long nXRight)
Definition: regband.cxx:481
bool mbTouched
Definition: regband.hxx:67
ImplRegionBandSep * mpNextSep
Definition: regband.hxx:39
bool IsInside(tools::Long nX)
Definition: regband.cxx:802
void XOr(tools::Long nXLeft, tools::Long nXRight)
Definition: regband.cxx:559
tools::Long mnXLeft
Definition: regband.hxx:40
tools::Long GetXRightBoundary() const
Definition: regband.cxx:823
tools::Long GetXLeftBoundary() const
Definition: regband.cxx:816
tools::Long mnXRight
Definition: regband.hxx:41
bool InsertPoint(tools::Long nX, tools::Long nLineID, bool bEndPoint, LineType eLineType)
Definition: regband.cxx:192
void Union(tools::Long nXLeft, tools::Long nXRight)
Definition: regband.cxx:364
void OptimizeBand()
Definition: regband.cxx:325
tools::Long mnYBottom
Definition: regband.hxx:65
LineType
ImplRegionBand * mpNextBand
Definition: regband.hxx:60