[Libreoffice-commits] .: 6 commits - cui/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Sat Mar 19 10:17:04 PDT 2011


 cui/source/inc/border.hxx      |    5 -
 cui/source/tabpages/border.cxx |  180 +++++++++++++++++------------------------
 cui/source/tabpages/border.hrc |    2 
 cui/source/tabpages/border.src |   26 +++++
 4 files changed, 106 insertions(+), 107 deletions(-)

New commits:
commit 940604a607307f6bf6eb706f062eaeb8108bff59
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Jan 7 14:45:54 2011 +0100

    Missing conversion from Twip to pt

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 3788054..43459cf 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -88,57 +88,6 @@ sal_Bool SvxBorderTabPage::bSync = sal_True;
 
 //------------------------------------------------------------------------
 
-#define LINE_WIDTH0		(DEF_LINE_WIDTH_0 *100)
-#define LINE_WIDTH1		(DEF_LINE_WIDTH_1 *100)
-#define LINE_WIDTH2		(DEF_LINE_WIDTH_2 *100)
-#define LINE_WIDTH3		(DEF_LINE_WIDTH_3 *100)
-#define LINE_WIDTH4		(DEF_LINE_WIDTH_4 *100)
-#define LINE_WIDTH5     (DEF_LINE_WIDTH_5 *100)
-
-#define DLINE0_OUT		(DEF_DOUBLE_LINE0_OUT  *100)
-#define DLINE0_IN		(DEF_DOUBLE_LINE0_IN   *100)
-#define DLINE0_DIST		(DEF_DOUBLE_LINE0_DIST *100)
-
-#define DLINE1_OUT		(DEF_DOUBLE_LINE1_OUT  *100)
-#define DLINE1_IN		(DEF_DOUBLE_LINE1_IN   *100)
-#define DLINE1_DIST		(DEF_DOUBLE_LINE1_DIST *100)
-
-#define DLINE2_OUT		(DEF_DOUBLE_LINE2_OUT  *100)
-#define DLINE2_IN		(DEF_DOUBLE_LINE2_IN   *100)
-#define DLINE2_DIST		(DEF_DOUBLE_LINE2_DIST *100)
-
-#define DLINE3_OUT		(DEF_DOUBLE_LINE3_OUT  *100)
-#define DLINE3_IN		(DEF_DOUBLE_LINE3_IN   *100)
-#define DLINE3_DIST		(DEF_DOUBLE_LINE3_DIST *100)
-
-#define DLINE4_OUT		(DEF_DOUBLE_LINE4_OUT  *100)
-#define DLINE4_IN		(DEF_DOUBLE_LINE4_IN   *100)
-#define DLINE4_DIST		(DEF_DOUBLE_LINE4_DIST *100)
-
-#define DLINE5_OUT		(DEF_DOUBLE_LINE5_OUT  *100)
-#define DLINE5_IN		(DEF_DOUBLE_LINE5_IN   *100)
-#define DLINE5_DIST		(DEF_DOUBLE_LINE5_DIST *100)
-
-#define DLINE6_OUT		(DEF_DOUBLE_LINE6_OUT  *100)
-#define DLINE6_IN		(DEF_DOUBLE_LINE6_IN   *100)
-#define DLINE6_DIST		(DEF_DOUBLE_LINE6_DIST *100)
-
-#define DLINE7_OUT		(DEF_DOUBLE_LINE7_OUT  *100)
-#define DLINE7_IN		(DEF_DOUBLE_LINE7_IN   *100)
-#define DLINE7_DIST		(DEF_DOUBLE_LINE7_DIST *100)
-
-#define DLINE8_OUT		(DEF_DOUBLE_LINE8_OUT  *100)
-#define DLINE8_IN		(DEF_DOUBLE_LINE8_IN   *100)
-#define DLINE8_DIST		(DEF_DOUBLE_LINE8_DIST *100)
-
-#define DLINE9_OUT		(DEF_DOUBLE_LINE9_OUT  *100)
-#define DLINE9_IN		(DEF_DOUBLE_LINE9_IN   *100)
-#define DLINE9_DIST		(DEF_DOUBLE_LINE9_DIST *100)
-
-#define DLINE10_OUT		(DEF_DOUBLE_LINE10_OUT *100)
-#define DLINE10_IN		(DEF_DOUBLE_LINE10_IN  *100)
-#define DLINE10_DIST	(DEF_DOUBLE_LINE10_DIST*100)
-
 #define RGBCOL(eColorName) (TpBorderRGBColor(eColorName))
 
 // LOKALE FUNKTION
@@ -555,7 +504,10 @@ void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
         if( bWidthEq )
         {
             // Determine the width first as some styles can be missing depending on it
-            aLineWidthMF.SetValue( sal_Int64( nWidth ) );
+            sal_Int64 nWidthPt = MetricField::ConvertDoubleValue(
+                        sal_Int64( nWidth ), aLineWidthMF.GetDecimalDigits( ),
+                        MAP_TWIP, aLineWidthMF.GetUnit() );
+            aLineWidthMF.SetValue( nWidthPt );
             aLbLineStyle.SetWidth( nWidth );
 
             // then set the style
commit 3b3379e278943ba221841c86d2a01c2e47ab5773
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Thu Jan 6 15:58:55 2011 +0100

    One LineListBox to rule them all: started improving column sep line

diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 5063610..27d692c 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -78,7 +78,7 @@ private:
     FixedLine           aFlSep1;
     FixedLine			aFlLine;
     FixedText           aStyleFT;
-    LineStyleListBox    aLbLineStyle;
+    LineListBox    aLbLineStyle;
     FixedText           aColorFT;
     ColorListBox		aLbLineColor;
     FixedText           aWidthFT;
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 3321f89..3788054 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -555,15 +555,11 @@ void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
         if( bWidthEq )
         {
             // Determine the width first as some styles can be missing depending on it
-            aLineWidthMF.SetValue( sal_Int64( nWidth * 5 ) );
-            aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
+            aLineWidthMF.SetValue( sal_Int64( nWidth ) );
+            aLbLineStyle.SetWidth( nWidth );
 
             // then set the style
-            // TODO Change the SelectEntry method
-            SvxBorderLine aLine( NULL, nWidth, nStyle );
-            aLbLineStyle.SelectEntry( aLine.GetOutWidth() * 5,
-                    aLine.GetInWidth() * 5,
-                    aLine.GetDistance() * 5, nStyle );
+            aLbLineStyle.SelectEntry( nStyle );
         }
         else
             aLbLineStyle.SelectEntryPos( 1 );
@@ -929,10 +925,13 @@ IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb )
 
 IMPL_LINK( SvxBorderTabPage, ModifyWidthHdl_Impl, void *, EMPTYARG )
 {
-    sal_Int64 nVal = aLineWidthMF.GetValue( );
+    sal_Int64 nVal = MetricField::ConvertDoubleValue(
+                aLineWidthMF.GetValue( ),
+                aLineWidthMF.GetDecimalDigits( ),
+                aLineWidthMF.GetUnit(), MAP_TWIP );
     aLbLineStyle.SetWidth( nVal );
 
-    aFrameSel.SetStyleToSelection( long( nVal / 5 ),
+    aFrameSel.SetStyleToSelection( nVal,
         SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
 
     return 0;
@@ -943,8 +942,14 @@ IMPL_LINK( SvxBorderTabPage, ModifyWidthHdl_Impl, void *, EMPTYARG )
 IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb )
 {
     if ( pLb == &aLbLineStyle )
-        aFrameSel.SetStyleToSelection ( long( aLineWidthMF.GetValue() / 5 ),
+    {
+        sal_Int64 nVal = MetricField::ConvertDoubleValue(
+                    aLineWidthMF.GetValue( ),
+                    aLineWidthMF.GetDecimalDigits( ),
+                    aLineWidthMF.GetUnit(), MAP_TWIP );
+        aFrameSel.SetStyleToSelection ( nVal,
             SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
+    }
 
     return 0;
 }
@@ -1100,6 +1105,8 @@ Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
 
 void SvxBorderTabPage::FillLineListBox_Impl()
 {
+    aLbLineStyle.SetSourceUnit( FUNIT_TWIP );
+
     aLbLineStyle.SetNone( SVX_RESSTR( RID_SVXSTR_NONE ) );
 
     // Simple lines
@@ -1125,12 +1132,16 @@ void SvxBorderTabPage::FillLineListBox_Impl()
             &lcl_mediumColor );
 
     // Inset / Outset
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 5,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10,
            &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 5,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10,
            &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
 
-    aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
+    sal_Int64 nVal = MetricField::ConvertDoubleValue(
+                aLineWidthMF.GetValue( ),
+                aLineWidthMF.GetDecimalDigits( ),
+                aLineWidthMF.GetUnit(), MAP_TWIP );
+    aLbLineStyle.SetWidth( nVal );
 }
 
 // -----------------------------------------------------------------------
commit 7ba3c4cb83e978d916f48bdf73d2c671e0826164
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Jan 4 13:40:59 2011 +0100

    Fixed units mess in SvxBorderLine and BorderLineImpl

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index e015cf9..3321f89 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -549,18 +549,21 @@ void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
     //-------------------------------------------------------------
     {
         // Do all visible lines show the same line widths?
-        sal_uInt16 nPrim, nDist, nSecn;
+        long nWidth;
         SvxBorderStyle nStyle;
-        bool bWidthEq = aFrameSel.GetVisibleWidth( nPrim, nDist, nSecn, nStyle );
+        bool bWidthEq = aFrameSel.GetVisibleWidth( nWidth, nStyle );
         if( bWidthEq )
         {
             // Determine the width first as some styles can be missing depending on it
-            long nWidth = aLbLineStyle.GetWidthFromStyle( nPrim * 5, nSecn * 5, nDist * 5, nStyle );
-            aLineWidthMF.SetValue( sal_Int64( nWidth ) );
+            aLineWidthMF.SetValue( sal_Int64( nWidth * 5 ) );
             aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
 
             // then set the style
-            aLbLineStyle.SelectEntry( nPrim * 5, nSecn * 5, nDist * 5, nStyle );
+            // TODO Change the SelectEntry method
+            SvxBorderLine aLine( NULL, nWidth, nStyle );
+            aLbLineStyle.SelectEntry( aLine.GetOutWidth() * 5,
+                    aLine.GetInWidth() * 5,
+                    aLine.GetDistance() * 5, nStyle );
         }
         else
             aLbLineStyle.SelectEntryPos( 1 );
@@ -1106,25 +1109,25 @@ void SvxBorderTabPage::FillLineListBox_Impl()
 
     // Double lines
     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 100 );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 );
     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 100 );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 );
     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
 
     // Engraved / Embossed
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 75,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15,
             &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
             &lcl_mediumColor );
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 75,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15,
             &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
             &lcl_mediumColor );
 
     // Inset / Outset
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 0.5,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 5,
            &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
-    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 0.5,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 5,
            &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
 
     aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
commit 697b33e1e85987e72bb5164cf92841b950f155d3
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Dec 24 09:59:30 2010 +0100

    Fix border selection page to use new width system

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index a82132c..e015cf9 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -929,10 +929,7 @@ IMPL_LINK( SvxBorderTabPage, ModifyWidthHdl_Impl, void *, EMPTYARG )
     sal_Int64 nVal = aLineWidthMF.GetValue( );
     aLbLineStyle.SetWidth( nVal );
 
-    aFrameSel.SetStyleToSelection(
-        static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine1() / 5 ),
-        static_cast< USHORT >( aLbLineStyle.GetSelectEntryDistance() / 5 ),
-        static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine2() / 5 ),
+    aFrameSel.SetStyleToSelection( long( nVal / 5 ),
         SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
 
     return 0;
@@ -943,10 +940,7 @@ IMPL_LINK( SvxBorderTabPage, ModifyWidthHdl_Impl, void *, EMPTYARG )
 IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb )
 {
     if ( pLb == &aLbLineStyle )
-        aFrameSel.SetStyleToSelection (
-            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryLine1() / 5 ),
-            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryDistance() / 5 ),
-            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryLine2() / 5 ),
+        aFrameSel.SetStyleToSelection ( long( aLineWidthMF.GetValue() / 5 ),
             SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
 
     return 0;
commit 559c8194fd9bb537d779436a9bd8bd777814f9c1
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Mon Nov 8 16:25:04 2010 +0100

    Borders: SvxBorderLine widths definition changes

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 5858a70..a82132c 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -1106,39 +1106,31 @@ void SvxBorderTabPage::FillLineListBox_Impl()
     aLbLineStyle.SetNone( SVX_RESSTR( RID_SVXSTR_NONE ) );
 
     // Simple lines
-    aLbLineStyle.InsertEntry( 1.0, 0.0, 0.0, CHANGE_LINE1, SOLID );
-    aLbLineStyle.InsertEntry( 1.0, 0.0, 0.0, CHANGE_LINE1, DOTTED );
-    aLbLineStyle.InsertEntry( 1.0, 0.0, 0.0, CHANGE_LINE1, DASHED );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED );
 
     // Double lines
-    aLbLineStyle.InsertEntry( 1.0, 1.0, 1.0, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, DOUBLE );
-    aLbLineStyle.InsertEntry( 1.0, 75.0, 75.0, CHANGE_LINE1, THINTHICK_SMALLGAP, 100 );
-    aLbLineStyle.InsertEntry( 1.0, 0.5, 0.5, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, THINTHICK_MEDIUMGAP );
-    aLbLineStyle.InsertEntry( 75.0, 150.0, 1.0, CHANGE_DIST, THINTHICK_LARGEGAP );
-    aLbLineStyle.InsertEntry( 75.0, 1.0, 75.0, CHANGE_LINE2, THICKTHIN_SMALLGAP, 100 );
-    aLbLineStyle.InsertEntry( 0.5, 1.0, 0.5, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, THICKTHIN_MEDIUMGAP );
-    aLbLineStyle.InsertEntry( 150.0, 75.0, 1.0, CHANGE_DIST, THICKTHIN_LARGEGAP );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 100 );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 100 );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
 
     // Engraved / Embossed
-    /*
-     *  Word compat: the lines widths are exactly following this rule, shouldbe:
-     *      0.75pt up to 3pt and then 3pt
-     */
-    aLbLineStyle.InsertEntry( 0.5, 0.5, 1, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, EMBOSSED, 75,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 75,
             &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
             &lcl_mediumColor );
-    aLbLineStyle.InsertEntry( 0.5, 0.5, 1, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, ENGRAVED, 75,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 75,
             &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
             &lcl_mediumColor );
 
     // Inset / Outset
-    /*
-     * Word compat: the gap width should be measured relatively to the biggest width for the
-     *      row or column.
-     */
-    aLbLineStyle.InsertEntry( 75.0, 1.0, 1.0, CHANGE_LINE2 | CHANGE_DIST, OUTSET, 0.5,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 0.5,
            &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
-    aLbLineStyle.InsertEntry( 1.0, 75.0, 1.0, CHANGE_LINE1 | CHANGE_DIST, INSET, 0.5,
+    aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 0.5,
            &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
 
     aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
commit c0fa20b9b06bca9f13841078f7d3beb2045843ae
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Sat Nov 6 19:22:51 2010 +0100

    Nicely draw borders using drawinglayer

diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 1d3be2c..5063610 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -78,9 +78,11 @@ private:
     FixedLine           aFlSep1;
     FixedLine			aFlLine;
     FixedText           aStyleFT;
-    LineListBox         aLbLineStyle;
+    LineStyleListBox    aLbLineStyle;
     FixedText           aColorFT;
     ColorListBox		aLbLineColor;
+    FixedText           aWidthFT;
+    MetricField 		aLineWidthMF;
 
     FixedLine           aFlSep2;
     FixedLine			aDistanceFL;
@@ -133,6 +135,7 @@ private:
     DECL_LINK( SelSdwHdl_Impl, void* );
     DECL_LINK( LinesChanged_Impl, void* );
     DECL_LINK( ModifyDistanceHdl_Impl, MetricField*);
+    DECL_LINK( ModifyWidthHdl_Impl, void*);
     DECL_LINK( SyncHdl_Impl, CheckBox*);
 
     sal_uInt16              GetPresetImageId( sal_uInt16 nValueSetIdx ) const;
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 0a94bc7..5858a70 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -86,7 +86,6 @@ static sal_uInt16 pRanges[] =
 
 sal_Bool SvxBorderTabPage::bSync = sal_True;
 
-
 //------------------------------------------------------------------------
 
 #define LINE_WIDTH0		(DEF_LINE_WIDTH_0 *100)
@@ -179,6 +178,8 @@ SvxBorderTabPage::SvxBorderTabPage( Window* pParent,
         aLbLineStyle    ( this, CUI_RES( LB_LINESTYLE ) ),
         aColorFT        ( this, CUI_RES( FT_COLOR ) ),
         aLbLineColor    ( this, CUI_RES( LB_LINECOLOR ) ),
+        aWidthFT        ( this, CUI_RES( FT_WIDTH ) ),
+        aLineWidthMF    ( this, CUI_RES( MF_LINEWIDTH ) ),
 
         aFlSep2         ( this, CUI_RES( FL_SEPARATOR2 ) ),
         aDistanceFL     ( this, CUI_RES( FL_DISTANCE ) ),
@@ -329,6 +330,7 @@ SvxBorderTabPage::SvxBorderTabPage( Window* pParent,
     aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl));
     aLbLineStyle.SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) );
     aLbLineColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
+    aLineWidthMF.SetModifyHdl( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) );
     aLbShadowColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
     aWndPresets.SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
     aWndShadows.SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
@@ -439,7 +441,6 @@ void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
 
     pBoxItem  = (const SvxBoxItem*)GetItem( rSet, SID_ATTR_BORDER_OUTER );
 
-
     pBoxInfoItem = (const SvxBoxInfoItem*)GetItem( rSet, SID_ATTR_BORDER_INNER, sal_False );
 
     eCoreUnit = rSet.GetPool()->GetMetric( nWhichBox );
@@ -552,7 +553,15 @@ void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
         SvxBorderStyle nStyle;
         bool bWidthEq = aFrameSel.GetVisibleWidth( nPrim, nDist, nSecn, nStyle );
         if( bWidthEq )
-            aLbLineStyle.SelectEntry( nPrim * 100, nSecn * 100, nDist * 100, nStyle );
+        {
+            // Determine the width first as some styles can be missing depending on it
+            long nWidth = aLbLineStyle.GetWidthFromStyle( nPrim * 5, nSecn * 5, nDist * 5, nStyle );
+            aLineWidthMF.SetValue( sal_Int64( nWidth ) );
+            aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
+
+            // then set the style
+            aLbLineStyle.SelectEntry( nPrim * 5, nSecn * 5, nDist * 5, nStyle );
+        }
         else
             aLbLineStyle.SelectEntryPos( 1 );
 
@@ -915,33 +924,30 @@ IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb )
     return 0;
 }
 
-// -----------------------------------------------------------------------
-
-SvxBorderStyle lcl_getBorderStyle( sal_uInt16 nStyle )
+IMPL_LINK( SvxBorderTabPage, ModifyWidthHdl_Impl, void *, EMPTYARG )
 {
-    SvxBorderStyle nResult = SOLID;
-    switch ( nStyle )
-    {
-        case STYLE_DOTTED:
-            nResult = DOTTED;
-            break;
-        case STYLE_DASHED:
-            nResult = DASHED;
-            break;
-        default:
-            nResult = SOLID;
-    }
-    return nResult;
+    sal_Int64 nVal = aLineWidthMF.GetValue( );
+    aLbLineStyle.SetWidth( nVal );
+
+    aFrameSel.SetStyleToSelection(
+        static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine1() / 5 ),
+        static_cast< USHORT >( aLbLineStyle.GetSelectEntryDistance() / 5 ),
+        static_cast< USHORT >( aLbLineStyle.GetSelectEntryLine2() / 5 ),
+        SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
+
+    return 0;
 }
 
+// -----------------------------------------------------------------------
+
 IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb )
 {
     if ( pLb == &aLbLineStyle )
-        aFrameSel.SetStyleToSelection(
-            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryLine1() / 100 ),
-            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryDistance() / 100 ),
-            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryLine2() / 100 ),
-            lcl_getBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
+        aFrameSel.SetStyleToSelection (
+            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryLine1() / 5 ),
+            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryDistance() / 5 ),
+            static_cast< sal_uInt16 >( aLbLineStyle.GetSelectEntryLine2() / 5 ),
+            SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
 
     return 0;
 }
@@ -1090,38 +1096,52 @@ void SvxBorderTabPage::FillValueSets()
 }
 
 // ============================================================================
+Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
+{
+    return SvxBorderLine::threeDMediumColor( aMain );
+}
 
 void SvxBorderTabPage::FillLineListBox_Impl()
 {
-    aLbLineStyle.SetUnit( FUNIT_POINT );
-    aLbLineStyle.SetSourceUnit( FUNIT_TWIP );
-
-    // Writer 2.0 Defaults:
-    aLbLineStyle.InsertEntry( SVX_RESSTR( RID_SVXSTR_NONE ) );
-
-    aLbLineStyle.InsertEntry( LINE_WIDTH0 );
-    aLbLineStyle.InsertEntry( LINE_WIDTH5 );
-    aLbLineStyle.InsertEntry( LINE_WIDTH5, 0, 0, STYLE_DOTTED );
-    aLbLineStyle.InsertEntry( LINE_WIDTH5, 0, 0, STYLE_DASHED );
-    aLbLineStyle.InsertEntry( LINE_WIDTH1 );
-    aLbLineStyle.InsertEntry( LINE_WIDTH2 );
-    aLbLineStyle.InsertEntry( LINE_WIDTH3 );
-    aLbLineStyle.InsertEntry( LINE_WIDTH4 );
-
-    // OS: wenn hier neue Linienstaerken zugfuegt werden, dann
-    // LINESTYLE_HTML_MAX anpassen
-
-    aLbLineStyle.InsertEntry( DLINE0_OUT, DLINE0_IN, DLINE0_DIST );
-    aLbLineStyle.InsertEntry( DLINE7_OUT, DLINE7_IN, DLINE7_DIST );
-    aLbLineStyle.InsertEntry( DLINE1_OUT, DLINE1_IN, DLINE1_DIST );
-    aLbLineStyle.InsertEntry( DLINE2_OUT, DLINE2_IN, DLINE2_DIST );
-    aLbLineStyle.InsertEntry( DLINE8_OUT, DLINE8_IN, DLINE8_DIST );
-    aLbLineStyle.InsertEntry( DLINE9_OUT, DLINE9_IN, DLINE9_DIST );
-    aLbLineStyle.InsertEntry( DLINE10_OUT,DLINE10_IN,DLINE10_DIST);
-    aLbLineStyle.InsertEntry( DLINE3_OUT, DLINE3_IN, DLINE3_DIST );
-    aLbLineStyle.InsertEntry( DLINE4_OUT, DLINE4_IN, DLINE4_DIST );
-    aLbLineStyle.InsertEntry( DLINE5_OUT, DLINE5_IN, DLINE5_DIST );
-    aLbLineStyle.InsertEntry( DLINE6_OUT, DLINE6_IN, DLINE6_DIST );
+    aLbLineStyle.SetNone( SVX_RESSTR( RID_SVXSTR_NONE ) );
+
+    // Simple lines
+    aLbLineStyle.InsertEntry( 1.0, 0.0, 0.0, CHANGE_LINE1, SOLID );
+    aLbLineStyle.InsertEntry( 1.0, 0.0, 0.0, CHANGE_LINE1, DOTTED );
+    aLbLineStyle.InsertEntry( 1.0, 0.0, 0.0, CHANGE_LINE1, DASHED );
+
+    // Double lines
+    aLbLineStyle.InsertEntry( 1.0, 1.0, 1.0, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, DOUBLE );
+    aLbLineStyle.InsertEntry( 1.0, 75.0, 75.0, CHANGE_LINE1, THINTHICK_SMALLGAP, 100 );
+    aLbLineStyle.InsertEntry( 1.0, 0.5, 0.5, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, THINTHICK_MEDIUMGAP );
+    aLbLineStyle.InsertEntry( 75.0, 150.0, 1.0, CHANGE_DIST, THINTHICK_LARGEGAP );
+    aLbLineStyle.InsertEntry( 75.0, 1.0, 75.0, CHANGE_LINE2, THICKTHIN_SMALLGAP, 100 );
+    aLbLineStyle.InsertEntry( 0.5, 1.0, 0.5, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, THICKTHIN_MEDIUMGAP );
+    aLbLineStyle.InsertEntry( 150.0, 75.0, 1.0, CHANGE_DIST, THICKTHIN_LARGEGAP );
+
+    // Engraved / Embossed
+    /*
+     *  Word compat: the lines widths are exactly following this rule, shouldbe:
+     *      0.75pt up to 3pt and then 3pt
+     */
+    aLbLineStyle.InsertEntry( 0.5, 0.5, 1, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, EMBOSSED, 75,
+            &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
+            &lcl_mediumColor );
+    aLbLineStyle.InsertEntry( 0.5, 0.5, 1, CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, ENGRAVED, 75,
+            &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
+            &lcl_mediumColor );
+
+    // Inset / Outset
+    /*
+     * Word compat: the gap width should be measured relatively to the biggest width for the
+     *      row or column.
+     */
+    aLbLineStyle.InsertEntry( 75.0, 1.0, 1.0, CHANGE_LINE2 | CHANGE_DIST, OUTSET, 0.5,
+           &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
+    aLbLineStyle.InsertEntry( 1.0, 75.0, 1.0, CHANGE_LINE1 | CHANGE_DIST, INSET, 0.5,
+           &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
+
+    aLbLineStyle.SetWidth( aLineWidthMF.GetValue( ) );
 }
 
 // -----------------------------------------------------------------------
diff --git a/cui/source/tabpages/border.hrc b/cui/source/tabpages/border.hrc
index c346ef2..4dcfbf1 100644
--- a/cui/source/tabpages/border.hrc
+++ b/cui/source/tabpages/border.hrc
@@ -37,6 +37,7 @@
 #define FL_LINE                 20
 #define LB_LINESTYLE            21
 #define LB_LINECOLOR            22
+#define MF_LINEWIDTH            23
 
 #define FL_SEPARATOR2           29
 #define FL_SHADOW               30
@@ -67,6 +68,7 @@
 #define FL_PROPERTIES           64
 #define CB_MERGEWITHNEXT        65
 #define CB_MERGEADJACENTBORDERS 66
+#define FT_WIDTH                67
 
 // ImageListe fuer ValueSets:
 #define IL_PRE_BITMAPS			1400
diff --git a/cui/source/tabpages/border.src b/cui/source/tabpages/border.src
index 3d2d295..10599d5 100644
--- a/cui/source/tabpages/border.src
+++ b/cui/source/tabpages/border.src
@@ -97,10 +97,32 @@ TabPage RID_SVXPAGE_BORDER
         Border = TRUE ;
         Pos = MAP_APPFONT ( 88 , 25 ) ;
         Size = MAP_APPFONT ( 74 , 66 ) ;
+        DropDown = TRUE ;
+    };
+    FixedText FT_WIDTH
+    {
+        Pos = MAP_APPFONT ( 88, 39 ) ;
+        Size = MAP_APPFONT ( 77, 8 ) ;
+        Text [ en-US ] = "~Width";
+    };
+    MetricField MF_LINEWIDTH
+    {
+        Border = TRUE ;
+        Pos = MAP_APPFONT ( 88 , 50 ) ;
+        Size = MAP_APPFONT ( 74 , 12 ) ;
+        Spin = TRUE ;
+        Repeat = TRUE ;
+        SpinSize = 25 ;
+        First = 25 ;
+        Last = 900 ;
+        Maximum = 900 ;
+        Minimum = 25 ;
+        DecimalDigits = 2 ;
+        Unit = FUNIT_POINT ;
     };
     FixedText FT_COLOR
     {
-        Pos = MAP_APPFONT ( 88, 95 ) ;
+        Pos = MAP_APPFONT ( 88, 64 ) ;
         Size = MAP_APPFONT ( 77, 8 ) ;
         Text [ en-US ] = "~Color";
     };
@@ -108,7 +130,7 @@ TabPage RID_SVXPAGE_BORDER
     {
         HelpID = "cui:ListBox:RID_SVXPAGE_BORDER:LB_LINECOLOR";
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 88 , 106 ) ;
+        Pos = MAP_APPFONT ( 88 , 75 ) ;
         Size = MAP_APPFONT ( 74 , 68 ) ;
         DropDown = TRUE ;
         DDExtraWidth = TRUE ;


More information about the Libreoffice-commits mailing list