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