Kaydet (Commit) 5331e767 authored tarafından Michael Stahl's avatar Michael Stahl

sw: convert boost::ptr_vector to std::vector<std::unique_ptr>

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