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_PORRST_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORRST_HXX
21 : #include "porlay.hxx"
22 : #include "porexp.hxx"
23 :
24 : #define LINE_BREAK_WIDTH 150
25 : #define SPECIAL_FONT_HEIGHT 200
26 :
27 : class SwTxtFormatInfo;
28 :
29 : /*************************************************************************
30 : * class SwTmpEndPortion
31 : *************************************************************************/
32 :
33 0 : class SwTmpEndPortion : public SwLinePortion
34 : {
35 : public:
36 : SwTmpEndPortion( const SwLinePortion &rPortion );
37 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
38 : OUTPUT_OPERATOR_OVERRIDE
39 : };
40 :
41 : /*************************************************************************
42 : * class SwBreakPortion
43 : *************************************************************************/
44 :
45 0 : class SwBreakPortion : public SwLinePortion
46 : {
47 : public:
48 : SwBreakPortion( const SwLinePortion &rPortion );
49 : // Returns 0 if we have no usable data
50 : virtual SwLinePortion *Compress() SAL_OVERRIDE;
51 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
52 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
53 : virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const SAL_OVERRIDE;
54 : virtual sal_Int32 GetCrsrOfst( const MSHORT nOfst ) const SAL_OVERRIDE;
55 :
56 : // Accessibility: pass information about this portion to the PortionHandler
57 : virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
58 :
59 : OUTPUT_OPERATOR_OVERRIDE
60 : };
61 :
62 : /*************************************************************************
63 : * class SwKernPortion
64 : *************************************************************************/
65 :
66 0 : class SwKernPortion : public SwLinePortion
67 : {
68 : short nKern;
69 : bool bBackground;
70 : bool bGridKern;
71 :
72 : public:
73 :
74 : // This constructor automatically appends the portion to rPortion
75 : // bBG indicates, that the background of the kerning portion has to
76 : // be painted, e.g., if the portion if positioned between to fields.
77 : // bGridKern indicates, that the kerning portion is used to provide
78 : // additional space in grid mode.
79 : SwKernPortion( SwLinePortion &rPortion, short nKrn,
80 : bool bBG = false, bool bGridKern = false );
81 :
82 : // This constructor only sets the height and ascent to the values
83 : // of rPortion. It is only used for kerning portions for grid mode
84 : SwKernPortion( const SwLinePortion &rPortion );
85 :
86 : virtual void FormatEOL( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
87 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
88 :
89 : OUTPUT_OPERATOR_OVERRIDE
90 : };
91 :
92 : /*************************************************************************
93 : * class SwArrowPortion
94 : *************************************************************************/
95 :
96 0 : class SwArrowPortion : public SwLinePortion
97 : {
98 : Point aPos;
99 : bool bLeft;
100 : public:
101 : SwArrowPortion( const SwLinePortion &rPortion );
102 : SwArrowPortion( const SwTxtPaintInfo &rInf );
103 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
104 : virtual SwLinePortion *Compress() SAL_OVERRIDE;
105 0 : inline bool IsLeft() const { return bLeft; }
106 0 : inline const Point& GetPos() const { return aPos; }
107 : OUTPUT_OPERATOR_OVERRIDE
108 : };
109 :
110 : /*************************************************************************
111 : * class SwHangingPortion
112 : * The characters which are forbidden at the start of a line like the dot and
113 : * other punctuation marks are allowed to display in the margin of the page
114 : * by a user option.
115 : * The SwHangingPortion is the corresponding textportion to do that.
116 : *************************************************************************/
117 :
118 0 : class SwHangingPortion : public SwTxtPortion
119 : {
120 : KSHORT nInnerWidth;
121 : public:
122 0 : inline SwHangingPortion( SwPosSize aSize ) : nInnerWidth( aSize.Width() )
123 0 : { SetWhichPor( POR_HNG ); SetLen( 1 ); Height( aSize.Height() ); }
124 :
125 0 : inline KSHORT GetInnerWidth() const { return nInnerWidth; }
126 : };
127 :
128 : /*************************************************************************
129 : * class SwHiddenTextPortion
130 : * Is used to hide text
131 : *************************************************************************/
132 :
133 0 : class SwHiddenTextPortion : public SwLinePortion
134 : {
135 : public:
136 0 : inline SwHiddenTextPortion( sal_Int32 nLen )
137 0 : { SetWhichPor( POR_HIDDEN_TXT ); SetLen( nLen ); }
138 :
139 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
140 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
141 : };
142 :
143 : /*************************************************************************
144 : * class SwControlCharPortion
145 : *************************************************************************/
146 :
147 0 : class SwControlCharPortion : public SwLinePortion
148 : {
149 :
150 : private:
151 : mutable sal_uInt16 mnViewWidth; // used to cache a calculated value
152 : mutable sal_uInt16 mnHalfCharWidth; // used to cache a calculated value
153 : sal_Unicode mcChar;
154 :
155 : public:
156 :
157 0 : inline SwControlCharPortion( sal_Unicode cChar )
158 0 : : mnViewWidth( 0 ), mnHalfCharWidth( 0 ), mcChar( cChar )
159 : {
160 0 : SetWhichPor( POR_CONTROLCHAR ); SetLen( 1 );
161 0 : }
162 :
163 : virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
164 : virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
165 : virtual KSHORT GetViewWidth( const SwTxtSizeInfo& rInf ) const SAL_OVERRIDE;
166 : };
167 :
168 : #endif
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|