[Libreoffice-commits] .: sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Tue Feb 1 07:27:50 PST 2011


 sw/source/ui/config/usrpref.cxx |   12 ++++++++++--
 sw/source/ui/uiview/view.cxx    |   33 ---------------------------------
 2 files changed, 10 insertions(+), 35 deletions(-)

New commits:
commit 552cdb5b8b406238486b9415262a551cb29ca817
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Feb 1 16:26:51 2011 +0100

    fdo#32684: Don't force Char / Lines units on rulers

diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
index 83739bd..979c45e 100644
--- a/sw/source/ui/config/usrpref.cxx
+++ b/sw/source/ui/config/usrpref.cxx
@@ -32,6 +32,7 @@
 
 #include <tools/stream.hxx>
 #include <unotools/syslocale.hxx>
+#include <svl/cjkoptions.hxx>
 
 #include "swtypes.hxx"
 #include "hintids.hxx"
@@ -72,9 +73,16 @@ SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb) :
     bApplyCharUnit(sal_False)
 {
     MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+    SvtCJKOptions aCJKOptions;
     eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
-    eHScrollMetric = eUserMetric;
-    eVScrollMetric = eUserMetric;
+
+    sal_Bool bCJKEnabled = aCJKOptions.IsAsianTypographyEnabled();
+    bApplyCharUnit = bCJKEnabled;
+    eHScrollMetric = bApplyCharUnit ? FUNIT_CHAR : eUserMetric;
+    eVScrollMetric = bApplyCharUnit ? FUNIT_LINE : eUserMetric;
+
+    bIsHScrollMetricSet = bApplyCharUnit;
+    bIsVScrollMetricSet = bApplyCharUnit;
 
     aContentConfig.Load();
     aLayoutConfig.Load();
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 63be548..ee4f600 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -917,42 +917,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     pVRuler->SetZoom( aZoomFract );
     pHRuler->SetDoubleClickHdl(LINK( this, SwView, ExecRulerClick ));
     FieldUnit eMetric = pUsrPref->GetHScrollMetric();
-
-    BOOL bApplyCharUnit = pUsrPref->IsApplyCharUnit();
-    SvtCJKOptions aCJKOptions;
-    if ( aCJKOptions.IsAsianTypographyEnabled() )
-    {
-        if ( bApplyCharUnit )
-            eMetric = FUNIT_CHAR;
-        else
-        {
-            if ( eMetric == FUNIT_CHAR )
-                eMetric = FUNIT_CM;
-        }
-    }
-    else
-    {
-        if ( eMetric == FUNIT_CHAR )
-            eMetric = FUNIT_INCH;
-    }
     pHRuler->SetUnit( eMetric );
 
     eMetric = pUsrPref->GetVScrollMetric();
-    if ( aCJKOptions.IsAsianTypographyEnabled() )
-    {
-        if ( bApplyCharUnit )
-            eMetric = FUNIT_LINE;
-        else
-        {
-            if ( eMetric == FUNIT_LINE )
-                eMetric = FUNIT_CM;
-        }
-    }
-    else
-    {
-        if ( eMetric == FUNIT_LINE )
-            eMetric = FUNIT_INCH;
-    }
     pVRuler->SetUnit( eMetric );
 
         pHRuler->SetCharWidth( 371 );  // default character width


More information about the Libreoffice-commits mailing list