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