diff options
author | Amelia Wang <amwang@novell.com> | 2010-09-13 14:37:51 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-09-13 15:57:00 +0200 |
commit | 51fb3c7f1925c7d1604549dfd8fcc0139e54a36b (patch) | |
tree | 627f4274dac57bb920717093a86e10d82008a1ba /svtools | |
parent | a04351284c4e084ab42a608e72f54eec47735730 (diff) |
cjk-character-units-imp.diff: add a new unit 'character unit'
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/ruler.hxx | 7 | ||||
-rw-r--r-- | svtools/source/control/ruler.cxx | 42 | ||||
-rw-r--r-- | svtools/source/misc/unitconv.cxx | 3 |
3 files changed, 49 insertions, 3 deletions
diff --git a/svtools/inc/ruler.hxx b/svtools/inc/ruler.hxx index c2649b298ba6..bcf441e5c2d2 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 6fcbd92597ba..9cf87414650b 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 612bcb4f0221..709ead2584a8 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; |