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