Lines 2024-2029
void SwTOXBaseSection::UpdatePageNum()
Link Here
|
2024 |
// die aktuellen Seitennummern ins Verzeichnis eintragen |
2024 |
// die aktuellen Seitennummern ins Verzeichnis eintragen |
2025 |
SwPageFrm* pAktPage = 0; |
2025 |
SwPageFrm* pAktPage = 0; |
2026 |
USHORT nPage = 0; |
2026 |
USHORT nPage = 0; |
|
|
2027 |
USHORT nPhyPage = 0; |
2027 |
SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); |
2028 |
SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); |
2028 |
|
2029 |
|
2029 |
SwTOXInternational aIntl( GetLanguage(), |
2030 |
SwTOXInternational aIntl( GetLanguage(), |
Lines 2035-2041
void SwTOXBaseSection::UpdatePageNum()
Link Here
|
2035 |
{ |
2036 |
{ |
2036 |
// Schleife ueber alle SourceNodes |
2037 |
// Schleife ueber alle SourceNodes |
2037 |
SvUShorts aNums; //Die Seitennummern |
2038 |
SvUShorts aNums; //Die Seitennummern |
|
|
2039 |
SvUShorts aPhyNums; //the physical page number, used in sorting instead of virtual pages |
2040 |
//if page restart numbering is used then this is a better way than |
2041 |
//using virtual pages |
2038 |
SvPtrarr aDescs; //Die PageDescriptoren passend zu den Seitennummern. |
2042 |
SvPtrarr aDescs; //Die PageDescriptoren passend zu den Seitennummern. |
|
|
2043 |
SvPtrarr aTOXSources; //The tox source of the page |
2039 |
SvUShorts* pMainNums = 0; // contains page numbers of main entries |
2044 |
SvUShorts* pMainNums = 0; // contains page numbers of main entries |
2040 |
|
2045 |
|
2041 |
// process run in lines |
2046 |
// process run in lines |
Lines 2087-2103
void SwTOXBaseSection::UpdatePageNum()
Link Here
|
2087 |
{ |
2092 |
{ |
2088 |
nPage = pTmpPage->GetVirtPageNum(); |
2093 |
nPage = pTmpPage->GetVirtPageNum(); |
2089 |
pAktPage = pTmpPage; |
2094 |
pAktPage = pTmpPage; |
|
|
2095 |
nPhyPage = pTmpPage->GetPhyPageNum(); |
2090 |
} |
2096 |
} |
2091 |
|
2097 |
|
|
|
2098 |
// if the page number is to be prefixed with chapter number, then |
2099 |
// sometimes the page number restarts from the chapter first page |
2100 |
// we may end up having a topic on the same virtual page |
2101 |
// but instead being on different physical page, |
2102 |
// may be even a different chapter. |
2103 |
// So we'd better use the physical page number as mean of sorting |
2104 |
// the physical page is anyway better than the virtual one since the |
2105 |
// document page flow is from physical page 1 up to the last one |
2106 |
|
2092 |
// sortiert einfuegen |
2107 |
// sortiert einfuegen |
2093 |
for( i = 0; i < aNums.Count() && aNums[i] < nPage; ++i ) |
2108 |
for( i = 0; i < aPhyNums.Count() && aPhyNums[i] < nPhyPage; ++i ) |
2094 |
; |
2109 |
; |
2095 |
|
2110 |
|
2096 |
if( i >= aNums.Count() || aNums[ i ] != nPage ) |
2111 |
if( i >= aPhyNums.Count() || aPhyNums[ i ] != nPhyPage ) |
2097 |
{ |
2112 |
{ |
|
|
2113 |
aPhyNums.Insert( nPhyPage, i ); |
2098 |
aNums.Insert( nPage, i ); |
2114 |
aNums.Insert( nPage, i ); |
2099 |
aDescs.Insert( (void*)pAktPage->GetPageDesc(), i ); |
2115 |
aDescs.Insert( (void*)pAktPage->GetPageDesc(), i ); |
|
|
2116 |
aTOXSources.Insert( (void*)&pSortBase->aTOXSources[j] , i ); |
2100 |
} |
2117 |
} |
|
|
2118 |
|
2101 |
// is it a main entry? |
2119 |
// is it a main entry? |
2102 |
if(TOX_SORT_INDEX == pSortBase->GetType() && |
2120 |
if(TOX_SORT_INDEX == pSortBase->GetType() && |
2103 |
rTOXSource.bMainEntry) |
2121 |
rTOXSource.bMainEntry) |
Lines 2116-2125
void SwTOXBaseSection::UpdatePageNum()
Link Here
|
2116 |
ASSERT( pTxtNd, "kein TextNode, falsches Verzeichnis" ); |
2134 |
ASSERT( pTxtNd, "kein TextNode, falsches Verzeichnis" ); |
2117 |
|
2135 |
|
2118 |
_UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums, |
2136 |
_UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums, |
2119 |
aIntl ); |
2137 |
aIntl, aTOXSources ); |
2120 |
} |
2138 |
} |
2121 |
DELETEZ(pMainNums); |
2139 |
DELETEZ(pMainNums); |
2122 |
aNums.Remove(0, aNums.Count()); |
2140 |
aNums.Remove(0, aNums.Count()); |
|
|
2141 |
aPhyNums.Remove(0, aPhyNums.Count()); |
2123 |
} |
2142 |
} |
2124 |
} |
2143 |
} |
2125 |
// nach dem Setzen der richtigen Seitennummer, das Mapping-Array |
2144 |
// nach dem Setzen der richtigen Seitennummer, das Mapping-Array |
Lines 2141-2151
BOOL lcl_HasMainEntry( const SvUShorts*
Link Here
|
2141 |
return FALSE; |
2160 |
return FALSE; |
2142 |
} |
2161 |
} |
2143 |
|
2162 |
|
|
|
2163 |
/* i53420 |
2164 |
* add the string representation of the current chapter number, |
2165 |
* do nothing if no representation available or no chapter numbering scheme used |
2166 |
*/ |
2167 |
static void lcl_GetChapterString( const SwTOXSource* pTOXSource,//where the chapter data comes from |
2168 |
String& sToAdd )//the string to add the chapter, if necessary |
2169 |
{ |
2170 |
if( pTOXSource && pTOXSource->pNd) |
2171 |
{ |
2172 |
//pTOXSource->pNd is the node cntaining the object being indexed |
2173 |
//be it text or frame or whatever |
2174 |
const SwCntntFrm* pFrm = pTOXSource->pNd->GetFrm(); |
2175 |
if( pFrm ) |
2176 |
{ |
2177 |
SwChapterFieldType aFldTyp; |
2178 |
SwChapterField aFld( &aFldTyp,CF_NUMBER ); |
2179 |
aFld.SetLevel( 0 ); |
2180 |
// the following call works even if the 2nd parameter |
2181 |
// if not a text node, e.g. an object node |
2182 |
aFld.ChangeExpansion( pFrm, (SwTxtNode*)pTOXSource->pNd, TRUE ); |
2183 |
String sChapter( aFld.GetNumber() ); |
2184 |
if( sChapter.Len() > 0 ) |
2185 |
{ |
2186 |
sToAdd += aFld.GetNumber(); |
2187 |
sToAdd += '-'; // this is fixed hyphen, |
2188 |
//can be of course changed to a customizable string |
2189 |
//is needed |
2190 |
} |
2191 |
} |
2192 |
} |
2193 |
} |
2194 |
|
2144 |
void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, |
2195 |
void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, |
2145 |
const SvUShorts& rNums, |
2196 |
const SvUShorts& rNums, |
2146 |
const SvPtrarr & rDescs, |
2197 |
const SvPtrarr & rDescs, |
2147 |
const SvUShorts* pMainEntryNums, |
2198 |
const SvUShorts* pMainEntryNums, |
2148 |
const SwTOXInternational& rIntl ) |
2199 |
const SwTOXInternational& rIntl, |
|
|
2200 |
const SvPtrarr & rTOXSources ) |
2149 |
{ |
2201 |
{ |
2150 |
//collect starts end ends of main entry character style |
2202 |
//collect starts end ends of main entry character style |
2151 |
SvUShorts* pCharStyleIdx = pMainEntryNums ? new SvUShorts : 0; |
2203 |
SvUShorts* pCharStyleIdx = pMainEntryNums ? new SvUShorts : 0; |
Lines 2166-2173
void SwTOXBaseSection::_UpdatePageNum( S
Link Here
|
2166 |
USHORT nOld = rNums[0], |
2218 |
USHORT nOld = rNums[0], |
2167 |
nBeg = nOld, |
2219 |
nBeg = nOld, |
2168 |
nCount = 0; |
2220 |
nCount = 0; |
2169 |
String aNumStr( SvxNumberType( ((SwPageDesc*)rDescs[0])->GetNumType() ). |
2221 |
//i53420 |
2170 |
GetNumStr( nBeg ) ); |
2222 |
String aNumStr; |
|
|
2223 |
BOOL bIsPrefixed = GetTOXForm().IsPrefixPageNum(); |
2224 |
if( bIsPrefixed ) |
2225 |
lcl_GetChapterString( (SwTOXSource*)rTOXSources[0], aNumStr ); |
2226 |
aNumStr += SvxNumberType( ((SwPageDesc*)rDescs[0])->GetNumType() ).GetNumStr( nBeg ); |
2227 |
|
2171 |
if( pCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg )) |
2228 |
if( pCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg )) |
2172 |
{ |
2229 |
{ |
2173 |
USHORT nTemp = 0; |
2230 |
USHORT nTemp = 0; |
Lines 2223-2229
void SwTOXBaseSection::_UpdatePageNum( S
Link Here
|
2223 |
aNumStr.AppendAscii( sPageDeli ); |
2280 |
aNumStr.AppendAscii( sPageDeli ); |
2224 |
//#58127# Wenn nCount == 0, dann steht die einzige Seitenzahl schon im aNumStr! |
2281 |
//#58127# Wenn nCount == 0, dann steht die einzige Seitenzahl schon im aNumStr! |
2225 |
if(nCount) |
2282 |
if(nCount) |
|
|
2283 |
{ |
2284 |
//i53420 prefix the chapter, if needed |
2285 |
if( bIsPrefixed ) |
2286 |
lcl_GetChapterString( (SwTOXSource*)rTOXSources[i], aNumStr ); |
2226 |
aNumStr += aType.GetNumStr( nBeg + nCount ); |
2287 |
aNumStr += aType.GetNumStr( nBeg + nCount ); |
|
|
2288 |
} |
2227 |
} |
2289 |
} |
2228 |
|
2290 |
|
2229 |
// neuen String anlegen |
2291 |
// neuen String anlegen |
Lines 2233-2238
void SwTOXBaseSection::_UpdatePageNum( S
Link Here
|
2233 |
if(pCharStyleIdx && bMainEntryChanges) |
2295 |
if(pCharStyleIdx && bMainEntryChanges) |
2234 |
pCharStyleIdx->Insert(aNumStr.Len(), |
2296 |
pCharStyleIdx->Insert(aNumStr.Len(), |
2235 |
pCharStyleIdx->Count()); |
2297 |
pCharStyleIdx->Count()); |
|
|
2298 |
//i53420 prefix the chapter, if needed |
2299 |
if( bIsPrefixed ) |
2300 |
lcl_GetChapterString( (SwTOXSource *)rTOXSources[i], aNumStr ); |
2236 |
aNumStr += aType.GetNumStr( nBeg ); |
2301 |
aNumStr += aType.GetNumStr( nBeg ); |
2237 |
nCount = 0; |
2302 |
nCount = 0; |
2238 |
} |
2303 |
} |
Lines 2240-2245
void SwTOXBaseSection::_UpdatePageNum( S
Link Here
|
2240 |
} |
2305 |
} |
2241 |
else |
2306 |
else |
2242 |
{ // Alle Nummern eintragen |
2307 |
{ // Alle Nummern eintragen |
|
|
2308 |
//i53420 prefix the chapter, if needed |
2309 |
if( bIsPrefixed ) |
2310 |
lcl_GetChapterString( (SwTOXSource *)rTOXSources[i], aNumStr ); |
2243 |
aNumStr += aType.GetNumStr( USHORT(rNums[i]) ); |
2311 |
aNumStr += aType.GetNumStr( USHORT(rNums[i]) ); |
2244 |
if(i != (rNums.Count()-1)) |
2312 |
if(i != (rNums.Count()-1)) |
2245 |
aNumStr.AppendAscii( sPageDeli ); |
2313 |
aNumStr.AppendAscii( sPageDeli ); |
Lines 2261-2268
void SwTOXBaseSection::_UpdatePageNum( S
Link Here
|
2261 |
aNumStr.AppendAscii( sPageDeli ); |
2329 |
aNumStr.AppendAscii( sPageDeli ); |
2262 |
//#58127# Wenn nCount == 0, dann steht die einzige Seitenzahl schon im aNumStr! |
2330 |
//#58127# Wenn nCount == 0, dann steht die einzige Seitenzahl schon im aNumStr! |
2263 |
if(nCount) |
2331 |
if(nCount) |
|
|
2332 |
{ |
2333 |
//i53420 prefix the chapter, if needed |
2334 |
if( bIsPrefixed ) |
2335 |
lcl_GetChapterString( (SwTOXSource*)rTOXSources[i-1], aNumStr ); |
2264 |
aNumStr += SvxNumberType( ((SwPageDesc*)rDescs[i-1])-> |
2336 |
aNumStr += SvxNumberType( ((SwPageDesc*)rDescs[i-1])-> |
2265 |
GetNumType() ).GetNumStr( nBeg+nCount ); |
2337 |
GetNumType() ).GetNumStr( nBeg+nCount ); |
|
|
2338 |
} |
2266 |
} |
2339 |
} |
2267 |
} |
2340 |
} |
2268 |
pNd->Insert( aNumStr, aPos, INS_EMPTYEXPAND ); |
2341 |
pNd->Insert( aNumStr, aPos, INS_EMPTYEXPAND ); |
Lines 2272-2278
void SwTOXBaseSection::_UpdatePageNum( S
Link Here
|
2272 |
pNd->InsertItem(aCharFmt, nStartPos, nStartPos + aNumStr.Len(), SETATTR_DONTEXPAND); |
2345 |
pNd->InsertItem(aCharFmt, nStartPos, nStartPos + aNumStr.Len(), SETATTR_DONTEXPAND); |
2273 |
} |
2346 |
} |
2274 |
|
2347 |
|
2275 |
//now the main entries should get there character style |
2348 |
//now the main entries should get their character style |
2276 |
if(pCharStyleIdx && pCharStyleIdx->Count() && GetMainEntryCharStyle().Len()) |
2349 |
if(pCharStyleIdx && pCharStyleIdx->Count() && GetMainEntryCharStyle().Len()) |
2277 |
{ |
2350 |
{ |
2278 |
// eventually the last index must me appended |
2351 |
// eventually the last index must me appended |