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>
25 #include <tools/poly.hxx>
34 class EDITENG_DLLPUBLIC TextRanger
36 //! The RangeCache class is used to cache the result of a single range calculation.
39 Range range
; //!< Range for which we calculated results.
40 std::deque
<tools::Long
> results
; //!< Calculated results for the range.
41 RangeCacheItem(const Range
& rng
) : range(rng
) {};
43 std::deque
<RangeCacheItem
> mRangeCache
; //!< Cached range calculations.
44 tools::PolyPolygon maPolyPolygon
; // Surface polygon
45 std::unique_ptr
<tools::PolyPolygon
> mpLinePolyPolygon
; // Line polygon
46 mutable std::optional
<tools::Rectangle
> mxBound
; // Comprehensive rectangle
47 sal_uInt16 nCacheSize
; // Cache-Size
48 sal_uInt16 nRight
; // Distance Contour-Text
49 sal_uInt16 nLeft
; // Distance Text-Contour
50 sal_uInt16 nUpper
; // Distance Contour-Text
51 sal_uInt16 nLower
; // Distance Text-Contour
52 sal_uInt32 nPointCount
; // Number of polygon points
53 bool bSimple
: 1; // Just outside edge
54 bool bInner
: 1; // TRUE: Object inline (EditEngine);
55 // FALSE: Object flow (StarWriter);
56 bool bVertical
:1;// for vertical writing mode
58 TextRanger( const TextRanger
& ) = delete;
59 const tools::Rectangle
& GetBoundRect_() const;
61 TextRanger( const basegfx::B2DPolyPolygon
& rPolyPolygon
,
62 const basegfx::B2DPolyPolygon
* pLinePolyPolygon
,
63 sal_uInt16 nCacheSize
, sal_uInt16 nLeft
, sal_uInt16 nRight
,
64 bool bSimple
, bool bInner
, bool bVert
= false );
66 std::deque
<tools::Long
>* GetTextRanges( const Range
& rRange
);
67 sal_uInt16
GetRight() const { return nRight
; }
68 sal_uInt16
GetLeft() const { return nLeft
; }
69 sal_uInt16
GetUpper() const { return nUpper
; }
70 sal_uInt16
GetLower() const { return nLower
; }
71 sal_uInt32
GetPointCount() const { return nPointCount
; }
72 bool IsSimple() const { return bSimple
; }
73 bool IsInner() const { return bInner
; }
74 bool IsVertical() const { return bVertical
; }
75 const tools::Rectangle
& GetBoundRect() const
76 { return mxBound
? const_cast< const tools::Rectangle
& >(*mxBound
) : GetBoundRect_(); }
77 void SetUpper( sal_uInt16 nNew
){ nUpper
= nNew
; }
78 void SetLower( sal_uInt16 nNew
){ nLower
= nNew
; }
79 void SetVertical( bool bNew
);
82 #endif // _TXTRANGE_HXX
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */