Lines 67-97
Link Here
|
67 |
* SwLineInfo::GetTabStop() |
67 |
* SwLineInfo::GetTabStop() |
68 |
*************************************************************************/ |
68 |
*************************************************************************/ |
69 |
|
69 |
|
70 |
/* Die Werte in SvxTabStop::nTabPos liegen immer relativ zum linken PrtRand |
70 |
//#i24363# tab stops relative to indent |
71 |
* vor. Tabs, die im Bereich des Erstzeileneinzugs liegen, sind also negativ. |
71 |
/* Return the first tab stop that is > nSearchPos. |
72 |
* nLeft ist der linke PrtRand |
72 |
* If the tab stop is outside the print area, we |
73 |
* nRight ist der rechte PrtRand |
73 |
* return 0 if it is not the first tab stop.*/ |
74 |
* nLinePos die aktuelle Position. |
74 |
const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos, |
75 |
* Es wird der erste Tabstop returnt, der groesser ist als nLinePos. |
75 |
const SwTwips nRight ) const |
76 |
*/ |
|
|
77 |
|
78 |
const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nLinePos, |
79 |
const SwTwips nLeft, const SwTwips nRight ) const |
80 |
{ |
76 |
{ |
81 |
// Mit den KSHORTs aufpassen, falls nLinePos < nLeft |
77 |
// Mit den KSHORTs aufpassen, falls nLinePos < nLeft |
82 |
SwTwips nPos = nLinePos; |
|
|
83 |
nPos -= nLeft; |
84 |
for( MSHORT i = 0; i < pRuler->Count(); ++i ) |
78 |
for( MSHORT i = 0; i < pRuler->Count(); ++i ) |
85 |
{ |
79 |
{ |
86 |
const SvxTabStop &rTabStop = pRuler->operator[](i); |
80 |
const SvxTabStop &rTabStop = pRuler->operator[](i); |
87 |
if( rTabStop.GetTabPos() > SwTwips(nRight) ) |
81 |
if( rTabStop.GetTabPos() > SwTwips(nRight) ) |
88 |
{ |
82 |
return i ? 0 : &rTabStop; |
89 |
if ( i ) |
83 |
|
90 |
return 0; |
84 |
if( rTabStop.GetTabPos() > nSearchPos ) |
91 |
else |
|
|
92 |
return &rTabStop; |
93 |
} |
94 |
if( rTabStop.GetTabPos() > nPos ) |
95 |
return &rTabStop; |
85 |
return &rTabStop; |
96 |
} |
86 |
} |
97 |
return 0; |
87 |
return 0; |
Lines 118-149
Link Here
|
118 |
if( pLastTab->PostFormat( rInf ) ) |
108 |
if( pLastTab->PostFormat( rInf ) ) |
119 |
return 0; |
109 |
return 0; |
120 |
|
110 |
|
121 |
// Wir suchen den naechsten Tab. Wenn gerade ein rechts-Tab unterwegs |
|
|
122 |
// ist, so koennen wir uns nicht auf rInf.X() beziehen. |
123 |
SwTwips nTabPos = rInf.GetLastTab() ? rInf.GetLastTab()->GetTabPos() : 0; |
124 |
if( nTabPos < rInf.X() ) |
125 |
nTabPos = rInf.X(); |
126 |
|
127 |
xub_Unicode cFill = 0; |
111 |
xub_Unicode cFill = 0; |
128 |
xub_Unicode cDec = 0; |
112 |
xub_Unicode cDec = 0; |
129 |
SvxTabAdjust eAdj; |
113 |
SvxTabAdjust eAdj; |
130 |
|
114 |
|
131 |
KSHORT nNewTabPos; |
115 |
KSHORT nNewTabPos; |
132 |
{ |
116 |
{ |
133 |
/* |
117 |
const bool bRTL = pFrm->IsRightToLeft(); |
134 |
nPos ist der Offset in der Zeile. |
118 |
// #i24363# tab stops relative to indent |
135 |
Die Tabulatoren haben ihren 0-Punkt bei Frm().Left(). |
119 |
// nTabLeft: The absolute value, the tab stops are relative to: Tabs origin. |
136 |
Die Zeilen beginnen ab Frm.Left() + Prt.Left(). |
120 |
// |
137 |
In dieser Methode wird zwischen beiden Koordinatensystemen |
121 |
const SwTwips nTmpIndent = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ? |
138 |
konvertiert (vgl. rInf.GetTabPos). |
122 |
pFrm->GetAttrSet()->GetLRSpace().GetTxtLeft() : 0; |
139 |
*/ |
123 |
|
140 |
const SwTwips nTabLeft = pFrm->Frm().Left() + |
124 |
const SwTwips nTabLeft = bRTL ? |
141 |
( pFrm->IsRightToLeft() ? |
125 |
pFrm->Frm().Right() - |
142 |
pFrm->GetAttrSet()->GetLRSpace().GetRight() : |
126 |
nTmpIndent : |
143 |
pFrm->GetAttrSet()->GetLRSpace().GetTxtLeft() ); |
127 |
pFrm->Frm().Left() + |
|
|
128 |
nTmpIndent; |
129 |
|
130 |
// |
131 |
// nLinePos: The absolute position, where we started the line formatting. |
132 |
// |
133 |
SwTwips nLinePos = GetLeftMargin(); |
134 |
if ( bRTL ) |
135 |
{ |
136 |
Point aPoint( nLinePos, 0 ); |
137 |
pFrm->SwitchLTRtoRTL( aPoint ); |
138 |
nLinePos = aPoint.X(); |
139 |
} |
140 |
|
141 |
// |
142 |
// nTabPos: The current position, relative to the line start. |
143 |
// |
144 |
SwTwips nTabPos = rInf.GetLastTab() ? rInf.GetLastTab()->GetTabPos() : 0; |
145 |
if( nTabPos < rInf.X() ) |
146 |
nTabPos = rInf.X(); |
147 |
|
148 |
// |
149 |
// nCurrentAbsPos: The current position in absolute coordinates. |
150 |
// |
151 |
const SwTwips nCurrentAbsPos = bRTL ? |
152 |
nLinePos - nTabPos : |
153 |
nLinePos + nTabPos; |
144 |
|
154 |
|
145 |
const SwTwips nLinePos = GetLeftMargin(); |
|
|
146 |
const SwTwips nLineTab = nLinePos + nTabPos; |
147 |
SwTwips nMyRight = Right(); |
155 |
SwTwips nMyRight = Right(); |
148 |
|
156 |
|
149 |
if ( pFrm->IsVertical() ) |
157 |
if ( pFrm->IsVertical() ) |
Lines 154-159
Link Here
|
154 |
} |
162 |
} |
155 |
|
163 |
|
156 |
SwTwips nNextPos; |
164 |
SwTwips nNextPos; |
|
|
165 |
|
166 |
// #i24363# tab stops relative to indent |
167 |
// nSearchPos: The current position relative to the tabs origin. |
168 |
// |
169 |
const SwTwips nSearchPos = bRTL ? |
170 |
nTabLeft - nCurrentAbsPos : |
171 |
nCurrentAbsPos - nTabLeft; |
172 |
|
157 |
// |
173 |
// |
158 |
// First, we examine the tab stops set at the paragraph style or |
174 |
// First, we examine the tab stops set at the paragraph style or |
159 |
// any hard set tab stops: |
175 |
// any hard set tab stops: |
Lines 161-167
Link Here
|
161 |
// default tab stop. |
177 |
// default tab stop. |
162 |
// |
178 |
// |
163 |
const SvxTabStop* pTabStop = |
179 |
const SvxTabStop* pTabStop = |
164 |
aLineInf.GetTabStop( nLineTab, nTabLeft, nMyRight ); |
180 |
aLineInf.GetTabStop( nSearchPos, nMyRight ); |
165 |
if( pTabStop ) |
181 |
if( pTabStop ) |
166 |
{ |
182 |
{ |
167 |
cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0; |
183 |
cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0; |
Lines 183-190
Link Here
|
183 |
nDefTabDist = SVX_TAB_DEFDIST; |
199 |
nDefTabDist = SVX_TAB_DEFDIST; |
184 |
aLineInf.SetDefTabStop( nDefTabDist ); |
200 |
aLineInf.SetDefTabStop( nDefTabDist ); |
185 |
} |
201 |
} |
186 |
SwTwips nCount = nLineTab; |
202 |
SwTwips nCount = nSearchPos; |
187 |
nCount -= nTabLeft; |
|
|
188 |
|
203 |
|
189 |
// Bei negativen Werten rundet "/" auf, "%" liefert negative Reste, |
204 |
// Bei negativen Werten rundet "/" auf, "%" liefert negative Reste, |
190 |
// bei positiven Werten rundet "/" ab, "%" liefert positvie Reste! |
205 |
// bei positiven Werten rundet "/" ab, "%" liefert positvie Reste! |
Lines 196-202
Link Here
|
196 |
// --> FME 2004-09-21 #117919 Minimum tab stop width is 1 or 51 twips: |
211 |
// --> FME 2004-09-21 #117919 Minimum tab stop width is 1 or 51 twips: |
197 |
const SwTwips nMinimumTabWidth = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) ? 0 : 50; |
212 |
const SwTwips nMinimumTabWidth = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) ? 0 : 50; |
198 |
// <-- |
213 |
// <-- |
199 |
if( nNextPos + nTabLeft <= nLineTab + nMinimumTabWidth ) |
214 |
if( ( bRTL && nTabLeft - nNextPos >= nCurrentAbsPos - nMinimumTabWidth ) || |
|
|
215 |
( !bRTL && nNextPos + nTabLeft <= nCurrentAbsPos + nMinimumTabWidth ) ) |
200 |
nNextPos += nDefTabDist; |
216 |
nNextPos += nDefTabDist; |
201 |
cFill = 0; |
217 |
cFill = 0; |
202 |
eAdj = SVX_TAB_ADJUST_LEFT; |
218 |
eAdj = SVX_TAB_ADJUST_LEFT; |
Lines 210-223
Link Here
|
210 |
if( pPor ) |
226 |
if( pPor ) |
211 |
nForced = pPor->Width(); |
227 |
nForced = pPor->Width(); |
212 |
} |
228 |
} |
213 |
if( nTabLeft + nForced > nLineTab && nNextPos > 0 ) |
229 |
|
|
|
230 |
if( nNextPos > 0 && |
231 |
( bRTL && nTabLeft - nForced < nCurrentAbsPos || |
232 |
!bRTL && nTabLeft + nForced > nCurrentAbsPos ) ) |
214 |
{ |
233 |
{ |
215 |
eAdj = SVX_TAB_ADJUST_DEFAULT; |
234 |
eAdj = SVX_TAB_ADJUST_DEFAULT; |
216 |
cFill = 0; |
235 |
cFill = 0; |
217 |
nNextPos = nForced; |
236 |
nNextPos = nForced; |
218 |
} |
237 |
} |
219 |
nNextPos += nTabLeft; |
238 |
nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos; |
220 |
nNextPos -= nLinePos; |
|
|
221 |
ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" ); |
239 |
ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" ); |
222 |
nNewTabPos = KSHORT(nNextPos); |
240 |
nNewTabPos = KSHORT(nNextPos); |
223 |
} |
241 |
} |