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