xref: /aoo41x/main/sw/source/core/text/porexp.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _POREXP_HXX
25 #define _POREXP_HXX
26 
27 #include "portxt.hxx"
28 
29 /*************************************************************************
30  *                      class SwExpandPortion
31  *************************************************************************/
32 
33 class SwExpandPortion : public SwTxtPortion
34 {
35 public:
SwExpandPortion()36 	inline	SwExpandPortion() { SetWhichPor( POR_EXP ); }
37 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
38 	virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
39 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
40 	virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
41 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
42 
43     // Accessibility: pass information about this portion to the PortionHandler
44     virtual void HandlePortion( SwPortionHandler& rPH ) const;
45 
46 	OUTPUT_OPERATOR
47 };
48 
49 
50 /*************************************************************************
51  *						class SwBlankPortion
52  *************************************************************************/
53 
54 class SwBlankPortion : public SwExpandPortion
55 {
56 	xub_Unicode cChar;
57 	sal_Bool bMulti;		// For multiportion brackets
58 public:
SwBlankPortion(xub_Unicode cCh,sal_Bool bMult=sal_False)59 	inline	SwBlankPortion( xub_Unicode cCh, sal_Bool bMult = sal_False )
60 		: cChar( cCh ), bMulti( bMult )
61 		{ cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); }
62 
IsMulti() const63 	sal_Bool IsMulti() const { return bMulti; }
SetMulti(sal_Bool bNew)64 	void SetMulti( sal_Bool bNew ) { bMulti = bNew; }
65 
66 	virtual SwLinePortion *Compress();
67 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
68 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
69 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
70 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
71 	MSHORT MayUnderFlow( const SwTxtFormatInfo &rInf, xub_StrLen nIdx,
72 		sal_Bool bUnderFlow ) const;
73 
74     // Accessibility: pass information about this portion to the PortionHandler
75     virtual void HandlePortion( SwPortionHandler& rPH ) const;
76 
77 	OUTPUT_OPERATOR
78 };
79 
80 /*************************************************************************
81  *                      class SwPostItsPortion
82  *************************************************************************/
83 
84 class SwPostItsPortion : public SwExpandPortion
85 {
86 	KSHORT	nViewWidth;
87 	sal_Bool	bScript;
88 public:
89 			SwPostItsPortion( sal_Bool bScrpt );
90 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
91 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
92 	virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
93 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
IsScript() const94 	sal_Bool IsScript() const { return bScript; }
95 	OUTPUT_OPERATOR
96 };
97 
98 
99 CLASSIO( SwExpandPortion )
100 CLASSIO( SwBlankPortion )
101 CLASSIO( SwPostItsPortion )
102 
103 
104 #endif
105