xref: /aoo4110/main/sw/source/core/text/guess.hxx (revision b1cdbd2c)
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 _GUESS_HXX
24 #define _GUESS_HXX
25 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
26 
27 #include "txttypes.hxx"
28 #include "breakit.hxx"
29 #include "porrst.hxx"	// SwHangingPortion
30 
31 class SwTxtFormatInfo;
32 
33 /*************************************************************************
34  *						class SwTxtGuess
35  *************************************************************************/
36 
37 class SwTxtGuess
38 {
39 	::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord >  xHyphWord;
40 	SwHangingPortion *pHanging; // for hanging punctuation
41 	xub_StrLen nCutPos;			// this character doesn't fit
42 	xub_StrLen nBreakStart;     // start index of word containing line break
43 	xub_StrLen nBreakPos;		// start index of break position
44     xub_StrLen nFieldDiff;      // absolut positions can be wrong if we
45                                 // a field in the text has been expanded
46 	KSHORT nBreakWidth;			// width of the broken portion
47 public:
SwTxtGuess()48 	inline SwTxtGuess(): pHanging( NULL ), nCutPos(0), nBreakStart(0),
49                         nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
50 		{ }
~SwTxtGuess()51 	~SwTxtGuess() {	delete pHanging; }
52 
53 	// true, if current portion still fits to current line
54     sal_Bool Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
55                     const KSHORT nHeight );
56 	sal_Bool AlternativeSpelling( const SwTxtFormatInfo &rInf, const xub_StrLen nPos );
57 
GetHangingPortion() const58 	inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
ClearHangingPortion()59 	inline void ClearHangingPortion() { pHanging = NULL; }
BreakWidth() const60 	inline KSHORT BreakWidth() const { return nBreakWidth; }
CutPos() const61 	inline xub_StrLen CutPos() const { return nCutPos; }
BreakStart() const62 	inline xub_StrLen BreakStart() const { return nBreakStart; }
BreakPos() const63 	inline xub_StrLen BreakPos() const {return nBreakPos; }
FieldDiff() const64     inline xub_StrLen FieldDiff() const {return nFieldDiff; }
HyphWord() const65 	inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > HyphWord() const
66 		{ return xHyphWord; }
67 };
68 
69 #endif
70