1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: guess.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
34 #include "txttypes.hxx"
35 #include "breakit.hxx"
36 #include "porrst.hxx" // SwHangingPortion
38 class SwTxtFormatInfo
;
40 /*************************************************************************
42 *************************************************************************/
46 ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XHyphenatedWord
> xHyphWord
;
47 SwHangingPortion
*pHanging
; // for hanging punctuation
48 xub_StrLen nCutPos
; // this character doesn't fit
49 xub_StrLen nBreakStart
; // start index of word containing line break
50 xub_StrLen nBreakPos
; // start index of break position
51 xub_StrLen nFieldDiff
; // absolut positions can be wrong if we
52 // a field in the text has been expanded
53 KSHORT nBreakWidth
; // width of the broken portion
55 inline SwTxtGuess(): pHanging( NULL
), nCutPos(0), nBreakStart(0),
56 nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
58 ~SwTxtGuess() { delete pHanging
; }
60 // true, if current portion still fits to current line
61 sal_Bool
Guess( const SwTxtPortion
& rPor
, SwTxtFormatInfo
&rInf
,
62 const KSHORT nHeight
);
63 sal_Bool
AlternativeSpelling( const SwTxtFormatInfo
&rInf
, const xub_StrLen nPos
);
65 inline SwHangingPortion
* GetHangingPortion() const { return pHanging
; }
66 inline void ClearHangingPortion() { pHanging
= NULL
; }
67 inline KSHORT
BreakWidth() const { return nBreakWidth
; }
68 inline xub_StrLen
CutPos() const { return nCutPos
; }
69 inline xub_StrLen
BreakStart() const { return nBreakStart
; }
70 inline xub_StrLen
BreakPos() const {return nBreakPos
; }
71 inline xub_StrLen
FieldDiff() const {return nFieldDiff
; }
72 inline ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XHyphenatedWord
> HyphWord() const