[ooo-build-commit] .: 17 commits - sc/inc sc/sdi sc/source

Fridrich Strba fridrich at kemper.freedesktop.org
Wed Sep 15 05:28:54 PDT 2010


 sc/inc/attarray.hxx                         |   10 +
 sc/inc/cell.hxx                             |   51 ++++++++
 sc/inc/column.hxx                           |    6 -
 sc/inc/dbcolect.hxx                         |    1 
 sc/inc/document.hxx                         |    6 -
 sc/inc/rangeutl.hxx                         |    5 
 sc/inc/sc.hrc                               |    4 
 sc/inc/sortparam.hxx                        |    1 
 sc/inc/table.hxx                            |    6 -
 sc/sdi/pivotsh.sdi                          |    1 
 sc/sdi/scalc.sdi                            |   26 ++++
 sc/source/core/data/attarray.cxx            |   37 +++++-
 sc/source/core/data/cell2.cxx               |   94 +++++++++++++++
 sc/source/core/data/column.cxx              |    9 -
 sc/source/core/data/column2.cxx             |    4 
 sc/source/core/data/docpool.cxx             |    5 
 sc/source/core/data/document.cxx            |   11 +
 sc/source/core/data/drwlayer.cxx            |   42 ++++---
 sc/source/core/data/sortparam.cxx           |    6 -
 sc/source/core/data/table2.cxx              |    9 -
 sc/source/core/data/table3.cxx              |  166 ++++++++++++++++++++++++++--
 sc/source/core/data/table4.cxx              |    4 
 sc/source/core/tool/dbcolect.cxx            |    4 
 sc/source/core/tool/rangeutl.cxx            |   57 +++++++++
 sc/source/filter/excel/excform.cxx          |   17 +-
 sc/source/filter/excel/excform8.cxx         |   17 +-
 sc/source/filter/excel/frmbase.cxx          |   26 +++-
 sc/source/filter/excel/xiname.cxx           |    6 -
 sc/source/filter/inc/excform.hxx            |    4 
 sc/source/filter/inc/formel.hxx             |    6 -
 sc/source/filter/xml/XMLExportDataPilot.cxx |    3 
 sc/source/filter/xml/xmlannoi.cxx           |    1 
 sc/source/filter/xml/xmldpimp.cxx           |    9 +
 sc/source/filter/xml/xmldpimp.hxx           |    1 
 sc/source/filter/xml/xmlimprt.cxx           |    1 
 sc/source/filter/xml/xmlimprt.hxx           |    3 
 sc/source/ui/app/inputhdl.cxx               |   16 ++
 sc/source/ui/dbgui/tpsort.cxx               |   19 +--
 sc/source/ui/docshell/dbdocfun.cxx          |   30 +++++
 sc/source/ui/docshell/dbdocimp.cxx          |   14 +-
 sc/source/ui/docshell/docsh.cxx             |   46 +++----
 sc/source/ui/inc/dbfunc.hxx                 |    8 -
 sc/source/ui/inc/preview.hxx                |    2 
 sc/source/ui/inc/sortdlg.hrc                |    3 
 sc/source/ui/inc/tpsort.hxx                 |    7 -
 sc/source/ui/inc/undoblk.hxx                |    7 +
 sc/source/ui/inc/undocell.hxx               |   11 +
 sc/source/ui/inc/viewdata.hxx               |    4 
 sc/source/ui/miscdlgs/makefile.mk           |    2 
 sc/source/ui/src/popup.src                  |   78 +++++++++++++
 sc/source/ui/src/sortdlg.src                |   37 ++++--
 sc/source/ui/undo/undoblk3.cxx              |   26 ++++
 sc/source/ui/undo/undocell.cxx              |   24 +++-
 sc/source/ui/unoobj/chart2uno.cxx           |   11 -
 sc/source/ui/view/cellsh2.cxx               |    7 +
 sc/source/ui/view/colrowba.cxx              |    6 -
 sc/source/ui/view/dbfunc3.cxx               |   22 +++
 sc/source/ui/view/gridwin.cxx               |   19 +++
 sc/source/ui/view/pivotsh.cxx               |   44 +++++++
 sc/source/ui/view/preview.cxx               |   10 +
 sc/source/ui/view/tabvwsh4.cxx              |    5 
 sc/source/ui/view/viewdata.cxx              |   16 ++
 sc/source/ui/view/viewfunc.cxx              |   43 +++++--
 63 files changed, 1003 insertions(+), 173 deletions(-)

New commits:
commit 188130067b80960fd509078f2e23fc1636e694ab
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 12:32:47 2010 +0200

    chart-odf-always-calc-a1.diff: always store ranges in ODF using A1 syntax
    
    n#463305

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index b8af2f2..af8b7f1 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -35,6 +35,11 @@
 #include <com/sun/star/table/CellRangeAddress.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 
+// Chart always stores cell range addresses using CONV_OOO convention. But
+// if parsing with CONV_OOO fails, try parsing it using the current address
+// convention.
+#define CHART_ADDRESS_CONV_WORKAROUND 1
+
 //------------------------------------------------------------------------
 
 class SvStream;
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 97f55d4..82034d2 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -476,6 +476,11 @@ sal_Bool ScRangeStringConverter::GetAddressFromString(
     {
         if ((rAddress.Parse( sToken, const_cast<ScDocument*>(pDocument), eConv ) & SCA_VALID) == SCA_VALID)
             return true;
+#if CHART_ADDRESS_CONV_WORKAROUND
+        ::formula::FormulaGrammar::AddressConvention eConvUI = pDocument->GetAddressConvention();
+        if (eConv != eConvUI)
+            return ((rAddress.Parse(sToken, const_cast<ScDocument*>(pDocument), eConvUI) & SCA_VALID) == SCA_VALID);
+#endif
     }
     return sal_False;
 }
@@ -502,6 +507,11 @@ sal_Bool ScRangeStringConverter::GetRangeFromString(
             if ( aUIString.GetChar(0) == (sal_Unicode) '.' )
                 aUIString.Erase( 0, 1 );
             bResult = ((rRange.aStart.Parse( aUIString, const_cast<ScDocument*> (pDocument), eConv) & SCA_VALID) == SCA_VALID);
+#if CHART_ADDRESS_CONV_WORKAROUND
+            if (!bResult && eConv != eConv)
+                bResult = ((rRange.aStart.Parse(
+                    aUIString, const_cast<ScDocument*>(pDocument), eConv) & SCA_VALID) == SCA_VALID);
+#endif
             rRange.aEnd = rRange.aStart;
         }
         else
@@ -526,6 +536,15 @@ sal_Bool ScRangeStringConverter::GetRangeFromString(
                                 eConv) & SCA_VALID) == SCA_VALID) &&
                           ((rRange.aEnd.Parse( aUIString.Copy((xub_StrLen)nIndex+1), const_cast<ScDocument*>(pDocument),
                                 eConv) & SCA_VALID) == SCA_VALID);
+#if CHART_ADDRESS_CONV_WORKAROUND
+                if (!bResult && eConv != eConv)
+                {
+                    bResult = ((rRange.aStart.Parse( aUIString.Copy(0, (xub_StrLen)nIndex), const_cast<ScDocument*>(pDocument),
+                                    eConv) & SCA_VALID) == SCA_VALID) &&
+                              ((rRange.aEnd.Parse( aUIString.Copy((xub_StrLen)nIndex+1), const_cast<ScDocument*>(pDocument),
+                                    eConv) & SCA_VALID) == SCA_VALID);
+                }
+#endif
             }
         }
     }
@@ -860,6 +879,8 @@ static void lcl_appendCellRangeAddress(
 
 void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, const OUString& rXMLRange, ScDocument* pDoc )
 {
+    FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+    const OUString aRangeSep = GetScCompilerNativeSymbol(ocSep);
     const sal_Unicode cSep = ' ';
     const sal_Unicode cQuote = '\'';
 
@@ -912,13 +933,37 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
             rtl::OUString aBuf;
             USHORT nRet = aCell1.Parse(aBeginCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo1);
             if ((nRet & SCA_VALID) != SCA_VALID)
+            {
                 // first cell is invalid.
+#if CHART_ADDRESS_CONV_WORKAROUND
+                if (eConv == FormulaGrammar::CONV_OOO)
+                    continue;
+
+                nRet = aCell1.Parse(aBeginCell, pDoc, eConv, &aExtInfo1);
+                if ((nRet & SCA_VALID) != SCA_VALID)
+                    // first cell is really invalid.
+                    continue;
+#else
                 continue;
+#endif
+            }
 
             nRet = aCell2.Parse(aEndCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo2);
             if ((nRet & SCA_VALID) != SCA_VALID)
+            {
                 // second cell is invalid.
+#if CHART_ADDRESS_CONV_WORKAROUND
+                if (eConv == FormulaGrammar::CONV_OOO)
+                    continue;
+
+                nRet = aCell2.Parse(aEndCell, pDoc, eConv, &aExtInfo2);
+                if ((nRet & SCA_VALID) != SCA_VALID)
+                    // second cell is really invalid.
+                    continue;
+#else
                 continue;
+#endif
+            }
 
             if (aExtInfo1.mnFileId != aExtInfo2.mnFileId || aExtInfo1.mbExternal != aExtInfo2.mbExternal)
                 // external info inconsistency.
@@ -929,7 +974,7 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
             if (bFirst)
                 bFirst = false;
             else
-                aRetStr.appendAscii(";");
+                aRetStr.append(aRangeSep);
 
             lcl_appendCellRangeAddress(aRetStr, pDoc, aCell1, aCell2, aExtInfo1, aExtInfo2);
         }
@@ -940,14 +985,22 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
             ScAddress aCell;
             USHORT nRet = aCell.Parse(aToken, pDoc, ::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
             if ((nRet & SCA_VALID) != SCA_VALID)
+            {
+#if CHART_ADDRESS_CONV_WORKAROUND
+                nRet = aCell.Parse(aToken, pDoc, eConv, &aExtInfo);
+                if ((nRet & SCA_VALID) != SCA_VALID)
+                    continue;
+#else
                 continue;
+#endif
+            }
 
             // Looks good!
 
             if (bFirst)
                 bFirst = false;
             else
-                aRetStr.appendAscii(";");
+                aRetStr.append(aRangeSep);
 
             lcl_appendCellAddress(aRetStr, pDoc, aCell, aExtInfo);
         }
commit fb6af8f7fc95beac17e411d43e91696de6aa13d8
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 12:28:47 2010 +0200

    sc-overwrite-char-font-attrs.diff: overwrite character level font attributes
    
    n#374580, i#53545, i#96853
    
    Overwrite character level font attributes when changing them at cell level

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 2ce3729..cbf4d26 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -32,6 +32,7 @@
 #include "attrib.hxx"
 
 class ScDocument;
+class ScEditDataArray;
 class ScMarkArray;
 class ScPatternAttr;
 class ScStyleSheet;
@@ -102,6 +103,9 @@ friend void lcl_IterGetNumberFormat( ULONG& nFormat,
                             SCROW nStartRow, SCROW nEndRow,
                             BOOL bLeft, SCCOL nDistRight, BOOL bTop, SCROW nDistBottom );
 
+    void RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow,
+                              const ScPatternAttr* pPattern, ScEditDataArray* pDataArray );
+
 public:
             ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc );
             ~ScAttrArray();
@@ -124,9 +128,11 @@ public:
                             SCROW nStartRow, SCROW nEndRow, BOOL bLeft, SCCOL nDistRight );
 
     void	SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE );
-    void	SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE);
+    void	SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern,
+                            BOOL bPutToPool = FALSE, ScEditDataArray* pDataArray = NULL );
     void	ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle );
-    void	ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache );
+    void	ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache,
+                            ScEditDataArray* pDataArray = NULL );
     void	ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
                                 const SvxBorderLine* pLine, BOOL bColorOnly );
 
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index ac9e84b..c5f17a4 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -31,6 +31,9 @@
 #include <stddef.h>
 
 #include <set>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
 #include <tools/mempool.hxx>
 #include <svl/listener.hxx>
 #include "global.hxx"
@@ -56,6 +59,7 @@ class SvtBroadcaster;
 class ScCodeArray;
 class ScProgress;
 class ScPostIt;
+class ScPatternAttr;
 
 // ============================================================================
 
@@ -276,6 +280,53 @@ public:
     void			GetString( String& rString ) const;
 
     const EditTextObject* GetData() const	{ return pData; }
+
+    /** Removes character attribute based on new pattern attributes. */
+    void            RemoveCharAttribs( const ScPatternAttr& rAttr );
+};
+
+// ============================================================================
+
+class ScEditDataArray
+{
+public:
+    class Item
+    {
+    public:
+        explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow,
+                      EditTextObject* pOldData, EditTextObject* pNewData);
+        ~Item();
+
+        const EditTextObject* GetOldData() const;
+        const EditTextObject* GetNewData() const;
+        SCTAB GetTab() const;
+        SCCOL GetCol() const;
+        SCROW GetRow() const;
+
+    private:
+        Item(); // disabled
+
+    private:
+        ::boost::shared_ptr<EditTextObject> mpOldData;
+        ::boost::shared_ptr<EditTextObject> mpNewData;
+        SCTAB mnTab;
+        SCCOL mnCol;
+        SCROW mnRow;
+
+    };
+
+    ScEditDataArray();
+    ~ScEditDataArray();
+
+    void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow,
+                 EditTextObject* pOldData, EditTextObject* pNewData);
+
+    const Item* First();
+    const Item* Next();
+
+private:
+    ::std::vector<Item>::const_iterator maIter;
+    ::std::vector<Item> maArray;
 };
 
 // ============================================================================
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 5c149cc..c60fafc 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -53,6 +53,7 @@ class ScAttrIterator;
 class ScAttrArray;
 class ScBaseCell;
 class ScDocument;
+class ScEditDataArray;
 class ScFormulaCell;
 class ScMarkData;
 class ScPatternAttr;
@@ -311,7 +312,8 @@ public:
 
     void		ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
     void		ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
-    void		ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr );
+    void		ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
+                                  ScEditDataArray* pDataArray = NULL );
     void		SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
     void		SetPatternArea( SCROW nStartRow, SCROW nEndRow,
                                 const ScPatternAttr& rPatAttr, BOOL bPutToPool = FALSE );
@@ -343,7 +345,7 @@ public:
 
     void		RemoveProtected( SCROW nStartRow, SCROW nEndRow );
 
-    SCsROW		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
+    SCsROW		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
     void        DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
 
     void		ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 82ddefb..1e3df03 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1206,7 +1206,8 @@ public:
                                     const ScPatternAttr& rAttr );
     SC_DLLPUBLIC void			ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
                                         SCCOL nEndCol, SCROW nEndRow,
-                                        const ScMarkData& rMark, const ScPatternAttr& rAttr );
+                                        const ScMarkData& rMark, const ScPatternAttr& rAttr,
+                                        ScEditDataArray* pDataArray = NULL );
     SC_DLLPUBLIC void			ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
                                             SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
                                             const ScPatternAttr& rAttr );
@@ -1268,7 +1269,8 @@ public:
                             SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
                             const String& sValStr, double& nX);
 
-    void			ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark );
+    void			ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
+                                           ScEditDataArray* pDataArray = NULL );
     void            DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
     void			DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark );
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index a40dfaf..faca8cb 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -64,6 +64,7 @@ class ScAutoFormatData;
 class ScBaseCell;
 class ScDocument;
 class ScDrawLayer;
+class ScEditDataArray;
 class ScFormulaCell;
 class ScOutlineTable;
 class ScPostIt;
@@ -536,7 +537,8 @@ public:
 
     void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
     void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
-    void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
+    void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
+                                  const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
     void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
                     {
                         if (ValidColRow(rPos.Col(),rPos.Row()))
@@ -567,7 +569,7 @@ public:
     BOOL		ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
     BOOL		RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
 
-    void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
+    void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
     void        DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
 
     void		ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 79eb1be..d5001ad 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -38,6 +38,7 @@
 #include <editeng/bolnitem.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <editeng/shaditem.hxx>
+#include <editeng/editobj.hxx>
 #include <svl/poolcach.hxx>
 #include <editeng/fontitem.hxx>
 #include <unotools/fontcvt.hxx>
@@ -53,6 +54,7 @@
 #include "rechead.hxx"
 #include "globstr.hrc"
 #include "segmenttree.hxx"
+#include "cell.hxx"
 
 #undef DBG_INVALIDATE
 #define DBGOUTPUT(s) \
@@ -299,8 +301,31 @@ void ScAttrArray::SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bP
     SetPatternArea( nRow, nRow, pPattern, bPutToPool );
 }
 
+void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow,
+                                       const ScPatternAttr* pPattern, ScEditDataArray* pDataArray )
+{
+    for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
+    {
+        ScBaseCell* pCell;
+        pDocument->GetCell(nCol, nRow, nTab, pCell);
+        if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
+        {
+            EditTextObject* pOldData = NULL;
+            ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
+            if (pDataArray)
+                pOldData = pEditCell->GetData()->Clone();
+            pEditCell->RemoveCharAttribs(*pPattern);
+            if (pDataArray)
+            {
+                EditTextObject* pNewData = pEditCell->GetData()->Clone();
+                pDataArray->AddItem(nTab, nCol, nRow, pOldData, pNewData);
+            }
+        }
+    }
+}
 
-void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, BOOL bPutToPool )
+void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern,
+                                 BOOL bPutToPool, ScEditDataArray* pDataArray )
 {
     if (ValidRow(nStartRow) && ValidRow(nEndRow))
     {
@@ -470,6 +495,12 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern
                     pData[nInsert-1].nRow = nStartRow - 1;
                 pData[nInsert].nRow = nEndRow;
                 pData[nInsert].pPattern = pPattern;
+
+                // Remove character attributes from these cells if the pattern
+                // is applied during normal session.
+                if (pDataArray)
+                    RemoveCellCharAttribs(nStartRow, nEndRow, pPattern, pDataArray);
+
                 nCount++;
             }
 
@@ -711,7 +742,7 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
 #undef SET_LINE
 
 
-void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache )
+void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, ScEditDataArray* pDataArray )
 {
 #ifdef DBG_UTIL
     TestData();
@@ -746,7 +777,7 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
                 {
                     if (nY1 < nStartRow) nY1=nStartRow;
                     if (nY2 > nEndRow) nY2=nEndRow;
-                    SetPatternArea( nY1, nY2, pNewPattern );
+                    SetPatternArea( nY1, nY2, pNewPattern, false, pDataArray );
                     Search( nStart, nPos );
                 }
                 else
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index c056c39..f2a1429 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -51,6 +51,8 @@
 #include "editutil.hxx"
 #include "chgtrack.hxx"
 #include "externalrefmgr.hxx"
+#include "scitems.hxx"
+#include "patattr.hxx"
 
 using namespace formula;
 
@@ -139,6 +141,28 @@ void ScEditCell::GetString( String& rString ) const
         rString.Erase();
 }
 
+void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr )
+{
+    const struct {
+        USHORT nAttrType;
+        USHORT nCharType;
+    } AttrTypeMap[] = {
+        { ATTR_FONT,        EE_CHAR_FONTINFO },
+        { ATTR_FONT_HEIGHT, EE_CHAR_FONTHEIGHT },
+        { ATTR_FONT_WEIGHT, EE_CHAR_WEIGHT },
+        { ATTR_FONT_COLOR,  EE_CHAR_COLOR }
+    };
+    USHORT nMapCount = sizeof(AttrTypeMap) / sizeof(AttrTypeMap[0]);
+
+    const SfxItemSet& rSet = rAttr.GetItemSet();
+    const SfxPoolItem* pItem;
+    for (USHORT i = 0; i < nMapCount; ++i)
+    {
+        if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SFX_ITEM_SET )
+            pData->RemoveCharAttribs(AttrTypeMap[i].nCharType);
+    }
+}
+
 void ScEditCell::SetTextObject( const EditTextObject* pObject,
             const SfxItemPool* pFromPool )
 {
@@ -174,6 +198,76 @@ void ScEditCell::SetTextObject( const EditTextObject* pObject,
         pData = NULL;
 }
 
+ScEditDataArray::ScEditDataArray()
+{
+}
+
+ScEditDataArray::~ScEditDataArray()
+{
+}
+
+void ScEditDataArray::AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow,
+                              EditTextObject* pOldData, EditTextObject* pNewData)
+{
+    maArray.push_back(Item(nTab, nCol, nRow, pOldData, pNewData));
+}
+
+const ScEditDataArray::Item* ScEditDataArray::First()
+{
+    maIter = maArray.begin();
+    if (maIter == maArray.end())
+        return NULL;
+    return &(*maIter++);
+}
+
+const ScEditDataArray::Item* ScEditDataArray::Next()
+{
+    if (maIter == maArray.end())
+        return NULL;
+    return &(*maIter++);
+}
+
+// ============================================================================
+
+ScEditDataArray::Item::Item(SCTAB nTab, SCCOL nCol, SCROW nRow,
+                            EditTextObject* pOldData, EditTextObject* pNewData) :
+    mnTab(nTab),
+    mnCol(nCol),
+    mnRow(nRow)
+{
+    mpOldData.reset(pOldData);
+    mpNewData.reset(pNewData);
+}
+
+ScEditDataArray::Item::~Item()
+{
+}
+
+const EditTextObject* ScEditDataArray::Item::GetOldData() const
+{
+    return mpOldData.get();
+}
+
+const EditTextObject* ScEditDataArray::Item::GetNewData() const
+{
+    return mpNewData.get();
+}
+
+SCTAB ScEditDataArray::Item::GetTab() const
+{
+    return mnTab;
+}
+
+SCCOL ScEditDataArray::Item::GetCol() const
+{
+    return mnCol;
+}
+
+SCROW ScEditDataArray::Item::GetRow() const
+{
+    return mnRow;
+}
+
 // ============================================================================
 
 namespace
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 98f7b4c..d6392d5 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -361,7 +361,7 @@ ULONG ScColumn::GetNumberFormat( SCROW nRow ) const
 }
 
 
-SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark )
+SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray )
 {
     SCROW nTop = 0;
     SCROW nBottom = 0;
@@ -372,7 +372,7 @@ SCsROW ScColumn::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData
         ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol );
         while (aMarkIter.Next( nTop, nBottom ))
         {
-            pAttrArray->ApplyCacheArea( nTop, nBottom, pCache );
+            pAttrArray->ApplyCacheArea( nTop, nBottom, pCache, pDataArray );
             bFound = TRUE;
         }
     }
@@ -446,11 +446,12 @@ void ScColumn::ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr )
 }
 
 
-void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr )
+void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
+                                 ScEditDataArray* pDataArray )
 {
     const SfxItemSet* pSet = &rPatAttr.GetItemSet();
     SfxItemPoolCache aCache( pDocument->GetPool(), pSet );
-    pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache );
+    pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray );
 }
 
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index b7ecc94..abf7668 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3865,12 +3865,13 @@ void ScDocument::ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatte
 void ScDocument::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
                         SCCOL nEndCol, SCROW nEndRow,
                         const ScMarkData& rMark,
-                        const ScPatternAttr& rAttr )
+                        const ScPatternAttr& rAttr,
+                        ScEditDataArray* pDataArray )
 {
     for (SCTAB i=0; i <= MAXTAB; i++)
         if (pTab[i])
             if (rMark.GetTableSelect(i))
-                pTab[i]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr );
+                pTab[i]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr, pDataArray );
 }
 
 
@@ -4805,7 +4806,7 @@ void ScDocument::ApplyFrameAreaTab( const ScRange& rRange,
 }
 
 
-void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark )
+void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark, ScEditDataArray* pDataArray )
 {
     const SfxItemSet* pSet = &rAttr.GetItemSet();
     BOOL bSet = FALSE;
@@ -4822,7 +4823,7 @@ void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMark
             ScRange aRange;
             rMark.GetMarkArea( aRange );
             ApplyPatternArea( aRange.aStart.Col(), aRange.aStart.Row(),
-                              aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr );
+                              aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr, pDataArray );
         }
         else
         {
@@ -4830,7 +4831,7 @@ void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMark
             for (SCTAB nTab=0; nTab<=MAXTAB; nTab++)
                 if (pTab[nTab])
                     if (rMark.GetTableSelect(nTab))
-                        pTab[nTab]->ApplySelectionCache( &aCache, rMark );
+                        pTab[nTab]->ApplySelectionCache( &aCache, rMark, pDataArray );
         }
     }
 }
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index aeb2a19..152fbe2 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1871,14 +1871,14 @@ void ScTable::ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr )
 
 
 void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
-                                     const ScPatternAttr& rAttr )
+                                     const ScPatternAttr& rAttr, ScEditDataArray* pDataArray )
 {
     if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
     {
         PutInOrder(nStartCol, nEndCol);
         PutInOrder(nStartRow, nEndRow);
         for (SCCOL i = nStartCol; i <= nEndCol; i++)
-            aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr);
+            aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr, pDataArray);
     }
 }
 
@@ -2074,10 +2074,11 @@ void ScTable::ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr )
 }
 
 
-void ScTable::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark )
+void ScTable::ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark,
+                                   ScEditDataArray* pDataArray )
 {
     for (SCCOL i=0; i<=MAXCOL; i++)
-        aCol[i].ApplySelectionCache( pCache, rMark );
+        aCol[i].ApplySelectionCache( pCache, rMark, pDataArray );
 }
 
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7554e18..6247f17 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -394,6 +394,27 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
     aDocument.DisableIdle( FALSE );
 }
 
+namespace {
+
+class LoadMediumGuard
+{
+public:
+    explicit LoadMediumGuard(ScDocument* pDoc) :
+        mpDoc(pDoc)
+    {
+        mpDoc->SetLoadingMedium(true);
+    }
+
+    ~LoadMediumGuard()
+    {
+        mpDoc->SetLoadingMedium(false);
+    }
+private:
+    ScDocument* mpDoc;
+};
+
+}
+
 BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "sb99857", "ScDocShell::LoadXML" );
@@ -450,7 +471,7 @@ BOOL ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::uno::R
 BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" );
-
+    LoadMediumGuard aLoadGuard(&aDocument);
     ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
 
     //	only the latin script language is loaded
@@ -933,7 +954,7 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
 BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::LoadFrom" );
-
+    LoadMediumGuard aLoadGuard(&aDocument);
     ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
 
     WaitObject aWait( GetActiveDialogParent() );
@@ -985,27 +1006,6 @@ static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLa
     rDateConvert = static_cast<bool>(aTokens[1].toInt32());
 }
 
-namespace {
-
-class LoadMediumGuard
-{
-public:
-    explicit LoadMediumGuard(ScDocument* pDoc) :
-        mpDoc(pDoc)
-    {
-        mpDoc->SetLoadingMedium(true);
-    }
-
-    ~LoadMediumGuard()
-    {
-        mpDoc->SetLoadingMedium(false);
-    }
-private:
-    ScDocument* mpDoc;
-};
-
-}
-
 BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertFrom" );
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 350a416..f1aab93 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -32,6 +32,10 @@
 #include "viewutil.hxx"
 #include "spellparam.hxx"
 
+#include "cell.hxx"
+
+#include <boost/shared_ptr.hpp>
+
 class ScDocShell;
 class ScBaseCell;
 class ScDocument;
@@ -351,9 +355,11 @@ public:
 
     virtual String	GetComment() const;
 
+    ScEditDataArray*    GetDataArray();
 private:
     ScMarkData		aMarkData;
     ScRange			aRange;
+    ScEditDataArray aDataArray;
     ScDocument*		pUndoDoc;
     BOOL			bMulti;
     ScPatternAttr*	pApplyPattern;
@@ -361,6 +367,7 @@ private:
     SvxBoxInfoItem*	pLineInner;
 
     void			DoChange( const BOOL bUndo );
+    void            ChangeEditData( const bool bUndo );
 };
 
 
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx
index 8bded7d..5b95faf 100644
--- a/sc/source/ui/inc/undocell.hxx
+++ b/sc/source/ui/inc/undocell.hxx
@@ -31,6 +31,8 @@
 #include "undobase.hxx"
 #include "postit.hxx"
 
+#include <boost/shared_ptr.hpp>
+
 class ScDocShell;
 class ScBaseCell;
 class ScPatternAttr;
@@ -59,6 +61,11 @@ public:
 
     virtual String	GetComment() const;
 
+    /** once the objects are passed to this class, their life-cycle is
+        managed by this class; the calling function must pass new'ed
+        objects to this method. */
+    void            SetEditData( EditTextObject* pOld, EditTextObject* pNew );
+
 private:
     SCCOL			nCol;
     SCROW			nRow;
@@ -66,9 +73,11 @@ private:
     ScPatternAttr*	pOldPattern;
     ScPatternAttr*	pNewPattern;
     ScPatternAttr*	pApplyPattern;
+    ::boost::shared_ptr<EditTextObject> pOldEditData;
+    ::boost::shared_ptr<EditTextObject> pNewEditData;
     BOOL			bIsAutomatic;
 
-    void			DoChange( const ScPatternAttr* pWhichPattern ) const;
+    void			DoChange( const ScPatternAttr* pWhichPattern, const ::boost::shared_ptr<EditTextObject>& pEditData ) const;
 };
 
 
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 0a63251..7fe686b 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -479,6 +479,12 @@ String __EXPORT ScUndoSelectionAttr::GetComment() const
     return ScGlobal::GetRscString( pLineOuter ? STR_UNDO_SELATTRLINES : STR_UNDO_SELATTR );
 }
 
+//----------------------------------------------------------------------------
+
+ScEditDataArray* ScUndoSelectionAttr::GetDataArray()
+{
+    return &aDataArray;
+}
 
 //----------------------------------------------------------------------------
 
@@ -497,6 +503,8 @@ void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
     USHORT nExtFlags = 0;
     pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
 
+    ChangeEditData(bUndo);
+
     if (bUndo)	// nur bei Undo
     {
         ScRange aCopyRange = aRange;
@@ -521,6 +529,24 @@ void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
     ShowTable( aRange );
 }
 
+void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
+{
+    ScDocument* pDoc = pDocShell->GetDocument();
+    for (const ScEditDataArray::Item* pItem = aDataArray.First(); pItem; pItem = aDataArray.Next())
+    {
+        ScBaseCell* pCell;
+        pDoc->GetCell(pItem->GetCol(), pItem->GetRow(), pItem->GetTab(), pCell);
+        if (!pCell || pCell->GetCellType() != CELLTYPE_EDIT)
+            continue;
+
+        ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
+        if (bUndo)
+            pEditCell->SetData(pItem->GetOldData(), NULL);
+        else
+            pEditCell->SetData(pItem->GetNewData(), NULL);
+    }
+}
+
 
 //----------------------------------------------------------------------------
 
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 453bd15..dd0c15a 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -54,6 +54,8 @@
 #include "sc.hrc"
 #include "docuno.hxx"
 
+using ::boost::shared_ptr;
+
 // STATIC DATA -----------------------------------------------------------
 
 TYPEINIT1(ScUndoCursorAttr, ScSimpleUndo);
@@ -82,6 +84,8 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell,
     nCol( nNewCol ),
     nRow( nNewRow ),
     nTab( nNewTab ),
+    pOldEditData( static_cast<EditTextObject*>(NULL) ),
+    pNewEditData( static_cast<EditTextObject*>(NULL) ),
     bIsAutomatic( bAutomatic )
 {
     ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
@@ -106,9 +110,21 @@ String __EXPORT ScUndoCursorAttr::GetComment() const
     return ScGlobal::GetRscString( nId );
 }
 
-void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern ) const
+void ScUndoCursorAttr::SetEditData( EditTextObject* pOld, EditTextObject* pNew )
+{
+    pOldEditData.reset(pOld);
+    pNewEditData.reset(pNew);
+}
+
+void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const shared_ptr<EditTextObject>& pEditData ) const
 {
-    pDocShell->GetDocument()->SetPattern( nCol, nRow, nTab, *pWhichPattern, TRUE );
+    ScDocument* pDoc = pDocShell->GetDocument();
+    pDoc->SetPattern( nCol, nRow, nTab, *pWhichPattern, TRUE );
+
+    ScBaseCell* pCell;
+    pDoc->GetCell(nCol, nRow, nTab, pCell);
+    if (pCell && pCell->GetCellType() == CELLTYPE_EDIT && pEditData.get())
+        static_cast<ScEditCell*>(pCell)->SetData(pEditData.get(), NULL);
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -134,7 +150,7 @@ void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern ) const
 void __EXPORT ScUndoCursorAttr::Undo()
 {
     BeginUndo();
-    DoChange(pOldPattern);
+    DoChange(pOldPattern, pOldEditData);
 
     if ( bIsAutomatic )
     {
@@ -152,7 +168,7 @@ void __EXPORT ScUndoCursorAttr::Undo()
 void __EXPORT ScUndoCursorAttr::Redo()
 {
     BeginRedo();
-    DoChange(pNewPattern);
+    DoChange(pNewPattern, pNewEditData);
     EndRedo();
 }
 
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index ba17f84..7e936cd 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1313,6 +1313,8 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
         SCROW nEndRow = aMarkRange.aEnd.Row();
         SCTAB nEndTab = aMarkRange.aEnd.Tab();
 
+        ScUndoSelectionAttr* pUndoAttr = NULL;
+        ScEditDataArray* pEditDataArray = NULL;
         if (bRecord)
         {
             ScRange aCopyRange = aMarkRange;
@@ -1328,15 +1330,14 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
 
             aFuncMark.MarkToMulti();
 
-            pDocSh->GetUndoManager()->AddUndoAction(
-                new ScUndoSelectionAttr(
-                            pDocSh, aFuncMark,
-                            nStartCol, nStartRow, nStartTab,
-                            nEndCol, nEndRow, nEndTab,
-                            pUndoDoc, bMulti, &rAttr ) );
+            pUndoAttr = new ScUndoSelectionAttr(
+                pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
+                nEndCol, nEndRow, nEndTab, pUndoDoc, bMulti, &rAttr );
+            pDocSh->GetUndoManager()->AddUndoAction(pUndoAttr);
+            pEditDataArray = pUndoAttr->GetDataArray();
         }
 
-        pDoc->ApplySelectionPattern( rAttr, aFuncMark );
+        pDoc->ApplySelectionPattern( rAttr, aFuncMark, pEditDataArray );
 
         pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
                            nEndCol,   nEndRow,   nEndTab,
@@ -1350,6 +1351,19 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
         SCCOL nCol = pViewData->GetCurX();
         SCROW nRow = pViewData->GetCurY();
         SCTAB nTab = pViewData->GetTabNo();
+
+        ScBaseCell* pCell;
+        pDoc->GetCell(nCol, nRow, nTab, pCell);
+        EditTextObject* pOldEditData = NULL;
+        EditTextObject* pNewEditData = NULL;
+        if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
+        {
+            ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
+            pOldEditData = pEditCell->GetData()->Clone();
+            pEditCell->RemoveCharAttribs(rAttr);
+            pNewEditData = pEditCell->GetData()->Clone();
+        }
+
         aChangeRanges.Append( ScRange( nCol, nRow, nTab ) );
         ScPatternAttr* pOldPat = new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ));
 
@@ -1359,11 +1373,10 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
 
         if (bRecord)
         {
-            pDocSh->GetUndoManager()->AddUndoAction(
-                        new ScUndoCursorAttr( pDocSh,
-                                              nCol, nRow, nTab,
-                                              pOldPat, pNewPat, &rAttr,
-                                              FALSE ) );	// FALSE = nicht automatisch
+            ScUndoCursorAttr* pUndo = new ScUndoCursorAttr(
+                pDocSh, nCol, nRow, nTab, pOldPat, pNewPat, &rAttr, false );
+            pUndo->SetEditData(pOldEditData, pNewEditData);
+            pDocSh->GetUndoManager()->AddUndoAction(pUndo);
         }
         delete pOldPat;		// wird im Undo kopiert (Pool)
 
commit f12df5f7f25315018247d6dd2fa80ab0be562d28
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 12:24:31 2010 +0200

    sc-excel-chart-default-xlabels.diff: Change x-y plot chart numbering scheme
    
    n#257079, i#83679
    
    Change default numbering scheme of x-y plot chart from Row 1, Row2, ... to
    1, 2, 3... when the X labels are not explicitly given.  This is what Excel
    does.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index cd7984d..bdd26e8 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3690,14 +3690,9 @@ uno::Sequence< rtl::OUString > SAL_CALL ScChart2EmptyDataSequence::getTextualDat
         }
         else
         {
-            for (sal_Int32 nRow = p->aStart.Row(); nRow <= p->aEnd.Row(); ++nRow)
-            {
-                String aString = ScGlobal::GetRscString(STR_ROW);
-                aString += ' ';
-                aString += String::CreateFromInt32( nRow+1 );
-                pArr[nCount] = aString;
-                ++nCount;
-            }
+            sal_Int32 n = p->aEnd.Row() - p->aStart.Row() + 1;
+            for (sal_Int32 i = 0; i < n; ++i)
+                pArr[nCount++] = String::CreateFromInt32( i+1 );
         }
     }
     return aSeq;
commit 3a53dde9e481dcd36f1c937bf3074c908554ce62
Author: Jonathan Pryor <jpryor at novell.com>
Date:   Wed Sep 15 12:21:49 2010 +0200

    sc-drwlayer-units.diff: Unit conversion fixes in ScDrawLayer
    
    i#83735

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
old mode 100644
new mode 100755
index 2718824..6c154f6
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -82,6 +82,10 @@
 #include "attrib.hxx"
 #include "charthelper.hxx"
 
+#ifndef _SV_FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
 #define DET_ARROW_OFFSET	1000
 
 //	Abstand zur naechsten Zelle beim Loeschen (bShrink), damit der Anker
@@ -170,16 +174,26 @@ __EXPORT ScTabSizeChangedHint::~ScTabSizeChangedHint()
 
 #define MAXMM	10000000
 
+inline long TwipsToHmm (long nVal)
+{
+    return static_cast< long >( MetricField::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
+            FUNIT_TWIP, FUNIT_100TH_MM) );
+}
+
+inline long HmmToTwips (long nVal)
+{
+    return static_cast< long > ( MetricField::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
+            FUNIT_100TH_MM, FUNIT_TWIP) );
+}
+
 inline void TwipsToMM( long& nVal )
 {
-    nVal = (long) ( nVal * HMM_PER_TWIPS );
+    nVal = TwipsToHmm (nVal);
 }
 
 inline void ReverseTwipsToMM( long& nVal )
 {
-    //	reverse the effect of TwipsToMM - round up here (add 1)
-
-    nVal = ((long) ( nVal / HMM_PER_TWIPS )) + 1;
+    nVal = HmmToTwips (nVal);
 }
 
 void lcl_TwipsToMM( Point& rPoint )
@@ -571,8 +585,8 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool b
 
         //	Berechnung und Werte wie in detfunc.cxx
 
-        Size aSize( (long)(pDoc->GetColWidth( nCol1, nTab1 ) * HMM_PER_TWIPS),
-                    (long)(pDoc->GetRowHeight( nRow1, nTab1 ) * HMM_PER_TWIPS) );
+        Size aSize( (long)( TwipsToHmm( pDoc->GetColWidth( nCol1, nTab1) ) ),
+                    (long)( TwipsToHmm( pDoc->GetRowHeight( nRow1, nTab1) ) ) );
         Rectangle aRect( aPos, aSize );
         aRect.Left()	-= 250;
         aRect.Right()	+= 250;
@@ -732,16 +746,16 @@ BOOL ScDrawLayer::GetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) co
         SCCOL nEndCol = rRange.aEnd.Col();
         for (i=nStartCol; i<=nEndCol; i++)
             nEndX += pDoc->GetColWidth(i,nTab);
-        nStartX = (long)(nStartX * HMM_PER_TWIPS);
-        nEndX   = (long)(nEndX   * HMM_PER_TWIPS);
+        nStartX = TwipsToHmm( nStartX );
+        nEndX   = TwipsToHmm( nEndX );
     }
     if (!bSetVer)
     {
         nStartY = pDoc->GetRowHeight( 0, rRange.aStart.Row()-1, nTab);
         nEndY = nStartY + pDoc->GetRowHeight( rRange.aStart.Row(),
                 rRange.aEnd.Row(), nTab);
-        nStartY = (long)(nStartY * HMM_PER_TWIPS);
-        nEndY   = (long)(nEndY   * HMM_PER_TWIPS);
+        nStartY = TwipsToHmm( nStartY );
+        nEndY   = TwipsToHmm( nEndY );
     }
 
     if ( bNegativePage )
@@ -799,8 +813,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) co
 
         if (bSetHor)
         {
-            nStartX = (long) (nStartX / HMM_PER_TWIPS);
-            nEndX = (long) (nEndX / HMM_PER_TWIPS);
+            nStartX = HmmToTwips( nStartX );
+            nEndX = HmmToTwips( nEndX );
             long nWidth;
             SCCOL i;
 
@@ -817,8 +831,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) co
 
         if (bSetVer)
         {
-            nStartY = (long) (nStartY / HMM_PER_TWIPS);
-            nEndY = (long) (nEndY / HMM_PER_TWIPS);
+            nStartY = HmmToTwips( nStartY );
+            nEndY = HmmToTwips( nEndY );
             SCROW nRow = pDoc->GetRowForHeight( nTab, nStartY);
             rRange.aStart.SetRow( nRow>0 ? (nRow-1) : 0);
             nRow = pDoc->GetRowForHeight( nTab, nEndY);
commit 791b263acad96f3b40aed5912620ae733bf1d0d7
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 12:18:21 2010 +0200

    calc-multiline-pattern-fix.diff: Fix bolding in multi-line cell contents
    
    n#359690, n#437137, i#99291
    
    For multi-line cell contents, bolding the first line shouldn't bold the
    entire cell.

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 685ea39..496ba61 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2504,13 +2504,27 @@ void ScInputHandler::EnterHandler( BYTE nBlockMode )
         USHORT nParCnt = pEngine->GetParagraphCount();
         if ( nParCnt == 0 )
             nParCnt = 1;
+
+        bool bUniformAttribs = true;
+        SfxItemSet aPara1Attribs = pEngine->GetAttribs(0, 0, pEngine->GetTextLen(0));
+        for (USHORT nPara = 1; nPara < nParCnt; ++nPara)
+        {
+            SfxItemSet aPara2Attribs = pEngine->GetAttribs(nPara, 0, pEngine->GetTextLen(nPara));
+            if (!(aPara1Attribs == aPara2Attribs))
+            {
+                // paragraph format different from that of the 1st paragraph.
+                bUniformAttribs = false;
+                break;
+            }
+        }
+
         ESelection aSel( 0, 0, nParCnt-1, pEngine->GetTextLen(nParCnt-1) );
         SfxItemSet aOldAttribs = pEngine->GetAttribs( aSel );
         const SfxPoolItem* pItem = NULL;
 
         //	find common (cell) attributes before RemoveAdjust
 
-        if ( pActiveViewSh )
+        if ( pActiveViewSh && bUniformAttribs )
         {
             SfxItemSet* pCommonAttrs = NULL;
             for (USHORT nId = EE_CHAR_START; nId <= EE_CHAR_END; nId++)
commit 2f40ebf58d72e536c6506646a314706849fd8f8e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 12:14:58 2010 +0200

    sc-natural-sort.diff: Add a 'Natural' variant of sorting
    
    i#26565

diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx
index 840977b..8be1868 100644
--- a/sc/inc/dbcolect.hxx
+++ b/sc/inc/dbcolect.hxx
@@ -60,6 +60,7 @@ private:
     BOOL			bStripData;
     // SortParam
     BOOL			bSortCaseSens;
+    BOOL			bSortNaturalSort;
     BOOL			bIncludePattern;
     BOOL			bSortInplace;
     BOOL			bSortUserDef;
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 3efb26a..8b0856d 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1124,6 +1124,7 @@
 #define SID_SORT_CASESENS		(SC_PARAM_START+2)
 #define SID_SORT_ATTRIBS		(SC_PARAM_START+3)
 #define SID_SORT_USERDEF		(SC_PARAM_START+4)
+#define SID_SORT_NATURALSORT	(SC_PARAM_START+5)
 
 // Resourcen -------------------------------------------------------------
 
diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx
index 5d7a098..fb72f01 100644
--- a/sc/inc/sortparam.hxx
+++ b/sc/inc/sortparam.hxx
@@ -49,6 +49,7 @@ struct SC_DLLPUBLIC ScSortParam
     BOOL		bHasHeader;
     BOOL		bByRow;
     BOOL		bCaseSens;
+    BOOL		bNaturalSort;
     BOOL		bUserDef;
     USHORT		nUserIndex;
     BOOL		bIncludePattern;
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index c52e028..fcd1a77 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -1574,7 +1574,7 @@ SfxVoidItem DataSelect SID_DATA_SELECT
 
 //--------------------------------------------------------------------------
 SfxVoidItem DataSort SID_SORT
-(SfxBoolItem ByRows SID_SORT_BYROW,SfxBoolItem HasHeader SID_SORT_HASHEADER,SfxBoolItem CaseSensitive SID_SORT_CASESENS,SfxBoolItem IncludeAttribs SID_SORT_ATTRIBS,SfxUInt16Item UserDefIndex SID_SORT_USERDEF,SfxInt32Item Col1 FN_PARAM_1,SfxBoolItem Ascending1 FN_PARAM_2,SfxInt32Item Col2 FN_PARAM_3,SfxBoolItem Ascending2 FN_PARAM_4,SfxInt32Item Col3 FN_PARAM_5,SfxBoolItem Ascending3 FN_PARAM_6)
+(SfxBoolItem ByRows SID_SORT_BYROW,SfxBoolItem HasHeader SID_SORT_HASHEADER,SfxBoolItem CaseSensitive SID_SORT_CASESENS,SfxBoolItem NaturalSort SID_SORT_NATURALSORT,SfxBoolItem IncludeAttribs SID_SORT_ATTRIBS,SfxUInt16Item UserDefIndex SID_SORT_USERDEF,SfxInt32Item Col1 FN_PARAM_1,SfxBoolItem Ascending1 FN_PARAM_2,SfxInt32Item Col2 FN_PARAM_3,SfxBoolItem Ascending2 FN_PARAM_4,SfxInt32Item Col3 FN_PARAM_5,SfxBoolItem Ascending3 FN_PARAM_6)
 [
     /* flags: */
     AutoUpdate = FALSE,
diff --git a/sc/source/core/data/sortparam.cxx b/sc/source/core/data/sortparam.cxx
index dd3a9cd..a7960ad 100644
--- a/sc/source/core/data/sortparam.cxx
+++ b/sc/source/core/data/sortparam.cxx
@@ -48,7 +48,7 @@ ScSortParam::ScSortParam()
 
 ScSortParam::ScSortParam( const ScSortParam& r ) :
         nCol1(r.nCol1),nRow1(r.nRow1),nCol2(r.nCol2),nRow2(r.nRow2),
-        bHasHeader(r.bHasHeader),bByRow(r.bByRow),bCaseSens(r.bCaseSens),
+        bHasHeader(r.bHasHeader),bByRow(r.bByRow),bCaseSens(r.bCaseSens),bNaturalSort(r.bNaturalSort),
         bUserDef(r.bUserDef),nUserIndex(r.nUserIndex),bIncludePattern(r.bIncludePattern),
         bInplace(r.bInplace),
         nDestTab(r.nDestTab),nDestCol(r.nDestCol),nDestRow(r.nDestRow),
@@ -71,7 +71,7 @@ void ScSortParam::Clear()
     nCompatHeader = 2;
     nDestTab = 0;
     nUserIndex = 0;
-    bHasHeader=bCaseSens=bUserDef = FALSE;
+    bHasHeader=bCaseSens=bUserDef=bNaturalSort = FALSE;
     bByRow=bIncludePattern=bInplace	= TRUE;
     aCollatorLocale = ::com::sun::star::lang::Locale();
     aCollatorAlgorithm.Erase();
@@ -94,6 +94,7 @@ ScSortParam& ScSortParam::operator=( const ScSortParam& r )
     nRow2			= r.nRow2;
     bHasHeader		= r.bHasHeader;
     bCaseSens		= r.bCaseSens;
+    bNaturalSort	= r.bNaturalSort;
     bByRow			= r.bByRow;
     bUserDef		= r.bUserDef;
     nUserIndex		= r.nUserIndex;
@@ -135,6 +136,7 @@ BOOL ScSortParam::operator==( const ScSortParam& rOther ) const
         && (bHasHeader		== rOther.bHasHeader)
         && (bByRow			== rOther.bByRow)
         && (bCaseSens		== rOther.bCaseSens)
+        && (bNaturalSort	== rOther.bNaturalSort)
         && (bUserDef		== rOther.bUserDef)
         && (nUserIndex		== rOther.nUserIndex)
         && (bIncludePattern == rOther.bIncludePattern)
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d3f025b..4537cda 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -62,6 +62,143 @@
 
 #include <vector>
 
+using namespace ::com::sun::star;
+
+namespace naturalsort {
+
+using namespace ::com::sun::star::i18n;
+
+/** Splits a given string into three parts: the prefix, number string, and
+    the suffix.
+
+    @param sWhole
+    Original string to be split into pieces
+
+    @param sPrefix
+    Prefix string that consists of the part before the first number token
+
+    @param sSuffix
+    String after the last number token.  This may still contain number strings.
+
+    @param fNum
+    Number converted from the middle number string
+
+    @return Returns TRUE if a numeral element is found in a given string, or
+    FALSE if no numeral element is found.
+*/
+bool SplitString( const rtl::OUString &sWhole,
+    rtl::OUString &sPrefix, rtl::OUString &sSuffix, double &fNum )
+{
+    i18n::LocaleDataItem aLocaleItem = ScGlobal::pLocaleData->getLocaleItem();
+
+    // Get prefix element
+    rtl::OUString sEmpty, sUser = rtl::OUString::createFromAscii( "-" );
+    ParseResult aPRPre = ScGlobal::pCharClass->parsePredefinedToken(
+        KParseType::IDENTNAME, sWhole, 0,
+        KParseTokens::ANY_LETTER, sUser, KParseTokens::ANY_LETTER, sUser );
+    sPrefix = sWhole.copy( 0, aPRPre.EndPos );
+
+    // Return FALSE if no numeral element is found
+    if ( aPRPre.EndPos == sWhole.getLength() )
+        return false;
+
+    // Get numeral element
+    sUser = aLocaleItem.decimalSeparator;
+    ParseResult aPRNum = ScGlobal::pCharClass->parsePredefinedToken(
+        KParseType::ANY_NUMBER, sWhole, aPRPre.EndPos,
+        KParseTokens::ANY_NUMBER, sEmpty, KParseTokens::ANY_NUMBER, sUser );
+
+    if ( aPRNum.EndPos == aPRPre.EndPos )
+        return false;
+
+    fNum = aPRNum.Value;
+    sSuffix = sWhole.copy( aPRNum.EndPos );
+
+    return true;
+}
+
+/** Naturally compares two given strings.
+
+    This is the main function that should be called externally.  It returns
+    either 1, 0, or -1 depending on the comparison result of given two strings.
+
+    @param sInput1
+    Input string 1
+
+    @param sInput2
+    Input string 2
+
+    @param bCaseSens
+    Boolean value for case sensitivity
+
+    @param pData
+    Pointer to user defined sort list
+
+    @param pCW
+    Pointer to collator wrapper for normal string comparison
+
+    @return Returnes 1 if sInput1 is greater, 0 if sInput1 == sInput2, and -1 if
+    sInput2 is greater.
+*/
+short Compare( const String &sInput1, const String &sInput2,
+               const BOOL bCaseSens, const ScUserListData* pData, const CollatorWrapper *pCW )
+{
+    rtl::OUString sStr1( sInput1 ), sStr2( sInput2 ), sPre1, sSuf1, sPre2, sSuf2;
+
+    do
+    {
+        double nNum1, nNum2;
+        BOOL bNumFound1 = SplitString( sStr1, sPre1, sSuf1, nNum1 );
+        BOOL bNumFound2 = SplitString( sStr2, sPre2, sSuf2, nNum2 );
+
+        short nPreRes; // Prefix comparison result
+        if ( pData )
+        {
+            if ( bCaseSens )
+            {
+                if ( !bNumFound1 || !bNumFound2 )
+                    return static_cast<short>(pData->Compare( sStr1, sStr2 ));
+                else
+                    nPreRes = pData->Compare( sPre1, sPre2 );
+            }
+            else
+            {
+                if ( !bNumFound1 || !bNumFound2 )
+                    return static_cast<short>(pData->ICompare( sStr1, sStr2 ));
+                else
+                    nPreRes = pData->ICompare( sPre1, sPre2 );
+            }
+        }
+        else
+        {
+            if ( !bNumFound1 || !bNumFound2 )
+                return static_cast<short>(pCW->compareString( sStr1, sStr2 ));
+            else
+                nPreRes = static_cast<short>(pCW->compareString( sPre1, sPre2 ));
+        }
+
+        // Prefix strings differ.  Return immediately.
+        if ( nPreRes != 0 ) return nPreRes;
+
+        if ( nNum1 != nNum2 )
+        {
+            if ( nNum1 < nNum2 ) return -1;
+            return static_cast<short>( nNum1 > nNum2 );
+        }
+
+        // The prefix and the first numerical elements are equal, but the suffix
+        // strings may still differ.  Stay in the loop.
+
+        sStr1 = sSuf1;
+        sStr2 = sSuf2;
+
+    } while (true);
+
+    return 0;
+}
+
+}
+
 // STATIC DATA -----------------------------------------------------------
 
 const USHORT nMaxSorts = 3;		// maximale Anzahl Sortierkriterien in aSortParam
@@ -280,25 +417,40 @@ short ScTable::CompareCell( USHORT nSort,
                     ((ScStringCell*)pCell2)->GetString(aStr2);
                 else
                     GetString(nCell2Col, nCell2Row, aStr2);
-                BOOL bUserDef = aSortParam.bUserDef;
+
+                BOOL bUserDef     = aSortParam.bUserDef;		// custom sort order
+                BOOL bNaturalSort = aSortParam.bNaturalSort;	// natural sort
+                BOOL bCaseSens    = aSortParam.bCaseSens;		// case sensitivity
+
                 if (bUserDef)
                 {
                     ScUserListData* pData =
-                        (ScUserListData*)(ScGlobal::GetUserList()->At(
-                        aSortParam.nUserIndex));
+                        static_cast<ScUserListData*>( (ScGlobal::GetUserList()->At(
+                        aSortParam.nUserIndex)) );
+
                     if (pData)
                     {
-                        if ( aSortParam.bCaseSens )
-                            nRes = sal::static_int_cast<short>( pData->Compare(aStr1, aStr2) );
+                        if ( bNaturalSort )
+                            nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, pData, pSortCollator );
                         else
-                            nRes = sal::static_int_cast<short>( pData->ICompare(aStr1, aStr2) );
+                        {
+                            if ( bCaseSens )
+                                nRes = sal::static_int_cast<short>( pData->Compare(aStr1, aStr2) );
+                            else
+                                nRes = sal::static_int_cast<short>( pData->ICompare(aStr1, aStr2) );
+                        }
                     }
                     else
                         bUserDef = FALSE;
 
                 }
                 if (!bUserDef)
-                    nRes = (short) pSortCollator->compareString( aStr1, aStr2 );
+                {
+                    if ( bNaturalSort )
+                        nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, NULL, pSortCollator );
+                    else
+                        nRes = static_cast<short>( pSortCollator->compareString( aStr1, aStr2 ) );
+                }
             }
             else if ( bStr1 )				// String <-> Zahl
                 nRes = 1;					// Zahl vorne
diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx
index 0f1d26f..92fef62 100644
--- a/sc/source/core/tool/dbcolect.cxx
+++ b/sc/source/core/tool/dbcolect.cxx
@@ -102,6 +102,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
     bKeepFmt			(rData.bKeepFmt),
     bStripData			(rData.bStripData),
     bSortCaseSens   	(rData.bSortCaseSens),
+    bSortNaturalSort	(rData.bSortNaturalSort),
     bIncludePattern 	(rData.bIncludePattern),
     bSortInplace		(rData.bSortInplace),
     bSortUserDef		(rData.bSortUserDef),
@@ -196,6 +197,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
     bKeepFmt			= rData.bKeepFmt;
     bStripData			= rData.bStripData;
     bSortCaseSens   	= rData.bSortCaseSens;
+    bSortNaturalSort	= rData.bSortNaturalSort;
     bIncludePattern 	= rData.bIncludePattern;
     bSortInplace		= rData.bSortInplace;
     nSortDestTab		= rData.nSortDestTab;
@@ -448,6 +450,7 @@ void ScDBData::GetSortParam( ScSortParam& rSortParam ) const
     rSortParam.bByRow = bByRow;
     rSortParam.bHasHeader = bHasHeader;
     rSortParam.bCaseSens = bSortCaseSens;
+    rSortParam.bNaturalSort = bSortNaturalSort;
     rSortParam.bInplace = bSortInplace;
     rSortParam.nDestTab = nSortDestTab;
     rSortParam.nDestCol = nSortDestCol;
@@ -468,6 +471,7 @@ void ScDBData::GetSortParam( ScSortParam& rSortParam ) const
 void ScDBData::SetSortParam( const ScSortParam& rSortParam )
 {
     bSortCaseSens = rSortParam.bCaseSens;
+    bSortNaturalSort = rSortParam.bNaturalSort;
     bIncludePattern = rSortParam.bIncludePattern;
     bSortInplace = rSortParam.bInplace;
     nSortDestTab = rSortParam.nDestTab;
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 0a222c5..216cb74 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -564,6 +564,7 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* 			pParent,
         aBtnHeader		( this, ScResId( BTN_LABEL ) ),
         aBtnFormats 	( this, ScResId( BTN_FORMATS ) ),
         aBtnCopyResult	( this, ScResId( BTN_COPYRESULT ) ),
+        aBtnNaturalSort	( this, ScResId( BTN_NATURALSORT ) ),
         aLbOutPos		( this, ScResId( LB_OUTAREA ) ),
         aEdOutPos		( this, ScResId( ED_OUTAREA ) ),
         aBtnSortUser	( this, ScResId( BTN_SORT_USER ) ),
@@ -575,7 +576,7 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* 			pParent,
         aLineDirection	( this, ScResId( FL_DIRECTION ) ),
         aBtnTopDown 	( this, ScResId( BTN_TOP_DOWN ) ),
         aBtnLeftRight	( this, ScResId( BTN_LEFT_RIGHT ) ),
-        aFtAreaLabel	( this, ScResId( FT_AREA_LABEL ) ),
+// 		aFtAreaLabel	( this, ScResId( FT_AREA_LABEL ) ),
 //		aFtArea 		( this, ScResId( FT_AREA ) ),
         //
 #if ENABLE_LAYOUT_EXPERIMENTAL
@@ -619,8 +620,8 @@ __EXPORT ScTabPageSortOptions::~ScTabPageSortOptions()
 
 void ScTabPageSortOptions::Init()
 {
-    aStrAreaLabel = aFtAreaLabel.GetText();
-    aStrAreaLabel.Append( (sal_Unicode) ' ' );
+// 	aStrAreaLabel = aFtAreaLabel.GetText();
+// 	aStrAreaLabel.Append( (sal_Unicode) ' ' );
 
     //	CollatorRessource has user-visible names for sort algorithms
     pColRes = new CollatorRessource();
@@ -699,8 +700,8 @@ void ScTabPageSortOptions::Init()
         theArea += ')';
 
         //aFtArea.SetText( theArea );
-        theArea.Insert( aStrAreaLabel, 0 );
-        aFtAreaLabel.SetText( theArea );
+        //theArea.Insert( aStrAreaLabel, 0 );
+        //aFtAreaLabel.SetText( theArea );
 
         aBtnHeader.SetText( aStrColLabel );
     }
@@ -749,9 +750,10 @@ void __EXPORT ScTabPageSortOptions::Reset( const SfxItemSet& /* rArgSet */ )
         aLbSortUser.SelectEntryPos( 0 );
     }
 
-    aBtnCase.Check		( rSortData.bCaseSens );
-    aBtnFormats.Check	( rSortData.bIncludePattern );
-    aBtnHeader.Check	( rSortData.bHasHeader );
+    aBtnCase.Check			( rSortData.bCaseSens );
+    aBtnFormats.Check		( rSortData.bIncludePattern );
+    aBtnHeader.Check		( rSortData.bHasHeader );
+    aBtnNaturalSort.Check	( rSortData.bNaturalSort );
 
     if ( rSortData.bByRow )
     {
@@ -817,6 +819,7 @@ BOOL __EXPORT ScTabPageSortOptions::FillItemSet( SfxItemSet& rArgSet )
     theSortData.bByRow			= aBtnTopDown.IsChecked();
     theSortData.bHasHeader		= aBtnHeader.IsChecked();
     theSortData.bCaseSens		= aBtnCase.IsChecked();
+    theSortData.bNaturalSort	= aBtnNaturalSort.IsChecked();
     theSortData.bIncludePattern = aBtnFormats.IsChecked();
     theSortData.bInplace		= !aBtnCopyResult.IsChecked();
     theSortData.nDestCol		= theOutPos.Col();
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index 40f5d04..2e55f44 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -63,7 +63,7 @@
 #define LB_SORT_USER		2
 #define LB_OUTAREA			3
 #define ED_OUTAREA          4
-#define FT_AREA_LABEL       5
+//#define FT_AREA_LABEL       5
 //#define FT_AREA             6
 #define BTN_SORT_USER       7
 #define BTN_CASESENSITIVE   8
@@ -78,6 +78,7 @@
 #define LB_LANGUAGE         17
 #define FT_ALGORITHM        18
 #define LB_ALGORITHM        19
+#define	BTN_NATURALSORT		20
 
 //#define RID_SCDLG_SORT_WARNING
 #define FT_TEXT             1
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index f197ca6..007c28f 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -50,7 +50,7 @@ class ScSortDlg;
 struct ScSortParam;
 
 //========================================================================
-// Kriterien
+// Kriterien (Sort Criteria)
 
 class ScTabPageSortFields : public SfxTabPage
 {
@@ -122,7 +122,7 @@ private:
 };
 
 //========================================================================
-// Sortieroptionen:
+// Sortieroptionen (Sort Options)
 
 class ScDocument;
 class ScRangeData;
@@ -164,6 +164,7 @@ private:
     CheckBox            aBtnCase;
     CheckBox            aBtnHeader;
     CheckBox            aBtnFormats;
+    CheckBox			aBtnNaturalSort;
 
     CheckBox            aBtnCopyResult;
     ListBox             aLbOutPos;
@@ -181,7 +182,7 @@ private:
     RadioButton         aBtnTopDown;
     RadioButton         aBtnLeftRight;
 
-    FixedText           aFtAreaLabel;
+//     FixedText           aFtAreaLabel;
 //  FixedInfo           aFtArea;
     LocalizedString aStrRowLabel;
     LocalizedString aStrColLabel;
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index ec03bb2..4090bba 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -151,17 +151,28 @@ TabPage RID_SCPAGE_SORT_OPTIONS
         Text [ en-US ] = "Include ~formats" ;
         TabStop = TRUE ;
     };
-    CheckBox BTN_COPYRESULT
+    CheckBox BTN_NATURALSORT
     {
         Pos = MAP_APPFONT ( 12 , 48 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
+        Text [ de ] = "Enable ~natural sort" ;
+        Text [ en-US ] = "Enable ~natural sort" ;
+        Text [ cs ] = "Aktivovat přirozené třídění" ;
+       Text [ sk ] = "Aktivovať prirodzené triedenie" ;
+        TabStop = TRUE ;
+        Text [ x-comment ] = " " ;
+    };
+    CheckBox BTN_COPYRESULT
+    {
+        Pos = MAP_APPFONT ( 12 , 62 ) ;
+        Size = MAP_APPFONT ( 242 , 10 ) ;
         Text [ en-US ] = "~Copy sort results to:" ;
         TabStop = TRUE ;
     };
     ListBox LB_OUTAREA
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 20 , 59 ) ;
+        Pos = MAP_APPFONT ( 20 , 73 ) ;
         Size = MAP_APPFONT ( 93 , 90 ) ;
         TabStop = TRUE ;
         DropDown = TRUE ;
@@ -170,13 +181,13 @@ TabPage RID_SCPAGE_SORT_OPTIONS
     {
         Disable = TRUE ;
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 119 , 59 ) ;
+        Pos = MAP_APPFONT ( 119 , 73 ) ;
         Size = MAP_APPFONT ( 132 , 12 ) ;
         TabStop = TRUE ;
     };
     CheckBox BTN_SORT_USER
     {
-        Pos = MAP_APPFONT ( 12 , 75 ) ;
+        Pos = MAP_APPFONT ( 12 , 89 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
         Text [ en-US ] = "Custom sort ~order" ;
         TabStop = TRUE ;
@@ -185,21 +196,21 @@ TabPage RID_SCPAGE_SORT_OPTIONS
     {
         Disable = TRUE ;
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 20 , 86 ) ;
+        Pos = MAP_APPFONT ( 20 , 100 ) ;
         Size = MAP_APPFONT ( 231 , 90 ) ;
         TabStop = TRUE ;
         DropDown = TRUE ;
     };
     FixedText FT_LANGUAGE
     {
-        Pos = MAP_APPFONT ( 12 , 104 ) ;
+        Pos = MAP_APPFONT ( 12 , 118 ) ;
         Size = MAP_APPFONT ( 101 , 8 ) ;
         Text [ en-US ] = "~Language";
     };
     ListBox LB_LANGUAGE
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 , 115 ) ;
+        Pos = MAP_APPFONT ( 12 , 129 ) ;
         Size = MAP_APPFONT ( 101 , 90 ) ;
         TabStop = TRUE ;
         DropDown = TRUE ;
@@ -207,44 +218,46 @@ TabPage RID_SCPAGE_SORT_OPTIONS
     };
     FixedText FT_ALGORITHM
     {
-        Pos = MAP_APPFONT ( 119 , 104 ) ;
+        Pos = MAP_APPFONT ( 119 , 118 ) ;
         Size = MAP_APPFONT ( 132 , 8 ) ;
         Text [ en-US ] = "O~ptions";
     };
     ListBox LB_ALGORITHM
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 119 , 115 ) ;
+        Pos = MAP_APPFONT ( 119 , 129 ) ;
         Size = MAP_APPFONT ( 132 , 90 ) ;
         TabStop = TRUE ;
         DropDown = TRUE ;
     };
     FixedLine FL_DIRECTION
     {
-        Pos = MAP_APPFONT ( 6 , 133 ) ;
+        Pos = MAP_APPFONT ( 6 , 147 ) ;
         Size = MAP_APPFONT ( 248 , 8 ) ;
         Text [ en-US ] = "Direction" ;
     };
     RadioButton BTN_TOP_DOWN
     {
-        Pos = MAP_APPFONT ( 12 , 144 ) ;
+        Pos = MAP_APPFONT ( 12 , 158 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
         Text [ en-US ] = "~Top to bottom (sort rows)" ;
         TabStop = TRUE ;
     };
     RadioButton BTN_LEFT_RIGHT
     {
-        Pos = MAP_APPFONT ( 12 , 158 ) ;
+        Pos = MAP_APPFONT ( 12 , 172 ) ;
         Size = MAP_APPFONT ( 242 , 10 ) ;
         Text [ en-US ] = "L~eft to right (sort columns)" ;
         TabStop = TRUE ;
     };
+/*
     FixedText FT_AREA_LABEL
     {
         Pos = MAP_APPFONT ( 6 , 171 ) ;
         Size = MAP_APPFONT ( 248 , 8 ) ;
         Text [ en-US ] = "Data area:" ;
     };
+*/
 };
 TabDialog RID_SCDLG_SORT
 {
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 62af646..3908596 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -438,6 +438,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                     aSortParam.bHasHeader		= bHasHeader;
                     aSortParam.bByRow			= TRUE;
                     aSortParam.bCaseSens		= FALSE;
+                    aSortParam.bNaturalSort		= FALSE;
                     aSortParam.bIncludePattern	= TRUE;
                     aSortParam.bInplace 		= TRUE;
                     aSortParam.bDoSort[0]		= TRUE;
@@ -489,6 +490,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                             aSortParam.bHasHeader = ((const SfxBoolItem*)pItem)->GetValue();
                         if ( pArgs->GetItemState( SID_SORT_CASESENS, TRUE, &pItem ) == SFX_ITEM_SET )
                             aSortParam.bCaseSens = ((const SfxBoolItem*)pItem)->GetValue();
+                    if ( pArgs->GetItemState( SID_SORT_NATURALSORT, TRUE, &pItem ) == SFX_ITEM_SET )
+                        aSortParam.bNaturalSort = ((const SfxBoolItem*)pItem)->GetValue();
                         if ( pArgs->GetItemState( SID_SORT_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
                             aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
                         if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
@@ -552,7 +555,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
 
                         pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(),  &aArgSet, RID_SCDLG_SORT );
                         DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
-                        pDlg->SetCurPageId(1);
+                    pDlg->SetCurPageId(1);	// 1=sort field tab  2=sort options tab
 
                         if ( pDlg->Execute() == RET_OK )
                         {
@@ -571,6 +574,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                                     rOutParam.bHasHeader ) );
                                 rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
                                     rOutParam.bCaseSens ) );
+                            rReq.AppendItem( SfxBoolItem( SID_SORT_NATURALSORT,
+                                                rOutParam.bNaturalSort ) );
                                 rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
                                     rOutParam.bIncludePattern ) );
                                 USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
commit 5f30f6f057e9fe6bf4ae1e719fcf67827189c483
Author: Jonathan Pryor <jpryor at novell.com>
Date:   Wed Sep 15 12:07:16 2010 +0200

    calc-filter-xml-free-context.diff: Don't use pShapeContext after deleting it
    
    n#467536

diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx
index 80c4edb..b13e148 100644
--- a/sc/source/filter/xml/xmlannoi.cxx
+++ b/sc/source/filter/xml/xmlannoi.cxx
@@ -192,6 +192,7 @@ void ScXMLAnnotationContext::EndElement()
     {
         pShapeContext->EndElement();
         delete pShapeContext;
+        pShapeContext = NULL;
     }
 
     mrAnnotationData.maAuthor = maAuthorBuffer.makeStringAndClear();
commit 4bfb2e399db2a6c88a3fda7a2d0a11c6ab002b76
Author: Jonathan Pryor <jpryor at novell.com>
Date:   Wed Sep 15 12:05:15 2010 +0200

    sc-print-lines.diff: print & page preview for files containing only lines
    
    n#351468, i#85076

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index f585e56..2d06f5e 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1321,6 +1321,10 @@ BOOL ScColumn::IsEmpty() const
 
 BOOL ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes) const
 {
+    Rectangle aRect;
+    if (pAttrArray->HasLines(nStartRow, nEndRow, aRect, TRUE, TRUE))
+        return FALSE;
+
     if ( nCount == 0 || !pItems )
         return TRUE;
 
commit dcfa8ebe1ca2822c18fc73165f59ebf28d4faa46
Author: Jonathan Pryor <jpryor at novell.com>
Date:   Wed Sep 15 12:01:56 2010 +0200

    sc-print-selected-sheets.diff: Make Print Preview consistent with Print output
    
    n#335684, i#45497

diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx
index 51370b6..6a446de 100644
--- a/sc/source/ui/inc/preview.hxx
+++ b/sc/source/ui/inc/preview.hxx
@@ -63,6 +63,8 @@ private:
     ScPreviewLocationData* pLocationData;	// stores table layout for accessibility API
     FmFormView*		pDrawView;
 
+    SCTAB           nCurTab;
+
                                         // intern:
     BOOL			bInPaint;
     BOOL			bInGetState;
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index f96aa09..7e01874 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -109,6 +109,7 @@ ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pView
     bLocationValid( FALSE ),
     pLocationData( NULL ),
     pDrawView( NULL ),
+    nCurTab ( ScDocShell::GetCurTab() ),
     bInPaint( FALSE ),
     bInGetState( FALSE ),
     pDocShell( pDocSh ),
@@ -249,8 +250,17 @@ void ScPreview::CalcPages( SCTAB /*nToWhichTab*/ )
     //	but always all sheets are used (there is no selected sheet)
     ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
 
+    ScMarkData aMarkData;
+    aMarkData.SelectTable( nCurTab, TRUE );
+
     for (SCTAB i=nStart; i<nAnz; i++)
     {
+        if (!aOptions.GetAllSheets() && !aMarkData.GetTableSelect( i )) {
+            nPages[i] = 0;
+            nFirstAttr[i] = 0;
+            continue;
+        }
+
         long nAttrPage = i > 0 ? nFirstAttr[i-1] : 1;
 
         long nThisStart = nTotalPages;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index cd52b98..095a6f3 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1189,8 +1189,13 @@ PrintDialog* __EXPORT ScTabViewShell::CreatePrintDialog( Window *pParent )
     // instead of a separate progress for each sheet from ScPrintFunc
     pDocShell->UpdatePendingRowHeights( MAXTAB, true );
 
+    ScMarkData aMarkData;
+    aMarkData.SelectTable( GetViewData()->GetTabNo(), TRUE );
+
     for ( SCTAB i=0; i<nTabCount; i++ )
     {
+        if ( !bAllTabs && !aMarkData.GetTableSelect( i ) )
+            continue;
         ScPrintFunc aPrintFunc( pDocShell, pPrinter, i );
         nDocPageMax += aPrintFunc.GetTotalPages();
     }
commit ffea8f5a08299fadbd56eca474b8821a2eaf0ad6
Author: Jonathan Pryor <jpryor at novell.com>
Date:   Wed Sep 15 11:57:32 2010 +0200

    sc-extra-cell-margins.diff: Add extra padding the the cell height
    
    n#361358

diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index b9078a5..a879fcc 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -274,7 +274,10 @@ ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool, BOOL bLoadRefCounts )
     ppPoolDefaults[ ATTR_SHRINKTOFIT     - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_SHRINKTOFIT );
     ppPoolDefaults[ ATTR_BORDER_TLBR     - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_TLBR );
     ppPoolDefaults[ ATTR_BORDER_BLTR     - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_BLTR );
-    ppPoolDefaults[ ATTR_MARGIN          - ATTR_STARTINDEX ] = new SvxMarginItem( ATTR_MARGIN );
+    SvxMarginItem* pItem = new SvxMarginItem( ATTR_MARGIN );
+    pItem->SetTopMargin( 27 );
+    pItem->SetBottomMargin( 27 );
+    ppPoolDefaults[ ATTR_MARGIN          - ATTR_STARTINDEX ] = pItem;
     ppPoolDefaults[	ATTR_MERGE			 - ATTR_STARTINDEX ] = new ScMergeAttr;
     ppPoolDefaults[	ATTR_MERGE_FLAG		 - ATTR_STARTINDEX ] = new ScMergeFlagAttr;
     ppPoolDefaults[	ATTR_VALUE_FORMAT	 - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALUE_FORMAT, 0 );
commit 0093d35f1927140c985430b186f2636e131633ee
Author: Jonathan Pryor <jpryor at novell.com>
Date:   Wed Sep 15 11:49:27 2010 +0200

    sc-xls-builtin-name-scope.diff: Print_Area/_Titles only for sheet local names
    
    n#191005, n#257422

diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index cf22c81..51c3d4b 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -898,7 +898,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
 
 
 // stream seeks to first byte after <nFormulaLen>
-ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, const FORMULA_TYPE eFT )
+ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen,
+                            SCsTAB nTab, const FORMULA_TYPE eFT )
 {
     RootData&       rR = GetOldRoot();
     BYTE			nOp, nLen;
@@ -1066,7 +1067,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
 
                 ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName );
 
-                rRangeList.Append( aSRD );
+                rRangeList.Append( aSRD, nTab );
                 break;
             case 0x45:
             case 0x65:
@@ -1093,7 +1094,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append( aCRD );
+                rRangeList.Append( aCRD, nTab );
             }
                 break;
             case 0x46:
@@ -1130,7 +1131,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
 
                 ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF );
 
-                rRangeList.Append( aSRD );
+                rRangeList.Append( aSRD, nTab );
             }
                 break;
             case 0x4D:
@@ -1156,7 +1157,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append( aCRD );
+                rRangeList.Append( aCRD, nTab );
             }
                 break;
             case 0x49:
@@ -1226,10 +1227,10 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                         b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() );
                         aCRD.Ref2.SetFlag3D( b3D );
                         aCRD.Ref2.SetTabRel( FALSE );
-                        rRangeList.Append( aCRD );
+                        rRangeList.Append( aCRD, nTab );
                     }
                     else
-                        rRangeList.Append( aSRD );
+                        rRangeList.Append( aSRD, nTab );
                 }
             }
 
@@ -1284,7 +1285,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                     else if( IsComplRowRange( nRowFirst, nRowLast ) )
                         SetComplRow( aCRD );
 
-                    rRangeList.Append( aCRD );
+                    rRangeList.Append( aCRD, nTab );
                 }//ENDE in aktuellem Workbook
             }
                 break;
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index c50151c..ab5dc89 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -871,7 +871,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
 
 
 // stream seeks to first byte after <nFormulaLen>
-ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, const FORMULA_TYPE eFT )
+ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen,
+                              SCsTAB nTab, const FORMULA_TYPE eFT )
 {
     BYTE					nOp, nLen;//, nByte;
     BOOL					bError = FALSE;
@@ -1002,7 +1003,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
 
                 ExcRelToScRel8( nRow, nCol, aSRD, bRangeName );
 
-                rRangeList.Append( aSRD );
+                rRangeList.Append( aSRD, nTab );
             }
                 break;
             case 0x45:
@@ -1030,7 +1031,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append( aCRD );
+                rRangeList.Append( aCRD, nTab );
             }
                 break;
             case 0x46:
@@ -1074,7 +1075,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
 
                 ExcRelToScRel8( nRow, nCol, aSRD, bRNorSF );
 
-                rRangeList.Append( aSRD );
+                rRangeList.Append( aSRD, nTab );
             }
                 break;
             case 0x4D:
@@ -1100,7 +1101,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append( aCRD );
+                rRangeList.Append( aCRD, nTab );
             }
                 break;
             case 0x4E:
@@ -1142,10 +1143,10 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                         aCRD.Ref2.nCol = aSRD.nCol;
                         aCRD.Ref2.nRow = aSRD.nRow;
                         aCRD.Ref2.nTab = nLastScTab;
-                        rRangeList.Append( aCRD );
+                        rRangeList.Append( aCRD, nTab );
                     }
                     else
-                        rRangeList.Append( aSRD );
+                        rRangeList.Append( aSRD, nTab );
                 }
             }
                 break;
@@ -1178,7 +1179,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                     else if( IsComplRowRange( nRw1, nRw2 ) )
                         SetComplRow( aCRD );
 
-                    rRangeList.Append( aCRD );
+                    rRangeList.Append( aCRD, nTab );
                 }
             }
                 break;
diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx
index 3b165e5..8d4acc0 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -78,7 +78,7 @@ _ScRangeListTabs::~_ScRangeListTabs()
 }
 
 
-void _ScRangeListTabs::Append( ScSingleRefData a, const BOOL b )
+void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b )
 {
     if( b )
     {
@@ -98,19 +98,24 @@ void _ScRangeListTabs::Append( ScSingleRefData a, const BOOL b )
 
     bHasRanges = TRUE;
 
-    if( a.nTab >= 0 )
+    if( nTab == SCTAB_MAX)
+        return;
+    if( nTab < 0)
+        nTab = a.nTab;
+
+    if( nTab >= 0 )
     {
-        _ScRangeList*   p = ppTabLists[ a.nTab ];
+        _ScRangeList*   p = ppTabLists[ nTab ];
 
         if( !p )
-            p = ppTabLists[ a.nTab ] = new _ScRangeList;
+            p = ppTabLists[ nTab ] = new _ScRangeList;
 
         p->Append( a );
     }
 }
 
 
-void _ScRangeListTabs::Append( ScComplexRefData a, const BOOL b )
+void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b )
 {
     if( b )
     {
@@ -158,12 +163,17 @@ void _ScRangeListTabs::Append( ScComplexRefData a, const BOOL b )
 
     bHasRanges = TRUE;
 
-    if( a.Ref1.nTab >= 0 )
+    if( nTab == SCTAB_MAX)
+        return;
+    if( nTab < -1)
+        nTab = a.Ref1.nTab;
+
+    if( nTab >= 0 )
     {
-        _ScRangeList*   p = ppTabLists[ a.Ref1.nTab ];
+        _ScRangeList*   p = ppTabLists[ nTab ];
 
         if( !p )
-            p = ppTabLists[ a.Ref1.nTab ] = new _ScRangeList;
+            p = ppTabLists[ nTab ] = new _ScRangeList;
 
         p->Append( a );
     }
diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index 5596d26..38e08b0 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -158,16 +158,18 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
     }
     else if( bBuiltIn )
     {
+        SCsTAB const nLocalTab = (nXclTab == EXC_NAME_GLOBAL) ? SCTAB_MAX : (nXclTab - 1);
+
         // --- print ranges or title ranges ---
         rStrm.PushPosition();
         switch( mcBuiltIn )
         {
             case EXC_BUILTIN_PRINTAREA:
-                if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, FT_RangeName ) == ConvOK )
+                if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
                     nNameType |= RT_PRINTAREA;
             break;
             case EXC_BUILTIN_PRINTTITLES:
-                if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, FT_RangeName ) == ConvOK )
+                if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
                     nNameType |= RT_COLHEADER | RT_ROWHEADER;
             break;
         }
diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx
index ab96e63..3633815 100644
--- a/sc/source/filter/inc/excform.hxx
+++ b/sc/source/filter/inc/excform.hxx
@@ -61,7 +61,7 @@ public:
     virtual ConvErr     Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
                                  bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
 
-    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
+    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
 
     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
                                            const String& rUrl, const ::std::vector<String>& rTabNames );
@@ -137,7 +137,7 @@ public:
 
     virtual ConvErr     Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
 
-    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
+    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
 
     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
                                            const String& rUrl, const ::std::vector<String>& rTabNames );
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 53a08ec..d6975ff 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -151,8 +151,8 @@ public:
                                 _ScRangeListTabs( void );
     virtual						~_ScRangeListTabs();
 
-    void						Append( ScSingleRefData aSRD, const BOOL bLimit = TRUE );
-    void						Append( ScComplexRefData aCRD, const BOOL bLimit = TRUE );
+    void						Append( ScSingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE );
+    void						Append( ScComplexRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE );
 
     inline BOOL					HasRanges( void ) const;
 
@@ -213,7 +213,7 @@ public:
 
     virtual ConvErr     Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen,
                                  bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
-    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen,
+    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab,
                                     const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
 };
 
commit c597e24275469fbb14ab8210d455a5643208c229
Author: Jody Goldberg <jody at gnome.org>
Date:   Wed Sep 15 11:44:06 2010 +0200

    sc-read-only-colrow-resize.diff: Allow resizing Cols/Rows if document is R/O
    
    n#165980

diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index 80c794d..0286946 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -216,8 +216,7 @@ BOOL ScColBar::IsDisabled()
 
 BOOL ScColBar::ResizeAllowed()
 {
-    return !pViewData->HasEditView( pViewData->GetActivePart() ) &&
-            !pViewData->GetDocShell()->IsReadOnly();
+    return !pViewData->HasEditView( pViewData->GetActivePart() );
 }
 
 void ScColBar::DrawInvert( long nDragPosP )
@@ -383,8 +382,7 @@ BOOL ScRowBar::IsDisabled()
 
 BOOL ScRowBar::ResizeAllowed()
 {
-    return !pViewData->HasEditView( pViewData->GetActivePart() ) &&
-            !pViewData->GetDocShell()->IsReadOnly();
+    return !pViewData->HasEditView( pViewData->GetActivePart() );
 }
 
 void ScRowBar::DrawInvert( long nDragPosP )
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index c594e3b..ba17f84 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2111,7 +2111,10 @@ void ScViewFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
                         bOnlyMatrix;
             }
         }
-    if ( !bAllowed )
+
+    // Allow users to resize cols/rows in readonly docs despite the r/o state.
+    // It is frustrating to be unable to see content in mis-sized cells.
+    if( !bAllowed && !pDocSh->IsReadOnly() )
     {
         ErrorMessage(STR_PROTECTIONERR);
         return;
@@ -2328,6 +2331,7 @@ void ScViewFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
             }
 
         pDocSh->UpdateOle(GetViewData());
+        if( !pDocSh->IsReadOnly() )
         aModificator.SetDocumentModified();
 
         ShowCursor();
commit 595233ddf6584a3fd7c5a067c0e4e49aa7024894
Author: Jody Goldberg <jody at gnome.org>
Date:   Wed Sep 15 11:40:21 2010 +0200

    sc-dp-gridlayout.diff: Something with grid layout :)
    
    i#68544, n#190970

diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 5aa770b..78d17d5 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -809,6 +809,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
                             rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_FALSE);
                         if (!pDPSave->GetDrillDown())
                             rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_FALSE);
+                        if ((*pDPs)[i]->GetHeaderLayout())
+                            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT, XML_TRUE);
+
                         SvXMLElementExport aElemDP(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, sal_True, sal_True);
 
                         // grand total elements.
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index d9b1f6b..6ba5bbf 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -139,7 +139,8 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport,
     bTargetRangeAddress(sal_False),
     bSourceCellRange(sal_False),
     bShowFilter(sal_True),
-    bDrillDown(sal_True)
+    bDrillDown(sal_True),
+    bHeaderGridLayout(sal_False)
 {
     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDataPilotTableAttrTokenMap();
@@ -219,6 +220,11 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport,
                 bDrillDown = IsXMLToken(sValue, XML_TRUE);
             }
             break;
+            case XML_TOK_DATA_PILOT_TABLE_ATTR_HEADER_GRID_LAYOUT :
+            {
+                bHeaderGridLayout = IsXMLToken(sValue, XML_TRUE);
+            }
+            break;
         }
     }
 
@@ -396,6 +402,7 @@ void ScXMLDataPilotTableContext::EndElement()
         pDPObject->SetName(sDataPilotTableName);
         pDPObject->SetTag(sApplicationData);
         pDPObject->SetOutRange(aTargetRangeAddress);
+        pDPObject->SetHeaderLayout(bHeaderGridLayout);
         switch (nSourceType)
         {
             case SQL :
diff --git a/sc/source/filter/xml/xmldpimp.hxx b/sc/source/filter/xml/xmldpimp.hxx
index e136fb2..45b371f 100644
--- a/sc/source/filter/xml/xmldpimp.hxx
+++ b/sc/source/filter/xml/xmldpimp.hxx
@@ -126,6 +126,7 @@ class ScXMLDataPilotTableContext : public SvXMLImportContext
     sal_Bool		bSourceCellRange;
     sal_Bool        bShowFilter;
     sal_Bool        bDrillDown;
+    sal_Bool        bHeaderGridLayout;
 
     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 51ee66c..511c321 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1329,6 +1329,7 @@ const SvXMLTokenMap& ScXMLImport::GetDataPilotTableAttrTokenMap()
             { XML_NAMESPACE_TABLE, XML_BUTTONS,				    XML_TOK_DATA_PILOT_TABLE_ATTR_BUTTONS				},
             { XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON,	    XML_TOK_DATA_PILOT_TABLE_ATTR_SHOW_FILTER_BUTTON	},
             { XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN			},
+    { XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT,      XML_TOK_DATA_PILOT_TABLE_ATTR_HEADER_GRID_LAYOUT    },
             XML_TOKEN_MAP_END
         };
 
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index a09b877..4831d32 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -481,7 +481,8 @@ enum ScXMLDataPilotTableAttrTokens
     XML_TOK_DATA_PILOT_TABLE_ATTR_TARGET_RANGE_ADDRESS,
     XML_TOK_DATA_PILOT_TABLE_ATTR_BUTTONS,
     XML_TOK_DATA_PILOT_TABLE_ATTR_SHOW_FILTER_BUTTON,
-    XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN
+    XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN,
+    XML_TOK_DATA_PILOT_TABLE_ATTR_HEADER_GRID_LAYOUT
 };
 
 enum ScXMLDataPilotTableElemTokens
commit c6735c0de2bbed4593ebd8060807aefe94a9941f
Author: Jody Goldberg <jody at gnome.org>
Date:   Wed Sep 15 11:33:09 2010 +0200

    sc-change-record-dnd.diff: Allow dnd in Change record mode for Data source
    
    i#44982

diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 6a91431..60abe62 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -65,6 +65,7 @@
 #include "dbdocutl.hxx"
 #include "editable.hxx"
 #include "hints.hxx"
+#include "chgtrack.hxx"
 
 using namespace com::sun::star;
 
@@ -216,6 +217,8 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
         const SbaSelectionList* pSelection, BOOL bRecord, BOOL bAddrInsert )
 {
     ScDocument* pDoc = rDocShell.GetDocument();
+    ScChangeTrack *pChangeTrack = NULL;
+    ScRange aChangedRange;
 
     if (bRecord && !pDoc->IsUndoEnabled())
         bRecord = FALSE;
@@ -490,11 +493,9 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
             nErrStringId = aTester.GetMessageId();
             bSuccess = FALSE;
         }
-        else if ( pDoc->GetChangeTrack() != NULL )
-        {
-            nErrStringId = STR_PROTECTIONERR;
-            bSuccess = FALSE;
-        }
+        else if ( (pChangeTrack = pDoc->GetChangeTrack()) != NULL )
+            aChangedRange = ScRange(rParam.nCol1, rParam.nRow1, nTab,
+                        nEndCol+nFormulaCols, nEndRow, nTab );
     }
 
     if ( bSuccess && bMoveCells )
@@ -712,6 +713,9 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
 
     delete pImportDoc;
 
+    if (bSuccess && pChangeTrack)
+        pChangeTrack->AppendInsert ( aChangedRange );
+
     return bSuccess;
 }
 
commit 1cd57db36c14e98190311ceed238c01f2dd60eea
Author: Jody Goldberg <jody at gnome.org>
Date:   Wed Sep 15 11:30:22 2010 +0200

    sc-datapilot-autoformat.diff: Provision for data-pilot to give autoformat
    
    i#37388, bxc#62162

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 0c4013a..3efb26a 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1653,6 +1653,9 @@
 #define MID_3   3
 #define MID_4   4
 
+// Autoformat for DataPilot
+#define SID_PIVOT_AFMT              (SC_OOO_BUILD_START + 1)
+
 #endif
 
 
diff --git a/sc/sdi/pivotsh.sdi b/sc/sdi/pivotsh.sdi
index 4b2ddbe..82671ae 100644
--- a/sc/sdi/pivotsh.sdi
+++ b/sc/sdi/pivotsh.sdi
@@ -31,6 +31,7 @@ interface Pivot
     SID_PIVOT_RECALC	[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
     SID_PIVOT_KILL		[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
         SID_DP_FILTER           [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+    SID_PIVOT_AFMT		[ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
 }
 
 shell ScPivotShell
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index b46c569..c52e028 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -1872,6 +1872,30 @@ SfxVoidItem DeletePivotTable SID_PIVOT_KILL
     GroupId = GID_DATA;
 ]
 
+SfxVoidItem AutoFormatPivotTable SID_PIVOT_AFMT
+()
+[
+        /* flags: */
+        AutoUpdate = FALSE,
+        Cachable = Cachable,
+        FastCall = FALSE,
+        HasCoreId = FALSE,
+        HasDialog = FALSE,
+        ReadOnlyDoc = TRUE,
+        Toggle = FALSE,
+        Container = FALSE,
+        RecordAbsolute = FALSE,
+        RecordPerSet;
+        Synchron;
+
+        /* config: */
+        AccelConfig = FALSE,
+        MenuConfig = TRUE,
+        StatusBarConfig = FALSE,
+        ToolBoxConfig = FALSE,
+        GroupId = GID_DATA;
+]
+
 //--------------------------------------------------------------------------
 SfxVoidItem DeletePrintArea SID_DELETE_PRINTAREA
 ()
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index ca09bc8..318ee76 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1413,6 +1413,36 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
     delete pNewUndoDoc;
     delete pUndoDPObj;
 
+    if (pNewObj && pNewObj->GetAutoFormatIndex() != 65535)
+    {
+        ScViewData* pViewData = rDocShell.GetViewData();
+        ScTabViewShell* pViewShell = pViewData->GetViewShell();
+        pViewShell->GetDBData( TRUE, SC_DB_OLD );
+        const ScMarkData& rMark1 = pViewData->GetMarkData();
+        SCCOL nStartCol;
+        SCROW nStartRow;
+        SCTAB nStartTab;
+        SCCOL nEndCol;
+        SCROW nEndRow;
+        SCTAB nEndTab;
+
+        rDocShell.GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab );
+        ScRange Outrange = pNewObj->GetOutRange();
+        if (( (Outrange.aStart.Col() <= nStartCol) && (nStartCol <= Outrange.aEnd.Col() )&& (nStartTab == Outrange.aStart.Tab()))
+            && ( (Outrange.aStart.Row() <= nStartRow) && (nStartRow <= Outrange.aEnd.Row() )) )
+        {
+
+            if ( !rMark1.IsMarked() && !rMark1.IsMultiMarked() )
+                pViewShell->MarkDataArea( TRUE );
+            //FIXME: Autoformat even when clicked from a non-dp cell.
+            pViewData->MoveNextRow();
+            sal_uInt16 nAutoFmtIndex = pNewObj->GetAutoFormatIndex();
+            pViewShell->AutoFormat(nAutoFmtIndex);
+            pViewShell->AutoFormatPivotTable(const_cast<ScDPObject*>(pNewObj), nAutoFmtIndex);
+            pViewData->MovePrevRow();
+        }
+    }
+
     if (bDone)
     {
         // notify API objects
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index 65805c8..257e3fa 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -86,10 +86,10 @@ public:
     bool            MakePivotTable( const ScDPSaveData& rData, const ScRange& rDest, BOOL bNewTable,
                                     const ScDPObject& rSource, BOOL bApi = FALSE );
     void			DeletePivotTable();
-    // Wang Xu Ming -- 2009-6-17
-    // DataPilot Migration
-    ULONG   RecalcPivotTable();
-    // End Comments
+    ULONG			RecalcPivotTable();
+    void            AutoFormatPivotTable(USHORT nIndex);
+    void            AutoFormatPivotTable(ScDPObject* pDPObj, USHORT nIndex);
+
     BOOL            HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts );
     BOOL            HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo );
     void            GroupDataPilot();
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 114601d..7be2b44 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -332,6 +332,10 @@ public:
     ScMarkType      GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
                                     SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
     ScMarkType      GetSimpleArea( ScRange& rRange ) const;
+
+    void            MoveNextRow();
+    void            MovePrevRow();
+
                     /// May modify rNewMark using MarkToSimple().
     ScMarkType      GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
     void			GetMultiArea( ScRangeListRef& rRange ) const;
diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk
index d349943..8c56101 100644
--- a/sc/source/ui/miscdlgs/makefile.mk

... etc. - the rest is truncated


More information about the ooo-build-commit mailing list