LCOV - code coverage report
Current view: top level - vcl/inc - textlayout.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include <rtl/ustring.hxx>
      25             : #include <vcl/outdev.hxx>
      26             : 
      27             : class Control;
      28             : 
      29             : namespace vcl
      30             : {
      31       22626 :     class SAL_NO_VTABLE ITextLayout
      32             :     {
      33             :     public:
      34             :         virtual long        GetTextWidth( const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
      35             :         virtual void        DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength,
      36             :                                 MetricVector* _pVector, OUString* _pDisplayText ) = 0;
      37             :         virtual bool        GetCaretPositions( const OUString& _rText, long* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
      38             :         virtual sal_Int32   GetTextBreak( const OUString& _rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
      39             :         virtual bool        DecomposeTextRectAction() const = 0;
      40             : 
      41             :     protected:
      42       22626 :         ~ITextLayout() {}
      43             :     };
      44             : 
      45             :     /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective
      46             :         methods of an OutputDevice instance, without any inbetween magic.
      47             :     */
      48             :     class DefaultTextLayout : public ITextLayout
      49             :     {
      50             :     public:
      51       22170 :         DefaultTextLayout( OutputDevice& _rTargetDevice )
      52       22170 :             : m_rTargetDevice( _rTargetDevice )
      53             :         {
      54       22170 :         }
      55             :         virtual ~DefaultTextLayout();
      56             : 
      57             :         // ITextLayout overridables
      58             :         virtual long        GetTextWidth( const OUString& _rText,
      59             :                                           sal_Int32 _nStartIndex,
      60             :                                           sal_Int32 _nLength ) const SAL_OVERRIDE;
      61             : 
      62             :         virtual void        DrawText( const Point& _rStartPoint,
      63             :                                       const OUString& _rText,
      64             :                                       sal_Int32 _nStartIndex,
      65             :                                       sal_Int32 _nLength,
      66             :                                       MetricVector* _pVector,
      67             :                                       OUString* _pDisplayText ) SAL_OVERRIDE;
      68             : 
      69             :         virtual bool        GetCaretPositions( const OUString& _rText,
      70             :                                                long* _pCaretXArray,
      71             :                                                sal_Int32 _nStartIndex,
      72             :                                                sal_Int32 _nLength ) const SAL_OVERRIDE;
      73             : 
      74             :         virtual sal_Int32   GetTextBreak( const OUString& _rText,
      75             :                                           long _nMaxTextWidth,
      76             :                                           sal_Int32 _nStartIndex,
      77             :                                           sal_Int32 _nLength ) const SAL_OVERRIDE;
      78             : 
      79             :         virtual bool        DecomposeTextRectAction() const SAL_OVERRIDE;
      80             : 
      81             :     private:
      82             :         OutputDevice&   m_rTargetDevice;
      83             :     };
      84             : 
      85             :     class ReferenceDeviceTextLayout;
      86             :     /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of
      87             :         a reference device.
      88             :     */
      89             :     class ControlTextRenderer
      90             :     {
      91             :     public:
      92             :         ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice );
      93             :         virtual ~ControlTextRenderer();
      94             : 
      95             :         Rectangle   DrawText( const Rectangle& _rRect,
      96             :                               const OUString& _rText, DrawTextFlags _nStyle = DrawTextFlags::NONE,
      97             :                               MetricVector* _pVector = NULL, OUString* _pDisplayText = NULL );
      98             : 
      99             :     private:
     100             :         ControlTextRenderer( const ControlTextRenderer& ) SAL_DELETED_FUNCTION;
     101             :         ControlTextRenderer& operator=( const ControlTextRenderer& ) SAL_DELETED_FUNCTION;
     102             : 
     103             :     private:
     104             :         ::std::unique_ptr< ReferenceDeviceTextLayout >   m_pImpl;
     105             :     };
     106             : 
     107             : } // namespace vcl
     108             : 
     109             : #endif // INCLUDED_VCL_INC_TEXTLAYOUT_HXX
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11