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