View | Details | Raw Unified | Return to issue 120759
Collapse All | Expand All

(-)sw/source/core/fields/chpfld.cxx (-10 / +29 lines)
Lines 138-143 Link Here
138
138
139
void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
139
void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
140
{
140
{
141
	//i120759,this function is for both the reference chapter field and normal chapter field
142
	//bSrchNum can distinguish the two types,to the latter type,the outline num rule is must...
143
	sNumber = aEmptyStr;
144
	sTitle = aEmptyStr;
145
	sPost = aEmptyStr;
146
	sPre = aEmptyStr;
147
	//The reference chapter field of normal num rule will be handled in this code segment
148
	if (bSrchNum && !rTxtNd.IsOutline())
149
	{
150
		SwNumRule* pRule(rTxtNd.GetNumRule());
151
		if (rTxtNd.IsCountedInList() && pRule)
152
		{
153
			sNumber = rTxtNd.GetNumString(false);
154
			const SwNumFmt& rNFmt = pRule->Get(static_cast<unsigned short>(rTxtNd.GetActualListLevel()));
155
			sPost = rNFmt.GetSuffix();
156
			sPre = rNFmt.GetPrefix();
157
		}
158
		else
159
		{			
160
			sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
161
		}
162
		sTitle = rTxtNd.GetExpandTxt();
163
164
		for( xub_StrLen i = 0; i < sTitle.Len(); ++i )
165
			if( ' ' > sTitle.GetChar( i ) )
166
				sTitle.Erase( i--, 1 );	
167
	}else
168
	{
169
	//End
141
	SwDoc* pDoc = (SwDoc*)rTxtNd.GetDoc();
170
	SwDoc* pDoc = (SwDoc*)rTxtNd.GetDoc();
142
	const SwTxtNode *pTxtNd = rTxtNd.FindOutlineNodeOfLevel( nLevel );
171
	const SwTxtNode *pTxtNd = rTxtNd.FindOutlineNodeOfLevel( nLevel );
143
	if( pTxtNd )
172
	if( pTxtNd )
Lines 197-209 Link Here
197
                sPost = rNFmt.GetSuffix();
226
                sPost = rNFmt.GetSuffix();
198
                sPre = rNFmt.GetPrefix();
227
                sPre = rNFmt.GetPrefix();
199
            }
228
            }
200
            else
201
                sPost = aEmptyStr, sPre = aEmptyStr;
202
        }
229
        }
203
        else
230
        else
204
        {
231
        {
205
            sPost = aEmptyStr;
206
            sPre = aEmptyStr;
207
            sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
232
            sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
208
        }
233
        }
209
234
Lines 213-224 Link Here
213
			if( ' ' > sTitle.GetChar( i ) )
238
			if( ' ' > sTitle.GetChar( i ) )
214
				sTitle.Erase( i--, 1 );
239
				sTitle.Erase( i--, 1 );
215
	}
240
	}
216
	else
217
	{
218
		sNumber = aEmptyStr;
219
		sTitle = aEmptyStr;
220
		sPost = aEmptyStr;
221
		sPre = aEmptyStr;
222
	}
241
	}
223
}
242
}
224
243

Return to issue 120759