Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _PORRST_HXX
29 : : #define _PORRST_HXX
30 : : #include "porlay.hxx"
31 : : #include "porexp.hxx"
32 : :
33 : : #define LINE_BREAK_WIDTH 150
34 : : #define SPECIAL_FONT_HEIGHT 200
35 : :
36 : : class SwTxtFormatInfo;
37 : :
38 : : /*************************************************************************
39 : : * class SwTmpEndPortion
40 : : *************************************************************************/
41 : :
42 [ # # ]: 0 : class SwTmpEndPortion : public SwLinePortion
43 : : {
44 : : public:
45 : : SwTmpEndPortion( const SwLinePortion &rPortion );
46 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
47 : : OUTPUT_OPERATOR
48 : : };
49 : :
50 : : /*************************************************************************
51 : : * class SwBreakPortion
52 : : *************************************************************************/
53 : :
54 [ - + ]: 542 : class SwBreakPortion : public SwLinePortion
55 : : {
56 : : public:
57 : : SwBreakPortion( const SwLinePortion &rPortion );
58 : : // Returns 0 if we have no usable data
59 : : virtual SwLinePortion *Compress();
60 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
61 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
62 : : virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
63 : : virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
64 : :
65 : : // Accessibility: pass information about this portion to the PortionHandler
66 : : virtual void HandlePortion( SwPortionHandler& rPH ) const;
67 : :
68 : : OUTPUT_OPERATOR
69 : : };
70 : :
71 : : /*************************************************************************
72 : : * class SwKernPortion
73 : : *************************************************************************/
74 : :
75 [ - + ]: 512 : class SwKernPortion : public SwLinePortion
76 : : {
77 : : short nKern;
78 : : sal_Bool bBackground;
79 : : sal_Bool bGridKern;
80 : :
81 : : public:
82 : :
83 : : // This constructor automatically appends the portion to rPortion
84 : : // bBG indicates, that the background of the kerning portion has to
85 : : // be painted, e.g., if the portion if positioned between to fields.
86 : : // bGridKern indicates, that the kerning portion is used to provide
87 : : // additional space in grid mode.
88 : : SwKernPortion( SwLinePortion &rPortion, short nKrn,
89 : : sal_Bool bBG = sal_False, sal_Bool bGridKern = sal_False );
90 : :
91 : : // This constructor only sets the height and ascent to the values
92 : : // of rPortion. It is only used for kerning portions for grid mode
93 : : SwKernPortion( const SwLinePortion &rPortion );
94 : :
95 : : virtual void FormatEOL( SwTxtFormatInfo &rInf );
96 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
97 : :
98 : : OUTPUT_OPERATOR
99 : : };
100 : :
101 : : /*************************************************************************
102 : : * class SwArrowPortion
103 : : *************************************************************************/
104 : :
105 [ - + ]: 98 : class SwArrowPortion : public SwLinePortion
106 : : {
107 : : Point aPos;
108 : : sal_Bool bLeft;
109 : : public:
110 : : SwArrowPortion( const SwLinePortion &rPortion );
111 : : SwArrowPortion( const SwTxtPaintInfo &rInf );
112 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
113 : : virtual SwLinePortion *Compress();
114 : 14 : inline sal_Bool IsLeft() const { return bLeft; }
115 : 14 : inline const Point& GetPos() const { return aPos; }
116 : : OUTPUT_OPERATOR
117 : : };
118 : :
119 : : /*************************************************************************
120 : : * class SwHangingPortion
121 : : * The characters which are forbidden at the start of a line like the dot and
122 : : * other punctuation marks are allowed to display in the margin of the page
123 : : * by a user option.
124 : : * The SwHangingPortion is the corresponding textportion to do that.
125 : : *************************************************************************/
126 : :
127 [ # # ]: 0 : class SwHangingPortion : public SwTxtPortion
128 : : {
129 : : KSHORT nInnerWidth;
130 : : public:
131 : 0 : inline SwHangingPortion( SwPosSize aSize ) : nInnerWidth( aSize.Width() )
132 : 0 : { SetWhichPor( POR_HNG ); SetLen( 1 ); Height( aSize.Height() ); }
133 : :
134 : 0 : inline KSHORT GetInnerWidth() const { return nInnerWidth; }
135 : : };
136 : :
137 : : /*************************************************************************
138 : : * class SwHiddenTextPortion
139 : : * Is used to hide text
140 : : *************************************************************************/
141 : :
142 [ # # ]: 0 : class SwHiddenTextPortion : public SwLinePortion
143 : : {
144 : : public:
145 : 0 : inline SwHiddenTextPortion( xub_StrLen nLen )
146 : 0 : { SetWhichPor( POR_HIDDEN_TXT ); SetLen( nLen ); }
147 : :
148 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
149 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
150 : : };
151 : :
152 : : /*************************************************************************
153 : : * class SwControlCharPortion
154 : : *************************************************************************/
155 : :
156 [ # # ]: 0 : class SwControlCharPortion : public SwLinePortion
157 : : {
158 : :
159 : : private:
160 : : mutable sal_uInt16 mnViewWidth; // used to cache a calculated value
161 : : mutable sal_uInt16 mnHalfCharWidth; // used to cache a calculated value
162 : : sal_Unicode mcChar;
163 : :
164 : : public:
165 : :
166 : 0 : inline SwControlCharPortion( sal_Unicode cChar )
167 : 0 : : mnViewWidth( 0 ), mnHalfCharWidth( 0 ), mcChar( cChar )
168 : : {
169 : 0 : SetWhichPor( POR_CONTROLCHAR ); SetLen( 1 );
170 : 0 : }
171 : :
172 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
173 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
174 : : virtual KSHORT GetViewWidth( const SwTxtSizeInfo& rInf ) const;
175 : : };
176 : :
177 : :
178 : :
179 : : /*************************************************************************
180 : : * inline - Implementations
181 : : *************************************************************************/
182 : :
183 : : CLASSIO( SwBreakPortion )
184 : : CLASSIO( SwEndPortion )
185 : : CLASSIO( SwKernPortion )
186 : : CLASSIO( SwArrowPortion )
187 : :
188 : : #endif
189 : :
190 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|