[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Feb 6 06:39:03 PST 2014
sc/inc/global.hxx | 4 ----
sc/source/core/data/column2.cxx | 22 ++++++++++------------
sc/source/filter/excel/colrowst.cxx | 4 ++--
3 files changed, 12 insertions(+), 18 deletions(-)
New commits:
commit 0003e02b1c96e01607924873697a52fb813343ac
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Jan 30 22:43:05 2014 -0500
Keep the standard row height situation under control.
With this change, applying cell attributes to default cells will
no longer change the row heights inadvertently.
Without this, applying background colors to cells, pasting to a
range of cells etc would make the row heights slightly shorter
which is 1) odd, and 2) causes all sorts of rendering issues because
internally we assume these actions wouldn't change the row heights.
Change-Id: I57c3546e1725c5e8b37696242e9642b1617f59c3
(cherry picked from commit 29b322ea0c40423a39efe2f6c2c85a7d2108c512)
Reviewed-on: https://gerrit.libreoffice.org/7774
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 9babb88..c7ef429 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -131,10 +131,6 @@ const SCSIZE MAXSUBTOTAL = 3;
/* standard row height: text + margin - STD_ROWHEIGHT_DIFF */
#define STD_ROWHEIGHT_DIFF 23
-/// use ScGlobal::nStdRowHeight instead of STD_ROW_HEIGHT !
-
-#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) /* 256 Twips, 0.45 cm */
-
namespace sc
{
inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; }
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 04f127f..018052f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -725,10 +725,11 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 nFontHeightId )
{
- sal_uInt16 nHeight = (sal_uInt16) ((const SvxFontHeightItem&) rPattern.GetItem(nFontHeightId)).GetHeight();
- const SvxMarginItem* pMargin = (const SvxMarginItem*) &rPattern.GetItem(ATTR_MARGIN);
- nHeight += nHeight / 5;
- // for 10pt gives 240
+ const SvxFontHeightItem& rFontHeight =
+ static_cast<const SvxFontHeightItem&>(rPattern.GetItem(nFontHeightId));
+
+ sal_uInt16 nHeight = rFontHeight.GetHeight();
+ nHeight *= 1.18;
if ( ((const SvxEmphasisMarkItem&)rPattern.
GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != EMPHASISMARK_NONE )
@@ -738,19 +739,16 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16
nHeight += nHeight / 4;
}
- if ( nHeight + 240 > ScGlobal::nDefFontHeight )
- {
- nHeight = sal::static_int_cast<sal_uInt16>( nHeight + ScGlobal::nDefFontHeight );
- nHeight -= 240;
- }
+ const SvxMarginItem& rMargin =
+ static_cast<const SvxMarginItem&>(rPattern.GetItem(ATTR_MARGIN));
- // Standard height: TextHeight + margin - 23
- // -> 257 for Windows
+ nHeight += rMargin.GetTopMargin() + rMargin.GetBottomMargin();
if (nHeight > STD_ROWHEIGHT_DIFF)
nHeight -= STD_ROWHEIGHT_DIFF;
- nHeight += pMargin->GetTopMargin() + pMargin->GetBottomMargin();
+ if (nHeight < ScGlobal::nStdRowHeight)
+ nHeight = ScGlobal::nStdRowHeight;
return nHeight;
}
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index bc43a1e..dc6eae0 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -50,7 +50,7 @@ XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) :
maHiddenRows(0, MAXROWCOUNT, false),
mnLastScRow( -1 ),
mnDefWidth( STD_COL_WIDTH ),
- mnDefHeight( static_cast< sal_uInt16 >( STD_ROW_HEIGHT ) ),
+ mnDefHeight( static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight ) ),
mnDefRowFlags( EXC_DEFROW_DEFAULTFLAGS ),
mbHasStdWidthRec( false ),
mbHasDefHeight( false ),
@@ -117,7 +117,7 @@ void XclImpColRowSettings::SetDefHeight( sal_uInt16 nDefHeight, sal_uInt16 nFlag
mnDefRowFlags = nFlags;
if( mnDefHeight == 0 )
{
- mnDefHeight = static_cast< sal_uInt16 >( STD_ROW_HEIGHT );
+ mnDefHeight = static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight );
::set_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN );
}
mbHasDefHeight = true;
More information about the Libreoffice-commits
mailing list