summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-09-30 23:22:11 +0200
committerMichael Stahl <mstahl@redhat.com>2015-10-01 11:28:58 +0200
commit277bf2338b313317e70db0cf9d09342558ae0792 (patch)
tree1cfbc16d85f30899ece56b8ebbabd5a39050d196
parentba785e0c93102e354c646c96a1de29f468080108 (diff)
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I821a853a0e4776d2b5ba2ca69d421ec0af8e865e
-rw-r--r--sw/source/core/doc/tblrwcl.cxx27
-rw-r--r--sw/source/core/inc/tblrwcl.hxx8
-rw-r--r--sw/source/core/undo/untbl.cxx3
3 files changed, 22 insertions, 16 deletions
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index b4abdb820e1f..f9d919862e6b 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -4411,16 +4411,16 @@ SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat, long
{
sal_uInt16 nPos;
return Seek_Entry( rFormat, &nPos )
- ? aShareArr[ nPos ].GetFormat( nWidth )
- : 0;
+ ? m_ShareArr[ nPos ]->GetFormat(nWidth)
+ : nullptr;
}
SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat,
const SfxPoolItem& rItem ) const
{
sal_uInt16 nPos;
return Seek_Entry( rFormat, &nPos )
- ? aShareArr[ nPos ].GetFormat( rItem )
- : 0;
+ ? m_ShareArr[ nPos ]->GetFormat(rItem)
+ : nullptr;
}
void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew )
@@ -4431,10 +4431,10 @@ void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNe
if( !Seek_Entry( rOld, &nPos ))
{
pEntry = new SwShareBoxFormat( rOld );
- aShareArr.insert( aShareArr.begin() + nPos, pEntry );
+ m_ShareArr.insert(m_ShareArr.begin() + nPos, std::unique_ptr<SwShareBoxFormat>(pEntry));
}
else
- pEntry = &aShareArr[ nPos ];
+ pEntry = m_ShareArr[ nPos ].get();
pEntry->AddFormat( rNew );
}
@@ -4508,22 +4508,27 @@ void SwShareBoxFormats::SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem )
void SwShareBoxFormats::RemoveFormat( const SwFrameFormat& rFormat )
{
- for( auto i = aShareArr.size(); i; )
- if( aShareArr[ --i ].RemoveFormat( rFormat ))
- aShareArr.erase( aShareArr.begin() + i );
+ for (auto i = m_ShareArr.size(); 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
{
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 )
{
nO--;
while( nU <= nO )
{
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( pPos )
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index 46c50cc9f73f..96d064c74d74 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -20,10 +20,9 @@
#define INCLUDED_SW_SOURCE_CORE_INC_TBLRWCL_HXX
#include <cstddef>
+#include <memory>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
-
#include <swtypes.hxx>
#include <tblsel.hxx>
#include <swtable.hxx>
@@ -174,11 +173,10 @@ public:
bool RemoveFormat( const SwFrameFormat& rFormat );
};
-typedef boost::ptr_vector<SwShareBoxFormat> _SwShareBoxFormats;
-
class SwShareBoxFormats
{
- _SwShareBoxFormats aShareArr;
+ std::vector<std::unique_ptr<SwShareBoxFormat>> m_ShareArr;
+
bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const;
void ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn, SwFrameFormat& rFormat );
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6589657b28ed..9af9efe5f6a4 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -63,6 +63,9 @@
#include <comcore.hrc>
#include <unochart.hxx>
#include <calbck.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <memory>
#include <vector>