[ooo-build-commit] .: 4 commits - rsc/inc rsc/source svl/inc svtools/inc svtools/source tools/inc vcl/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Sep 13 07:53:43 PDT 2010


 rsc/inc/vclrsc.hxx               |    2 -
 rsc/source/parser/rscibas.cxx    |    3 +
 svl/inc/svl/poolitem.hxx         |    2 -
 svtools/inc/ruler.hxx            |    9 +++++
 svtools/source/control/ruler.cxx |   64 +++++++++++++++++++++++++++++++++++----
 svtools/source/misc/unitconv.cxx |    3 +
 tools/inc/tools/fldunit.hxx      |    2 -
 vcl/source/control/field.cxx     |   34 ++++++++++++--------
 vcl/source/src/units.src         |    3 +
 9 files changed, 101 insertions(+), 21 deletions(-)

New commits:
commit 193232ca21162235981610c9af88e635e404f76d
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:45:00 2010 +0200

    cjk-character-units-fix-376788.diff: add a new character unit
    
    i#376788

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 24092c3..ba56da2 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -268,6 +268,8 @@ void Ruler::ImplInit( WinBits nWinBits )
     mnExtraStyle    = 0;                    // Style des Extra-Feldes
     mnExtraClicks   = 0;                    // Click-Anzahl fuer Extra-Feld
     mnExtraModifier = 0;                    // Modifier-Tasten beim Click im Extrafeld
+    mnCharWidth     = 371;
+    mnLineHeight    = 551;
     mbCalc          = TRUE;                 // Muessen Pagebreiten neu berechnet werden
     mbFormat        = TRUE;                 // Muss neu ausgegeben werden
     mbDrag          = FALSE;                // Sind wir im Drag-Modus
@@ -476,6 +478,8 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     long    nTick2 ;
     if ( mnUnitIndex == RULER_UNIT_CHAR )
     {
+        if ( mnCharWidth == 0 )
+            mnCharWidth = 371;
         nTick3 = mnCharWidth*2;
         nTickCount = mnCharWidth;
         nTickUnit = mnCharWidth;
@@ -483,6 +487,8 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     }
     else if ( mnUnitIndex == RULER_UNIT_LINE )
     {
+        if ( mnLineHeight == 0 )
+            mnLineHeight = 551;
         nTick3 = mnLineHeight*2;
         nTickCount = mnLineHeight;
         nTickUnit = mnLineHeight;
commit 9ff34bff63efe1d3f034feaec59d7e9ee5adf83b
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:42:43 2010 +0200

    cjk-character-units-rulers-sync-with-pggrid-fix.diff:

diff --git a/svtools/inc/ruler.hxx b/svtools/inc/ruler.hxx
index a77a517..22eec9f 100644
--- a/svtools/inc/ruler.hxx
+++ b/svtools/inc/ruler.hxx
@@ -876,6 +876,8 @@ public:
 
     void                SetCharWidth( long nWidth ) { mnCharWidth = nWidth ; }
     void                SetLineHeight( long nHeight ) { mnLineHeight = nHeight ; }
+
+    void                DrawTicks();
 };
 
 #endif  // _RULER_HXX
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index df4b461..24092c3 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -476,14 +476,14 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     long    nTick2 ;
     if ( mnUnitIndex == RULER_UNIT_CHAR )
     {
-        nTick3 = mnCharWidth;
+        nTick3 = mnCharWidth*2;
         nTickCount = mnCharWidth;
         nTickUnit = mnCharWidth;
         nTick2 = mnCharWidth;
     }
     else if ( mnUnitIndex == RULER_UNIT_LINE )
     {
-        nTick3 = mnLineHeight;
+        nTick3 = mnLineHeight*2;
         nTickCount = mnLineHeight;
         nTickUnit = mnLineHeight;
         nTick2 = mnLineHeight;
@@ -3219,3 +3219,11 @@ const RulerBorder*  Ruler::GetBorders() const { return mpData->pBorders; }
 USHORT              Ruler::GetIndentCount() const { return mpData->nIndents; }
 const RulerIndent*  Ruler::GetIndents() const { return mpData->pIndents; }
 
+/* ---------------------------------------------------
+ *
+ * ---------------------------------------------------*/
+void Ruler::DrawTicks()
+{
+    mbFormat = TRUE;
+    ImplDraw();
+}
commit 80c912a380b819bc994e31b62ef81b4b0309bb17
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:40:57 2010 +0200

    cjk-character-units-ui.diff: add a new unit 'character unit'

diff --git a/rsc/inc/vclrsc.hxx b/rsc/inc/vclrsc.hxx
index b384495..d565984 100644
--- a/rsc/inc/vclrsc.hxx
+++ b/rsc/inc/vclrsc.hxx
@@ -173,7 +173,7 @@ typedef sal_Int64 WinBits;
 // from vcl/inc/fldunit.hxx
 enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM,
                  FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA,
-                 FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM,
+                 FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CHAR, FUNIT_LINE, FUNIT_CUSTOM,
                  FUNIT_PERCENT, FUNIT_100TH_MM };
 
 
diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
index ddf223f..793e884 100644
--- a/rsc/source/parser/rscibas.cxx
+++ b/rsc/source/parser/rscibas.cxx
@@ -237,6 +237,9 @@ RscEnum * RscTypCont::InitFieldUnitsType()
     SETCONST( pFieldUnits, "FUNIT_FOOT", FUNIT_FOOT );
     SETCONST( pFieldUnits, "FUNIT_MILE", FUNIT_MILE );
     SETCONST( pFieldUnits, "FUNIT_CUSTOM", FUNIT_CUSTOM );
+    // Amelia : adds two units ,"char" and "line"
+    SETCONST( pFieldUnits, "FUNIT_CHAR", FUNIT_CHAR );
+    SETCONST( pFieldUnits, "FUNIT_LINE", FUNIT_LINE );
     SETCONST( pFieldUnits, "FUNIT_PERCENT", FUNIT_PERCENT );
 
     return pFieldUnits;
diff --git a/svl/inc/svl/poolitem.hxx b/svl/inc/svl/poolitem.hxx
index 480c0dd..e371bc5 100644
--- a/svl/inc/svl/poolitem.hxx
+++ b/svl/inc/svl/poolitem.hxx
@@ -100,7 +100,7 @@ enum SfxFieldUnit
 {
     SFX_FUNIT_NONE, SFX_FUNIT_MM, SFX_FUNIT_CM, SFX_FUNIT_M, SFX_FUNIT_KM,
     SFX_FUNIT_TWIP, SFX_FUNIT_POINT, SFX_FUNIT_PICA,
-    SFX_FUNIT_INCH, SFX_FUNIT_FOOT, SFX_FUNIT_MILE, SFX_FUNIT_CUSTOM
+    SFX_FUNIT_INCH, SFX_FUNIT_FOOT, SFX_FUNIT_MILE, SFX_FUNIT_CHAR, SFX_FUNIT_LINE, SFX_FUNIT_CUSTOM
 };
 
 enum SfxMapUnit
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index dc8ee54..df4b461 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -81,7 +81,9 @@
 #define RULER_UNIT_MILE     6
 #define RULER_UNIT_POINT    7
 #define RULER_UNIT_PICA     8
-#define RULER_UNIT_COUNT    9
+#define RULER_UNIT_CHAR	    9
+#define RULER_UNIT_LINE    10
+#define RULER_UNIT_COUNT    11
 
 // -----------------
 // - ImplRulerData -
@@ -145,7 +147,9 @@ static ImplRulerUnitData aImplRulerUnitTab[RULER_UNIT_COUNT] =
 { MAP_100TH_INCH,     1200,   120,    600,   1200,   30480, 3, "'"      }, // FOOT
 { MAP_10TH_INCH,    633600, 63360, 316800, 633600, 1609344, 4, " miles" }, // MILE
 { MAP_POINT,             1,    12,     12,     36,     353, 2, " pt"    }, // POINT
-{ MAP_100TH_MM,        423,   423,    423,    846,     423, 3, " pi"    }  // PICA
+{ MAP_100TH_MM,        423,   423,    423,    846,     423, 3, " pi"    }, // PICA
+{ MAP_100TH_MM,	       371,   371,    371,    743,     371, 3, " ch"    }, // CHAR
+{ MAP_100TH_MM,        551,   551,    551,   1102,     551, 3, " li"    }  // LINE
 };
 
 // =======================================================================
diff --git a/tools/inc/tools/fldunit.hxx b/tools/inc/tools/fldunit.hxx
index b89ff85..d3d7dca 100644
--- a/tools/inc/tools/fldunit.hxx
+++ b/tools/inc/tools/fldunit.hxx
@@ -35,7 +35,7 @@
 // By changes you must also change: rsc/vclrsc.hxx
 enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM,
                  FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA,
-                 FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM,
+                 FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CHAR, FUNIT_LINE, FUNIT_CUSTOM,
                  FUNIT_PERCENT, FUNIT_100TH_MM };
 
 #endif // _TOOLS_FLDUNIT_HXX
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index f66ce78..88be56a 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1128,6 +1128,10 @@ static FieldUnit ImplStringToMetric( const String &rMetricString )
         if ( strAllUnits->GetString( i ).Equals( aStr ) )
             return (FieldUnit) strAllUnits->GetValue( i );
 
+    // Amelia : about character unit
+    if (aStr.EqualsIgnoreCaseAscii("cm"))
+        return FUNIT_CM;
+
     return FUNIT_NONE;
 }
 
@@ -1143,20 +1147,24 @@ static FieldUnit ImplMetricGetUnit( const XubString& rStr )
 #define M *1000000L
 #define X *5280L
 
-static const sal_Int64 aImplFactor[FUNIT_MILE+1][FUNIT_MILE+1] =
+// Amelia : about measurement unit, 'char' and 'line'
+//static const sal_Int64 aImplFactor[FUNIT_MILE+1][FUNIT_MILE+1] =
+static const sal_Int64 aImplFactor[FUNIT_LINE+1][FUNIT_LINE+1] =
 { /*
-mm/100    mm    cm       m     km  twip point  pica  inch    foot     mile */
-{    1,  100,  1 K,  100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X },
-{    1,    1,   10,    1 K,   1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X },
-{    1,    1,    1,    100, 100 K,  254,  254,  254,  254, 254*12, 254*12 X },
-{    1,    1,    1,      1,   1 K,  254,  254,  254,  254, 254*12, 254*12 X },
-{    1,    1,    1,      1,     1,    0,  254,  254,  254, 254*12, 254*12 X },
-{ 1440,144 K,144 K,14400 K,     0,    1,   20,  240, 1440,1440*12,1440*12 X },
-{   72, 7200, 7200,  720 K, 720 M,    1,    1,   12,   72,  72*12,  72*12 X },
-{    6,  600,  600,   60 K,  60 M,    1,    1,    1,    6,   6*12,   6*12 X },
-{    1,  100,  100,   10 K,  10 M,    1,    1,    1,    1,     12,     12 X },
-{    1,  100,  100,   10 K,  10 M,    1,    1,    1,    1,      1,      1 X },
-{    1,  100,  100,   10 K,  10 M,    1,    1,    1,    1,      1,        1 }
+mm/100    mm    cm       m     km  twip point  pica  inch    foot     mile    char    line*/
+{    1,  100,  1 K,  100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X ,   53340, 396240},
+{    1,    1,   10,    1 K,   1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X ,    5334, 396240},
+{    1,    1,    1,    100, 100 K,  254,  254,  254,  254, 254*12, 254*12 X ,    5334,  39624},
+{    1,    1,    1,      1,   1 K,  254,  254,  254,  254, 254*12, 254*12 X ,  533400,  39624},
+{    1,    1,    1,      1,     1,    0,  254,  254,  254, 254*12, 254*12 X ,533400 K,  39624},
+{ 1440,144 K,144 K,14400 K,     0,    1,   20,  240, 1440,1440*12,1440*12 X ,     210,   3120},
+{   72, 7200, 7200,  720 K, 720 M,    1,    1,   12,   72,  72*12,  72*12 X ,     210,    156},
+{    6,  600,  600,   60 K,  60 M,    1,    1,    1,    6,   6*12,   6*12 X ,     210,     10},
+{    1,  100,  100,   10 K,  10 M,    1,    1,    1,    1,     12,     12 X ,     210,     45},
+{    1,  100,  100,   10 K,  10 M,    1,    1,    1,    1,      1,      1 X ,     210,     45},
+{    1,  100,  100,   10 K,  10 M,    1,    1,    1,    1,      1,        1 ,     210,     45},
+{  144, 1440,14400,  14400, 14400,    1,   20,  240, 1440,1440*12, 1440*12 X,       1,   156 },
+{  720,72000,72000, 7200 K,7200 M,   20,   10,   13,   11,  11*12,   11*12 X,     105,     1 }
 };
 
 #undef X
diff --git a/vcl/source/src/units.src b/vcl/source/src/units.src
index f50ea6b..aff92ad 100644
--- a/vcl/source/src/units.src
+++ b/vcl/source/src/units.src
@@ -30,6 +30,7 @@
 #include <vcl/svids.hrc>
 #endif
 
+// Amelia : adds two units , 'ch' and 'line'
 StringArray SV_FUNIT_STRINGS
 {
     ItemList [ en-US ] =
@@ -51,6 +52,8 @@ StringArray SV_FUNIT_STRINGS
         < "feet" ; FUNIT_FOOT ; > ;
         < "miles" ; FUNIT_MILE ; > ;
         < "mile" ; FUNIT_MILE ; > ;
+        < "ch" ; FUNIT_CHAR ; > ;
+        < "line" ; FUNIT_LINE ; > ;
         < "%" ; FUNIT_PERCENT ; > ;
     };
 };
commit 6c0d47b27adc0e5f23dae84ef954b56636a68cb5
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:37:51 2010 +0200

    cjk-character-units-imp.diff: add a new unit 'character unit'

diff --git a/svtools/inc/ruler.hxx b/svtools/inc/ruler.hxx
index 48df5f7..a77a517 100644
--- a/svtools/inc/ruler.hxx
+++ b/svtools/inc/ruler.hxx
@@ -690,6 +690,10 @@ private:
     USHORT              mnExtraStyle;
     USHORT              mnExtraClicks;
     USHORT              mnExtraModifier;
+// Amelia
+    long                mnCharWidth;
+    long                mnLineHeight;
+
     RulerExtra          meExtraType;
     RulerType           meDragType;
     MapUnit             meSourceUnit;
@@ -869,6 +873,9 @@ public:
 
     //set text direction right-to-left
     void                SetTextRTL(BOOL bRTL);
+
+    void                SetCharWidth( long nWidth ) { mnCharWidth = nWidth ; }
+    void                SetLineHeight( long nHeight ) { mnLineHeight = nHeight ; }
 };
 
 #endif  // _RULER_HXX
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index c013b89..dc8ee54 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -467,6 +467,25 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     long    nY;
     BOOL    bNoTicks = FALSE;
 
+    //Amelia
+    long    nTickUnit ;
+    long    nTick2 ;
+    if ( mnUnitIndex == RULER_UNIT_CHAR )
+    {
+        nTick3 = mnCharWidth;
+        nTickCount = mnCharWidth;
+        nTickUnit = mnCharWidth;
+        nTick2 = mnCharWidth;
+    }
+    else if ( mnUnitIndex == RULER_UNIT_LINE )
+    {
+        nTick3 = mnLineHeight;
+        nTickCount = mnLineHeight;
+        nTickUnit = mnLineHeight;
+        nTick2 = mnLineHeight;
+    }
+    aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
+
     // Groessenvorberechnung
     BOOL bVertRight = FALSE;
     if ( mnWinStyle & WB_HORZ )
@@ -487,7 +506,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
     if ( nMaxWidth < 0 )
         nMaxWidth *= -1;
-    nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit;
+// Amelia
+    if (( mnUnitIndex == RULER_UNIT_CHAR ) || ( mnUnitIndex == RULER_UNIT_LINE ))
+        nMaxWidth /= nTickUnit;
+    else
+        nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit;
     UniString aNumStr( UniString::CreateFromInt32( nMaxWidth ) );
     long nTxtWidth = GetTextWidth( aNumStr );
     if ( (nTxtWidth*2) > nTickWidth )
@@ -567,7 +590,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                 // Tick3 - Ausgabe (Text)
                 if ( !(nTick % nTick3) )
                 {
-                    aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit );
+                    //aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit );
+                    if ( ( mnUnitIndex == RULER_UNIT_CHAR ) || ( mnUnitIndex == RULER_UNIT_LINE ) )
+                        aNumStr = UniString::CreateFromInt32( nTick / nTickUnit );
+                    else
+                        aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit );
                     nTxtWidth2 = GetTextWidth( aNumStr )/2;
 
                     nX = nStart+n;
@@ -594,7 +621,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                 // Tick/Tick2 - Ausgabe (Striche)
                 else
                 {
-                    if ( !(nTick % aImplRulerUnitTab[mnUnitIndex].nTick2) )
+        /// Amelia
+                    if ( ( mnUnitIndex != RULER_UNIT_CHAR ) && ( mnUnitIndex != RULER_UNIT_LINE ) )
+                        nTick2 = aImplRulerUnitTab[mnUnitIndex].nTick2;
+                    if ( !(nTick % nTick2 ) )
                         nTickWidth = RULER_TICK2_WIDTH;
                     else
                         nTickWidth = RULER_TICK1_WIDTH;
@@ -2804,6 +2834,12 @@ void Ruler::SetUnit( FieldUnit eNewUnit )
             case FUNIT_PICA:
                 mnUnitIndex = RULER_UNIT_PICA;
                 break;
+            case FUNIT_CHAR:
+                mnUnitIndex = RULER_UNIT_CHAR;
+                break;
+            case FUNIT_LINE:
+                mnUnitIndex = RULER_UNIT_LINE;
+                break;
             default:
 #ifdef DBG_UTIL
                 DBG_ERRORFILE( "Ruler::SetUnit() - Wrong Unit" );
diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx
index f900004..6f8516a 100644
--- a/svtools/source/misc/unitconv.cxx
+++ b/svtools/source/misc/unitconv.cxx
@@ -63,6 +63,9 @@ void SetFieldUnit( MetricField& rField, FieldUnit eUnit, BOOL bAll )
     rField.SetUnit( eUnit );
     switch( eUnit )
     {
+        // _CHAR and _LINE sets the step of "char" and "line" unit, they are same as FUNIT_MM
+        case FUNIT_CHAR:
+        case FUNIT_LINE:
         case FUNIT_MM:
             rField.SetSpinSize( 50 );
             break;


More information about the ooo-build-commit mailing list