[Libreoffice-commits] core.git: 24 commits - include/svx sc/inc sc/Library_sc.mk sc/source svx/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Oct 22 15:07:38 PDT 2014


 include/svx/sdtakitm.hxx                     |   19 -
 include/svx/svdotext.hxx                     |    5 
 sc/Library_sc.mk                             |    1 
 sc/inc/column.hxx                            |    4 
 sc/inc/document.hxx                          |    2 
 sc/inc/documentimport.hxx                    |   19 +
 sc/inc/formulacell.hxx                       |    3 
 sc/inc/numformat.hxx                         |   46 +++
 sc/inc/rowheightcontext.hxx                  |    6 
 sc/inc/table.hxx                             |    4 
 sc/source/core/data/column.cxx               |   60 ++++-
 sc/source/core/data/column2.cxx              |   28 +-
 sc/source/core/data/column3.cxx              |   41 +++
 sc/source/core/data/document.cxx             |    8 
 sc/source/core/data/documentimport.cxx       |  117 +++++++++-
 sc/source/core/data/formulacell.cxx          |   25 +-
 sc/source/core/data/rowheightcontext.cxx     |    5 
 sc/source/core/data/table1.cxx               |   41 +--
 sc/source/core/data/table2.cxx               |   24 +-
 sc/source/core/opencl/op_statistical.cxx     |    6 
 sc/source/core/opencl/opbase.cxx             |   73 ++++++
 sc/source/core/opencl/opbase.hxx             |   68 ++---
 sc/source/core/tool/numformat.cxx            |   82 +++++++
 sc/source/filter/excel/xistyle.cxx           |   24 +-
 sc/source/filter/excel/xlroot.cxx            |   21 +
 sc/source/filter/inc/numberformatsbuffer.hxx |    4 
 sc/source/filter/inc/stylesbuffer.hxx        |   19 +
 sc/source/filter/inc/xlroot.hxx              |   10 
 sc/source/filter/oox/numberformatsbuffer.cxx |   16 +
 sc/source/filter/oox/sheetdatabuffer.cxx     |   28 +-
 sc/source/filter/oox/stylesbuffer.cxx        |   98 ++++++--
 sc/source/filter/oox/worksheethelper.cxx     |   13 -
 sc/source/filter/xml/xmlimprt.cxx            |   29 --
 sc/source/ui/view/viewfun2.cxx               |    2 
 svx/source/svdraw/svdoashp.cxx               |    3 
 svx/source/svdraw/svdotext.cxx               |   77 +++---
 svx/source/svdraw/svdotxat.cxx               |  311 ++++++++++++++++-----------
 svx/source/svdraw/svdotxtr.cxx               |   26 --
 38 files changed, 974 insertions(+), 394 deletions(-)

New commits:
commit bc87f12c6a045203d3bb3c0d0e38693c25efa1f9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 15 14:26:02 2014 -0400

    Reduce scopes and add some whitespaces.
    
    Conflicts:
    	svx/source/svdraw/svdotxat.cxx
    
    Change-Id: Ie1c94a4c241352c580d2509529919806f01ed6c0

diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index 6ede596..47e402e 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -57,136 +57,205 @@ const short PADDING_LENGTH_FOR_STYLE_FAMILY = 5;
 const sal_Char PADDING_CHARACTER_FOR_STYLE_FAMILY = ' ';
 }
 
-bool SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bWdt) const
+bool SdrTextObj::AdjustTextFrameWidthAndHeight( Rectangle& rR, bool bHgt, bool bWdt ) const
 {
-    if (bTextFrame && pModel!=NULL && !rR.IsEmpty())
+    if (!bTextFrame)
+        // Not a text frame.  Bail out.
+        return false;
+
+    if (!pModel)
+        // Model doesn't exist.  Bail out.
+        return false;
+
+    if (rR.IsEmpty())
+        // Empty rectangle.
+        return false;
+
+    bool bFitToSize = IsFitToSize();
+    if (bFitToSize)
+        return false;
+
+    bool bWdtGrow = bWdt && IsAutoGrowWidth();
+    bool bHgtGrow = bHgt && IsAutoGrowHeight();
+    if (!bWdtGrow && !bHgtGrow)
+        // Not supposed to auto-adjust width or height.
+        return false;
+
+    SdrTextAniKind eAniKind = GetTextAniKind();
+    SdrTextAniDirection eAniDir = GetTextAniDirection();
+
+    bool bScroll = eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE;
+    bool bHScroll = bScroll && (eAniDir == SDRTEXTANI_LEFT || eAniDir == SDRTEXTANI_RIGHT);
+    bool bVScroll = bScroll && (eAniDir == SDRTEXTANI_UP || eAniDir == SDRTEXTANI_DOWN);
+
+    Rectangle aOldRect = rR;
+    long nHgt = 0, nMinHgt = 0, nMaxHgt = 0;
+    long nWdt = 0, nMinWdt = 0, nMaxWdt = 0;
+
+    Size aNewSize = rR.GetSize();
+    aNewSize.Width()--; aNewSize.Height()--;
+
+    Size aMaxSiz(100000, 100000);
+    Size aTmpSiz = pModel->GetMaxObjSize();
+
+    if (aTmpSiz.Width())
+        aMaxSiz.Width() = aTmpSiz.Width();
+    if (aTmpSiz.Height())
+        aMaxSiz.Height() = aTmpSiz.Height();
+
+    if (bWdtGrow)
+    {
+        nMinWdt = GetMinTextFrameWidth();
+        nMaxWdt = GetMaxTextFrameWidth();
+        if (nMaxWdt == 0 || nMaxWdt > aMaxSiz.Width())
+            nMaxWdt = aMaxSiz.Width();
+        if (nMinWdt <= 0)
+            nMinWdt = 1;
+
+        aNewSize.Width() = nMaxWdt;
+    }
+
+    if (bHgtGrow)
+    {
+        nMinHgt = GetMinTextFrameHeight();
+        nMaxHgt = GetMaxTextFrameHeight();
+        if (nMaxHgt == 0 || nMaxHgt > aMaxSiz.Height())
+            nMaxHgt = aMaxSiz.Height();
+        if (nMinHgt <= 0)
+            nMinHgt = 1;
+
+        aNewSize.Height() = nMaxHgt;
+    }
+
+    long nHDist = GetTextLeftDistance() + GetTextRightDistance();
+    long nVDist = GetTextUpperDistance() + GetTextLowerDistance();
+    aNewSize.Width() -= nHDist;
+    aNewSize.Height() -= nVDist;
+
+    if (aNewSize.Width() < 2)
+        aNewSize.Width() = 2;
+    if (aNewSize.Height() < 2)
+        aNewSize.Height() = 2;
+
+    if (!IsInEditMode())
+    {
+        if (bHScroll)
+            aNewSize.Width() = 0x0FFFFFFF; // don't break ticker text
+        if (bVScroll)
+            aNewSize.Height() = 0x0FFFFFFF;
+    }
+
+    if (pEdtOutl)
     {
-        bool bFitToSize(IsFitToSize());
-        bool bWdtGrow=bWdt && IsAutoGrowWidth();
-        bool bHgtGrow=bHgt && IsAutoGrowHeight();
-        SdrTextAniKind eAniKind=GetTextAniKind();
-        SdrTextAniDirection eAniDir=GetTextAniDirection();
-        bool bScroll=eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE;
-        bool bHScroll=bScroll && (eAniDir==SDRTEXTANI_LEFT || eAniDir==SDRTEXTANI_RIGHT);
-        bool bVScroll=bScroll && (eAniDir==SDRTEXTANI_UP || eAniDir==SDRTEXTANI_DOWN);
-        if (!bFitToSize && (bWdtGrow || bHgtGrow))
+        pEdtOutl->SetMaxAutoPaperSize(aNewSize);
+        if (bWdtGrow)
         {
-            Rectangle aR0(rR);
-            long nHgt=0,nMinHgt=0,nMaxHgt=0;
-            long nWdt=0,nMinWdt=0,nMaxWdt=0;
-            Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--;
-            Size aMaxSiz(100000,100000);
-            Size aTmpSiz(pModel->GetMaxObjSize());
-            if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
-            if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
-            if (bWdtGrow)
-            {
-                nMinWdt=GetMinTextFrameWidth();
-                nMaxWdt=GetMaxTextFrameWidth();
-                if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
-                if (nMinWdt<=0) nMinWdt=1;
-                aSiz.Width()=nMaxWdt;
-            }
+            Size aSiz2(pEdtOutl->CalcTextSize());
+            nWdt = aSiz2.Width() + 1; // a little tolerance
             if (bHgtGrow)
-            {
-                nMinHgt=GetMinTextFrameHeight();
-                nMaxHgt=GetMaxTextFrameHeight();
-                if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
-                if (nMinHgt<=0) nMinHgt=1;
-                aSiz.Height()=nMaxHgt;
-            }
-            long nHDist=GetTextLeftDistance()+GetTextRightDistance();
-            long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
-            aSiz.Width()-=nHDist;
-            aSiz.Height()-=nVDist;
-            if (aSiz.Width()<2) aSiz.Width()=2;
-            if (aSiz.Height()<2) aSiz.Height()=2;
+                nHgt = aSiz2.Height() + 1; // a little tolerance
+        }
+        else
+        {
+            nHgt = pEdtOutl->GetTextHeight() + 1; // a little tolerance
+        }
+    }
+    else
+    {
+        Outliner& rOutliner = ImpGetDrawOutliner();
+        rOutliner.SetPaperSize(aNewSize);
+        rOutliner.SetUpdateMode(true);
+        // TODO: add the optimization with bPortionInfoChecked etc. here
+        OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+        if (pOutlinerParaObject)
+        {
+            rOutliner.SetText(*pOutlinerParaObject);
+            rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+        }
 
-            bool bInEditMode = IsInEditMode();
+        if (bWdtGrow)
+        {
+            Size aSiz2(rOutliner.CalcTextSize());
+            nWdt = aSiz2.Width() + 1; // a little tolerance
+            if (bHgtGrow)
+                nHgt = aSiz2.Height() + 1; // a little tolerance
+        }
+        else
+        {
+            nHgt = rOutliner.GetTextHeight() + 1; // a little tolerance
+        }
+        rOutliner.Clear();
+    }
 
-            if(!bInEditMode)
-            {
-                if (bHScroll) aSiz.Width()=0x0FFFFFFF; // don't break ticker text
-                if (bVScroll) aSiz.Height()=0x0FFFFFFF;
-            }
+    if (nWdt < nMinWdt)
+        nWdt = nMinWdt;
+    if (nWdt > nMaxWdt)
+        nWdt = nMaxWdt;
+    nWdt += nHDist;
+    if (nWdt < 1)
+        nWdt = 1; // nHDist may be negative
+    if (nHgt < nMinHgt)
+        nHgt = nMinHgt;
+    if (nHgt > nMaxHgt)
+        nHgt = nMaxHgt;
+    nHgt += nVDist;
+    if (nHgt < 1)
+        nHgt = 1; // nVDist may be negative
+    long nWdtGrow = nWdt - (rR.Right() - rR.Left());
+    long nHgtGrow = nHgt - (rR.Bottom() - rR.Top());
+
+    if (nWdtGrow == 0)
+        bWdtGrow = false;
+    if (nHgtGrow == 0)
+        bHgtGrow = false;
+
+    if (!bWdtGrow && !bHgtGrow)
+        return false;
+
+    if (bWdtGrow)
+    {
+        SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust();
 
-            if(pEdtOutl)
-            {
-                pEdtOutl->SetMaxAutoPaperSize(aSiz);
-                if (bWdtGrow) {
-                    Size aSiz2(pEdtOutl->CalcTextSize());
-                    nWdt=aSiz2.Width()+1; // a little tolerance
-                    if (bHgtGrow) nHgt=aSiz2.Height()+1; // a little tolerance
-                } else {
-                    nHgt=pEdtOutl->GetTextHeight()+1; // a little tolerance
-                }
-            } else {
-                Outliner& rOutliner=ImpGetDrawOutliner();
-                rOutliner.SetPaperSize(aSiz);
-                rOutliner.SetUpdateMode(true);
-                // TODO: add the optimization with bPortionInfoChecked etc. here
-                OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
-                if ( pOutlinerParaObject != NULL )
-                {
-                    rOutliner.SetText(*pOutlinerParaObject);
-                    rOutliner.SetFixedCellHeight(static_cast<const SdrTextFixedCellHeightItem&>(GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
-                }
-                if (bWdtGrow)
-                {
-                    Size aSiz2(rOutliner.CalcTextSize());
-                    nWdt=aSiz2.Width()+1; // a little tolerance
-                    if (bHgtGrow) nHgt=aSiz2.Height()+1; // a little tolerance
-                } else {
-                    nHgt=rOutliner.GetTextHeight()+1; // a little tolerance
-                }
-                rOutliner.Clear();
-            }
-            if (nWdt<nMinWdt) nWdt=nMinWdt;
-            if (nWdt>nMaxWdt) nWdt=nMaxWdt;
-            nWdt+=nHDist;
-            if (nWdt<1) nWdt=1; // nHDist may be negative
-            if (nHgt<nMinHgt) nHgt=nMinHgt;
-            if (nHgt>nMaxHgt) nHgt=nMaxHgt;
-            nHgt+=nVDist;
-            if (nHgt<1) nHgt=1; // nVDist may be negative
-            long nWdtGrow=nWdt-(rR.Right()-rR.Left());
-            long nHgtGrow=nHgt-(rR.Bottom()-rR.Top());
-            if (nWdtGrow==0) bWdtGrow=false;
-            if (nHgtGrow==0) bHgtGrow=false;
-            if (bWdtGrow || bHgtGrow) {
-                if (bWdtGrow) {
-                    SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
-                    if (eHAdj==SDRTEXTHORZADJUST_LEFT) rR.Right()+=nWdtGrow;
-                    else if (eHAdj==SDRTEXTHORZADJUST_RIGHT) rR.Left()-=nWdtGrow;
-                    else {
-                        long nWdtGrow2=nWdtGrow/2;
-                        rR.Left()-=nWdtGrow2;
-                        rR.Right()=rR.Left()+nWdt;
-                    }
-                }
-                if (bHgtGrow) {
-                    SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
-                    if (eVAdj==SDRTEXTVERTADJUST_TOP) rR.Bottom()+=nHgtGrow;
-                    else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM) rR.Top()-=nHgtGrow;
-                    else {
-                        long nHgtGrow2=nHgtGrow/2;
-                        rR.Top()-=nHgtGrow2;
-                        rR.Bottom()=rR.Top()+nHgt;
-                    }
-                }
-                if (aGeo.nRotationAngle!=0) {
-                    Point aD1(rR.TopLeft());
-                    aD1-=aR0.TopLeft();
-                    Point aD2(aD1);
-                    RotatePoint(aD2,Point(),aGeo.nSin,aGeo.nCos);
-                    aD2-=aD1;
-                    rR.Move(aD2.X(),aD2.Y());
-                }
-                return true;
-            }
+        if (eHAdj == SDRTEXTHORZADJUST_LEFT)
+            rR.Right() += nWdtGrow;
+        else if (eHAdj == SDRTEXTHORZADJUST_RIGHT)
+            rR.Left() -= nWdtGrow;
+        else
+        {
+            long nWdtGrow2 = nWdtGrow / 2;
+            rR.Left() -= nWdtGrow2;
+            rR.Right() = rR.Left() + nWdt;
+        }
+    }
+
+    if (bHgtGrow)
+    {
+        SdrTextVertAdjust eVAdj = GetTextVerticalAdjust();
+
+        if (eVAdj == SDRTEXTVERTADJUST_TOP)
+            rR.Bottom() += nHgtGrow;
+        else if (eVAdj == SDRTEXTVERTADJUST_BOTTOM)
+            rR.Top() -= nHgtGrow;
+        else
+        {
+            long nHgtGrow2 = nHgtGrow / 2;
+            rR.Top() -= nHgtGrow2;
+            rR.Bottom() = rR.Top() + nHgt;
         }
     }
-    return false;
+
+    if (aGeo.nRotationAngle)
+    {
+        // Object is rotated.
+        Point aD1(rR.TopLeft());
+        aD1 -= aOldRect.TopLeft();
+        Point aD2(aD1);
+        RotatePoint(aD2, Point(), aGeo.nSin, aGeo.nCos);
+        aD2 -= aD1;
+        rR.Move(aD2.X(), aD2.Y());
+    }
+
+    return true;
 }
 
 bool SdrTextObj::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
commit ec1b82e682ac613fe6de78a733ed3a00094a946f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 15 14:06:53 2014 -0400

    Describe text animation types.
    
    Change-Id: I4f878eff707e318fa80b7d3c19833bf724e4bcef

diff --git a/include/svx/sdtakitm.hxx b/include/svx/sdtakitm.hxx
index fc0730f..2b94486 100644
--- a/include/svx/sdtakitm.hxx
+++ b/include/svx/sdtakitm.hxx
@@ -23,15 +23,16 @@
 #include <svx/svddef.hxx>
 #include <svx/svxdllapi.h>
 
-
-// class SdrTextAniKindItem
-
-
-enum SdrTextAniKind {SDRTEXTANI_NONE,
-                     SDRTEXTANI_BLINK,
-                     SDRTEXTANI_SCROLL,
-                     SDRTEXTANI_ALTERNATE,
-                     SDRTEXTANI_SLIDE};
+/**
+ * Animation type for text frame.
+ */
+enum SdrTextAniKind {
+    SDRTEXTANI_NONE,      /// no animation
+    SDRTEXTANI_BLINK,     /// blinking
+    SDRTEXTANI_SCROLL,    /// scroll through
+    SDRTEXTANI_ALTERNATE, /// scroll back and forth
+    SDRTEXTANI_SLIDE      /// scroll in
+};
 
 // - SDRTEXTANI_BLINK:
 //   Just blink.  Direction and Amount don't effect things.
commit c3513475e549581b8d535975bf84acf8c788d469
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 15 10:04:51 2014 -0400

    SetObjectItemSet() eventually calls NbcAdjustTextFrameWidthAndHeight().
    
    No need to call this (rather expensive) method twice.
    
    Change-Id: I4c0a54acd1da0b8504ae7eb96beda4a8531943c7

diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index be38ea9..85a4b9f 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1480,10 +1480,7 @@ void SdrObjCustomShape::AdaptTextMinSize()
         }
 
         if(bChanged)
-        {
             SetObjectItemSet(aSet);
-            NbcAdjustTextFrameWidthAndHeight();
-        }
     }
 }
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 86893c5..fdb46e9 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -600,7 +600,6 @@ void SdrTextObj::AdaptTextMinSize()
     }
 
     SetObjectItemSet(aSet);
-    NbcAdjustTextFrameWidthAndHeight();
 }
 
 void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, bool bLineWidth ) const
commit 4a3e7d46c106a8d75c399b0fc21ab3808a9b2467
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 14 17:40:40 2014 -0400

    AdoptTextMinSize() calls NbcAdjustTextFrameWidthAndHeight() at the end.
    
    No need to call this again in the caller.
    
    Change-Id: Ib36853cf5a0720082275e0490b4443cd9e0bd007

diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 1107c9b..c7c91a8 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -63,11 +63,6 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
         // #115391#
         AdaptTextMinSize();
 
-        if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize()))
-        {
-            NbcAdjustTextFrameWidthAndHeight();
-        }
-
         ImpCheckShear();
         SetRectsDirty();
     }
@@ -92,11 +87,6 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
     // #115391#
     AdaptTextMinSize();
 
-    if(bTextFrame)
-    {
-        NbcAdjustTextFrameWidthAndHeight();
-    }
-
     SetRectsDirty();
 }
 
commit df3995232349ac5aac14e28d2931b9862b5c047a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 14 17:19:56 2014 -0400

    Reduce scope level & Annotate the code a bit.
    
    Change-Id: I6ebf849243000920b1c1f7e67d2dc81fcee9e16b

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 9fa6cb6..86893c5 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -548,51 +548,59 @@ bool SdrTextObj::NbcSetEckenradius(long nRad)
 // states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height
 void SdrTextObj::AdaptTextMinSize()
 {
-    if(bTextFrame && (!pModel || !pModel->IsPasteResize()))
-    {
-        const bool bW(IsAutoGrowWidth());
-        const bool bH(IsAutoGrowHeight());
+    if (!bTextFrame)
+        // Only do this for text frame.
+        return;
 
-        if(bW || bH)
-        {
-            SfxItemSet aSet(
-                *GetObjectItemSet().GetPool(),
-                SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
-                SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, // contains SDRATTR_TEXT_MAXFRAMEWIDTH
-                0, 0);
+    if (pModel && pModel->IsPasteResize())
+        // Don't do this during paste resize.
+        return;
 
-            if(bW)
-            {
-                const long nDist(GetTextLeftDistance() + GetTextRightDistance());
-                const long nW(std::max(long(0), (long)(aRect.GetWidth() - 1 - nDist)));
+    const bool bW = IsAutoGrowWidth();
+    const bool bH = IsAutoGrowHeight();
 
-                aSet.Put(makeSdrTextMinFrameWidthItem(nW));
+    if (!bW && !bH)
+        // No auto grow requested.  Bail out.
+        return;
 
-                if(!IsVerticalWriting() && bDisableAutoWidthOnDragging)
-                {
-                    bDisableAutoWidthOnDragging = true;
-                    aSet.Put(makeSdrTextAutoGrowWidthItem(false));
-                }
-            }
+    SfxItemSet aSet(
+        *GetObjectItemSet().GetPool(),
+        SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
+        SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, // contains SDRATTR_TEXT_MAXFRAMEWIDTH
+        0, 0);
 
-            if(bH)
-            {
-                const long nDist(GetTextUpperDistance() + GetTextLowerDistance());
-                const long nH(std::max(long(0), (long)(aRect.GetHeight() - 1 - nDist)));
+    if(bW)
+    {
+        // Set minimum width.
+        const long nDist = GetTextLeftDistance() + GetTextRightDistance();
+        const long nW = std::max<long>(0, aRect.GetWidth() - 1 - nDist); // text width without margins
 
-                aSet.Put(makeSdrTextMinFrameHeightItem(nH));
+        aSet.Put(makeSdrTextMinFrameWidthItem(nW));
 
-                if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
-                {
-                    bDisableAutoWidthOnDragging = false;
-                    aSet.Put(makeSdrTextAutoGrowHeightItem(false));
-                }
-            }
+        if(!IsVerticalWriting() && bDisableAutoWidthOnDragging)
+        {
+            bDisableAutoWidthOnDragging = true;
+            aSet.Put(makeSdrTextAutoGrowWidthItem(false));
+        }
+    }
 
-            SetObjectItemSet(aSet);
-            NbcAdjustTextFrameWidthAndHeight();
+    if(bH)
+    {
+        // Set Minimum height.
+        const long nDist = GetTextUpperDistance() + GetTextLowerDistance();
+        const long nH = std::max<long>(0, aRect.GetHeight() - 1 - nDist); // text height without margins
+
+        aSet.Put(makeSdrTextMinFrameHeightItem(nH));
+
+        if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
+        {
+            bDisableAutoWidthOnDragging = false;
+            aSet.Put(makeSdrTextAutoGrowHeightItem(false));
         }
     }
+
+    SetObjectItemSet(aSet);
+    NbcAdjustTextFrameWidthAndHeight();
 }
 
 void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, bool bLineWidth ) const
commit 96554f0590841bc03e90a15b98e9455d478ee31f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 14 16:29:04 2014 -0400

    Remove local variables that are no longer used.
    
    Armin removed their uses in 120e469d176026ceb59abbf74d2ad255323cbc9a.
    
    Conflicts:
    	svx/source/svdraw/svdotxtr.cxx
    
    Change-Id: Id620466929ca3a66dd1c261e81aacd533a44cd76

diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 120c3b7..1107c9b 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -42,7 +42,9 @@ using namespace com::sun::star;
 
 void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
 {
-    if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0) {
+    if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0)
+    {
+        // Either the rotation or shear angle exists.
         Rectangle aSR0(GetSnapRect());
         long nWdt0=aSR0.Right()-aSR0.Left();
         long nHgt0=aSR0.Bottom()-aSR0.Top();
@@ -50,13 +52,11 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
         long nHgt1=rRect.Bottom()-rRect.Top();
         SdrTextObj::NbcResize(maSnapRect.TopLeft(),boost::rational<sal_Int64>(nWdt1,nWdt0),boost::rational<sal_Int64>(nHgt1,nHgt0));
         SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
-    } else {
-        long nHDist=GetTextLeftDistance()+GetTextRightDistance();
-        long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
-        long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0;
-        long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0;
-        long nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0;
-        long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
+    }
+    else
+    {
+        // No rotation or shear.
+
         aRect=rRect;
         ImpJustifyRect(aRect);
 
commit f3f1d8eaddc09446713e2bd065ed1815211b79b5
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 14 16:14:41 2014 -0400

    Method descriptions.
    
    Change-Id: Iece61424e09fc36768889fde2c848ed2b0722701

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index ba69600..8a45649 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -417,10 +417,13 @@ public:
     SdrTextVertAdjust GetTextVerticalAdjust(const SfxItemSet& rSet) const;
     SdrTextVertAdjust GetTextVerticalAdjust() const;
 
-    // Textrahmenabstaende
+    /** Left inner spacing to borders  */
     long GetTextLeftDistance() const;
+    /** Right inner spacing to borders  */
     long GetTextRightDistance() const;
+    /** Top inner spacing to borders */
     long GetTextUpperDistance() const;
+    /** Bottom inner spacing to borders */
     long GetTextLowerDistance() const;
     SdrTextAniKind GetTextAniKind() const;
     SdrTextAniDirection GetTextAniDirection() const;
commit 75c4091b14a0b419e6c9c2bd3c5e28a345c07a4b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Oct 3 16:43:25 2014 -0400

    Inlining make no sense for virtual functions.
    
    Change-Id: I6392eaceb0544b7faa9a0c726acf6619d971dbb7

diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx
index f19e36e..14ae124 100644
--- a/sc/source/core/opencl/opbase.cxx
+++ b/sc/source/core/opencl/opbase.cxx
@@ -88,17 +88,62 @@ DynamicKernelArgument::DynamicKernelArgument( const std::string& s,
     FormulaTreeNodeRef ft ) :
     mSymName(s), mFormulaTree(ft) { }
 
+std::string DynamicKernelArgument::GenDoubleSlidingWindowDeclRef( bool ) const
+{
+    return std::string("");
+}
+
+/// When Mix, it will be called
+std::string DynamicKernelArgument::GenStringSlidingWindowDeclRef( bool ) const
+{
+    return std::string("");
+}
+
+bool DynamicKernelArgument::IsMixedArgument() const
+{
+    return false;
+}
+
 /// Generate use/references to the argument
 void DynamicKernelArgument::GenDeclRef( std::stringstream& ss ) const
 {
     ss << mSymName;
 }
 
+void DynamicKernelArgument::GenNumDeclRef( std::stringstream& ss ) const
+{
+    ss << ",";
+}
+
+void DynamicKernelArgument::GenStringDeclRef( std::stringstream& ss ) const
+{
+    ss << ",";
+}
+
+void DynamicKernelArgument::GenSlidingWindowFunction( std::stringstream& ) {}
+
 FormulaToken* DynamicKernelArgument::GetFormulaToken() const
 {
     return mFormulaTree->GetFormulaToken();
 }
 
+std::string DynamicKernelArgument::DumpOpName() const
+{
+    return std::string("");
+}
+
+void DynamicKernelArgument::DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const {}
+
+const std::string& DynamicKernelArgument::GetName() const
+{
+    return mSymName;
+}
+
+bool DynamicKernelArgument::NeedParallelReduction() const
+{
+    return false;
+}
+
 VectorRef::VectorRef( const std::string& s, FormulaTreeNodeRef ft, int idx ) :
     DynamicKernelArgument(s, ft), mpClmem(NULL), mnIndex(idx)
 {
@@ -144,6 +189,8 @@ std::string VectorRef::GenSlidingWindowDeclRef( bool nested ) const
     return ss.str();
 }
 
+void VectorRef::GenSlidingWindowFunction( std::stringstream& ) {}
+
 size_t VectorRef::GetWindowSize() const
 {
     FormulaToken* pCur = mFormulaTree->GetFormulaToken();
@@ -164,6 +211,28 @@ size_t VectorRef::GetWindowSize() const
     }
 }
 
+std::string VectorRef::DumpOpName() const
+{
+    return std::string("");
+}
+
+void VectorRef::DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const {}
+
+const std::string& VectorRef::GetName() const
+{
+    return mSymName;
+}
+
+cl_mem VectorRef::GetCLBuffer() const
+{
+    return mpClmem;
+}
+
+bool VectorRef::NeedParallelReduction() const
+{
+    return false;
+}
+
 void Normal::GenSlidingWindowFunction(
     std::stringstream& ss, const std::string& sSymName, SubArguments& vSubArguments )
 {
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 15dedc5..d806140 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -87,6 +87,7 @@ class DynamicKernelArgument : boost::noncopyable
 {
 public:
     DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft );
+    virtual ~DynamicKernelArgument() {}
 
     /// Generate declaration
     virtual void GenDecl( std::stringstream& ss ) const = 0;
@@ -97,36 +98,31 @@ public:
     /// When referenced in a sliding window function
     virtual std::string GenSlidingWindowDeclRef( bool = false ) const = 0;
 
+    /// Create buffer and pass the buffer to a given kernel
+    virtual size_t Marshal( cl_kernel, int, int, cl_program ) = 0;
+
+    virtual size_t GetWindowSize() const = 0;
+
     /// When Mix, it will be called
-    virtual std::string GenDoubleSlidingWindowDeclRef( bool = false ) const
-    { return std::string(""); }
+    virtual std::string GenDoubleSlidingWindowDeclRef( bool = false ) const;
 
     /// When Mix, it will be called
-    virtual std::string GenStringSlidingWindowDeclRef( bool = false ) const
-    { return std::string(""); }
+    virtual std::string GenStringSlidingWindowDeclRef( bool = false ) const;
 
-    virtual bool IsMixedArgument() const
-    { return false; }
+    virtual bool IsMixedArgument() const;
 
     /// Generate use/references to the argument
     virtual void GenDeclRef( std::stringstream& ss ) const;
-    virtual void GenNumDeclRef( std::stringstream& ss ) const { ss << ",";}
+    virtual void GenNumDeclRef( std::stringstream& ss ) const;
 
-    virtual void GenStringDeclRef( std::stringstream& ss ) const { ss << ",";}
+    virtual void GenStringDeclRef( std::stringstream& ss ) const;
 
-    /// Create buffer and pass the buffer to a given kernel
-    virtual size_t Marshal( cl_kernel, int, int, cl_program ) = 0;
-
-    virtual ~DynamicKernelArgument() { }
-
-    virtual void GenSlidingWindowFunction( std::stringstream& ) { }
+    virtual void GenSlidingWindowFunction( std::stringstream& );
     formula::FormulaToken* GetFormulaToken() const;
-    virtual size_t GetWindowSize() const = 0;
-    virtual std::string DumpOpName() const { return std::string(""); }
-    virtual void DumpInlineFun( std::set<std::string>&,
-        std::set<std::string>& ) const { }
-    const std::string& GetName() const { return mSymName; }
-    virtual bool NeedParallelReduction() const { return false; }
+    virtual std::string DumpOpName() const;
+    virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const;
+    const std::string& GetName() const;
+    virtual bool NeedParallelReduction() const;
 
 protected:
     std::string mSymName;
@@ -142,6 +138,7 @@ class VectorRef : public DynamicKernelArgument
 {
 public:
     VectorRef( const std::string& s, FormulaTreeNodeRef ft, int index = 0 );
+    virtual ~VectorRef();
 
     /// Generate declaration
     virtual void GenDecl( std::stringstream& ss ) const SAL_OVERRIDE;
@@ -154,16 +151,13 @@ public:
     /// Create buffer and pass the buffer to a given kernel
     virtual size_t Marshal( cl_kernel, int, int, cl_program ) SAL_OVERRIDE;
 
-    virtual ~VectorRef();
-
-    virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE { }
+    virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE;
     virtual size_t GetWindowSize() const SAL_OVERRIDE;
-    virtual std::string DumpOpName() const SAL_OVERRIDE { return std::string(""); }
-    virtual void DumpInlineFun( std::set<std::string>&,
-        std::set<std::string>& ) const SAL_OVERRIDE { }
-    const std::string& GetName() const { return mSymName; }
-    virtual cl_mem GetCLBuffer() const { return mpClmem; }
-    virtual bool NeedParallelReduction() const SAL_OVERRIDE { return false; }
+    virtual std::string DumpOpName() const SAL_OVERRIDE;
+    virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const SAL_OVERRIDE;
+    const std::string& GetName() const;
+    virtual cl_mem GetCLBuffer() const;
+    virtual bool NeedParallelReduction() const SAL_OVERRIDE;
 
 protected:
     // Used by marshaling
@@ -200,7 +194,7 @@ public:
     typedef std::vector<SubArgument> SubArguments;
     virtual void GenSlidingWindowFunction( std::stringstream&,
         const std::string&, SubArguments& ) = 0;
-    virtual ~SlidingFunctionBase() { };
+    virtual ~SlidingFunctionBase() { }
 };
 
 class Normal : public SlidingFunctionBase
commit 165eef492748c8bd7cc3a72cddf234017c6a236b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Oct 3 16:28:54 2014 -0400

    GetSymName() not used.
    
    Change-Id: Ia369bf99a5e381a6f1f9c3d8a2499aa1780f04b8

diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index ea89378..15dedc5 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -120,7 +120,6 @@ public:
     virtual ~DynamicKernelArgument() { }
 
     virtual void GenSlidingWindowFunction( std::stringstream& ) { }
-    const std::string& GetSymName() const { return mSymName; }
     formula::FormulaToken* GetFormulaToken() const;
     virtual size_t GetWindowSize() const = 0;
     virtual std::string DumpOpName() const { return std::string(""); }
@@ -158,7 +157,6 @@ public:
     virtual ~VectorRef();
 
     virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE { }
-    const std::string& GetSymName() const { return mSymName; }
     virtual size_t GetWindowSize() const SAL_OVERRIDE;
     virtual std::string DumpOpName() const SAL_OVERRIDE { return std::string(""); }
     virtual void DumpInlineFun( std::set<std::string>&,
commit ae7901abd638df353ffb60052d7aceb44a08cfc4
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Oct 3 16:26:05 2014 -0400

    GetNameAsString() identical to GetName(). Remove this and use GetName().
    
    Change-Id: I26dce2dd11792ee118e78d23d652a5feb0789830

diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index d2ece0d..839b46c 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -5661,14 +5661,14 @@ void OpMedian::GenSlidingWindowFunction(
     ss << "    int nSize =endFlag- startFlag ;\n";
     ss << "    if (nSize & 1)\n";
     ss << "    {\n";
-    ss << "        tmp = "<<vSubArguments[0]->GetNameAsString();
+    ss << "        tmp = "<<vSubArguments[0]->GetName();
     ss << "        [startFlag+nSize/2];\n";
     ss << "    }\n";
     ss << "    else\n";
     ss << "    {\n";
-    ss << "        tmp =("<<vSubArguments[0]->GetNameAsString();
+    ss << "        tmp =("<<vSubArguments[0]->GetName();
     ss << "        [startFlag+nSize/2]+";
-    ss <<          vSubArguments[0]->GetNameAsString();
+    ss <<          vSubArguments[0]->GetName();
     ss << "        [startFlag+nSize/2-1])/2;\n";
     ss << "    }\n";
     ss <<"     return tmp;\n";
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 497af94..ea89378 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -88,7 +88,6 @@ class DynamicKernelArgument : boost::noncopyable
 public:
     DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft );
 
-    const std::string& GetNameAsString() const { return mSymName; }
     /// Generate declaration
     virtual void GenDecl( std::stringstream& ss ) const = 0;
 
@@ -145,7 +144,6 @@ class VectorRef : public DynamicKernelArgument
 public:
     VectorRef( const std::string& s, FormulaTreeNodeRef ft, int index = 0 );
 
-    const std::string& GetNameAsString() const { return mSymName; }
     /// Generate declaration
     virtual void GenDecl( std::stringstream& ss ) const SAL_OVERRIDE;
     /// When declared as input to a sliding window function
commit 0ae2d01cb86fc9c236be88530eba88c06a9511f4
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Oct 3 16:21:14 2014 -0400

    ( void ) -> ()
    
    Change-Id: I0d3d1d9ab5f7bc270c89a2a98d45ebea3cc37e02

diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx
index e1aef1f..f19e36e 100644
--- a/sc/source/core/opencl/opbase.cxx
+++ b/sc/source/core/opencl/opbase.cxx
@@ -94,7 +94,7 @@ void DynamicKernelArgument::GenDeclRef( std::stringstream& ss ) const
     ss << mSymName;
 }
 
-FormulaToken* DynamicKernelArgument::GetFormulaToken( void ) const
+FormulaToken* DynamicKernelArgument::GetFormulaToken() const
 {
     return mFormulaTree->GetFormulaToken();
 }
@@ -144,7 +144,7 @@ std::string VectorRef::GenSlidingWindowDeclRef( bool nested ) const
     return ss.str();
 }
 
-size_t VectorRef::GetWindowSize( void ) const
+size_t VectorRef::GetWindowSize() const
 {
     FormulaToken* pCur = mFormulaTree->GetFormulaToken();
     assert(pCur);
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 125d24d..497af94 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -73,7 +73,7 @@ public:
         Children.reserve(8);
     }
     std::vector<FormulaTreeNodeRef> Children;
-    formula::FormulaToken* GetFormulaToken( void ) const
+    formula::FormulaToken* GetFormulaToken() const
     {
         return const_cast<formula::FormulaToken*>(mpCurrentFormula.get());
     }
@@ -88,7 +88,7 @@ class DynamicKernelArgument : boost::noncopyable
 public:
     DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft );
 
-    const std::string& GetNameAsString( void ) const { return mSymName; }
+    const std::string& GetNameAsString() const { return mSymName; }
     /// Generate declaration
     virtual void GenDecl( std::stringstream& ss ) const = 0;
 
@@ -121,14 +121,14 @@ public:
     virtual ~DynamicKernelArgument() { }
 
     virtual void GenSlidingWindowFunction( std::stringstream& ) { }
-    const std::string& GetSymName( void ) const { return mSymName; }
-    formula::FormulaToken* GetFormulaToken( void ) const;
-    virtual size_t GetWindowSize( void ) const = 0;
-    virtual std::string DumpOpName( void ) const { return std::string(""); }
+    const std::string& GetSymName() const { return mSymName; }
+    formula::FormulaToken* GetFormulaToken() const;
+    virtual size_t GetWindowSize() const = 0;
+    virtual std::string DumpOpName() const { return std::string(""); }
     virtual void DumpInlineFun( std::set<std::string>&,
         std::set<std::string>& ) const { }
-    const std::string& GetName( void ) const { return mSymName; }
-    virtual bool NeedParallelReduction( void ) const { return false; }
+    const std::string& GetName() const { return mSymName; }
+    virtual bool NeedParallelReduction() const { return false; }
 
 protected:
     std::string mSymName;
@@ -145,7 +145,7 @@ class VectorRef : public DynamicKernelArgument
 public:
     VectorRef( const std::string& s, FormulaTreeNodeRef ft, int index = 0 );
 
-    const std::string& GetNameAsString( void ) const { return mSymName; }
+    const std::string& GetNameAsString() const { return mSymName; }
     /// Generate declaration
     virtual void GenDecl( std::stringstream& ss ) const SAL_OVERRIDE;
     /// When declared as input to a sliding window function
@@ -160,14 +160,14 @@ public:
     virtual ~VectorRef();
 
     virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE { }
-    const std::string& GetSymName( void ) const { return mSymName; }
-    virtual size_t GetWindowSize( void ) const SAL_OVERRIDE;
-    virtual std::string DumpOpName( void ) const SAL_OVERRIDE { return std::string(""); }
+    const std::string& GetSymName() const { return mSymName; }
+    virtual size_t GetWindowSize() const SAL_OVERRIDE;
+    virtual std::string DumpOpName() const SAL_OVERRIDE { return std::string(""); }
     virtual void DumpInlineFun( std::set<std::string>&,
         std::set<std::string>& ) const SAL_OVERRIDE { }
-    const std::string& GetName( void ) const { return mSymName; }
-    virtual cl_mem GetCLBuffer( void ) const { return mpClmem; }
-    virtual bool NeedParallelReduction( void ) const SAL_OVERRIDE { return false; }
+    const std::string& GetName() const { return mSymName; }
+    virtual cl_mem GetCLBuffer() const { return mpClmem; }
+    virtual bool NeedParallelReduction() const SAL_OVERRIDE { return false; }
 
 protected:
     // Used by marshaling
@@ -182,11 +182,11 @@ class OpBase
 public:
     typedef std::vector<std::string> ArgVector;
     typedef std::vector<std::string>::iterator ArgVectorIter;
-    virtual std::string GetBottom( void ) { return "";};
+    virtual std::string GetBottom() { return "";};
     virtual std::string Gen2( const std::string&/*lhs*/,
         const std::string&/*rhs*/ ) const { return "";}
     virtual std::string Gen( ArgVector& /*argVector*/ ) { return "";};
-    virtual std::string BinFuncName( void ) const { return "";};
+    virtual std::string BinFuncName() const { return "";};
     virtual void BinInlineFun( std::set<std::string>&,
         std::set<std::string>& ) { }
     virtual bool takeString() const = 0;
commit e5084fbf728e4eaff7cb67296222e6d54e3e4757
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 1 20:34:36 2014 -0400

    Be sure to copy the cell text attributes values to and from clip.
    
    Otherwise we'd have to unnecessarily re-calculate the script types again
    which is not cheap...
    
    Change-Id: Ie589fb4a7e5ec9b5ef646dabea4e6bd0c0aca560

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index b00bf92..e0fb0ec 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -983,6 +983,31 @@ public:
     }
 };
 
+class CopyTextAttrToClipHandler
+{
+    sc::CellTextAttrStoreType& mrDestAttrs;
+    sc::CellTextAttrStoreType::iterator miPos;
+
+public:
+    CopyTextAttrToClipHandler( sc::CellTextAttrStoreType& rAttrs ) :
+        mrDestAttrs(rAttrs), miPos(mrDestAttrs.begin()) {}
+
+    void operator() ( const sc::CellTextAttrStoreType::value_type& aNode, size_t nOffset, size_t nDataSize )
+    {
+        if (aNode.type != sc::element_type_celltextattr)
+            return;
+
+        sc::celltextattr_block::const_iterator it = sc::celltextattr_block::begin(*aNode.data);
+        std::advance(it, nOffset);
+        sc::celltextattr_block::const_iterator itEnd = it;
+        std::advance(itEnd, nDataSize);
+
+        size_t nPos = aNode.position + nOffset;
+        miPos = mrDestAttrs.set(miPos, nPos, it, itEnd);
+    }
+};
+
+
 }
 
 void ScColumn::CopyToClip(
@@ -991,8 +1016,15 @@ void ScColumn::CopyToClip(
     pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray,
                           rCxt.isKeepScenarioFlags() ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL );
 
-    CopyToClipHandler aFunc(*this, rColumn, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), rCxt.isCloneNotes());
-    sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2);
+    {
+        CopyToClipHandler aFunc(*this, rColumn, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), rCxt.isCloneNotes());
+        sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2);
+    }
+
+    {
+        CopyTextAttrToClipHandler aFunc(rColumn.maCellTextAttrs);
+        sc::ParseBlock(maCellTextAttrs.begin(), maCellTextAttrs, aFunc, nRow1, nRow2);
+    }
 
     rColumn.CellStorageModified();
 }
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 5723b73..225276a 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -950,6 +950,31 @@ public:
     }
 };
 
+class CopyTextAttrsFromClipHandler
+{
+    sc::CellTextAttrStoreType& mrAttrs;
+    sc::CellTextAttrStoreType::iterator miPos;
+    size_t mnDelta;
+
+public:
+    CopyTextAttrsFromClipHandler( sc::CellTextAttrStoreType& rAttrs, size_t nDelta ) :
+        mrAttrs(rAttrs), miPos(mrAttrs.begin()), mnDelta(nDelta) {}
+
+    void operator() ( const sc::CellTextAttrStoreType::value_type& aNode, size_t nOffset, size_t nDataSize )
+    {
+        if (aNode.type != sc::element_type_celltextattr)
+            return;
+
+        sc::celltextattr_block::const_iterator it = sc::celltextattr_block::begin(*aNode.data);
+        std::advance(it, nOffset);
+        sc::celltextattr_block::const_iterator itEnd = it;
+        std::advance(itEnd, nDataSize);
+
+        size_t nPos = aNode.position + nOffset + mnDelta;
+        miPos = mrAttrs.set(miPos, nPos, it, itEnd);
+    }
+};
+
 }
 
 //  rColumn = source
@@ -1001,6 +1026,10 @@ void ScColumn::CopyFromClip(
             SetFormulaCell(nDestRow, new ScFormulaCell(pDocument, aDestPos, aArr));
         }
 
+        // Don't forget to copy the cell text attributes.
+        CopyTextAttrsFromClipHandler aFunc(maCellTextAttrs, nDy);
+        sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
+
         return;
     }
 
@@ -1011,8 +1040,16 @@ void ScColumn::CopyFromClip(
 
     // nRow1 to nRow2 is for destination (this) column. Subtract nDy to get the source range.
     // Copy all cells in the source column (rColumn) from nRow1-nDy to nRow2-nDy to this column.
-    CopyCellsFromClipHandler aFunc(rCxt, rColumn, *this, nTab, nCol, nDy, pSharedStringPool);
-    sc::ParseBlock(rColumn.maCells.begin(), rColumn.maCells, aFunc, nRow1-nDy, nRow2-nDy);
+    {
+        CopyCellsFromClipHandler aFunc(rCxt, rColumn, *this, nTab, nCol, nDy, pSharedStringPool);
+        sc::ParseBlock(rColumn.maCells.begin(), rColumn.maCells, aFunc, nRow1-nDy, nRow2-nDy);
+    }
+
+    {
+        // Don't forget to copy the cell text attributes.
+        CopyTextAttrsFromClipHandler aFunc(maCellTextAttrs, nDy);
+        sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
+    }
 }
 
 void ScColumn::MixMarked(
commit 5156c5937b428b0923c7ede51bbbf9c407f68bc1
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 1 15:18:17 2014 -0400

    Set script type to latin for formula cells with numeric results.
    
    But only when the column contains only standard number format types.
    
    Change-Id: I83982d2e87f9776cf03754beaf183e35675be992

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 475bea3..98bfcba 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -289,6 +289,7 @@ public:
     bool            IsEmptyDisplayedAsString();
     bool            IsValue();      // also true if formula::svEmptyCell
     bool IsValueNoError();
+    bool IsValueNoError() const;
     bool            IsHybridValueCell(); // for cells after import to deal with inherited number formats
     double          GetValue();
     svl::SharedString GetString();
@@ -371,6 +372,8 @@ public:
     /** Determines whether or not the result string contains more than one paragraph */
     bool            IsMultilineResult();
 
+    bool NeedsInterpret() const;
+
     void            MaybeInterpret();
 
     /**
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 29f912f..625b92f 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -513,12 +513,43 @@ public:
 
         // Fill with default values for non-empty cell segments.
         sc::CellTextAttr aDefault;
-        if (node.type == sc::element_type_numeric)
+        switch (node.type)
         {
-            aDefault.mnScriptType = mpImpl->mnScriptNumeric;
-            const ColAttr* p = mrDocImpl.getColAttr(mnTab, mnCol);
-            if (p && p->mbLatinNumFmtOnly)
-                aDefault.mnScriptType = SCRIPTTYPE_LATIN;
+            case sc::element_type_numeric:
+            {
+                aDefault.mnScriptType = mpImpl->mnScriptNumeric;
+                const ColAttr* p = mrDocImpl.getColAttr(mnTab, mnCol);
+                if (p && p->mbLatinNumFmtOnly)
+                    aDefault.mnScriptType = SCRIPTTYPE_LATIN;
+            }
+            break;
+            case sc::element_type_formula:
+            {
+                const ColAttr* p = mrDocImpl.getColAttr(mnTab, mnCol);
+                if (p && p->mbLatinNumFmtOnly)
+                {
+                    // We can assume latin script type if the block only
+                    // contains formula cells with numeric results.
+                    ScFormulaCell** pp = &sc::formula_block::at(*node.data, 0);
+                    ScFormulaCell** ppEnd = pp + node.size;
+                    bool bNumResOnly = true;
+                    for (; pp != ppEnd; ++pp)
+                    {
+                        const ScFormulaCell& rCell = **pp;
+                        if (!rCell.IsValueNoError())
+                        {
+                            bNumResOnly = false;
+                            break;
+                        }
+                    }
+
+                    if (bNumResOnly)
+                        aDefault.mnScriptType = SCRIPTTYPE_LATIN;
+                }
+            }
+            break;
+            default:
+                ;
         }
 
         std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 33f64e9..c902788 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2218,15 +2218,20 @@ bool ScFormulaCell::IsMultilineResult()
     return false;
 }
 
-void ScFormulaCell::MaybeInterpret()
+bool ScFormulaCell::NeedsInterpret() const
 {
     if (mxGroup && mxGroup->meKernelState == sc::OpenCLKernelCompilationScheduled)
-        return;
+        return false;
 
     if (!IsDirtyOrInTableOpDirty())
-        return;
+        return false;
 
-    if (pDocument->GetAutoCalc() || (cMatrixFlag != MM_NONE))
+    return (pDocument->GetAutoCalc() || (cMatrixFlag != MM_NONE));
+}
+
+void ScFormulaCell::MaybeInterpret()
+{
+    if (NeedsInterpret())
         Interpret();
 }
 
@@ -2271,6 +2276,18 @@ bool ScFormulaCell::IsValueNoError()
     return aResult.IsValueNoError();
 }
 
+bool ScFormulaCell::IsValueNoError() const
+{
+    if (NeedsInterpret())
+        // false if the cell is dirty & needs to be interpreted.
+        return false;
+
+    if (pCode->GetCodeError())
+        return false;
+
+    return aResult.IsValueNoError();
+}
+
 bool ScFormulaCell::IsHybridValueCell()
 {
     return aResult.GetType() == formula::svHybridValueCell;
commit 90f2f3426773919bbc216253616239ba5d2d153b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 1 11:12:49 2014 -0400

    Exit early in case the column has no cell notes to copy to destination.
    
    Change-Id: Ifca77ccda7b2065b00ee29f29f377da599929843

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 3941cf8..b110be4 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1695,6 +1695,10 @@ public:
 void ScColumn::CopyCellNotesToDocument(
     SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption, SCROW nRowOffsetDest ) const
 {
+    if (IsNotesEmptyBlock(nRow1, nRow2))
+        // The column has no cell notes to copy between specified rows.
+        return;
+
     ScDrawLayer *pDrawLayer = rDestCol.GetDoc().GetDrawLayer();
     bool bWasLocked = bool();
     if (pDrawLayer)
commit beb2d06e2e016a393f3bf1735f5a632402cf7f13
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 30 23:28:41 2014 -0400

    Set latin script to numeric blocks of applicable columns.
    
    Change-Id: Ib81ef144f168fed38100127bd63f43ea5a835a13

diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index e27a38a..29f912f 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -23,6 +23,27 @@
 #include <attarray.hxx>
 
 #include <svl/sharedstringpool.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <vector>
+
+namespace {
+
+struct ColAttr
+{
+    bool mbLatinNumFmtOnly;
+
+    ColAttr() : mbLatinNumFmtOnly(false) {}
+};
+
+struct TabAttr
+{
+    std::vector<ColAttr> maCols;
+};
+
+typedef std::vector<TabAttr> TabAttrsType;
+
+}
 
 struct ScDocumentImportImpl
 {
@@ -31,11 +52,28 @@ struct ScDocumentImportImpl
     sc::ColumnBlockPositionSet maBlockPosSet;
     sal_uInt16 mnDefaultScriptNumeric;
 
+    TabAttrsType maTabAttrs;
+
     ScDocumentImportImpl(ScDocument& rDoc) :
         mrDoc(rDoc),
         maListenCxt(rDoc),
         maBlockPosSet(rDoc),
         mnDefaultScriptNumeric(SC_SCRIPTTYPE_UNKNOWN) {}
+
+    ColAttr* getColAttr( size_t nTab, size_t nCol )
+    {
+        if (nTab > static_cast<size_t>(MAXTAB) || nCol > static_cast<size_t>(MAXCOL))
+            return NULL;
+
+        if (nTab >= maTabAttrs.size())
+            maTabAttrs.resize(nTab+1);
+
+        TabAttr& rTab = maTabAttrs[nTab];
+        if (nCol >= rTab.maCols.size())
+            rTab.maCols.resize(nCol+1);
+
+        return &rTab.maCols[nCol];
+    }
 };
 
 ScDocumentImport::Attrs::Attrs() : mpData(NULL), mnSize(0), mbLatinNumFmtOnly(false) {}
@@ -421,6 +459,10 @@ void ScDocumentImport::setAttrEntries( SCTAB nTab, SCCOL nCol, Attrs& rAttrs )
     if (!pCol)
         return;
 
+    ColAttr* pColAttr = mpImpl->getColAttr(nTab, nCol);
+    if (pColAttr)
+        pColAttr->mbLatinNumFmtOnly = rAttrs.mbLatinNumFmtOnly;
+
     pCol->pAttrArray->SetAttrEntries(rAttrs.mpData, rAttrs.mnSize);
 }
 
@@ -450,14 +492,16 @@ class CellStoreInitializer
         {}
     };
 
-    ScDocument& mrDoc;
-    sc::StartListeningContext& mrListenCxt;
+    ScDocumentImportImpl& mrDocImpl;
+    SCTAB mnTab;
+    SCCOL mnCol;
 
 public:
-    CellStoreInitializer(ScDocument& rDoc, sc::StartListeningContext& rCxt, sal_uInt16 nScriptNumeric) :
-        mrDoc(rDoc),
-        mrListenCxt(rCxt),
-        mpImpl(new Impl(MAXROWCOUNT, nScriptNumeric))
+    CellStoreInitializer( ScDocumentImportImpl& rDocImpl, SCTAB nTab, SCCOL nCol ) :
+        mrDocImpl(rDocImpl),
+        mnTab(nTab),
+        mnCol(nCol),
+        mpImpl(new Impl(MAXROWCOUNT, mrDocImpl.mnDefaultScriptNumeric))
     {}
 
     boost::shared_ptr<Impl> mpImpl;
@@ -470,7 +514,13 @@ public:
         // Fill with default values for non-empty cell segments.
         sc::CellTextAttr aDefault;
         if (node.type == sc::element_type_numeric)
+        {
             aDefault.mnScriptType = mpImpl->mnScriptNumeric;
+            const ColAttr* p = mrDocImpl.getColAttr(mnTab, mnCol);
+            if (p && p->mbLatinNumFmtOnly)
+                aDefault.mnScriptType = SCRIPTTYPE_LATIN;
+        }
+
         std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
         mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, node.position, aDefaults.begin(), aDefaults.end());
 
@@ -482,7 +532,7 @@ public:
             for (; it != itEnd; ++it)
             {
                 ScFormulaCell& rFC = **it;
-                rFC.StartListeningTo(mrListenCxt);
+                rFC.StartListeningTo(mrDocImpl.maListenCxt);
             }
         }
     }
@@ -515,7 +565,7 @@ void ScDocumentImport::finalize()
 
 void ScDocumentImport::initColumn(ScColumn& rCol)
 {
-    CellStoreInitializer aFunc(mpImpl->mrDoc, mpImpl->maListenCxt, mpImpl->mnDefaultScriptNumeric);
+    CellStoreInitializer aFunc(*mpImpl, rCol.nTab, rCol.nCol);
     std::for_each(rCol.maCells.begin(), rCol.maCells.end(), aFunc);
     aFunc.swap(rCol.maCellTextAttrs);
     rCol.RegroupFormulaCells();
commit a4b7d8a40106300b3eb95e1be3e4468e9fb8741f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 30 22:23:16 2014 -0400

    Check for standard number format rather than just for 'General'.
    
    That's what the ods import filter does.
    
    Change-Id: Ibcd9a80a51785a448594d29a02283cca0ec53e95

diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index dc064ee..e561fcd 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -49,7 +49,7 @@ public:
         ScAttrEntry* mpData;
         size_t mnSize;
 
-        bool mbGeneralNumFmtOnly;
+        bool mbLatinNumFmtOnly;
 
         Attrs();
     };
diff --git a/sc/inc/numformat.hxx b/sc/inc/numformat.hxx
index 40d9561..7293818 100644
--- a/sc/inc/numformat.hxx
+++ b/sc/inc/numformat.hxx
@@ -35,6 +35,8 @@ public:
      * latin script output.
      */
     static bool isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc );
+
+    static bool isLatinScript( sal_uLong nFormat, ScDocument& rDoc );
 };
 
 }
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 09cacec..e27a38a 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -38,7 +38,7 @@ struct ScDocumentImportImpl
         mnDefaultScriptNumeric(SC_SCRIPTTYPE_UNKNOWN) {}
 };
 
-ScDocumentImport::Attrs::Attrs() : mpData(NULL), mnSize(0), mbGeneralNumFmtOnly(true) {}
+ScDocumentImport::Attrs::Attrs() : mpData(NULL), mnSize(0), mbLatinNumFmtOnly(false) {}
 
 ScDocumentImport::ScDocumentImport(ScDocument& rDoc) : mpImpl(new ScDocumentImportImpl(rDoc)) {}
 ScDocumentImport::~ScDocumentImport()
diff --git a/sc/source/core/tool/numformat.cxx b/sc/source/core/tool/numformat.cxx
index 1961125..a889ab8 100644
--- a/sc/source/core/tool/numformat.cxx
+++ b/sc/source/core/tool/numformat.cxx
@@ -49,7 +49,13 @@ bool NumFmtUtil::isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc )
 {
     SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
     sal_uInt32 nKey = rPat.GetNumberFormat(pFormatter);
-    const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
+    return isLatinScript(nKey, rDoc);
+}
+
+bool NumFmtUtil::isLatinScript( sal_uLong nFormat, ScDocument& rDoc )
+{
+    SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
+    const SvNumberformat* pFormat = pFormatter->GetEntry(nFormat);
     if (!pFormat || !pFormat->IsStandard())
         return false;
 
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 271c41c..7349a8e 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1990,7 +1990,7 @@ void XclImpXFRangeBuffer::Finalize()
             aAttrParam.mnSize = aAttrs.size();
             assert(aAttrParam.mnSize > 0);
             aAttrParam.mpData = new ScAttrEntry[aAttrParam.mnSize];
-            aAttrParam.mbGeneralNumFmtOnly = false; // when unsure, set it to false.
+            aAttrParam.mbLatinNumFmtOnly = false; // when unsure, set it to false.
             list<ScAttrEntry>::const_iterator itr = aAttrs.begin(), itrEnd = aAttrs.end();
             for (size_t i = 0; itr != itrEnd; ++itr, ++i)
                 aAttrParam.mpData[i] = *itr;
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index bde631d..4502e04 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -640,7 +640,7 @@ public:
     struct AttrList
     {
         std::list<ScAttrEntry> maAttrs;
-        bool mbGeneralNumFmtOnly;
+        bool mbLatinNumFmtOnly;
 
         AttrList();
     };
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index e5f4e92..7cdf627 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -54,6 +54,7 @@
 #include "paramisc.hxx"
 #include "documentimport.hxx"
 #include "formulabuffer.hxx"
+#include <numformat.hxx>
 
 namespace oox {
 namespace xls {
@@ -477,12 +478,15 @@ void SheetDataBuffer::finalizeImport()
             aEntry.pPattern = rDoc.getDoc().GetPattern(nScCol, 0, getSheetIndex());
             rDoc.getDoc().GetPool()->Put(*aEntry.pPattern);
             aAttrs.maAttrs.push_back(aEntry);
+
+            if (!sc::NumFmtUtil::isLatinScript(*aEntry.pPattern, rDoc.getDoc()))
+                aAttrs.mbLatinNumFmtOnly = false;
         }
 
         ScDocumentImport::Attrs aAttrParam;
         aAttrParam.mnSize = aAttrs.maAttrs.size();
         aAttrParam.mpData = new ScAttrEntry[aAttrParam.mnSize];
-        aAttrParam.mbGeneralNumFmtOnly = aAttrs.mbGeneralNumFmtOnly;
+        aAttrParam.mbLatinNumFmtOnly = aAttrs.mbLatinNumFmtOnly;
         std::list<ScAttrEntry>::const_iterator itr = aAttrs.maAttrs.begin(), itrEnd = aAttrs.maAttrs.end();
         for (size_t i = 0; itr != itrEnd; ++itr, ++i)
             aAttrParam.mpData[i] = *itr;
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 9cb8c46..498241f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2054,7 +2054,7 @@ XfModel::XfModel() :
 {
 }
 
-Xf::AttrList::AttrList() : mbGeneralNumFmtOnly(true) {}
+Xf::AttrList::AttrList() : mbLatinNumFmtOnly(true) {}
 
 Xf::Xf( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
@@ -2165,8 +2165,8 @@ void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal
         rPat.GetItemSet().Put(aNumPat.GetItemSet());
     }
 
-    if (!sc::NumFmtUtil::isGeneral(mnScNumFmt))
-        rAttrs.mbGeneralNumFmtOnly = false;
+    if (!sc::NumFmtUtil::isLatinScript(mnScNumFmt, rDoc))
+        rAttrs.mbLatinNumFmtOnly = false;
 
     if (rPat.GetStyleName())
     {
@@ -2188,8 +2188,8 @@ void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal
             rAttrs.maAttrs.push_back(aEntry);
 
             // Check if the default pattern is 'General'.
-            if (!sc::NumFmtUtil::isGeneral(*aEntry.pPattern))
-                rAttrs.mbGeneralNumFmtOnly = false;
+            if (!sc::NumFmtUtil::isLatinScript(*aEntry.pPattern, rDoc))
+                rAttrs.mbLatinNumFmtOnly = false;
         }
 
         ScAttrEntry aEntry;
@@ -2197,8 +2197,8 @@ void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal
         aEntry.pPattern = static_cast<const ScPatternAttr*>(&rDoc.GetPool()->Put(rPat));
         rAttrs.maAttrs.push_back(aEntry);
 
-        if (!sc::NumFmtUtil::isGeneral(*aEntry.pPattern))
-            rAttrs.mbGeneralNumFmtOnly = false;
+        if (!sc::NumFmtUtil::isLatinScript(*aEntry.pPattern, rDoc))
+            rAttrs.mbLatinNumFmtOnly = false;
     }
 }
 
commit bc1dd8feb80a51109c99c6cb176f5fd16ace5a1e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 30 22:00:05 2014 -0400

    Move this useful function to sc::NumFmtUtil.
    
    Change-Id: I7b42a4418408ee2c988c32e7f1adeee3dfe269c8

diff --git a/sc/inc/numformat.hxx b/sc/inc/numformat.hxx
index 0bf4930..40d9561 100644
--- a/sc/inc/numformat.hxx
+++ b/sc/inc/numformat.hxx
@@ -15,6 +15,7 @@
 #include <tools/solar.h>
 
 class ScPatternAttr;
+class ScDocument;
 
 namespace sc {
 
@@ -28,6 +29,12 @@ public:
     static bool isGeneral( sal_uLong nFormat );
 
     static bool isGeneral( const ScPatternAttr& rPat );
+
+    /**
+     * Check if the attribute pattern has a number format that only produces
+     * latin script output.
+     */
+    static bool isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc );
 };
 
 }
diff --git a/sc/source/core/tool/numformat.cxx b/sc/source/core/tool/numformat.cxx
index 505bf6f..1961125 100644
--- a/sc/source/core/tool/numformat.cxx
+++ b/sc/source/core/tool/numformat.cxx
@@ -5,14 +5,27 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
 #include <numformat.hxx>
 #include <patattr.hxx>
 #include <scitems.hxx>
+#include <document.hxx>
 
 #include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
 #include <svl/intitem.hxx>
+#include <svl/languageoptions.hxx>
 
 namespace sc {
 
@@ -32,6 +45,32 @@ bool NumFmtUtil::isGeneral( const ScPatternAttr& rPat )
     return isGeneral(nNumFmt);
 }
 
+bool NumFmtUtil::isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc )
+{
+    SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
+    sal_uInt32 nKey = rPat.GetNumberFormat(pFormatter);
+    const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
+    if (!pFormat || !pFormat->IsStandard())
+        return false;
+
+    // The standard format is all-latin if the decimal separator doesn't
+    // have a different script type
+
+    OUString aDecSep;
+    LanguageType nFormatLang = pFormat->GetLanguage();
+    if (nFormatLang == LANGUAGE_SYSTEM)
+        aDecSep = ScGlobal::pLocaleData->getNumDecimalSep();
+    else
+    {
+        LocaleDataWrapper aLocaleData(
+            comphelper::getProcessComponentContext(), LanguageTag(nFormatLang));
+        aDecSep = aLocaleData.getNumDecimalSep();
+    }
+
+    sal_uInt8 nScript = rDoc.GetStringScriptType(aDecSep);
+    return (nScript == 0 || nScript == SCRIPTTYPE_LATIN);
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 73080e9..aefb1a9 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -73,6 +73,7 @@
 #include "documentimport.hxx"
 #include "pivotsource.hxx"
 #include <unonames.hxx>
+#include <numformat.hxx>
 
 #include <comphelper/extract.hxx>
 
@@ -2441,32 +2442,8 @@ void ScXMLImport::ExamineDefaultStyle()
         // number format (then, value cells can be pre-initialized with western script type)
 
         const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
-        SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-        if ( pFormatter && pDefPattern )
-        {
-            sal_uInt32 nKey = pDefPattern->GetNumberFormat(pFormatter);
-            const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
-            if ( pFormat && pFormat->IsStandard() )
-            {
-                // The standard format is all-latin if the decimal separator doesn't
-                // have a different script type
-
-                OUString aDecSep;
-                LanguageType nFormatLang = pFormat->GetLanguage();
-                if ( nFormatLang == LANGUAGE_SYSTEM )
-                    aDecSep = ScGlobal::pLocaleData->getNumDecimalSep();
-                else
-                {
-                    LocaleDataWrapper aLocaleData( comphelper::getProcessComponentContext(),
-                        LanguageTag( nFormatLang ) );
-                    aDecSep = aLocaleData.getNumDecimalSep();
-                }
-
-                sal_uInt8 nScript = pDoc->GetStringScriptType( aDecSep );
-                if ( nScript == 0 || nScript == SCRIPTTYPE_LATIN )
-                    mpDocImport->setDefaultNumericScript(SCRIPTTYPE_LATIN);
-            }
-        }
+        if (pDefPattern && sc::NumFmtUtil::isLatinScript(*pDefPattern, *pDoc))
+            mpDocImport->setDefaultNumericScript(SCRIPTTYPE_LATIN);
     }
 }
 
commit f1fcac4bc93d895307fad194988c4a024034dd5d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 30 21:30:17 2014 -0400

    Try to determine whether or not a column has all 'General' number format
    
    during import.  We'll then use this information to set script type to latin
    for all numeric cells in those columns rather than leaving the script type
    'unknown'.
    
    Change-Id: I69eae1effc32c57290b0265bc6c87e58f51944b1

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index cdd4228..5a7c03b 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -240,6 +240,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/core/tool/listenerquery \
     sc/source/core/tool/lookupcache \
     sc/source/core/tool/navicfg \
+    sc/source/core/tool/numformat \
     sc/source/core/tool/odffmap \
     sc/source/core/tool/optutil \
     sc/source/core/tool/orcusxml \
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index 621d222..dc064ee 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -43,6 +43,17 @@ class SC_DLLPUBLIC ScDocumentImport : boost::noncopyable
     ScDocumentImport(); // disabled
 
 public:
+
+    struct SC_DLLPUBLIC Attrs
+    {
+        ScAttrEntry* mpData;
+        size_t mnSize;
+
+        bool mbGeneralNumFmtOnly;
+
+        Attrs();
+    };
+
     ScDocumentImport(ScDocument& rDoc);
     ~ScDocumentImport();
 
@@ -87,7 +98,7 @@ public:
      * transfers the ownership of the ScAttrEntry array from the caller to the
      * column.
      */
-    void setAttrEntries( SCTAB nTab, SCCOL nCol, ScAttrEntry* pData, size_t nSize );
+    void setAttrEntries( SCTAB nTab, SCCOL nCol, Attrs& rAttrs );
 
     void finalize();
 
diff --git a/sc/inc/numformat.hxx b/sc/inc/numformat.hxx
new file mode 100644
index 0000000..0bf4930
--- /dev/null
+++ b/sc/inc/numformat.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_NUMFORMAT_HXX
+#define INCLUDED_SC_NUMFORMAT_HXX
+
+#include <scdllapi.h>
+
+#include <tools/solar.h>
+
+class ScPatternAttr;
+
+namespace sc {
+
+class SC_DLLPUBLIC NumFmtUtil
+{
+public:
+
+    /**
+     * Return whether or not given number format is a 'General' number format.
+     */
+    static bool isGeneral( sal_uLong nFormat );
+
+    static bool isGeneral( const ScPatternAttr& rPat );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 17c8e4d..09cacec 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -38,6 +38,8 @@ struct ScDocumentImportImpl
         mnDefaultScriptNumeric(SC_SCRIPTTYPE_UNKNOWN) {}
 };
 
+ScDocumentImport::Attrs::Attrs() : mpData(NULL), mnSize(0), mbGeneralNumFmtOnly(true) {}
+
 ScDocumentImport::ScDocumentImport(ScDocument& rDoc) : mpImpl(new ScDocumentImportImpl(rDoc)) {}
 ScDocumentImport::~ScDocumentImport()
 {
@@ -409,7 +411,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
     }
 }
 
-void ScDocumentImport::setAttrEntries( SCTAB nTab, SCCOL nCol, ScAttrEntry* pData, size_t nSize )
+void ScDocumentImport::setAttrEntries( SCTAB nTab, SCCOL nCol, Attrs& rAttrs )
 {
     ScTable* pTab = mpImpl->mrDoc.FetchTable(nTab);
     if (!pTab)
@@ -419,7 +421,7 @@ void ScDocumentImport::setAttrEntries( SCTAB nTab, SCCOL nCol, ScAttrEntry* pDat
     if (!pCol)
         return;
 
-    pCol->pAttrArray->SetAttrEntries(pData, nSize);
+    pCol->pAttrArray->SetAttrEntries(rAttrs.mpData, rAttrs.mnSize);
 }
 
 namespace {
diff --git a/sc/source/core/tool/numformat.cxx b/sc/source/core/tool/numformat.cxx
new file mode 100644
index 0000000..505bf6f
--- /dev/null
+++ b/sc/source/core/tool/numformat.cxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <numformat.hxx>
+#include <patattr.hxx>
+#include <scitems.hxx>
+
+#include <svl/zforlist.hxx>
+#include <svl/intitem.hxx>
+
+namespace sc {
+
+bool NumFmtUtil::isGeneral( sal_uLong nFormat )
+{
+    return (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0;
+}
+
+bool NumFmtUtil::isGeneral( const ScPatternAttr& rPat )
+{
+    const SfxPoolItem* pItem = NULL;
+    if (!rPat.GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem))
+        // Assume it's 'General' when the number format is not explicitly set.
+        return true;
+
+    sal_uInt32 nNumFmt = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
+    return isGeneral(nNumFmt);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 1e5c236..271c41c 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1986,14 +1986,16 @@ void XclImpXFRangeBuffer::Finalize()
                 aAttrs.push_back(aEntry);
             }
 
-            size_t nAttrSize = aAttrs.size();
-            assert(nAttrSize > 0);
-            ScAttrEntry* pData = new ScAttrEntry[nAttrSize];
+            ScDocumentImport::Attrs aAttrParam;
+            aAttrParam.mnSize = aAttrs.size();
+            assert(aAttrParam.mnSize > 0);
+            aAttrParam.mpData = new ScAttrEntry[aAttrParam.mnSize];
+            aAttrParam.mbGeneralNumFmtOnly = false; // when unsure, set it to false.
             list<ScAttrEntry>::const_iterator itr = aAttrs.begin(), itrEnd = aAttrs.end();
             for (size_t i = 0; itr != itrEnd; ++itr, ++i)
-                pData[i] = *itr;
+                aAttrParam.mpData[i] = *itr;
 
-            rDoc.setAttrEntries(nScTab, nScCol, pData, static_cast<SCSIZE>(nAttrSize));
+            rDoc.setAttrEntries(nScTab, nScCol, aAttrParam);
         }
     }
 
diff --git a/sc/source/filter/inc/numberformatsbuffer.hxx b/sc/source/filter/inc/numberformatsbuffer.hxx
index e75caa6..3a79075 100644
--- a/sc/source/filter/inc/numberformatsbuffer.hxx
+++ b/sc/source/filter/inc/numberformatsbuffer.hxx
@@ -71,7 +71,7 @@ public:
     sal_Int32           finalizeImport(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& rxNumFmts,
                             const ::com::sun::star::lang::Locale& rFromLocale );
-    void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
+    sal_uLong fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
     /** Writes the number format to the passed property map. */
     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
 
@@ -98,7 +98,7 @@ public:
     /** Final processing after import of all style settings. */
     void                finalizeImport();
 
-    void                fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs = false ) const;
+    sal_uLong           fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs = false ) const;
 
     /** Writes the specified number format to the passed property map. */
     void                writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const;
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 3e1eadf..bde631d 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -637,6 +637,14 @@ class Xf : public WorkbookHelper
 {
     friend bool operator==( const Xf& rXf1,  const Xf& rXf2 );
 public:
+    struct AttrList
+    {
+        std::list<ScAttrEntry> maAttrs;
+        bool mbGeneralNumFmtOnly;
+
+        AttrList();
+    };
+
     explicit            Xf( const WorkbookHelper& rHelper );
 
     /** Sets all attributes from the xf element. */
@@ -662,8 +670,9 @@ public:
     /** Returns the cell protection data of this style. */
     inline const Protection& getProtection() const { return maProtection; }
 
-    void  applyPatternToAttrList( ::std::list<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2,
-                                  sal_Int32 nForceScNumFmt );
+    void applyPatternToAttrList(
+        AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nForceScNumFmt );
+
     /** Writes all formatting attributes to the passed property map. */
     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
     /** Writes all formatting attributes to the passed property set. */
@@ -677,6 +686,7 @@ private:
     typedef ::std::unique_ptr< ::ScPatternAttr > ScPatternAttrPtr;
 
     ScPatternAttrPtr    mpPattern;          /// Calc item set.
+    sal_uLong           mnScNumFmt;         /// Calc number format.
 
     XfModel             maModel;            /// Cell XF or style XF model data.
     Alignment           maAlignment;        /// Cell alignment data.
@@ -902,7 +912,7 @@ public:
     void                writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs = false ) const;
     /** Writes the font attributes of the specified font data to the passed property map. */
     void                writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const;
-    void                writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs = false ) const;
+    sal_uLong           writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs = false ) const;
     /** Writes the specified number format to the passed property map. */
     void                writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const;
     void                writeBorderToItemSet( SfxItemSet& rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs = false ) const;
diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx
index 04202cc..d0d3c37 100644
--- a/sc/source/filter/oox/numberformatsbuffer.cxx
+++ b/sc/source/filter/oox/numberformatsbuffer.cxx
@@ -1911,16 +1911,21 @@ sal_Int32 NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNum
     return maApiData.mnIndex;
 }
 
-void NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
+sal_uLong NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
 {
     const ScDocument& rDoc = getScDocument();
     static sal_uLong  nDflt = rDoc.GetFormatTable()->GetStandardFormat( ScGlobal::eLnge );
     sal_uLong nScNumFmt = nDflt;
     if ( maApiData.mnIndex )
         nScNumFmt = maApiData.mnIndex;
+
     ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
     if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SfxItemState::SET )
         ScGlobal::AddLanguage( rItemSet, *(rDoc.GetFormatTable()) );
+    else
+        nScNumFmt = 0;
+
+    return nScNumFmt;
 }
 
 void NumberFormat::writeToPropertyMap( PropertyMap& rPropMap ) const
@@ -1976,10 +1981,13 @@ void NumberFormatsBuffer::finalizeImport()
     maNumFmts.forEach( NumberFormatFinalizer( *this ) );
 }
 
-void NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
+sal_uLong NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
 {
-    if( const NumberFormat* pNumFmt = maNumFmts.get( nNumFmtId ).get() )
-        pNumFmt->fillToItemSet( rItemSet, bSkipPoolDefs);
+    const NumberFormat* pNumFmt = maNumFmts.get(nNumFmtId).get();
+    if (!pNumFmt)
+        return 0;
+
+    return pNumFmt->fillToItemSet( rItemSet, bSkipPoolDefs);
 }
 
 void NumberFormatsBuffer::writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index adaaf5e..e5f4e92 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -461,7 +461,7 @@ void SheetDataBuffer::finalizeImport()
     for ( ColStyles::iterator col = maStylesPerColumn.begin(), col_end = maStylesPerColumn.end(); col != col_end; ++col )
     {
         RowStyles& rRowStyles = col->second;
-        std::list<ScAttrEntry> aAttrs;
+        Xf::AttrList aAttrs;
         SCCOL nScCol = static_cast< SCCOL >( col->first );
         for ( RowStyles::iterator rRows = rRowStyles.begin(), rRows_end = rRowStyles.end(); rRows != rRows_end; ++rRows )
         {
@@ -470,22 +470,24 @@ void SheetDataBuffer::finalizeImport()
              if ( pXf )
                  pXf->applyPatternToAttrList( aAttrs,  rRows->mnStartRow,  rRows->mnEndRow,  rRows->mnNumFmt.second );
         }
-        if (aAttrs.empty() || aAttrs.back().nRow != MAXROW)
+        if (aAttrs.maAttrs.empty() || aAttrs.maAttrs.back().nRow != MAXROW)
         {
             ScAttrEntry aEntry;
             aEntry.nRow = MAXROW;
             aEntry.pPattern = rDoc.getDoc().GetPattern(nScCol, 0, getSheetIndex());
             rDoc.getDoc().GetPool()->Put(*aEntry.pPattern);
-            aAttrs.push_back(aEntry);
+            aAttrs.maAttrs.push_back(aEntry);
         }
 
-        size_t nAttrSize = aAttrs.size();
-        ScAttrEntry* pData = new ScAttrEntry[nAttrSize];
-        std::list<ScAttrEntry>::const_iterator itr = aAttrs.begin(), itrEnd = aAttrs.end();
+        ScDocumentImport::Attrs aAttrParam;
+        aAttrParam.mnSize = aAttrs.maAttrs.size();
+        aAttrParam.mpData = new ScAttrEntry[aAttrParam.mnSize];
+        aAttrParam.mbGeneralNumFmtOnly = aAttrs.mbGeneralNumFmtOnly;
+        std::list<ScAttrEntry>::const_iterator itr = aAttrs.maAttrs.begin(), itrEnd = aAttrs.maAttrs.end();
         for (size_t i = 0; itr != itrEnd; ++itr, ++i)
-            pData[i] = *itr;
+            aAttrParam.mpData[i] = *itr;
 
-        rDoc.setAttrEntries(getSheetIndex(), nScCol, pData, static_cast<SCSIZE>(nAttrSize));
+        rDoc.setAttrEntries(getSheetIndex(), nScCol, aAttrParam);
     }
 
     // merge all cached merged ranges and update right/bottom cell borders
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 210dec2..9cb8c46 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -78,6 +78,7 @@
 #include "globstr.hrc"
 #include "xlconst.hxx"
 #include <documentimport.hxx>
+#include <numformat.hxx>
 
 using ::com::sun::star::table::BorderLine2;
 namespace oox {
@@ -2053,8 +2054,11 @@ XfModel::XfModel() :
 {
 }
 
+Xf::AttrList::AttrList() : mbGeneralNumFmtOnly(true) {}
+
 Xf::Xf( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
+    mnScNumFmt(0),
     maAlignment( rHelper ),
     maProtection( rHelper ),
     meRotationRef( ::com::sun::star::table::CellVertJustify2::STANDARD ),
@@ -2124,8 +2128,7 @@ FontRef Xf::getFont() const
     return getStyles().getFont( maModel.mnFontId );
 }
 
-void Xf::applyPatternToAttrList( ::std::list<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2,
-                                  sal_Int32 nNumFmtId )
+void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nNumFmtId )
 {
     createPattern();
     ScPatternAttr& rPat = *mpPattern;
@@ -2158,18 +2161,22 @@ void Xf::applyPatternToAttrList( ::std::list<ScAttrEntry>& rAttrs, SCROW nRow1,
     if ( nNumFmtId >= 0 )
     {
         ScPatternAttr aNumPat(rDoc.GetPool());
-        getStyles().writeNumFmtToItemSet( aNumPat.GetItemSet(), nNumFmtId );
+        mnScNumFmt = getStyles().writeNumFmtToItemSet( aNumPat.GetItemSet(), nNumFmtId );
         rPat.GetItemSet().Put(aNumPat.GetItemSet());
     }
+
+    if (!sc::NumFmtUtil::isGeneral(mnScNumFmt))
+        rAttrs.mbGeneralNumFmtOnly = false;
+
     if (rPat.GetStyleName())
     {
         // Check for a gap between the last entry and this one.
         bool bHasGap = false;
-        if (rAttrs.empty() && nRow1 > 0)
+        if (rAttrs.maAttrs.empty() && nRow1 > 0)
             // First attribute range doesn't start at row 0.
             bHasGap = true;
 
-        if (!rAttrs.empty() && rAttrs.back().nRow + 1 < nRow1)
+        if (!rAttrs.maAttrs.empty() && rAttrs.maAttrs.back().nRow + 1 < nRow1)
             bHasGap = true;
 
         if (bHasGap)
@@ -2178,13 +2185,20 @@ void Xf::applyPatternToAttrList( ::std::list<ScAttrEntry>& rAttrs, SCROW nRow1,
             ScAttrEntry aEntry;
             aEntry.nRow = nRow1 - 1;
             aEntry.pPattern = rDoc.GetDefPattern();
-            rAttrs.push_back(aEntry);
+            rAttrs.maAttrs.push_back(aEntry);
+
+            // Check if the default pattern is 'General'.
+            if (!sc::NumFmtUtil::isGeneral(*aEntry.pPattern))
+                rAttrs.mbGeneralNumFmtOnly = false;
         }
 
         ScAttrEntry aEntry;
         aEntry.nRow = nRow2;
         aEntry.pPattern = static_cast<const ScPatternAttr*>(&rDoc.GetPool()->Put(rPat));
-        rAttrs.push_back(aEntry);
+        rAttrs.maAttrs.push_back(aEntry);
+
+        if (!sc::NumFmtUtil::isGeneral(*aEntry.pPattern))
+            rAttrs.mbGeneralNumFmtOnly = false;
     }
 }
 
@@ -2307,7 +2321,7 @@ Xf::createPattern( bool bSkipPoolDefs )
     // value format
     if( maModel.mbNumFmtUsed )
     {
-        rStyles.writeNumFmtToItemSet( rItemSet, maModel.mnNumFmtId, bSkipPoolDefs );
+        mnScNumFmt = rStyles.writeNumFmtToItemSet( rItemSet, maModel.mnNumFmtId, bSkipPoolDefs );
     }
     // alignment
     if( maModel.mbAlignUsed )
@@ -3107,9 +3121,9 @@ void StylesBuffer::writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFon
         pFont->writeToPropertyMap( rPropMap, FONT_PROPTYPE_CELL );
 }
 
-void StylesBuffer::writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
+sal_uLong StylesBuffer::writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
 {
-    maNumFmts.fillToItemSet( rItemSet, nNumFmtId, bSkipPoolDefs );
+    return maNumFmts.fillToItemSet( rItemSet, nNumFmtId, bSkipPoolDefs );
 }
 
 void StylesBuffer::writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const
commit e0d62d8ef7ec781ded59c2453d817eb9022b4bf3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 30 14:52:52 2014 -0400

    Move SetAttrEntries from ScDocument to ScDocumentImport.
    
    Since that method was really an optimization for xls(x) import code.
    
    Change-Id: Ie2530f5dc27411bd45d72440681689c6c7a8b10a

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index fbf11d5..f21ab07 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -411,7 +411,6 @@ public:
     void        ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
     void        ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
                                   ScEditDataArray* pDataArray = NULL );
-    bool        SetAttrEntries(ScAttrEntry* pData, SCSIZE nSize);
     void        SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, bool bPutToPool = false );
     void        SetPatternArea( SCROW nStartRow, SCROW nEndRow,
                                 const ScPatternAttr& rPatAttr, bool bPutToPool = false );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 9a79674..0fb3922 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1428,8 +1428,6 @@ public:
                                             SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
                                             const ScPatternAttr& rAttr );
 
-    SC_DLLPUBLIC bool SetAttrEntries(SCCOL nCol, SCTAB nTab, ScAttrEntry* pData, SCSIZE nSize);
-
     SC_DLLPUBLIC void           ApplyPatternIfNumberformatIncompatible(
                             const ScRange& rRange, const ScMarkData& rMark,
                             const ScPatternAttr& rPattern, short nNewType );
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index 4b84f0d..621d222 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -21,6 +21,7 @@ class EditTextObject;
 class ScDocument;
 class ScColumn;
 class ScAddress;
+struct ScAttrEntry;
 class ScTokenArray;
 class ScFormulaCell;
 class ScStyleSheet;
@@ -81,6 +82,13 @@ public:
 
     void setTableOpCells(const ScRange& rRange, const ScTabOpParam& rParam);
 
+    /**
+     * Set an array of cell attributes to specified column.  This call
+     * transfers the ownership of the ScAttrEntry array from the caller to the
+     * column.
+     */
+    void setAttrEntries( SCTAB nTab, SCCOL nCol, ScAttrEntry* pData, size_t nSize );
+
     void finalize();
 
 private:
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 3b33c65..bec3bec 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -610,7 +610,6 @@ public:
     void        ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
     void        ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
                                   const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
-    bool        SetAttrEntries(SCCOL nCol, ScAttrEntry* pData, SCSIZE nSize);
 
     void        SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, bool bPutToPool = false )
                     {
@@ -1098,6 +1097,9 @@ private:
     // Clipboard transpose for notes
     void TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, SCROW nRow2);
 
+    ScColumn* FetchColumn( SCCOL nCol );
+    const ScColumn* FetchColumn( SCCOL nCol ) const;
+
     /**
      * Use this to iterate through non-empty visible cells in a single column.
      */
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 5aeaf4c..b00bf92 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -509,11 +509,6 @@ void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPattern
     pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray );
 }
 
-bool ScColumn::SetAttrEntries(ScAttrEntry* pData, SCSIZE nSize)
-{
-    return pAttrArray->SetAttrEntries(pData, nSize);
-}
-
 void ScColumn::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
         const ScPatternAttr& rPattern, short nNewType )
 {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9b0a341..e7d78e6 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4437,14 +4437,6 @@ void ScDocument::ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
             maTabs[nTab]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr );
 }
 
-bool ScDocument::SetAttrEntries(SCCOL nCol, SCTAB nTab, ScAttrEntry* pData, SCSIZE nSize)
-{
-    if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab])
-        return false;
-
-    return maTabs[nTab]->SetAttrEntries(nCol, pData, nSize);
-}
-
 void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
         const ScMarkData& rMark, const ScPatternAttr& rPattern, short nNewType )
 {
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 32ff6fb..17c8e4d 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -20,6 +20,7 @@
 #include "compiler.hxx"
 #include "paramisc.hxx"
 #include "listenercontext.hxx"
+#include <attarray.hxx>
 
 #include <svl/sharedstringpool.hxx>
 
@@ -408,6 +409,19 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
     }
 }
 
+void ScDocumentImport::setAttrEntries( SCTAB nTab, SCCOL nCol, ScAttrEntry* pData, size_t nSize )
+{
+    ScTable* pTab = mpImpl->mrDoc.FetchTable(nTab);
+    if (!pTab)
+        return;
+
+    ScColumn* pCol = pTab->FetchColumn(nCol);
+    if (!pCol)
+        return;
+
+    pCol->pAttrArray->SetAttrEntries(pData, nSize);
+}
+
 namespace {
 
 class CellStoreInitializer
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index fdbc463..e179650 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1005,6 +1005,22 @@ void ScTable::TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SC
     }
 }
 
+ScColumn* ScTable::FetchColumn( SCCOL nCol )
+{
+    if (!ValidCol(nCol))
+        return NULL;
+
+    return &aCol[nCol];
+}
+
+const ScColumn* ScTable::FetchColumn( SCCOL nCol ) const
+{
+    if (!ValidCol(nCol))
+        return NULL;
+
+    return &aCol[nCol];
+}
+
 void ScTable::StartAllListeners()
 {
     for (SCCOL i=0; i<=MAXCOL; i++)
@@ -2374,14 +2390,6 @@ void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol,
     }
 }
 
-bool ScTable::SetAttrEntries(SCCOL nCol, ScAttrEntry* pData, SCSIZE nSize)
-{
-    if (!ValidCol(nCol))
-        return false;
-
-    return aCol[nCol].SetAttrEntries(pData, nSize);
-}
-
 void ScTable::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
         const ScPatternAttr& rPattern, short nNewType )
 {
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 499f117..1e5c236 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1949,7 +1949,7 @@ void XclImpXFRangeBuffer::SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2,
 
 void XclImpXFRangeBuffer::Finalize()
 {
-    ScDocument& rDoc = GetDoc();
+    ScDocumentImport& rDoc = GetDocImport();
     SCTAB nScTab = GetCurrScTab();
 
     // apply patterns
@@ -1982,7 +1982,7 @@ void XclImpXFRangeBuffer::Finalize()
             {
                 ScAttrEntry aEntry;
                 aEntry.nRow = MAXROW;
-                aEntry.pPattern = rDoc.GetDefPattern();
+                aEntry.pPattern = rDoc.getDoc().GetDefPattern();
                 aAttrs.push_back(aEntry);
             }
 
@@ -1993,7 +1993,7 @@ void XclImpXFRangeBuffer::Finalize()
             for (size_t i = 0; itr != itrEnd; ++itr, ++i)
                 pData[i] = *itr;
 
-            rDoc.SetAttrEntries(nScCol, nScTab, pData, static_cast<SCSIZE>(nAttrSize));
+            rDoc.setAttrEntries(nScTab, nScCol, pData, static_cast<SCSIZE>(nAttrSize));
         }
     }
 
@@ -2017,13 +2017,13 @@ void XclImpXFRangeBuffer::Finalize()
             SetBorderLine( *pRange, nScTab, BOX_LINE_BOTTOM );
         // do merge
         if( bMultiCol || bMultiRow )
-            rDoc.DoMerge( nScTab, rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() );
+            rDoc.getDoc().DoMerge( nScTab, rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() );
         // #i93609# merged range in a single row: test if manual row height is needed
         if( !bMultiRow )
         {
-            bool bTextWrap = static_cast< const SfxBoolItem* >( rDoc.GetAttr( rStart.Col(), rStart.Row(), rStart.Tab(), ATTR_LINEBREAK ) )->GetValue();
-            if( !bTextWrap && (rDoc.GetCellType( rStart ) == CELLTYPE_EDIT) )
-                if (const EditTextObject* pEditObj = rDoc.GetEditText(rStart))
+            bool bTextWrap = static_cast<const SfxBoolItem*>( rDoc.getDoc().GetAttr( rStart.Col(), rStart.Row(), rStart.Tab(), ATTR_LINEBREAK ) )->GetValue();
+            if( !bTextWrap && (rDoc.getDoc().GetCellType( rStart ) == CELLTYPE_EDIT) )
+                if (const EditTextObject* pEditObj = rDoc.getDoc().GetEditText(rStart))
                     bTextWrap = pEditObj->GetParagraphCount() > 1;
             if( bTextWrap )
                 GetOldRoot().pColRowBuff->SetManualRowHeight( rStart.Row() );
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index e43800b..5690316 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -82,6 +82,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
     mrMedium( rMedium ),
     mxRootStrg( xRootStrg ),
     mrDoc( rDoc ),
+    maDocImport(mrDoc),
     maDefPassword( "VelvetSweatshop" ),
     meTextEnc( eTextEnc ),
     meSysLang( Application::GetSettings().GetLanguageTag().getLanguageType() ),
@@ -265,6 +266,26 @@ SotStorageStreamRef XclRoot::OpenStream( const OUString& rStrmName ) const
     return OpenStream( GetRootStorage(), rStrmName );
 }
 
+ScDocument& XclRoot::GetDoc() const
+{
+    return mrData.mrDoc;
+}
+
+ScDocument* XclRoot::GetDocPtr() const
+{
+    return &mrData.mrDoc;
+}
+
+ScDocumentImport& XclRoot::GetDocImport()
+{
+    return mrData.maDocImport;
+}
+
+const ScDocumentImport& XclRoot::GetDocImport() const
+{
+    return mrData.maDocImport;
+}
+
 SfxObjectShell* XclRoot::GetDocShell() const
 {
     return GetDoc().GetDocumentShell();
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 0dc5e1d..a132eda 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -26,6 +26,7 @@
 #include <sot/storage.hxx>
 #include "xlconst.hxx"
 #include "xltools.hxx"
+#include <documentimport.hxx>
 #include <boost/shared_ptr.hpp>
 
 namespace comphelper { class IDocPasswordVerifier; }
@@ -80,6 +81,7 @@ struct XclRootData
     SfxMedium&          mrMedium;           /// The medium to import from.
     SotStorageRef       mxRootStrg;         /// The root OLE storage of imported/exported file.
     ScDocument&         mrDoc;              /// The source or destination document.
+    ScDocumentImport    maDocImport;
     OUString            maDocUrl;           /// Document URL of imported/exported file.
     OUString            maBasePath;         /// Base path of imported/exported file (path of maDocUrl).
     OUString            maUserName;         /// Current user name.
@@ -202,9 +204,13 @@ public:
     SotStorageStreamRef OpenStream( const OUString& rStrmName ) const;
 
     /** Returns the destination document (import) or source document (export). */
-    inline ScDocument&  GetDoc() const { return mrData.mrDoc; }
+    ScDocument& GetDoc() const;
     /** Returns pointer to the destination document (import) or source document (export). */
-    inline ScDocument*  GetDocPtr() const { return &mrData.mrDoc; }
+    ScDocument* GetDocPtr() const;
+
+    ScDocumentImport& GetDocImport();
+    const ScDocumentImport& GetDocImport() const;
+
     /** Returns the object shell of the Calc document. May be 0 (i.e. import from clipboard). */
     SfxObjectShell*     GetDocShell() const;
     /** Returns the object model of the Calc document. */
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 6fc4922..adaaf5e 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -456,7 +456,7 @@ void SheetDataBuffer::finalizeImport()
         }
     }
 
-    ScDocument& rDoc = getScDocument();
+    ScDocumentImport& rDoc = getDocImport();
     StylesBuffer& rStyles = getStyles();
     for ( ColStyles::iterator col = maStylesPerColumn.begin(), col_end = maStylesPerColumn.end(); col != col_end; ++col )
     {
@@ -474,8 +474,8 @@ void SheetDataBuffer::finalizeImport()
         {
             ScAttrEntry aEntry;
             aEntry.nRow = MAXROW;
-            aEntry.pPattern = rDoc.GetPattern(nScCol, 0, getSheetIndex());
-            rDoc.GetPool()->Put(*aEntry.pPattern);
+            aEntry.pPattern = rDoc.getDoc().GetPattern(nScCol, 0, getSheetIndex());
+            rDoc.getDoc().GetPool()->Put(*aEntry.pPattern);
             aAttrs.push_back(aEntry);
         }
 
@@ -485,7 +485,7 @@ void SheetDataBuffer::finalizeImport()
         for (size_t i = 0; itr != itrEnd; ++itr, ++i)
             pData[i] = *itr;
 
-        rDoc.SetAttrEntries(nScCol, getSheetIndex(), pData, static_cast<SCSIZE>(nAttrSize));
+        rDoc.setAttrEntries(getSheetIndex(), nScCol, pData, static_cast<SCSIZE>(nAttrSize));
     }
 
     // merge all cached merged ranges and update right/bottom cell borders
commit ab4606f9e7693e610a04174b94f0c74ea8ec388a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Sep 29 14:24:27 2014 -0400

    Update all script types in the marked ranges up-front.
    
    This is slightly faster than doing it on a as-needed basis.
    
    Change-Id: I7618f003f3c98ee894c3f1cf597681e4281cc6ab

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 5fb567c..ceac6f0 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -138,6 +138,8 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
         {
             SCROW nStartNo = itRows->mnStart;
             SCROW nEndNo = itRows->mnEnd;
+            ScAddress aTopLeft(0, nStartNo, nTab);
+            rDoc.UpdateScriptTypes(aTopLeft, MAXCOLCOUNT, nEndNo-nStartNo+1);
             if (rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab))
             {
                 if (!bChanged)
commit 8922f72d1ea1dd8af8a43d265253eac4f82baffc
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Sep 26 16:21:12 2014 -0400

    Annotate FindEditCellsHandler.
    
    Change-Id: Ib49a7a3eccee62e5496f7f19824631866e072b6a

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 521b942..5aeaf4c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2839,17 +2839,21 @@ class FindEditCellsHandler
     sc::CellStoreType::iterator miCellPos;
 
 public:
-    FindEditCellsHandler(ScColumn& rColumn, sc::CellTextAttrStoreType& rAttrs,
-            const sc::CellStoreType::iterator& rCellItr) :
-        mrColumn(rColumn), miAttrPos(rAttrs.begin()), miCellPos(rCellItr) {}
+    FindEditCellsHandler(ScColumn& rCol) :
+        mrColumn(rCol),
+        miAttrPos(rCol.GetCellAttrStore().begin()),
+        miCellPos(rCol.GetCellStore().begin()) {}
 
     bool operator() (size_t, const EditTextObject*)
     {
+        // This is definitely an edit text cell.
         return true;
     }
 
     bool operator() (size_t nRow, const ScFormulaCell* p)
     {
+        // With a formula cell, it's considered an edit text cell when either
+        // the result is multi-line or it has more than one script types.
         sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
         if (IsAmbiguousScriptNonZero(nScriptType))
             return true;
@@ -2857,13 +2861,19 @@ public:
         return const_cast<ScFormulaCell*>(p)->IsMultilineResult();
     }
 
+    /**
+     * Callback for a block of other types.
+     */
     std::pair<size_t,bool> operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize)
     {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list