LibreOffice Module vcl (master) 1
textlayout.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_VCL_INC_TEXTLAYOUT_HXX
21#define INCLUDED_VCL_INC_TEXTLAYOUT_HXX
22
23#include <memory>
24
25class Control;
26
27namespace vcl
28{
30 {
31 public:
32 virtual tools::Long GetTextWidth( const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
33 virtual void DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength,
34 std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText ) = 0;
35 virtual void GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
36 virtual sal_Int32 GetTextBreak( const OUString& _rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
37 virtual bool DecomposeTextRectAction() const = 0;
38
39 protected:
40 ~ITextLayout() COVERITY_NOEXCEPT_FALSE {}
41 };
42
46 class DefaultTextLayout final : public ITextLayout
47 {
48 public:
50 : m_rTargetDevice( _rTargetDevice )
51 {
52 }
53 virtual ~DefaultTextLayout();
54
55 // ITextLayout overridables
56 virtual tools::Long GetTextWidth( const OUString& _rText,
57 sal_Int32 _nStartIndex,
58 sal_Int32 _nLength ) const override;
59
60 virtual void DrawText( const Point& _rStartPoint,
61 const OUString& _rText,
62 sal_Int32 _nStartIndex,
63 sal_Int32 _nLength,
64 std::vector< tools::Rectangle >* _pVector,
65 OUString* _pDisplayText ) override;
66
67 virtual void GetCaretPositions( const OUString& _rText,
68 sal_Int32* _pCaretXArray,
69 sal_Int32 _nStartIndex,
70 sal_Int32 _nLength ) const override;
71
72 virtual sal_Int32 GetTextBreak( const OUString& _rText,
73 tools::Long _nMaxTextWidth,
74 sal_Int32 _nStartIndex,
75 sal_Int32 _nLength ) const override;
76
77 virtual bool DecomposeTextRectAction() const override;
78
79 private:
81 };
82
88 {
89 public:
90 ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice );
92
94 const OUString& _rText, DrawTextFlags _nStyle,
95 std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
96
98 const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );
99
100 private:
103
104 private:
105 ::std::unique_ptr< ReferenceDeviceTextLayout > m_pImpl;
106 };
107
108} // namespace vcl
109
110#endif // INCLUDED_VCL_INC_TEXTLAYOUT_HXX
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawTextFlags
Definition: ctrl.hxx:82
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
a class which allows rendering text of a Control onto a device, by taking into account the metrics of...
Definition: textlayout.hxx:88
::std::unique_ptr< ReferenceDeviceTextLayout > m_pImpl
Definition: textlayout.hxx:105
tools::Rectangle DrawText(const tools::Rectangle &_rRect, const OUString &_rText, DrawTextFlags _nStyle, std::vector< tools::Rectangle > *_pVector, OUString *_pDisplayText, const Size *i_pDeviceSize)
Definition: textlayout.cxx:335
tools::Rectangle GetTextRect(const tools::Rectangle &_rRect, const OUString &_rText, DrawTextFlags _nStyle, Size *o_pDeviceSize)
Definition: textlayout.cxx:341
ControlTextRenderer(const Control &_rControl, OutputDevice &_rTargetDevice, OutputDevice &_rReferenceDevice)
Definition: textlayout.cxx:326
ControlTextRenderer & operator=(const ControlTextRenderer &)=delete
ControlTextRenderer(const ControlTextRenderer &)=delete
is an implementation of the ITextLayout interface which simply delegates its calls to the respective ...
Definition: textlayout.hxx:47
DefaultTextLayout(OutputDevice &_rTargetDevice)
Definition: textlayout.hxx:49
virtual void DrawText(const Point &_rStartPoint, const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, std::vector< tools::Rectangle > *_pVector, OUString *_pDisplayText) override
Definition: textlayout.cxx:48
virtual ~DefaultTextLayout()
Definition: textlayout.cxx:39
virtual bool DecomposeTextRectAction() const override
Definition: textlayout.cxx:65
virtual tools::Long GetTextWidth(const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:43
virtual sal_Int32 GetTextBreak(const OUString &_rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:60
virtual void GetCaretPositions(const OUString &_rText, sal_Int32 *_pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:54
OutputDevice & m_rTargetDevice
Definition: textlayout.hxx:80
virtual bool DecomposeTextRectAction() const =0
virtual void DrawText(const Point &_rStartPoint, const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, std::vector< tools::Rectangle > *_pVector, OUString *_pDisplayText)=0
virtual tools::Long GetTextWidth(const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength) const =0
~ITextLayout() COVERITY_NOEXCEPT_FALSE
Definition: textlayout.hxx:40
virtual sal_Int32 GetTextBreak(const OUString &_rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength) const =0
virtual void GetCaretPositions(const OUString &_rText, sal_Int32 *_pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength) const =0
long Long
#define SAL_NO_VTABLE