1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _PORDROP_HXX 28 #define _PORDROP_HXX 29 30 #include "portxt.hxx" 31 32 class SwFont; 33 34 // DropCap-Cache, globale Variable, in txtinit.cxx initialisiert/zerstoert 35 // und in txtdrop.cxx benutzt bei der Initialenberechnung 36 37 class SwDropCapCache; 38 extern SwDropCapCache *pDropCapCache; 39 40 /************************************************************************* 41 * class SwDropPortionPart 42 * 43 * A drop portion can consist of one or more parts in order to allow 44 * attribute changes inside them. 45 *************************************************************************/ 46 47 class SwDropPortionPart 48 { 49 SwDropPortionPart* pFollow; 50 SwFont* pFnt; 51 xub_StrLen nLen; 52 sal_uInt16 nWidth; 53 54 public: 55 SwDropPortionPart( SwFont& rFont, const xub_StrLen nL ) 56 : pFollow( 0 ), pFnt( &rFont ), nLen( nL ), nWidth( 0 ) {}; 57 ~SwDropPortionPart(); 58 59 inline SwDropPortionPart* GetFollow() const { return pFollow; }; 60 inline void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; }; 61 inline SwFont& GetFont() const { return *pFnt; } 62 inline xub_StrLen GetLen() const { return nLen; } 63 inline sal_uInt16 GetWidth() const { return nWidth; } 64 inline void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } 65 }; 66 67 /************************************************************************* 68 * class SwDropPortion 69 *************************************************************************/ 70 71 class SwDropPortion : public SwTxtPortion 72 { 73 friend class SwDropCapCache; 74 SwDropPortionPart* pPart; // due to script / attribute changes 75 MSHORT nLines; // Anzahl der Zeilen 76 KSHORT nDropHeight; // Hoehe 77 KSHORT nDropDescent; // Abstand zur naechsten Zeile 78 KSHORT nDistance; // Abstand zum Text 79 KSHORT nFix; // Fixposition 80 short nX; // X-PaintOffset 81 short nY; // Y-Offset 82 83 sal_Bool FormatTxt( SwTxtFormatInfo &rInf ); 84 void PaintTxt( const SwTxtPaintInfo &rInf ) const; 85 86 inline void Fix( const KSHORT nNew ) { nFix = nNew; } 87 public: 88 SwDropPortion( const MSHORT nLineCnt, 89 const KSHORT nDropHeight, 90 const KSHORT nDropDescent, 91 const KSHORT nDistance ); 92 virtual ~SwDropPortion(); 93 94 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 95 void PaintDrop( const SwTxtPaintInfo &rInf ) const; 96 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 97 virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; 98 virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const; 99 100 inline MSHORT GetLines() const { return nLines; } 101 inline KSHORT GetDistance() const { return nDistance; } 102 inline KSHORT GetDropHeight() const { return nDropHeight; } 103 inline KSHORT GetDropDescent() const { return nDropDescent; } 104 inline KSHORT GetDropLeft() const { return Width() + nFix; } 105 106 inline SwDropPortionPart* GetPart() const { return pPart; } 107 inline void SetPart( SwDropPortionPart* pNew ) { pPart = pNew; } 108 109 inline void SetY( short nNew ) { nY = nNew; } 110 111 inline SwFont* GetFnt() const { return pPart ? &pPart->GetFont() : NULL; } 112 113 static void DeleteDropCapCache(); 114 115 OUTPUT_OPERATOR 116 }; 117 118 119 #endif 120