Line data Source code
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 _MyTXTRANGE_HXX
21 : #define _MyTXTRANGE_HXX
22 :
23 : #include "editeng/editengdllapi.h"
24 : #include "tools/solar.h"
25 : #include "tools/gen.hxx"
26 :
27 : #include <deque>
28 :
29 : class PolyPolygon;
30 : class Rectangle;
31 :
32 : namespace basegfx {
33 : class B2DPolyPolygon;
34 : }
35 :
36 : typedef std::deque<long>* LongDqPtr;
37 :
38 : /*************************************************************************
39 : |*
40 : |* class TextRanger
41 : |*
42 : *************************************************************************/
43 : class EDITENG_DLLPUBLIC TextRanger
44 : {
45 : //! The RangeCache class is used to cache the result of a single range calculation.
46 15 : struct RangeCache
47 : {
48 : Range range; //!< Range for which we calculated results.
49 : std::deque<long> results; //!< Calculated results for the range.
50 5 : RangeCache(const Range& rng) : range(rng) {};
51 : };
52 : std::deque<RangeCache> mRangeCache; //!< Cached range calculations.
53 : PolyPolygon *mpPolyPolygon; // Surface polygon
54 : PolyPolygon *mpLinePolyPolygon; // Line polygon
55 : Rectangle *pBound; // Comprehensive rectangle
56 : sal_uInt16 nCacheSize; // Cache-Size
57 : sal_uInt16 nRight; // Distance Contour-Text
58 : sal_uInt16 nLeft; // Distance Text-Contour
59 : sal_uInt16 nUpper; // Distance Contour-Text
60 : sal_uInt16 nLower; // Distance Text-Contour
61 : sal_uInt32 nPointCount; // Number of polygon points
62 : sal_Bool bSimple : 1; // Just outside edge
63 : sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine);
64 : // FALSE: Objekt flow (StarWriter);
65 : sal_Bool bVertical :1; // for vertical writing mode
66 : sal_Bool bFlag3 :1;
67 : sal_Bool bFlag4 :1;
68 : sal_Bool bFlag5 :1;
69 : sal_Bool bFlag6 :1;
70 : sal_Bool bFlag7 :1;
71 : TextRanger( const TextRanger& ); // not implemented
72 : const Rectangle& _GetBoundRect();
73 : public:
74 : TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon,
75 : const basegfx::B2DPolyPolygon* pLinePolyPolygon,
76 : sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
77 : sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False );
78 : ~TextRanger();
79 : LongDqPtr GetTextRanges( const Range& rRange );
80 5 : sal_uInt16 GetRight() const { return nRight; }
81 5 : sal_uInt16 GetLeft() const { return nLeft; }
82 5 : sal_uInt16 GetUpper() const { return nUpper; }
83 5 : sal_uInt16 GetLower() const { return nLower; }
84 10 : sal_uInt32 GetPointCount() const { return nPointCount; }
85 5 : sal_Bool IsSimple() const { return bSimple; }
86 5 : sal_Bool IsInner() const { return bInner; }
87 45 : sal_Bool IsVertical() const { return bVertical; }
88 : sal_Bool HasBorder() const { return nRight || nLeft; }
89 0 : const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; }
90 : const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; }
91 0 : const Rectangle& GetBoundRect()
92 0 : { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); }
93 5 : void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
94 5 : void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
95 : void SetVertical( sal_Bool bNew );
96 : sal_Bool IsFlag3() const { return bFlag3; }
97 : void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; }
98 : sal_Bool IsFlag4() const { return bFlag4; }
99 : void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; }
100 : sal_Bool IsFlag5() const { return bFlag5; }
101 : void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; }
102 : sal_Bool IsFlag6() const { return bFlag6; }
103 : void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; }
104 : sal_Bool IsFlag7() const { return bFlag7; }
105 : void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; }
106 : };
107 :
108 :
109 :
110 : #endif // _TXTRANGE_HXX
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|