sw: convert boost::ptr_vector to std::vector<std::unique_ptr>
Change-Id: I7fc96e3b7754bb3f4718f9142c75ee82aef0a22c
This commit is contained in:
+4
-2
@@ -21,7 +21,9 @@
|
||||
|
||||
#include <swtypes.hxx>
|
||||
#include <fmtruby.hxx>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class SwRubyListEntry
|
||||
{
|
||||
@@ -39,7 +41,7 @@ public:
|
||||
void SetRubyAttr( const SwFormatRuby& rAttr ) { m_aRubyAttr = rAttr; }
|
||||
};
|
||||
|
||||
class SwRubyList : public boost::ptr_vector<SwRubyListEntry> {};
|
||||
class SwRubyList : public std::vector<std::unique_ptr<SwRubyListEntry>> {};
|
||||
|
||||
#endif //_ INCLUDED_SW_INC_RUBYLIST_HXX
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList,
|
||||
{
|
||||
SwPaM aPam( *pStt );
|
||||
do {
|
||||
SwRubyListEntry* pNew = new SwRubyListEntry;
|
||||
std::unique_ptr<SwRubyListEntry> pNew(new SwRubyListEntry);
|
||||
if( pEnd != pStt )
|
||||
{
|
||||
aPam.SetMark();
|
||||
@@ -68,12 +68,11 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList,
|
||||
}
|
||||
if( _SelectNextRubyChars( aPam, *pNew, nMode ))
|
||||
{
|
||||
rList.push_back( pNew );
|
||||
rList.push_back(std::move(pNew));
|
||||
aPam.DeleteMark();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete pNew;
|
||||
if( *aPam.GetPoint() < *pEnd )
|
||||
{
|
||||
// goto next paragraph
|
||||
@@ -121,7 +120,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
|
||||
}
|
||||
if( _SelectNextRubyChars( aPam, aCheckEntry, nMode ))
|
||||
{
|
||||
const SwRubyListEntry* pEntry = &rList[ nListEntry++ ];
|
||||
const SwRubyListEntry* pEntry = rList[ nListEntry++ ].get();
|
||||
if( aCheckEntry.GetRubyAttr() != pEntry->GetRubyAttr() )
|
||||
{
|
||||
// set/reset the attribute
|
||||
@@ -153,7 +152,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
|
||||
}
|
||||
else
|
||||
{
|
||||
const SwRubyListEntry* pEntry = &rList[ nListEntry++ ];
|
||||
const SwRubyListEntry* pEntry = rList[ nListEntry++ ].get();
|
||||
|
||||
// set/reset the attribute
|
||||
if( !pEntry->GetRubyAttr().GetText().isEmpty() &&
|
||||
|
||||
@@ -547,7 +547,7 @@ Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAuto
|
||||
OUString aString;
|
||||
for(sal_uInt16 n = 0; n < nCount; n++)
|
||||
{
|
||||
const SwRubyListEntry* pEntry = &aList[n];
|
||||
const SwRubyListEntry* pEntry = aList[n].get();
|
||||
|
||||
const OUString& rEntryText = pEntry->GetText();
|
||||
const SwFormatRuby& rAttr = pEntry->GetRubyAttr();
|
||||
@@ -591,7 +591,7 @@ void SAL_CALL SwXTextView::setRubyList(
|
||||
const Sequence<PropertyValue>* pRubyList = rRubyList.getConstArray();
|
||||
for(sal_Int32 nPos = 0; nPos < rRubyList.getLength(); nPos++)
|
||||
{
|
||||
SwRubyListEntry* pEntry = new SwRubyListEntry;
|
||||
std::unique_ptr<SwRubyListEntry> pEntry(new SwRubyListEntry);
|
||||
const PropertyValue* pProperties = pRubyList[nPos].getConstArray();
|
||||
OUString sTmp;
|
||||
for(sal_Int32 nProp = 0; nProp < pRubyList[nPos].getLength(); nProp++)
|
||||
@@ -633,7 +633,7 @@ void SAL_CALL SwXTextView::setRubyList(
|
||||
pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1);
|
||||
}
|
||||
}
|
||||
aList.insert(aList.begin() + nPos, pEntry);
|
||||
aList.insert(aList.begin() + nPos, std::move(pEntry));
|
||||
}
|
||||
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
|
||||
pDoc->SetRubyList( *rSh.GetCrsr(), aList, 0 );
|
||||
|
||||
Reference in New Issue
Block a user