Kaydet (Commit) d3fe01de authored tarafından Michael Stahl's avatar Michael Stahl

fix problems in 1015cd4f:

- inverted check in SwDoc::RemoveInvisibleContent
- various too short end positions in DeleteAndDestroy calls in
  SwDoc::~SwDoc and SwDoc::ClearDoc
- std::copy to begin() of empty vector in SwReader::Read replaced
  with std::back_inserter; the vector is used as a set here so the
  end position should work just as well

Change-Id: Ib2ddd788fade4ee1a8beb702d5321c503985fba4
üst 38ebb2f9
......@@ -2245,8 +2245,9 @@ bool SwDoc::RemoveInvisibleContent()
pParent = pTmp;
}
SwSectionFmts::iterator it = std::find( aSectFmts.begin(), aSectFmts.end(), pSect->GetFmt() );
if ( it != aSectFmts.end() )
SwSectionFmts::iterator it = std::find(
aSectFmts.begin(), aSectFmts.end(), pSect->GetFmt() );
if (it == aSectFmts.end())
aSectFmts.insert( aSectFmts.begin(), pSect->GetFmt() );
}
if( pSect->GetCondition().Len() )
......
......@@ -632,14 +632,14 @@ SwDoc::~SwDoc()
// array, we should delete it as the last. With this we avoid
// remangling the Formats all the time!
if( 2 < pTxtFmtCollTbl->size() )
DeleteAndDestroy( *pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size()-2 );
DeleteAndDestroy( *pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size()-1 );
DeleteAndDestroy(*pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size());
DeleteAndDestroy(*pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size());
delete pTxtFmtCollTbl;
OSL_ENSURE( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0],
"DefaultGrfCollection must always be at the start" );
DeleteAndDestroy( *pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size()-1 );
DeleteAndDestroy(*pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size());
// Is the result anyway - no _DEL array!
// pGrfFmtCollTbl->Remove( 0, n );
delete pGrfFmtCollTbl;
......@@ -876,20 +876,20 @@ void SwDoc::ClearDoc()
// array, we should delete it as the last. With this we avoid
// remangling the Formats all the time!
if( 2 < pTxtFmtCollTbl->size() )
DeleteAndDestroy( *pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size()-2 );
DeleteAndDestroy( *pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size()-1 );
DeleteAndDestroy( *pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size()-1 );
DeleteAndDestroy( *pCharFmtTbl, 1, pCharFmtTbl->size()-1 );
DeleteAndDestroy(*pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size());
DeleteAndDestroy(*pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size());
DeleteAndDestroy(*pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size());
DeleteAndDestroy(*pCharFmtTbl, 1, pCharFmtTbl->size());
if( pCurrentView )
{
// search the FrameFormat of the root frm. This is not allowed to delete
pFrmFmtTbl->erase( std::find( pFrmFmtTbl->begin(), pFrmFmtTbl->end(), pCurrentView->GetLayout()->GetFmt() ) );
DeleteAndDestroy( *pFrmFmtTbl, 1, pFrmFmtTbl->size()-1 );
DeleteAndDestroy(*pFrmFmtTbl, 1, pFrmFmtTbl->size());
pFrmFmtTbl->push_back( pCurrentView->GetLayout()->GetFmt() );
}
else //swmod 071029//swmod 071225
DeleteAndDestroy( *pFrmFmtTbl, 1, pFrmFmtTbl->size()-1 );
DeleteAndDestroy(*pFrmFmtTbl, 1, pFrmFmtTbl->size());
xForbiddenCharsTable.clear();
......
......@@ -1668,7 +1668,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
// see if there are frames already anchored to this node
std::vector<SwFrmFmt*> aAnchoredFrames;
for (int i = 0; i < (int)m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i)
for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i)
{
SwFrmFmt* pFrmFmt = (*m_pImpl->m_pDoc->GetSpzFrmFmts())[i];
const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
......
......@@ -168,7 +168,10 @@ sal_uLong SwReader::Read( const Reader& rOptions )
// Speicher mal alle Fly's
if( pCrsr )
std::copy( pDoc->GetSpzFrmFmts()->begin(), pDoc->GetSpzFrmFmts()->end(), aFlyFrmArr.begin() );
{
std::copy(pDoc->GetSpzFrmFmts()->begin(),
pDoc->GetSpzFrmFmts()->end(), std::back_inserter(aFlyFrmArr));
}
xub_StrLen nSttCntnt = pPam->GetPoint()->nContent.GetIndex();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment