Kaydet (Commit) 115a8539 authored tarafından Noel Grandin's avatar Noel Grandin

std::list->std::vector in SubsetMap

Change-Id: I3fa98b787707dcbc555abe6aaa3a11e0fe467308
Reviewed-on: https://gerrit.libreoffice.org/52606Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e463ab92
......@@ -34,9 +34,9 @@ void SvxEditSource::removeRange( SvxUnoTextRangeBase* )
}
const SvxUnoTextRangeBaseList& SvxEditSource::getRanges() const
const SvxUnoTextRangeBaseVec& SvxEditSource::getRanges() const
{
static SvxUnoTextRangeBaseList gList;
static SvxUnoTextRangeBaseVec gList;
return gList;
}
......
......@@ -51,7 +51,7 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
{
if( currentPara>=maSelection.nStartPara && currentPara<=maSelection.nEndPara )
{
const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
SvxUnoTextContent* pContent = nullptr;
sal_Int32 nStartPos = 0;
sal_Int32 nEndPos = mrText.GetEditSource()->GetTextForwarder()->GetTextLen( currentPara );
......@@ -405,7 +405,7 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rTe
nEndPos = std::min<sal_uInt16>(nEndPos, mnSel.nEndPos);
ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
SvxUnoTextRange* pRange = nullptr;
for (auto const& elemRange : rRanges)
{
......
......@@ -30,7 +30,7 @@
#include <editeng/editengdllapi.h>
#include <editeng/editeng.hxx>
#include <list>
#include <vector>
struct ESelection;
struct EFieldInfo;
......@@ -45,7 +45,7 @@ class SvxFieldItem;
class SfxBroadcaster;
class SvxUnoTextRangeBase;
typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
typedef std::vector< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseVec;
/** Wrapper class for unified EditEngine/Outliner access
......@@ -122,7 +122,7 @@ public:
/** returns a const list of all text ranges that are registered
for the underlying text object. */
virtual const SvxUnoTextRangeBaseList& getRanges() const;
virtual const SvxUnoTextRangeBaseVec& getRanges() const;
};
......
......@@ -52,7 +52,7 @@ inline bool operator<(const Subset &rLHS, const Subset &rRHS)
return rLHS.GetRangeMin() < rRHS.GetRangeMin();
}
typedef ::std::list<Subset> SubsetList;
typedef ::std::vector<Subset> SubsetVec;
class SVX_DLLPUBLIC SubsetMap
{
......@@ -60,10 +60,10 @@ public:
SubsetMap( const FontCharMapRef& );
const Subset* GetSubsetByUnicode( sal_UCS4 ) const;
const SubsetList& GetSubsetMap() const;
const SubsetVec& GetSubsetMap() const;
private:
SubsetList maSubsets;
SubsetVec maSubsets;
SVX_DLLPRIVATE void InitList();
SVX_DLLPRIVATE void ApplyCharMap( const FontCharMapRef& );
......
......@@ -64,7 +64,7 @@ public:
virtual void addRange( SvxUnoTextRangeBase* pNewRange ) override;
virtual void removeRange( SvxUnoTextRangeBase* pOldRange ) override;
virtual const SvxUnoTextRangeBaseList& getRanges() const override;
virtual const SvxUnoTextRangeBaseVec& getRanges() const override;
virtual SfxBroadcaster& GetBroadcaster() const override;
......
......@@ -865,7 +865,7 @@ SubsetMap::SubsetMap( const FontCharMapRef& rxFontCharMap )
ApplyCharMap(rxFontCharMap);
}
const SubsetList& SubsetMap::GetSubsetMap() const
const SubsetVec& SubsetMap::GetSubsetMap() const
{
return maSubsets;
}
......@@ -885,7 +885,7 @@ inline Subset::Subset(sal_UCS4 nMin, sal_UCS4 nMax, const OUString& rName)
void SubsetMap::InitList()
{
static SubsetList aAllSubsets;
static SubsetVec aAllSubsets;
static bool bInit = true;
if( bInit )
{
......@@ -1769,7 +1769,7 @@ void SubsetMap::InitList()
#endif
}
aAllSubsets.sort();
std::stable_sort(aAllSubsets.begin(), aAllSubsets.end());
}
maSubsets = aAllSubsets;
......@@ -1781,7 +1781,7 @@ void SubsetMap::ApplyCharMap( const FontCharMapRef& rxFontCharMap )
return;
// remove subsets that are not matched in any range
SubsetList::iterator it = maSubsets.begin();
auto it = maSubsets.begin();
while(it != maSubsets.end())
{
const Subset& rSubset = *it;
......
......@@ -99,7 +99,7 @@ private:
bool mbNotificationsDisabled; // prevent EditEngine/Outliner notifications (e.g. when setting up forwarder)
bool mbNotifyEditOutlinerSet;
SvxUnoTextRangeBaseList maTextRanges;
SvxUnoTextRangeBaseVec mvTextRanges;
SvxTextForwarder* GetBackgroundTextForwarder();
SvxTextForwarder* GetEditModeTextForwarder();
......@@ -132,7 +132,7 @@ public:
void addRange( SvxUnoTextRangeBase* pNewRange );
void removeRange( SvxUnoTextRangeBase* pOldRange );
const SvxUnoTextRangeBaseList& getRanges() const { return maTextRanges;}
const SvxUnoTextRangeBaseVec& getRanges() const { return mvTextRanges;}
void lock();
void unlock();
......@@ -238,15 +238,15 @@ SvxTextEditSourceImpl::~SvxTextEditSourceImpl()
void SvxTextEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange )
{
if( pNewRange )
if( std::find( maTextRanges.begin(), maTextRanges.end(), pNewRange ) == maTextRanges.end() )
maTextRanges.push_back( pNewRange );
if( std::find( mvTextRanges.begin(), mvTextRanges.end(), pNewRange ) == mvTextRanges.end() )
mvTextRanges.push_back( pNewRange );
}
void SvxTextEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange )
{
if( pOldRange )
maTextRanges.remove( pOldRange );
mvTextRanges.erase( std::remove(mvTextRanges.begin(), mvTextRanges.end(), pOldRange), mvTextRanges.end() );
}
......@@ -1050,7 +1050,7 @@ void SvxTextEditSource::removeRange( SvxUnoTextRangeBase* pOldRange )
mpImpl->removeRange( pOldRange );
}
const SvxUnoTextRangeBaseList& SvxTextEditSource::getRanges() const
const SvxUnoTextRangeBaseVec& SvxTextEditSource::getRanges() const
{
return mpImpl->getRanges();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment