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