[Libreoffice-commits] core.git: 10 commits - filter/source include/filter include/svtools include/svx sd/source svtools/inc svtools/source svx/source sw/source
Michael Stahl
mstahl at redhat.com
Fri Jul 24 02:07:40 PDT 2015
filter/source/msfilter/msdffimp.cxx | 53 ++++++++-------
filter/source/msfilter/svdfppt.cxx | 116 ++++++++++++++++-----------------
include/filter/msfilter/msdffimp.hxx | 46 +++++--------
include/filter/msfilter/svdfppt.hxx | 34 +++++----
include/svtools/ctrltool.hxx | 10 +-
include/svtools/parhtml.hxx | 4 -
include/svx/PaletteManager.hxx | 8 +-
sd/source/filter/ppt/pptin.cxx | 6 -
svtools/inc/pch/precompiled_svt.hxx | 1
svtools/source/control/ctrltool.cxx | 25 +++----
svtools/source/svhtml/parhtml.cxx | 6 -
svx/source/tbxctrls/PaletteManager.cxx | 20 ++---
sw/source/filter/ww8/ww8graf.cxx | 6 -
sw/source/filter/ww8/ww8graf2.cxx | 4 -
sw/source/filter/ww8/ww8par.cxx | 6 -
15 files changed, 175 insertions(+), 170 deletions(-)
New commits:
commit 22fd35f5987e3fed40d5b2ad0df35f7d89f842f8
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 23:47:46 2015 +0200
filter: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I9aa0543edf3f0aef3a0a376aa0f82f51c6d93313
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 1a49e87..05fd7ea 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5470,10 +5470,10 @@ void SvxMSDffManager::StoreShapeOrder(sal_uLong nId,
SwFlyFrameFormat* pFly,
short nHdFtSection) const
{
- sal_uInt16 nShpCnt = pShapeOrders->size();
+ sal_uInt16 nShpCnt = m_pShapeOrders->size();
for (sal_uInt16 nShapeNum=0; nShapeNum < nShpCnt; nShapeNum++)
{
- SvxMSDffShapeOrder& rOrder = (*pShapeOrders)[ nShapeNum ];
+ SvxMSDffShapeOrder& rOrder = *(*m_pShapeOrders)[ nShapeNum ];
if( rOrder.nShapeId == nId )
{
@@ -5491,10 +5491,10 @@ void SvxMSDffManager::ExchangeInShapeOrder( SdrObject* pOldObject,
SwFlyFrameFormat* pFly,
SdrObject* pObject) const
{
- sal_uInt16 nShpCnt = pShapeOrders->size();
+ sal_uInt16 nShpCnt = m_pShapeOrders->size();
for (sal_uInt16 nShapeNum=0; nShapeNum < nShpCnt; nShapeNum++)
{
- SvxMSDffShapeOrder& rOrder = (*pShapeOrders)[ nShapeNum ];
+ SvxMSDffShapeOrder& rOrder = *(*m_pShapeOrders)[ nShapeNum ];
if( rOrder.pObj == pOldObject )
{
@@ -5508,10 +5508,10 @@ void SvxMSDffManager::ExchangeInShapeOrder( SdrObject* pOldObject,
void SvxMSDffManager::RemoveFromShapeOrder( SdrObject* pObject ) const
{
- sal_uInt16 nShpCnt = pShapeOrders->size();
+ sal_uInt16 nShpCnt = m_pShapeOrders->size();
for (sal_uInt16 nShapeNum=0; nShapeNum < nShpCnt; nShapeNum++)
{
- SvxMSDffShapeOrder& rOrder = (*pShapeOrders)[ nShapeNum ];
+ SvxMSDffShapeOrder& rOrder = *(*m_pShapeOrders)[ nShapeNum ];
if( rOrder.pObj == pObject )
{
@@ -5523,12 +5523,8 @@ void SvxMSDffManager::RemoveFromShapeOrder( SdrObject* pObject ) const
}
-
-
-
// exported class: Public Methods
-
SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
const OUString& rBaseURL,
sal_uInt32 nOffsDgg_,
@@ -5542,7 +5538,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
pFormModel( NULL ),
m_pBLIPInfos( new SvxMSDffBLIPInfos ),
m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
- pShapeOrders( new SvxMSDffShapeOrders ),
+ m_pShapeOrders( new SvxMSDffShapeOrders ),
nOffsDgg( nOffsDgg_ ),
nBLIPCount( USHRT_MAX ), // initialize with error, since we fist check if the
nGroupShapeFlags(0), // ensure initialization here, as some corrupted
@@ -5591,7 +5587,7 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const OUString& rBaseURL )
pFormModel( NULL ),
m_pBLIPInfos( new SvxMSDffBLIPInfos ),
m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
- pShapeOrders( new SvxMSDffShapeOrders ),
+ m_pShapeOrders( new SvxMSDffShapeOrders ),
nOffsDgg( 0 ),
nBLIPCount( USHRT_MAX ), // initialize with error, since we first have to check
nGroupShapeFlags(0),
@@ -5616,7 +5612,7 @@ SvxMSDffManager::~SvxMSDffManager()
{
delete pSecPropSet;
delete m_pBLIPInfos;
- delete pShapeOrders;
+ delete m_pShapeOrders;
delete pFormModel;
}
@@ -6146,7 +6142,8 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
}
m_xShapeInfosByTxBxComp->insert(std::shared_ptr<SvxMSDffShapeInfo>(
new SvxMSDffShapeInfo(aInfo)));
- pShapeOrders->push_back( new SvxMSDffShapeOrder( aInfo.nShapeId ) );
+ m_pShapeOrders->push_back(std::unique_ptr<SvxMSDffShapeOrder>(
+ new SvxMSDffShapeOrder( aInfo.nShapeId )));
}
// and position the Stream correctly again
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index 14fa1e5..f3ce6b5 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -27,8 +27,6 @@
#include <set>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
-
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -110,7 +108,7 @@ typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
#define SVEXT_PERSIST_STREAM "\002OlePres000"
/// the following will be sorted by the order of their appearance:
-typedef boost::ptr_vector<SvxMSDffShapeOrder> SvxMSDffShapeOrders;
+typedef std::vector<std::unique_ptr<SvxMSDffShapeOrder>> SvxMSDffShapeOrders;
struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
{
@@ -402,7 +400,7 @@ class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
SvxMSDffBLIPInfos* m_pBLIPInfos;
std::unique_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_xShapeInfosByTxBxComp;
std::unique_ptr<SvxMSDffShapeInfos_ById> m_xShapeInfosById;
- SvxMSDffShapeOrders* pShapeOrders;
+ SvxMSDffShapeOrders* m_pShapeOrders;
sal_uInt32 nOffsDgg;
sal_uInt16 nBLIPCount;
sal_uInt32 nGroupShapeFlags;
@@ -675,7 +673,7 @@ public:
{ return m_xShapeInfosById.get(); }
inline SvxMSDffShapeOrders* GetShapeOrders() const
- { return pShapeOrders; }
+ { return m_pShapeOrders; }
void StoreShapeOrder(sal_uLong nId,
sal_uLong nTxBx,
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index c2c0a65..2c1182d 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -99,7 +99,7 @@ sal_uInt16 wwZOrderer::GetEscherObjectIdx(sal_uLong nSpId)
// First, find out what position this shape is in the Escher order.
for (sal_uInt16 nShapePos=0; nShapePos < nShapeCount; nShapePos++)
{
- const SvxMSDffShapeOrder& rOrder = (*mpShapeOrders)[nShapePos];
+ const SvxMSDffShapeOrder& rOrder = *(*mpShapeOrders)[nShapePos];
if (rOrder.nShapeId == nSpId)
{
nFound = nShapePos;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9ae8606..8641ff0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5167,7 +5167,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
for (sal_uInt16 nShapeNum=0; nShapeNum < nShapeCount; nShapeNum++)
{
SvxMSDffShapeOrder *pOrder =
- &(*m_pMSDffManager->GetShapeOrders())[nShapeNum];
+ (*m_pMSDffManager->GetShapeOrders())[nShapeNum].get();
// Insert Pointer into new Sort array
if (pOrder->nTxBxComp && pOrder->pFly)
aTxBxSort.insert(pOrder);
commit b772f022192d2150aa6b33b1ce086c4645277023
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 23:36:28 2015 +0200
filter: convert boost::ptr_vector to std::vector
... and move it out of the header since it's only used in that class.
Change-Id: Icd5cc86428c97bdaaa07d56e17393846629721e5
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 1e62f40..1a49e87 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -149,6 +149,18 @@ using namespace container ;
static sal_uInt32 nMSOleObjCntr = 0;
#define MSO_OLE_Obj "MSO_OLE_Obj"
+struct SvxMSDffBLIPInfo
+{
+ sal_uInt16 nBLIPType; ///< type of BLIP: e.g. 6 for PNG
+ sal_uLong nFilePos; ///< offset of the BLIP in data strem
+ sal_uLong nBLIPSize; ///< number of bytes that the BLIP needs in stream
+ SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize):
+ nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){}
+};
+
+/// the following will be sorted by the order of their appearance:
+struct SvxMSDffBLIPInfos : public std::vector<SvxMSDffBLIPInfo> {};
+
/************************************************************************/
void Impl_OlePres::Write( SvStream & rStm )
{
@@ -5528,7 +5540,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
bool bSkipImages )
:DffPropertyReader( *this ),
pFormModel( NULL ),
- pBLIPInfos( new SvxMSDffBLIPInfos ),
+ m_pBLIPInfos( new SvxMSDffBLIPInfos ),
m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
pShapeOrders( new SvxMSDffShapeOrders ),
nOffsDgg( nOffsDgg_ ),
@@ -5577,7 +5589,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const OUString& rBaseURL )
:DffPropertyReader( *this ),
pFormModel( NULL ),
- pBLIPInfos( new SvxMSDffBLIPInfos ),
+ m_pBLIPInfos( new SvxMSDffBLIPInfos ),
m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
pShapeOrders( new SvxMSDffShapeOrders ),
nOffsDgg( 0 ),
@@ -5603,7 +5615,7 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const OUString& rBaseURL )
SvxMSDffManager::~SvxMSDffManager()
{
delete pSecPropSet;
- delete pBLIPInfos;
+ delete m_pBLIPInfos;
delete pShapeOrders;
delete pFormModel;
}
@@ -5879,7 +5891,7 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLe
nBLIPCount++;
// now save the info for later access
- pBLIPInfos->push_back( new SvxMSDffBLIPInfo( nInst, nBLIPPos, nBLIPLen ) );
+ m_pBLIPInfos->push_back(SvxMSDffBLIPInfo(nInst, nBLIPPos, nBLIPLen));
}
rSt.SeekRel( nLength );
}
@@ -6217,7 +6229,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, Rectangle* pVisA
if ( !bOk )
{
sal_uInt16 nIdx = sal_uInt16( nIdx_ );
- if( !nIdx || (pBLIPInfos->size() < nIdx) )
+ if (!nIdx || (m_pBLIPInfos->size() < nIdx))
return false;
// possibly delete old error flag(s)
@@ -6232,7 +6244,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, Rectangle* pVisA
sal_uLong nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
// fetch matching info struct out of the pointer array
- SvxMSDffBLIPInfo& rInfo = (*pBLIPInfos)[ nIdx-1 ];
+ SvxMSDffBLIPInfo& rInfo = (*m_pBLIPInfos)[ nIdx-1 ];
// jump to the BLIP atom in the data stream
pStData->Seek( rInfo.nFilePos );
// possibly reset error status
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index 5ef4b5c..14fa1e5 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -56,7 +56,7 @@ class FmFormModel;
class SdrModel;
class SwFlyFrameFormat;
-struct SvxMSDffBLIPInfo;
+struct SvxMSDffBLIPInfos;
struct SvxMSDffShapeInfo;
struct SvxMSDffShapeOrder;
@@ -109,8 +109,7 @@ typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
#define SVEXT_PERSIST_STREAM "\002OlePres000"
-// the following two will be sorted by the order of their appearance:
-typedef boost::ptr_vector<SvxMSDffBLIPInfo> SvxMSDffBLIPInfos;
+/// the following will be sorted by the order of their appearance:
typedef boost::ptr_vector<SvxMSDffShapeOrder> SvxMSDffShapeOrders;
struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
@@ -400,7 +399,7 @@ public:
class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
{
FmFormModel* pFormModel;
- SvxMSDffBLIPInfos* pBLIPInfos;
+ SvxMSDffBLIPInfos* m_pBLIPInfos;
std::unique_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_xShapeInfosByTxBxComp;
std::unique_ptr<SvxMSDffShapeInfos_ById> m_xShapeInfosById;
SvxMSDffShapeOrders* pShapeOrders;
@@ -722,15 +721,6 @@ public:
SdrObject* getShapeForId( sal_Int32 nShapeId );
};
-struct SvxMSDffBLIPInfo
-{
- sal_uInt16 nBLIPType; ///< type of BLIP: e.g. 6 for PNG
- sal_uLong nFilePos; ///< offset of the BLIP in data strem
- sal_uLong nBLIPSize; ///< number of bytes that the BLIP needs in stream
- SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize):
- nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){}
-};
-
struct SvxMSDffShapeInfo
{
sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
commit 355865211c50303095582f6e1dfbd5d209802b7b
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 23:20:34 2015 +0200
filter: replace boost::ptr_set with std::set<std::unique_ptr>
Change-Id: I171fdb41bef4a7f3ef6418d81a1d99f123c0652c
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 74b337a..1e62f40 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5413,7 +5413,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
if( pOrgObj )
{
pImpRec->pObj = pOrgObj;
- rImportData.aRecords.insert( pImpRec );
+ rImportData.m_Records.insert(std::unique_ptr<SvxMSDffImportRec>(pImpRec));
bDeleteImpRec = false;
if (pImpRec == pTextImpRec)
bDeleteTextImpRec = false;
@@ -5424,7 +5424,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
// Modify ShapeId (must be unique)
pImpRec->nShapeId |= 0x8000000;
pTextImpRec->pObj = pTextObj;
- rImportData.aRecords.insert( pTextImpRec );
+ rImportData.m_Records.insert(std::unique_ptr<SvxMSDffImportRec>(pTextImpRec));
bDeleteTextImpRec = false;
if (pTextImpRec == pImpRec)
bDeleteImpRec = false;
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index b60847a..5ef4b5c 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -28,7 +28,6 @@
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/ptr_container/ptr_set.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
@@ -270,16 +269,21 @@ private:
SvxMSDffImportRec &operator=(const SvxMSDffImportRec&) SAL_DELETED_FUNCTION;
};
+struct MSDffImportRecords_Less
+{
+ bool operator()(std::unique_ptr<SvxMSDffImportRec> const& left,
+ std::unique_ptr<SvxMSDffImportRec> const& right) const
+ { return (*left) < (*right); }
+};
/** list of all SvxMSDffImportRec instances of/for a group */
-class MSDffImportRecords
- : public ::boost::ptr_set<SvxMSDffImportRec>
-{};
+typedef std::set<std::unique_ptr<SvxMSDffImportRec>, MSDffImportRecords_Less>
+ MSDffImportRecords;
/** block of parameters for import/export for a single call of
ImportObjAtCurrentStreamPos() */
struct SvxMSDffImportData
{
- MSDffImportRecords aRecords; ///< Shape pointer, Shape ids and private data
+ MSDffImportRecords m_Records; ///< Shape pointer, Shape ids and private data
Rectangle aParentRect;///< Rectangle of the surrounding groups,
///< which might have been provided externally
Rectangle aNewRect; ///< Rectangle that is defined by this shape
@@ -287,10 +291,10 @@ struct SvxMSDffImportData
SvxMSDffImportData()
{}
explicit SvxMSDffImportData( const Rectangle& rParentRect ) : aParentRect( rParentRect ) {}
- bool empty() const { return aRecords.empty(); }
- size_t size() const { return aRecords.size(); }
- MSDffImportRecords::const_iterator begin() const { return aRecords.begin(); }
- MSDffImportRecords::const_iterator end() const { return aRecords.end(); }
+ bool empty() const { return m_Records.empty(); }
+ size_t size() const { return m_Records.size(); }
+ MSDffImportRecords::const_iterator begin() const { return m_Records.begin(); }
+ MSDffImportRecords::const_iterator end() const { return m_Records.end(); }
};
struct DffObjData
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 3fc3052..4bca571 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2547,9 +2547,9 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
for (MSDffImportRecords::const_iterator it = aData.begin();
it != aData.end(); ++it) // MSVC2008 wants const_iterator here???
{
- if (it->pObj == pObject)
+ if ((*it)->pObj == pObject)
{
- pRecord = &const_cast<SvxMSDffImportRec&>(*it);
+ pRecord = const_cast<SvxMSDffImportRec *>(it->get());
break;
}
}
@@ -2682,7 +2682,7 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
for (MSDffImportRecords::const_iterator it = aData.begin();
it != aData.end(); ++it)
{
- pRecord = &const_cast<SvxMSDffImportRec&>(*it);
+ pRecord = const_cast<SvxMSDffImportRec *>(it->get());
if (pRecord->pObj && pRecord->aTextId.nTxBxS)
{ // #i52825# pRetFrameFormat can be NULL
pRetFrameFormat = MungeTextIntoDrawBox(pRecord->pObj,
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index f6ab2cc..c2c0a65 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -547,7 +547,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
RES_FRMATR_END-1 );
SvxMSDffImportRec const*const pRecord = (1 == aData.size())
- ? &*aData.begin() : 0;
+ ? aData.begin()->get() : nullptr;
if( pRecord )
{
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 02d26f4..9ae8606 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1120,7 +1120,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
{
// Complement Import Record List
pImpRec->pObj = pObj;
- rImportData.aRecords.insert( pImpRec );
+ rImportData.m_Records.insert(std::unique_ptr<SvxMSDffImportRec>(pImpRec));
// Complement entry in Z Order List with a pointer to this Object
// Only store objects which are not deep inside the tree
@@ -4284,7 +4284,7 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection,
if (mrReader.m_pMSDffManager->GetShape(0x401, pObject, aData))
{
// Only handle shape if it is a background shape
- if ((aData.begin()->nFlags & 0x400) != 0)
+ if (((*aData.begin())->nFlags & 0x400) != 0)
{
SfxItemSet aSet(rFormat.GetAttrSet());
mrReader.MatchSdrItemsIntoFlySet(pObject, aSet, mso_lineSimple,
commit 0de2d916dcee1f3afe0e71c3432b99855cf843f1
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 23:03:36 2015 +0200
filter: that cast is silly
Change-Id: Id3766ccc992934633c77d8e035abd8390ef088cb
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index fa06703..754bb6c 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -578,7 +578,7 @@ PptFontEntityAtom* SdrEscherImport::GetFontEnityAtom( sal_uInt32 nNum ) const
{
PptFontEntityAtom* pRetValue = NULL;
if (m_pFonts && (nNum < m_pFonts->size()))
- pRetValue = (*m_pFonts)[ (sal_uInt16)nNum ].get();
+ pRetValue = (*m_pFonts)[ nNum ].get();
return pRetValue;
}
commit 9c959736caaaab5a757b0a0ff0abb121062483ab
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 23:02:50 2015 +0200
filter: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I87f903c6a81b271847f072fa0608fae4669ac307
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index e11dc43..fa06703 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -206,7 +206,7 @@ sal_uInt16 PptSlidePersistList::FindPage(sal_uInt32 nId) const
{
for ( size_t i=0; i < mvEntries.size(); i++ )
{
- if (mvEntries[ i ].GetSlideId()==nId) return i;
+ if (mvEntries[ i ]->GetSlideId() == nId) return i;
}
return PPTSLIDEPERSIST_ENTRY_NOTFOUND;
}
@@ -1289,9 +1289,9 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
pPersistPtr ( NULL ),
nPersistPtrAnz ( 0 ),
pDefaultSheet ( NULL ),
- pMasterPages ( NULL ),
- pSlidePages ( NULL ),
- pNotePages ( NULL ),
+ m_pMasterPages ( nullptr ),
+ m_pSlidePages ( nullptr ),
+ m_pNotePages ( nullptr ),
nAktPageNum ( 0 ),
nDocStreamPos ( 0 ),
nPageColorsNum ( 0xFFFF ),
@@ -1478,17 +1478,17 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
// TODO:: PPT_PST_TxPFStyleAtom
// read SlidePersists
- pMasterPages=new PptSlidePersistList;
- pSlidePages =new PptSlidePersistList;
- pNotePages =new PptSlidePersistList;
+ m_pMasterPages = new PptSlidePersistList;
+ m_pSlidePages = new PptSlidePersistList;
+ m_pNotePages = new PptSlidePersistList;
// now always creating the handout page, it will be the first in our masterpage list
- PptSlidePersistEntry* pE = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE(new PptSlidePersistEntry);
pE->aPersistAtom.nPsrReference = aDocAtom.nHandoutMasterPersist;
pE->bHandoutMaster = true;
if ( !aDocAtom.nHandoutMasterPersist )
pE->bStarDrawFiller = true; // this is a dummy master page
- pMasterPages->insert( pMasterPages->begin(), pE );
+ m_pMasterPages->insert(m_pMasterPages->begin(), std::move(pE));
sal_uInt16 nPageListNum = 0;
DffRecordHeader* pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText );
@@ -1502,12 +1502,12 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
{
if ( pPreviousPersist )
pPreviousPersist->nSlidePersistEndOffset = rStCtrl.Tell();
- PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
ReadPptSlidePersistAtom( rStCtrl, pE2->aPersistAtom );
pE2->nSlidePersistStartOffset = rStCtrl.Tell();
pE2->ePageKind = PptPageKind( nPageListNum );
- pPageList->push_back( pE2 );
- pPreviousPersist = pE2;
+ pPreviousPersist = pE2.get();
+ pPageList->push_back(std::move(pE2));
}
if ( pPreviousPersist )
pPreviousPersist->nSlidePersistEndOffset = nSlideListWithTextHdEndOffset;
@@ -1516,19 +1516,19 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
}
// we will ensure that there is at least one master page
- if ( pMasterPages->size() == 1 ) // -> there is only a handout page available
+ if (m_pMasterPages->size() == 1) // -> there is only a handout page available
{
- PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
pE2->bStarDrawFiller = true; // this is a dummy master page
- pMasterPages->insert( pMasterPages->begin() + 1, pE2 );
+ m_pMasterPages->insert(m_pMasterPages->begin() + 1, std::move(pE2));
}
// now we will insert at least one notes master for each master page
sal_uInt16 nMasterPage;
- sal_uInt16 nMasterPages = pMasterPages->size() - 1;
+ sal_uInt16 nMasterPages = m_pMasterPages->size() - 1;
for ( nMasterPage = 0; nMasterPage < nMasterPages; nMasterPage++ )
{
- PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
pE2->bNotesMaster = true;
pE2->bStarDrawFiller = true; // this is a dummy master page
if ( !nMasterPage && aDocAtom.nNotesMasterPersist )
@@ -1536,7 +1536,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
pE2->aPersistAtom.nPsrReference = aDocAtom.nNotesMasterPersist;
pE2->bStarDrawFiller = false; // this is a dummy master page
}
- pMasterPages->insert( pMasterPages->begin() + (( nMasterPage + 1 ) << 1), pE2 );
+ m_pMasterPages->insert(m_pMasterPages->begin() + ((nMasterPage + 1) << 1), std::move(pE2));
}
// read for each page the SlideAtom respectively the NotesAtom if it exists
@@ -1619,12 +1619,12 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
else if ( pHeadersFootersHd->nRecInstance == 4 ) // notes master
ImportHeaderFooterContainer( *pHeadersFootersHd, aNotesMaster );
}
- for ( size_t i = 0; i < pMasterPages->size(); i++ )
+ for (size_t i = 0; i < m_pMasterPages->size(); i++)
{
- if ( (*pMasterPages)[ i ].bNotesMaster )
- (*pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNotesMaster );
+ if ((*m_pMasterPages)[ i ].bNotesMaster)
+ (*m_pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNotesMaster );
else
- (*pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNormalMaster );
+ (*m_pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNormalMaster );
}
}
}
@@ -1641,9 +1641,9 @@ SdrPowerPointImport::~SdrPowerPointImport()
delete aHyperList[ i ];
}
aHyperList.clear();
- delete pMasterPages;
- delete pSlidePages;
- delete pNotePages;
+ delete m_pMasterPages;
+ delete m_pSlidePages;
+ delete m_pNotePages;
delete[] pPersistPtr;
}
@@ -2171,11 +2171,11 @@ bool SdrPowerPointImport::ReadFontCollection()
PptSlidePersistList* SdrPowerPointImport::GetPageList(PptPageKind ePageKind) const
{
if ( ePageKind == PPT_MASTERPAGE )
- return pMasterPages;
+ return m_pMasterPages;
if ( ePageKind == PPT_SLIDEPAGE )
- return pSlidePages;
+ return m_pSlidePages;
if ( ePageKind == PPT_NOTEPAGE )
- return pNotePages;
+ return m_pNotePages;
return NULL;
}
@@ -2462,7 +2462,7 @@ void SdrPowerPointImport::SetPageNum( sal_uInt16 nPageNum, PptPageKind eKind )
PptSlidePersistEntry* pMasterPersist = &(*pPageList)[ nMasterIndex ];
if ( ( pMasterPersist->pStyleSheet == NULL ) && pMasterPersist->aSlideAtom.nMasterId )
{
- nMasterIndex = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ nMasterIndex = m_pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
if ( nMasterIndex != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
pMasterPersist = &(*pPageList)[ nMasterIndex ];
}
@@ -2539,7 +2539,7 @@ bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor )
while( ( pMasterPersist && pMasterPersist->aSlideAtom.nFlags & 2 ) // it is possible that a masterpage
&& pMasterPersist->aSlideAtom.nMasterId ) // itself is following a master colorscheme
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ sal_uInt16 nNextMaster = m_pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
@@ -2772,7 +2772,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
PptSlidePersistEntry* pE = &(*pPageList)[ nMasterNum ];
while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ sal_uInt16 nNextMaster = m_pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
@@ -2931,9 +2931,9 @@ sal_uInt16 SdrPowerPointImport::GetMasterPageIndex( sal_uInt16 nPageNum, PptPage
if ( ePageKind == PPT_NOTEPAGE )
return 2;
sal_uInt32 nId = GetMasterPageId( nPageNum, ePageKind );
- if ( nId && pMasterPages )
+ if (nId && m_pMasterPages)
{
- nIdx = pMasterPages->FindPage( nId );
+ nIdx = m_pMasterPages->FindPage( nId );
if ( nIdx == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
nIdx = 0;
}
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index dd4cfcf..e355d65 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -36,9 +36,9 @@
#include <filter/msfilter/msfilterdllapi.h>
#include <vcl/font.hxx>
#include <vector>
+#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
class SdrModel;
class SdPage;
@@ -354,23 +354,27 @@ public:
class MSFILTER_DLLPUBLIC PptSlidePersistList: private boost::noncopyable
{
private:
- boost::ptr_vector<PptSlidePersistEntry> mvEntries;
+ typedef std::vector<std::unique_ptr<PptSlidePersistEntry>> Entries_t;
+ Entries_t mvEntries;
public:
PptSlidePersistList();
~PptSlidePersistList();
size_t size() const { return mvEntries.size(); }
- bool is_null( size_t nIdx ) const { return mvEntries.is_null( nIdx ); }
- const PptSlidePersistEntry& operator[]( size_t nIdx ) const { return mvEntries[ nIdx ]; }
- PptSlidePersistEntry& operator[]( size_t nIdx ) { return mvEntries[ nIdx ]; }
- boost::ptr_vector<PptSlidePersistEntry>::iterator begin() { return mvEntries.begin(); }
- void insert( boost::ptr_vector<PptSlidePersistEntry>::iterator it,
- PptSlidePersistEntry* pEntry )
+ bool is_null( size_t nIdx ) const { return mvEntries[ nIdx ] == nullptr; }
+ const PptSlidePersistEntry& operator[](size_t nIdx) const { return *mvEntries[ nIdx ]; }
+ PptSlidePersistEntry& operator[](size_t nIdx) { return *mvEntries[ nIdx ]; }
+ Entries_t::iterator begin() { return mvEntries.begin(); }
+ void insert( Entries_t::iterator it,
+ std::unique_ptr<PptSlidePersistEntry> pEntry )
{
- mvEntries.insert(it, pEntry);
+ mvEntries.insert(it, std::move(pEntry));
+ }
+ void push_back(std::unique_ptr<PptSlidePersistEntry> pEntry)
+ {
+ mvEntries.push_back(std::move(pEntry));
}
- void push_back( PptSlidePersistEntry* pEntry ) { mvEntries.push_back(pEntry); }
sal_uInt16 FindPage( sal_uInt32 nId ) const;
};
@@ -545,9 +549,9 @@ protected:
const PPTStyleSheet* pPPTStyleSheet; // this is the current stylesheet;
const PPTStyleSheet* pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
// never happen just preventing a crash
- PptSlidePersistList* pMasterPages;
- PptSlidePersistList* pSlidePages;
- PptSlidePersistList* pNotePages;
+ PptSlidePersistList* m_pMasterPages;
+ PptSlidePersistList* m_pSlidePages;
+ PptSlidePersistList* m_pNotePages;
sal_uInt16 nAktPageNum;
sal_uLong nDocStreamPos;
sal_uInt16 nPageColorsNum;
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index ca300f1..68f80f3 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -541,7 +541,7 @@ bool ImplSdPPTImport::Import()
// create master pages:
SfxProgress* pStbMgr = new SfxProgress( pDocShell, SD_RESSTR( STR_POWERPOINT_IMPORT ),
- pMasterPages->size() + pSlidePages->size() + pNotePages->size() );
+ m_pMasterPages->size() + m_pSlidePages->size() + m_pNotePages->size() );
sal_uInt32 nImportedPages = 0;
{
@@ -726,7 +726,7 @@ bool ImplSdPPTImport::Import()
PptSlidePersistEntry* pE = pPersist;
while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ sal_uInt16 nNextMaster = m_pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
@@ -952,7 +952,7 @@ bool ImplSdPPTImport::Import()
if ( nNotesPageId )
{
nImportedPages++;
- sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
+ sal_uInt16 nNotesPageIndex = m_pNotePages->FindPage( nNotesPageId );
if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
nNotesPageIndex = 0;
SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );
commit 2ca3569e04bdebf94496ba24829e696493413b90
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 22:41:02 2015 +0200
filter: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I2659fea1fb18c5b0a4ff5339643c7c28c0f5f458
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index e709914..e11dc43 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -450,7 +450,8 @@ SvStream& ReadPptFontEntityAtom( SvStream& rIn, PptFontEntityAtom& rAtom )
return rIn;
}
-class PptFontCollection: public boost::ptr_vector<PptFontEntityAtom> {
+class PptFontCollection : public std::vector<std::unique_ptr<PptFontEntityAtom>>
+{
};
SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom )
@@ -514,7 +515,7 @@ PptSlidePersistEntry::~PptSlidePersistEntry()
SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const OUString& rBaseURL ) :
SvxMSDffManager ( rParam.rDocStream, rBaseURL ),
- pFonts ( NULL ),
+ m_pFonts ( nullptr ),
nStreamLen ( 0 ),
nTextStylesIndex ( 0xffff ),
eCharSetSystem ( osl_getThreadTextEncoding() ),
@@ -533,7 +534,7 @@ SdrEscherImport::~SdrEscherImport()
for ( size_t i = 0, n = aOleObjectList.size(); i < n; ++i )
delete aOleObjectList[ i ];
aOleObjectList.clear();
- delete pFonts;
+ delete m_pFonts;
}
const PptSlideLayoutAtom* SdrEscherImport::GetSlideLayoutAtom() const
@@ -576,8 +577,8 @@ bool SdrEscherImport::SeekToShape( SvStream& /*rSt*/, void* /*pClientData*/, sal
PptFontEntityAtom* SdrEscherImport::GetFontEnityAtom( sal_uInt32 nNum ) const
{
PptFontEntityAtom* pRetValue = NULL;
- if ( pFonts && ( nNum < pFonts->size() ) )
- pRetValue = &(*pFonts)[ (sal_uInt16)nNum ];
+ if (m_pFonts && (nNum < m_pFonts->size()))
+ pRetValue = (*m_pFonts)[ (sal_uInt16)nNum ].get();
return pRetValue;
}
@@ -1441,7 +1442,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
if ( bOk )
{
- if ( !pFonts )
+ if (!m_pFonts)
ReadFontCollection();
// reading TxPF, TxSI
@@ -2133,9 +2134,9 @@ bool SdrPowerPointImport::ReadFontCollection()
while ( SeekToRec( rStCtrl, PPT_PST_FontEntityAtom, aListHd.GetRecEndFilePos() ) )
{
bRet = true;
- if ( !pFonts )
- pFonts = new PptFontCollection;
- PptFontEntityAtom* pFont = new PptFontEntityAtom;
+ if (!m_pFonts)
+ m_pFonts = new PptFontCollection;
+ std::unique_ptr<PptFontEntityAtom> pFont(new PptFontEntityAtom);
ReadPptFontEntityAtom( rStCtrl, *pFont );
vcl::Font aFont;
@@ -2159,7 +2160,7 @@ bool SdrPowerPointImport::ReadFontCollection()
{
pFont->eCharSet = RTL_TEXTENCODING_SYMBOL;
};
- pFonts->insert( pFonts->begin() + nCount2++, pFont );
+ m_pFonts->insert(m_pFonts->begin() + nCount2++, std::move(pFont));
}
}
rStCtrl.Seek( nFPosMerk ); // restore FilePos
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index cabb4b9..dd4cfcf 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -430,7 +430,7 @@ protected:
PPTOleEntryList aOleObjectList; // contains PPTOleEntrys
- PptFontCollection* pFonts;
+ PptFontCollection* m_pFonts;
sal_uInt32 nStreamLen;
sal_uInt16 nTextStylesIndex;
commit 88b992d0da1e6122942cd9817ac55da1b932fdd6
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 22:32:14 2015 +0200
filter: convert boost::ptr_vector to std::vector<std::unique_ptr>
Change-Id: I548f15466c695e4cbf5e505771d7c0baf8812198
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 615a366..e709914 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5701,13 +5701,13 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
{
PPTCharPropSet *const pCharPropSet =
rPropReader.aCharPropList[rnCurCharPos];
- PPTPortionObj* pPPTPortion = new PPTPortionObj( *pCharPropSet,
- rStyleSheet, nInstance, pParaSet->mnDepth );
- m_PortionList.push_back(pPPTPortion);
+ std::unique_ptr<PPTPortionObj> pPPTPortion(new PPTPortionObj(
+ *pCharPropSet, rStyleSheet, nInstance, pParaSet->mnDepth));
if (!mbTab)
{
mbTab = pPPTPortion->HasTabulator();
}
+ m_PortionList.push_back(std::move(pPPTPortion));
}
}
}
@@ -5718,10 +5718,11 @@ PPTParagraphObj::~PPTParagraphObj()
void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion )
{
- m_PortionList.push_back(new PPTPortionObj(rPPTPortion));
+ m_PortionList.push_back(
+ std::unique_ptr<PPTPortionObj>(new PPTPortionObj(rPPTPortion)));
if ( !mbTab )
{
- mbTab = m_PortionList.back().HasTabulator();
+ mbTab = m_PortionList.back()->HasTabulator();
}
}
@@ -5732,7 +5733,7 @@ void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
sal_uInt16 nFontHeight = 0;
if (!m_PortionList.empty())
{
- PPTPortionObj const& rPortion = m_PortionList.front();
+ PPTPortionObj const& rPortion = *m_PortionList.front();
if (rPortion.pCharSet->mnAttrSet & (1 << PPT_CharAttr_FontHeight))
{
nFontHeight = rPortion.pCharSet->mnFontHeight;
@@ -5775,7 +5776,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI
rRetValue = PPT_COLSCHEME_TEXT_UND_ZEILEN;
if ((nDestinationInstance != 0xffffffff) && !m_PortionList.empty())
{
- PPTPortionObj const& rPortion = m_PortionList.front();
+ PPTPortionObj const& rPortion = *m_PortionList.front();
if (rPortion.pCharSet->mnAttrSet & (1 << PPT_CharAttr_FontColor))
{
rRetValue = rPortion.pCharSet->mnColor;
@@ -5803,7 +5804,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI
rRetValue = 0;
if ((nDestinationInstance != 0xffffffff) && !m_PortionList.empty())
{
- PPTPortionObj const& rPortion = m_PortionList.front();
+ PPTPortionObj const& rPortion = *m_PortionList.front();
if (rPortion.pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Font ) )
{
rRetValue = rPortion.pCharSet->mnFont;
@@ -5869,7 +5870,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI
{
if (!m_PortionList.empty())
{
- PPTPortionObj const& rPortion = m_PortionList.front();
+ PPTPortionObj const& rPortion = *m_PortionList.front();
bIsHardAttribute = rPortion.GetAttrib(
PPT_CharAttr_Font, rRetValue, nDestinationInstance);
}
@@ -5905,7 +5906,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI
{
if (!m_PortionList.empty())
{
- PPTPortionObj const& rPortion = m_PortionList.front();
+ PPTPortionObj const& rPortion = *m_PortionList.front();
if (rPortion.mbIsHyperlink )
{
if( rPortion.mbHardHylinkOrigColor )
@@ -6137,7 +6138,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
if (!m_PortionList.empty())
{
sal_uInt32 nFontHeight = 0;
- m_PortionList.back().GetAttrib(
+ m_PortionList.back()->GetAttrib(
PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance);
if ( ((sal_Int16)nUpperDist) > 0 )
nUpperDist = - (sal_Int16)( ( nFontHeight * nUpperDist * 100 ) / 1000 );
@@ -6219,7 +6220,7 @@ sal_uInt32 PPTParagraphObj::GetTextSize()
sal_uInt32 nCount, nRetValue = 0;
for (size_t i = 0; i < m_PortionList.size(); i++)
{
- PPTPortionObj const& rPortionObj = m_PortionList[i];
+ PPTPortionObj const& rPortionObj = *m_PortionList[i];
nCount = rPortionObj.Count();
if ((!nCount) && rPortionObj.mpFieldItem)
nCount++;
@@ -6233,7 +6234,7 @@ PPTPortionObj* PPTParagraphObj::First()
mnCurrentObject = 0;
if (m_PortionList.empty())
return NULL;
- return &m_PortionList.front();
+ return m_PortionList.front().get();
}
PPTPortionObj* PPTParagraphObj::Next()
@@ -6242,7 +6243,7 @@ PPTPortionObj* PPTParagraphObj::Next()
if (i >= m_PortionList.size())
return NULL;
mnCurrentObject++;
- return &m_PortionList[i];
+ return m_PortionList[i].get();
}
PPTFieldEntry::~PPTFieldEntry()
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index b864c67..cabb4b9 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -1161,7 +1161,7 @@ public:
bool mbTab; // if true, this paragraph has tabulators in text
sal_uInt32 mnCurrentObject;
- ::boost::ptr_vector<PPTPortionObj> m_PortionList;
+ ::std::vector<std::unique_ptr<PPTPortionObj>> m_PortionList;
void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
commit 5e6a0eed2743b99dbbe133168204fdb184608476
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 22:21:49 2015 +0200
svx: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I512ed27ef812498e021e320259b1e0862969a10e
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 7af989c..7ad0cdb 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -23,7 +23,6 @@
#include <svx/Palette.hxx>
#include <rtl/ustring.hxx>
#include <svx/tbxcolorupdate.hxx>
-#include <deque>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
@@ -33,7 +32,9 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <deque>
+#include <vector>
+#include <memory>
class PaletteManager
{
@@ -47,7 +48,8 @@ class PaletteManager
Color mLastColor;
std::deque<Color> maRecentColors;
- boost::ptr_vector<Palette> maPalettes;
+ std::vector<std::unique_ptr<Palette>> m_Palettes;
+
public:
PaletteManager();
~PaletteManager();
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 3334afc..658348f 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -39,7 +39,7 @@ PaletteManager::PaletteManager() :
mLastColor(COL_AUTO)
{
LoadPalettes();
- mnNumOfPalettes += maPalettes.size();
+ mnNumOfPalettes += m_Palettes.size();
}
PaletteManager::~PaletteManager()
@@ -48,7 +48,7 @@ PaletteManager::~PaletteManager()
void PaletteManager::LoadPalettes()
{
- maPalettes.clear();
+ m_Palettes.clear();
OUString aPalPaths = SvtPathOptions().GetPalettePath();
std::stack<OUString> aDirs;
@@ -82,16 +82,16 @@ void PaletteManager::LoadPalettes()
OUString aFName = aFileStat.getFileName();
if (aNames.find(aFName) == aNames.end())
{
- Palette* pPalette = 0;
+ std::unique_ptr<Palette> pPalette;
if( aFName.endsWithIgnoreAsciiCase(".gpl") )
- pPalette = new PaletteGPL( aFileStat.getFileURL(), aFName );
+ pPalette.reset(new PaletteGPL(aFileStat.getFileURL(), aFName));
else if( aFName.endsWithIgnoreAsciiCase(".soc") )
- pPalette = new PaletteSOC( aFileStat.getFileURL(), aFName );
+ pPalette.reset(new PaletteSOC(aFileStat.getFileURL(), aFName));
else if ( aFName.endsWithIgnoreAsciiCase(".ase") )
- pPalette = new PaletteASE( aFileStat.getFileURL(), aFName );
+ pPalette.reset(new PaletteASE(aFileStat.getFileURL(), aFName));
if( pPalette && pPalette->IsValid() )
- maPalettes.push_back( pPalette );
+ m_Palettes.push_back( std::move(pPalette) );
aNames.insert(aFName);
}
}
@@ -136,7 +136,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
}
else
{
- maPalettes[mnCurrentPalette-1].LoadColorSet( rColorSet );
+ m_Palettes[mnCurrentPalette-1]->LoadColorSet( rColorSet );
mnColorCount = rColorSet.GetItemCount();
}
}
@@ -159,9 +159,7 @@ std::vector<OUString> PaletteManager::GetPaletteList()
aPaletteNames.push_back( SVX_RESSTR( RID_SVXSTR_DEFAULT_PAL ) );
- for( boost::ptr_vector<Palette>::iterator it = maPalettes.begin();
- it != maPalettes.end();
- ++it)
+ for (auto const& it : m_Palettes)
{
aPaletteNames.push_back( (*it).GetName() );
}
commit 2f467535231af44af5ee857e2444a87779e82b2c
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 22:14:07 2015 +0200
svtools: replace boost::ptr_vector with std::vector
Change-Id: I70a2919e43495ce10c0c90ec91a25604d82e7d28
diff --git a/include/svtools/parhtml.hxx b/include/svtools/parhtml.hxx
index ee5c419..85a514f 100644
--- a/include/svtools/parhtml.hxx
+++ b/include/svtools/parhtml.hxx
@@ -23,7 +23,7 @@
#include <svtools/svtdllapi.h>
#include <svtools/svparser.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
namespace com { namespace sun { namespace star {
namespace document {
@@ -118,7 +118,7 @@ public:
//SvxAdjust GetAdjust() const; // <P,TH,TD ALIGN=>
};
-typedef ::boost::ptr_vector<HTMLOption> HTMLOptions;
+typedef ::std::vector<HTMLOption> HTMLOptions;
class SVT_DLLPUBLIC HTMLParser : public SvParser
{
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index ba111fc..023fb2c 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -282,7 +282,6 @@
#include <memory>
#include <numeric>
#include <o3tl/numeric.hxx>
-#include <o3tl/ptr_container.hxx>
#include <officecfg/Office/Common.hxx>
#include <osl/conditn.hxx>
#include <osl/diagnose.h>
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 2627bc1..b9e228a 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -20,7 +20,6 @@
#include <ctype.h>
#include <comphelper/string.hxx>
-#include <o3tl/ptr_container.hxx>
#include <tools/stream.hxx>
#include <tools/debug.hxx>
#include <tools/color.hxx>
@@ -1577,10 +1576,9 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
}
// Token is known and can be saved
- std::unique_ptr<HTMLOption> pOption(
- new HTMLOption(sal::static_int_cast<sal_uInt16>(nToken), sName, aValue));
+ maOptions.push_back(
+ HTMLOption(sal::static_int_cast<sal_uInt16>(nToken), sName, aValue));
- o3tl::ptr_container::push_back(maOptions, std::move(pOption));
}
else
// Ignore white space and unexpected characters
commit cef74993a96feae0dd7489a11dfdf062687c0868
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 23 21:58:31 2015 +0200
svtools: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: Ib0b10305768d368585d80ad6163e9081a4d8cd28
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
index edda87f..e66e2c2 100644
--- a/include/svtools/ctrltool.hxx
+++ b/include/svtools/ctrltool.hxx
@@ -20,14 +20,16 @@
#ifndef INCLUDED_SVTOOLS_CTRLTOOL_HXX
#define INCLUDED_SVTOOLS_CTRLTOOL_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
-
#include <svtools/svtdllapi.h>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <vcl/metric.hxx>
#include <tools/solar.h>
+#include <vector>
+#include <memory>
+
+
class ImplFontListNameInfo;
class OutputDevice;
@@ -149,7 +151,7 @@ private:
sal_IntPtr* mpSizeAry;
VclPtr<OutputDevice> mpDev;
VclPtr<OutputDevice> mpDev2;
- boost::ptr_vector<ImplFontListNameInfo> maEntries;
+ std::vector<std::unique_ptr<ImplFontListNameInfo>> m_Entries;
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const;
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const;
@@ -182,7 +184,7 @@ public:
bool IsAvailable( const OUString& rName ) const;
sal_uInt16 GetFontNameCount() const
{
- return (sal_uInt16)maEntries.size();
+ return (sal_uInt16)m_Entries.size();
}
const vcl::FontInfo& GetFontName( sal_uInt16 nFont ) const;
sal_Handle GetFirstFontInfo( const OUString& rName ) const;
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 4e46dda..50a304c 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -168,8 +168,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong*
// then the last one. We only compare to the last entry as the list of VCL
// is returned sorted, which increases the probability that appending
// is more likely
- sal_uLong nCnt = maEntries.size();
- if ( !nCnt )
+ if (m_Entries.empty())
{
if ( pIndex )
*pIndex = ULONG_MAX;
@@ -177,7 +176,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong*
}
else
{
- const ImplFontListNameInfo* pCmpData = &maEntries[nCnt-1];
+ const ImplFontListNameInfo* pCmpData = m_Entries.back().get();
sal_Int32 nComp = rSearchName.compareTo( pCmpData->maSearchName );
if (nComp > 0)
{
@@ -192,14 +191,14 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong*
// search fonts in the list
const ImplFontListNameInfo* pCompareData;
const ImplFontListNameInfo* pFoundData = NULL;
- sal_uLong nLow = 0;
- sal_uLong nHigh = nCnt-1;
- sal_uLong nMid;
+ size_t nLow = 0;
+ size_t nHigh = m_Entries.size() - 1;
+ size_t nMid;
do
{
nMid = (nLow + nHigh) / 2;
- pCompareData = &maEntries[nMid];
+ pCompareData = m_Entries[nMid].get();
sal_Int32 nComp = rSearchName.compareTo(pCompareData->maSearchName);
if (nComp < 0)
{
@@ -275,10 +274,11 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll,
pData->mpFirst = pNewInfo;
pNewInfo->mpNext = NULL;
- if (nIndex < maEntries.size())
- maEntries.insert(maEntries.begin()+nIndex,pData);
+ if (nIndex < m_Entries.size())
+ m_Entries.insert(m_Entries.begin()+nIndex,
+ std::unique_ptr<ImplFontListNameInfo>(pData));
else
- maEntries.push_back(pData);
+ m_Entries.push_back(std::unique_ptr<ImplFontListNameInfo>(pData));
}
}
else
@@ -372,8 +372,7 @@ FontList::~FontList()
// delete FontInfos
ImplFontListFontInfo *pTemp, *pInfo;
- boost::ptr_vector<ImplFontListNameInfo>::iterator it;
- for (it = maEntries.begin(); it != maEntries.end(); ++it)
+ for (auto const& it : m_Entries)
{
pInfo = it->mpFirst;
while ( pInfo )
@@ -701,7 +700,7 @@ const vcl::FontInfo& FontList::GetFontName( sal_uInt16 nFont ) const
{
DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" );
- return *(maEntries[nFont].mpFirst);
+ return *(m_Entries[nFont]->mpFirst);
}
sal_Handle FontList::GetFirstFontInfo(const OUString& rName) const
More information about the Libreoffice-commits
mailing list