1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pordrop.hxx,v $
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 ************************************************************************/
37 // DropCap-Cache, globale Variable, in txtinit.cxx initialisiert/zerstoert
38 // und in txtdrop.cxx benutzt bei der Initialenberechnung
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
;
58 SwDropPortionPart( SwFont
& rFont
, const xub_StrLen nL
)
59 : pFollow( 0 ), pFnt( &rFont
), nLen( nL
), nWidth( 0 ) {};
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 /*************************************************************************
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
86 sal_Bool
FormatTxt( SwTxtFormatInfo
&rInf
);
87 void PaintTxt( const SwTxtPaintInfo
&rInf
) const;
89 inline void Fix( const KSHORT nNew
) { nFix
= nNew
; }
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();