diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-01-22 21:11:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-02 13:27:19 +0000 |
commit | 3ab6b03413803c9512a7dd02d42542372f8e573e (patch) | |
tree | f60409447923da25ccab062b6c46ac05d24cbfec | |
parent | bump version to 4.1.5.2.0+ (diff) | |
download | core-3ab6b03413803c9512a7dd02d42542372f8e573e.tar.gz core-3ab6b03413803c9512a7dd02d42542372f8e573e.zip |
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
(cherry picked from commit b2f9d1b43e4b14cc48327cdce14a03c826096579)
Reviewed-on: https://gerrit.libreoffice.org/7640
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit d506760f7797565486c2470abbc269a446fbc3b0)
Reviewed-on: https://gerrit.libreoffice.org/7679
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-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 689ac04bfdb4..92f17bf60689 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4460,22 +4460,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; } |