diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-19 22:09:17 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-07-26 15:44:43 +0200 |
commit | 48d9ab395df1b005d9595908317c843cdc007683 (patch) | |
tree | 8c93732d0fdc35533b854be35f0fece7db686952 | |
parent | c28968f2eae35cae76594fc9ef2434667c26fffe (diff) |
Resolves: #i118018# fExtChar affects only < 8 (if at all)
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index cd87f587f4..4bfba2c343 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1491,7 +1491,12 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const if( nFcPos == WW8_FC_MAX ) return nFallBackCpEnd; - bool bIsUnicode = false; + bool bIsUnicode; + if (pWw8Fib->nVersion >= 8) + bIsUnicode = false; + else + bIsUnicode = pWw8Fib->fExtChar ? true : false; + if( pPieceIter ) // Complex File ? { ULONG nOldPos = pPieceIter->GetIdx(); @@ -1514,8 +1519,7 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const } else { - if (pWw8Fib->fExtChar) - bIsUnicode=true; + bIsUnicode = pWw8Fib->fExtChar ? true : false; } INT32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1); @@ -1550,10 +1554,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const */ return nFallBackCpEnd; } - // No complex file - if (pWw8Fib->fExtChar) - bIsUnicode=true; - return ((nFcPos - pWw8Fib->fcMin) / (bIsUnicode ? 2 : 1)); + + // No complex file + if (!bIsUnicode) + nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin); + else + nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin + 1) / 2; + + return nFallBackCpEnd; } WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, @@ -1568,8 +1576,14 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, if( !pIsUnicode ) pIsUnicode = &bIsUnicode; + if (pWw8Fib->nVersion >= 8) + *pIsUnicode = false; + else + *pIsUnicode = pWw8Fib->fExtChar ? true : false; + if( pPieceIter ) - { // Complex File + { + // Complex File if( pNextPieceCp ) *pNextPieceCp = WW8_CP_MAX; @@ -1597,14 +1611,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, *pNextPieceCp = nCpEnd; WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc ); - if (8 > pWw8Fib->nVersion) - if (pWw8Fib->fExtChar) - *pIsUnicode=true; - else - *pIsUnicode = false; - else + if (pWw8Fib->nVersion >= 8) nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode ); - + else + *pIsUnicode = pWw8Fib->fExtChar ? true : false; nRet += (nCpPos - nCpStart) * (*pIsUnicode ? 2 : 1); @@ -1612,10 +1622,6 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, } // No complex file - if (pWw8Fib->fExtChar) - *pIsUnicode = true; - else - *pIsUnicode = false; return pWw8Fib->fcMin + nCpPos * (*pIsUnicode ? 2 : 1); } |