update dev300-m58
[ooovba.git] / applied_patches / 0045-cjk-character-units-fix-376788.diff
blob08f1f1987f1f3bcc5ff54b0f2ba819f37f5e8460
1 --- sw/source/ui/app/swmodul1.cxx 2008-04-14 14:05:13.000000000 +0800
2 +++ sw/source/ui/app/swmodul1.cxx 2008-04-17 13:51:11.000000000 +0800
3 @@ -91,6 +91,7 @@
4 #include <svx/colritem.hxx>
5 #include <svx/brshitem.hxx>
6 #include <vcl/msgbox.hxx>
7 +#include <svtools/cjkoptions.hxx>
8 #include <swmodule.hxx>
9 #include <swtypes.hxx>
10 #include <usrpref.hxx>
11 @@ -384,10 +387,15 @@ void SwModule::ApplyUserCharUnit(BOOL bA
13 else
15 - if ( eHScrollMetric == FUNIT_CHAR )
16 - eHScrollMetric == FUNIT_CM;
17 - if ( eVScrollMetric == FUNIT_LINE )
18 - eVScrollMetric == FUNIT_CM;
19 + SvtCJKOptions aCJKOptions;
20 + if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FUNIT_CHAR ))
21 + eHScrollMetric = FUNIT_INCH;
22 + else if ( eHScrollMetric == FUNIT_CHAR )
23 + eHScrollMetric = FUNIT_CM;
24 + if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FUNIT_LINE ))
25 + eVScrollMetric = FUNIT_INCH;
26 + else if ( eVScrollMetric == FUNIT_LINE )
27 + eVScrollMetric = FUNIT_CM;
29 SwView* pTmpView = SwModule::GetFirstView();
30 // fuer alle MDI-Fenster das Lineal umschalten
31 --- sw/source/ui/config/optload.cxx 2008-04-14 14:05:13.000000000 +0800
32 +++ sw/source/ui/config/optload.cxx 2008-04-17 14:07:36.000000000 +0800
33 @@ -163,7 +163,6 @@ SwLoadOptPage::SwLoadOptPage( Window* pP
34 case FUNIT_POINT:
35 case FUNIT_PICA:
36 case FUNIT_INCH:
37 - case FUNIT_CHAR:
39 // nur diese Metriken benutzen
40 USHORT nPos = aMetricLB.InsertEntry( sMetric );
41 @@ -265,9 +264,12 @@ BOOL __EXPORT SwLoadOptPage::FillItemSet
42 bRet = TRUE;
45 - if(aUseCharUnit.IsChecked() != aUseCharUnit.GetSavedValue())
46 + sal_Bool bIsUseCharUnitFlag = aUseCharUnit.IsChecked();
47 + SvtCJKOptions aCJKOptions;
48 + bIsUseCharUnitFlag = bIsUseCharUnitFlag && aCJKOptions.IsAsianTypographyEnabled();
49 + if( bIsUseCharUnitFlag != aUseCharUnit.GetSavedValue())
51 - rSet.Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, aUseCharUnit.IsChecked()));
52 + rSet.Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bIsUseCharUnitFlag ));
53 bRet = TRUE;
56 --- sw/source/ui/misc/pggrid.cxx 2008-04-15 15:27:38.000000000 +0800
57 +++ sw/source/ui/misc/pggrid.cxx 2008-04-11 16:28:19.000000000 +0800
58 @@ -365,9 +365,9 @@ void SwTextGridPage::PutGridItem(SfxItem
59 m_bHRulerChanged = sal_True;
61 m_bVRulerChanged = sal_True;
62 + pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
63 + pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
65 - pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
66 - pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
68 /* -----------------------------08.02.2002 10:54------------------------------
70 --- sw/source/ui/uiview/view.cxx 2008-04-14 14:05:13.000000000 +0800
71 +++ sw/source/ui/uiview/view.cxx 2008-04-17 17:27:49.000000000 +0800
72 @@ -1068,16 +1068,40 @@ SwView::SwView( SfxViewFrame *_pFrame, S
74 BOOL bApplyCharUnit = pUsrPref->IsApplyCharUnit();
75 SvtCJKOptions aCJKOptions;
76 - if ( aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
77 - pHRuler->SetUnit( FUNIT_CHAR );
78 + if ( aCJKOptions.IsAsianTypographyEnabled() )
79 + {
80 + if ( bApplyCharUnit )
81 + eMetric = FUNIT_CHAR;
82 + else
83 + {
84 + if ( eMetric == FUNIT_CHAR )
85 + eMetric = FUNIT_CM;
86 + }
87 + }
88 else
89 - pHRuler->SetUnit( eMetric );
90 + {
91 + if ( eMetric == FUNIT_CHAR )
92 + eMetric = FUNIT_INCH;
93 + }
94 + pHRuler->SetUnit( eMetric );
96 eMetric = pUsrPref->GetVScrollMetric();
97 - if ( aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
98 - pVRuler->SetUnit(FUNIT_LINE);
99 + if ( aCJKOptions.IsAsianTypographyEnabled() )
101 + if ( bApplyCharUnit )
102 + eMetric = FUNIT_LINE;
103 + else
105 + if ( eMetric == FUNIT_LINE )
106 + eMetric = FUNIT_CM;
109 else
110 - pVRuler->SetUnit( eMetric );
112 + if ( eMetric == FUNIT_LINE )
113 + eMetric = FUNIT_INCH;
115 + pVRuler->SetUnit( eMetric );
117 pHRuler->SetCharWidth( 371 ); // default character width
118 pVRuler->SetLineHeight( 551 ); // default line height
119 --- svx/source/cui/paragrph.cxx
120 +++ svx/source/cui/paragrph.cxx
121 @@ -106,6 +106,9 @@
122 #include <svtools/eitem.hxx> //add CHINA001
123 #include <sfx2/request.hxx> //add CHINA001
124 #include <svtools/intitem.hxx> //add CHINA001
125 +#ifndef _SVTOOLS_CJKOPTIONS_HXX
126 +#include <svtools/cjkoptions.hxx>
127 +#endif
129 // static ----------------------------------------------------------------
131 @@ -485,18 +488,26 @@ void SvxStdParagraphTabPage::Reset( cons
133 BOOL bApplyCharUnit = sal_False ;
134 bApplyCharUnit = GetApplyCharUnit( &rSet );
136 + SvtCJKOptions aCJKOptions;
137 + if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
138 + eFUnit = FUNIT_CHAR;
140 - if ( bApplyCharUnit )
141 - eFUnit = FUNIT_CHAR; // Amelia
142 SetFieldUnit( aLeftIndent, eFUnit );
143 SetFieldUnit( aRightIndent, eFUnit );
144 SetFieldUnit( aFLineIndent, eFUnit );
145 - if ( bApplyCharUnit )
146 - eFUnit = FUNIT_LINE; // Amelia
147 - SetFieldUnit( aTopDist, eFUnit );
148 - SetFieldUnit( aBottomDist, eFUnit );
149 - eFUnit = FUNIT_POINT;
150 - SetFieldUnit( aLineDistAtMetricBox, eFUnit );
151 + if ( eFUnit == FUNIT_CHAR )
153 + SetFieldUnit( aTopDist, FUNIT_LINE );
154 + SetFieldUnit( aBottomDist, FUNIT_LINE );
155 + SetFieldUnit( aLineDistAtMetricBox, FUNIT_POINT );
157 + else
159 + SetFieldUnit( aTopDist, eFUnit );
160 + SetFieldUnit( aBottomDist, eFUnit );
161 + SetFieldUnit( aLineDistAtMetricBox, eFUnit );
164 USHORT _nWhich = GetWhich( SID_ATTR_LRSPACE );
165 SfxItemState eItemState = rSet.GetItemState( _nWhich );
166 @@ -588,7 +599,10 @@ void SvxStdParagraphTabPage::Reset( cons
167 else
169 aTopDist.SetRelative();
170 - SetFieldUnit( aTopDist, eFUnit );
171 + if ( eFUnit == FUNIT_CHAR )
172 + SetFieldUnit( aTopDist, FUNIT_LINE );
173 + else
174 + SetFieldUnit( aTopDist, eFUnit );
175 SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
178 @@ -600,7 +614,10 @@ void SvxStdParagraphTabPage::Reset( cons
179 else
181 aBottomDist.SetRelative();
182 - SetFieldUnit( aBottomDist, eFUnit );
183 + if ( eFUnit == FUNIT_CHAR )
184 + SetFieldUnit( aBottomDist, FUNIT_LINE );
185 + else
186 + SetFieldUnit( aBottomDist, eFUnit );
187 SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
190 --- svtools/source/control/ruler.cxx 2008-04-15 15:27:38.000000000 +0800
191 +++ svtools/source/control/ruler.cxx 2008-04-11 16:28:19.000000000 +0800
192 @@ -284,6 +284,8 @@ void Ruler::ImplInit( WinBits nWinBits )
193 mnExtraStyle = 0; // Style des Extra-Feldes
194 mnExtraClicks = 0; // Click-Anzahl fuer Extra-Feld
195 mnExtraModifier = 0; // Modifier-Tasten beim Click im Extrafeld
196 + mnCharWidth = 371;
197 + mnLineHeight = 551;
198 mbCalc = TRUE; // Muessen Pagebreiten neu berechnet werden
199 mbFormat = TRUE; // Muss neu ausgegeben werden
200 mbDrag = FALSE; // Sind wir im Drag-Modus
201 @@ -492,6 +494,8 @@ void Ruler::ImplDrawTicks( long nMin, lo
202 long nTick2 ;
203 if ( mnUnitIndex == RULER_UNIT_CHAR )
205 + if ( mnCharWidth == 0 )
206 + mnCharWidth = 371;
207 nTick3 = mnCharWidth*2;
208 nTickCount = mnCharWidth;
209 nTickUnit = mnCharWidth;
210 @@ -499,6 +503,8 @@ void Ruler::ImplDrawTicks( long nMin, lo
212 else if ( mnUnitIndex == RULER_UNIT_LINE )
214 + if ( mnLineHeight == 0 )
215 + mnLineHeight = 551;
216 nTick3 = mnLineHeight*2;
217 nTickCount = mnLineHeight;
218 nTickUnit = mnLineHeight;