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

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 77210164)

Change-Id: I0881a1c499c51b5f3c257e9def1a2e9a00bcb639
üst 8532dbcf
...@@ -4424,22 +4424,23 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) ...@@ -4424,22 +4424,23 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() ) ? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() )
: 0; : 0;
std::vector<SwFrmFmt*> aFmts, aNewFmts; std::map<SwFrmFmt*, SwTableBoxFmt*> aFmtsMap;
for (size_t i = rBoxes.size(); i; ) for (size_t i = rBoxes.size(); i; )
{ {
SwTableBox* pBox = rBoxes[ --i ]; SwTableBox* pBox = rBoxes[ --i ];
SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
if( pBoxFmt->GetProtect().IsCntntProtected() ) if( pBoxFmt->GetProtect().IsCntntProtected() )
{ {
std::vector<SwFrmFmt*>::iterator it = std::find( aFmts.begin(), aFmts.end(), pBoxFmt ); std::map<SwFrmFmt*, SwTableBoxFmt*>::const_iterator const it =
if( aFmts.end() != it ) aFmtsMap.find(pBoxFmt);
pBox->ChgFrmFmt( (SwTableBoxFmt*)*it ); if (aFmtsMap.end() != it)
pBox->ChgFrmFmt(it->second);
else else
{ {
aFmts.push_back( pBoxFmt ); SwTableBoxFmt *const pNewBoxFmt(
pBoxFmt = pBox->ClaimFrmFmt(); dynamic_cast<SwTableBoxFmt*>(pBox->ClaimFrmFmt()));
pBoxFmt->ResetFmtAttr( RES_PROTECT ); pNewBoxFmt->ResetFmtAttr( RES_PROTECT );
aNewFmts.push_back( pBoxFmt ); aFmtsMap.insert(std::make_pair(pBoxFmt, pNewBoxFmt));
} }
bChgd = sal_True; bChgd = sal_True;
} }
......
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