1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _PORTAB_HXX 28 #define _PORTAB_HXX 29 30 #include "porglue.hxx" 31 32 /************************************************************************* 33 * class SwTabPortion 34 *************************************************************************/ 35 36 class SwTabPortion : public SwFixPortion 37 { 38 const KSHORT nTabPos; 39 const xub_Unicode cFill; 40 41 // Das Format() verzweigt entweder in Pre- oder PostFormat() 42 sal_Bool PreFormat( SwTxtFormatInfo &rInf ); 43 public: 44 SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill = '\0' ); 45 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 46 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 47 virtual void FormatEOL( SwTxtFormatInfo &rInf ); 48 sal_Bool PostFormat( SwTxtFormatInfo &rInf ); 49 inline sal_Bool IsFilled() const { return 0 != cFill; } 50 inline KSHORT GetTabPos() const { return nTabPos; } 51 52 // Accessibility: pass information about this portion to the PortionHandler 53 virtual void HandlePortion( SwPortionHandler& rPH ) const; 54 55 OUTPUT_OPERATOR 56 }; 57 58 /************************************************************************* 59 * class SwTabLeftPortion 60 *************************************************************************/ 61 62 class SwTabLeftPortion : public SwTabPortion 63 { 64 public: 65 inline SwTabLeftPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' ) 66 : SwTabPortion( nTabPosVal, cFillChar ) 67 { SetWhichPor( POR_TABLEFT ); } 68 OUTPUT_OPERATOR 69 }; 70 71 /************************************************************************* 72 * class SwTabRightPortion 73 *************************************************************************/ 74 75 class SwTabRightPortion : public SwTabPortion 76 { 77 public: 78 inline SwTabRightPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' ) 79 : SwTabPortion( nTabPosVal, cFillChar ) 80 { SetWhichPor( POR_TABRIGHT ); } 81 OUTPUT_OPERATOR 82 }; 83 84 /************************************************************************* 85 * class SwTabCenterPortion 86 *************************************************************************/ 87 88 class SwTabCenterPortion : public SwTabPortion 89 { 90 public: 91 inline SwTabCenterPortion( const KSHORT nTabPosVal, const xub_Unicode cFillChar='\0' ) 92 : SwTabPortion( nTabPosVal, cFillChar ) 93 { SetWhichPor( POR_TABCENTER ); } 94 OUTPUT_OPERATOR 95 }; 96 97 /************************************************************************* 98 * class SwTabDecimalPortion 99 *************************************************************************/ 100 101 class SwTabDecimalPortion : public SwTabPortion 102 { 103 const xub_Unicode mcTab; 104 105 /* 106 * During text formatting, we already store the width of the portions 107 * following the tab stop up to the decimal position. This value is 108 * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#. 109 */ 110 sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition; 111 112 public: 113 inline SwTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab, 114 const xub_Unicode cFillChar = '\0' ) 115 : SwTabPortion( nTabPosVal, cFillChar ), 116 mcTab(cTab), 117 mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX ) 118 { SetWhichPor( POR_TABDECIMAL ); } 119 120 inline xub_Unicode GetTabDecimal() const { return mcTab; } 121 122 inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew ) 123 { 124 mnWidthOfPortionsUpTpDecimalPosition = nNew; 125 } 126 inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const 127 { 128 return mnWidthOfPortionsUpTpDecimalPosition; 129 } 130 131 OUTPUT_OPERATOR 132 }; 133 134 135 /************************************************************************* 136 * class SwAutoTabDecimalPortion 137 *************************************************************************/ 138 139 class SwAutoTabDecimalPortion : public SwTabDecimalPortion 140 { 141 public: 142 inline SwAutoTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab, 143 const xub_Unicode cFillChar = '\0' ) 144 : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar ) 145 { SetLen( 0 ); } 146 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 147 }; 148 149 150 CLASSIO( SwTabPortion ) 151 CLASSIO( SwTabLeftPortion ) 152 CLASSIO( SwTabRightPortion ) 153 CLASSIO( SwTabCenterPortion ) 154 CLASSIO( SwTabDecimalPortion ) 155 156 157 #endif 158