[Libreoffice-commits] .: Branch 'feature/cond-format-rework' - 6 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 5 12:27:37 PDT 2012


 sc/source/core/data/document.cxx          |    2 +-
 sc/source/filter/excel/xicontent.cxx      |   15 +++------------
 sc/source/filter/oox/condformatbuffer.cxx |   13 +++----------
 sc/source/filter/xml/xmlcondformat.cxx    |   14 +++-----------
 sc/source/filter/xml/xmlstyli.cxx         |   13 ++-----------
 5 files changed, 12 insertions(+), 45 deletions(-)

New commits:
commit cd743fee63eec572a3ee162859912b55640389ae
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 5 20:39:20 2012 +0200

    adapt xls import to new cond formats
    
    Change-Id: Ibf8149d14c1404fc6e82ec285be9389072f24c31

diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 0d4319a..c5f6dad 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -650,19 +650,10 @@ void XclImpCondFormat::Apply()
     {
         ScDocument& rDoc = GetDoc();
 
-        sal_uLong nKey = rDoc.AddCondFormat( mxScCondFmt->Clone(), maRanges.front()->aStart.Tab() );
-        ScPatternAttr aPattern( rDoc.GetPool() );
-        aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nKey ) );
+        SCTAB nTab = maRanges.front()->aStart.Tab();
+        sal_uLong nKey = rDoc.AddCondFormat( mxScCondFmt->Clone(), nTab );
 
-        // maRanges contains only valid cell ranges
-        for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
-        {
-            const ScRange* pScRange = maRanges[ i ];
-            rDoc.ApplyPatternAreaTab(
-                pScRange->aStart.Col(), pScRange->aStart.Row(),
-                pScRange->aEnd.Col(), pScRange->aEnd.Row(),
-                pScRange->aStart.Tab(), aPattern );
-        }
+        rDoc.AddCondFormatData( maRanges, nTab, nKey );
     }
 }
 
commit 234c5da7abde2029088204ff0d897cb0902c544e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 5 20:38:57 2012 +0200

    use parantheses to prevent wrong evaluation
    
    Change-Id: Ia872b5648286fd76039f7c397ea78e18bc2ad6b8

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5ebd9f5..14b6983 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4213,7 +4213,7 @@ void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
 
 void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex )
 {
-    if(!static_cast<SCTAB>(nTab) < maTabs.size())
+    if(!(static_cast<size_t>(nTab) < maTabs.size()))
         return;
 
     if(!maTabs[nTab])
commit af573ec0da1cc9f15d1a77a8fa36cafb8a403a37
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 5 19:58:56 2012 +0200

    adapt old style odf cond format import
    
    Change-Id: I0bfcc21f66e2c76f6c8521bfc711972eb747ac43

diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index 687c841..fe0f265 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -454,12 +454,7 @@ void XMLTableStyleContext::ApplyCondFormat( uno::Sequence<table::CellRangeAddres
                 rRangeList.Join(*pRange);
             }
 
-            ScPatternAttr aPattern( pDoc->GetPool() );
-            aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nCondId ) );
-            ScMarkData aMarkData;
-            aMarkData.MarkFromRangeList(aRangeList, true);
-            pDoc->ApplySelectionPattern( aPattern , aMarkData);
-
+            pDoc->AddCondFormatData( aRangeList, nTab, nCondId );
             break;
         }
     }
@@ -471,11 +466,7 @@ void XMLTableStyleContext::ApplyCondFormat( uno::Sequence<table::CellRangeAddres
         mpCondFormat->SetKey(nIndex);
         mpCondFormat->AddRange(aRangeList);
 
-        ScPatternAttr aPattern( pDoc->GetPool() );
-        aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
-        ScMarkData aMarkData;
-        aMarkData.MarkFromRangeList(aRangeList, true);
-        pDoc->ApplySelectionPattern( aPattern , aMarkData);
+        pDoc->AddCondFormatData( aRangeList, nTab, nIndex );
     }
 
 
commit f0f4913477e346db3aea667cadcba78330983dcf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 5 19:50:59 2012 +0200

    remove some newly unused includes
    
    Change-Id: I33e3d581d2ba38d6f68629fc2a7671cb48873bad

diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 23cff09..32e0751 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -36,11 +36,6 @@
 #include "rangelst.hxx"
 #include "rangeutl.hxx"
 #include "docfunc.hxx"
-#include "markdata.hxx"
-#include "docpool.hxx"
-#include "scitems.hxx"
-#include "patattr.hxx"
-#include "svl/intitem.hxx"
 #include "XMLConverter.hxx"
 
 
commit a8ff317b16eaf7c5223f45480006d842106073b9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 5 19:47:31 2012 +0200

    adapt oox import to cond format change
    
    Change-Id: I0924e0077f877cc123eab999c332e4c08df41f50

diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 7df5321..254b0d6 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -58,9 +58,6 @@
 #include "document.hxx"
 #include "convuno.hxx"
 #include "docfunc.hxx"
-#include "markdata.hxx"
-#include "docpool.hxx"
-#include "scitems.hxx"
 #include "tokenarray.hxx"
 #include "tokenuno.hxx"
 
@@ -892,21 +889,17 @@ void CondFormat::finalizeImport()
 {
     ScDocument& rDoc = getScDocument();
     maRules.forEachMem( &CondFormatRule::finalizeImport );
-    sal_Int32 nIndex = getScDocument().AddCondFormat(mpFormat, maModel.maRanges.getBaseAddress().Sheet);
+    SCTAB nTab = maModel.maRanges.getBaseAddress().Sheet;
+    sal_Int32 nIndex = getScDocument().AddCondFormat(mpFormat, nTab);
 
     ScRangeList aList;
     for( ApiCellRangeList::const_iterator itr = maModel.maRanges.begin(); itr != maModel.maRanges.end(); ++itr)
     {
         ScRange aRange;
         ScUnoConversion::FillScRange(aRange, *itr);
-        ScPatternAttr aPattern( rDoc.GetPool() );
-        aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
-        ScMarkData aMarkData;
-        aMarkData.SetMarkArea(aRange);
-        rDoc.ApplySelectionPattern( aPattern , aMarkData);
-
         aList.Append(aRange);
     }
+    rDoc.AddCondFormatData( aList, nTab, nIndex );
     mpFormat->AddRange(aList);
 }
 
commit 6199dbf7beb34d816882e6a1b3df597339cee72f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 5 19:46:54 2012 +0200

    adapt ods import of new cond format data
    
    Change-Id: I15969a5ddaab1d7edb2f0b2035f8206e6f544ab3

diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index c53e77f..23cff09 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -137,14 +137,11 @@ void ScXMLConditionalFormatContext::EndElement()
 {
     ScDocument* pDoc = GetScImport().GetDocument();
 
-    sal_uLong nIndex = pDoc->AddCondFormat(mpFormat, GetScImport().GetTables().GetCurrentSheet());
+    SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
+    sal_uLong nIndex = pDoc->AddCondFormat(mpFormat, nTab);
     mpFormat->SetKey(nIndex);
 
-    ScPatternAttr aPattern( pDoc->GetPool() );
-    aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
-    ScMarkData aMarkData;
-    aMarkData.MarkFromRangeList(mpFormat->GetRange(), true);
-    pDoc->ApplySelectionPattern( aPattern , aMarkData);
+    pDoc->AddCondFormatData( mpFormat->GetRange(), nTab, nIndex);
 }
 
 ScXMLColorScaleFormatContext::ScXMLColorScaleFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx,


More information about the Libreoffice-commits mailing list