[Libreoffice-commits] core.git: sw/source

Michael Stahl mstahl at redhat.com
Wed Jan 22 15:21:09 PST 2014


 sw/source/core/docnode/ndtbl.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit b2f9d1b43e4b14cc48327cdce14a03c826096579
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jan 22 21:11:01 2014 +0100

    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

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 6892e2b..cc85950 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;
             }


More information about the Libreoffice-commits mailing list