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 "swtypes.hxx"
24 : #include "breakit.hxx"
25 : #include "porrst.hxx"
26 :
27 : class SwTextFormatInfo;
28 :
29 : class SwTextGuess
30 : {
31 : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
32 : SwHangingPortion *pHanging; // for hanging punctuation
33 : sal_Int32 nCutPos; // this character doesn't fit
34 : sal_Int32 nBreakStart; // start index of word containing line break
35 : sal_Int32 nBreakPos; // start index of break position
36 : sal_Int32 nFieldDiff; // absolut positions can be wrong if we
37 : // a field in the text has been expanded
38 : sal_uInt16 nBreakWidth; // width of the broken portion
39 : public:
40 102021 : inline SwTextGuess(): pHanging( NULL ), nCutPos(0), nBreakStart(0),
41 102021 : nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
42 102021 : { }
43 102021 : ~SwTextGuess() { delete pHanging; }
44 :
45 : // true, if current portion still fits to current line
46 : bool Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
47 : const sal_uInt16 nHeight );
48 : bool AlternativeSpelling( const SwTextFormatInfo &rInf, const sal_Int32 nPos );
49 :
50 35204 : inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
51 0 : inline void ClearHangingPortion() { pHanging = NULL; }
52 133909 : inline sal_uInt16 BreakWidth() const { return nBreakWidth; }
53 3406 : inline sal_Int32 CutPos() const { return nCutPos; }
54 32389 : inline sal_Int32 BreakStart() const { return nBreakStart; }
55 170563 : inline sal_Int32 BreakPos() const {return nBreakPos; }
56 32389 : inline sal_Int32 FieldDiff() const {return nFieldDiff; }
57 34202 : inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > HyphWord() const
58 34202 : { return xHyphWord; }
59 : };
60 :
61 : #endif
62 :
63 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|