diff options
-rw-r--r-- | sw/source/ui/envelp/label1.cxx | 30 | ||||
-rw-r--r-- | sw/source/ui/envelp/labfmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/envelp/labelcfg.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/inc/label.hxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/inc/labrec.hxx | 6 |
5 files changed, 24 insertions, 24 deletions
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 9b27a7cfecd0..90f6497e7f0e 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -68,8 +68,8 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const void SwLabDlg::_ReplaceGroup( const OUString &rMake ) { // Remove old entries - pRecs->erase(pRecs->begin() + 1, pRecs->end()); - aLabelsCfg.FillLabels(rMake, *pRecs); + m_pRecs->erase(m_pRecs->begin() + 1, m_pRecs->end()); + aLabelsCfg.FillLabels(rMake, *m_pRecs); aLstGroup = rMake; } @@ -96,7 +96,7 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, , pDBManager(pDBManager_) , pPrtPage(0) , aTypeIds(50, 10) - , pRecs(new SwLabRecs()) + , m_pRecs(new SwLabRecs) , m_bLabel(bLabel) , m_nFormatId(0) , m_nOptionsId(0) @@ -131,16 +131,16 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, } // Read user label from writer.cfg SwLabItem aItem(static_cast<const SwLabItem&>(rSet.Get( FN_LABEL ))); - SwLabRec* pRec = new SwLabRec; + std::unique_ptr<SwLabRec> pRec(new SwLabRec); pRec->aMake = pRec->aType = SW_RESSTR( STR_CUSTOM ); pRec->SetFromItem( aItem ); bool bDouble = false; - for (size_t nRecPos = 0; nRecPos < pRecs->size(); ++nRecPos) + for (size_t nRecPos = 0; nRecPos < m_pRecs->size(); ++nRecPos) { - if (pRec->aMake == (*pRecs)[nRecPos].aMake && - pRec->aType == (*pRecs)[nRecPos].aType) + if (pRec->aMake == (*m_pRecs)[nRecPos]->aMake && + pRec->aType == (*m_pRecs)[nRecPos]->aType) { bDouble = true; break; @@ -148,9 +148,7 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, } if (!bDouble) - pRecs->insert( pRecs->begin(), pRec ); - else - delete pRec; + m_pRecs->insert( m_pRecs->begin(), std::move(pRec)); size_t nLstGroup = 0; const std::vector<OUString>& rMan = aLabelsCfg.GetManufacturers(); @@ -175,7 +173,7 @@ SwLabDlg::~SwLabDlg() void SwLabDlg::dispose() { - delete pRecs; + delete m_pRecs; pPrtPage.clear(); SfxTabDialog::dispose(); } @@ -210,7 +208,7 @@ SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont) const size_t nCount = Recs().size(); for (size_t i = 0; i < nCount; ++i) { - pRec = &Recs()[i]; + pRec = Recs()[i].get(); if (pRec->aType != sCustom && rRecName == pRec->aType && bCont == pRec->bCont) { @@ -219,7 +217,7 @@ SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont) } } if (!bFound) // User defined - pRec = &Recs()[0]; + pRec = Recs()[0].get(); return pRec; } @@ -388,14 +386,14 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl) //insert the entries into the sorted list box for ( size_t i = 0; i < nCount; ++i ) { - const OUString aType ( GetParentSwLabDlg()->Recs()[i].aType ); + const OUString aType(GetParentSwLabDlg()->Recs()[i]->aType); bool bInsert = false; - if ( GetParentSwLabDlg()->Recs()[i].aType == sCustom ) + if (GetParentSwLabDlg()->Recs()[i]->aType == sCustom) { bInsert = true; m_pTypeBox->InsertEntry(aType ); } - else if ( GetParentSwLabDlg()->Recs()[i].bCont == bCont ) + else if (GetParentSwLabDlg()->Recs()[i]->bCont == bCont) { if ( m_pHiddenSortTypeBox->GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND ) { diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 7d721c2cd1dd..48a4f21b6400 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -509,7 +509,7 @@ void SwLabFormatPage::FillItem(SwLabItem& rItem) { rItem.aMake = rItem.aType = SW_RESSTR(STR_CUSTOM); - SwLabRec& rRec = GetParentSwLabDlg()->Recs()[0]; + SwLabRec& rRec = *GetParentSwLabDlg()->Recs()[0]; rItem.lHDist = rRec.lHDist = static_cast< long >(GETFLDVAL(*m_pHDistField )); rItem.lVDist = rRec.lVDist = static_cast< long >(GETFLDVAL(*m_pVDistField )); rItem.lWidth = rRec.lWidth = static_cast< long >(GETFLDVAL(*m_pWidthField )); diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index e9197ab2474c..a29ee6c4ce34 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -173,9 +173,9 @@ void SwLabelConfig::ImplCommit() {} void SwLabelConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {} -static SwLabRec* lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeasure, const OUString& rManufacturer) +static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeasure, const OUString& rManufacturer) { - SwLabRec* pNewRec = new SwLabRec; + std::unique_ptr<SwLabRec> pNewRec(new SwLabRec); pNewRec->aMake = rManufacturer; pNewRec->lPWidth = 0; pNewRec->lPHeight = 0; diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx index bb23e44c80e7..d9ffa02b8a6c 100644 --- a/sw/source/uibase/inc/label.hxx +++ b/sw/source/uibase/inc/label.hxx @@ -38,7 +38,7 @@ class SwLabDlg : public SfxTabDialog std::vector<sal_uInt16> aTypeIds; std::vector<OUString> aMakes; - SwLabRecs* pRecs; + SwLabRecs* m_pRecs; OUString aLstGroup; OUString m_sBusinessCardDlg; bool m_bLabel; @@ -61,8 +61,8 @@ public: SwLabRec* GetRecord(const OUString &rRecName, bool bCont); void GetLabItem(SwLabItem &rItem); - SwLabRecs &Recs() { return *pRecs; } - const SwLabRecs &Recs() const { return *pRecs; } + SwLabRecs &Recs() { return *m_pRecs; } + const SwLabRecs &Recs() const { return *m_pRecs; } std::vector<sal_uInt16> &TypeIds() { return aTypeIds; } const std::vector<sal_uInt16> &TypeIds() const { return aTypeIds; } diff --git a/sw/source/uibase/inc/labrec.hxx b/sw/source/uibase/inc/labrec.hxx index 3e5f124b1489..1a133ed8e451 100644 --- a/sw/source/uibase/inc/labrec.hxx +++ b/sw/source/uibase/inc/labrec.hxx @@ -19,7 +19,9 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX -#include <boost/ptr_container/ptr_vector.hpp> +#include <memory> +#include <vector> + class SwLabItem; @@ -46,7 +48,7 @@ public: bool bCont; }; -typedef boost::ptr_vector<SwLabRec> SwLabRecs; +typedef std::vector<std::unique_ptr<SwLabRec>> SwLabRecs; #endif |