Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / vcl / inc / region.h
blob457bb1e6fa79901d08c6ff7f3fff68319f08cb3d
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 _SV_REGION_H
21 #define _SV_REGION_H
23 #include <vcl/regband.hxx>
24 #include <tools/poly.hxx>
25 #include <vcl/region.hxx>
27 // -----------------
28 // - Hilfsmethoden -
29 // -----------------
31 #ifdef DBG_UTIL
32 const char* ImplDbgTestRegion( const void* pObj );
33 #endif
35 // --------------------
36 // - ImplRegionHandle -
37 // --------------------
39 struct ImplRegionHandle
41 Region* mpRegion;
42 ImplRegionBand* mpCurrRectBand;
43 ImplRegionBandSep* mpCurrRectBandSep;
44 sal_Bool mbFirst;
47 // ------------------
48 // - ImplRegionInfo -
49 // ------------------
51 struct ImplRegionInfo
53 void* mpVoidCurrRectBand;
54 void* mpVoidCurrRectBandSep;
57 // --------------
58 // - ImplRegion -
59 // --------------
61 struct ImplRegionBase
63 public:
64 ImplRegionBase( int nCount = 1 ); // TODO: replace manual refcounting
65 virtual ~ImplRegionBase();
66 public:
67 sal_uIntPtr mnRefCount;
68 sal_uIntPtr mnRectCount;
69 PolyPolygon* mpPolyPoly;
70 basegfx::B2DPolyPolygon* mpB2DPolyPoly;
73 class ImplRegion : public ImplRegionBase
75 friend class Region;
77 private:
78 ImplRegionBand* mpFirstBand; // root of the list with y-bands
79 ImplRegionBand* mpLastCheckedBand;
81 public:
82 ImplRegion();
83 ImplRegion( const PolyPolygon& rPolyPoly );
84 ImplRegion( const basegfx::B2DPolyPolygon& );
85 ImplRegion( const ImplRegion& rImplRegion );
86 ~ImplRegion();
88 ImplRegionBand* ImplGetFirstRegionBand() const { return mpFirstBand; }
89 PolyPolygon* ImplGetPolyPoly() const { return mpPolyPoly; }
91 void CreateBandRange( long nYTop, long nYBottom );
92 void InsertBands( long nYTop, long nYBottom );
93 sal_Bool InsertSingleBand( ImplRegionBand* mpImplRegionBand,
94 long nYBandPosition );
95 sal_Bool InsertLine( const Point & rFirstPoint,
96 const Point & rSecondPoint,
97 long nLineID );
98 sal_Bool InsertPoint( const Point &rPoint,
99 long nLineID,
100 sal_Bool bEndPoint, LineType eLineType );
102 /** Insert one band either after another band or as the first or only
103 band. Both the forward as well as the backward links are updated.
104 @param pPreviousBand
105 When <NULL/> then pBandToInsert is inserted as first band or as
106 only band when there are no other bands.
107 When not <NULL/> then pBandToInsert is inserted directly after
108 pPreviousBand.
109 @param pBandToInsert
110 The band to insert.
112 void InsertBand (ImplRegionBand* pPreviousBand,
113 ImplRegionBand* pBandToInsert);
115 void Union( long nLeft, long nTop, long nRight, long nBottom );
116 void Exclude( long nLeft, long nTop, long nRight, long nBottom );
117 void XOr( long nLeft, long nTop, long nRight, long nBottom );
119 // remove emtpy rects
120 sal_Bool OptimizeBandList();
122 friend SvStream& operator>>( SvStream& rIStm, Region& rRegion );
123 friend SvStream& operator<<( SvStream& rOStm, const Region& rRegion );
126 #endif // _SV_REGION_H
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */