summaryrefslogtreecommitdiff
path: root/sw/source/core/inc/rolbck.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-05-24 09:51:14 +0200
committerMichael Stahl <mstahl@redhat.com>2012-05-25 00:17:08 +0200
commit9c0ca924446933431d736ee0dd37e6852b4947dc (patch)
tree97ae6260011cb6eafcc286f1e9f5da508d43215f /sw/source/core/inc/rolbck.hxx
parentc271eb95a8519c88af809ee7a0e1c750e08beb27 (diff)
Convert SV_DECL_PTRARR_DEL(SwpHstry) to std::vector
Could not use boost::ptr_vector here because the code moves pointers around by hand. Change-Id: I60d19741ad08add18d99ee3b75e9dc3810d2c675
Diffstat (limited to 'sw/source/core/inc/rolbck.hxx')
-rw-r--r--sw/source/core/inc/rolbck.hxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index f030c236f422..0eb6efa66cf7 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -353,8 +353,11 @@ public:
#endif
-typedef SwHistoryHint* SwHistoryHintPtr;
-SV_DECL_PTRARR_DEL( SwpHstry, SwHistoryHintPtr, 0 )
+class SwpHstry : public std::vector<SwHistoryHint*> {
+public:
+ // the destructor will free all objects still in the vector
+ ~SwpHstry();
+};
class SwHistory
{
@@ -386,8 +389,8 @@ public:
void Add( const SwTxtFtn& );
void Add( const SfxItemSet & rSet, const SwCharFmt & rCharFmt);
- sal_uInt16 Count() const { return m_SwpHstry.Count(); }
- sal_uInt16 GetTmpEnd() const { return m_SwpHstry.Count() - m_nEndDiff; }
+ sal_uInt16 Count() const { return m_SwpHstry.size(); }
+ sal_uInt16 GetTmpEnd() const { return m_SwpHstry.size() - m_nEndDiff; }
sal_uInt16 SetTmpEnd( sal_uInt16 nTmpEnd ); // return previous value
SwHistoryHint * operator[]( sal_uInt16 nPos ) { return m_SwpHstry[nPos]; }
SwHistoryHint const* operator[]( sal_uInt16 nPos ) const
@@ -397,10 +400,10 @@ public:
void Move( sal_uInt16 nPos, SwHistory *pIns,
sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX )
{
- m_SwpHstry.Insert( &pIns->m_SwpHstry, nPos, nStart, nEnd );
- pIns->m_SwpHstry.Remove( nStart, (nEnd == USHRT_MAX)
- ? pIns->Count() - nStart
- : nEnd );
+ SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
+ SwpHstry::iterator itSourceEnd = nEnd == USHRT_MAX ? pIns->m_SwpHstry.end() : pIns->m_SwpHstry.begin() + nEnd;
+ std::copy( itSourceBegin, itSourceEnd, m_SwpHstry.begin() + nPos );
+ pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd );
}
// helper methods for recording attribute in History