Kaydet (Commit) 277bf233 authored tarafından Michael Stahl's avatar Michael Stahl

sw: replace boost::ptr_vector with std::vector<std::unique_ptr>

Change-Id: I821a853a0e4776d2b5ba2ca69d421ec0af8e865e
üst ba785e0c
...@@ -4411,16 +4411,16 @@ SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat, long ...@@ -4411,16 +4411,16 @@ SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat, long
{ {
sal_uInt16 nPos; sal_uInt16 nPos;
return Seek_Entry( rFormat, &nPos ) return Seek_Entry( rFormat, &nPos )
? aShareArr[ nPos ].GetFormat( nWidth ) ? m_ShareArr[ nPos ]->GetFormat(nWidth)
: 0; : nullptr;
} }
SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat, SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat,
const SfxPoolItem& rItem ) const const SfxPoolItem& rItem ) const
{ {
sal_uInt16 nPos; sal_uInt16 nPos;
return Seek_Entry( rFormat, &nPos ) return Seek_Entry( rFormat, &nPos )
? aShareArr[ nPos ].GetFormat( rItem ) ? m_ShareArr[ nPos ]->GetFormat(rItem)
: 0; : nullptr;
} }
void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew ) void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew )
...@@ -4431,10 +4431,10 @@ void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNe ...@@ -4431,10 +4431,10 @@ void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNe
if( !Seek_Entry( rOld, &nPos )) if( !Seek_Entry( rOld, &nPos ))
{ {
pEntry = new SwShareBoxFormat( rOld ); pEntry = new SwShareBoxFormat( rOld );
aShareArr.insert( aShareArr.begin() + nPos, pEntry ); m_ShareArr.insert(m_ShareArr.begin() + nPos, std::unique_ptr<SwShareBoxFormat>(pEntry));
} }
else else
pEntry = &aShareArr[ nPos ]; pEntry = m_ShareArr[ nPos ].get();
pEntry->AddFormat( rNew ); pEntry->AddFormat( rNew );
} }
...@@ -4508,22 +4508,27 @@ void SwShareBoxFormats::SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem ) ...@@ -4508,22 +4508,27 @@ void SwShareBoxFormats::SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem )
void SwShareBoxFormats::RemoveFormat( const SwFrameFormat& rFormat ) void SwShareBoxFormats::RemoveFormat( const SwFrameFormat& rFormat )
{ {
for( auto i = aShareArr.size(); i; ) for (auto i = m_ShareArr.size(); i; )
if( aShareArr[ --i ].RemoveFormat( rFormat )) {
aShareArr.erase( aShareArr.begin() + i ); if (m_ShareArr[ --i ]->RemoveFormat(rFormat))
{
m_ShareArr.erase( m_ShareArr.begin() + i );
}
}
} }
bool SwShareBoxFormats::Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const bool SwShareBoxFormats::Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const
{ {
sal_uLong nIdx = reinterpret_cast<sal_uLong>(&rFormat); sal_uLong nIdx = reinterpret_cast<sal_uLong>(&rFormat);
_SwShareBoxFormats::size_type nO = aShareArr.size(), nU = 0; auto nO = m_ShareArr.size();
decltype(nO) nU = 0;
if( nO > 0 ) if( nO > 0 )
{ {
nO--; nO--;
while( nU <= nO ) while( nU <= nO )
{ {
const auto nM = nU + ( nO - nU ) / 2; const auto nM = nU + ( nO - nU ) / 2;
sal_uLong nFormat = reinterpret_cast<sal_uLong>(&aShareArr[ nM ].GetOldFormat()); sal_uLong nFormat = reinterpret_cast<sal_uLong>(&m_ShareArr[ nM ]->GetOldFormat());
if( nFormat == nIdx ) if( nFormat == nIdx )
{ {
if( pPos ) if( pPos )
......
...@@ -20,10 +20,9 @@ ...@@ -20,10 +20,9 @@
#define INCLUDED_SW_SOURCE_CORE_INC_TBLRWCL_HXX #define INCLUDED_SW_SOURCE_CORE_INC_TBLRWCL_HXX
#include <cstddef> #include <cstddef>
#include <memory>
#include <vector> #include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include <swtypes.hxx> #include <swtypes.hxx>
#include <tblsel.hxx> #include <tblsel.hxx>
#include <swtable.hxx> #include <swtable.hxx>
...@@ -174,11 +173,10 @@ public: ...@@ -174,11 +173,10 @@ public:
bool RemoveFormat( const SwFrameFormat& rFormat ); bool RemoveFormat( const SwFrameFormat& rFormat );
}; };
typedef boost::ptr_vector<SwShareBoxFormat> _SwShareBoxFormats;
class SwShareBoxFormats class SwShareBoxFormats
{ {
_SwShareBoxFormats aShareArr; std::vector<std::unique_ptr<SwShareBoxFormat>> m_ShareArr;
bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const; bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const;
void ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn, SwFrameFormat& rFormat ); void ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn, SwFrameFormat& rFormat );
......
...@@ -63,6 +63,9 @@ ...@@ -63,6 +63,9 @@
#include <comcore.hrc> #include <comcore.hrc>
#include <unochart.hxx> #include <unochart.hxx>
#include <calbck.hxx> #include <calbck.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <memory> #include <memory>
#include <vector> #include <vector>
......
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