merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0133-sc-drwlayer-units.diff
blob8a6e9ae663b4a9dcfc1207390bb05c43cce3c867
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
8 @@ -118,6 +118,10 @@
9 #include "postit.hxx"
10 #include "attrib.hxx"
12 +#ifndef _SV_FIELD_HXX //autogen
13 +#include <vcl/field.hxx>
14 +#endif
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 );
59 aRect.Left() -= 250;
60 aRect.Right() += 250;
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 );
70 if (!bSetVer)
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 );
81 if ( bNegativePage )
82 @@ -909,8 +923,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange&
84 if (bSetHor)
86 - nStartX = (long) (nStartX / HMM_PER_TWIPS);
87 - nEndX = (long) (nEndX / HMM_PER_TWIPS);
88 + nStartX = HmmToTwips( nStartX );
89 + nEndX = HmmToTwips( nEndX );
90 long nWidth;
91 SCCOL i;
93 @@ -927,8 +941,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange&
95 if (bSetVer)
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);