summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-05-05 08:53:19 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-05-05 08:53:19 -0400
commit43cb6820ed410082961d0229e022bcdc5159e1dc (patch)
tree8e62a55fe1980a4fa4581273dad615183b173b52 /sc/source
parentc6914659b65e73046ca66dc1b9e36f0a8c672fb8 (diff)
koheiautodecimal: #i111387# Disable text wrapping when the cell value is numeric.
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/column2.cxx12
-rw-r--r--sc/source/ui/view/output2.cxx24
2 files changed, 28 insertions, 8 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 9e3ed1c7ef5e..4c8de67ba271 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -193,6 +193,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 );
@@ -233,22 +234,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;
@@ -300,7 +305,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 a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 96e3ae1bbbd6..437052a9cca9 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/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
@@ -1293,10 +1295,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;
@@ -1319,6 +1317,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++)
@@ -1456,6 +1461,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 ||