diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-11-09 13:36:43 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-11-09 17:12:20 +0100 |
commit | 5abe5c141fc8ef23a1968f43bd0928b65101851f (patch) | |
tree | 717140b4f0cff203ab87d2e5f38fce9e56bc351a /sc/source/ui | |
parent | 1f0c3a16321ca0d63e09b733170b0375cf2d4ee3 (diff) |
sc: replace boost::ptr_list with std::list<std::unique_ptr>
Change-Id: Ic1202dc49789d7f392fc7c0065e071e114687717
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/inc/prevloc.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/prevloc.cxx | 58 |
2 files changed, 32 insertions, 36 deletions
diff --git a/sc/source/ui/inc/prevloc.hxx b/sc/source/ui/inc/prevloc.hxx index 3f59e330725e..95b58535a97d 100644 --- a/sc/source/ui/inc/prevloc.hxx +++ b/sc/source/ui/inc/prevloc.hxx @@ -20,13 +20,14 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX #define INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX -#include <boost/ptr_container/ptr_list.hpp> - #include <sal/types.h> #include <vcl/mapmod.hxx> #include "address.hxx" +#include <memory> +#include <list> + #define SC_PREVIEW_MAXRANGES 4 #define SC_PREVIEW_RANGE_EDGE 0 #define SC_PREVIEW_RANGE_REPCOL 1 @@ -82,6 +83,9 @@ public: class ScPreviewLocationData { +public: + typedef std::list<std::unique_ptr<ScPreviewLocationEntry>> Entries_t; +private: VclPtr<OutputDevice> pWindow; ScDocument* pDoc; MapMode aCellMapMode; @@ -90,7 +94,7 @@ class ScPreviewLocationData sal_uInt8 aDrawRangeId[SC_PREVIEW_MAXRANGES]; sal_uInt16 nDrawRanges; SCTAB nPrintTab; - boost::ptr_list<ScPreviewLocationEntry> aEntries; + Entries_t m_Entries; Rectangle GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const; diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx index 7da573bbbe1f..371e456ae43e 100644 --- a/sc/source/ui/view/prevloc.cxx +++ b/sc/source/ui/view/prevloc.cxx @@ -22,6 +22,8 @@ #include "prevloc.hxx" #include "document.hxx" +#include <o3tl/make_unique.hxx> + enum ScPreviewLocationType { SC_PLOC_CELLRANGE, @@ -170,7 +172,7 @@ void ScPreviewLocationData::SetPrintTab( SCTAB nNew ) void ScPreviewLocationData::Clear() { - aEntries.clear(); + m_Entries.clear(); nDrawRanges = 0; } @@ -179,7 +181,7 @@ void ScPreviewLocationData::AddCellRange( const Rectangle& rRect, const ScRange& const MapMode& rDrawMap ) { Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) ); - aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow ) ); + m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow) ); OSL_ENSURE( nDrawRanges < SC_PREVIEW_MAXRANGES, "too many ranges" ); @@ -213,7 +215,7 @@ void ScPreviewLocationData::AddColHeaders( const Rectangle& rRect, SCCOL nStartC ScRange aRange( nStartCol, 0, nTab, nEndCol, 0, nTab ); Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) ); - aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, false ) ); + m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, false) ); } void ScPreviewLocationData::AddRowHeaders( const Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, bool bRepRow ) @@ -222,7 +224,7 @@ void ScPreviewLocationData::AddRowHeaders( const Rectangle& rRect, SCROW nStartR ScRange aRange( 0, nStartRow, nTab, 0, nEndRow, nTab ); Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) ); - aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_ROWHEADER, aPixelRect, aRange, false, bRepRow ) ); + m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_ROWHEADER, aPixelRect, aRange, false, bRepRow) ); } void ScPreviewLocationData::AddHeaderFooter( const Rectangle& rRect, bool bHeader, bool bLeft ) @@ -234,7 +236,7 @@ void ScPreviewLocationData::AddHeaderFooter( const Rectangle& rRect, bool bHeade ( bLeft ? SC_PLOC_LEFTHEADER : SC_PLOC_RIGHTHEADER ) : ( bLeft ? SC_PLOC_LEFTFOOTER : SC_PLOC_RIGHTFOOTER ); - aEntries.push_front( new ScPreviewLocationEntry( eType, aPixelRect, aRange, false, false ) ); + m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(eType, aPixelRect, aRange, false, false) ); } void ScPreviewLocationData::AddNoteMark( const Rectangle& rRect, const ScAddress& rPos ) @@ -242,7 +244,7 @@ void ScPreviewLocationData::AddNoteMark( const Rectangle& rRect, const ScAddress ScRange aRange( rPos ); Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) ); - aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_NOTEMARK, aPixelRect, aRange, false, false ) ); + m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTEMARK, aPixelRect, aRange, false, false) ); } void ScPreviewLocationData::AddNoteText( const Rectangle& rRect, const ScAddress& rPos ) @@ -250,7 +252,7 @@ void ScPreviewLocationData::AddNoteText( const Rectangle& rRect, const ScAddress ScRange aRange( rPos ); Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) ); - aEntries.push_front( new ScPreviewLocationEntry( SC_PLOC_NOTETEXT, aPixelRect, aRange, false, false ) ); + m_Entries.push_front( o3tl::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTETEXT, aPixelRect, aRange, false, false) ); } void ScPreviewLocationData::GetDrawRange( sal_uInt16 nPos, Rectangle& rPixelRect, MapMode& rMapMode, sal_uInt8& rRangeId ) const @@ -264,14 +266,14 @@ void ScPreviewLocationData::GetDrawRange( sal_uInt16 nPos, Rectangle& rPixelRect } } -static ScPreviewLocationEntry* lcl_GetEntryByAddress( const boost::ptr_list<ScPreviewLocationEntry> &rEntries, - const ScAddress& rPos, ScPreviewLocationType eType ) +static ScPreviewLocationEntry* lcl_GetEntryByAddress( + ScPreviewLocationData::Entries_t const& rEntries, + const ScAddress& rPos, ScPreviewLocationType const eType) { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = rEntries.begin(); it != rEntries.end(); ++it) + for (auto const& it : rEntries) { if ( it->eType == eType && it->aCellRange.In( rPos ) ) - return const_cast<ScPreviewLocationEntry*>(&(*it)); + return const_cast<ScPreviewLocationEntry*>(it.get()); } return NULL; @@ -308,7 +310,7 @@ Rectangle ScPreviewLocationData::GetOffsetPixel( const ScAddress& rCellPos, cons bool ScPreviewLocationData::GetCellPosition( const ScAddress& rCellPos, Rectangle& rCellRect ) const { - ScPreviewLocationEntry* pEntry = lcl_GetEntryByAddress( aEntries, rCellPos, SC_PLOC_CELLRANGE ); + ScPreviewLocationEntry* pEntry = lcl_GetEntryByAddress( m_Entries, rCellPos, SC_PLOC_CELLRANGE ); if ( pEntry ) { Rectangle aOffsetRect = GetOffsetPixel( rCellPos, pEntry->aCellRange ); @@ -323,8 +325,7 @@ bool ScPreviewLocationData::GetCellPosition( const ScAddress& rCellPos, Rectangl bool ScPreviewLocationData::HasCellsInRange( const Rectangle& rVisiblePixel ) const { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_CELLRANGE || it->eType == SC_PLOC_COLHEADER || it->eType == SC_PLOC_ROWHEADER ) if ( it->aPixelRect.IsOver( rVisiblePixel ) ) @@ -336,8 +337,7 @@ bool ScPreviewLocationData::HasCellsInRange( const Rectangle& rVisiblePixel ) co bool ScPreviewLocationData::GetHeaderPosition( Rectangle& rRect ) const { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_LEFTHEADER || it->eType == SC_PLOC_RIGHTHEADER ) { @@ -351,8 +351,7 @@ bool ScPreviewLocationData::GetHeaderPosition( Rectangle& rRect ) const bool ScPreviewLocationData::GetFooterPosition( Rectangle& rRect ) const { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_LEFTFOOTER || it->eType == SC_PLOC_RIGHTFOOTER ) { @@ -366,8 +365,7 @@ bool ScPreviewLocationData::GetFooterPosition( Rectangle& rRect ) const bool ScPreviewLocationData::IsHeaderLeft() const { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_LEFTHEADER ) return true; @@ -381,8 +379,7 @@ bool ScPreviewLocationData::IsHeaderLeft() const bool ScPreviewLocationData::IsFooterLeft() const { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_LEFTFOOTER ) return true; @@ -399,8 +396,7 @@ long ScPreviewLocationData::GetNoteCountInRange( const Rectangle& rVisiblePixel, ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT; sal_uLong nRet = 0; - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) ) ++nRet; @@ -415,8 +411,7 @@ bool ScPreviewLocationData::GetNoteInRange( const Rectangle& rVisiblePixel, long ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT; sal_uLong nPos = 0; - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) ) { @@ -438,8 +433,7 @@ Rectangle ScPreviewLocationData::GetNoteInRangeOutputRect(const Rectangle& rVisi ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT; sal_uLong nPos = 0; - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) ) { @@ -478,8 +472,7 @@ void ScPreviewLocationData::GetTableInfo( const Rectangle& rVisiblePixel, ScPrev Rectangle aHeaderRect, aRepeatRect, aMainRect; SCTAB nTab = 0; - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_CELLRANGE ) { @@ -714,8 +707,7 @@ Rectangle ScPreviewLocationData::GetCellOutputRect(const ScAddress& rCellPos) co bool ScPreviewLocationData::GetMainCellRange( ScRange& rRange, Rectangle& rPixRect ) const { - boost::ptr_list<ScPreviewLocationEntry>::const_iterator it; - for (it = aEntries.begin(); it != aEntries.end(); ++it) + for (auto const& it : m_Entries) { if ( it->eType == SC_PLOC_CELLRANGE && !it->bRepeatCol && !it->bRepeatRow ) { |