summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/output2.cxx
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-06-23 13:54:50 +0200
committerobo <obo@openoffice.org>2010-06-23 13:54:50 +0200
commitabaedc357b56a2214762bc1fdceded65645149c2 (patch)
tree20bb3c6a470ef160fcdf08a06de687ad44c20658 /sc/source/ui/view/output2.cxx
parent1085111559bb616cdcce09f6b98d82ab1447e695 (diff)
parent6f02878909a45c178b48d6eadfd9c04c86ceda51 (diff)
CWS-TOOLING: integrate CWS calc55
Diffstat (limited to 'sc/source/ui/view/output2.cxx')
-rw-r--r--sc/source/ui/view/output2.cxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 13c404fba..5009443b8 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -114,6 +114,7 @@ class ScDrawStringsVars
long nMaxDigitWidth;
long nSignWidth;
long nDotWidth;
+ long nExpWidth;
ScBaseCell* pLastCell;
ULONG nValueFormat;
@@ -173,6 +174,7 @@ private:
long GetMaxDigitWidth();
long GetSignWidth();
long GetDotWidth();
+ long GetExpWidth();
void TextChanged();
long ConvertWidthLogicToPixel( long nWidth ) const;
};
@@ -193,6 +195,7 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) :
nMaxDigitWidth( 0 ),
nSignWidth( 0 ),
nDotWidth( 0 ),
+ nExpWidth( 0 ),
pLastCell ( NULL ),
nValueFormat( 0 ),
bLineBreak ( FALSE ),
@@ -262,6 +265,7 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet*
nMaxDigitWidth = 0;
nSignWidth = 0;
nDotWidth = 0;
+ nExpWidth = 0;
pPattern = pNew;
pCondSet = pSet;
@@ -417,6 +421,7 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt
nMaxDigitWidth = 0;
nSignWidth = 0;
nDotWidth = 0;
+ nExpWidth = 0;
// wird gerufen, wenn sich die Font-Variablen nicht aendern (!StringDiffer)
pPattern = pNew;
@@ -547,7 +552,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
// Failed to get output string. Bail out.
return;
- sal_uInt8 nSignCount = 0, nDecimalCount = 0;
+ sal_uInt8 nSignCount = 0, nDecimalCount = 0, nExpCount = 0;
xub_StrLen nLen = aString.Len();
sal_Unicode cDecSep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator.getStr()[0];
for (xub_StrLen i = 0; i < nLen; ++i)
@@ -557,13 +562,17 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
++nSignCount;
else if (c == cDecSep)
++nDecimalCount;
+ else if (c == sal_Unicode('E'))
+ ++nExpCount;
}
if (nDecimalCount)
nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount;
if (nSignCount)
nWidth += (nMaxDigit - GetSignWidth()) * nSignCount;
+ if (nExpCount)
+ nWidth += (nMaxDigit - GetExpWidth()) * nExpCount;
- if (nDecimalCount || nSignCount)
+ if (nDecimalCount || nSignCount || nExpCount)
{
// Re-calculate.
nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
@@ -658,6 +667,17 @@ long ScDrawStringsVars::GetDotWidth()
return nDotWidth;
}
+long ScDrawStringsVars::GetExpWidth()
+{
+ if (nExpWidth > 0)
+ return nExpWidth;
+
+ nExpWidth = pOutput->pFmtDevice->GetTextWidth(String('E'));
+ if (bPixelToLogic)
+ nExpWidth = ConvertWidthLogicToPixel(nExpWidth);
+ return nExpWidth;
+}
+
void ScDrawStringsVars::TextChanged()
{
OutputDevice* pRefDevice = pOutput->pRefDevice;