sc/source/filter/inc/richstring.hxx | 15 +++++++++++++-- sc/source/filter/oox/richstring.cxx | 20 ++++++++++---------- 2 files changed, 23 insertions(+), 12 deletions(-)
New commits: commit c0e378312cb18b1f783a6971c61b5d878e1d7538 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Thu Sep 4 12:02:26 2014 +0900 fdo#75757: remove inheritance to std::vector from PhoneticPortionModelList. Change-Id: I0972bb1bac93e86cb73b9e03af11a84b06e177be Reviewed-on: https://gerrit.libreoffice.org/11269 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/filter/inc/richstring.hxx b/sc/source/filter/inc/richstring.hxx index 229dd6f..9f15aab 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 4cbc6eb..0480c59 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) )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits