diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-01-22 21:11:01 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-01-23 00:16:46 +0100 |
commit | b2f9d1b43e4b14cc48327cdce14a03c826096579 (patch) | |
tree | 9490294512b8fdff31ba7195e294adb2aff00ea9 | |
parent | 8532dbcfa88051104dd6eea73b75147874cdcf4a (diff) |
fdo#67238: sw: fix table cell Unprotect
SwDoc::UnProtectCells() was setting the old box format (from aFmts)
instead of the new one, and actually these 2 vectors are a map.
(regression from 772101649cf16233bbaf0900aa9ebbc915151a95)
Change-Id: I0881a1c499c51b5f3c257e9def1a2e9a00bcb639
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 6892e2b029d5..cc859506cc21 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4424,22 +4424,23 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) ? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() ) : 0; - std::vector<SwFrmFmt*> aFmts, aNewFmts; + std::map<SwFrmFmt*, SwTableBoxFmt*> aFmtsMap; for (size_t i = rBoxes.size(); i; ) { SwTableBox* pBox = rBoxes[ --i ]; SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); if( pBoxFmt->GetProtect().IsCntntProtected() ) { - std::vector<SwFrmFmt*>::iterator it = std::find( aFmts.begin(), aFmts.end(), pBoxFmt ); - if( aFmts.end() != it ) - pBox->ChgFrmFmt( (SwTableBoxFmt*)*it ); + std::map<SwFrmFmt*, SwTableBoxFmt*>::const_iterator const it = + aFmtsMap.find(pBoxFmt); + if (aFmtsMap.end() != it) + pBox->ChgFrmFmt(it->second); else { - aFmts.push_back( pBoxFmt ); - pBoxFmt = pBox->ClaimFrmFmt(); - pBoxFmt->ResetFmtAttr( RES_PROTECT ); - aNewFmts.push_back( pBoxFmt ); + SwTableBoxFmt *const pNewBoxFmt( + dynamic_cast<SwTableBoxFmt*>(pBox->ClaimFrmFmt())); + pNewBoxFmt->ResetFmtAttr( RES_PROTECT ); + aFmtsMap.insert(std::make_pair(pBoxFmt, pNewBoxFmt)); } bChgd = sal_True; } |