android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / txtnode / justify.hxx
blob454b6c25900134075075865510a8d5886f4216fc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
11 #include <sal/types.h>
13 namespace sw::Justify
15 /// Get model position base on given kern array.
16 /// @param rKernArray text positions from OutDev::GetTextArray().
17 /// @param nLen number of elements to process in rKernArray.
18 /// @param nX the visual position
19 SW_DLLPUBLIC sal_Int32 GetModelPosition(const KernArray& rKernArray, sal_Int32 nLen,
20 tools::Long nX);
21 /// Distribute space between words and letters.
22 /// @param[in,out] rKernArray text positions from OutDev::GetTextArray().
23 /// @param aText string used to determine where space and kern are inserted.
24 /// @param nStt starting index of rText.
25 /// @param nLen number of elements to process in rKernArray and rText.
26 /// @param nSpaceAdd amount of space to insert for each CH_BLANK.
27 /// @param nKern amount of space to insert between letters.
28 /// @param bNoHalfSpace whether to split the space into two halves.
29 /// Split spaces are inserted before and after CH_BLANK.
30 /// Set to true in word line mode and for Arabic text to avoid splitting.
31 SW_DLLPUBLIC void SpaceDistribution(KernArray& rKernArray, std::u16string_view aText,
32 sal_Int32 nStt, sal_Int32 nLen, tools::Long nSpaceAdd,
33 tools::Long nKern, bool bNoHalfSpace);
35 /// Snap ideographs to text grids:
36 /// a) Ideographic open brackets are aligned to the rightmost edge of spanned grids so that
37 // they can be closer to the next ideograph.
38 /// b) Ideographic close brackets, ideographic comma, and ideographic fullstop are aligned
39 /// to the leftmost edge of spanned grids so that they can be closer to the previous
40 /// ideograph.
41 /// c) Other ideographs are aligned to the center of the spanned grids.
42 /// @param[in,out] rKernArray text positions from OutDev::GetTextArray().
43 /// @param aText string used to determine where space and kern are inserted.
44 /// @param nStt starting index of rText.
45 /// @param nLen number of elements to process in rKernArray and rText.
46 /// @param nGridWidth width of a text grid
47 /// @param bForceLeft for align to the left edge of the grid disregard of the punctuation type.
48 /// This is useful for calculate text width, line break, and conversion model position.
49 /// @return the delta offset of first glyph so text origin can be updated accordingly.
50 SW_DLLPUBLIC tools::Long SnapToGrid(KernArray& rKernArray, std::u16string_view aText,
51 sal_Int32 nStt, sal_Int32 nLen, tools::Long nGridWidth,
52 bool bForceLeft);
54 /// Snap ideographs to text grids edge ( used when snap to char is off ):
55 /// space will be distributed ( in case that alignment is set to justify. ).
56 /// @param[in,out] rKernArray text positions from OutDev::GetTextArray().
57 /// @param nLen number of elements to process in rKernArray and rText.
58 /// @param nGridWidth width of a text grid
59 /// @param nSpace amount of space distributed under justify text alignment mode.
60 /// @param nKern letter spacing.
61 SW_DLLPUBLIC void SnapToGridEdge(KernArray& rKernArray, sal_Int32 nLen, tools::Long nGridWidth,
62 tools::Long nSpace, tools::Long nKern);
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */