[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Jul 9 13:16:46 PDT 2009


 patches/dev300/apply                                 |    1 
 patches/dev300/calc-dp-hide-list-menu-crash-fix.diff |  131 +++++++++++++++++++
 2 files changed, 132 insertions(+)

New commits:
commit 9b0843021fe4f6269102ae9d7834594314d493b9
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Jul 9 16:12:31 2009 -0400

    Fixed a crash on importing certain xls documents.
    
    * patches/dev300/apply:
    * patches/dev300/calc-dp-hide-list-menu-crash-fix.diff: fixed
      mis-handling of data layout button position which caused a
      crash. (n#520556)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index fa9fde9..bae8666 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2042,6 +2042,7 @@ calc-remove-merge-flags-on-row-insert.diff, n#484599, i#101047, kohei
 # quick editing of field member visibilities via popup window.
 calc-dp-hide-list-menu.diff,        n#483379, i#100619, kohei
 calc-dp-hide-list-menu-bugfix.diff, n#483379, i#100619, kohei
+calc-dp-hide-list-menu-crash-fix.diff, n#520556, kohei
 
 [ CalcFixes < dev300-m52 ]
 # disable autofilter within datapilot output.
diff --git a/patches/dev300/calc-dp-hide-list-menu-crash-fix.diff b/patches/dev300/calc-dp-hide-list-menu-crash-fix.diff
new file mode 100644
index 0000000..804e128
--- /dev/null
+++ b/patches/dev300/calc-dp-hide-list-menu-crash-fix.diff
@@ -0,0 +1,131 @@
+diff --git sc/inc/dpoutputgeometry.hxx sc/inc/dpoutputgeometry.hxx
+index aae3271..4dd6b41 100644
+--- sc/inc/dpoutputgeometry.hxx
++++ sc/inc/dpoutputgeometry.hxx
+@@ -57,6 +57,8 @@ public:
+     void getRowFieldPositions(::std::vector<ScAddress>& rAddrs) const;
+     void getPageFieldPositions(::std::vector<ScAddress>& rAddrs) const;
+ 
++    SCROW getRowFieldHeaderRow() const;
++
+     FieldType getFieldButtonType(const ScAddress& rPos) const;
+ 
+ private:
+@@ -64,7 +66,7 @@ private:
+ 
+ private:
+     ScRange     maOutRange;
+-    sal_uInt32  mnRowFields;
++    sal_uInt32  mnRowFields;    /// number of row fields (data layout field NOT included!)
+     sal_uInt32  mnColumnFields;
+     sal_uInt32  mnPageFields;
+     sal_uInt32  mnDataFields;
+diff --git sc/source/core/data/dpoutputgeometry.cxx sc/source/core/data/dpoutputgeometry.cxx
+index d570dfc..0976569 100644
+--- sc/source/core/data/dpoutputgeometry.cxx
++++ sc/source/core/data/dpoutputgeometry.cxx
+@@ -117,23 +117,7 @@ void ScDPOutputGeometry::getRowFieldPositions(vector<ScAddress>& rAddrs) const
+         return;
+     }
+ 
+-    SCROW nCurRow = maOutRange.aStart.Row();
+-
+-    if (mnPageFields)
+-    {
+-        SCROW nRowStart = maOutRange.aStart.Row() + mbShowFilter;
+-        SCROW nRowEnd   = nRowStart + static_cast<SCCOL>(mnPageFields-1);
+-        nCurRow = nRowEnd + 2;
+-    }
+-    else if (mbShowFilter)
+-        nCurRow += 2;
+-
+-    if (mnColumnFields)
+-        nCurRow += static_cast<SCROW>(mnColumnFields);
+-    else
+-        ++nCurRow;
+-
+-    SCROW nRow = nCurRow;
++    SCROW nRow = getRowFieldHeaderRow();
+     SCTAB nTab = maOutRange.aStart.Tab();
+     SCCOL nColStart = maOutRange.aStart.Col();
+     SCCOL nColEnd = nColStart + static_cast<SCCOL>(mnRowFields-1);
+@@ -163,6 +147,27 @@ void ScDPOutputGeometry::getPageFieldPositions(vector<ScAddress>& rAddrs) const
+     rAddrs.swap(aAddrs);
+ }
+ 
++SCROW ScDPOutputGeometry::getRowFieldHeaderRow() const
++{
++    SCROW nCurRow = maOutRange.aStart.Row();
++
++    if (mnPageFields)
++    {
++        SCROW nRowStart = maOutRange.aStart.Row() + mbShowFilter;
++        SCROW nRowEnd   = nRowStart + static_cast<SCCOL>(mnPageFields-1);
++        nCurRow = nRowEnd + 2;
++    }
++    else if (mbShowFilter)
++        nCurRow += 2;
++
++    if (mnColumnFields)
++        nCurRow += static_cast<SCROW>(mnColumnFields);
++    else if (mnRowFields)
++        ++nCurRow;
++
++    return nCurRow;
++}
++
+ ScDPOutputGeometry::FieldType ScDPOutputGeometry::getFieldButtonType(const ScAddress& rPos) const
+ {
+     // We will ignore the table position for now.
+diff --git sc/source/filter/excel/xipivot.cxx sc/source/filter/excel/xipivot.cxx
+index a48a0b4..d950093 100644
+--- sc/source/filter/excel/xipivot.cxx
++++ sc/source/filter/excel/xipivot.cxx
+@@ -1485,21 +1485,35 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD
+ 
+     vector<ScAddress> aRowBtns;
+     aGeometry.getRowFieldPositions(aRowBtns);
+-    itr    = aRowBtns.begin();
+-    itrEnd = aRowBtns.end();
+-    for (; itr != itrEnd; ++itr)
++    if (aRowBtns.empty())
+     {
+-        sal_Int16 nMFlag = SC_MF_BUTTON | SC_MF_BUTTON_POPUP;
+-        String aName;
+-        rDoc.GetString(itr->Col(), itr->Row(), itr->Tab(), aName);
+-        if (rSaveData.HasInvisibleMember(aName))
+-            nMFlag |= SC_MF_HIDDEN_MEMBER;
+-        rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag);
++        if (bDataLayout)
++        {
++            // No row fields, but the data layout button exists.
++            SCROW nRow = aGeometry.getRowFieldHeaderRow();
++            SCCOL nCol = rOutRange.aStart.Col();
++            SCTAB nTab = rOutRange.aStart.Tab();
++            rDoc.ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, SC_MF_BUTTON);
++        }
+     }
+-    if (bDataLayout)
++    else
+     {
+-        --itr; // move back to the last row field position.
+-        rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), SC_MF_BUTTON);
++        itr    = aRowBtns.begin();
++        itrEnd = aRowBtns.end();
++        for (; itr != itrEnd; ++itr)
++        {
++            sal_Int16 nMFlag = SC_MF_BUTTON | SC_MF_BUTTON_POPUP;
++            String aName;
++            rDoc.GetString(itr->Col(), itr->Row(), itr->Tab(), aName);
++            if (rSaveData.HasInvisibleMember(aName))
++                nMFlag |= SC_MF_HIDDEN_MEMBER;
++            rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag);
++        }
++        if (bDataLayout)
++        {
++            --itr; // move back to the last row field position.
++            rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), SC_MF_BUTTON);
++        }
+     }
+ }
+ 


More information about the ooo-build-commit mailing list