[Libreoffice-commits] core.git: 12 commits - cui/source editeng/source
Noel Grandin
noel at peralex.com
Tue Nov 10 05:30:29 PST 2015
cui/source/customize/cfgutil.cxx | 65 ++++-------
cui/source/customize/selector.cxx | 10 -
cui/source/inc/cfgutil.hxx | 4
cui/source/inc/numpages.hxx | 4
cui/source/inc/selector.hxx | 4
cui/source/tabpages/numpages.cxx | 8 -
editeng/source/editeng/editdbg.cxx | 17 +-
editeng/source/editeng/editdoc.cxx | 185 ++++++++++++++++----------------
editeng/source/editeng/editdoc.hxx | 15 +-
editeng/source/editeng/editeng.cxx | 8 -
editeng/source/editeng/editobj.cxx | 90 +++++++--------
editeng/source/editeng/editobj2.hxx | 8 -
editeng/source/editeng/editundo.cxx | 12 +-
editeng/source/editeng/editundo.hxx | 4
editeng/source/editeng/editview.cxx | 2
editeng/source/editeng/fieldupdater.cxx | 4
editeng/source/editeng/impedit.cxx | 2
editeng/source/editeng/impedit.hxx | 5
editeng/source/editeng/impedit2.cxx | 13 +-
editeng/source/editeng/impedit3.cxx | 6 -
editeng/source/editeng/impedit4.cxx | 6 -
editeng/source/editeng/impedit5.cxx | 8 -
22 files changed, 235 insertions(+), 245 deletions(-)
New commits:
commit 97ebf71c8bbe1755e02fe4d486d04353cf2575da
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 15:18:31 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I49cf179016a0690cb87bc12880da8b1824ac01cc
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 203531a..eb4921c 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -684,7 +684,7 @@ bool EditEngine::IsCallParaInsertedOrDeleted() const
void EditEngine::AppendDeletedNodeInfo(DeletedNodeInfo* pInfo)
{
- pImpEditEngine->aDeletedNodes.push_back(pInfo);
+ pImpEditEngine->aDeletedNodes.push_back(std::unique_ptr<DeletedNodeInfo>(pInfo));
}
void EditEngine::UpdateSelections()
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 815e7ae..40bb0f7 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -59,7 +59,8 @@
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
+#include <vector>
#define DEL_LEFT 1
#define DEL_RIGHT 2
@@ -467,7 +468,7 @@ private:
OnDemandTransliterationWrapper xTransliterationWrapper;
// For Formatting / Update ....
- boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
+ std::vector<std::unique_ptr<DeletedNodeInfo> > aDeletedNodes;
Rectangle aInvalidRect;
sal_uInt32 nCurTextHeight;
sal_uInt32 nCurTextHeightNTP; // without trailing empty paragraphs
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index ee31b8e..1ae1dd8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -61,6 +61,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
+#include <o3tl/make_unique.hxx>
#include <unicode/ubidi.h>
#include <algorithm>
@@ -2202,8 +2203,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
}
sal_Int32 nParagraphTobeDeleted = aEditDoc.GetPos( pRight );
- DeletedNodeInfo* pInf = new DeletedNodeInfo( pRight, nParagraphTobeDeleted );
- aDeletedNodes.push_back(pInf);
+ aDeletedNodes.push_back(o3tl::make_unique<DeletedNodeInfo>( pRight, nParagraphTobeDeleted ));
GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) );
@@ -2441,8 +2441,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_Int32 nPara )
OSL_ENSURE( pNode, "Blind Node in ImpRemoveParagraph" );
- DeletedNodeInfo* pInf = new DeletedNodeInfo( pNode, nPara );
- aDeletedNodes.push_back(pInf);
+ aDeletedNodes.push_back(o3tl::make_unique<DeletedNodeInfo>( pNode, nPara ));
// The node is managed by the undo and possibly destroyed!
aEditDoc.Release( nPara );
@@ -3293,7 +3292,7 @@ void ImpEditEngine::UpdateSelections()
bool bChanged = false;
for (size_t i = 0, n = aDeletedNodes.size(); i < n; ++i)
{
- const DeletedNodeInfo& rInf = aDeletedNodes[i];
+ const DeletedNodeInfo& rInf = *aDeletedNodes[i].get();
if ( ( aCurSel.Min().GetNode() == rInf.GetNode() ) ||
( aCurSel.Max().GetNode() == rInf.GetNode() ) )
{
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 9d878ae..5b3498e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -69,6 +69,7 @@
#include <com/sun/star/text/CharacterCompressionType.hpp>
#include <vcl/pdfextoutdevdata.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <o3tl/make_unique.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/ustrbuf.hxx>
@@ -3947,8 +3948,7 @@ void ImpEditEngine::ShowParagraph( sal_Int32 nParagraph, bool bShow )
{
// Mark as deleted, so that no selection will end or begin at
// this paragraph...
- DeletedNodeInfo* pDelInfo = new DeletedNodeInfo( pPPortion->GetNode(), nParagraph );
- aDeletedNodes.push_back(pDelInfo);
+ aDeletedNodes.push_back(o3tl::make_unique<DeletedNodeInfo>( pPPortion->GetNode(), nParagraph ));
UpdateSelections();
// The region below will not be invalidated if UpdateMode = sal_False!
// If anyway, then save as sal_False before SetVisible !
commit 5f86c1f3792a5161e2d661276c529ce05e53d44b
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 15:12:17 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Iee1e64d22e799653bc58d6a72c57c55787e45d84
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index f1ff034..63ced0a 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -501,14 +501,14 @@ EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel,
namespace {
-struct RemoveAttribsFromPool : std::unary_function<ContentAttribsInfo, void>
+struct RemoveAttribsFromPool : std::unary_function<std::unique_ptr<ContentAttribsInfo>, void>
{
SfxItemPool& mrPool;
public:
explicit RemoveAttribsFromPool(SfxItemPool& rPool) : mrPool(rPool) {}
- void operator() (ContentAttribsInfo& rInfo)
+ void operator() (std::unique_ptr<ContentAttribsInfo>& rInfo)
{
- rInfo.RemoveAllCharAttribsFromPool(mrPool);
+ rInfo->RemoveAllCharAttribsFromPool(mrPool);
}
};
@@ -528,7 +528,7 @@ void EditUndoSetAttribs::Undo()
bool bFields = false;
for ( sal_Int32 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ )
{
- const ContentAttribsInfo& rInf = aPrevAttribs[nPara-aESel.nStartPara];
+ const ContentAttribsInfo& rInf = *aPrevAttribs[nPara-aESel.nStartPara].get();
// first the paragraph attributes ...
pEE->SetParaAttribsOnly(nPara, rInf.GetPrevParaAttribs());
@@ -568,7 +568,7 @@ void EditUndoSetAttribs::Redo()
void EditUndoSetAttribs::AppendContentInfo(ContentAttribsInfo* pNew)
{
- aPrevAttribs.push_back(pNew);
+ aPrevAttribs.push_back(std::unique_ptr<ContentAttribsInfo>(pNew));
}
void EditUndoSetAttribs::ImpSetSelection( EditView* /*pView*/ )
diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx
index 411633c..4af7d38 100644
--- a/editeng/source/editeng/editundo.hxx
+++ b/editeng/source/editeng/editundo.hxx
@@ -23,7 +23,8 @@
#include <editdoc.hxx>
#include <editeng/editund2.hxx>
#include <editeng/editdata.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
class EditEngine;
class EditView;
@@ -212,7 +213,7 @@ public:
class EditUndoSetAttribs: public EditUndo
{
private:
- typedef boost::ptr_vector<ContentAttribsInfo> InfoArrayType;
+ typedef std::vector<std::unique_ptr<ContentAttribsInfo> > InfoArrayType;
ESelection aESel;
SfxItemSet aNewAttribs;
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ecfd01b..815e7ae 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -59,7 +59,7 @@
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
#include <boost/noncopyable.hpp>
-
+#include <boost/ptr_container/ptr_vector.hpp>
#define DEL_LEFT 1
#define DEL_RIGHT 2
commit 5a7a4325eca58c253270d4e9d327042a9ee2c5f0
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:59:05 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I2b4cdb3809de0e9c69253d2cd05714e15fdc8913
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index f0a4ec3..52f1c95 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -500,7 +500,7 @@ void EditTextObjectImpl::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
aReplaced.reserve(aContents.size());
ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
for (; it != itEnd; ++it)
- aReplaced.push_back(new ContentInfo(*it, *pNewPool));
+ aReplaced.push_back(std::unique_ptr<ContentInfo>(new ContentInfo(*it->get(), *pNewPool)));
aReplaced.swap(aContents);
// set local variables
@@ -612,7 +612,7 @@ EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, const EditTextOb
aContents.reserve(r.aContents.size());
ContentInfosType::const_iterator it = r.aContents.begin(), itEnd = r.aContents.end();
for (; it != itEnd; ++it)
- aContents.push_back(new ContentInfo(*it, *pPool));
+ aContents.push_back(std::unique_ptr<ContentInfo>(new ContentInfo(*it->get(), *pPool)));
}
EditTextObjectImpl::~EditTextObjectImpl()
@@ -644,7 +644,7 @@ void EditTextObjectImpl::NormalizeString( svl::SharedStringPool& rPool )
ContentInfosType::iterator it = aContents.begin(), itEnd = aContents.end();
for (; it != itEnd; ++it)
{
- ContentInfo& rInfo = *it;
+ ContentInfo& rInfo = *it->get();
rInfo.NormalizeString(rPool);
}
}
@@ -656,7 +656,7 @@ std::vector<svl::SharedString> EditTextObjectImpl::GetSharedStrings() const
ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
for (; it != itEnd; ++it)
{
- const ContentInfo& rInfo = *it;
+ const ContentInfo& rInfo = *it->get();
aSSs.push_back(rInfo.GetSharedString());
}
return aSSs;
@@ -693,8 +693,8 @@ void EditTextObjectImpl::DestroyAttrib( XEditAttribute* pAttr )
ContentInfo* EditTextObjectImpl::CreateAndInsertContent()
{
- aContents.push_back(new ContentInfo(*pPool));
- return &aContents.back();
+ aContents.push_back(std::unique_ptr<ContentInfo>(new ContentInfo(*pPool)));
+ return aContents.back().get();
}
sal_Int32 EditTextObjectImpl::GetParagraphCount() const
@@ -713,7 +713,7 @@ OUString EditTextObjectImpl::GetText(sal_Int32 nPara) const
if (nPara < 0 || static_cast<size_t>(nPara) >= aContents.size())
return OUString();
- return aContents[nPara].GetText();
+ return aContents[nPara]->GetText();
}
void EditTextObjectImpl::ClearPortionInfo()
@@ -730,7 +730,7 @@ bool EditTextObjectImpl::HasOnlineSpellErrors() const
ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
for (; it != itEnd; ++it)
{
- if ( it->GetWrongList() && !it->GetWrongList()->empty() )
+ if ( (*it)->GetWrongList() && !(*it)->GetWrongList()->empty() )
return true;
}
return false;
@@ -742,7 +742,7 @@ void EditTextObjectImpl::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttr
return;
rLst.clear();
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr)
{
const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get();
@@ -764,7 +764,7 @@ const SvxFieldItem* EditTextObjectImpl::GetField() const
{
if (aContents.size() == 1)
{
- const ContentInfo& rC = aContents[0];
+ const ContentInfo& rC = *aContents[0].get();
if (rC.GetText().getLength() == 1)
{
size_t nAttribs = rC.aAttribs.size();
@@ -784,7 +784,7 @@ const SvxFieldData* EditTextObjectImpl::GetFieldData(sal_Int32 nPara, size_t nPo
if (nPara < 0 || static_cast<size_t>(nPara) >= aContents.size())
return nullptr;
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
if (nPos >= rC.aAttribs.size())
// URL position is out-of-bound.
return nullptr;
@@ -819,7 +819,7 @@ bool EditTextObjectImpl::HasField( sal_Int32 nType ) const
size_t nParagraphs = aContents.size();
for (size_t nPara = 0; nPara < nParagraphs; ++nPara)
{
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
size_t nAttrs = rC.aAttribs.size();
for (size_t nAttr = 0; nAttr < nAttrs; ++nAttr)
{
@@ -841,7 +841,7 @@ bool EditTextObjectImpl::HasField( sal_Int32 nType ) const
const SfxItemSet& EditTextObjectImpl::GetParaAttribs(sal_Int32 nPara) const
{
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
return rC.GetParaAttribs();
}
@@ -851,7 +851,7 @@ bool EditTextObjectImpl::RemoveCharAttribs( sal_uInt16 _nWhich )
for ( size_t nPara = aContents.size(); nPara; )
{
- ContentInfo& rC = aContents[--nPara];
+ ContentInfo& rC = *aContents[--nPara].get();
for (size_t nAttr = rC.aAttribs.size(); nAttr; )
{
@@ -907,7 +907,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
// First pass: determine section borders for each paragraph.
for (size_t nPara = 0; nPara < aContents.size(); ++nPara)
{
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
SectionBordersType& rBorders = aParaBorders[nPara];
rBorders.push_back(0);
rBorders.push_back(rC.GetText().getLength());
@@ -967,7 +967,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
std::vector<editeng::Section>::iterator itAttr = aAttrs.begin();
for (sal_Int32 nPara = 0; nPara < (sal_Int32)aContents.size(); ++nPara)
{
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
itAttr = std::find_if(itAttr, aAttrs.end(), FindByParagraph(nPara));
if (itAttr == aAttrs.end())
@@ -1024,7 +1024,7 @@ void EditTextObjectImpl::GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyl
if (nPara < 0 || static_cast<size_t>(nPara) >= aContents.size())
return;
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
rName = rC.GetStyle();
rFamily = rC.GetFamily();
}
@@ -1034,7 +1034,7 @@ void EditTextObjectImpl::SetStyleSheet(sal_Int32 nPara, const OUString& rName, c
if (nPara < 0 || static_cast<size_t>(nPara) >= aContents.size())
return;
- ContentInfo& rC = aContents[nPara];
+ ContentInfo& rC = *aContents[nPara].get();
rC.GetStyle() = rName;
rC.GetFamily() = rFamily;
}
@@ -1048,7 +1048,7 @@ bool EditTextObjectImpl::ImpChangeStyleSheets(
for (size_t nPara = 0; nPara < nParagraphs; ++nPara)
{
- ContentInfo& rC = aContents[nPara];
+ ContentInfo& rC = *aContents[nPara].get();
if ( rC.GetFamily() == eOldFamily )
{
if ( rC.GetStyle() == rOldName )
@@ -1127,7 +1127,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const
// The individual paragraphs ...
for (size_t nPara = 0; nPara < nParagraphs_Stream; ++nPara)
{
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
// Text...
OStringBuffer aBuffer(OUStringToOString(rC.GetText(), eEncoding));
@@ -1249,7 +1249,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const
{
for ( size_t nPara = 0; nPara < nParagraphs_Stream; nPara++ )
{
- const ContentInfo& rC = aContents[nPara];
+ const ContentInfo& rC = *aContents[nPara].get();
sal_uInt16 nL = rC.GetText().getLength();
rOStream.WriteUInt16( nL );
rOStream.Write(rC.GetText().getStr(), nL*sizeof(sal_Unicode));
@@ -1508,7 +1508,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
{
for (sal_uInt16 nPara = 0; nPara < nParagraphs; ++nPara)
{
- ContentInfo& rC = aContents[nPara];
+ ContentInfo& rC = *aContents[nPara].get();
sal_uInt16 nL(0);
// Text
@@ -1557,7 +1557,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
{
for (size_t i = 0, n = aContents.size(); i < n; ++i)
{
- ContentInfo& rC = aContents[i];
+ ContentInfo& rC = *aContents[i].get();
const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rC.GetParaAttribs().Get(EE_PARA_LRSPACE));
if ( rLRSpace.GetTextLeft() && ( rC.GetParaAttribs().GetItemState( EE_PARA_TABS ) == SfxItemState::SET ) )
{
@@ -1607,8 +1607,8 @@ bool EditTextObjectImpl::isWrongListEqual(const EditTextObjectImpl& rCompare) co
for (size_t i = 0, n = aContents.size(); i < n; ++i)
{
- const ContentInfo& rCandA = aContents[i];
- const ContentInfo& rCandB = rCompare.aContents[i];
+ const ContentInfo& rCandA = *aContents[i].get();
+ const ContentInfo& rCandB = *rCompare.aContents[i].get();
if(!rCandA.isWrongListEqual(rCandB))
{
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 4c0c590..1f0aa5e 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -28,7 +28,6 @@
#include "svl/sharedstring.hxx"
#include <svl/languageoptions.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
#include <memory>
#include <vector>
@@ -177,7 +176,7 @@ public:
class EditTextObjectImpl : boost::noncopyable
{
public:
- typedef boost::ptr_vector<ContentInfo> ContentInfosType;
+ typedef std::vector<std::unique_ptr<ContentInfo> > ContentInfosType;
private:
EditTextObject* mpFront;
diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx
index 31e6942..5373b09 100644
--- a/editeng/source/editeng/fieldupdater.cxx
+++ b/editeng/source/editeng/fieldupdater.cxx
@@ -31,7 +31,7 @@ public:
EditTextObjectImpl::ContentInfosType& rContents = mrObj.GetContents();
for (size_t i = 0; i < rContents.size(); ++i)
{
- ContentInfo& rContent = rContents[i];
+ ContentInfo& rContent = *rContents[i].get();
ContentInfo::XEditAttributesType& rAttribs = rContent.GetAttribs();
for (size_t j = 0; j < rAttribs.size(); ++j)
{
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index db3df69..f6d5aee 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1241,7 +1241,7 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject
for (sal_Int32 n = 0; n < nContents; ++n, ++nPara)
{
- const ContentInfo* pC = &rTextObject.mpImpl->GetContents()[n];
+ const ContentInfo* pC = rTextObject.mpImpl->GetContents()[n].get();
bool bNewContent = aPaM.GetNode()->Len() == 0;
const sal_Int32 nStartPos = aPaM.GetIndex();
commit 05b9c892b8568b076a6bc14f45c889e7cd5385ca
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:51:47 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I5b3d8e0e20938d8e66045ea6282f37afe29474e2
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index f2b7c97..f0a4ec3 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -131,10 +131,10 @@ ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse
for (size_t i = 0; i < rCopyFrom.aAttribs.size(); ++i)
{
- const XEditAttribute& rAttr = rCopyFrom.aAttribs[i];
+ const XEditAttribute& rAttr = *rCopyFrom.aAttribs[i].get();
XEditAttribute* pMyAttr = MakeXEditAttribute(
rPoolToUse, *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd());
- aAttribs.push_back(pMyAttr);
+ aAttribs.push_back(std::unique_ptr<XEditAttribute>(pMyAttr));
}
if ( rCopyFrom.GetWrongList() )
@@ -145,7 +145,7 @@ ContentInfo::~ContentInfo()
{
XEditAttributesType::iterator it = aAttribs.begin(), itEnd = aAttribs.end();
for (; it != itEnd; ++it)
- aParaAttribs.GetPool()->Remove(*it->GetItem());
+ aParaAttribs.GetPool()->Remove(*(*it)->GetItem());
aAttribs.clear();
}
@@ -745,7 +745,7 @@ void EditTextObjectImpl::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttr
const ContentInfo& rC = aContents[nPara];
for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr)
{
- const XEditAttribute& rAttr = rC.aAttribs[nAttr];
+ const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get();
EECharAttrib aEEAttr;
aEEAttr.pAttr = rAttr.GetItem();
aEEAttr.nPara = nPara;
@@ -770,7 +770,7 @@ const SvxFieldItem* EditTextObjectImpl::GetField() const
size_t nAttribs = rC.aAttribs.size();
for (size_t nAttr = nAttribs; nAttr; )
{
- const XEditAttribute& rX = rC.aAttribs[--nAttr];
+ const XEditAttribute& rX = *rC.aAttribs[--nAttr].get();
if (rX.GetItem()->Which() == EE_FEATURE_FIELD)
return static_cast<const SvxFieldItem*>(rX.GetItem());
}
@@ -793,7 +793,7 @@ const SvxFieldData* EditTextObjectImpl::GetFieldData(sal_Int32 nPara, size_t nPo
size_t nCurPos = 0;
for (; it != itEnd; ++it)
{
- const XEditAttribute& rAttr = *it;
+ const XEditAttribute& rAttr = *it->get();
if (rAttr.GetItem()->Which() != EE_FEATURE_FIELD)
// Skip attributes that are not fields.
continue;
@@ -823,7 +823,7 @@ bool EditTextObjectImpl::HasField( sal_Int32 nType ) const
size_t nAttrs = rC.aAttribs.size();
for (size_t nAttr = 0; nAttr < nAttrs; ++nAttr)
{
- const XEditAttribute& rAttr = rC.aAttribs[nAttr];
+ const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get();
if (rAttr.GetItem()->Which() != EE_FEATURE_FIELD)
continue;
@@ -855,7 +855,7 @@ bool EditTextObjectImpl::RemoveCharAttribs( sal_uInt16 _nWhich )
for (size_t nAttr = rC.aAttribs.size(); nAttr; )
{
- XEditAttribute& rAttr = rC.aAttribs[--nAttr];
+ XEditAttribute& rAttr = *rC.aAttribs[--nAttr].get();
if ( !_nWhich || (rAttr.GetItem()->Which() == _nWhich) )
{
pPool->Remove(*rAttr.GetItem());
@@ -913,7 +913,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
rBorders.push_back(rC.GetText().getLength());
for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr)
{
- const XEditAttribute& rAttr = rC.aAttribs[nAttr];
+ const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get();
const SfxPoolItem* pItem = rAttr.GetItem();
if (!pItem)
continue;
@@ -979,7 +979,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
for (size_t i = 0; i < rC.aAttribs.size(); ++i)
{
- const XEditAttribute& rXAttr = rC.aAttribs[i];
+ const XEditAttribute& rXAttr = *rC.aAttribs[i].get();
const SfxPoolItem* pItem = rXAttr.GetItem();
if (!pItem)
continue;
@@ -1082,15 +1082,15 @@ void EditTextObjectImpl::ChangeStyleSheetName( SfxStyleFamily eFamily,
namespace {
-class FindAttribByChar : public std::unary_function<XEditAttribute, bool>
+class FindAttribByChar : public std::unary_function<std::unique_ptr<XEditAttribute>, bool>
{
sal_uInt16 mnWhich;
sal_uInt16 mnChar;
public:
FindAttribByChar(sal_uInt16 nWhich, sal_uInt16 nChar) : mnWhich(nWhich), mnChar(nChar) {}
- bool operator() (const XEditAttribute& rAttr) const
+ bool operator() (const std::unique_ptr<XEditAttribute>& rAttr) const
{
- return (rAttr.GetItem()->Which() == mnWhich) && (rAttr.GetStart() <= mnChar) && (rAttr.GetEnd() > mnChar);
+ return (rAttr->GetItem()->Which() == mnWhich) && (rAttr->GetStart() <= mnChar) && (rAttr->GetEnd() > mnChar);
}
};
@@ -1145,7 +1145,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const
}
for (size_t nA = 0; nA < rC.aAttribs.size(); ++nA)
{
- const XEditAttribute& rAttr = rC.aAttribs[nA];
+ const XEditAttribute& rAttr = *rC.aAttribs[nA].get();
if (rAttr.GetItem()->Which() == EE_CHAR_FONTINFO)
{
@@ -1227,7 +1227,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const
// Which = 2; Surregat = 2; Start = 2; End = 2;
for (size_t nAttr = 0; nAttr < nAttribs; ++nAttr)
{
- const XEditAttribute& rX = rC.aAttribs[nAttr];
+ const XEditAttribute& rX = *rC.aAttribs[nAttr].get();
rOStream.WriteUInt16( rX.GetItem()->Which() );
GetPool()->StoreSurrogate(rOStream, rX.GetItem());
@@ -1366,7 +1366,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
else
{
XEditAttribute* pAttr = new XEditAttribute( *pItem, nStart, nEnd );
- pC->aAttribs.push_back(pAttr);
+ pC->aAttribs.push_back(std::unique_ptr<XEditAttribute>(pAttr));
if ( ( _nWhich >= EE_FEATURE_START ) && ( _nWhich <= EE_FEATURE_END ) )
{
@@ -1395,7 +1395,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
for (size_t nAttr = pC->aAttribs.size(); nAttr; )
{
- const XEditAttribute& rAttr = pC->aAttribs[--nAttr];
+ const XEditAttribute& rAttr = *pC->aAttribs[--nAttr].get();
if ( rAttr.GetItem()->Which() == EE_CHAR_FONTINFO )
{
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(*rAttr.GetItem());
@@ -1420,7 +1420,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
pPool->Remove(*rAttr.GetItem());
pC->aAttribs.erase(pC->aAttribs.begin()+nAttr);
- pC->aAttribs.insert(pC->aAttribs.begin()+nAttr, pNewAttr);
+ pC->aAttribs.insert(pC->aAttribs.begin()+nAttr, std::unique_ptr<XEditAttribute>(pNewAttr));
for ( sal_uInt16 nChar = pNewAttr->GetStart(); nChar < pNewAttr->GetEnd(); nChar++ )
{
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index f732aaa..4c0c590 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -128,7 +128,7 @@ class ContentInfo : boost::noncopyable
{
friend class EditTextObjectImpl;
public:
- typedef boost::ptr_vector<XEditAttribute> XEditAttributesType;
+ typedef std::vector<std::unique_ptr<XEditAttribute> > XEditAttributesType;
private:
svl::SharedString maText;
diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx
index 80a35e9..31e6942 100644
--- a/editeng/source/editeng/fieldupdater.cxx
+++ b/editeng/source/editeng/fieldupdater.cxx
@@ -35,7 +35,7 @@ public:
ContentInfo::XEditAttributesType& rAttribs = rContent.GetAttribs();
for (size_t j = 0; j < rAttribs.size(); ++j)
{
- XEditAttribute& rAttr = rAttribs[j];
+ XEditAttribute& rAttr = *rAttribs[j].get();
const SfxPoolItem* pItem = rAttr.GetItem();
if (pItem->Which() != EE_FEATURE_FIELD)
// This is not a field item.
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 4f3e2bd..db3df69 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1111,7 +1111,7 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool
if ( !pX->GetLen() && !bEmptyPara )
pTxtObj->mpImpl->DestroyAttrib(pX);
else
- pC->GetAttribs().push_back(pX);
+ pC->GetAttribs().push_back(std::unique_ptr<XEditAttribute>(pX));
}
nAttr++;
pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
@@ -1259,7 +1259,7 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject
bool bUpdateFields = false;
for (size_t nAttr = 0; nAttr < nNewAttribs; ++nAttr)
{
- const XEditAttribute& rX = pC->GetAttribs()[nAttr];
+ const XEditAttribute& rX = *pC->GetAttribs()[nAttr].get();
// Can happen when paragraphs > 16K, it is simply wrapped.
if ( rX.GetEnd() <= aPaM.GetNode()->Len() )
{
commit c1cd376c2830f626ebfde9585b9ddb93ce603b48
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:44:43 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I7a49ed58cb20c365308db703c67e43c6687f35e4
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index b607b1f..f2b7c97 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -105,12 +105,12 @@ XParaPortionList::XParaPortionList(
void XParaPortionList::push_back(XParaPortion* p)
{
- maList.push_back(p);
+ maList.push_back(std::unique_ptr<XParaPortion>(p));
}
const XParaPortion& XParaPortionList::operator [](size_t i) const
{
- return maList[i];
+ return *maList[i].get();
}
ContentInfo::ContentInfo( SfxItemPool& rPool ) :
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 33b7093..f732aaa 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -31,6 +31,7 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
#include <memory>
+#include <vector>
namespace editeng {
@@ -98,7 +99,7 @@ struct XParaPortion
class XParaPortionList
{
- typedef boost::ptr_vector<XParaPortion> ListType;
+ typedef std::vector<std::unique_ptr<XParaPortion> > ListType;
ListType maList;
sal_uIntPtr nRefDevPtr;
commit a249cfc2bcc7f4e5784b47581327c99e551d0e55
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:42:13 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I562b1f7cd1e5e7f7fc03b8f54bd6117255703eb5
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 31a5786..9b484a3 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -708,7 +708,7 @@ sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos)
for (sal_Int32 nIdx = rLastPos - 2; nIdx < nEnd; ++nIdx)
{
- if (&rArray.at(nIdx) == p)
+ if (rArray.at(nIdx).get() == p)
{
rLastPos = nIdx;
return nIdx;
@@ -717,7 +717,7 @@ sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos)
}
// The world's lamest linear search from svarray...
for (sal_Int32 nIdx = 0; nIdx < nArrayLen; ++nIdx)
- if (&rArray.at(nIdx) == p)
+ if (rArray.at(nIdx).get() == p)
return rLastPos = nIdx;
// XXX "not found" condition for sal_Int32 indexes
@@ -741,12 +741,12 @@ sal_Int32 ParaPortionList::GetPos(const ParaPortion* p) const
ParaPortion* ParaPortionList::operator [](sal_Int32 nPos)
{
- return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : nullptr;
+ return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? maPortions[nPos].get() : nullptr;
}
const ParaPortion* ParaPortionList::operator [](sal_Int32 nPos) const
{
- return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : nullptr;
+ return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? maPortions[nPos].get() : nullptr;
}
ParaPortion* ParaPortionList::Release(sal_Int32 nPos)
@@ -756,7 +756,9 @@ ParaPortion* ParaPortionList::Release(sal_Int32 nPos)
SAL_WARN( "editeng", "ParaPortionList::Release - out of bounds pos " << nPos);
return nullptr;
}
- return maPortions.release(maPortions.begin()+nPos).release();
+ ParaPortion* p = maPortions[nPos].release();
+ maPortions.erase(maPortions.begin()+nPos);
+ return p;
}
void ParaPortionList::Remove(sal_Int32 nPos)
@@ -776,12 +778,12 @@ void ParaPortionList::Insert(sal_Int32 nPos, ParaPortion* p)
SAL_WARN( "editeng", "ParaPortionList::Insert - out of bounds pos " << nPos);
return;
}
- maPortions.insert(maPortions.begin()+nPos, p);
+ maPortions.insert(maPortions.begin()+nPos, std::unique_ptr<ParaPortion>(p));
}
void ParaPortionList::Append(ParaPortion* p)
{
- maPortions.push_back(p);
+ maPortions.push_back(std::unique_ptr<ParaPortion>(p));
}
sal_Int32 ParaPortionList::Count() const
@@ -805,7 +807,7 @@ long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
long nHeight = 0;
for (sal_Int32 i = 0, n = maPortions.size(); i < n; ++i)
{
- const ParaPortion* pTmpPortion = &maPortions[i];
+ const ParaPortion* pTmpPortion = maPortions[i].get();
if ( pTmpPortion == pPPortion )
return nHeight;
nHeight += pTmpPortion->GetHeight();
@@ -819,7 +821,7 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
long nY = 0;
for (size_t i = 0, n = maPortions.size(); i < n; ++i)
{
- nY += maPortions[i].GetHeight(); // should also be correct even in bVisible!
+ nY += maPortions[i]->GetHeight(); // should also be correct even in bVisible!
if ( nY > nYOffset )
return i <= SAL_MAX_INT32 ? static_cast<sal_Int32>(i) : SAL_MAX_INT32;
}
@@ -828,12 +830,12 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
const ParaPortion* ParaPortionList::SafeGetObject(sal_Int32 nPos) const
{
- return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : nullptr;
+ return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? maPortions[nPos].get() : nullptr;
}
ParaPortion* ParaPortionList::SafeGetObject(sal_Int32 nPos)
{
- return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : nullptr;
+ return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? maPortions[nPos].get() : nullptr;
}
#if OSL_DEBUG_LEVEL > 0
@@ -1982,22 +1984,22 @@ EditDoc::~EditDoc()
namespace {
-class RemoveEachItemFromPool : std::unary_function<ContentNode, void>
+class RemoveEachItemFromPool : std::unary_function<std::unique_ptr<ContentNode>, void>
{
EditDoc& mrDoc;
public:
explicit RemoveEachItemFromPool(EditDoc& rDoc) : mrDoc(rDoc) {}
- void operator() (const ContentNode& rNode)
+ void operator() (const std::unique_ptr<ContentNode>& rNode)
{
- mrDoc.RemoveItemsFromPool(rNode);
+ mrDoc.RemoveItemsFromPool(*rNode.get());
}
};
-struct ClearSpellErrorsHandler : std::unary_function<ContentNode, void>
+struct ClearSpellErrorsHandler : std::unary_function<std::unique_ptr<ContentNode>, void>
{
- void operator() (ContentNode& rNode)
+ void operator() (std::unique_ptr<ContentNode>& rNode)
{
- rNode.DestroyWrongList();
+ rNode->DestroyWrongList();
}
};
@@ -2118,12 +2120,12 @@ sal_Int32 EditDoc::GetPos(const ContentNode* p) const
const ContentNode* EditDoc::GetObject(sal_Int32 nPos) const
{
- return 0 <= nPos && nPos < (sal_Int32)maContents.size() ? &maContents[nPos] : nullptr;
+ return 0 <= nPos && nPos < (sal_Int32)maContents.size() ? maContents[nPos].get() : nullptr;
}
ContentNode* EditDoc::GetObject(sal_Int32 nPos)
{
- return 0 <= nPos && nPos < (sal_Int32)maContents.size() ? &maContents[nPos] : nullptr;
+ return 0 <= nPos && nPos < (sal_Int32)maContents.size() ? maContents[nPos].get() : nullptr;
}
const ContentNode* EditDoc::operator[](sal_Int32 nPos) const
@@ -2143,7 +2145,7 @@ void EditDoc::Insert(sal_Int32 nPos, ContentNode* p)
SAL_WARN( "editeng", "EditDoc::Insert - overflow pos " << nPos);
return;
}
- maContents.insert(maContents.begin()+nPos, p);
+ maContents.insert(maContents.begin()+nPos, std::unique_ptr<ContentNode>(p));
}
void EditDoc::Remove(sal_Int32 nPos)
@@ -2163,7 +2165,8 @@ void EditDoc::Release(sal_Int32 nPos)
SAL_WARN( "editeng", "EditDoc::Release - out of bounds pos " << nPos);
return;
}
- maContents.release(maContents.begin() + nPos).release();
+ maContents[nPos].release();
+ maContents.erase(maContents.begin() + nPos);
}
sal_Int32 EditDoc::Count() const
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 55754f6..5c419cd 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -35,7 +35,6 @@
#include <memory>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
class ImpEditEngine;
@@ -655,7 +654,7 @@ public:
class ParaPortionList
{
mutable sal_Int32 nLastCache;
- boost::ptr_vector<ParaPortion> maPortions;
+ std::vector<std::unique_ptr<ParaPortion>> maPortions;
public:
ParaPortionList();
~ParaPortionList();
@@ -743,7 +742,7 @@ class EditDoc
{
private:
mutable sal_Int32 nLastCache;
- boost::ptr_vector<ContentNode> maContents;
+ std::vector<std::unique_ptr<ContentNode> > maContents;
SfxItemPool* pItemPool;
Link<LinkParamNone*,void> aModifyHdl;
diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx
index 775f5a9..411633c 100644
--- a/editeng/source/editeng/editundo.hxx
+++ b/editeng/source/editeng/editundo.hxx
@@ -23,6 +23,7 @@
#include <editdoc.hxx>
#include <editeng/editund2.hxx>
#include <editeng/editdata.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
class EditEngine;
class EditView;
commit ed381a77fc846ec5d42d2f19c6470f4dbb7bb0bf
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:28:26 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I8fc80274e7eb33c81062f8514f63e6d0682d1b8f
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index a0abc5b..31a5786 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1125,7 +1125,7 @@ sal_Int32 EditLineList::FindLine(sal_Int32 nChar, bool bInclEnd)
sal_Int32 n = maLines.size();
for (sal_Int32 i = 0; i < n; ++i)
{
- const EditLine& rLine = maLines[i];
+ const EditLine& rLine = *maLines[i].get();
if ( (bInclEnd && (rLine.GetEnd() >= nChar)) ||
(rLine.GetEnd() > nChar) )
{
@@ -1144,22 +1144,22 @@ sal_Int32 EditLineList::Count() const
const EditLine& EditLineList::operator[](sal_Int32 nPos) const
{
- return maLines[nPos];
+ return *maLines[nPos].get();
}
EditLine& EditLineList::operator[](sal_Int32 nPos)
{
- return maLines[nPos];
+ return *maLines[nPos].get();
}
void EditLineList::Append(EditLine* p)
{
- maLines.push_back(p);
+ maLines.push_back(std::unique_ptr<EditLine>(p));
}
void EditLineList::Insert(sal_Int32 nPos, EditLine* p)
{
- maLines.insert(maLines.begin()+nPos, p);
+ maLines.insert(maLines.begin()+nPos, std::unique_ptr<EditLine>(p));
}
EditPaM::EditPaM() : pNode(nullptr), nIndex(0) {}
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 45838d9..55754f6 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -560,7 +560,7 @@ public:
class EditLineList
{
- typedef boost::ptr_vector<EditLine> LinesType;
+ typedef std::vector<std::unique_ptr<EditLine> > LinesType;
LinesType maLines;
public:
commit d489e76a514dc9cd5c9a432e51e6c8ff986b91ee
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:23:47 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I212c6b990da655ad7947154ca9e62981b049489e
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 53ff7cf..a0abc5b 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -440,22 +440,22 @@ sal_Int32 TextPortionList::Count() const
const TextPortion& TextPortionList::operator[](sal_Int32 nPos) const
{
- return maPortions[nPos];
+ return *maPortions[nPos].get();
}
TextPortion& TextPortionList::operator[](sal_Int32 nPos)
{
- return maPortions[nPos];
+ return *maPortions[nPos].get();
}
void TextPortionList::Append(TextPortion* p)
{
- maPortions.push_back(p);
+ maPortions.push_back(std::unique_ptr<TextPortion>(p));
}
void TextPortionList::Insert(sal_Int32 nPos, TextPortion* p)
{
- maPortions.insert(maPortions.begin()+nPos, p);
+ maPortions.insert(maPortions.begin()+nPos, std::unique_ptr<TextPortion>(p));
}
void TextPortionList::Remove(sal_Int32 nPos)
@@ -465,14 +465,14 @@ void TextPortionList::Remove(sal_Int32 nPos)
namespace {
-class FindTextPortionByAddress : std::unary_function<TextPortion, bool>
+class FindTextPortionByAddress : std::unary_function<std::unique_ptr<TextPortion>, bool>
{
const TextPortion* mp;
public:
explicit FindTextPortionByAddress(const TextPortion* p) : mp(p) {}
- bool operator() (const TextPortion& v) const
+ bool operator() (const std::unique_ptr<TextPortion>& v) const
{
- return &v == mp;
+ return v.get() == mp;
}
};
@@ -497,7 +497,7 @@ sal_Int32 TextPortionList::FindPortion(
sal_Int32 n = maPortions.size();
for (sal_Int32 i = 0; i < n; ++i)
{
- const TextPortion& rPortion = maPortions[i];
+ const TextPortion& rPortion = *maPortions[i].get();
nTmpPos = nTmpPos + rPortion.GetLen();
if ( nTmpPos >= nCharPos )
{
@@ -518,7 +518,7 @@ sal_Int32 TextPortionList::GetStartPos(sal_Int32 nPortion)
sal_Int32 nPos = 0;
for (sal_Int32 i = 0; i < nPortion; ++i)
{
- const TextPortion& rPortion = maPortions[i];
+ const TextPortion& rPortion = *maPortions[i].get();
nPos = nPos + rPortion.GetLen();
}
return nPos;
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 02d2af9..45838d9 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -445,7 +445,7 @@ public:
class TextPortionList
{
- typedef boost::ptr_vector<TextPortion> PortionsType;
+ typedef std::vector<std::unique_ptr<TextPortion> > PortionsType;
PortionsType maPortions;
public:
commit bb4379a2e4d58485dd44da03f324ca0fd13c49d9
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 14:19:47 2015 +0200
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ifc44041290d44c5e4dcbd9a0882b99fe0f8f62a5
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index e77d95c..810315e 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -351,21 +351,21 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
bool bZeroAttr = false;
for ( sal_Int32 z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); ++z )
{
- const EditCharAttrib& rAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs()[z];
+ const std::unique_ptr<EditCharAttrib>& rAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs()[z];
OStringBuffer aCharAttribs;
aCharAttribs.append("\nA");
aCharAttribs.append(static_cast<sal_Int32>(nPortion));
aCharAttribs.append(": ");
- aCharAttribs.append(static_cast<sal_Int32>(rAttr.GetItem()->Which()));
+ aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetItem()->Which()));
aCharAttribs.append('\t');
- aCharAttribs.append(static_cast<sal_Int32>(rAttr.GetStart()));
+ aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetStart()));
aCharAttribs.append('\t');
- aCharAttribs.append(static_cast<sal_Int32>(rAttr.GetEnd()));
- if ( rAttr.IsEmpty() )
+ aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetEnd()));
+ if ( rAttr->IsEmpty() )
bZeroAttr = true;
fprintf(fp, "%s => ", aCharAttribs.getStr());
- OString aDebStr = DbgOutItem( rPool, *rAttr.GetItem() );
+ OString aDebStr = DbgOutItem( rPool, *rAttr->GetItem() );
fprintf( fp, "%s", aDebStr.getStr() );
}
if ( bZeroAttr )
@@ -501,10 +501,9 @@ bool ParaPortion::DbgCheckTextPortions(ParaPortion const& rPara)
void CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart)
{
sal_Int32 nPrev = 0;
- for (size_t nAttr = 0; nAttr < rAttribs.size(); ++nAttr)
+ for (const std::unique_ptr<EditCharAttrib>& rAttr : rAttribs)
{
- const EditCharAttrib& rAttr = rAttribs[nAttr];
- sal_Int32 const nCur = bStart ? rAttr.GetStart() : rAttr.GetEnd();
+ sal_Int32 const nCur = bStart ? rAttr->GetStart() : rAttr->GetEnd();
assert(nCur >= nPrev);
nPrev = nCur;
}
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index ec6aad4..53ff7cf 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -66,6 +66,7 @@
#include <cassert>
#include <limits>
+#include <algorithm>
using namespace ::com::sun::star;
@@ -856,14 +857,13 @@ ContentAttribsInfo::ContentAttribsInfo( const SfxItemSet& rParaAttribs ) :
void ContentAttribsInfo::RemoveAllCharAttribsFromPool(SfxItemPool& rPool) const
{
- CharAttribsType::const_iterator it = aPrevCharAttribs.begin(), itEnd = aPrevCharAttribs.end();
- for (; it != itEnd; ++it)
- rPool.Remove(*it->GetItem());
+ for (const std::unique_ptr<EditCharAttrib>& rAttrib : aPrevCharAttribs)
+ rPool.Remove(*rAttrib->GetItem());
}
void ContentAttribsInfo::AppendCharAttrib(EditCharAttrib* pNew)
{
- aPrevCharAttribs.push_back(pNew);
+ aPrevCharAttribs.push_back(std::unique_ptr<EditCharAttrib>(pNew));
}
void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit )
@@ -1353,7 +1353,7 @@ void ContentNode::ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNew, SfxItemPool&
sal_uInt16 nW = pAttrib->GetItem()->Which();
for ( sal_Int32 nA = 0; nA < nAttr; nA++ )
{
- const EditCharAttrib& r = aCharAttribList.GetAttribs()[nA];
+ const EditCharAttrib& r = *aCharAttribList.GetAttribs()[nA].get();
if ( ( r.GetStart() == 0 ) && ( r.GetItem()->Which() == nW ) )
{
bExpand = false;
@@ -1547,7 +1547,8 @@ void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool,
{
// Move all attributes in the current node (this)
CharAttribList::AttribsType::iterator it = rPrevAttribs.begin() + nAttr;
- aCharAttribList.InsertAttrib(rPrevAttribs.release(it).release());
+ aCharAttribList.InsertAttrib(it->release());
+ rPrevAttribs.erase(it);
pAttrib->MoveBackward( nCut );
nAttr--;
}
@@ -1617,7 +1618,8 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode )
pAttrib->GetStart() = pAttrib->GetStart() + nNewStart;
pAttrib->GetEnd() = pAttrib->GetEnd() + nNewStart;
CharAttribList::AttribsType::iterator it = rNextAttribs.begin() + nAttr;
- aCharAttribList.InsertAttrib(rNextAttribs.release(it).release());
+ aCharAttribList.InsertAttrib(it->release());
+ rNextAttribs.erase(it);
}
pAttrib = GetAttrib(rNextAttribs, nAttr);
}
@@ -1679,7 +1681,7 @@ sal_uLong ContentNode::GetExpandedLen() const
const CharAttribList::AttribsType& rAttrs = GetCharAttribs().GetAttribs();
for (sal_Int32 nAttr = rAttrs.size(); nAttr; )
{
- const EditCharAttrib& rAttr = rAttrs[--nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[--nAttr].get();
if (rAttr.Which() == EE_FEATURE_FIELD)
{
nLen += static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().getLength();
@@ -1741,9 +1743,9 @@ void ContentNode::UnExpandPosition( sal_Int32 &rPos, bool bBiasStart )
const CharAttribList::AttribsType& rAttrs = GetCharAttribs().GetAttribs();
for (size_t nAttr = 0; nAttr < rAttrs.size(); ++nAttr )
{
- const EditCharAttrib& rAttr = rAttrs[nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[nAttr].get();
assert (!(nAttr < rAttrs.size() - 1) ||
- rAttrs[nAttr].GetStart() <= rAttrs[nAttr + 1].GetStart());
+ rAttrs[nAttr]->GetStart() <= rAttrs[nAttr + 1]->GetStart());
nOffset = rAttr.GetStart();
@@ -2011,7 +2013,7 @@ void EditDoc::RemoveItemsFromPool(const ContentNode& rNode)
{
for (sal_Int32 nAttr = 0; nAttr < rNode.GetCharAttribs().Count(); ++nAttr)
{
- const EditCharAttrib& rAttr = rNode.GetCharAttribs().GetAttribs()[nAttr];
+ const EditCharAttrib& rAttr = *rNode.GetCharAttribs().GetAttribs()[nAttr].get();
GetItemPool().Remove(*rAttr.GetItem());
}
}
@@ -2722,11 +2724,11 @@ void EditDoc::FindAttribs( ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nE
namespace {
-struct LessByStart : std::binary_function<EditCharAttrib, EditCharAttrib, bool>
+struct LessByStart : std::binary_function<std::unique_ptr<EditCharAttrib>, std::unique_ptr<EditCharAttrib>, bool>
{
- bool operator() (const EditCharAttrib& left, const EditCharAttrib& right) const
+ bool operator() (const std::unique_ptr<EditCharAttrib>& left, const std::unique_ptr<EditCharAttrib>& right) const
{
- return left.GetStart() < right.GetStart();
+ return left->GetStart() < right->GetStart();
}
};
@@ -2766,16 +2768,16 @@ void CharAttribList::InsertAttrib( EditCharAttrib* pAttrib )
bool bInsert(true);
for (sal_Int32 i = 0, n = aAttribs.size(); i < n; ++i)
{
- const EditCharAttrib& rCurAttrib = aAttribs[i];
+ const EditCharAttrib& rCurAttrib = *aAttribs[i].get();
if (rCurAttrib.GetStart() > nStart)
{
- aAttribs.insert(aAttribs.begin()+i, pAttrib);
+ aAttribs.insert(aAttribs.begin()+i, std::unique_ptr<EditCharAttrib>(pAttrib));
bInsert = false;
break;
}
}
- if (bInsert) aAttribs.push_back(pAttrib);
+ if (bInsert) aAttribs.push_back(std::unique_ptr<EditCharAttrib>(pAttrib));
#if OSL_DEBUG_LEVEL > 0
CharAttribList::DbgCheckAttribs(*this);
@@ -2784,7 +2786,7 @@ void CharAttribList::InsertAttrib( EditCharAttrib* pAttrib )
void CharAttribList::ResortAttribs()
{
- aAttribs.sort(LessByStart());
+ std::sort(aAttribs.begin(), aAttribs.end(), LessByStart());
#if OSL_DEBUG_LEVEL > 0
CharAttribList::DbgCheckAttribs(*this);
@@ -2798,10 +2800,10 @@ void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool )
#endif
for (sal_Int32 i = 0; i < (sal_Int32)aAttribs.size(); ++i)
{
- EditCharAttrib& rAttr = aAttribs[i];
+ EditCharAttrib& rAttr = *aAttribs[i].get();
for (sal_Int32 nNext = i+1; nNext < (sal_Int32)aAttribs.size(); ++nNext)
{
- EditCharAttrib& rNext = aAttribs[nNext];
+ EditCharAttrib& rNext = *aAttribs[nNext].get();
if (!rAttr.IsFeature() && rNext.GetStart() == rAttr.GetEnd() && rNext.Which() == rAttr.Which())
{
if (*rNext.GetItem() == *rAttr.GetItem())
@@ -2835,7 +2837,7 @@ const EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 n
AttribsType::const_reverse_iterator it = aAttribs.rbegin(), itEnd = aAttribs.rend();
for (; it != itEnd; ++it)
{
- const EditCharAttrib& rAttr = *it;
+ const EditCharAttrib& rAttr = *it->get();
if (rAttr.Which() == nWhich && rAttr.IsIn(nPos))
return &rAttr;
}
@@ -2849,7 +2851,7 @@ EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos )
AttribsType::reverse_iterator it = aAttribs.rbegin(), itEnd = aAttribs.rend();
for (; it != itEnd; ++it)
{
- EditCharAttrib& rAttr = *it;
+ EditCharAttrib& rAttr = *it->get();
if (rAttr.Which() == nWhich && rAttr.IsIn(nPos))
return &rAttr;
}
@@ -2862,7 +2864,7 @@ const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_Int
AttribsType::const_iterator it = aAttribs.begin(), itEnd = aAttribs.end();
for (; it != itEnd; ++it)
{
- const EditCharAttrib& rAttr = *it;
+ const EditCharAttrib& rAttr = *it->get();
if (rAttr.GetStart() >= nFromPos && rAttr.Which() == nWhich)
return &rAttr;
}
@@ -2874,7 +2876,7 @@ bool CharAttribList::HasAttrib( sal_Int32 nStartPos, sal_Int32 nEndPos ) const
AttribsType::const_reverse_iterator it = aAttribs.rbegin(), itEnd = aAttribs.rend();
for (; it != itEnd; ++it)
{
- const EditCharAttrib& rAttr = *it;
+ const EditCharAttrib& rAttr = *it->get();
if (rAttr.GetStart() < nEndPos && rAttr.GetEnd() > nStartPos)
return true;
}
@@ -2885,14 +2887,14 @@ bool CharAttribList::HasAttrib( sal_Int32 nStartPos, sal_Int32 nEndPos ) const
namespace {
-class FindByAddress : std::unary_function<EditCharAttrib, bool>
+class FindByAddress : std::unary_function<std::unique_ptr<EditCharAttrib>, bool>
{
const EditCharAttrib* mpAttr;
public:
explicit FindByAddress(const EditCharAttrib* p) : mpAttr(p) {}
- bool operator() (const EditCharAttrib& r) const
+ bool operator() (const std::unique_ptr<EditCharAttrib>& r) const
{
- return &r == mpAttr;
+ return r.get() == mpAttr;
}
};
@@ -2917,7 +2919,10 @@ void CharAttribList::Release(const EditCharAttrib* p)
{
AttribsType::iterator it = std::find_if(aAttribs.begin(), aAttribs.end(), FindByAddress(p));
if (it != aAttribs.end())
- aAttribs.release(it).release();
+ {
+ it->release();
+ aAttribs.erase(it);
+ }
}
void CharAttribList::SetHasEmptyAttribs(bool b)
@@ -2932,7 +2937,7 @@ bool CharAttribList::HasBoundingAttrib( sal_Int32 nBound ) const
AttribsType::const_reverse_iterator it = aAttribs.rbegin(), itEnd = aAttribs.rend();
for (; it != itEnd; ++it)
{
- const EditCharAttrib& rAttr = *it;
+ const EditCharAttrib& rAttr = *it->get();
if (rAttr.GetEnd() < nBound)
return false;
@@ -2947,12 +2952,10 @@ const EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_In
if ( !bHasEmptyAttribs )
return nullptr;
- AttribsType::const_iterator it = aAttribs.begin(), itEnd = aAttribs.end();
- for (; it != itEnd; ++it)
+ for (const std::unique_ptr<EditCharAttrib>& rAttr : aAttribs)
{
- const EditCharAttrib& rAttr = *it;
- if (rAttr.GetStart() == nPos && rAttr.GetEnd() == nPos && rAttr.Which() == nWhich)
- return &rAttr;
+ if (rAttr->GetStart() == nPos && rAttr->GetEnd() == nPos && rAttr->Which() == nWhich)
+ return rAttr.get();
}
return nullptr;
}
@@ -2962,26 +2965,24 @@ EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nP
if ( !bHasEmptyAttribs )
return nullptr;
- AttribsType::iterator it = aAttribs.begin(), itEnd = aAttribs.end();
- for (; it != itEnd; ++it)
+ for (const std::unique_ptr<EditCharAttrib>& rAttr : aAttribs)
{
- EditCharAttrib& rAttr = *it;
- if (rAttr.GetStart() == nPos && rAttr.GetEnd() == nPos && rAttr.Which() == nWhich)
- return &rAttr;
+ if (rAttr->GetStart() == nPos && rAttr->GetEnd() == nPos && rAttr->Which() == nWhich)
+ return rAttr.get();
}
return nullptr;
}
namespace {
-class FindByStartPos : std::unary_function<EditCharAttrib, bool>
+class FindByStartPos : std::unary_function<std::unique_ptr<EditCharAttrib>, bool>
{
sal_Int32 mnPos;
public:
explicit FindByStartPos(sal_Int32 nPos) : mnPos(nPos) {}
- bool operator() (const EditCharAttrib& r) const
+ bool operator() (const std::unique_ptr<EditCharAttrib>& r) const
{
- return r.GetStart() >= mnPos;
+ return r->GetStart() >= mnPos;
}
};
@@ -2998,21 +2999,21 @@ const EditCharAttrib* CharAttribList::FindFeature( sal_Int32 nPos ) const
return nullptr;
// And find the first attribute with feature.
- it = std::find_if(it, aAttribs.end(), [](const EditCharAttrib& aAttrib) { return aAttrib.IsFeature(); } );
- return it == aAttribs.end() ? nullptr : &(*it);
+ it = std::find_if(it, aAttribs.end(), [](const std::unique_ptr<EditCharAttrib>& aAttrib) { return aAttrib->IsFeature(); } );
+ return it == aAttribs.end() ? nullptr : it->get();
}
namespace {
-class RemoveEmptyAttrItem : std::unary_function<EditCharAttrib, void>
+class RemoveEmptyAttrItem : std::unary_function<std::unique_ptr<EditCharAttrib>, void>
{
SfxItemPool& mrItemPool;
public:
explicit RemoveEmptyAttrItem(SfxItemPool& rPool) : mrItemPool(rPool) {}
- void operator() (const EditCharAttrib& r)
+ void operator() (const std::unique_ptr<EditCharAttrib>& r)
{
- if (r.IsEmpty())
- mrItemPool.Remove(*r.GetItem());
+ if (r->IsEmpty())
+ mrItemPool.Remove(*r->GetItem());
}
};
@@ -3021,25 +3022,22 @@ public:
void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool )
{
std::for_each(aAttribs.begin(), aAttribs.end(), RemoveEmptyAttrItem(rItemPool));
- aAttribs.erase_if([](const EditCharAttrib& aAttrib) { return aAttrib.IsEmpty(); } );
+ aAttribs.erase( std::remove_if(aAttribs.begin(), aAttribs.end(), [](const std::unique_ptr<EditCharAttrib>& aAttrib) { return aAttrib->IsEmpty(); } ), aAttribs.end() );
bHasEmptyAttribs = false;
}
#if OSL_DEBUG_LEVEL > 0
void CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs)
{
- AttribsType::const_iterator it = rAttribs.aAttribs.begin();
- AttribsType::const_iterator itEnd = rAttribs.aAttribs.end();
std::set<std::pair<sal_Int32, sal_uInt16>> zero_set;
- for (; it != itEnd; ++it)
+ for (const std::unique_ptr<EditCharAttrib>& rAttr : rAttribs.aAttribs)
{
- const EditCharAttrib& rAttr = *it;
- assert(rAttr.GetStart() <= rAttr.GetEnd());
- assert(!rAttr.IsFeature() || rAttr.GetLen() == 1);
- if (0 == rAttr.GetLen())
+ assert(rAttr->GetStart() <= rAttr->GetEnd());
+ assert(!rAttr->IsFeature() || rAttr->GetLen() == 1);
+ if (0 == rAttr->GetLen())
{
// not sure if 0-length attributes allowed at all in non-empty para?
- assert(zero_set.insert(std::make_pair(rAttr.GetStart(), rAttr.Which())).second && "duplicate 0-length attribute detected");
+ assert(zero_set.insert(std::make_pair(rAttr->GetStart(), rAttr->Which())).second && "duplicate 0-length attribute detected");
}
}
CheckOrderedList(rAttribs.GetAttribs(), true);
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index e1b4914..02d2af9 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -113,7 +113,7 @@ typedef std::deque< WritingDirectionInfo > WritingDirectionInfos;
class ContentAttribsInfo
{
private:
- typedef boost::ptr_vector<EditCharAttrib> CharAttribsType;
+ typedef std::vector<std::unique_ptr<EditCharAttrib> > CharAttribsType;
SfxItemSet aPrevParaAttribs;
CharAttribsType aPrevCharAttribs;
@@ -184,7 +184,7 @@ public:
class CharAttribList
{
public:
- typedef boost::ptr_vector<EditCharAttrib> AttribsType;
+ typedef std::vector<std::unique_ptr<EditCharAttrib> > AttribsType;
private:
AttribsType aAttribs;
@@ -828,7 +828,7 @@ public:
inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, sal_Int32 nAttr)
{
- return (nAttr < (sal_Int32)rAttribs.size()) ? &rAttribs[nAttr] : nullptr;
+ return (nAttr < (sal_Int32)rAttribs.size()) ? rAttribs[nAttr].get() : nullptr;
}
void CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart);
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 1439768..203531a 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2234,7 +2234,7 @@ sal_uInt16 EditEngine::GetFieldCount( sal_Int32 nPara ) const
CharAttribList::AttribsType::const_iterator it = rAttrs.begin(), itEnd = rAttrs.end();
for (; it != itEnd; ++it)
{
- if (it->Which() == EE_FEATURE_FIELD)
+ if ((*it)->Which() == EE_FEATURE_FIELD)
++nFields;
}
}
@@ -2252,7 +2252,7 @@ EFieldInfo EditEngine::GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const
CharAttribList::AttribsType::const_iterator it = rAttrs.begin(), itEnd = rAttrs.end();
for (; it != itEnd; ++it)
{
- const EditCharAttrib& rAttr = *it;
+ const EditCharAttrib& rAttr = *it->get();
if (rAttr.Which() == EE_FEATURE_FIELD)
{
if ( nCurrentField == nField )
@@ -2297,7 +2297,7 @@ void EditEngine::RemoveFields( bool bKeepFieldText, std::function<bool ( const S
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
for (size_t nAttr = rAttrs.size(); nAttr; )
{
- const EditCharAttrib& rAttr = rAttrs[--nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[--nAttr].get();
if (rAttr.Which() == EE_FEATURE_FIELD)
{
const SvxFieldData* pFldData = static_cast<const SvxFieldItem*>(rAttr.GetItem())->GetField();
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 2ede585..f1ff034 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -540,7 +540,7 @@ void EditUndoSetAttribs::Undo()
ContentNode* pNode = pEE->GetEditDoc().GetObject( nPara );
for (size_t nAttr = 0; nAttr < rInf.GetPrevCharAttribs().size(); ++nAttr)
{
- const EditCharAttrib& rX = rInf.GetPrevCharAttribs()[nAttr];
+ const EditCharAttrib& rX = *rInf.GetPrevCharAttribs()[nAttr].get();
// is automatically "poolsized"
pEE->GetEditDoc().InsertAttrib(pNode, rX.GetStart(), rX.GetEnd(), *rX.GetItem());
if (rX.Which() == EE_FEATURE_FIELD)
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 0741984..5653731 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1106,7 +1106,7 @@ const SvxFieldItem* EditView::GetFieldAtSelection() const
const sal_Int32 nXPos = aPaM.GetIndex();
for (size_t nAttr = rAttrs.size(); nAttr; )
{
- const EditCharAttrib& rAttr = rAttrs[--nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[--nAttr].get();
if (rAttr.GetStart() == nXPos)
if (rAttr.Which() == EE_FEATURE_FIELD)
{
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 40a7efa..11e78d5 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1302,7 +1302,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara,
const sal_Int32 nXPos = aPaM.GetIndex();
for (size_t nAttr = rAttrs.size(); nAttr; )
{
- const EditCharAttrib& rAttr = rAttrs[--nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[--nAttr].get();
if (rAttr.GetStart() == nXPos)
{
if (rAttr.Which() == EE_FEATURE_FIELD)
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 354ba80..ee31b8e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2048,7 +2048,7 @@ void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_Int32 nChars, EditU
const CharAttribList::AttribsType& rAttribs = rPaM.GetNode()->GetCharAttribs().GetAttribs();
for (size_t i = 0, n = rAttribs.size(); i < n; ++i)
{
- const EditCharAttrib& rAttr = rAttribs[i];
+ const EditCharAttrib& rAttr = *rAttribs[i].get();
if (rAttr.GetEnd() >= nStart && rAttr.GetStart() < nEnd)
{
EditSelection aSel( rPaM );
@@ -2928,7 +2928,7 @@ bool ImpEditEngine::UpdateFields()
CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs();
for (size_t nAttr = 0; nAttr < rAttribs.size(); ++nAttr)
{
- EditCharAttrib& rAttr = rAttribs[nAttr];
+ EditCharAttrib& rAttr = *rAttribs[nAttr].get();
if (rAttr.Which() == EE_FEATURE_FIELD)
{
EditCharAttribField& rField = static_cast<EditCharAttribField&>(rAttr);
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index bbc2f6d..9d878ae 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1785,7 +1785,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
for (size_t nAttr = rAttrs.size(); nAttr; )
{
- const EditCharAttrib& rAttr = rAttrs[--nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[--nAttr].get();
if (rAttr.IsFeature() && rAttr.GetEnd() > nMinBreakPos && rAttr.GetEnd() <= nMaxBreakPos)
{
nMinBreakPos = rAttr.GetEnd();
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 187939a..51d947e 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -211,7 +211,7 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S
for ( sal_Int32 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ )
{
- const EditCharAttrib& rAttr = pNode->GetCharAttribs().GetAttribs()[nAttr];
+ const EditCharAttrib& rAttr = *pNode->GetCharAttribs().GetAttribs()[nAttr].get();
if (rAttr.GetLen())
{
EditCharAttrib* pNew = MakeCharAttrib(*pPool, *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd());
@@ -430,7 +430,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
for (size_t nAttr = 0; nAttr < rAttrs.size(); ++nAttr)
{
- const EditCharAttrib& rAttr = rAttrs[nAttr];
+ const EditCharAttrib& rAttr = *rAttrs[nAttr].get();
if ( nStart == nEnd )
{
@@ -544,7 +544,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs();
for (size_t i = 0, n = rAttribs.size(); i < n; ++i)
{
- EditCharAttrib& rAttr = rAttribs[i];
+ EditCharAttrib& rAttr = *rAttribs[i].get();
if (rAttr.GetStart() > nEndPos)
break;
@@ -732,7 +732,7 @@ void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>&
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
for (size_t i = 0; i < rAttrs.size(); ++i)
{
- const EditCharAttrib& rAttr = rAttrs[i];
+ const EditCharAttrib& rAttr = *rAttrs[i].get();
EECharAttrib aEEAttr;
aEEAttr.pAttr = rAttr.GetItem();
aEEAttr.nPara = nPara;
commit 5ec7d783ed8a9506389005d4a63da507abdb68dd
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 13:22:30 2015 +0200
cui: convert boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I96a1090ea8617644748afdea2786949fb0506b72
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index a713d0d..7f4c65e 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -378,7 +378,7 @@ void SvxConfigGroupListBox::fillScriptList( const Reference< browse::XBrowseNode
SvxGroupInfo_Impl* pInfo =
new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, theChild );
pNewEntry->SetUserData( pInfo );
- aArr.push_back( pInfo );
+ aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
if ( _bCheapChildrenOnDemand )
{
@@ -500,7 +500,7 @@ void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame
SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
- aArr.push_back( pInfo );
+ aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
pEntry->SetUserData( pInfo );
}
@@ -532,7 +532,7 @@ void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame
SvTreeListEntry *pNewEntry = InsertEntry( aTitle );
pNewEntry->SetUserData( pInfo );
pNewEntry->EnableChildrenOnDemand();
- aArr.push_back( pInfo );
+ aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
}
else
{
@@ -726,7 +726,7 @@ void SvxConfigGroupListBox::GroupSelected()
SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl(
SVX_CFGFUNCTION_SLOT, 123, aCmdURL, OUString() );
- pFunctionListBox->aArr.push_back( _pGroupInfo );
+ pFunctionListBox->aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(_pGroupInfo) );
pFuncEntry->SetUserData( _pGroupInfo );
}
@@ -783,7 +783,7 @@ void SvxConfigGroupListBox::GroupSelected()
pNewEntry->SetUserData( _pGroupInfo );
- pFunctionListBox->aArr.push_back( _pGroupInfo );
+ pFunctionListBox->aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(_pGroupInfo) );
}
}
diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx
index 4d65c04..2f6b194 100644
--- a/cui/source/inc/selector.hxx
+++ b/cui/source/inc/selector.hxx
@@ -30,7 +30,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/script/browse/XBrowseNode.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
class SaveInData;
@@ -80,7 +80,7 @@ struct SvxGroupInfo_Impl
}
};
-typedef boost::ptr_vector<SvxGroupInfo_Impl> SvxGroupInfoArr_Impl;
+typedef std::vector<std::unique_ptr<SvxGroupInfo_Impl> > SvxGroupInfoArr_Impl;
class SvxConfigFunctionListBox : public SvTreeListBox
{
commit 13815efe3d92226155531e523cbd0cf1faaa8d54
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 13:15:58 2015 +0200
cui: boost::ptr_vector->std::vector<unique_ptr>
Change-Id: Ieddd13abc6bb23904db10f303dfc85cd87cfaa03
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 8d83f10..8e7194c 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -20,7 +20,7 @@
#define INCLUDED_CUI_SOURCE_INC_NUMPAGES_HXX
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
#include <sfx2/tabdlg.hxx>
#include <vcl/group.hxx>
@@ -76,7 +76,7 @@ struct SvxNumSettings_Impl
{}
};
-typedef boost::ptr_vector<SvxNumSettings_Impl> SvxNumSettingsArr_Impl;
+typedef std::vector<std::unique_ptr<SvxNumSettings_Impl> > SvxNumSettingsArr_Impl;
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 4456e89..e032500 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -213,7 +213,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(vcl::Window* pParent,
for(sal_Int32 i = 0; i < nLength; i++)
{
SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
- aNumSettingsArr.push_back(pNew);
+ aNumSettingsArr.push_back(std::unique_ptr<SvxNumSettings_Impl>(pNew));
}
}
catch(const Exception&)
@@ -336,7 +336,7 @@ IMPL_LINK_NOARG_TYPED(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, voi
DBG_ASSERT(aNumSettingsArr.size() > nIdx, "wrong index");
if(aNumSettingsArr.size() <= nIdx)
return;
- SvxNumSettings_Impl* _pSet = &aNumSettingsArr[nIdx];
+ SvxNumSettings_Impl* _pSet = aNumSettingsArr[nIdx].get();
sal_Int16 eNewType = _pSet->nNumberType;
const sal_Unicode cLocalPrefix = !_pSet->sPrefix.isEmpty() ? _pSet->sPrefix[0] : 0;
const sal_Unicode cLocalSuffix = !_pSet->sSuffix.isEmpty() ? _pSet->sSuffix[0] : 0;
@@ -580,7 +580,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(vcl::Window* pParent,
Sequence<PropertyValue> aLevelProps;
aValueAny >>= aLevelProps;
SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aLevelProps);
- rItemArr.push_back( pNew );
+ rItemArr.push_back( std::unique_ptr<SvxNumSettings_Impl>(pNew) );
}
}
}
@@ -710,7 +710,7 @@ IMPL_LINK_NOARG_TYPED(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
{
if(rItemArr.size() > i)
- pLevelSettings = &rItemArr[i];
+ pLevelSettings = rItemArr[i].get();
if(!pLevelSettings)
break;
SvxNumberFormat aFmt(pActNum->GetLevel(i));
commit c83bf01e6ec3386e2dd1a97112ff4696881dc323
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 13:06:41 2015 +0200
cui: boost::ptr_vector->std::vector<unique_ptr>
Change-Id: If2e8e7eddd5e75a211940416b4370c8f7768849e
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 1102c4c..43674f2 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -60,6 +60,7 @@
#include "dialmgr.hxx"
#include <svl/stritem.hxx>
#include <vcl/builderfactory.hxx>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -292,7 +293,7 @@ void SfxConfigFunctionListBox::ClearAll()
sal_uInt16 nCount = aArr.size();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- SfxGroupInfo_Impl *pData = &aArr[i];
+ SfxGroupInfo_Impl *pData = aArr[i].get();
if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
{
@@ -427,7 +428,7 @@ void SfxConfigGroupListBox::ClearAll()
sal_uInt16 nCount = aArr.size();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- SfxGroupInfo_Impl *pData = &aArr[i];
+ SfxGroupInfo_Impl *pData = aArr[i].get();
if (pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER)
{
XInterface* xi = static_cast<XInterface *>(pData->pObject);
@@ -583,15 +584,12 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
//get autodestructed and become invalid when accessed later.
rootNode->acquire();
- SfxGroupInfo_Impl *pInfo =
- new SfxGroupInfo_Impl( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
- static_cast<void *>(rootNode.get()));
-
+ aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
+ static_cast<void *>(rootNode.get())));
OUString aTitle(pImp->m_sDlgMacros);
SvTreeListEntry *pNewEntry = InsertEntry( aTitle );
- pNewEntry->SetUserData( pInfo );
+ pNewEntry->SetUserData( aArr.back().get() );
pNewEntry->EnableChildrenOnDemand();
- aArr.push_back( pInfo );
}
else
{
@@ -654,18 +652,16 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
// get autodestructed and become invalid when accessed later.
theChild->acquire();
- SfxGroupInfo_Impl* pInfo =
- new SfxGroupInfo_Impl(SfxCfgKind::GROUP_SCRIPTCONTAINER,
- 0, static_cast<void *>( theChild.get()));
-
Image aImage = GetImage( theChild, xCtx, bIsRootNode );
SvTreeListEntry* pNewEntry =
InsertEntry( uiName );
SetExpandedEntryBmp( pNewEntry, aImage );
SetCollapsedEntryBmp( pNewEntry, aImage );
- pNewEntry->SetUserData( pInfo );
- aArr.push_back( pInfo );
+ aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
+ 0, static_cast<void *>( theChild.get())));
+
+ pNewEntry->SetUserData( aArr.back().get() );
if ( children[n]->hasChildNodes() )
{
@@ -696,9 +692,8 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
{
OUString sStyle( pImp->m_aStrGroupStyles );
SvTreeListEntry *pEntry = InsertEntry( sStyle );
- SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SfxCfgKind::GROUP_STYLES, 0, nullptr ); // TODO last parameter should contain user data
- aArr.push_back( pInfo );
- pEntry->SetUserData( pInfo );
+ aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
+ pEntry->SetUserData( aArr.back().get() );
pEntry->EnableChildrenOnDemand();
}
@@ -899,7 +894,6 @@ void SfxConfigGroupListBox::GroupSelected()
value >>= uri;
OUString* pScriptURI = new OUString( uri );
- SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI );
Image aImage = GetImage( children[n], Reference< XComponentContext >(), false );
SvTreeListEntry* pNewEntry =
@@ -907,12 +901,10 @@ void SfxConfigGroupListBox::GroupSelected()
pFunctionListBox->SetExpandedEntryBmp( pNewEntry, aImage );
pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage );
- pGrpInfo->sCommand = uri;
- pGrpInfo->sLabel = children[n]->getName();
- pNewEntry->SetUserData( pGrpInfo );
-
- pFunctionListBox->aArr.push_back( pGrpInfo );
-
+ pFunctionListBox->aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
+ pFunctionListBox->aArr.back()->sCommand = uri;
+ pFunctionListBox->aArr.back()->sLabel = children[n]->getName();
+ pNewEntry->SetUserData( pFunctionListBox->aArr.back().get() );
}
}
}
@@ -937,11 +929,10 @@ void SfxConfigGroupListBox::GroupSelected()
{
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt);
SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel );
- SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SfxCfgKind::GROUP_STYLES, 0, pStyle );
- pFunctionListBox->aArr.push_back( pGrpInfo );
- pGrpInfo->sCommand = pStyle->sCommand;
- pGrpInfo->sLabel = pStyle->sLabel;
- pFuncEntry->SetUserData( pGrpInfo );
+ pFunctionListBox->aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pStyle ) );
+ pFunctionListBox->aArr.back()->sCommand = pStyle->sCommand;
+ pFunctionListBox->aArr.back()->sLabel = pStyle->sLabel;
+ pFuncEntry->SetUserData( pFunctionListBox->aArr.back().get() );
}
}
break;
@@ -1051,18 +1042,17 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
*/
theChild->acquire();
- SfxGroupInfo_Impl* pGrpInfo =
- new SfxGroupInfo_Impl(SfxCfgKind::GROUP_SCRIPTCONTAINER,
- 0, static_cast<void *>( theChild.get()));
-
Image aImage = GetImage( theChild, Reference< XComponentContext >(), false );
SvTreeListEntry* pNewEntry =
InsertEntry( theChild->getName(), pEntry );
SetExpandedEntryBmp( pNewEntry, aImage );
SetCollapsedEntryBmp(pNewEntry, aImage );
- pNewEntry->SetUserData( pGrpInfo );
- aArr.push_back( pGrpInfo );
+ aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>(
+ SfxCfgKind::GROUP_SCRIPTCONTAINER,
+ 0, static_cast<void *>( theChild.get())));
+
+ pNewEntry->SetUserData( aArr.back().get() );
if ( children[n]->hasChildNodes() )
{
@@ -1101,9 +1091,8 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
{
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt);
SvTreeListEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry );
- SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SfxCfgKind::GROUP_STYLES, 0, pFamily );
- aArr.push_back( pGrpInfo );
- pStyleEntry->SetUserData( pGrpInfo );
+ aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily ));
+ pStyleEntry->SetUserData( aArr.back().get() );
pStyleEntry->EnableChildrenOnDemand( false );
}
}
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 314f165..fddbdc1 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -20,7 +20,7 @@
#define INCLUDED_CUI_SOURCE_INC_CFGUTIL_HXX
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
#include <rtl/ustring.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -96,7 +96,7 @@ struct SfxGroupInfo_Impl
nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(false) {}
};
-typedef boost::ptr_vector<SfxGroupInfo_Impl> SfxGroupInfoArr_Impl;
+typedef std::vector<std::unique_ptr<SfxGroupInfo_Impl> > SfxGroupInfoArr_Impl;
class SfxConfigFunctionListBox : public SvTreeListBox
{
More information about the Libreoffice-commits
mailing list