1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: portab.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include "porglue.hxx"
35 /*************************************************************************
37 *************************************************************************/
39 class SwTabPortion
: public SwFixPortion
42 const xub_Unicode cFill
;
44 // Das Format() verzweigt entweder in Pre- oder PostFormat()
45 sal_Bool
PreFormat( SwTxtFormatInfo
&rInf
);
47 SwTabPortion( const KSHORT nTabPos
, const xub_Unicode cFill
= '\0' );
48 virtual void Paint( const SwTxtPaintInfo
&rInf
) const;
49 virtual sal_Bool
Format( SwTxtFormatInfo
&rInf
);
50 virtual void FormatEOL( SwTxtFormatInfo
&rInf
);
51 sal_Bool
PostFormat( SwTxtFormatInfo
&rInf
);
52 inline sal_Bool
IsFilled() const { return 0 != cFill
; }
53 inline KSHORT
GetTabPos() const { return nTabPos
; }
55 // Accessibility: pass information about this portion to the PortionHandler
56 virtual void HandlePortion( SwPortionHandler
& rPH
) const;
61 /*************************************************************************
62 * class SwTabLeftPortion
63 *************************************************************************/
65 class SwTabLeftPortion
: public SwTabPortion
68 inline SwTabLeftPortion( const KSHORT nTabPosVal
, const xub_Unicode cFillChar
='\0' )
69 : SwTabPortion( nTabPosVal
, cFillChar
)
70 { SetWhichPor( POR_TABLEFT
); }
74 /*************************************************************************
75 * class SwTabRightPortion
76 *************************************************************************/
78 class SwTabRightPortion
: public SwTabPortion
81 inline SwTabRightPortion( const KSHORT nTabPosVal
, const xub_Unicode cFillChar
='\0' )
82 : SwTabPortion( nTabPosVal
, cFillChar
)
83 { SetWhichPor( POR_TABRIGHT
); }
87 /*************************************************************************
88 * class SwTabCenterPortion
89 *************************************************************************/
91 class SwTabCenterPortion
: public SwTabPortion
94 inline SwTabCenterPortion( const KSHORT nTabPosVal
, const xub_Unicode cFillChar
='\0' )
95 : SwTabPortion( nTabPosVal
, cFillChar
)
96 { SetWhichPor( POR_TABCENTER
); }
100 /*************************************************************************
101 * class SwTabDecimalPortion
102 *************************************************************************/
104 class SwTabDecimalPortion
: public SwTabPortion
106 const xub_Unicode mcTab
;
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#.
113 USHORT mnWidthOfPortionsUpTpDecimalPosition
;
116 inline SwTabDecimalPortion( const KSHORT nTabPosVal
, const xub_Unicode cTab
,
117 const xub_Unicode cFillChar
= '\0' )
118 : SwTabPortion( nTabPosVal
, cFillChar
),
120 mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX
)
121 { SetWhichPor( POR_TABDECIMAL
); }
123 inline xub_Unicode
GetTabDecimal() const { return mcTab
; }
125 inline void SetWidthOfPortionsUpToDecimalPosition( USHORT nNew
)
127 mnWidthOfPortionsUpTpDecimalPosition
= nNew
;
129 inline USHORT
GetWidthOfPortionsUpToDecimalPosition() const
131 return mnWidthOfPortionsUpTpDecimalPosition
;
138 /*************************************************************************
139 * class SwAutoTabDecimalPortion
140 *************************************************************************/
142 class SwAutoTabDecimalPortion
: public SwTabDecimalPortion
145 inline SwAutoTabDecimalPortion( const KSHORT nTabPosVal
, const xub_Unicode cTab
,
146 const xub_Unicode cFillChar
= '\0' )
147 : SwTabDecimalPortion( nTabPosVal
, cTab
, cFillChar
)
149 virtual void Paint( const SwTxtPaintInfo
&rInf
) const;
153 CLASSIO( SwTabPortion
)
154 CLASSIO( SwTabLeftPortion
)
155 CLASSIO( SwTabRightPortion
)
156 CLASSIO( SwTabCenterPortion
)
157 CLASSIO( SwTabDecimalPortion
)