[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 17:26:42 PST 2012


 sc/source/core/data/attarray.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 8a028afd55decfd269268d0d1e6adcfbdc9d85d0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Dec 18 02:28:24 2012 +0100

    we need to use a copy of the original ScPatternAttr, fdo#58338
    
    Change-Id: Ic231347cb864bff073d46ddef06f65b7517c45c3

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 31e4b2f..201538d 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -279,9 +279,10 @@ void ScAttrArray::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nInd
     {
         const ScPatternAttr* pPattern = GetPattern(nTempStartRow);
 
-        ScPatternAttr aPattern( pDocument->GetPool() );
+        boost::scoped_ptr<ScPatternAttr> pNewPattern;
         if(pPattern)
         {
+            pNewPattern.reset( new ScPatternAttr(*pPattern) );
             SCROW nPatternStartRow;
             SCROW nPatternEndRow;
             GetPatternRange( nPatternStartRow, nPatternEndRow, nTempStartRow );
@@ -296,17 +297,18 @@ void ScAttrArray::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nInd
 
             ScCondFormatItem aItem;
             aItem.SetCondFormatData( aCondFormatData );
-            aPattern.GetItemSet().Put( aItem );
+            pNewPattern->GetItemSet().Put( aItem );
         }
         else
         {
+            pNewPattern.reset( new ScPatternAttr( pDocument->GetPool() ) );
             ScCondFormatItem aItem;
             aItem.AddCondFormatData(nIndex);
-            aPattern.GetItemSet().Put( aItem );
+            pNewPattern->GetItemSet().Put( aItem );
             nTempEndRow = nEndRow;
         }
 
-        SetPatternArea( nTempStartRow, nTempEndRow, &aPattern, true );
+        SetPatternArea( nTempStartRow, nTempEndRow, pNewPattern.get(), true );
         nTempStartRow = nTempEndRow + 1;
     }
     while(nTempEndRow < nEndRow);
@@ -328,9 +330,9 @@ void ScAttrArray::RemoveCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 n
     {
         const ScPatternAttr* pPattern = GetPattern(nTempStartRow);
 
-        ScPatternAttr aPattern( pDocument->GetPool() );
         if(pPattern)
         {
+            ScPatternAttr aPattern( *pPattern );
             SCROW nPatternStartRow;
             SCROW nPatternEndRow;
             GetPatternRange( nPatternStartRow, nPatternEndRow, nTempStartRow );


More information about the Libreoffice-commits mailing list