[ooo-build-commit] .: patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Wed May 12 14:10:13 PDT 2010


 patches/dev300/apply                                                  |    3 
 patches/dev300/calc-general-type-auto-decimal-printer-matrix-fix.diff |   68 ++++++++++
 2 files changed, 71 insertions(+)

New commits:
commit b4179eaeafd70cfcd13d8cb95a8481f4ba218159
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed May 12 17:06:28 2010 -0400

    Fixed bug in automatic adjustment of decimals when printer matrics are used.
    
    The automatic decimal adjustment failed when the "Use printer matrics for
    text formatting" option was checked in the Options dialog.  This patch fixes
    it. (i#111559)
    
    * patches/dev300/apply:
    * patches/dev300/calc-general-type-auto-decimal-printer-matrix-fix.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index dd2f356..a0c2c1a 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -876,6 +876,9 @@ calc-general-type-auto-decimal-disable-linebreak.diff, kohei
 # Tweak the default display format to hide the ugliness of IEEE 754 rounding error.
 calc-general-type-auto-decimal-ieee754-fix.diff, i#111533, kohei
 
+# Fix automatic decimals when the printer matrics is used.
+calc-general-type-auto-decimal-printer-matrix-fix.diff, i#111559, 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-printer-matrix-fix.diff b/patches/dev300/calc-general-type-auto-decimal-printer-matrix-fix.diff
new file mode 100644
index 0000000..720ad67
--- /dev/null
+++ b/patches/dev300/calc-general-type-auto-decimal-printer-matrix-fix.diff
@@ -0,0 +1,68 @@
+diff --git sc/source/ui/view/output2.cxx sc/source/ui/view/output2.cxx
+index 301a973..e4a0208 100644
+--- sc/source/ui/view/output2.cxx
++++ sc/source/ui/view/output2.cxx
+@@ -178,6 +178,7 @@ private:
+     long        GetSignWidth();
+     long        GetDotWidth();
+     void        TextChanged();
++    long        ConvertWidthLogicToPixel( long nWidth ) const;
+ };
+ 
+ //==================================================================
+@@ -598,7 +599,12 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
+             return;
+     }
+ 
+-    if (pOutput->pFmtDevice->GetTextWidth(aString) > nWidth)
++    long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString);
++
++    if (bPixelToLogic)
++        nActualTextWidth = ConvertWidthLogicToPixel(nActualTextWidth);
++
++    if (nActualTextWidth > nWidth)
+     {
+         // Even after the decimal adjustment the text doesn't fit.  Give up.
+         SetHashText();
+@@ -650,6 +656,9 @@ long ScDrawStringsVars::GetMaxDigitWidth()
+         long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit));
+         nMaxDigitWidth = ::std::max(nMaxDigitWidth, n);
+     }
++
++    if (bPixelToLogic)
++        nMaxDigitWidth = ConvertWidthLogicToPixel(nMaxDigitWidth);
+     return nMaxDigitWidth;
+ }
+ 
+@@ -659,6 +668,8 @@ long ScDrawStringsVars::GetSignWidth()
+         return nSignWidth;
+ 
+     nSignWidth = pOutput->pFmtDevice->GetTextWidth(String('-'));
++    if (bPixelToLogic)
++        nSignWidth = ConvertWidthLogicToPixel(nSignWidth);
+     return nSignWidth;
+ }
+ 
+@@ -669,6 +680,8 @@ long ScDrawStringsVars::GetDotWidth()
+ 
+     const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator;
+     nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep);
++    if (bPixelToLogic)
++        nDotWidth = ConvertWidthLogicToPixel(nDotWidth);
+     return nDotWidth;
+ }
+ 
+@@ -698,6 +711,13 @@ void ScDrawStringsVars::TextChanged()
+         aTextSize = pRefDevice->LogicToPixel( aTextSize );
+ }
+ 
++long ScDrawStringsVars::ConvertWidthLogicToPixel( long nWidth ) const
++{
++    Size aSize(nWidth, pOutput->pFmtDevice->GetTextHeight());
++    aSize = pOutput->pRefDevice->LogicToPixel(aSize);
++    return aSize.Width();
++}
++
+ BOOL ScDrawStringsVars::HasEditCharacters() const
+ {
+     static const sal_Unicode pChars[] =


More information about the ooo-build-commit mailing list