[ooo-build-commit] patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Oct 29 18:51:12 PDT 2009
patches/dev300/calc-general-type-auto-decimal-sc.diff | 98 ++++++++++--------
1 file changed, 58 insertions(+), 40 deletions(-)
New commits:
commit afcc24b4975ff85fb2eb5c6789c413aa1e78d495
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Oct 29 21:50:48 2009 -0400
More fine-tuned text width calculation in presence of '-' and '.'.
* patches/dev300/calc-general-type-auto-decimal-sc.diff:
diff --git a/patches/dev300/calc-general-type-auto-decimal-sc.diff b/patches/dev300/calc-general-type-auto-decimal-sc.diff
index 29f7d7c..c0953bc 100644
--- a/patches/dev300/calc-general-type-auto-decimal-sc.diff
+++ b/patches/dev300/calc-general-type-auto-decimal-sc.diff
@@ -278,7 +278,7 @@ index f91bb81..a6a4867 100644
}
}
diff --git sc/source/ui/view/output2.cxx sc/source/ui/view/output2.cxx
-index ef7f0c9..a3ac69c 100644
+index ef7f0c9..793d17a 100644
--- sc/source/ui/view/output2.cxx
+++ sc/source/ui/view/output2.cxx
@@ -56,6 +56,7 @@
@@ -383,7 +383,7 @@ index ef7f0c9..a3ac69c 100644
}
// sonst String/Groesse behalten
}
-@@ -511,6 +511,60 @@ void ScDrawStringsVars::SetHashText()
+@@ -511,6 +511,77 @@ void ScDrawStringsVars::SetHashText()
SetAutoText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
}
@@ -417,20 +417,37 @@ index ef7f0c9..a3ac69c 100644
+ return;
+
+ long nMaxDigit = GetMaxDigitWidth();
-+ // Compensate for the width differences of '.' and '-' which are usually
-+ // narrower than the digits, by increasing the maximum width.
-+ if (ceil(fVal) != fVal)
-+ nWidth += nMaxDigit - GetDotWidth();
-+
-+ if (fVal < 0.0)
-+ nWidth += nMaxDigit - GetSignWidth();
-+
+ sal_uInt16 nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
+
+ if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+ // Failed to get output string. Bail out.
+ return;
+
++ sal_uInt8 nSignCount = 0, nDecimalCount = 0;
++ xub_StrLen nLen = aString.Len();
++ sal_Unicode cDecSep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator.getStr()[0];
++ for (xub_StrLen i = 0; i < nLen; ++i)
++ {
++ sal_Unicode c = aString.GetChar(i);
++ if (c == sal_Unicode('-'))
++ ++nSignCount;
++ else if (c == cDecSep)
++ ++nDecimalCount;
++ }
++ if (nDecimalCount)
++ nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount;
++ if (nSignCount)
++ nWidth += (nMaxDigit - GetSignWidth()) * nSignCount;
++
++ if (nDecimalCount || nSignCount)
++ {
++ // Re-calculate.
++ nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
++ if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
++ // Failed to get output string. Bail out.
++ return;
++ }
++
+ if (pOutput->pFmtDevice->GetTextWidth(aString) > nWidth)
+ {
+ // Even after the decimal adjustment the text doesn't fit. Give up.
@@ -444,7 +461,7 @@ index ef7f0c9..a3ac69c 100644
void ScDrawStringsVars::SetAutoText( const String& rAutoText )
{
aString = rAutoText;
-@@ -541,6 +595,65 @@ void ScDrawStringsVars::SetAutoText( const String& rAutoText )
+@@ -541,6 +612,66 @@ void ScDrawStringsVars::SetAutoText( const String& rAutoText )
pLastCell = NULL; // derselbe Text kann in der naechsten Zelle wieder passen
}
@@ -477,7 +494,8 @@ index ef7f0c9..a3ac69c 100644
+ if (nDotWidth > 0)
+ return nDotWidth;
+
-+ nDotWidth = pOutput->pFmtDevice->GetTextWidth(String('.'));
++ const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator;
++ nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep);
+ return nDotWidth;
+}
+
@@ -510,7 +528,7 @@ index ef7f0c9..a3ac69c 100644
BOOL ScDrawStringsVars::HasEditCharacters() const
{
static const sal_Unicode pChars[] =
-@@ -922,29 +1035,25 @@ BOOL ScOutputData::IsAvailable( SCCOL nX, SCROW nY )
+@@ -922,29 +1053,25 @@ BOOL ScOutputData::IsAvailable( SCCOL nX, SCROW nY )
// bCellIsValue: if set, don't extend into empty cells
// bBreak: if set, don't extend, and don't set clip marks (but rLeftClip/rRightClip is set)
// bOverwrite: if set, also extend into non-empty cells (for rotated text)
@@ -549,7 +567,7 @@ index ef7f0c9..a3ac69c 100644
long nColWidth = ( nCompCol <= nX2 ) ?
pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
(long) ( pDoc->GetColWidth( nCompCol, nTab ) * nPPTX );
-@@ -960,7 +1069,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
+@@ -960,7 +1087,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
nCellPosX -= nColWidth * nLayoutSign;
}
@@ -558,7 +576,7 @@ index ef7f0c9..a3ac69c 100644
SCSIZE nCompArr = nArrY;
SCROW nCompRow = pRowInfo[nCompArr].nRowNo;
while ( nCellY > nCompRow )
-@@ -1005,28 +1114,30 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
+@@ -1005,28 +1132,30 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
{
// take first row's height from row info
nMergeSizeY += rThisRowInfo.nHeight;
@@ -599,7 +617,7 @@ index ef7f0c9..a3ac69c 100644
if ( nNeeded > nMergeSizeX )
{
SvxCellHorJustify eHorJust = (SvxCellHorJustify)nHorJustify;
-@@ -1060,14 +1171,14 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
+@@ -1060,14 +1189,14 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
SCCOL nLeftX = nCellX;
if ( !bMerged && !bCellIsValue && !bBreak )
{
@@ -616,7 +634,7 @@ index ef7f0c9..a3ac69c 100644
if ( rThisRowInfo.nRowNo == nCellY && nRightX >= nX1 && nRightX <= nX2 )
rThisRowInfo.pCellInfo[nRightX].bHideGrid = TRUE;
-@@ -1081,33 +1192,33 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
+@@ -1081,33 +1210,33 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
--nLeftX;
long nAdd = (long) ( pDoc->GetColWidth( nLeftX, nTab ) * nPPTX );
nLeftMissing -= nAdd;
@@ -658,7 +676,7 @@ index ef7f0c9..a3ac69c 100644
// leave space for AutoFilter on screen
// (for automatic line break: only if not formatting for printer, as in ScColumn::GetNeededSize)
-@@ -1123,30 +1234,30 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
+@@ -1123,30 +1252,30 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
// content fits even in the remaining area without the filter button
// -> align within that remaining area
@@ -697,7 +715,7 @@ index ef7f0c9..a3ac69c 100644
pDev->Pop();
//! Test !!!
#endif
-@@ -1187,12 +1298,9 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1187,12 +1316,9 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
--nLoopStartX; // start before nX1 for rest of long text to the left
// variables for GetOutputArea
@@ -711,7 +729,7 @@ index ef7f0c9..a3ac69c 100644
SvxCellHorJustify eOutHorJust = SVX_HOR_JUSTIFY_STANDARD;
const ScPatternAttr* pPattern = NULL;
const SfxItemSet* pCondSet = NULL;
-@@ -1363,6 +1471,7 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1363,6 +1489,7 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
bNeedEdit = aVars.HasEditCharacters() ||
(bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
}
@@ -719,7 +737,7 @@ index ef7f0c9..a3ac69c 100644
if (bDoCell && !bNeedEdit)
{
CellType eCellType = pCell->GetCellType();
-@@ -1384,14 +1493,17 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1384,14 +1511,17 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
BOOL bRepeat = aVars.IsRepeat() && !bBreak;
BOOL bShrink = aVars.IsShrink() && !bBreak && !bRepeat;
@@ -742,7 +760,7 @@ index ef7f0c9..a3ac69c 100644
if ( bShrink )
{
-@@ -1401,9 +1513,9 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1401,9 +1531,9 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
// DrawEdit is used to vertically scale 90 deg rotated text.
bNeedEdit = TRUE;
}
@@ -754,7 +772,7 @@ index ef7f0c9..a3ac69c 100644
long nScaleSize = aVars.GetTextSize().Width(); // without margin
if ( nScaleSize > 0 ) // 0 if the text is empty (formulas, number formats)
-@@ -1427,16 +1539,16 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1427,16 +1557,16 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
// If even at half the size the font still isn't rendered smaller,
// fall back to normal clipping (showing ### for numbers).
if ( nNewSize <= nAvailable )
@@ -774,7 +792,7 @@ index ef7f0c9..a3ac69c 100644
long nRepeatSize = aVars.GetTextSize().Width(); // without margin
// When formatting for the printer, the text sizes don't always add up.
// Round down (too few repetitions) rather than exceeding the cell size then:
-@@ -1460,13 +1572,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1460,13 +1590,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
if ( bBreak )
{
if ( aVars.GetOrient() == SVX_ORIENTATION_STANDARD )
@@ -790,7 +808,7 @@ index ef7f0c9..a3ac69c 100644
}
}
}
-@@ -1482,48 +1594,49 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1482,48 +1612,49 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
}
if ( bDoCell )
{
@@ -860,7 +878,7 @@ index ef7f0c9..a3ac69c 100644
bVClip = TRUE;
}
-@@ -1606,27 +1719,27 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1606,27 +1737,27 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
if (!bHClip)
{
@@ -895,7 +913,7 @@ index ef7f0c9..a3ac69c 100644
}
Point aURLStart( nJustPosX, nJustPosY ); // copy before modifying for orientation
-@@ -1830,7 +1943,7 @@ long lcl_GetEditSize( EditEngine& rEngine, BOOL bWidth, BOOL bSwap, long nAttrRo
+@@ -1830,7 +1961,7 @@ long lcl_GetEditSize( EditEngine& rEngine, BOOL bWidth, BOOL bSwap, long nAttrRo
void ScOutputData::ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
long nLeftM, long nTopM, long nRightM, long nBottomM,
BOOL bWidth, USHORT nOrient, long nAttrRotate, BOOL bPixelToLogic,
@@ -904,7 +922,7 @@ index ef7f0c9..a3ac69c 100644
{
if ( !bWidth )
{
-@@ -2152,10 +2265,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2152,10 +2283,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
nPosY = nScrY;
}
@@ -916,7 +934,7 @@ index ef7f0c9..a3ac69c 100644
//
// Initial page size - large for normal text, cell size for automatic line breaks
-@@ -2170,23 +2280,22 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2170,23 +2298,22 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
//! handle nArrY == 0
GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, 0,
@@ -945,7 +963,7 @@ index ef7f0c9..a3ac69c 100644
}
}
if (bPixelToLogic)
-@@ -2375,26 +2484,26 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2375,26 +2502,26 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
{
// for break, the first GetOutputArea call is sufficient
GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, nNeededPixel,
@@ -979,7 +997,7 @@ index ef7f0c9..a3ac69c 100644
if ( nAvailable >= 2 * nFormatted )
{
// "repeat" is handled with unformatted text (for performance reasons)
-@@ -2428,7 +2537,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2428,7 +2555,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
}
}
@@ -988,7 +1006,7 @@ index ef7f0c9..a3ac69c 100644
{
pEngine->SetText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
nEngineWidth = (long) pEngine->CalcTextWidth();
-@@ -2451,11 +2560,11 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2451,11 +2578,11 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
}
}
@@ -1004,7 +1022,7 @@ index ef7f0c9..a3ac69c 100644
if ( bBreak || eOrient != SVX_ORIENTATION_STANDARD || bAsianVertical )
{
-@@ -2475,21 +2584,21 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2475,21 +2602,21 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
nStartX += nLeftM;
}
@@ -1034,7 +1052,7 @@ index ef7f0c9..a3ac69c 100644
BOOL bSimClip = FALSE;
if ( bWrapFields )
-@@ -2498,14 +2607,14 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2498,14 +2625,14 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
bClip = TRUE;
}
@@ -1053,7 +1071,7 @@ index ef7f0c9..a3ac69c 100644
bClip = TRUE;
}
-@@ -2557,8 +2666,8 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2557,8 +2684,8 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
@@ -1064,7 +1082,7 @@ index ef7f0c9..a3ac69c 100644
}
}
-@@ -2582,9 +2691,9 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
+@@ -2582,9 +2709,9 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
// Clip marks are already handled in GetOutputArea
if (bPixelToLogic)
@@ -1076,7 +1094,7 @@ index ef7f0c9..a3ac69c 100644
if (bClip) // bei bSimClip nur aClipRect initialisieren
{
-@@ -3218,10 +3327,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
+@@ -3218,10 +3345,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
// use GetOutputArea to hide the grid
// (clip region is done manually below)
@@ -1088,7 +1106,7 @@ index ef7f0c9..a3ac69c 100644
SCCOL nCellX = nX;
SCROW nCellY = nY;
-@@ -3234,8 +3340,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
+@@ -3234,8 +3358,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
GetOutputArea( nX, nArrY, nCellStartX, nPosY, nCellX, nCellY, nNeededWidth,
*pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
@@ -1098,7 +1116,7 @@ index ef7f0c9..a3ac69c 100644
if ( bShrink )
{
-@@ -3243,19 +3348,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
+@@ -3243,19 +3366,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
pRefDevice->LogicToPixel(Size(nEngineWidth,0)).Width() : nEngineWidth;
long nNeededPixel = nPixelWidth + nLeftM + nRightM;
@@ -1123,7 +1141,7 @@ index ef7f0c9..a3ac69c 100644
}
// nEngineWidth/nEngineHeight is updated in ShrinkEditEngine
-@@ -3309,19 +3414,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
+@@ -3309,19 +3432,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
}
if (bPixelToLogic)
More information about the ooo-build-commit
mailing list