LCOV - code coverage report
Current view: top level - libreoffice/vcl/inc - textlayout.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 5 0.0 %
Date: 2012-12-27 Functions: 0 3 0.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 VCL_TEXTLAYOUT_HXX
      21             : #define VCL_TEXTLAYOUT_HXX
      22             : 
      23             : #include "vcl/outdev.hxx"
      24             : 
      25             : #include <tools/solar.h>
      26             : #include <tools/string.hxx>
      27             : 
      28             : #include <memory>
      29             : 
      30             : class Control;
      31             : 
      32             : //........................................................................
      33             : namespace vcl
      34             : {
      35             : //........................................................................
      36             : 
      37             :     //====================================================================
      38             :     //= ITextLayout
      39             :     //====================================================================
      40           0 :     class SAL_NO_VTABLE ITextLayout
      41             :     {
      42             :     public:
      43             :         virtual long        GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0;
      44             :         virtual void        DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength,
      45             :                                 MetricVector* _pVector, String* _pDisplayText ) = 0;
      46             :         virtual bool        GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0;
      47             :         virtual xub_StrLen  GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0;
      48             :         virtual bool        DecomposeTextRectAction() const = 0;
      49             : 
      50             :     protected:
      51           0 :         ~ITextLayout() {}
      52             :     };
      53             : 
      54             :     //====================================================================
      55             :     //= DefaultTextLayout
      56             :     //====================================================================
      57             :     /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective
      58             :         methods of an OutputDevice instance, without any inbetween magic.
      59             :     */
      60             :     class DefaultTextLayout : public ITextLayout
      61             :     {
      62             :     public:
      63           0 :         DefaultTextLayout( OutputDevice& _rTargetDevice )
      64           0 :             :m_rTargetDevice( _rTargetDevice )
      65             :         {
      66           0 :         }
      67             :         virtual ~DefaultTextLayout();
      68             : 
      69             :         // ITextLayout overridables
      70             :         virtual long        GetTextWidth(
      71             :                                 const XubString& _rText,
      72             :                                 xub_StrLen _nStartIndex,
      73             :                                 xub_StrLen _nLength
      74             :                             ) const;
      75             :         virtual void        DrawText(
      76             :                                 const Point& _rStartPoint,
      77             :                                 const XubString& _rText,
      78             :                                 xub_StrLen _nStartIndex,
      79             :                                 xub_StrLen _nLength,
      80             :                                 MetricVector* _pVector,
      81             :                                 String* _pDisplayText
      82             :                             );
      83             :         virtual bool        GetCaretPositions(
      84             :                                 const XubString& _rText,
      85             :                                 sal_Int32* _pCaretXArray,
      86             :                                 xub_StrLen _nStartIndex,
      87             :                                 xub_StrLen _nLength
      88             :                             ) const;
      89             :         virtual xub_StrLen  GetTextBreak(
      90             :                                 const XubString& _rText,
      91             :                                 long _nMaxTextWidth,
      92             :                                 xub_StrLen _nStartIndex,
      93             :                                 xub_StrLen _nLength
      94             :                             ) const;
      95             :         virtual bool        DecomposeTextRectAction() const;
      96             : 
      97             :     private:
      98             :         OutputDevice&   m_rTargetDevice;
      99             :     };
     100             : 
     101             :     //====================================================================
     102             :     //= ControlTextRenderer
     103             :     //====================================================================
     104             :     class ReferenceDeviceTextLayout;
     105             :     /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of
     106             :         a reference device.
     107             :     */
     108             :     class ControlTextRenderer
     109             :     {
     110             :     public:
     111             :         ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice );
     112             :         virtual ~ControlTextRenderer();
     113             : 
     114             :         Rectangle   DrawText( const Rectangle& _rRect,
     115             :                               const XubString& _rText, sal_uInt16 _nStyle = 0,
     116             :                               MetricVector* _pVector = NULL, String* _pDisplayText = NULL );
     117             : 
     118             :     private:
     119             :         ControlTextRenderer();                                                  // never implemented
     120             :         ControlTextRenderer( const ControlTextRenderer& );              // never implemented
     121             :         ControlTextRenderer& operator=( const ControlTextRenderer& );   // never implemented
     122             : 
     123             :     private:
     124             :         ::std::auto_ptr< ReferenceDeviceTextLayout >   m_pImpl;
     125             :     };
     126             : 
     127             : //........................................................................
     128             : } // namespace vcl
     129             : //........................................................................
     130             : 
     131             : #endif // VCL_TEXTLAYOUT_HXX
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10