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