xref: /AOO41X/main/sw/source/core/text/porexp.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 
28 #ifndef _POREXP_HXX
29 #define _POREXP_HXX
30 
31 #include "portxt.hxx"
32 
33 /*************************************************************************
34  *                      class SwExpandPortion
35  *************************************************************************/
36 
37 class SwExpandPortion : public SwTxtPortion
38 {
39 public:
40 	inline	SwExpandPortion() { SetWhichPor( POR_EXP ); }
41 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
42 	virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
43 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
44 	virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
45 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
46 
47     // Accessibility: pass information about this portion to the PortionHandler
48     virtual void HandlePortion( SwPortionHandler& rPH ) const;
49 
50 	OUTPUT_OPERATOR
51 };
52 
53 
54 /*************************************************************************
55  *						class SwBlankPortion
56  *************************************************************************/
57 
58 class SwBlankPortion : public SwExpandPortion
59 {
60 	xub_Unicode cChar;
61 	sal_Bool bMulti;		// For multiportion brackets
62 public:
63 	inline	SwBlankPortion( xub_Unicode cCh, sal_Bool bMult = sal_False )
64 		: cChar( cCh ), bMulti( bMult )
65 		{ cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); }
66 
67 	sal_Bool IsMulti() const { return bMulti; }
68 	void SetMulti( sal_Bool bNew ) { bMulti = bNew; }
69 
70 	virtual SwLinePortion *Compress();
71 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
72 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
73 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
74 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
75 	MSHORT MayUnderFlow( const SwTxtFormatInfo &rInf, xub_StrLen nIdx,
76 		sal_Bool bUnderFlow ) const;
77 
78     // Accessibility: pass information about this portion to the PortionHandler
79     virtual void HandlePortion( SwPortionHandler& rPH ) const;
80 
81 	OUTPUT_OPERATOR
82 };
83 
84 /*************************************************************************
85  *                      class SwPostItsPortion
86  *************************************************************************/
87 
88 class SwPostItsPortion : public SwExpandPortion
89 {
90 	KSHORT	nViewWidth;
91 	sal_Bool	bScript;
92 public:
93 			SwPostItsPortion( sal_Bool bScrpt );
94 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
95 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
96 	virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
97 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
98 	sal_Bool IsScript() const { return bScript; }
99 	OUTPUT_OPERATOR
100 };
101 
102 
103 CLASSIO( SwExpandPortion )
104 CLASSIO( SwBlankPortion )
105 CLASSIO( SwPostItsPortion )
106 
107 
108 #endif
109