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