sc/inc/document.hxx | 6 ++--- sc/inc/rangenam.hxx | 2 - sc/inc/undorangename.hxx | 14 +++++++----- sc/qa/unit/ucalc_sharedformula.cxx | 4 +-- sc/source/core/data/documen2.cxx | 1 sc/source/core/data/documen3.cxx | 8 +++---- sc/source/core/data/document.cxx | 4 +-- sc/source/core/tool/interpr4.cxx | 38 ++++++++++++++++++---------------- sc/source/ui/docshell/docfunc.cxx | 2 - sc/source/ui/inc/docfunc.hxx | 2 - sc/source/ui/inc/namedlg.hxx | 12 +++++----- sc/source/ui/inc/namemgrtable.hxx | 9 +++++--- sc/source/ui/inc/namepast.hxx | 5 +++- sc/source/ui/inc/tabvwsh.hxx | 5 ++-- sc/source/ui/namedlg/namedlg.cxx | 22 +++++++++++-------- sc/source/ui/namedlg/namemgrtable.cxx | 27 ++++++++++++------------ sc/source/ui/namedlg/namepast.cxx | 6 +++-- sc/source/ui/undo/undorangename.cxx | 20 ++++++++--------- sc/source/ui/view/tabvwshc.cxx | 9 +++----- 19 files changed, 105 insertions(+), 91 deletions(-)
New commits: commit f462cd39b990929bc71615f7f04d561d64c1039d Author: Michael Stahl <[email protected]> Date: Mon Nov 2 18:38:48 2015 +0100 sc: replace boost::ptr_vector with std::vector<std::unique_ptr> Change-Id: I51d87693bdb3d57c36d8cafb851fdad10cd93589 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index ec019b0..83f12bc 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -528,7 +528,7 @@ public: * non-empty range name set. */ SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const; - SC_DLLPUBLIC void SetAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap); + SC_DLLPUBLIC void SetAllRangeNames(const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap); SC_DLLPUBLIC void GetTabRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName); SC_DLLPUBLIC void GetRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName); SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const; diff --git a/sc/inc/undorangename.hxx b/sc/inc/undorangename.hxx index ba5a935..009c2a1 100644 --- a/sc/inc/undorangename.hxx +++ b/sc/inc/undorangename.hxx @@ -12,7 +12,9 @@ #include "undobase.hxx" #include "rangenam.hxx" -#include <boost/ptr_container/ptr_map.hpp> + +#include <memory> +#include <map> class ScDocShell; @@ -23,8 +25,8 @@ class ScUndoAllRangeNames : public ScSimpleUndo { public: ScUndoAllRangeNames(ScDocShell* pDocSh, - const std::map<OUString, ScRangeName*>& rOldNames, - const boost::ptr_map<OUString, ScRangeName>& rNewNames); + const std::map<OUString, ScRangeName*>& rOldNames, + const std::map<OUString, std::unique_ptr<ScRangeName>>& rNewNames); virtual ~ScUndoAllRangeNames(); @@ -35,11 +37,11 @@ public: virtual OUString GetComment() const override; private: - void DoChange(const boost::ptr_map<OUString, ScRangeName>& rNames); + void DoChange(const std::map<OUString, std::unique_ptr<ScRangeName>>& rNames); private: - boost::ptr_map<OUString, ScRangeName> maOldNames; - boost::ptr_map<OUString, ScRangeName> maNewNames; + std::map<OUString, std::unique_ptr<ScRangeName>> m_OldNames; + std::map<OUString, std::unique_ptr<ScRangeName>> m_NewNames; }; class ScUndoAddRangeData : public ScSimpleUndo diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 63cc3b1..8d70e4d 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1555,10 +1555,10 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pNames->size()); ScDocFunc& rFunc = getDocShell().GetDocFunc(); - typedef boost::ptr_map<OUString, ScRangeName> NameMapType; + typedef std::map<OUString, std::unique_ptr<ScRangeName>> NameMapType; NameMapType aNewNames; OUString aScope(STR_GLOBAL_RANGE_NAME); - aNewNames.insert(aScope, pNames); + aNewNames.insert(std::make_pair(aScope, std::unique_ptr<ScRangeName>(pNames))); rFunc.ModifyAllRangeNames(aNewNames); // Check to make sure all displayed formulas are still good. diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index e939264..21decad 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -119,16 +119,16 @@ void ScDocument::GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rNames) const rNames.swap(aNames); } -void ScDocument::SetAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap) +void ScDocument::SetAllRangeNames(const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap) { OUString aGlobalStr(STR_GLOBAL_RANGE_NAME); - boost::ptr_map<OUString,ScRangeName>::const_iterator itr = rRangeMap.begin(), itrEnd = rRangeMap.end(); + auto itr = rRangeMap.begin(), itrEnd = rRangeMap.end(); for (; itr!=itrEnd; ++itr) { if (itr->first == aGlobalStr) { delete pRangeName; - const ScRangeName* pName = itr->second; + const ScRangeName *const pName = itr->second.get(); if (pName->empty()) pRangeName = NULL; else @@ -136,7 +136,7 @@ void ScDocument::SetAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& } else { - const ScRangeName* pName = itr->second; + const ScRangeName *const pName = itr->second.get(); SCTAB nTab; bool bFound = GetTable(itr->first, nTab); assert(bFound); (void)bFound; // fouled up? diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index c3e8551..6f1e593 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4872,7 +4872,7 @@ void ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA } } -void ScDocFunc::ModifyAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap ) +void ScDocFunc::ModifyAllRangeNames(const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap) { ScDocShellModificator aModificator(rDocShell); ScDocument& rDoc = rDocShell.GetDocument(); diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 6d9c032..2d38647 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -200,7 +200,7 @@ public: * passed as arguments (it creates copies); the caller is responsible for * destroying them. */ - void ModifyAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap ); + void ModifyAllRangeNames(const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap); bool CreateNames( const ScRange& rRange, sal_uInt16 nFlags, bool bApi, SCTAB nTab = -1 ); // -1 for global range names bool InsertNameList( const ScAddress& rStartPos, bool bApi ); diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index 06fc816..f0c0084 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -30,8 +30,7 @@ #include "anyrefdg.hxx" #include "namemgrtable.hxx" -#include <boost/ptr_container/ptr_map.hpp> - +#include <memory> #include <stack> #include <map> @@ -76,9 +75,9 @@ private: //ugly hack to call DefineNames from ManageNames bool mbCloseWithoutUndo; - typedef boost::ptr_map<OUString, ScRangeName> RangeNameContainer; + typedef std::map<OUString, std::unique_ptr<ScRangeName>> RangeNameContainer; - RangeNameContainer maRangeMap; + RangeNameContainer m_RangeMap; private: void Init(); @@ -116,7 +115,8 @@ protected: public: ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* ptrViewData, - const ScAddress& aCursorPos, boost::ptr_map<OUString, ScRangeName>* pRangeMap = NULL ); + const ScAddress& aCursorPos, + std::map<OUString, std::unique_ptr<ScRangeName>>* pRangeMap = nullptr); virtual ~ScNameDlg(); virtual void dispose() override; @@ -128,7 +128,7 @@ public: virtual void tableInitialized() override; - void GetRangeNames(boost::ptr_map<OUString, ScRangeName>& rRangeMap); + void GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap); void SetEntry(const OUString& rName, const OUString& rScope); }; diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx index aec3cb2..9d5f4e19 100644 --- a/sc/source/ui/inc/namemgrtable.hxx +++ b/sc/source/ui/inc/namemgrtable.hxx @@ -16,8 +16,9 @@ #include "scresid.hxx" #include "address.hxx" +#include <memory> #include <vector> -#include <boost/ptr_container/ptr_map.hpp> +#include <map> class ScRangeName; class ScRangeData; @@ -47,7 +48,7 @@ private: OUString maGlobalString; // should be const because we should not modify it here - const boost::ptr_map<OUString, ScRangeName>& mrRangeMap; + const std::map<OUString, std::unique_ptr<ScRangeName>>& m_RangeMap; // for performance, save which entries already have the formula entry // otherwise opening the dialog with a lot of range names is extremelly slow because // we would calculate all formula strings during opening @@ -64,7 +65,9 @@ private: void setColWidths(); public: - ScRangeManagerTable( SvSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos ); + ScRangeManagerTable(SvSimpleTableContainer& rParent, + std::map<OUString, std::unique_ptr<ScRangeName>>& rTabRangeNames, + const ScAddress& rPos); virtual ~ScRangeManagerTable(); virtual void dispose() override; diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx index 113299c..604e6c3 100644 --- a/sc/source/ui/inc/namepast.hxx +++ b/sc/source/ui/inc/namepast.hxx @@ -26,7 +26,9 @@ #include <vcl/lstbox.hxx> #include "namemgrtable.hxx" +#include <memory> #include <vector> +#include <map> #include "scui_def.hxx" class ScRangeName; @@ -44,7 +46,8 @@ private: VclPtr<ScRangeManagerTable> mpTable; std::vector<OUString> maSelectedNames; - boost::ptr_map<OUString, ScRangeName> maRangeMap; + std::map<OUString, std::unique_ptr<ScRangeName>> m_RangeMap; + public: ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool bInsList=true ); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 6f94a60..a162111 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -32,7 +32,8 @@ #include "shellids.hxx" #include "tabprotection.hxx" -#include <boost/ptr_container/ptr_map.hpp> +#include <memory> +#include <map> class SbxObject; class SdrOle2Obj; @@ -168,7 +169,7 @@ private: SfxBroadcaster* pAccessibilityBroadcaster; // ugly hack for Add button in ScNameDlg - boost::ptr_map<OUString, ScRangeName> maRangeMap; + std::map<OUString, std::unique_ptr<ScRangeName>> m_RangeMap; bool mbInSwitch; OUString maName; OUString maScope; diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 3138ec0..5426964 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -35,6 +35,8 @@ #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> +#include <o3tl/make_unique.hxx> + #include <map> // defines ------------------------------------------------------------------- @@ -49,7 +51,8 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* ptrViewData, - const ScAddress& aCursorPos, boost::ptr_map<OUString, ScRangeName>* pRangeMap ) + const ScAddress& aCursorPos, + std::map<OUString, std::unique_ptr<ScRangeName>> *const pRangeMap) : ScAnyRefDlg(pB, pCW, pParent, "ManageNamesDialog", "modules/scalc/ui/managenamesdialog.ui") , maGlobalNameStr(ScGlobal::GetRscString(STR_GLOBAL_SCOPE)) @@ -90,12 +93,13 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent for (; itr != itrEnd; ++itr) { OUString aTemp(itr->first); - maRangeMap.insert(aTemp, new ScRangeName(*itr->second)); + m_RangeMap.insert(std::make_pair(aTemp, + o3tl::make_unique<ScRangeName>(*itr->second))); } } else { - maRangeMap.swap(*pRangeMap); + m_RangeMap.swap(*pRangeMap); } Init(); } @@ -136,7 +140,7 @@ void ScNameDlg::Init() SvSimpleTableContainer *pCtrl = get<SvSimpleTableContainer>("names"); pCtrl->set_height_request(pCtrl->GetTextHeight()*12); - m_pRangeManagerTable = VclPtr<ScRangeManagerTable>::Create(*pCtrl, maRangeMap, maCursorPos); + m_pRangeManagerTable = VclPtr<ScRangeManagerTable>::Create(*pCtrl, m_RangeMap, maCursorPos); m_pRangeManagerTable->setInitListener(this); m_pRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); m_pRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); @@ -194,7 +198,7 @@ void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) bool ScNameDlg::Close() { if (mbDataChanged && !mbCloseWithoutUndo) - mpViewData->GetDocFunc().ModifyAllRangeNames(maRangeMap); + mpViewData->GetDocFunc().ModifyAllRangeNames(m_RangeMap); return DoClose( ScNameDlgWrapper::GetChildWindowId() ); } @@ -319,9 +323,9 @@ bool ScNameDlg::IsFormulaValid() ScRangeName* ScNameDlg::GetRangeName(const OUString& rScope) { if (rScope == maGlobalNameStr) - return maRangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second; + return m_RangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second.get(); else - return maRangeMap.find(rScope)->second; + return m_RangeMap.find(rScope)->second.get(); } void ScNameDlg::ShowOptions(const ScRangeNameLine& rLine) @@ -478,9 +482,9 @@ void ScNameDlg::ScopeChanged() NameModified(); } -void ScNameDlg::GetRangeNames(boost::ptr_map<OUString, ScRangeName>& rRangeMap) +void ScNameDlg::GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap) { - maRangeMap.swap(rRangeMap); + m_RangeMap.swap(rRangeMap); } IMPL_LINK_NOARG_TYPED(ScNameDlg, OkBtnHdl, Button*, void) diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx index 770fa33..655fce6 100644 --- a/sc/source/ui/namedlg/namemgrtable.cxx +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -34,12 +34,14 @@ static OUString createEntryString(const ScRangeNameLine& rLine) ScRangeManagerTable::InitListener::~InitListener() {} -ScRangeManagerTable::ScRangeManagerTable( SvSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& rRangeMap, const ScAddress& rPos ): - SvSimpleTable( rParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ), - maGlobalString( ScGlobal::GetRscString(STR_GLOBAL_SCOPE)), - mrRangeMap( rRangeMap ), - maPos( rPos ), - mpInitListener(NULL) +ScRangeManagerTable::ScRangeManagerTable(SvSimpleTableContainer& rParent, + std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap, + const ScAddress& rPos) + : SvSimpleTable( rParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) + , maGlobalString( ScGlobal::GetRscString(STR_GLOBAL_SCOPE)) + , m_RangeMap(rRangeMap) + , maPos( rPos ) + , mpInitListener(nullptr) { static long aStaticTabs[] = {3, 0, 0, 0 }; SetTabs( &aStaticTabs[0], MAP_PIXEL ); @@ -141,15 +143,14 @@ void ScRangeManagerTable::Init() { SetUpdateMode(false); Clear(); - for (boost::ptr_map<OUString, ScRangeName>::const_iterator itr = mrRangeMap.begin(); - itr != mrRangeMap.end(); ++itr) + for (auto const& itr : m_RangeMap) { - const ScRangeName* pLocalRangeName = itr->second; + const ScRangeName *const pLocalRangeName = itr.second.get(); ScRangeNameLine aLine; - if ( itr->first == STR_GLOBAL_RANGE_NAME ) + if (itr.first == STR_GLOBAL_RANGE_NAME) aLine.aScope = maGlobalString; else - aLine.aScope = itr->first; + aLine.aScope = itr.first; for (ScRangeName::const_iterator it = pLocalRangeName->begin(); it != pLocalRangeName->end(); ++it) { @@ -167,9 +168,9 @@ const ScRangeData* ScRangeManagerTable::findRangeData(const ScRangeNameLine& rLi { const ScRangeName* pRangeName; if (rLine.aScope == maGlobalString) - pRangeName = mrRangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second; + pRangeName = m_RangeMap.find(OUString(STR_GLOBAL_RANGE_NAME))->second.get(); else - pRangeName = mrRangeMap.find(rLine.aScope)->second; + pRangeName = m_RangeMap.find(rLine.aScope)->second.get(); return pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(rLine.aName)); } diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index 7b64fed..a73d372 100644 --- a/sc/source/ui/namedlg/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -26,6 +26,8 @@ #include "rangenam.hxx" #include "viewdata.hxx" +#include <o3tl/make_unique.hxx> + ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool ) : ModalDialog( pParent, "InsertNameDialog", "modules/scalc/ui/insertname.ui" ) { @@ -40,7 +42,7 @@ ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool for (; itr != itrEnd; ++itr) { OUString aTemp(itr->first); - maRangeMap.insert(aTemp, new ScRangeName(*itr->second)); + m_RangeMap.insert(std::make_pair(aTemp, o3tl::make_unique<ScRangeName>(*itr->second))); } ScViewData* pViewData = ScDocShell::GetViewData(); @@ -50,7 +52,7 @@ ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool aControlSize = LogicToPixel(aControlSize, MAP_APPFONT); pContainer->set_width_request(aControlSize.Width()); pContainer->set_height_request(10 * GetTextHeight()); - mpTable = VclPtr<ScRangeManagerTable>::Create(*pContainer, maRangeMap, aPos); + mpTable = VclPtr<ScRangeManagerTable>::Create(*pContainer, m_RangeMap, aPos); m_pBtnPaste->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) ); m_pBtnPasteAll->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl)); diff --git a/sc/source/ui/undo/undorangename.cxx b/sc/source/ui/undo/undorangename.cxx index 6cb3d6c..f275cdc 100644 --- a/sc/source/ui/undo/undorangename.cxx +++ b/sc/source/ui/undo/undorangename.cxx @@ -13,7 +13,6 @@ #include "docfunc.hxx" #include "sc.hrc" -#include <o3tl/ptr_container.hxx> #include <sfx2/app.hxx> #include <memory> @@ -24,21 +23,20 @@ using ::std::unique_ptr; ScUndoAllRangeNames::ScUndoAllRangeNames( ScDocShell* pDocSh, const std::map<OUString, ScRangeName*>& rOldNames, - const boost::ptr_map<OUString, ScRangeName>& rNewNames) : - ScSimpleUndo(pDocSh) + const std::map<OUString, std::unique_ptr<ScRangeName>>& rNewNames) + : ScSimpleUndo(pDocSh) { std::map<OUString, ScRangeName*>::const_iterator itr, itrEnd; for (itr = rOldNames.begin(), itrEnd = rOldNames.end(); itr != itrEnd; ++itr) { unique_ptr<ScRangeName> p(new ScRangeName(*itr->second)); - o3tl::ptr_container::insert(maOldNames, itr->first, std::move(p)); + m_OldNames.insert(std::make_pair(itr->first, std::move(p))); } - boost::ptr_map<OUString, ScRangeName>::const_iterator it, itEnd; - for (it = rNewNames.begin(), itEnd = rNewNames.end(); it != itEnd; ++it) + for (auto const& it : rNewNames) { - unique_ptr<ScRangeName> p(new ScRangeName(*it->second)); - o3tl::ptr_container::insert(maNewNames, it->first, std::move(p)); + unique_ptr<ScRangeName> p(new ScRangeName(*it.second)); + m_NewNames.insert(std::make_pair(it.first, std::move(p))); } } @@ -48,12 +46,12 @@ ScUndoAllRangeNames::~ScUndoAllRangeNames() void ScUndoAllRangeNames::Undo() { - DoChange(maOldNames); + DoChange(m_OldNames); } void ScUndoAllRangeNames::Redo() { - DoChange(maNewNames); + DoChange(m_NewNames); } void ScUndoAllRangeNames::Repeat(SfxRepeatTarget& /*rTarget*/) @@ -70,7 +68,7 @@ OUString ScUndoAllRangeNames::GetComment() const return ScGlobal::GetRscString(STR_UNDO_RANGENAMES); } -void ScUndoAllRangeNames::DoChange(const boost::ptr_map<OUString, ScRangeName>& rNames) +void ScUndoAllRangeNames::DoChange(const std::map<OUString, std::unique_ptr<ScRangeName>>& rNames) { ScDocument& rDoc = pDocShell->GetDocument(); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 6b8118e..de6eddc 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -89,7 +89,7 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog) if (nSlotId == FID_DEFINE_NAME) { mbInSwitch = true; - static_cast<ScNameDlg*>(pDialog)->GetRangeNames(maRangeMap); + static_cast<ScNameDlg*>(pDialog)->GetRangeNames(m_RangeMap); static_cast<ScNameDlg*>(pDialog)->Close(); sal_uInt16 nId = ScNameDefDlgWrapper::GetChildWindowId(); SfxViewFrame* pViewFrm = GetViewFrame(); @@ -156,7 +156,7 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( pResult = VclPtr<ScNameDlg>::Create( pB, pCW, pParent, &GetViewData(), ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), - GetViewData().GetTabNo() ), &maRangeMap); + GetViewData().GetTabNo() ), &m_RangeMap); static_cast<ScNameDlg*>(pResult.get())->SetEntry( maName, maScope); mbInSwitch = false; } @@ -177,10 +177,9 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( else { std::map<OUString, ScRangeName*> aRangeMap; - for (boost::ptr_map<OUString, ScRangeName>::iterator itr = maRangeMap.begin(); - itr != maRangeMap.end(); ++itr) + for (auto const& itr : m_RangeMap) { - aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr->first, itr->second)); + aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr.first, itr.second.get())); } pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap, ScAddress( GetViewData().GetCurX(), commit 9939a89c1e39e5c350600b6bea795743ddb780fb Author: Michael Stahl <[email protected]> Date: Mon Nov 2 17:14:52 2015 +0100 sc: remove unused boost::ptr_map ScRangeName::TabNameMap Change-Id: I7967f0ee333eda4db320dc50bd91f2229792f0a8 diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 5d01b31..812af42 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -175,8 +175,6 @@ private: IndexDataType maIndexToData; public: - /// Map that manages stored ScRangeName instances. - typedef ::boost::ptr_map<SCTAB, ScRangeName> TabNameMap; /// Map that stores non-managed pointers to ScRangeName instances. typedef ::std::map<SCTAB, const ScRangeName*> TabNameCopyMap; commit 64f3c1ecce7038a7890947020540161ec31204c7 Author: Michael Stahl <[email protected]> Date: Mon Nov 2 17:12:26 2015 +0100 sc: replace boost::ptr_vector with std::vector<std::unique_ptr> Change-Id: I21719d513aa4af7a7f9621e19d529fd0c4425f58 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index db0f6d2..ec019b0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -44,7 +44,6 @@ #include <map> #include <set> #include <vector> -#include <boost/ptr_container/ptr_vector.hpp> #include "markdata.hxx" @@ -374,7 +373,8 @@ private: css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents; public: - boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use + /// list of ScInterpreterTableOpParams currently in use + std::vector<std::unique_ptr<ScInterpreterTableOpParams>> m_TableOpList; ScInterpreterTableOpParams aLastTableOpParams; // remember last params private: diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 38ca15d..b7cc1ed 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -170,7 +170,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : nUnoObjectId( 0 ), nRangeOverflowType( 0 ), aCurTextWidthCalcPos(MAXCOL,0,0), - aTableOpList( 0 ), nFormulaCodeInTree(0), nXMLImportedFormulaCount( 0 ), nInterpretLevel(0), diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 9bfee0b..054dc9f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3755,9 +3755,9 @@ void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges ) void ScDocument::AddTableOpFormulaCell( ScFormulaCell* pCell ) { - if ( !aTableOpList.empty() ) + if (!m_TableOpList.empty()) { - ScInterpreterTableOpParams* p = &aTableOpList.back(); + ScInterpreterTableOpParams *const p = m_TableOpList.back().get(); if ( p->bCollectNotifications ) { if ( p->bRefresh ) diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index d21e9e6..53ac379 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -87,10 +87,10 @@ using ::std::unique_ptr; void ScInterpreter::ReplaceCell( ScAddress& rPos ) { - size_t ListSize = pDok->aTableOpList.size(); + size_t ListSize = pDok->m_TableOpList.size(); for ( size_t i = 0; i < ListSize; ++i ) { - ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ]; + ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ].get(); if ( rPos == pTOp->aOld1 ) { rPos = pTOp->aNew1; @@ -107,10 +107,10 @@ void ScInterpreter::ReplaceCell( ScAddress& rPos ) void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ) { ScAddress aCellPos( rCol, rRow, rTab ); - size_t ListSize = pDok->aTableOpList.size(); + size_t ListSize = pDok->m_TableOpList.size(); for ( size_t i = 0; i < ListSize; ++i ) { - ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ]; + ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ].get(); if ( aCellPos == pTOp->aOld1 ) { rCol = pTOp->aNew1.Col(); @@ -134,10 +134,10 @@ bool ScInterpreter::IsTableOpInRange( const ScRange& rRange ) return false; // not considered to be a range in TableOp sense // we can't replace a single cell in a range - size_t ListSize = pDok->aTableOpList.size(); + size_t ListSize = pDok->m_TableOpList.size(); for ( size_t i = 0; i < ListSize; ++i ) { - ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ]; + ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ].get(); if ( rRange.In( pTOp->aOld1 ) ) return true; if ( rRange.In( pTOp->aOld2 ) ) @@ -911,7 +911,7 @@ void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab) break; case svSingleRef: SingleRefToVars( *p->GetSingleRef(), rCol, rRow, rTab); - if ( !pDok->aTableOpList.empty() ) + if (!pDok->m_TableOpList.empty()) ReplaceCell( rCol, rRow, rTab ); break; default: @@ -940,7 +940,7 @@ void ScInterpreter::PopSingleRef( ScAddress& rAdr ) SCTAB nTab; SingleRefToVars( *p->GetSingleRef(), nCol, nRow, nTab); rAdr.Set( nCol, nRow, nTab ); - if ( !pDok->aTableOpList.empty() ) + if (!pDok->m_TableOpList.empty()) ReplaceCell( rAdr ); } break; @@ -960,7 +960,7 @@ void ScInterpreter::DoubleRefToVars( const formula::FormulaToken* p, const ScComplexRefData& rCRef = *p->GetDoubleRef(); SingleRefToVars( rCRef.Ref1, rCol1, rRow1, rTab1); SingleRefToVars( rCRef.Ref2, rCol2, rRow2, rTab2); - if ( !pDok->aTableOpList.empty() && !bDontCheckForTableOp ) + if (!pDok->m_TableOpList.empty() && !bDontCheckForTableOp) { ScRange aRange( rCol1, rRow1, rTab1, rCol2, rRow2, rTab2 ); if ( IsTableOpInRange( aRange ) ) @@ -1045,7 +1045,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef, SingleRefToVars( rCRef.Ref2, nCol, nRow, nTab); rRange.aEnd.Set( nCol, nRow, nTab ); rRange.PutInOrder(); - if (! pDok->aTableOpList.empty() && !bDontCheckForTableOp ) + if (!pDok->m_TableOpList.empty() && !bDontCheckForTableOp) { if ( IsTableOpInRange( rRange ) ) SetError( errIllegalParameter ); @@ -3219,9 +3219,9 @@ class FindByPointer : ::std::unary_function<ScInterpreterTableOpParams, bool> const ScInterpreterTableOpParams* mpTableOp; public: explicit FindByPointer(const ScInterpreterTableOpParams* p) : mpTableOp(p) {} - bool operator() (const ScInterpreterTableOpParams& val) const + bool operator() (const auto& val) const { - return &val == mpTableOp; + return val.get() == mpTableOp; } }; @@ -3246,7 +3246,8 @@ void ScInterpreter::ScTableOp() PopSingleRef( pTableOp->aFormulaPos ); pTableOp->bValid = true; - pDok->aTableOpList.push_back( pTableOp ); + pDok->m_TableOpList.push_back( + std::unique_ptr<ScInterpreterTableOpParams>(pTableOp)); pDok->IncInterpreterTableOpLevel(); bool bReuseLastParams = (pDok->aLastTableOpParams == *pTableOp); @@ -3286,10 +3287,13 @@ void ScInterpreter::ScTableOp() PushString( aCellString ); } - boost::ptr_vector< ScInterpreterTableOpParams >::iterator itr = - ::std::find_if(pDok->aTableOpList.begin(), pDok->aTableOpList.end(), FindByPointer(pTableOp)); - if (itr != pDok->aTableOpList.end()) - pTableOp = pDok->aTableOpList.release(itr).release(); + auto const itr = + ::std::find_if(pDok->m_TableOpList.begin(), pDok->m_TableOpList.end(), FindByPointer(pTableOp)); + if (itr != pDok->m_TableOpList.end()) + { + pTableOp = itr->release(); + pDok->m_TableOpList.erase(itr); + } // set dirty again once more to be able to recalculate original for ( ::std::vector< ScFormulaCell* >::const_iterator iBroadcast( _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
