[Libreoffice-commits] core.git: 7 commits - sw/source
Michael Stahl
mstahl at redhat.com
Wed Oct 28 06:49:33 PDT 2015
sw/source/core/text/itratr.cxx | 14 +++--
sw/source/filter/html/htmltabw.cxx | 10 ++-
sw/source/filter/inc/wrtswtbl.hxx | 10 ++-
sw/source/filter/writer/wrtswtbl.cxx | 2
sw/source/filter/ww8/docxattributeoutput.cxx | 4 -
sw/source/filter/ww8/rtfattributeoutput.cxx | 8 +--
sw/source/filter/ww8/wrtww8.cxx | 71 ++++++++++++++-------------
sw/source/filter/ww8/wrtww8.hxx | 8 +--
sw/source/filter/ww8/ww8par.hxx | 2
sw/source/filter/ww8/ww8par2.cxx | 23 +++-----
sw/source/filter/ww8/ww8par3.cxx | 29 ++++-------
11 files changed, 94 insertions(+), 87 deletions(-)
New commits:
commit 59dfeacf8c08b911e8bf3b1f5d9bf896970dd929
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Oct 28 14:42:33 2015 +0100
sw: surely that should be !=, not <
Change-Id: Id733fd3a53fe2023be20fcf7c9d93823d1697a7d
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 8ea7875..0920d77 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1510,7 +1510,7 @@ WW8ListManager::~WW8ListManager()
}
delete *aIter;
}
- for (auto aIter = m_LFOInfos.rbegin(); aIter < m_LFOInfos.rend(); ++aIter)
+ for (auto aIter = m_LFOInfos.rbegin(); aIter != m_LFOInfos.rend(); ++aIter)
{
if ((*aIter)->bOverride
&& (*aIter)->pNumRule
commit 34b5da1c701144d2d957d523d79e2547cbf40ece
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Oct 28 14:29:19 2015 +0100
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I1d9aa200734d264e3bc65ea39f8c2a2d03782f7b
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 5926b06..afdd8bb 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -513,9 +513,9 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
sal_Int16 eRowVertOri = text::VertOrientation::NONE;
if( rCells.size() > 1 )
{
- for( SwWriteTableCells::size_type nCell = 0; nCell<rCells.size(); ++nCell )
+ for (SwWriteTableCells::size_type nCell = 0; nCell < rCells.size(); ++nCell)
{
- sal_Int16 eCellVertOri = rCells[nCell].GetVertOri();
+ sal_Int16 eCellVertOri = rCells[nCell]->GetVertOri();
if( 0==nCell )
{
eRowVertOri = eCellVertOri;
@@ -553,8 +553,10 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
rWrt.IncIndentLevel(); // Inhalt von <TR>...</TR> einruecken
- for( const auto &rCell : rCells )
- OutTableCell( rWrt, &rCell, text::VertOrientation::NONE==eRowVertOri );
+ for (const auto &rpCell : rCells)
+ {
+ OutTableCell(rWrt, rpCell.get(), text::VertOrientation::NONE == eRowVertOri);
+ }
rWrt.DecIndentLevel(); // Inhalt von <TR>...</TR> einruecken
diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx
index 144b19b..47ea399 100644
--- a/sw/source/filter/inc/wrtswtbl.hxx
+++ b/sw/source/filter/inc/wrtswtbl.hxx
@@ -21,11 +21,13 @@
#include <tools/solar.h>
#include <tools/color.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <o3tl/sorted_vector.hxx>
#include <swdllapi.h>
+#include <memory>
+#include <vector>
+
class SwTableBox;
class SwTableLine;
class SwTableLines;
@@ -89,11 +91,11 @@ public:
bool HasPrcWidthOpt() const { return bPrcWidthOpt; }
};
-typedef boost::ptr_vector<SwWriteTableCell> SwWriteTableCells;
+typedef std::vector<std::unique_ptr<SwWriteTableCell>> SwWriteTableCells;
class SW_DLLPUBLIC SwWriteTableRow
{
- SwWriteTableCells aCells; // Alle Zellen der Rows
+ SwWriteTableCells m_Cells; ///< All cells of the Rows
const SvxBrushItem *pBackground;// Hintergrund
long nPos; // End-Position (twips) der Zeile
@@ -133,7 +135,7 @@ public:
bool HasTopBorder() const { return bTopBorder; }
bool HasBottomBorder() const { return bBottomBorder; }
- const SwWriteTableCells& GetCells() const { return aCells; }
+ const SwWriteTableCells& GetCells() const { return m_Cells; }
inline bool operator==( const SwWriteTableRow& rRow ) const;
inline bool operator<( const SwWriteTableRow& rRow2 ) const;
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 1b2ca2f..0dadce9 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -67,7 +67,7 @@ SwWriteTableCell *SwWriteTableRow::AddCell( const SwTableBox *pBox,
SwWriteTableCell *pCell =
new SwWriteTableCell( pBox, nRow, nCol, nRowSpan, nColSpan,
nHeight, pBackgroundBrush );
- aCells.push_back( pCell );
+ m_Cells.push_back(std::unique_ptr<SwWriteTableCell>(pCell));
return pCell;
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 55d1d6c..e5ab550 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2946,7 +2946,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
const SwWriteTableCells& rTableCells = pRow->GetCells();
if (nCell < rTableCells.size() )
{
- const SwWriteTableCell& rCell = rTableCells[nCell];
+ const SwWriteTableCell& rCell = *rTableCells[nCell];
const sal_uInt16 nColSpan = rCell.GetColSpan();
if ( nColSpan > 1 )
m_pSerializer->singleElementNS( XML_w, XML_gridSpan,
@@ -3703,7 +3703,7 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer
const SwWriteTableCells& rTableCells = pRow->GetCells();
if (nCell < rTableCells.size() )
{
- const SwWriteTableCell *pCell = &pRow->GetCells( )[ nCell ];
+ const SwWriteTableCell *const pCell = pRow->GetCells()[ nCell ].get();
switch( pCell->GetVertOri())
{
case text::VertOrientation::TOP:
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ff7f7d6..b60ad04 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -728,7 +728,7 @@ void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t p
m_aCells[nCurrentDepth] = pRow->GetCells().size();
for (sal_uInt32 i = 0; i < m_aCells[nCurrentDepth]; i++)
{
- const SwWriteTableCell* pCell = &pRow->GetCells()[ i ];
+ const SwWriteTableCell *const pCell = pRow->GetCells()[ i ].get();
const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat();
pTableTextNodeInfoInner->setCell(i);
@@ -756,7 +756,7 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer
const SwWriteTableRows& aRows = m_pTableWrt->GetRows();
SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ];
- const SwWriteTableCell* pCell = &pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ];
+ const SwWriteTableCell *const pCell = pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ].get();
const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat();
const SfxPoolItem* pItem;
if (pCellFormat->GetAttrSet().HasItem(RES_BOX, &pItem))
@@ -799,7 +799,7 @@ void RtfAttributeOutput::TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t
{
const SwWriteTableRows& aRows = m_pTableWrt->GetRows();
SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ];
- const SwWriteTableCell* pCell = &pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ];
+ const SwWriteTableCell *const pCell = pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ].get();
const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat();
const SfxPoolItem* pItem;
if (pCellFormat->GetAttrSet().HasItem(RES_BACKGROUND, &pItem))
@@ -879,7 +879,7 @@ void RtfAttributeOutput::TableVerticalCell(ww8::WW8TableNodeInfoInner::Pointer_t
{
const SwWriteTableRows& aRows = m_pTableWrt->GetRows();
SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ];
- const SwWriteTableCell* pCell = &pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ];
+ const SwWriteTableCell *const pCell = pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ].get();
const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat();
const SfxPoolItem* pItem;
commit 9092f96c63c05833ee5319935da1078afe216b55
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Oct 28 14:15:01 2015 +0100
tdf#94871: sw: fix a frame formatting regression that affects help
The early return must also be taken if the anchor is neither AT_CHAR nor
AT_PARA.
(regression from a219bbb62f974020fac0799143fbc51c385bb460)
Change-Id: I4eccb1f80401ba620ef87342f40c1a896918f3d3
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 71425ae..1af40f9 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -434,15 +434,17 @@ static void lcl_MinMaxNode( SwFrameFormat* pNd, SwMinMaxNodeArgs* pIn )
{
const SwFormatAnchor& rFormatA = pNd->GetAnchor();
- if ((FLY_AT_PARA == rFormatA.GetAnchorId()) ||
- (FLY_AT_CHAR == rFormatA.GetAnchorId()))
+ if ((FLY_AT_PARA != rFormatA.GetAnchorId()) &&
+ (FLY_AT_CHAR != rFormatA.GetAnchorId()))
{
- const SwPosition *pPos = rFormatA.GetContentAnchor();
- OSL_ENSURE(pPos && pIn, "Unexpected NULL arguments");
- if (!pPos || !pIn || pIn->nIndx != pPos->nNode.GetIndex())
- return;
+ return;
}
+ const SwPosition *pPos = rFormatA.GetContentAnchor();
+ OSL_ENSURE(pPos && pIn, "Unexpected NULL arguments");
+ if (!pPos || !pIn || pIn->nIndx != pPos->nNode.GetIndex())
+ return;
+
long nMin, nMax;
SwHTMLTableLayout *pLayout = 0;
const bool bIsDrawFrameFormat = pNd->Which()==RES_DRAWFRMFMT;
commit ade0e181ac5c58186a71969fc5e81ad570d33fb3
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Oct 27 22:09:45 2015 +0100
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I85409838a5c44f8e76c60ff88e41c01d2bb71987
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index c642c5c..c4e1abf 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -20,7 +20,6 @@
#include <sal/config.h>
#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <comphelper/string.hxx>
#include <tools/solar.h>
#include <vcl/vclenum.hxx>
@@ -89,7 +88,7 @@ public:
{}
};
-typedef boost::ptr_vector<WW8SelBoxInfo> WW8MergeGroups;
+typedef std::vector<std::unique_ptr<WW8SelBoxInfo>> WW8MergeGroups;
WW8TabBandDesc::WW8TabBandDesc()
{
@@ -123,7 +122,7 @@ class WW8TabDesc: private boost::noncopyable
SwTableBoxes* pTabBoxes; // boxes array in current row
SwTableBox* pTabBox; // current cell
- WW8MergeGroups aMergeGroups; // list of all cells to be merged
+ WW8MergeGroups m_MergeGroups; // list of all cells to be merged
WW8_TCell* pAktWWCell;
@@ -2617,7 +2616,7 @@ void WW8TabDesc::MergeCells()
}
// 3. push to group array
- aMergeGroups.push_back(pActMGroup);
+ m_MergeGroups.push_back(std::unique_ptr<WW8SelBoxInfo>(pActMGroup));
}
// if necessary add the current box to a merge group
@@ -2697,13 +2696,10 @@ void WW8TabDesc::FinishSwTable()
MergeCells();
// if needed group cells together that should be merged
- if( !aMergeGroups.empty() )
+ if (!m_MergeGroups.empty())
{
// process all merge groups one by one
- for (
- WW8MergeGroups::iterator groupIt = aMergeGroups.begin();
- groupIt != aMergeGroups.end();
- ++groupIt)
+ for (auto const& groupIt : m_MergeGroups)
{
sal_uInt16 nActBoxCount = groupIt->size();
@@ -2721,11 +2717,11 @@ void WW8TabDesc::FinishSwTable()
}
}
pIo->m_pFormatOfJustInsertedApo = 0;
- aMergeGroups.clear();
+ m_MergeGroups.clear();
}
}
-// browse aMergeGroups, detect the index of the first fitting group or -1 otherwise
+// browse m_MergeGroups, detect the index of the first fitting group or -1 otherwise
// Parameter: nXcenter = center position of asking box
// nWidth = width of asking box
@@ -2734,7 +2730,7 @@ void WW8TabDesc::FinishSwTable()
WW8SelBoxInfo* WW8TabDesc::FindMergeGroup(short nX1, short nWidth, bool bExact)
{
- if( !aMergeGroups.empty() )
+ if (!m_MergeGroups.empty())
{
// still valid area near the boundery
const short nToleranz = 4;
@@ -2745,10 +2741,10 @@ WW8SelBoxInfo* WW8TabDesc::FindMergeGroup(short nX1, short nWidth, bool bExact)
short nGrX2;
// improvement: search backwards
- for ( short iGr = aMergeGroups.size() - 1; iGr >= 0; --iGr )
+ for (short iGr = m_MergeGroups.size() - 1; iGr >= 0; --iGr)
{
// the currently inspected group
- WW8SelBoxInfo& rActGroup = aMergeGroups[ iGr ];
+ WW8SelBoxInfo& rActGroup = *m_MergeGroups[ iGr ];
if (!rActGroup.bGroupLocked)
{
// approximate group boundery with room (tolerance) to the *outside*
commit 3e2a6738969cea8ed2eb0e6c25fa2673ca756e63
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Oct 27 22:00:33 2015 +0100
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I2bb543ce1678140e8a6e086171a8f6b4529771d3
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 1db7c25..6c6b361 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -55,7 +55,6 @@
#include <oox/ole/olehelper.hxx>
#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
class SwDoc;
class SwPaM;
@@ -165,7 +164,7 @@ private:
const WW8Fib& rFib;
SvStream& rSt;
std::vector<WW8LSTInfo* > maLSTInfos;
- boost::ptr_vector<WW8LFOInfo > pLFOInfos;// D. from PLF LFO, sorted exactly like in the WW8 Stream
+ std::vector<std::unique_ptr<WW8LFOInfo>> m_LFOInfos;// D. from PLF LFO, sorted exactly like in the WW8 Stream
sal_uInt16 nUniqueList; // current number for creating unique list names
sal_uInt8* GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms, sal_uInt8 nLen);
WW8LSTInfo* GetLSTByListId( sal_uInt32 nIdLst ) const;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 35ce862..c642c5c 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
#include <comphelper/string.hxx>
#include <tools/solar.h>
#include <vcl/vclenum.hxx>
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 4ddc311..8ea7875 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -429,7 +429,7 @@ struct WW8LFOInfo // unsortiert, d.h. Reihenfolge genau wie im WW8 Stream
// an dem Tag, wo MS ihr Listenformat auf mehr als 15 Level aufbohren.
bool bOverride :1;// Flag, ob die NumRule nicht in maLSTInfos steht,
- // sondern fuer pLFOInfos NEU angelegt wurde
+ // sondern fuer m_LFOInfos NEU angelegt wurde
bool bSimpleList:1;// Flag, ob diese NumRule nur einen Level verwendet
bool bUsedInDoc :1;// Flag, ob diese NumRule im Doc verwendet wird,
// oder beim Reader-Ende geloescht werden sollte
@@ -1321,7 +1321,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
aLFO.bSimpleList = pParentListInfo->bSimpleList;
}
// und rein ins Merk-Array mit dem Teil
- WW8LFOInfo* pLFOInfo = new WW8LFOInfo(aLFO);
+ std::unique_ptr<WW8LFOInfo> pLFOInfo(new WW8LFOInfo(aLFO));
if (pParentListInfo)
{
//Copy the basic paragraph properties for each level from the
@@ -1331,7 +1331,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
for (int i = 0; i < nMaxSize; ++i)
pLFOInfo->maParaSprms[i] = pParentListInfo->maParaSprms[i];
}
- pLFOInfos.push_back(pLFOInfo);
+ m_LFOInfos.push_back(std::move(pLFOInfo));
bOk = true;
}
@@ -1340,10 +1340,10 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_)
// 2.2 fuer alle LFO die zugehoerigen LFOLVL einlesen
- size_t nLFOInfos = pLFOInfos.size();
+ size_t nLFOInfos = m_LFOInfos.size();
for (size_t nLfo = 0; nLfo < nLFOInfos; ++nLfo)
{
- WW8LFOInfo& rLFOInfo = pLFOInfos[nLfo];
+ WW8LFOInfo& rLFOInfo = *m_LFOInfos[nLfo];
// stehen hierfuer ueberhaupt LFOLVL an ?
if( rLFOInfo.bOverride )
{
@@ -1510,17 +1510,14 @@ WW8ListManager::~WW8ListManager()
}
delete *aIter;
}
- boost::ptr_vector<WW8LFOInfo >::reverse_iterator aIter;
- for (aIter = pLFOInfos.rbegin() ;
- aIter < pLFOInfos.rend();
- ++aIter )
+ for (auto aIter = m_LFOInfos.rbegin(); aIter < m_LFOInfos.rend(); ++aIter)
{
- if (aIter->bOverride
- && aIter->pNumRule
- && !aIter->bUsedInDoc
- && aIter->pNumRule->IsAutoRule())
+ if ((*aIter)->bOverride
+ && (*aIter)->pNumRule
+ && !(*aIter)->bUsedInDoc
+ && (*aIter)->pNumRule->IsAutoRule())
{
- rDoc.DelNumRule( aIter->pNumRule->GetName() );
+ rDoc.DelNumRule( (*aIter)->pNumRule->GetName() );
}
}
}
@@ -1557,10 +1554,10 @@ bool IsEqualFormatting(const SwNumRule &rOne, const SwNumRule &rTwo)
SwNumRule* WW8ListManager::GetNumRuleForActivation(sal_uInt16 nLFOPosition,
const sal_uInt8 nLevel, std::vector<sal_uInt8> &rParaSprms, SwTextNode *pNode)
{
- if (pLFOInfos.size() <= nLFOPosition)
+ if (m_LFOInfos.size() <= nLFOPosition)
return 0;
- WW8LFOInfo& rLFOInfo = pLFOInfos[nLFOPosition];
+ WW8LFOInfo& rLFOInfo = *m_LFOInfos[nLFOPosition];
bool bFirstUse = !rLFOInfo.bUsedInDoc;
rLFOInfo.bUsedInDoc = true;
commit 44d38a110b87afbba6f8221e226ce22a93a39127
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Oct 27 18:06:31 2015 +0100
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I32edfa929aa81431a1e20180f3fd8a539ad43274
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index cebe071..3ddf594 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -860,8 +860,7 @@ WW8_WrPlcPn::WW8_WrPlcPn(WW8Export& rWr, ePLCFT ePl, WW8_FC nStartFc)
, nFkpStartPage(0)
, ePlc(ePl)
{
- WW8_WrFkp* pF = new WW8_WrFkp(ePlc, nStartFc);
- aFkps.push_back( pF );
+ m_Fkps.push_back(o3tl::make_unique<WW8_WrFkp>(ePlc, nStartFc));
}
WW8_WrPlcPn::~WW8_WrPlcPn()
@@ -870,13 +869,13 @@ WW8_WrPlcPn::~WW8_WrPlcPn()
sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 &rLen)
{
- WW8_WrFkp& rF = aFkps.back();
+ WW8_WrFkp& rF = *m_Fkps.back();
return rF.CopyLastSprms(rLen);
}
void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pSprms)
{
- WW8_WrFkp* pF = &aFkps.back();
+ WW8_WrFkp* pF = m_Fkps.back().get();
// big sprm? build the sprmPHugePapx
sal_uInt8* pNewSprms = const_cast<sal_uInt8*>(pSprms);
@@ -915,7 +914,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS
pF->Combine();
pF = new WW8_WrFkp(ePlc, pF->GetEndFc()); // Start new Fkp == end of old Fkp
- aFkps.push_back( pF );
+ m_Fkps.push_back(std::unique_ptr<WW8_WrFkp>(pF));
if( !pF->Append( nEndFc, nVarLen, pNewSprms ) )
{
OSL_ENSURE( false, "Sprm liess sich nicht einfuegen" );
@@ -929,18 +928,20 @@ void WW8_WrPlcPn::WriteFkps()
{
nFkpStartPage = (sal_uInt16) ( SwWW8Writer::FillUntil( rWrt.Strm() ) >> 9 );
- for( size_t i = 0; i < aFkps.size(); i++ )
- aFkps[ i ].Write( rWrt.Strm(), *rWrt.m_pGrf );
+ for( size_t i = 0; i < m_Fkps.size(); i++ )
+ {
+ m_Fkps[ i ]->Write( rWrt.Strm(), *rWrt.m_pGrf );
+ }
if( CHP == ePlc )
{
rWrt.pFib->pnChpFirst = nFkpStartPage;
- rWrt.pFib->cpnBteChp = aFkps.size();
+ rWrt.pFib->cpnBteChp = m_Fkps.size();
}
else
{
rWrt.pFib->pnPapFirst = nFkpStartPage;
- rWrt.pFib->cpnBtePap = aFkps.size();
+ rWrt.pFib->cpnBtePap = m_Fkps.size();
}
}
@@ -949,16 +950,20 @@ void WW8_WrPlcPn::WritePlc()
sal_uLong nFcStart = rWrt.pTableStrm->Tell();
sal_uInt16 i;
- for( i = 0; i < aFkps.size(); i++ )
+ for (i = 0; i < m_Fkps.size(); ++i)
+ {
SwWW8Writer::WriteLong( *rWrt.pTableStrm,
- aFkps[ i ].GetStartFc() );
+ m_Fkps[ i ]->GetStartFc() );
+ }
SwWW8Writer::WriteLong( *rWrt.pTableStrm,
- aFkps[ i - 1 ].GetEndFc() );
+ m_Fkps[ i - 1 ]->GetEndFc() );
// fuer jedes FKP die Page ausgeben
- for ( i = 0; i < aFkps.size(); i++)
+ for (i = 0; i < m_Fkps.size(); ++i)
+ {
SwWW8Writer::WriteLong( *rWrt.pTableStrm, i + nFkpStartPage );
+ }
if( CHP == ePlc )
{
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 7bb353b..e05c50e 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -39,7 +39,6 @@
#include <vcl/graph.hxx>
#include <boost/optional.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <memory>
#include <map>
@@ -1253,13 +1252,13 @@ public:
};
// Plc for Chpx and Papx ( incl PN-Plc )
-typedef boost::ptr_vector<WW8_WrFkp> WW8_WrFkpPtrs;
+typedef std::vector<std::unique_ptr<WW8_WrFkp>> WW8_WrFkpPtrs;
class WW8_WrPlcPn // Plc for Page Numbers
{
private:
WW8Export& rWrt;
- WW8_WrFkpPtrs aFkps; // PTRARR
+ WW8_WrFkpPtrs m_Fkps;
sal_uInt16 nFkpStartPage;
ePLCFT ePlc;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 3e855b9..1db7c25 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -55,6 +55,7 @@
#include <oox/ole/olehelper.hxx>
#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
class SwDoc;
class SwPaM;
commit 191ca975b7fd37d79d8b82fdf4ecb5f298625c22
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Oct 27 17:57:15 2015 +0100
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I9adb9a445844ead91eefec8c57b879b0cc11c686
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 1cfab96..cebe071 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -29,6 +29,7 @@
#include <hintids.hxx>
#include <string.h>
#include <osl/endian.h>
+#include <o3tl/make_unique.hxx>
#include <docsh.hxx>
#include <drawdoc.hxx>
@@ -1235,10 +1236,10 @@ void WW8_WrPct::AppendPc(WW8_FC nStartFc)
WW8_CP nStartCp = nStartFc - nOldFc; // subtract the beginning of the text
if ( !nStartCp )
{
- if ( !aPcts.empty() )
+ if (!m_Pcts.empty())
{
- OSL_ENSURE( 1 == aPcts.size(), "Leeres Piece !!");
- aPcts.pop_back( );
+ OSL_ENSURE(1 == m_Pcts.size(), "empty Piece!");
+ m_Pcts.pop_back();
}
}
@@ -1246,39 +1247,40 @@ void WW8_WrPct::AppendPc(WW8_FC nStartFc)
nStartCp >>= 1; // for Unicode: number of characters / 2
- if( !aPcts.empty() )
- nStartCp += aPcts.back().GetStartCp();
+ if (!m_Pcts.empty())
+ {
+ nStartCp += m_Pcts.back()->GetStartCp();
+ }
- WW8_WrPc* pPc = new WW8_WrPc( nStartFc, nStartCp );
- aPcts.push_back( pPc );
+ m_Pcts.push_back(o3tl::make_unique<WW8_WrPc>(nStartFc, nStartCp));
}
void WW8_WrPct::WritePc( WW8Export& rWrt )
{
sal_uLong nPctStart;
sal_uLong nOldPos, nEndPos;
- boost::ptr_vector<WW8_WrPc>::iterator aIter;
nPctStart = rWrt.pTableStrm->Tell(); // Start piece table
rWrt.pTableStrm->WriteChar( ( char )0x02 ); // Status byte PCT
nOldPos = nPctStart + 1; // remember Position
SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 ); // then the length
- for( aIter = aPcts.begin(); aIter != aPcts.end(); ++aIter ) // ranges
- SwWW8Writer::WriteLong( *rWrt.pTableStrm,
- aIter->GetStartCp() );
+ for (auto const& it : m_Pcts) // ranges
+ {
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, it->GetStartCp() );
+ }
// calculate the last Pos
sal_uLong nStartCp = rWrt.pFib->fcMac - nOldFc;
nStartCp >>= 1; // For Unicode: number of characters / 2
- nStartCp += aPcts.back().GetStartCp();
+ nStartCp += m_Pcts.back()->GetStartCp();
SwWW8Writer::WriteLong( *rWrt.pTableStrm, nStartCp );
// piece references
- for ( aIter = aPcts.begin(); aIter != aPcts.end(); ++aIter )
+ for (auto const& it : m_Pcts)
{
- SwWW8Writer::WriteShort( *rWrt.pTableStrm, aIter->GetStatus());
- SwWW8Writer::WriteLong( *rWrt.pTableStrm, aIter->GetStartFc());
+ SwWW8Writer::WriteShort(*rWrt.pTableStrm, it->GetStatus());
+ SwWW8Writer::WriteLong(*rWrt.pTableStrm, it->GetStartFc());
SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0); // PRM=0
}
@@ -1295,18 +1297,18 @@ void WW8_WrPct::WritePc( WW8Export& rWrt )
void WW8_WrPct::SetParaBreak()
{
- OSL_ENSURE( !aPcts.empty(),"SetParaBreak : aPcts.empty()" );
- aPcts.back().SetStatus();
+ OSL_ENSURE( !m_Pcts.empty(), "SetParaBreak : m_Pcts.empty()" );
+ m_Pcts.back()->SetStatus();
}
WW8_CP WW8_WrPct::Fc2Cp( sal_uLong nFc ) const
{
OSL_ENSURE( nFc >= (sal_uLong)nOldFc, "FilePos lies in front of last piece" );
- OSL_ENSURE( ! aPcts.empty(), "Fc2Cp no piece available" );
+ OSL_ENSURE( ! m_Pcts.empty(), "Fc2Cp no piece available" );
nFc -= nOldFc;
nFc /= 2; // Unicode
- return nFc + aPcts.back().GetStartCp();
+ return nFc + m_Pcts.back()->GetStartCp();
}
void WW8Export::AppendBookmarks( const SwTextNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen )
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index ea1e06f..7bb353b 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -41,6 +41,7 @@
#include <boost/optional.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
#include <map>
#include <vector>
@@ -276,7 +277,7 @@ public:
// class WW8_WrPct to construct the piece table
class WW8_WrPct
{
- boost::ptr_vector<WW8_WrPc > aPcts;
+ std::vector<std::unique_ptr<WW8_WrPc>> m_Pcts;
WW8_FC nOldFc;
public:
explicit WW8_WrPct(WW8_FC nStartFc);
More information about the Libreoffice-commits
mailing list