LibreOffice Module sw (master)  1
guess.hxx
Go to the documentation of this file.
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 <memory>
22 
23 #include "porrst.hxx"
24 
25 #include <com/sun/star/uno/Reference.hxx>
26 
27 namespace com::sun::star::linguistic2 { class XHyphenatedWord; }
28 
29 class SwTextFormatInfo;
30 
32 {
33  css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord;
34  std::unique_ptr<SwHangingPortion> pHanging; // for hanging punctuation
35  TextFrameIndex nCutPos; // this character doesn't fit
36  TextFrameIndex nBreakStart; // start index of word containing line break
37  TextFrameIndex nBreakPos; // start index of break position
38  TextFrameIndex nFieldDiff; // absolute positions can be wrong if we
39  // a field in the text has been expanded
40  sal_uInt16 nBreakWidth; // width of the broken portion
41 public:
42  SwTextGuess(): nCutPos(0), nBreakStart(0),
43  nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
44  { }
45 
46  // true, if current portion still fits to current line
47  bool Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
48  const sal_uInt16 nHeight );
49  bool AlternativeSpelling( const SwTextFormatInfo &rInf, const TextFrameIndex nPos );
50 
51  SwHangingPortion* GetHangingPortion() const { return pHanging.get(); }
52  SwHangingPortion* ReleaseHangingPortion() { return pHanging.release(); }
53  sal_uInt16 BreakWidth() const { return nBreakWidth; }
54  TextFrameIndex CutPos() const { return nCutPos; }
56  TextFrameIndex BreakPos() const {return nBreakPos; }
57  TextFrameIndex FieldDiff() const {return nFieldDiff; }
58  const css::uno::Reference< css::linguistic2::XHyphenatedWord >& HyphWord() const
59  { return xHyphWord; }
60 };
61 
62 #endif
63 
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TextFrameIndex FieldDiff() const
Definition: guess.hxx:57
sal_uInt16 BreakWidth() const
Definition: guess.hxx:53
bool Guess(const SwTextPortion &rPor, SwTextFormatInfo &rInf, const sal_uInt16 nHeight)
Definition: guess.cxx:53
bool AlternativeSpelling(const SwTextFormatInfo &rInf, const TextFrameIndex nPos)
Definition: guess.cxx:559
css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord
Definition: guess.hxx:33
TextFrameIndex BreakStart() const
Definition: guess.hxx:55
TextFrameIndex BreakPos() const
Definition: guess.hxx:56
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
TextFrameIndex nBreakPos
Definition: guess.hxx:37
TextFrameIndex nCutPos
Definition: guess.hxx:35
TextFrameIndex CutPos() const
Definition: guess.hxx:54
TextFrameIndex nFieldDiff
Definition: guess.hxx:38
SwHangingPortion * GetHangingPortion() const
Definition: guess.hxx:51
SwHangingPortion * ReleaseHangingPortion()
Definition: guess.hxx:52
std::unique_ptr< SwHangingPortion > pHanging
Definition: guess.hxx:34
SwTextGuess()
Definition: guess.hxx:42
sal_uInt16 nBreakWidth
Definition: guess.hxx:40
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & HyphWord() const
Definition: guess.hxx:58
TextFrameIndex nBreakStart
Definition: guess.hxx:36