xref: /aoo42x/main/sw/source/core/text/portxt.hxx (revision 69a74367)
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 #ifndef _PORTXT_HXX
24 #define _PORTXT_HXX
25 
26 #include <tools/mempool.hxx>
27 
28 #include "porlin.hxx"
29 
30 class SwTxtGuess;
31 
32 /*************************************************************************
33  *						class SwTxtPortion
34  *************************************************************************/
35 
36 class SwTxtPortion : public SwLinePortion
37 {
38 	void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
39 	void BreakUnderflow( SwTxtFormatInfo &rInf );
40 	sal_Bool _Format( SwTxtFormatInfo &rInf );
41 
42 public:
SwTxtPortion()43 	inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
44 	SwTxtPortion( const SwLinePortion &rPortion );
45 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
46 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
47 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
48 	virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
49 	virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
50 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
51     virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
52 
53 	// zaehlt die Spaces fuer Blocksatz
54 	xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const;
55 
56 	sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
57 
58     // Accessibility: pass information about this portion to the PortionHandler
59     virtual void HandlePortion( SwPortionHandler& rPH ) const;
60 
61 	OUTPUT_OPERATOR
62 	DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
63 };
64 
65 
66 class SwTxtInputFldPortion : public SwTxtPortion
67 {
68 public:
69     SwTxtInputFldPortion();
70 
71     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
72     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
73     virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
74     virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
75     virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
76 
77 private:
78     bool mbContainsInputFieldStart;
79     bool mbContainsInputFieldEnd;
80     bool ContainsOnlyDummyChars() const;
81 };
82 
83 /*************************************************************************
84  *						class SwHolePortion
85  *************************************************************************/
86 
87 class SwHolePortion : public SwLinePortion
88 {
89 	KSHORT nBlankWidth;
90 public:
91 			SwHolePortion( const SwTxtPortion &rPor );
GetBlankWidth() const92 	inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
SetBlankWidth(const KSHORT nNew)93 	inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
94 	virtual SwLinePortion *Compress();
95 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
96 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
97 
98     // Accessibility: pass information about this portion to the PortionHandler
99     virtual void HandlePortion( SwPortionHandler& rPH ) const;
100 
101 	OUTPUT_OPERATOR
102 	DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
103 };
104 
105 class SwFieldMarkPortion : public SwTxtPortion
106 {
107     public:
SwFieldMarkPortion()108         inline SwFieldMarkPortion() : SwTxtPortion()
109             { }
110         virtual void Paint( const SwTxtPaintInfo &rInf ) const;
111         virtual sal_Bool Format( SwTxtFormatInfo &rInf );
112 };
113 
114 class SwFieldFormPortion : public SwTxtPortion
115 {
116     public:
SwFieldFormPortion()117         inline SwFieldFormPortion() : SwTxtPortion()
118             { }
119     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
120     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
121 };
122 
123 
124 CLASSIO( SwTxtPortion )
125 CLASSIO( SwHolePortion )
126 
127 #endif
128