[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/source

Michael Stahl mstahl at redhat.com
Sat Jan 25 04:05:54 PST 2014


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

New commits:
commit d506760f7797565486c2470abbc269a446fbc3b0
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
    (cherry picked from commit b2f9d1b43e4b14cc48327cdce14a03c826096579)
    Reviewed-on: https://gerrit.libreoffice.org/7640
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 689ac04..92f17bf 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;
             }


More information about the Libreoffice-commits mailing list