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 _PORTAB_HXX
29 : : #define _PORTAB_HXX
30 : :
31 : : #include "porglue.hxx"
32 : :
33 : : /*************************************************************************
34 : : * class SwTabPortion
35 : : *************************************************************************/
36 : :
37 [ - + ]: 207 : class SwTabPortion : public SwFixPortion
38 : : {
39 : : const KSHORT nTabPos;
40 : : const xub_Unicode cFill;
41 : : const bool bAutoTabStop;
42 : :
43 : : // Format() branches either into PreFormat() or PostFormat()
44 : : sal_Bool PreFormat( SwTxtFormatInfo &rInf );
45 : : public:
46 : : SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill = '\0', const bool bAutoTab = true );
47 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
48 : : virtual sal_Bool Format( SwTxtFormatInfo &rInf );
49 : : virtual void FormatEOL( SwTxtFormatInfo &rInf );
50 : : sal_Bool PostFormat( SwTxtFormatInfo &rInf );
51 : 10 : inline sal_Bool IsFilled() const { return 0 != cFill; }
52 : 207 : inline KSHORT GetTabPos() const { return nTabPos; }
53 : 0 : inline sal_Bool IsAutoTabStop() const { return bAutoTabStop; }
54 : :
55 : : // Accessibility: pass information about this portion to the PortionHandler
56 : : virtual void HandlePortion( SwPortionHandler& rPH ) const;
57 : :
58 : : OUTPUT_OPERATOR
59 : : };
60 : :
61 : : /*************************************************************************
62 : : * class SwTabLeftPortion
63 : : *************************************************************************/
64 : :
65 [ - + ]: 410 : class SwTabLeftPortion : public SwTabPortion
66 : : {
67 : : public:
68 : 205 : inline SwTabLeftPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0', bool bAutoTab = true )
69 : 205 : : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
70 : 205 : { SetWhichPor( POR_TABLEFT ); }
71 : : OUTPUT_OPERATOR
72 : : };
73 : :
74 : : /*************************************************************************
75 : : * class SwTabRightPortion
76 : : *************************************************************************/
77 : :
78 [ - + ]: 4 : class SwTabRightPortion : public SwTabPortion
79 : : {
80 : : public:
81 : 2 : inline SwTabRightPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' )
82 : 2 : : SwTabPortion( nTabPosVal, cFillChar )
83 : 2 : { SetWhichPor( POR_TABRIGHT ); }
84 : : OUTPUT_OPERATOR
85 : : };
86 : :
87 : : /*************************************************************************
88 : : * class SwTabCenterPortion
89 : : *************************************************************************/
90 : :
91 [ # # ]: 0 : class SwTabCenterPortion : public SwTabPortion
92 : : {
93 : : public:
94 : 0 : inline SwTabCenterPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' )
95 : 0 : : SwTabPortion( nTabPosVal, cFillChar )
96 : 0 : { SetWhichPor( POR_TABCENTER ); }
97 : : OUTPUT_OPERATOR
98 : : };
99 : :
100 : : /*************************************************************************
101 : : * class SwTabDecimalPortion
102 : : *************************************************************************/
103 : :
104 [ # # ]: 0 : class SwTabDecimalPortion : public SwTabPortion
105 : : {
106 : : const xub_Unicode mcTab;
107 : :
108 : : /*
109 : : * During text formatting, we already store the width of the portions
110 : : * following the tab stop up to the decimal position. This value is
111 : : * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#.
112 : : */
113 : : sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition;
114 : :
115 : : public:
116 : 0 : inline SwTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab,
117 : : const xub_Unicode cFillChar = '\0' )
118 : : : SwTabPortion( nTabPosVal, cFillChar ),
119 : : mcTab(cTab),
120 : 0 : mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
121 : 0 : { SetWhichPor( POR_TABDECIMAL ); }
122 : :
123 : 0 : inline xub_Unicode GetTabDecimal() const { return mcTab; }
124 : :
125 : 0 : inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
126 : : {
127 : 0 : mnWidthOfPortionsUpTpDecimalPosition = nNew;
128 : 0 : }
129 : 0 : inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
130 : : {
131 : 0 : return mnWidthOfPortionsUpTpDecimalPosition;
132 : : }
133 : :
134 : : OUTPUT_OPERATOR
135 : : };
136 : :
137 : :
138 : : /*************************************************************************
139 : : * class SwAutoTabDecimalPortion
140 : : *************************************************************************/
141 : :
142 [ # # ]: 0 : class SwAutoTabDecimalPortion : public SwTabDecimalPortion
143 : : {
144 : : public:
145 : 0 : inline SwAutoTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab,
146 : : const xub_Unicode cFillChar = '\0' )
147 : 0 : : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar )
148 : 0 : { SetLen( 0 ); }
149 : : virtual void Paint( const SwTxtPaintInfo &rInf ) const;
150 : : };
151 : :
152 : :
153 : : CLASSIO( SwTabPortion )
154 : : CLASSIO( SwTabLeftPortion )
155 : : CLASSIO( SwTabRightPortion )
156 : : CLASSIO( SwTabCenterPortion )
157 : : CLASSIO( SwTabDecimalPortion )
158 : :
159 : :
160 : : #endif
161 : :
162 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|