1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_EDITENG_TXTRANGE_HXX
21 #define INCLUDED_EDITENG_TXTRANGE_HXX
23 #include <editeng/editengdllapi.h>
24 #include <tools/gen.hxx>
27 namespace tools
{ class PolyPolygon
; }
34 typedef std::deque
<long>* LongDqPtr
;
36 class EDITENG_DLLPUBLIC TextRanger
38 //! The RangeCache class is used to cache the result of a single range calculation.
41 Range range
; //!< Range for which we calculated results.
42 std::deque
<long> results
; //!< Calculated results for the range.
43 RangeCache(const Range
& rng
) : range(rng
) {};
45 std::deque
<RangeCache
> mRangeCache
; //!< Cached range calculations.
46 tools::PolyPolygon
*mpPolyPolygon
; // Surface polygon
47 tools::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
60 TextRanger( const TextRanger
& ) SAL_DELETED_FUNCTION
;
61 const Rectangle
& _GetBoundRect();
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 );
68 LongDqPtr
GetTextRanges( const Range
& rRange
);
69 sal_uInt16
GetRight() const { return nRight
; }
70 sal_uInt16
GetLeft() const { return nLeft
; }
71 sal_uInt16
GetUpper() const { return nUpper
; }
72 sal_uInt16
GetLower() const { return nLower
; }
73 sal_uInt32
GetPointCount() const { return nPointCount
; }
74 bool IsSimple() const { return bSimple
; }
75 bool IsInner() const { return bInner
; }
76 bool IsVertical() const { return bVertical
; }
77 bool HasBorder() const { return nRight
|| nLeft
; }
78 const tools::PolyPolygon
& GetPolyPolygon() const { return *mpPolyPolygon
; }
79 const tools::PolyPolygon
* GetLinePolygon() const { return mpLinePolyPolygon
; }
80 const Rectangle
& GetBoundRect()
81 { return pBound
? static_cast< const Rectangle
& >(*pBound
) : _GetBoundRect(); }
82 void SetUpper( sal_uInt16 nNew
){ nUpper
= nNew
; }
83 void SetLower( sal_uInt16 nNew
){ nLower
= nNew
; }
84 void SetVertical( bool bNew
);
87 #endif // _TXTRANGE_HXX
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */