[PATCH 5/5] Remove compression svArray usage from SwScriptInfo
Nigel Hawkins
n.hawkins at gmx.com
Tue Feb 8 08:12:13 PST 2011
---
sw/source/core/inc/scriptinfo.hxx | 26 ++++++++++++++++----------
sw/source/core/text/porlay.cxx | 15 +++------------
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index f8cf486..4a70226 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -121,10 +121,16 @@ private:
SvXub_StrLens aKashidaInvalid;
SvXub_StrLens aNoKashidaLine;
SvXub_StrLens aNoKashidaLineEnd;
- SvXub_StrLens aCompChg;
- SvXub_StrLens aCompLen;
SvXub_StrLens aHiddenChg;
- SvBytes aCompType;
+ //! Records a single change in compression.
+ struct CompressionChangeInfo
+ {
+ xub_StrLen position; //!< Character position where the change occurs.
+ xub_StrLen length; //!< Length of the segment.
+ BYTE type; //!< Type of compression that we change to.
+ inline CompressionChangeInfo(xub_StrLen pos, xub_StrLen len, BYTE typ) : position(pos), length(len), type(typ) {};
+ };
+ std::vector<CompressionChangeInfo> aCompressionChanges;
xub_StrLen nInvalidityPos;
BYTE nDefaultDir;
@@ -403,22 +409,22 @@ inline xub_StrLen SwScriptInfo::GetKashida( const USHORT nCnt ) const
return aKashida[ nCnt ];
}
-inline USHORT SwScriptInfo::CountCompChg() const { return aCompChg.Count(); };
+inline USHORT SwScriptInfo::CountCompChg() const { return aCompressionChanges.size(); };
inline xub_StrLen SwScriptInfo::GetCompStart( const USHORT nCnt ) const
{
- OSL_ENSURE( nCnt < aCompChg.Count(),"No CompressionStart today!");
- return aCompChg[ nCnt ];
+ OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionStart today!");
+ return aCompressionChanges[ nCnt ].position;
}
inline xub_StrLen SwScriptInfo::GetCompLen( const USHORT nCnt ) const
{
- OSL_ENSURE( nCnt < aCompChg.Count(),"No CompressionLen today!");
- return aCompLen[ nCnt ];
+ OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionLen today!");
+ return aCompressionChanges[ nCnt ].length;
}
inline BYTE SwScriptInfo::GetCompType( const USHORT nCnt ) const
{
- OSL_ENSURE( nCnt < aCompChg.Count(),"No CompressionType today!");
- return aCompType[ nCnt ];
+ OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionType today!");
+ return aCompressionChanges[ nCnt ].type;
}
inline USHORT SwScriptInfo::CountHiddenChg() const { return aHiddenChg.Count(); };
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index b7db718..8ca3535 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -931,10 +931,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
}
// remove invalid entries from compression information arrays
- const USHORT nCompRemove = aCompChg.Count() - nCntComp;
- aCompChg.Remove( nCntComp, nCompRemove );
- aCompLen.Remove( nCntComp, nCompRemove );
- aCompType.Remove( nCntComp, nCompRemove );
+ aCompressionChanges.erase(aCompressionChanges.begin() + nCntComp, aCompressionChanges.end() );
// get the start of the last kashida group
USHORT nLastKashida = nChg;
@@ -1085,10 +1082,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
ePrevState != KANA )
{
- aCompChg.Insert( nPrevChg, nCntComp );
- BYTE nTmpType = ePrevState;
- aCompType.Insert( nTmpType, nCntComp );
- aCompLen.Insert( nLastCompression - nPrevChg, nCntComp++ );
+ aCompressionChanges.push_back( CompressionChangeInfo(nPrevChg, nLastCompression - nPrevChg, ePrevState) );
}
}
@@ -1106,10 +1100,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
ePrevState != KANA )
{
- aCompChg.Insert( nPrevChg, nCntComp );
- BYTE nTmpType = ePrevState;
- aCompType.Insert( nTmpType, nCntComp );
- aCompLen.Insert( nLastCompression - nPrevChg, nCntComp++ );
+ aCompressionChanges.push_back( CompressionChangeInfo(nPrevChg, nLastCompression - nPrevChg, ePrevState) );
}
}
}
--
1.7.0.4
--=-0Mu99rNXtMDkVYeh9ZQR--
More information about the LibreOffice
mailing list