diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-09-03 08:35:32 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-09-06 12:12:31 +0200 |
commit | bce2c9d473dde0114d81d15a6fb217ae71669092 (patch) | |
tree | fceef22532b719a0a3a4af455d729779866194a5 /sw | |
parent | 6f8a26668e559f3fd4c7699c3ff7acfa3f8f604c (diff) |
Reduce scope and avoid casts at each call-place
Change-Id: Iade7f5e174b74ea156c0e0bafc5c7c72e4b86dbd
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/guess.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/text/inftxt.hxx | 13 | ||||
-rw-r--r-- | sw/source/core/text/itradj.cxx | 8 |
3 files changed, 14 insertions, 13 deletions
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 3bc0a0f2ec0f..95feb445d2d9 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -136,7 +136,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // save maximum width for later use if ( nMaxSizeDiff ) - rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff ); + rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff ); nBreakWidth += nLeftRightBorderSpace; @@ -188,7 +188,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // save maximum width for later use if ( nMaxSizeDiff ) - rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff ); + rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff ); nBreakWidth += nLeftRightBorderSpace; @@ -508,7 +508,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // save maximum width for later use if ( nMaxSizeDiff ) - rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff ); + rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff ); nBreakWidth += nItalic + nLeftRightBorderSpace; } diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index d04e59b6a67a..2307627a7c6d 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -140,10 +140,11 @@ public: friend SvStream & WriteSwTxtInfo( SvStream &rOS, const SwTxtInfo &rInf ); }; -typedef ::std::map< sal_uLong, sal_IntPtr > SwTxtPortionMap; - class SwTxtSizeInfo : public SwTxtInfo { +private: + typedef ::std::map< sal_uIntPtr, sal_uInt16 > SwTxtPortionMap; + protected: // during formatting, a small database is built, mapping portion pointers // to their maximum size (used for kana compression) @@ -337,13 +338,13 @@ public: // space among compressed kanas. // During formatting, the maximum values of compressable portions are // stored in m_aMaxWidth and discarded after a line has been formatted. - inline void SetMaxWidthDiff( sal_uLong nKey, sal_uInt16 nVal ) + inline void SetMaxWidthDiff( const void *nKey, sal_uInt16 nVal ) { - m_aMaxWidth.insert( ::std::make_pair( nKey, nVal ) ); + m_aMaxWidth.insert( ::std::make_pair( reinterpret_cast<sal_uIntPtr>(nKey), nVal ) ); }; - inline sal_uInt16 GetMaxWidthDiff( sal_uLong nKey ) + inline sal_uInt16 GetMaxWidthDiff( const void *nKey ) { - SwTxtPortionMap::iterator it = m_aMaxWidth.find( nKey ); + SwTxtPortionMap::iterator it = m_aMaxWidth.find( reinterpret_cast<sal_uIntPtr>(nKey) ); if( it != m_aMaxWidth.end() ) return it->second; diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index dc30c603ed18..b2af4d626a75 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -421,11 +421,11 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) { // get maximum portion width from info structure, calculated // during text formatting - sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pPos ); + sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pPos ); // check, if information is stored under other key if ( !nMaxWidthDiff && pPos == pCurrent->GetFirstPortion() ) - nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pCurrent ); + nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pCurrent ); // calculate difference between portion width and max. width nKanaDiffSum += nMaxWidthDiff; @@ -501,11 +501,11 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) // get maximum portion width from info structure, calculated // during text formatting - sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pPos ); + sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pPos ); // check, if information is stored under other key if ( !nMaxWidthDiff && pPos == pCurrent->GetFirstPortion() ) - nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pCurrent ); + nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pCurrent ); nKanaDiffSum += nMaxWidthDiff; pPos->Width( nMinWidth + ( ( 10000 - nCompress ) * nMaxWidthDiff ) / 10000 ); |