summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/inc/richstring.hxx15
-rw-r--r--sc/source/filter/oox/richstring.cxx20
2 files changed, 23 insertions, 12 deletions
diff --git a/sc/source/filter/inc/richstring.hxx b/sc/source/filter/inc/richstring.hxx
index 229dd6f1cbab..9f15aab0470f 100644
--- a/sc/source/filter/inc/richstring.hxx
+++ b/sc/source/filter/inc/richstring.hxx
@@ -203,15 +203,26 @@ struct PhoneticPortionModel
};
/** A vector with all phonetic portions in a rich-string. */
-class PhoneticPortionModelList : public ::std::vector< PhoneticPortionModel >
+class PhoneticPortionModelList
{
public:
- inline explicit PhoneticPortionModelList() {}
+ inline explicit PhoneticPortionModelList() : mvModels() {}
+
+ bool empty() const { return mvModels.empty(); }
+
+ const PhoneticPortionModel& back() const { return mvModels.back(); }
+
+ void push_back(const PhoneticPortionModel& rModel) { mvModels.push_back(rModel); }
+
+ ::std::vector< PhoneticPortionModel >::const_iterator begin() const { return mvModels.begin(); }
/** Appends a rich-string phonetic portion. */
void appendPortion( const PhoneticPortionModel& rPortion );
/** Reads all phonetic portions from the passed stream. */
void importPortions( SequenceInputStream& rStrm );
+
+private:
+ ::std::vector< PhoneticPortionModel > mvModels;
};
/** Contains string data and a list of formatting runs for a rich formatted string. */
diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx
index 4cbc6eb24b79..0480c596f558 100644
--- a/sc/source/filter/oox/richstring.cxx
+++ b/sc/source/filter/oox/richstring.cxx
@@ -269,27 +269,27 @@ void PhoneticPortionModel::read( SequenceInputStream& rStrm )
void PhoneticPortionModelList::appendPortion( const PhoneticPortionModel& rPortion )
{
// same character index may occur several times
- OSL_ENSURE( empty() || ((back().mnPos <= rPortion.mnPos) &&
- (back().mnBasePos + back().mnBaseLen <= rPortion.mnBasePos)),
+ OSL_ENSURE( mvModels.empty() || ((mvModels.back().mnPos <= rPortion.mnPos) &&
+ (mvModels.back().mnBasePos + mvModels.back().mnBaseLen <= rPortion.mnBasePos)),
"PhoneticPortionModelList::appendPortion - wrong char order" );
- if( empty() || (back().mnPos < rPortion.mnPos) )
+ if( mvModels.empty() || (mvModels.back().mnPos < rPortion.mnPos) )
{
- push_back( rPortion );
+ mvModels.push_back( rPortion );
}
- else if( back().mnPos == rPortion.mnPos )
+ else if( mvModels.back().mnPos == rPortion.mnPos )
{
- back().mnBasePos = rPortion.mnBasePos;
- back().mnBaseLen = rPortion.mnBaseLen;
+ mvModels.back().mnBasePos = rPortion.mnBasePos;
+ mvModels.back().mnBaseLen = rPortion.mnBaseLen;
}
}
void PhoneticPortionModelList::importPortions( SequenceInputStream& rStrm )
{
sal_Int32 nCount = rStrm.readInt32();
- clear();
+ mvModels.clear();
if( nCount > 0 )
{
- reserve( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 6 ) );
+ mvModels.reserve( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 6 ) );
PhoneticPortionModel aPortion;
for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
@@ -470,7 +470,7 @@ void RichString::createPhoneticPortions( const OUString& rText, PhoneticPortionM
rPortions.push_back( PhoneticPortionModel( nStrLen, nBaseLen, 0 ) );
// create all phonetic portions according to the portions vector
- for( PhoneticPortionModelList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
+ for( ::std::vector< PhoneticPortionModel >::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
{
sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
if( (0 < nPortionLen) && (aIt->mnPos + nPortionLen <= nStrLen) )