Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _GUESS_HXX
20 : #define _GUESS_HXX
21 : #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
22 :
23 : #include "txttypes.hxx"
24 : #include "breakit.hxx"
25 : #include "porrst.hxx" // SwHangingPortion
26 :
27 : class SwTxtFormatInfo;
28 :
29 : /*************************************************************************
30 : * class SwTxtGuess
31 : *************************************************************************/
32 :
33 : class SwTxtGuess
34 : {
35 : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
36 : SwHangingPortion *pHanging; // for hanging punctuation
37 : xub_StrLen nCutPos; // this character doesn't fit
38 : xub_StrLen nBreakStart; // start index of word containing line break
39 : xub_StrLen nBreakPos; // start index of break position
40 : xub_StrLen nFieldDiff; // absolut positions can be wrong if we
41 : // a field in the text has been expanded
42 : KSHORT nBreakWidth; // width of the broken portion
43 : public:
44 680 : inline SwTxtGuess(): pHanging( NULL ), nCutPos(0), nBreakStart(0),
45 680 : nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
46 680 : { }
47 680 : ~SwTxtGuess() { delete pHanging; }
48 :
49 : // true, if current portion still fits to current line
50 : sal_Bool Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
51 : const KSHORT nHeight );
52 : bool AlternativeSpelling( const SwTxtFormatInfo &rInf, const xub_StrLen nPos );
53 :
54 85 : inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
55 0 : inline void ClearHangingPortion() { pHanging = NULL; }
56 757 : inline KSHORT BreakWidth() const { return nBreakWidth; }
57 20 : inline xub_StrLen CutPos() const { return nCutPos; }
58 66 : inline xub_StrLen BreakStart() const { return nBreakStart; }
59 393 : inline xub_StrLen BreakPos() const {return nBreakPos; }
60 66 : inline xub_StrLen FieldDiff() const {return nFieldDiff; }
61 73 : inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > HyphWord() const
62 73 : { return xHyphWord; }
63 : };
64 :
65 : #endif
66 :
67 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|