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 
25 class Control;
26 
27 namespace vcl
28 {
30  {
31  public:
32  virtual 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  MetricVector* _pVector, OUString* _pDisplayText ) = 0;
35  virtual void GetCaretPositions( const OUString& _rText, long* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
36  virtual sal_Int32 GetTextBreak( const OUString& _rText, 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 
47  {
48  public:
49  DefaultTextLayout( OutputDevice& _rTargetDevice )
50  : m_rTargetDevice( _rTargetDevice )
51  {
52  }
53  virtual ~DefaultTextLayout();
54 
55  // ITextLayout overridables
56  virtual 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  MetricVector* _pVector,
65  OUString* _pDisplayText ) override;
66 
67  virtual void GetCaretPositions( const OUString& _rText,
68  long* _pCaretXArray,
69  sal_Int32 _nStartIndex,
70  sal_Int32 _nLength ) const override;
71 
72  virtual sal_Int32 GetTextBreak( const OUString& _rText,
73  long _nMaxTextWidth,
74  sal_Int32 _nStartIndex,
75  sal_Int32 _nLength ) const override;
76 
77  virtual bool DecomposeTextRectAction() const override;
78 
79  private:
81  };
82 
87  class ControlTextRenderer final
88  {
89  public:
90  ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice );
92 
94  const OUString& _rText, DrawTextFlags _nStyle,
95  MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
96 
98  const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );
99 
100  private:
101  ControlTextRenderer( const ControlTextRenderer& ) = delete;
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: */
virtual bool DecomposeTextRectAction() const override
Definition: textlayout.cxx:65
std::vector< tools::Rectangle > MetricVector
Definition: outdev.hxx:139
::std::unique_ptr< ReferenceDeviceTextLayout > m_pImpl
Definition: textlayout.hxx:105
OutputDevice & m_rTargetDevice
Definition: textlayout.hxx:80
is an implementation of the ITextLayout interface which simply delegates its calls to the respective ...
Definition: textlayout.hxx:46
a class which allows rendering text of a Control onto a device, by taking into account the metrics of...
Definition: textlayout.hxx:87
virtual ~DefaultTextLayout()
Definition: textlayout.cxx:39
virtual sal_Int32 GetTextBreak(const OUString &_rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:60
~ITextLayout() COVERITY_NOEXCEPT_FALSE
Definition: textlayout.hxx:40
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
virtual long GetTextWidth(const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:43
DefaultTextLayout(OutputDevice &_rTargetDevice)
Definition: textlayout.hxx:49
tools::Rectangle GetTextRect(const tools::Rectangle &_rRect, const OUString &_rText, DrawTextFlags _nStyle, Size *o_pDeviceSize)
Definition: textlayout.cxx:345
DrawTextFlags
Definition: outdev.hxx:144
virtual void GetCaretPositions(const OUString &_rText, long *_pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override
Definition: textlayout.cxx:54
Definition: ctrl.hxx:33
virtual void DrawText(const Point &_rStartPoint, const OUString &_rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, MetricVector *_pVector, OUString *_pDisplayText) override
Definition: textlayout.cxx:48
tools::Rectangle DrawText(const tools::Rectangle &_rRect, const OUString &_rText, DrawTextFlags _nStyle, MetricVector *_pVector, OUString *_pDisplayText, const Size *i_pDeviceSize)
Definition: textlayout.cxx:339
ControlTextRenderer & operator=(const ControlTextRenderer &)=delete
#define SAL_NO_VTABLE
ControlTextRenderer(const Control &_rControl, OutputDevice &_rTargetDevice, OutputDevice &_rReferenceDevice)
Definition: textlayout.cxx:330