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 tools::Long GetTextArray( const OUString& _rText, KernArray* _pDXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength, bool bCaret = false ) 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 tools::Long GetTextArray( const OUString& _rText,
68 KernArray* _pDXArray,
69 sal_Int32 _nStartIndex,
70 sal_Int32 _nLength,
71 bool bCaret = false ) const override;
72
73 virtual sal_Int32 GetTextBreak( const OUString& _rText,
74 tools::Long _nMaxTextWidth,
75 sal_Int32 _nStartIndex,
76 sal_Int32 _nLength ) const override;
77
78 virtual bool DecomposeTextRectAction() const override;
79
80 private:
82 };
83
89 {
90 public:
91 ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice );
93
95 const OUString& _rText, DrawTextFlags _nStyle,
96 std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
97
99 const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );
100
101 private:
104
105 private:
106 ::std::unique_ptr< ReferenceDeviceTextLayout > m_pImpl;
107 };
108
109} // namespace vcl
110
111#endif // INCLUDED_VCL_INC_TEXTLAYOUT_HXX
112
113/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawTextFlags
Definition: ctrl.hxx:80
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
a class which allows rendering text of a Control onto a device, by taking into account the metrics of...
Definition: textlayout.hxx:89
::std::unique_ptr< ReferenceDeviceTextLayout > m_pImpl
Definition: textlayout.hxx:106
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:325
tools::Rectangle GetTextRect(const tools::Rectangle &_rRect, const OUString &_rText, DrawTextFlags _nStyle, Size *o_pDeviceSize)
Definition: textlayout.cxx:331
ControlTextRenderer(const Control &_rControl, OutputDevice &_rTargetDevice, OutputDevice &_rReferenceDevice)
Definition: textlayout.cxx:316
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 tools::Long GetTextArray(const OUString &_rText, KernArray *_pDXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength, bool bCaret=false) const override
Definition: textlayout.cxx:55
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:49
virtual ~DefaultTextLayout()
Definition: textlayout.cxx:40
virtual bool DecomposeTextRectAction() const override
Definition: textlayout.cxx:66
virtual tools::Long GetTextWidth(const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:44
virtual sal_Int32 GetTextBreak(const OUString &_rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:61
OutputDevice & m_rTargetDevice
Definition: textlayout.hxx:81
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
virtual tools::Long GetTextArray(const OUString &_rText, KernArray *_pDXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength, bool bCaret=false) 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
long Long
#define SAL_NO_VTABLE