[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jun 17 10:26:05 PDT 2009


 patches/dev300/apply                                |    9 
 patches/dev300/calc-chart-hypocycloid-fix.diff      |   63 -----
 patches/dev300/calc-dirty-cells-after-load-fix.diff |  229 ++++++++++++++++++++
 3 files changed, 235 insertions(+), 66 deletions(-)

New commits:
commit 7de386e4a7bfb99b2d3177db91113d6c500aa878
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Jun 17 13:19:53 2009 -0400

    Fix for chart update problems with Excel documents.
    
    When loading an Excel document with charts, charts failed to update on
    value change when the source ranges consisted of formula cells outside
    the visible area.  Creating a chart listener per chart object, and not
    modifying formula cell's dirty flags upon file load fix this problem.
    (n#491898)
    
    * patches/dev300/apply:
    * patches/dev300/calc-chart-hypocycloid-fix.diff: removed; old,
      temporary fix.
    * patches/dev300/calc-dirty-cells-after-load-fix.diff: new fix, and
      hopefully the right fix.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 679d6fc..ef33df3 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2019,9 +2019,6 @@ calc-jump-on-formula-ref-sc.diff,        n#464359, i#101018, kohei
 calc-jump-on-formula-ref-sfx2.diff,      n#464359, i#101018, kohei
 calc-jump-on-formula-ref-vcl.diff,       n#464359, i#101018, kohei
 
-# mark chart data ranges dirty to force re-calculation.
-calc-chart-hypocycloid-fix.diff, n#491898, kohei
-
 # extend column range to Calc's max column when the range ends with 256.
 calc-xls-import-maxcol.diff, n#495140, i#101330, kohei
 
@@ -3105,6 +3102,12 @@ xlsx-export-cell-style-max-builtin.diff, n#497563, janneke
 [ OOXML ]
 oox-pptx-export-fix-hidden-slides.diff, n#499131, rodo
 
+[ CalcFixes ]
+
+# register chart listener per chart object when for xls import & don't modify
+# cell's dirty flag upon loading.
+calc-dirty-cells-after-load-fix.diff, n#491898, kohei
+
 [ CalcRowLimit ]
 # The work to increase Calc's row size limit, and any work associated with it.
 SectionOwner => kohei
diff --git a/patches/dev300/calc-chart-hypocycloid-fix.diff b/patches/dev300/calc-chart-hypocycloid-fix.diff
deleted file mode 100644
index 649beb5..0000000
--- a/patches/dev300/calc-chart-hypocycloid-fix.diff
+++ /dev/null
@@ -1,63 +0,0 @@
-diff --git sc/inc/chart2uno.hxx sc/inc/chart2uno.hxx
-index f6ae3fd..5247475 100644
---- sc/inc/chart2uno.hxx
-+++ sc/inc/chart2uno.hxx
-@@ -461,6 +461,7 @@ public:
- // 									com::sun::star::uno::XInterface> xObj );
- 
- private:
-+    void markRangeDirty(const ScRange& rRange) const;
-     void setDataChangedHint(bool b);
- 
-     // Implementation --------------------------------------------------------
-diff --git sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/chart2uno.cxx
-index 163ba2a..55ff449 100644
---- sc/source/ui/unoobj/chart2uno.cxx
-+++ sc/source/ui/unoobj/chart2uno.cxx
-@@ -3687,6 +3687,8 @@ void SAL_CALL ScChart2DataSequence::addModifyListener( const uno::Reference< uti
-                 m_pDocument->StartListeningArea( aRange, m_pValueListener );
-                 if (pCLC)
-                     pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
-+
-+                markRangeDirty(aRange);
-             }
-         }
- 
-@@ -3844,6 +3846,37 @@ void SAL_CALL ScChart2DataSequence::removeVetoableChangeListener(
-     OSL_ENSURE( false, "Not yet implemented" );
- }
- 
-+void ScChart2DataSequence::markRangeDirty(const ScRange& rRange) const
-+{
-+    if (!m_pDocument)
-+        return;
-+
-+    const ScAddress &s = rRange.aStart, &e = rRange.aEnd;
-+    SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
-+    SCCOL nCol1 = s.Col(), nCol2 = e.Col();
-+    SCROW nRow1 = s.Row(), nRow2 = e.Row();
-+    for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
-+    {
-+        for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
-+        {
-+            for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
-+            {
-+                ScAddress aAddr(nCol, nRow, nTab);
-+                ScBaseCell* pBaseCell = m_pDocument->GetCell(aAddr);
-+                if (!pBaseCell || pBaseCell->GetCellType() != CELLTYPE_FORMULA)
-+                    continue;
-+
-+                ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pBaseCell);
-+                ScTokenArray* pArray = pFCell->GetCode();
-+                if (!pArray)
-+                    continue;
-+
-+                pFCell->SetDirty();
-+            }
-+        }
-+    }
-+}
-+
- void ScChart2DataSequence::setDataChangedHint(bool b)
- {
-     m_bGotDataChangedHint = b;
diff --git a/patches/dev300/calc-dirty-cells-after-load-fix.diff b/patches/dev300/calc-dirty-cells-after-load-fix.diff
new file mode 100644
index 0000000..b581a2f
--- /dev/null
+++ b/patches/dev300/calc-dirty-cells-after-load-fix.diff
@@ -0,0 +1,229 @@
+diff --git sc/inc/chartlis.hxx sc/inc/chartlis.hxx
+index a8a97d3..51ac644 100644
+--- sc/inc/chartlis.hxx
++++ sc/inc/chartlis.hxx
+@@ -49,7 +49,7 @@ class ScChartUnoData;
+ #include <com/sun/star/chart/XChartData.hpp>
+ #include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
+ 
+-class ScChartListener : public StrData, public SvtListener
++class SC_DLLPUBLIC ScChartListener : public StrData, public SvtListener
+ {
+ public:
+     class ExternalRefListener : public ScExternalRefManager::LinkListener
+diff --git sc/inc/reftokenhelper.hxx sc/inc/reftokenhelper.hxx
+index 44619ab..1ea763e 100644
+--- sc/inc/reftokenhelper.hxx
++++ sc/inc/reftokenhelper.hxx
+@@ -70,12 +70,12 @@ public:
+ 
+     static void getTokensFromRangeList(::std::vector<ScSharedTokenRef>& pTokens, const ScRangeList& rRanges);
+ 
+-    static bool isRef(const ScSharedTokenRef& pToken);
+-    static bool isExternalRef(const ScSharedTokenRef& pToken);
++    static bool SC_DLLPUBLIC isRef(const ScSharedTokenRef& pToken);
++    static bool SC_DLLPUBLIC isExternalRef(const ScSharedTokenRef& pToken);
+ 
+-    static bool intersects(const ::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken);
++    static bool SC_DLLPUBLIC intersects(const ::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken);
+ 
+-    static void join(::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken);
++    static void SC_DLLPUBLIC join(::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken);
+ 
+     static bool getDoubleRefDataFromToken(ScComplexRefData& rData, const ScSharedTokenRef& pToken);
+ 
+diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
+index 7e5f291..9fe50df 100644
+--- sc/source/core/data/cell.cxx
++++ sc/source/core/data/cell.cxx
+@@ -1871,8 +1871,7 @@ void ScFormulaCell::SetDirtyVar()
+ 
+ void ScFormulaCell::SetDirtyAfterLoad()
+ {
+-    bDirty = TRUE;
+-    if ( !pDocument->GetHardRecalcState() )
++    if ( bDirty && !pDocument->GetHardRecalcState() )
+         pDocument->PutInFormulaTree( this );
+ }
+ 
+diff --git sc/source/filter/excel/xichart.cxx sc/source/filter/excel/xichart.cxx
+index 77d9eae..6d393e5 100644
+--- sc/source/filter/excel/xichart.cxx
++++ sc/source/filter/excel/xichart.cxx
+@@ -34,6 +34,7 @@
+ #include "xichart.hxx"
+ 
+ #include <algorithm>
++#include <memory>
+ 
+ #include <com/sun/star/frame/XModel.hpp>
+ #include <com/sun/star/drawing/Direction3D.hpp>
+@@ -76,6 +77,8 @@
+ #include "tokenarray.hxx"
+ #include "token.hxx"
+ #include "compiler.hxx"
++#include "reftokenhelper.hxx"
++#include "chartlis.hxx"
+ 
+ using ::rtl::OUString;
+ using ::rtl::OUStringBuffer;
+@@ -119,6 +122,8 @@ using ::com::sun::star::chart2::data::XDataSequence;
+ using ::formula::FormulaToken;
+ using ::formula::StackVar;
+ 
++using ::std::vector;
++
+ // Helpers ====================================================================
+ 
+ namespace {
+@@ -792,6 +797,22 @@ Sequence< Reference< XFormattedString > > XclImpChSourceLink::CreateStringSequen
+     return ScfApiHelper::VectorToSequence( aStringVec );
+ }
+ 
++void XclImpChSourceLink::FillSourceLink(vector<ScSharedTokenRef>& rTokens) const
++{
++    if (!mpTokenArray)
++        // no links to fill.
++        return;
++
++    mpTokenArray->Reset();
++    for (FormulaToken* p = mpTokenArray->First(); p; p = mpTokenArray->Next())
++    {
++        ScSharedTokenRef pToken(static_cast<ScToken*>(p->Clone()));
++        if (ScRefTokenHelper::isRef(pToken))
++            // This is a reference token.  Store it.
++            ScRefTokenHelper::join(rTokens, pToken);
++    }
++}
++
+ // Text =======================================================================
+ 
+ XclImpChFontBase::~XclImpChFontBase()
+@@ -1794,6 +1815,14 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
+     return xDataSeries;
+ }
+ 
++void XclImpChSeries::FillAllSourceLinks(vector<ScSharedTokenRef>& rTokens) const
++{
++    mxValueLink->FillSourceLink(rTokens);
++    mxCategLink->FillSourceLink(rTokens);
++    mxTitleLink->FillSourceLink(rTokens);
++    mxBubbleLink->FillSourceLink(rTokens);
++}
++
+ void XclImpChSeries::ReadChSourceLink( XclImpStream& rStrm )
+ {
+     XclImpChSourceLinkRef xSrcLink( new XclImpChSourceLink( GetChRoot() ) );
+@@ -3399,7 +3428,7 @@ XclImpChTextRef XclImpChChart::GetDefaultText( XclChTextType eTextType ) const
+     return maDefTexts.get( nDefTextId );
+ }
+ 
+-void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressBar& rProgress ) const
++void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressBar& rProgress, const OUString& rObjName ) const
+ {
+     // initialize conversion (locks the model to suppress any internal updates)
+     InitConversion( xChartDoc );
+@@ -3442,6 +3471,28 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressB
+ 
+     // unlock the model
+     FinishConversion( rProgress );
++
++    ScDocument* pDoc = &GetRoot().GetDoc();
++    ScChartListenerCollection* pChartCollection = pDoc->GetChartListenerCollection();
++    if (pChartCollection)
++    {
++        // Now, start listening to this chart.
++        ::std::auto_ptr< vector<ScSharedTokenRef> > pRefTokens(new vector<ScSharedTokenRef>);
++        for (XclImpChSeriesVec::const_iterator itr = maSeries.begin(), itrEnd = maSeries.end(); itr != itrEnd; ++itr)
++        {
++            const XclImpChSeriesRef& rSeries = *itr;
++            rSeries->FillAllSourceLinks(*pRefTokens);
++        }
++        if (!pRefTokens->empty())
++        {
++            ::std::auto_ptr<ScChartListener> pListener(
++                new ScChartListener(rObjName, pDoc, pRefTokens.release()));
++            pListener->SetDirty(true);
++            pListener->StartListeningTo();
++            pChartCollection->Insert(pListener.release());
++
++        }
++    }
+ }
+ 
+ void XclImpChChart::ReadChSeries( XclImpStream& rStrm )
+@@ -3651,11 +3702,11 @@ sal_Size XclImpChart::GetProgressSize() const
+     return mxChartData.is() ? mxChartData->GetProgressSize() : 0;
+ }
+ 
+-void XclImpChart::Convert( Reference< XModel > xModel, ScfProgressBar& rProgress ) const
++void XclImpChart::Convert( Reference< XModel > xModel, ScfProgressBar& rProgress, const OUString& rObjName ) const
+ {
+     Reference< XChartDocument > xChartDoc( xModel, UNO_QUERY );
+     if( mxChartData.is() && xChartDoc.is() )
+-        mxChartData->Convert( xChartDoc, rProgress );
++        mxChartData->Convert( xChartDoc, rProgress, rObjName );
+ }
+ 
+ void XclImpChart::ReadChChart( XclImpStream& rStrm )
+diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
+index a046521..5eb246e 100644
+--- sc/source/filter/excel/xiescher.cxx
++++ sc/source/filter/excel/xiescher.cxx
+@@ -1581,7 +1581,7 @@ SdrObject* XclImpChartObj::DoCreateSdrObj( const Rectangle& rAnchorRect, ScfProg
+         if( svt::EmbeddedObjectRef::TryRunningState( xEmbObj ) )
+         {
+             Reference< XModel > xModel( xEmbObj->getComponent(), UNO_QUERY );
+-            mxChart->Convert( xModel, rProgress );
++            mxChart->Convert( xModel, rProgress, aEmbObjName );
+ 
+             Reference< XEmbedPersist > xPers( xEmbObj, UNO_QUERY );
+             if( xPers.is() )
+diff --git sc/source/filter/inc/xichart.hxx sc/source/filter/inc/xichart.hxx
+index 05932de..32b8105 100644
+--- sc/source/filter/inc/xichart.hxx
++++ sc/source/filter/inc/xichart.hxx
+@@ -39,6 +39,7 @@
+ #include <svtools/itemset.hxx>
+ 
+ #include "rangelst.hxx"
++#include "token.hxx"
+ #include "xlchart.hxx"
+ #include "xlstyle.hxx"
+ #include "xistring.hxx"
+@@ -404,6 +405,8 @@ public:
+     XFormattedStringSeq CreateStringSequence( const XclImpChRoot& rRoot,
+                             sal_uInt16 nLeadFontIdx, const Color& rLeadFontColor ) const;
+ 
++    void                FillSourceLink(::std::vector<ScSharedTokenRef>& rTokens) const;
++
+ private:
+     XclChSourceLink     maData;             /// Contents of the CHSOURCELINK record.
+     XclImpStringRef     mxString;           /// Text data (CHSTRING record).
+@@ -807,6 +810,8 @@ public:
+     /** Creates a data series object with initialized source links. */
+     XDataSeriesRef      CreateDataSeries() const;
+ 
++    void                FillAllSourceLinks(::std::vector<ScSharedTokenRef>& rTokens) const;
++
+ private:
+     /** Reads a CHSOURCELINK record. */
+     void                ReadChSourceLink( XclImpStream& rStrm );
+@@ -1342,7 +1347,7 @@ public:
+     inline sal_Size     GetProgressSize() const { return 2 * EXC_CHART_PROGRESS_SIZE; }
+ 
+     /** Converts and writes all properties to the passed chart. */
+-    void                Convert( XChartDocRef xChartDoc, ScfProgressBar& rProgress ) const;
++    void                Convert( XChartDocRef xChartDoc, ScfProgressBar& rProgress, const ::rtl::OUString& rObjName ) const;
+ 
+ private:
+     /** Reads a CHSERIES group (data series source and formatting). */
+@@ -1407,7 +1412,7 @@ public:
+     inline bool         IsPivotChart() const { return mbIsPivotChart; }
+ 
+     /** Creates the chart object in the passed component. */
+-    void                Convert( XModelRef xModel, ScfProgressBar& rProgress ) const;
++    void                Convert( XModelRef xModel, ScfProgressBar& rProgress, const ::rtl::OUString& rObjName ) const;
+ 
+ private:
+     /** Reads the CHCHART group (entire chart data). */


More information about the ooo-build-commit mailing list