LCOV - code coverage report
Current view: top level - sw/source/core/text - pordrop.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 17 22 77.3 %
Date: 2015-06-13 12:38:46 Functions: 16 21 76.2 %
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             : #ifndef INCLUDED_SW_SOURCE_CORE_TEXT_PORDROP_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORDROP_HXX
      21             : 
      22             : #include "portxt.hxx"
      23             : 
      24             : class SwFont;
      25             : 
      26             : // DropCap cache, global variable initialized/destroyed in txtinit.cxx
      27             : // and used in txtdrop.cxx for initial calculation
      28             : 
      29             : class SwDropCapCache;
      30             : extern SwDropCapCache *pDropCapCache;
      31             : 
      32             : // A drop portion can consist of one or more parts in order to allow
      33             : // attribute changes inside them.
      34             : class SwDropPortionPart
      35             : {
      36             :     SwDropPortionPart* pFollow;
      37             :     SwFont* pFnt;
      38             :     sal_Int32 nLen;
      39             :     sal_uInt16 nWidth;
      40             :     bool m_bJoinBorderWithNext;
      41             :     bool m_bJoinBorderWithPrev;
      42             : 
      43             : public:
      44           6 :     SwDropPortionPart( SwFont& rFont, const sal_Int32 nL )
      45           6 :             : pFollow( 0 ), pFnt( &rFont ), nLen( nL ), nWidth( 0 ), m_bJoinBorderWithNext(false), m_bJoinBorderWithPrev(false) {};
      46             :     ~SwDropPortionPart();
      47             : 
      48          45 :     inline SwDropPortionPart* GetFollow() const { return pFollow; };
      49           0 :     inline void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; };
      50          39 :     inline SwFont& GetFont() const { return *pFnt; }
      51          42 :     inline sal_Int32 GetLen() const { return nLen; }
      52           0 :     inline sal_uInt16 GetWidth() const { return nWidth; }
      53           6 :     inline void SetWidth( sal_uInt16 nNew )  { nWidth = nNew; }
      54             : 
      55           6 :     bool GetJoinBorderWithPrev() const { return m_bJoinBorderWithPrev; }
      56           6 :     bool GetJoinBorderWithNext() const { return m_bJoinBorderWithNext; }
      57           0 :     void SetJoinBorderWithPrev( const bool bJoinPrev ) { m_bJoinBorderWithPrev = bJoinPrev; }
      58           0 :     void SetJoinBorderWithNext( const bool bJoinNext ) { m_bJoinBorderWithNext = bJoinNext; }
      59             : };
      60             : 
      61             : class SwDropPortion : public SwTextPortion
      62             : {
      63             :     friend class SwDropCapCache;
      64             :     SwDropPortionPart* pPart; // due to script/attribute changes
      65             :     sal_uInt16 nLines;          // Line count
      66             :     sal_uInt16 nDropHeight;     // Height
      67             :     sal_uInt16 nDropDescent;    // Distance to the next line
      68             :     sal_uInt16 nDistance;       // Distance to the text
      69             :     sal_uInt16 nFix;            // Fixed position
      70             :     short nX;               // X PaintOffset
      71             :     short nY;               // Y Offset
      72             : 
      73             :     bool FormatText( SwTextFormatInfo &rInf );
      74             :     void PaintText( const SwTextPaintInfo &rInf ) const;
      75             : 
      76          12 :     inline void Fix( const sal_uInt16 nNew ) { nFix = nNew; }
      77             : public:
      78             :     SwDropPortion( const sal_uInt16 nLineCnt,
      79             :                    const sal_uInt16 nDropHeight,
      80             :                    const sal_uInt16 nDropDescent,
      81             :                    const sal_uInt16 nDistance );
      82             :     virtual ~SwDropPortion();
      83             : 
      84             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      85             :             void PaintDrop( const SwTextPaintInfo &rInf ) const;
      86             :     virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
      87             :     virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const SAL_OVERRIDE;
      88             :     virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
      89             : 
      90         102 :     inline sal_uInt16 GetLines() const { return nLines; }
      91          24 :     inline sal_uInt16 GetDistance() const { return nDistance; }
      92         148 :     inline sal_uInt16 GetDropHeight() const { return nDropHeight; }
      93         142 :     inline sal_uInt16 GetDropDescent() const { return nDropDescent; }
      94          78 :     inline sal_uInt16 GetDropLeft() const { return Width() + nFix; }
      95             : 
      96          30 :     inline SwDropPortionPart* GetPart() const { return pPart; }
      97           6 :     inline void SetPart( SwDropPortionPart* pNew ) { pPart = pNew; }
      98             : 
      99           6 :     inline void SetY( short nNew )  { nY = nNew; }
     100             : 
     101           0 :     inline SwFont* GetFnt() const { return pPart ? &pPart->GetFont() : NULL; }
     102             : 
     103             :     static void DeleteDropCapCache();
     104             : 
     105             :     OUTPUT_OPERATOR_OVERRIDE
     106             : };
     107             : 
     108             : #endif
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11