xref: /AOO41X/main/sw/source/core/text/portxt.hxx (revision 69a743679e823ad8f875be547552acb607b8ada5)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _PORTXT_HXX
24cdf0e10cSrcweir #define _PORTXT_HXX
2598847fa6SHerbert Dürr 
26cdf0e10cSrcweir #include <tools/mempool.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "porlin.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class SwTxtGuess;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /*************************************************************************
33cdf0e10cSrcweir  *						class SwTxtPortion
34cdf0e10cSrcweir  *************************************************************************/
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class SwTxtPortion : public SwLinePortion
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
39cdf0e10cSrcweir 	void BreakUnderflow( SwTxtFormatInfo &rInf );
40cdf0e10cSrcweir 	sal_Bool _Format( SwTxtFormatInfo &rInf );
41cdf0e10cSrcweir 
42cdf0e10cSrcweir public:
SwTxtPortion()43cdf0e10cSrcweir 	inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
44cdf0e10cSrcweir 	SwTxtPortion( const SwLinePortion &rPortion );
45cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
46cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
47cdf0e10cSrcweir 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
48cdf0e10cSrcweir 	virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
49cdf0e10cSrcweir 	virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
50cdf0e10cSrcweir 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
51cdf0e10cSrcweir     virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	// zaehlt die Spaces fuer Blocksatz
54cdf0e10cSrcweir 	xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     // Accessibility: pass information about this portion to the PortionHandler
59cdf0e10cSrcweir     virtual void HandlePortion( SwPortionHandler& rPH ) const;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	OUTPUT_OPERATOR
62cdf0e10cSrcweir 	DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
63cdf0e10cSrcweir };
64cdf0e10cSrcweir 
65*69a74367SOliver-Rainer Wittmann 
66*69a74367SOliver-Rainer Wittmann class SwTxtInputFldPortion : public SwTxtPortion
67*69a74367SOliver-Rainer Wittmann {
68*69a74367SOliver-Rainer Wittmann public:
69*69a74367SOliver-Rainer Wittmann     SwTxtInputFldPortion();
70*69a74367SOliver-Rainer Wittmann 
71*69a74367SOliver-Rainer Wittmann     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
72*69a74367SOliver-Rainer Wittmann     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
73*69a74367SOliver-Rainer Wittmann     virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
74*69a74367SOliver-Rainer Wittmann     virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
75*69a74367SOliver-Rainer Wittmann     virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
76*69a74367SOliver-Rainer Wittmann 
77*69a74367SOliver-Rainer Wittmann private:
78*69a74367SOliver-Rainer Wittmann     bool mbContainsInputFieldStart;
79*69a74367SOliver-Rainer Wittmann     bool mbContainsInputFieldEnd;
80*69a74367SOliver-Rainer Wittmann     bool ContainsOnlyDummyChars() const;
81*69a74367SOliver-Rainer Wittmann };
82*69a74367SOliver-Rainer Wittmann 
83cdf0e10cSrcweir /*************************************************************************
84cdf0e10cSrcweir  *						class SwHolePortion
85cdf0e10cSrcweir  *************************************************************************/
86cdf0e10cSrcweir 
87cdf0e10cSrcweir class SwHolePortion : public SwLinePortion
88cdf0e10cSrcweir {
89cdf0e10cSrcweir 	KSHORT nBlankWidth;
90cdf0e10cSrcweir public:
91cdf0e10cSrcweir 			SwHolePortion( const SwTxtPortion &rPor );
GetBlankWidth() const92cdf0e10cSrcweir 	inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
SetBlankWidth(const KSHORT nNew)93cdf0e10cSrcweir 	inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
94cdf0e10cSrcweir 	virtual SwLinePortion *Compress();
95cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
96cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     // Accessibility: pass information about this portion to the PortionHandler
99cdf0e10cSrcweir     virtual void HandlePortion( SwPortionHandler& rPH ) const;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	OUTPUT_OPERATOR
102cdf0e10cSrcweir 	DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir class SwFieldMarkPortion : public SwTxtPortion
106cdf0e10cSrcweir {
107cdf0e10cSrcweir     public:
SwFieldMarkPortion()108cdf0e10cSrcweir         inline SwFieldMarkPortion() : SwTxtPortion()
109cdf0e10cSrcweir             { }
110cdf0e10cSrcweir         virtual void Paint( const SwTxtPaintInfo &rInf ) const;
111cdf0e10cSrcweir         virtual sal_Bool Format( SwTxtFormatInfo &rInf );
112cdf0e10cSrcweir };
113cdf0e10cSrcweir 
114cdf0e10cSrcweir class SwFieldFormPortion : public SwTxtPortion
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     public:
SwFieldFormPortion()117cdf0e10cSrcweir         inline SwFieldFormPortion() : SwTxtPortion()
118cdf0e10cSrcweir             { }
119cdf0e10cSrcweir     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
120cdf0e10cSrcweir     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 
124cdf0e10cSrcweir CLASSIO( SwTxtPortion )
125cdf0e10cSrcweir CLASSIO( SwHolePortion )
126cdf0e10cSrcweir 
127cdf0e10cSrcweir #endif
128