[Libreoffice-commits] .: 3 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Nov 24 06:59:45 PST 2012


 sc/source/core/data/table4.cxx       |   57 +++++++++++++++++++++++++++++++++++
 sc/source/filter/excel/excform8.cxx  |   26 ++++++++-------
 sc/source/filter/excel/xicontent.cxx |    4 +-
 sc/source/filter/inc/formel.hxx      |    3 +
 4 files changed, 75 insertions(+), 15 deletions(-)

New commits:
commit add3633a6ec53b038ebd29b70125d0eb259549d6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Nov 23 23:15:04 2012 +0100

    autofill should adapt the cond format range, fdo#57050
    
    Change-Id: Iec5e4f75f92f4bfcc49d3e3e36090d0c7d0f8be3

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index b1f86e0..124f441 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -71,6 +71,7 @@
 #include "docpool.hxx"
 #include "progress.hxx"
 #include "segmenttree.hxx"
+#include "conditio.hxx"
 
 #include <math.h>
 
@@ -603,6 +604,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                         pNewPattern = NULL;
                 }
 
+                const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(pSrcPattern->GetItem(ATTR_CONDITIONAL));
+                const std::vector<sal_uInt32>& rCondFormatIndex = rCondFormatItem.GetCondFormatData();
+
                 if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered )
                 {
                     //  Attribute komplett am Stueck setzen
@@ -617,7 +621,18 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                             aCol[nCol].ApplyPatternArea( nY1, nY2, *pNewPattern );
                         else
                             aCol[nCol].ApplyPatternArea( nY1, nY2, *pSrcPattern );
+
+                        for(std::vector<sal_uInt32>::const_iterator itr = rCondFormatIndex.begin(), itrEnd = rCondFormatIndex.end();
+                                                        itr != itrEnd; ++itr)
+                        {
+                            ScConditionalFormat* pCondFormat = mpCondFormatList->GetFormat(*itr);
+                            ScRangeList aRange = pCondFormat->GetRange();
+                            aRange.Join(ScRange(nCol, nY1, nTab, nCol, nY2, nTab));
+                            pCondFormat->AddRange(aRange);
+                        }
                     }
+
+
                     break;      // Schleife abbrechen
                 }
 
@@ -637,6 +652,15 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                         aCol[nCol].ApplyPattern( static_cast<SCROW>(nRow), *pNewPattern );
                     else
                         aCol[nCol].ApplyPattern( static_cast<SCROW>(nRow), *pSrcPattern );
+
+                    for(std::vector<sal_uInt32>::const_iterator itr = rCondFormatIndex.begin(), itrEnd = rCondFormatIndex.end();
+                            itr != itrEnd; ++itr)
+                    {
+                        ScConditionalFormat* pCondFormat = mpCondFormatList->GetFormat(*itr);
+                        ScRangeList aRange = pCondFormat->GetRange();
+                        aRange.Join(ScRange(nCol, nRow, nTab, nCol, nRow, nTab));
+                        pCondFormat->AddRange(aRange);
+                    }
                 }
 
                 if (nAtSrc==nISrcEnd)
@@ -1384,6 +1408,10 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         if (bAttribs)
         {
             const ScPatternAttr* pSrcPattern = aCol[nCol].GetPattern(static_cast<SCROW>(nRow));
+
+            const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(pSrcPattern->GetItem(ATTR_CONDITIONAL));
+            const std::vector<sal_uInt32>& rCondFormatIndex = rCondFormatItem.GetCondFormatData();
+
             if (bVertical)
             {
                 // if not filtered use the faster method
@@ -1392,14 +1420,33 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                 {
                     aCol[nCol].SetPatternArea( static_cast<SCROW>(nIMin),
                             static_cast<SCROW>(nIMax), *pSrcPattern, true );
+
+                    for(std::vector<sal_uInt32>::const_iterator itr = rCondFormatIndex.begin(), itrEnd = rCondFormatIndex.end();
+                            itr != itrEnd; ++itr)
+                    {
+                        ScConditionalFormat* pCondFormat = mpCondFormatList->GetFormat(*itr);
+                        ScRangeList aRange = pCondFormat->GetRange();
+                        aRange.Join(ScRange(nCol, nIMin, nTab, nCol, nIMax, nTab));
+                        pCondFormat->AddRange(aRange);
+                    }
                 }
                 else
                 {
                     for(SCROW nAtRow = static_cast<SCROW>(nIMin); nAtRow <= static_cast<SCROW>(nIMax); ++nAtRow)
                     {
                         if(!RowHidden(nAtRow))
+                        {
                             aCol[nCol].SetPatternArea( static_cast<SCROW>(nAtRow),
                                     static_cast<SCROW>(nAtRow), *pSrcPattern, true);
+                            for(std::vector<sal_uInt32>::const_iterator itr = rCondFormatIndex.begin(), itrEnd = rCondFormatIndex.end();
+                                    itr != itrEnd; ++itr)
+                            {
+                                ScConditionalFormat* pCondFormat = mpCondFormatList->GetFormat(*itr);
+                                ScRangeList aRange = pCondFormat->GetRange();
+                                aRange.Join(ScRange(nCol, nAtRow, nTab, nCol, nAtRow, nTab));
+                                pCondFormat->AddRange(aRange);
+                            }
+                        }
                     }
 
                 }
@@ -1407,7 +1454,17 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
             else
                 for (SCCOL nAtCol = static_cast<SCCOL>(nIMin); nAtCol <= sal::static_int_cast<SCCOL>(nIMax); nAtCol++)
                     if(!ColHidden(nAtCol))
+                    {
                         aCol[nAtCol].SetPattern(static_cast<SCROW>(nRow), *pSrcPattern, true);
+                        for(std::vector<sal_uInt32>::const_iterator itr = rCondFormatIndex.begin(), itrEnd = rCondFormatIndex.end();
+                                itr != itrEnd; ++itr)
+                        {
+                            ScConditionalFormat* pCondFormat = mpCondFormatList->GetFormat(*itr);
+                            ScRangeList aRange = pCondFormat->GetRange();
+                            aRange.Join(ScRange(nAtCol, static_cast<SCROW>(nRow), nTab, nAtCol, static_cast<SCROW>(nRow), nTab));
+                            pCondFormat->AddRange(aRange);
+                        }
+                    }
         }
 
         if (pSrcCell)
commit d1def6b029ad941d0b2cbecd8f682ae0d33ddd79
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 24 15:51:09 2012 +0100

    don't make 2D refs 3D refs in the cond format import, fdo#36379
    
    Change-Id: I1c190e29ab26fab7e3ae109ea3135d7654a7cb9a

diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 35cb3a8..95b4d37 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -158,7 +158,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
     sal_Bool                    bError = false;
     sal_Bool                    bArrayFormula = false;
     TokenId                 nMerk0;
-    const bool              bRangeName = eFT == FT_RangeName;
+    const bool              bCondFormat = eFT == FT_CondFormat;
+    const bool              bRangeName = eFT == FT_RangeName || bCondFormat;
     const bool              bSharedFormula = eFT == FT_SharedFormula;
     const bool              bRNorSF = bRangeName || bSharedFormula;
 
@@ -510,7 +511,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
                 aSRD.nRow = nRow & 0x3FFF;
                 aSRD.nRelTab = 0;
                 aSRD.SetTabRel( sal_True );
-                aSRD.SetFlag3D( bRangeName );
+                aSRD.SetFlag3D( bRangeName && !bCondFormat );
 
                 ExcRelToScRel8( nRow, nCol, aSRD, bRangeName );
 
@@ -544,8 +545,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
                 rSRef1.nRelTab = rSRef2.nRelTab = 0;
                 rSRef1.SetTabRel( sal_True );
                 rSRef2.SetTabRel( sal_True );
-                rSRef1.SetFlag3D( bRangeName );
-                rSRef2.SetFlag3D( bRangeName );
+                rSRef1.SetFlag3D( bRangeName && !bCondFormat );
+                rSRef2.SetFlag3D( bRangeName && !bCondFormat );
 
                 ExcRelToScRel8( nRowFirst, nColFirst, aCRD.Ref1, bRangeName );
                 ExcRelToScRel8( nRowLast, nColLast, aCRD.Ref2, bRangeName );
@@ -945,7 +946,8 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
 {
     sal_uInt8                   nOp, nLen;
     sal_Bool                    bError = false;
-    const bool              bRangeName = eFT == FT_RangeName;
+    const bool              bCondFormat = eFT == FT_CondFormat;
+    const bool              bRangeName = eFT == FT_RangeName || bCondFormat;
     const bool              bSharedFormula = eFT == FT_SharedFormula;
     const bool              bRNorSF = bRangeName || bSharedFormula;
 
@@ -1065,7 +1067,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                 aSRD.nRow = nRow & 0x3FFF;
                 aSRD.nRelTab = 0;
                 aSRD.SetTabRel( sal_True );
-                aSRD.SetFlag3D( bRangeName );
+                aSRD.SetFlag3D( bRangeName && !bCondFormat );
 
                 ExcRelToScRel8( nRow, nCol, aSRD, bRangeName );
 
@@ -1086,8 +1088,8 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                 rSRef1.nRelTab = rSRef2.nRelTab = 0;
                 rSRef1.SetTabRel( sal_True );
                 rSRef2.SetTabRel( sal_True );
-                rSRef1.SetFlag3D( bRangeName );
-                rSRef2.SetFlag3D( bRangeName );
+                rSRef1.SetFlag3D( bRangeName && !bCondFormat );
+                rSRef2.SetFlag3D( bRangeName && !bCondFormat );
 
                 ExcRelToScRel8( nRowFirst, nColFirst, aCRD.Ref1, bRangeName );
                 ExcRelToScRel8( nRowLast, nColLast, aCRD.Ref2, bRangeName );
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index edd4717..33cac5a 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -611,7 +611,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
     {
         const ScTokenArray* pTokArr = 0;
         rFmlaConv.Reset( rPos );
-        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_RangeName );
+        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_CondFormat );
         // formula converter owns pTokArr -> create a copy of the token array
         if( pTokArr )
             xTokArr1.reset( pTokArr->Clone() );
@@ -624,7 +624,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
     {
         const ScTokenArray* pTokArr = 0;
         rFmlaConv.Reset( rPos );
-        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_RangeName );
+        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_CondFormat );
         // formula converter owns pTokArr -> create a copy of the token array
         if( pTokArr )
             pTokArr2.reset( pTokArr->Clone() );
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 04fc46a..418fe14 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -58,7 +58,8 @@ enum FORMULA_TYPE
 {
     FT_CellFormula,
     FT_RangeName,
-    FT_SharedFormula
+    FT_SharedFormula,
+    FT_CondFormat
 };
 
 class _ScRangeListTabs
commit 5c522cf5836b7263981a8f9de38af54c64ef873a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 24 14:58:26 2012 +0100

    sal_Bool to bool
    
    Change-Id: I9d221cd10fcc6ef92b6accfcabd586717a7dcad8

diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 9693fe8..35cb3a8 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -158,9 +158,9 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
     sal_Bool                    bError = false;
     sal_Bool                    bArrayFormula = false;
     TokenId                 nMerk0;
-    const sal_Bool              bRangeName = eFT == FT_RangeName;
-    const sal_Bool              bSharedFormula = eFT == FT_SharedFormula;
-    const sal_Bool              bRNorSF = bRangeName || bSharedFormula;
+    const bool              bRangeName = eFT == FT_RangeName;
+    const bool              bSharedFormula = eFT == FT_SharedFormula;
+    const bool              bRNorSF = bRangeName || bSharedFormula;
 
     ScSingleRefData         aSRD;
     ScComplexRefData            aCRD;
@@ -945,9 +945,9 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
 {
     sal_uInt8                   nOp, nLen;
     sal_Bool                    bError = false;
-    const sal_Bool              bRangeName = eFT == FT_RangeName;
-    const sal_Bool              bSharedFormula = eFT == FT_SharedFormula;
-    const sal_Bool              bRNorSF = bRangeName || bSharedFormula;
+    const bool              bRangeName = eFT == FT_RangeName;
+    const bool              bSharedFormula = eFT == FT_SharedFormula;
+    const bool              bRNorSF = bRangeName || bSharedFormula;
 
     ScSingleRefData         aSRD;
     ScComplexRefData            aCRD;


More information about the Libreoffice-commits mailing list