Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _MyTXTRANGE_HXX
30 : : #define _MyTXTRANGE_HXX
31 : :
32 : : #include "editeng/editengdllapi.h"
33 : : #include "tools/solar.h"
34 : : #include "tools/gen.hxx"
35 : :
36 : : #include <deque>
37 : :
38 : : class PolyPolygon;
39 : : class Rectangle;
40 : :
41 : : namespace basegfx {
42 : : class B2DPolyPolygon;
43 : : }
44 : :
45 : : typedef std::deque<long>* LongDqPtr;
46 : :
47 : : /*************************************************************************
48 : : |*
49 : : |* class TextRanger
50 : : |*
51 : : *************************************************************************/
52 : : class EDITENG_DLLPUBLIC TextRanger
53 : : {
54 : : //! The RangeCache class is used to cache the result of a single range calculation.
55 : 48 : struct RangeCache
56 : : {
57 : : Range range; //!< Range for which we calculated results.
58 : : std::deque<long> results; //!< Calculated results for the range.
59 : 16 : RangeCache(const Range& rng) : range(rng) {};
60 : : };
61 : : std::deque<RangeCache> mRangeCache; //!< Cached range calculations.
62 : : PolyPolygon *mpPolyPolygon; // Surface polygon
63 : : PolyPolygon *mpLinePolyPolygon; // Line polygon
64 : : Rectangle *pBound; // Comprehensive rectangle
65 : : sal_uInt16 nCacheSize; // Cache-Size
66 : : sal_uInt16 nRight; // Distance Contour-Text
67 : : sal_uInt16 nLeft; // Distance Text-Contour
68 : : sal_uInt16 nUpper; // Distance Contour-Text
69 : : sal_uInt16 nLower; // Distance Text-Contour
70 : : sal_uInt32 nPointCount; // Number of polygon points
71 : : sal_Bool bSimple : 1; // Just outside edge
72 : : sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine);
73 : : // FALSE: Objekt flow (StarWriter);
74 : : sal_Bool bVertical :1; // for vertical writing mode
75 : : sal_Bool bFlag3 :1;
76 : : sal_Bool bFlag4 :1;
77 : : sal_Bool bFlag5 :1;
78 : : sal_Bool bFlag6 :1;
79 : : sal_Bool bFlag7 :1;
80 : : TextRanger( const TextRanger& ); // not implemented
81 : : const Rectangle& _GetBoundRect();
82 : : public:
83 : : TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon,
84 : : const basegfx::B2DPolyPolygon* pLinePolyPolygon,
85 : : sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
86 : : sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False );
87 : : ~TextRanger();
88 : : LongDqPtr GetTextRanges( const Range& rRange );
89 : 16 : sal_uInt16 GetRight() const { return nRight; }
90 : 16 : sal_uInt16 GetLeft() const { return nLeft; }
91 : 16 : sal_uInt16 GetUpper() const { return nUpper; }
92 : 16 : sal_uInt16 GetLower() const { return nLower; }
93 : 32 : sal_uInt32 GetPointCount() const { return nPointCount; }
94 : 16 : sal_Bool IsSimple() const { return bSimple; }
95 : 16 : sal_Bool IsInner() const { return bInner; }
96 : 144 : sal_Bool IsVertical() const { return bVertical; }
97 : : sal_Bool HasBorder() const { return nRight || nLeft; }
98 : 0 : const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; }
99 : : const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; }
100 : 0 : const Rectangle& GetBoundRect()
101 [ # # ]: 0 : { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); }
102 : 16 : void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
103 : 16 : void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
104 : : void SetVertical( sal_Bool bNew );
105 : : sal_Bool IsFlag3() const { return bFlag3; }
106 : : void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; }
107 : : sal_Bool IsFlag4() const { return bFlag4; }
108 : : void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; }
109 : : sal_Bool IsFlag5() const { return bFlag5; }
110 : : void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; }
111 : : sal_Bool IsFlag6() const { return bFlag6; }
112 : : void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; }
113 : : sal_Bool IsFlag7() const { return bFlag7; }
114 : : void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; }
115 : : };
116 : :
117 : :
118 : :
119 : : #endif // _TXTRANGE_HXX
120 : :
121 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|