xref: /trunk/main/editeng/inc/editeng/txtrange.hxx (revision 4c5491ea)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _MyTXTRANGE_HXX
25 #define _MyTXTRANGE_HXX
26 
27 #ifndef _TXTRANGE_HXX
28 #define _SVSTDARR_sal_BoolS
29 #define _SVSTDARR_LONGS
30 #include <svl/svstdarr.hxx>
31 #endif
32 #include "editeng/editengdllapi.h"
33 
34 class PolyPolygon;
35 class Range;
36 class Rectangle;
37 
38 namespace basegfx {
39     class B2DPolyPolygon;
40 }
41 
42 typedef SvLongs* SvLongsPtr;
43 
44 /*************************************************************************
45 |*
46 |*    class TextRanger
47 |*
48 |*    Beschreibung
49 |*    Ersterstellung       20.01.97
50 |*    Letzte Aenderung AMA 20.01.97
51 |*
52 *************************************************************************/
53 class EDITENG_DLLPUBLIC TextRanger
54 {
55 	Range *pRangeArr;
56 	SvLongsPtr *pCache;
57 	PolyPolygon *mpPolyPolygon; // Flaechenpolygon
58 	PolyPolygon *mpLinePolyPolygon; // Linienpolygon
59 	Rectangle *pBound;	// Umfassendes Rechteck
60 	sal_uInt16 nCacheSize;	// Cache-Size
61 	sal_uInt16 nCacheIdx;	// Cache-Index
62 	sal_uInt16 nRight;		// Abstand Kontur-Text
63 	sal_uInt16 nLeft;		// Abstand Text-Kontur
64 	sal_uInt16 nUpper;		// Abstand Kontur-Text
65 	sal_uInt16 nLower;		// Abstand Text-Kontur
66 	sal_uInt32 nPointCount; // Anzahl der Polygonpunkte
67 	sal_Bool bSimple : 1;	// Nur Aussenkante
68 	sal_Bool bInner  : 1;	// sal_True: Objekt beschriften (EditEngine);
69 						// sal_False: Objekt umfliessen (StarWriter);
70 	sal_Bool bVertical :1;	// for vertical writing mode
71 	sal_Bool bFlag3 :1;
72 	sal_Bool bFlag4 :1;
73 	sal_Bool bFlag5 :1;
74 	sal_Bool bFlag6 :1;
75 	sal_Bool bFlag7 :1;
76 	TextRanger( const TextRanger& ); // not implemented
77 	const Rectangle& _GetBoundRect();
78 public:
79 	TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon,
80 				sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
81 				sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False );
82 	~TextRanger();
83 	SvLongsPtr GetTextRanges( const Range& rRange );
GetRight() const84 	sal_uInt16 GetRight() const { return nRight; }
GetLeft() const85 	sal_uInt16 GetLeft() const { return nLeft; }
GetUpper() const86 	sal_uInt16 GetUpper() const { return nUpper; }
GetLower() const87 	sal_uInt16 GetLower() const { return nLower; }
GetPointCount() const88 	sal_uInt32 GetPointCount() const { return nPointCount; }
IsSimple() const89 	sal_Bool IsSimple() const { return bSimple; }
IsInner() const90 	sal_Bool IsInner() const { return bInner; }
IsVertical() const91 	sal_Bool IsVertical() const { return bVertical; }
HasBorder() const92 	sal_Bool HasBorder() const { return nRight || nLeft; }
GetPolyPolygon() const93 	const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; }
GetLinePolygon() const94 	const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; }
GetBoundRect()95 	const Rectangle& GetBoundRect()
96 		{ return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); }
SetUpper(sal_uInt16 nNew)97 	void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
SetLower(sal_uInt16 nNew)98 	void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
99 	void SetVertical( sal_Bool bNew );
IsFlag3() const100 	sal_Bool IsFlag3() const { return bFlag3; }
SetFlag3(sal_Bool bNew)101 	void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; }
IsFlag4() const102 	sal_Bool IsFlag4() const { return bFlag4; }
SetFlag4(sal_Bool bNew)103 	void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; }
IsFlag5() const104 	sal_Bool IsFlag5() const { return bFlag5; }
SetFlag5(sal_Bool bNew)105 	void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; }
IsFlag6() const106 	sal_Bool IsFlag6() const { return bFlag6; }
SetFlag6(sal_Bool bNew)107 	void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; }
IsFlag7() const108 	sal_Bool IsFlag7() const { return bFlag7; }
SetFlag7(sal_Bool bNew)109 	void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; }
110 };
111 
112 
113 
114 #endif      // _TXTRANGE_HXX
115