1 Index: sc/source/core/data/drwlayer.cxx
2 ===================================================================
3 RCS file: /cvs/sc/sc/source/core/data/drwlayer.cxx,v
4 retrieving revision 1.51
5 diff -u -p -r1.51 drwlayer.cxx
6 --- sc/source/core/data/drwlayer.cxx 6 Jul 2007 12:33:05 -0000 1.51
7 +++ sc/source/core/data/drwlayer.cxx 19 Nov 2007 03:21:21 -0000
12 +#ifndef _SV_FIELD_HXX //autogen
13 +#include <vcl/field.hxx>
16 #define DET_ARROW_OFFSET 1000
18 // Abstand zur naechsten Zelle beim Loeschen (bShrink), damit der Anker
19 @@ -230,16 +234,26 @@ __EXPORT ScTabSizeChangedHint::~ScTabSiz
21 #define MAXMM 10000000
23 +inline long TwipsToHmm (long nVal)
25 + return static_cast< long >( MetricField::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
26 + FUNIT_TWIP, FUNIT_100TH_MM) );
29 +inline long HmmToTwips (long nVal)
31 + return static_cast< long > ( MetricField::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
32 + FUNIT_100TH_MM, FUNIT_TWIP) );
35 inline void TwipsToMM( long& nVal )
37 - nVal = (long) ( nVal * HMM_PER_TWIPS );
38 + nVal = TwipsToHmm (nVal);
41 inline void ReverseTwipsToMM( long& nVal )
43 - // reverse the effect of TwipsToMM - round up here (add 1)
45 - nVal = ((long) ( nVal / HMM_PER_TWIPS )) + 1;
46 + nVal = HmmToTwips (nVal);
49 void lcl_TwipsToMM( Point& rPoint )
50 @@ -670,8 +684,8 @@ void ScDrawLayer::RecalcPos( SdrObject*
52 // Berechnung und Werte wie in detfunc.cxx
54 - Size aSize( (long)(pDoc->GetColWidth( nCol1, nTab1 ) * HMM_PER_TWIPS),
55 - (long)(pDoc->GetRowHeight( nRow1, nTab1 ) * HMM_PER_TWIPS) );
56 + Size aSize( (long)( TwipsToHmm( pDoc->GetColWidth( nCol1, nTab1) ) ),
57 + (long)( TwipsToHmm( pDoc->GetRowHeight( nRow1, nTab1) ) ) );
58 Rectangle aRect( aPos, aSize );
61 @@ -842,16 +856,16 @@ BOOL ScDrawLayer::GetPrintArea( ScRange&
62 SCCOL nEndCol = rRange.aEnd.Col();
63 for (i=nStartCol; i<=nEndCol; i++)
64 nEndX += pDoc->GetColWidth(i,nTab);
65 - nStartX = (long)(nStartX * HMM_PER_TWIPS);
66 - nEndX = (long)(nEndX * HMM_PER_TWIPS);
67 + nStartX = TwipsToHmm( nStartX );
68 + nEndX = TwipsToHmm( nEndX );
72 nStartY = pDoc->FastGetRowHeight( 0, rRange.aStart.Row()-1, nTab);
73 nEndY = nStartY + pDoc->FastGetRowHeight( rRange.aStart.Row(),
74 rRange.aEnd.Row(), nTab);
75 - nStartY = (long)(nStartY * HMM_PER_TWIPS);
76 - nEndY = (long)(nEndY * HMM_PER_TWIPS);
77 + nStartY = TwipsToHmm( nStartY );
78 + nEndY = TwipsToHmm( nEndY );
82 @@ -909,8 +923,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange&
86 - nStartX = (long) (nStartX / HMM_PER_TWIPS);
87 - nEndX = (long) (nEndX / HMM_PER_TWIPS);
88 + nStartX = HmmToTwips( nStartX );
89 + nEndX = HmmToTwips( nEndX );
93 @@ -927,8 +941,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange&
97 - nStartY = (long) (nStartY / HMM_PER_TWIPS);
98 - nEndY = (long) (nEndY / HMM_PER_TWIPS);
99 + nStartY = HmmToTwips( nStartY );
100 + nEndY = HmmToTwips( nEndY );
101 SCROW nRow = pDoc->FastGetRowForHeight( nTab, nStartY);
102 rRange.aStart.SetRow( nRow>0 ? (nRow-1) : 0);
103 nRow = pDoc->FastGetRowForHeight( nTab, nEndY);