xref: /trunk/main/sw/source/core/text/portab.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2*1d2dbeb0SAndrew Rist  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _PORTAB_HXX
24cdf0e10cSrcweir #define _PORTAB_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "porglue.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir /*************************************************************************
29cdf0e10cSrcweir  *                      class SwTabPortion
30cdf0e10cSrcweir  *************************************************************************/
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class SwTabPortion : public SwFixPortion
33cdf0e10cSrcweir {
34cdf0e10cSrcweir 	const KSHORT nTabPos;
35cdf0e10cSrcweir 	const xub_Unicode cFill;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	// Das Format() verzweigt entweder in Pre- oder PostFormat()
38cdf0e10cSrcweir 	sal_Bool PreFormat( SwTxtFormatInfo &rInf );
39cdf0e10cSrcweir public:
40cdf0e10cSrcweir 	SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill = '\0' );
41cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
42cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
43cdf0e10cSrcweir 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
44cdf0e10cSrcweir 	sal_Bool PostFormat( SwTxtFormatInfo &rInf );
IsFilled() const45cdf0e10cSrcweir 	inline  sal_Bool IsFilled() const { return 0 != cFill; }
GetTabPos() const46cdf0e10cSrcweir 	inline  KSHORT GetTabPos() const { return nTabPos; }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     // Accessibility: pass information about this portion to the PortionHandler
49cdf0e10cSrcweir     virtual void HandlePortion( SwPortionHandler& rPH ) const;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	OUTPUT_OPERATOR
52cdf0e10cSrcweir };
53cdf0e10cSrcweir 
54cdf0e10cSrcweir /*************************************************************************
55cdf0e10cSrcweir  *                  class SwTabLeftPortion
56cdf0e10cSrcweir  *************************************************************************/
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class SwTabLeftPortion : public SwTabPortion
59cdf0e10cSrcweir {
60cdf0e10cSrcweir public:
SwTabLeftPortion(const KSHORT nTabPosVal,const xub_Unicode cFillChar='\\0')61cdf0e10cSrcweir     inline SwTabLeftPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' )
62cdf0e10cSrcweir          : SwTabPortion( nTabPosVal, cFillChar )
63cdf0e10cSrcweir 	{ SetWhichPor( POR_TABLEFT ); }
64cdf0e10cSrcweir 	OUTPUT_OPERATOR
65cdf0e10cSrcweir };
66cdf0e10cSrcweir 
67cdf0e10cSrcweir /*************************************************************************
68cdf0e10cSrcweir  *                  class SwTabRightPortion
69cdf0e10cSrcweir  *************************************************************************/
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class SwTabRightPortion : public SwTabPortion
72cdf0e10cSrcweir {
73cdf0e10cSrcweir public:
SwTabRightPortion(const KSHORT nTabPosVal,const xub_Unicode cFillChar='\\0')74cdf0e10cSrcweir     inline SwTabRightPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' )
75cdf0e10cSrcweir          : SwTabPortion( nTabPosVal, cFillChar )
76cdf0e10cSrcweir 	{ SetWhichPor( POR_TABRIGHT ); }
77cdf0e10cSrcweir 	OUTPUT_OPERATOR
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir /*************************************************************************
81cdf0e10cSrcweir  *                  class SwTabCenterPortion
82cdf0e10cSrcweir  *************************************************************************/
83cdf0e10cSrcweir 
84cdf0e10cSrcweir class SwTabCenterPortion : public SwTabPortion
85cdf0e10cSrcweir {
86cdf0e10cSrcweir public:
SwTabCenterPortion(const KSHORT nTabPosVal,const xub_Unicode cFillChar='\\0')87cdf0e10cSrcweir     inline SwTabCenterPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' )
88cdf0e10cSrcweir          : SwTabPortion( nTabPosVal, cFillChar )
89cdf0e10cSrcweir 	{ SetWhichPor( POR_TABCENTER );	}
90cdf0e10cSrcweir 	OUTPUT_OPERATOR
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir /*************************************************************************
94cdf0e10cSrcweir  *                  class SwTabDecimalPortion
95cdf0e10cSrcweir  *************************************************************************/
96cdf0e10cSrcweir 
97cdf0e10cSrcweir class SwTabDecimalPortion : public SwTabPortion
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     const xub_Unicode mcTab;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     /*
102cdf0e10cSrcweir      * During text formatting, we already store the width of the portions
103cdf0e10cSrcweir      * following the tab stop up to the decimal position. This value is
104cdf0e10cSrcweir      * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#.
105cdf0e10cSrcweir      */
106cdf0e10cSrcweir     sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir public:
SwTabDecimalPortion(const KSHORT nTabPosVal,const xub_Unicode cTab,const xub_Unicode cFillChar='\\0')109cdf0e10cSrcweir     inline SwTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab,
110cdf0e10cSrcweir                                 const xub_Unicode cFillChar = '\0' )
111cdf0e10cSrcweir          : SwTabPortion( nTabPosVal, cFillChar ),
112cdf0e10cSrcweir            mcTab(cTab),
113cdf0e10cSrcweir            mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
114cdf0e10cSrcweir 	{ SetWhichPor( POR_TABDECIMAL ); }
115cdf0e10cSrcweir 
GetTabDecimal() const116cdf0e10cSrcweir     inline xub_Unicode GetTabDecimal() const { return mcTab; }
117cdf0e10cSrcweir 
SetWidthOfPortionsUpToDecimalPosition(sal_uInt16 nNew)118cdf0e10cSrcweir     inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
119cdf0e10cSrcweir     {
120cdf0e10cSrcweir         mnWidthOfPortionsUpTpDecimalPosition = nNew;
121cdf0e10cSrcweir     }
GetWidthOfPortionsUpToDecimalPosition() const122cdf0e10cSrcweir     inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
123cdf0e10cSrcweir     {
124cdf0e10cSrcweir         return mnWidthOfPortionsUpTpDecimalPosition;
125cdf0e10cSrcweir     }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	OUTPUT_OPERATOR
128cdf0e10cSrcweir };
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 
131cdf0e10cSrcweir /*************************************************************************
132cdf0e10cSrcweir  *                  class SwAutoTabDecimalPortion
133cdf0e10cSrcweir  *************************************************************************/
134cdf0e10cSrcweir 
135cdf0e10cSrcweir class SwAutoTabDecimalPortion : public SwTabDecimalPortion
136cdf0e10cSrcweir {
137cdf0e10cSrcweir public:
SwAutoTabDecimalPortion(const KSHORT nTabPosVal,const xub_Unicode cTab,const xub_Unicode cFillChar='\\0')138cdf0e10cSrcweir     inline SwAutoTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab,
139cdf0e10cSrcweir                                     const xub_Unicode cFillChar = '\0' )
140cdf0e10cSrcweir          : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar )
141cdf0e10cSrcweir     { SetLen( 0 ); }
142cdf0e10cSrcweir     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
143cdf0e10cSrcweir };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 
146cdf0e10cSrcweir CLASSIO( SwTabPortion )
147cdf0e10cSrcweir CLASSIO( SwTabLeftPortion )
148cdf0e10cSrcweir CLASSIO( SwTabRightPortion )
149cdf0e10cSrcweir CLASSIO( SwTabCenterPortion )
150cdf0e10cSrcweir CLASSIO( SwTabDecimalPortion )
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 
153cdf0e10cSrcweir #endif
154