LCOV - code coverage report
Current view: top level - sw/source/core/text - porfld.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 40 0.0 %
Date: 2014-04-14 Functions: 0 40 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             : #ifndef INCLUDED_SW_SOURCE_CORE_TEXT_PORFLD_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORFLD_HXX
      21             : 
      22             : #include "swtypes.hxx"
      23             : #include "porexp.hxx"
      24             : #include <fmtornt.hxx>
      25             : 
      26             : class SwFont;
      27             : class SvxBrushItem;
      28             : class SwFmtVertOrient;
      29             : class SwFrm;
      30             : 
      31             : /*************************************************************************
      32             :  *                      class SwFldPortion
      33             :  *************************************************************************/
      34             : 
      35             : class SwFldPortion : public SwExpandPortion
      36             : {
      37             :     friend class SwTxtFormatter;
      38             : protected:
      39             :     OUString  aExpand;              // The expanded field
      40             :     SwFont  *pFnt;                  // For multi-line fields
      41             :     sal_Int32 nNextOffset;         // Offset of the follow in the original string
      42             :     sal_Int32 nNextScriptChg;
      43             :     KSHORT  nViewWidth;             // Screen width for empty fields
      44             :     bool bFollow : 1;           // 2nd or later part of a field
      45             :     bool bLeft : 1;             // Used by SwNumberPortion
      46             :     bool bHide : 1;             // Used by SwNumberPortion
      47             :     bool bCenter : 1;           // Used by SwNumberPortion
      48             :     bool bHasFollow : 1;        // Continues on the next line
      49             :     bool bAnimated : 1;         // Used by SwGrfNumPortion
      50             :     bool bNoPaint : 1;          // Used by SwGrfNumPortion
      51             :     bool bReplace : 1;          // Used by SwGrfNumPortion
      52             :     const bool bPlaceHolder : 1;
      53             :     bool m_bNoLength : 1;       // HACK for meta suffix (no CH_TXTATR)
      54             : 
      55           0 :     inline void SetFont( SwFont *pNew ) { pFnt = pNew; }
      56           0 :     inline bool IsNoLength() const  { return m_bNoLength; }
      57           0 :     inline void SetNoLength()       { m_bNoLength = true; }
      58             : 
      59             : public:
      60             :     SwFldPortion( const SwFldPortion& rFld );
      61             :     SwFldPortion( const OUString &rExpand, SwFont *pFnt = 0, bool bPlaceHolder = false );
      62             :     virtual ~SwFldPortion();
      63             : 
      64             :     sal_uInt16 m_nAttrFldType;
      65             :     void TakeNextOffset( const SwFldPortion* pFld );
      66             :     void CheckScript( const SwTxtSizeInfo &rInf );
      67           0 :     inline bool HasFont() const { return 0 != pFnt; }
      68             :     // #i89179# - made public
      69           0 :     inline const SwFont *GetFont() const { return pFnt; }
      70             : 
      71           0 :     inline OUString GetExp() const { return aExpand; }
      72             :     virtual bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const SAL_OVERRIDE;
      73             :     virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
      74             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
      75             : 
      76             :     // Empty fields are also allowed
      77             :     virtual SwLinePortion *Compress() SAL_OVERRIDE;
      78             : 
      79             :     virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const SAL_OVERRIDE;
      80             : 
      81           0 :     inline bool IsFollow() const { return bFollow; }
      82           0 :     inline void SetFollow( bool bNew ) { bFollow = bNew; }
      83             : 
      84           0 :     inline bool IsLeft() const { return bLeft; }
      85           0 :     inline void SetLeft( bool bNew ) { bLeft = bNew; }
      86             : 
      87           0 :     inline bool IsHide() const { return bHide; }
      88           0 :     inline void SetHide( bool bNew ) { bHide = bNew; }
      89             : 
      90           0 :     inline bool IsCenter() const { return bCenter; }
      91           0 :     inline void SetCenter( bool bNew ) { bCenter = bNew; }
      92             : 
      93           0 :     inline bool HasFollow() const { return bHasFollow; }
      94           0 :     inline void SetHasFollow( bool bNew ) { bHasFollow = bNew; }
      95             : 
      96           0 :     inline sal_Int32 GetNextOffset() const { return nNextOffset; }
      97           0 :     inline void SetNextOffset( sal_Int32 nNew ) { nNextOffset = nNew; }
      98             : 
      99           0 :     inline sal_Int32 GetNextScriptChg() const { return nNextScriptChg; }
     100             :     inline void SetNextScriptChg( sal_Int32 nNew ) { nNextScriptChg = nNew; }
     101             : 
     102             :     // Field cloner for SplitGlue
     103             :     virtual SwFldPortion *Clone( const OUString &rExpand ) const;
     104             : 
     105             :     // Extra GetTxtSize because of pFnt
     106             :     virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const SAL_OVERRIDE;
     107             : 
     108             :     // Accessibility: pass information about this portion to the PortionHandler
     109             :     virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
     110             : 
     111             :     OUTPUT_OPERATOR_OVERRIDE
     112             : };
     113             : 
     114             : /*************************************************************************
     115             :  *                      class SwHiddenPortion
     116             :  *************************************************************************/
     117             : // Distinguish only for painting/hide
     118             : 
     119           0 : class SwHiddenPortion : public SwFldPortion
     120             : {
     121             : public:
     122           0 :     inline SwHiddenPortion( const OUString &rExpand, SwFont *pFntL = 0 )
     123           0 :          : SwFldPortion( rExpand, pFntL )
     124           0 :         { SetLen(1); SetWhichPor( POR_HIDDEN ); }
     125             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
     126             :     virtual bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const SAL_OVERRIDE;
     127             : 
     128             :     // Field cloner for SplitGlue
     129             :     virtual SwFldPortion *Clone( const OUString &rExpand ) const SAL_OVERRIDE;
     130             :     OUTPUT_OPERATOR_OVERRIDE
     131             : };
     132             : 
     133             : /*************************************************************************
     134             :  *                      class SwNumberPortion
     135             :  *************************************************************************/
     136             : 
     137           0 : class SwNumberPortion : public SwFldPortion
     138             : {
     139             : protected:
     140             :     KSHORT  nFixWidth;      // See Glues
     141             :     KSHORT  nMinDist;       // Minimal distance to the text
     142             :     bool    mbLabelAlignmentPosAndSpaceModeActive;
     143             : 
     144             : public:
     145             :     SwNumberPortion( const OUString &rExpand,
     146             :                      SwFont *pFnt,
     147             :                      const bool bLeft,
     148             :                      const bool bCenter,
     149             :                      const KSHORT nMinDst,
     150             :                      const bool bLabelAlignmentPosAndSpaceModeActive );
     151             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
     152             :     virtual sal_Int32 GetCrsrOfst( const MSHORT nOfst ) const SAL_OVERRIDE;
     153             :     virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
     154             : 
     155             :     // Field cloner for SplitGlue
     156             :     virtual SwFldPortion *Clone( const OUString &rExpand ) const SAL_OVERRIDE;
     157             :     virtual void FormatEOL( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
     158             : 
     159             :     OUTPUT_OPERATOR_OVERRIDE
     160             : };
     161             : 
     162             : /*************************************************************************
     163             :  *                      class SwBulletPortion
     164             :  *************************************************************************/
     165             : 
     166           0 : class SwBulletPortion : public SwNumberPortion
     167             : {
     168             : public:
     169             :     SwBulletPortion( const sal_Unicode cCh,
     170             :                      const OUString& rBulletFollowedBy,
     171             :                      SwFont *pFnt,
     172             :                      const bool bLeft,
     173             :                      const bool bCenter,
     174             :                      const KSHORT nMinDst,
     175             :                      const bool bLabelAlignmentPosAndSpaceModeActive );
     176             :     OUTPUT_OPERATOR_OVERRIDE
     177             : };
     178             : 
     179             : /*************************************************************************
     180             :  *                      class SwBmpBulletPortion
     181             :  *************************************************************************/
     182             : 
     183             : class SwGrfNumPortion : public SwNumberPortion
     184             : {
     185             :     SvxBrushItem* pBrush;
     186             :     long            nId;    // For StopAnimation
     187             :     SwTwips         nYPos;  // _Always_ contains the current RelPos
     188             :     SwTwips         nGrfHeight;
     189             :     sal_Int16       eOrient;
     190             : public:
     191             :     SwGrfNumPortion( SwFrm *pFrm,
     192             :                      const OUString& rGraphicFollowedBy,
     193             :                      const SvxBrushItem* pGrfBrush,
     194             :                      const SwFmtVertOrient* pGrfOrient,
     195             :                      const Size& rGrfSize,
     196             :                      const bool bLeft,
     197             :                      const bool bCenter,
     198             :                      const KSHORT nMinDst,
     199             :                      const bool bLabelAlignmentPosAndSpaceModeActive );
     200             :     virtual ~SwGrfNumPortion();
     201             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
     202             :     virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
     203             : 
     204             :     void SetBase( long nLnAscent, long nLnDescent,
     205             :         long nFlyAscent, long nFlyDescent );
     206             : 
     207             :     void StopAnimation( OutputDevice* pOut );
     208             : 
     209           0 :     inline bool IsAnimated() const { return bAnimated; }
     210           0 :     inline void SetAnimated( bool bNew ) { bAnimated = bNew; }
     211           0 :     inline bool DontPaint() const { return bNoPaint; }
     212           0 :     inline void SetNoPaint( bool bNew ) { bNoPaint = bNew; }
     213           0 :     inline void SetRelPos( SwTwips nNew ) { nYPos = nNew; }
     214           0 :     inline void SetId( long nNew ) const
     215           0 :         { ((SwGrfNumPortion*)this)->nId = nNew; }
     216           0 :     inline SwTwips GetRelPos() const { return nYPos; }
     217           0 :     inline SwTwips GetGrfHeight() const { return nGrfHeight; }
     218             :     inline SwTwips GetId() const { return nId; }
     219           0 :     inline sal_Int16 GetOrient() const { return eOrient; }
     220             : 
     221             :     OUTPUT_OPERATOR_OVERRIDE
     222             : };
     223             : 
     224             : /*************************************************************************
     225             :  *                      class SwCombinedPortion
     226             :  * Used in for asian layout specialities to display up to six characters
     227             :  * in 2 rows and 2-3 columns.
     228             :  * e.g.
     229             :  *
     230             :  *       A..  A..  A.B  A.B   A.B.C   A.B.C
     231             :  *       ...  ..B  .C.  C.D   .D.E.   D.E.F
     232             :  *************************************************************************/
     233             : 
     234           0 : class SwCombinedPortion : public SwFldPortion
     235             : {
     236             :     sal_uInt16 aPos[6];     // up to six X positions
     237             :     sal_uInt16 aWidth[3];   // one width for every scripttype
     238             :     sal_uInt8 aScrType[6];  // scripttype of every character
     239             :     sal_uInt16 nUpPos;      // the Y position of the upper baseline
     240             :     sal_uInt16 nLowPos;     // the Y position of the lower baseline
     241             :     sal_uInt8 nProportion;  // relative font height
     242             : public:
     243             :     SwCombinedPortion( const OUString &rExpand );
     244             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
     245             :     virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
     246             :     virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const SAL_OVERRIDE;
     247             :     OUTPUT_OPERATOR_OVERRIDE
     248             : };
     249             : 
     250             : namespace sw { namespace mark {
     251             :     class IFieldmark;
     252             : } }
     253             : 
     254           0 : class SwFieldFormDropDownPortion : public SwFldPortion
     255             : {
     256             : public:
     257           0 :     SwFieldFormDropDownPortion(const OUString &rExpand)
     258           0 :         : SwFldPortion(rExpand)
     259             :     {
     260           0 :     }
     261             :     // Field cloner for SplitGlue
     262             :     virtual SwFldPortion *Clone( const OUString &rExpand ) const SAL_OVERRIDE;
     263             : };
     264             : 
     265             : #endif
     266             : 
     267             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10