[ooo-build-commit] .: patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue May 4 11:13:06 PDT 2010
patches/dev300/apply | 3
patches/dev300/calc-general-type-auto-decimal-disable-linebreak.diff | 106 ++++++++++
2 files changed, 109 insertions(+)
New commits:
commit bb9c3ed6ee36892740199492675bcc513efc699a
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue May 4 14:12:06 2010 -0400
Disable text wrap when the cell value is numeric.
This is in line with what Excel does under similar conditions.
* patches/dev300/apply:
* patches/dev300/calc-general-type-auto-decimal-disable-linebreak.diff:
diff --git a/patches/dev300/apply b/patches/dev300/apply
index c66f0b5..d85e18f 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -854,6 +854,9 @@ calc-general-type-auto-decimal-svtools.diff, n#541973, i#46511, kohei
calc-general-type-auto-decimal-officecfg.diff, n#541973, i#46511, kohei
calc-general-type-auto-decimal-sc-dbf-fix.diff, i#111074, kohei
+# Disable text wrap for numeric values.
+calc-general-type-auto-decimal-disable-linebreak.diff, kohei
+
# FIXME. hack. readd XclExpInterfaceEnd::WriteBody as in m60 as
# calc-xls-export-encryption-condfmt-fix.diff patches it. Kohei, please check
# --rengelhard
diff --git a/patches/dev300/calc-general-type-auto-decimal-disable-linebreak.diff b/patches/dev300/calc-general-type-auto-decimal-disable-linebreak.diff
new file mode 100644
index 0000000..3981a13
--- /dev/null
+++ b/patches/dev300/calc-general-type-auto-decimal-disable-linebreak.diff
@@ -0,0 +1,106 @@
+diff --git sc/source/core/data/column2.cxx sc/source/core/data/column2.cxx
+index 0ce77fb..d303e45 100644
+--- sc/source/core/data/column2.cxx
++++ sc/source/core/data/column2.cxx
+@@ -195,6 +195,7 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
+ double nPPT = bWidth ? nPPTX : nPPTY;
+ if (Search(nRow,nIndex))
+ {
++ ScBaseCell* pCell = pItems[nIndex].pCell;
+ const ScPatternAttr* pPattern = rOptions.pPattern;
+ if (!pPattern)
+ pPattern = pAttrArray->GetPattern( nRow );
+@@ -235,22 +236,26 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
+ else
+ eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)
+ pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
+- BOOL bBreak;
++ bool bBreak;
+ if ( eHorJust == SVX_HOR_JUSTIFY_BLOCK )
+- bBreak = TRUE;
++ bBreak = true;
+ else if ( pCondSet &&
+ pCondSet->GetItemState(ATTR_LINEBREAK, TRUE, &pCondItem) == SFX_ITEM_SET)
+ bBreak = ((const SfxBoolItem*)pCondItem)->GetValue();
+ else
+ bBreak = ((const SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK)).GetValue();
+
++ if (pCell->HasValueData())
++ // Cell has a value. Disable line break.
++ bBreak = false;
++
+ // get other attributes from pattern and conditional formatting
+
+ SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet );
+ BOOL bAsianVertical = ( eOrient == SVX_ORIENTATION_STACKED &&
+ ((const SfxBoolItem&)pPattern->GetItem( ATTR_VERTICAL_ASIAN, pCondSet )).GetValue() );
+ if ( bAsianVertical )
+- bBreak = FALSE;
++ bBreak = false;
+
+ if ( bWidth && bBreak ) // after determining bAsianVertical (bBreak may be reset)
+ return 0;
+@@ -302,7 +307,6 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
+ nIndent = ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue();
+ }
+
+- ScBaseCell* pCell = pItems[nIndex].pCell;
+ BYTE nScript = pDocument->GetScriptType( nCol, nRow, nTab, pCell );
+ if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
+
+diff --git sc/source/ui/view/output2.cxx sc/source/ui/view/output2.cxx
+index 35f48bf..301a973 100644
+--- sc/source/ui/view/output2.cxx
++++ sc/source/ui/view/output2.cxx
+@@ -75,6 +75,8 @@
+ #include "scmod.hxx"
+ #include "fillinfo.hxx"
+
++#include <boost/scoped_ptr.hpp>
++
+ #include <math.h>
+
+ //! Autofilter-Breite mit column.cxx zusammenfassen
+@@ -1324,10 +1326,6 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+
+ ScDrawStringsVars aVars( this, bPixelToLogic );
+
+- const ScPatternAttr* pOldPattern = NULL;
+- const SfxItemSet* pOldCondSet = NULL;
+- BYTE nOldScript = 0;
+-
+ BOOL bProgress = FALSE;
+
+ long nInitPosX = nScrX;
+@@ -1350,6 +1348,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+ SvxCellHorJustify eOutHorJust = SVX_HOR_JUSTIFY_STANDARD;
+ const ScPatternAttr* pPattern = NULL;
+ const SfxItemSet* pCondSet = NULL;
++ const ScPatternAttr* pOldPattern = NULL;
++ const SfxItemSet* pOldCondSet = NULL;
++ BYTE nOldScript = 0;
++
++ // alternative pattern instance in case we need to modify the pattern
++ // before processing the cell value.
++ ::boost::scoped_ptr<ScPatternAttr> pAltPattern;
+
+ long nPosY = nScrY;
+ for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
+@@ -1487,6 +1492,17 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+ pCondSet = pDoc->GetCondResult( nCellX, nCellY, nTab );
+ }
+
++ if (pCell->HasValueData() &&
++ static_cast<const SfxBoolItem&>(
++ pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue())
++ {
++ // Disable line break when the cell content is numeric.
++ pAltPattern.reset(new ScPatternAttr(*pPattern));
++ SfxBoolItem aLineBreak(ATTR_LINEBREAK, false);
++ pAltPattern->GetItemSet().Put(aLineBreak);
++ pPattern = pAltPattern.get();
++ }
++
+ BYTE nScript = GetScriptType( pDoc, pCell, pPattern, pCondSet );
+ if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
+ if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
More information about the ooo-build-commit
mailing list