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 INCLUDED_SW_SOURCE_CORE_TEXT_GUESS_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_TEXT_GUESS_HXX
21 : #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
22 :
23 : #include "txttypes.hxx"
24 : #include "breakit.hxx"
25 : #include "porrst.hxx"
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 : sal_Int32 nCutPos; // this character doesn't fit
38 : sal_Int32 nBreakStart; // start index of word containing line break
39 : sal_Int32 nBreakPos; // start index of break position
40 : sal_Int32 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 0 : inline SwTxtGuess(): pHanging( NULL ), nCutPos(0), nBreakStart(0),
45 0 : nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
46 0 : { }
47 0 : ~SwTxtGuess() { delete pHanging; }
48 :
49 : // true, if current portion still fits to current line
50 : bool Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
51 : const KSHORT nHeight );
52 : bool AlternativeSpelling( const SwTxtFormatInfo &rInf, const sal_Int32 nPos );
53 :
54 0 : inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
55 0 : inline void ClearHangingPortion() { pHanging = NULL; }
56 0 : inline KSHORT BreakWidth() const { return nBreakWidth; }
57 0 : inline sal_Int32 CutPos() const { return nCutPos; }
58 0 : inline sal_Int32 BreakStart() const { return nBreakStart; }
59 0 : inline sal_Int32 BreakPos() const {return nBreakPos; }
60 0 : inline sal_Int32 FieldDiff() const {return nFieldDiff; }
61 0 : inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > HyphWord() const
62 0 : { return xHyphWord; }
63 : };
64 :
65 : #endif
66 :
67 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|