86e716e
From fcdf6cde90c7f9f941a5664d4b0866adcfab5db9 Mon Sep 17 00:00:00 2001
86e716e
From: Michael Stahl <mstahl@redhat.com>
86e716e
Date: Wed, 25 Jan 2012 17:56:08 +0100
86e716e
Subject: [PATCH 4/4] fdo#38542: sw: ODF import: prevent border width
86e716e
 overriding:
86e716e
MIME-Version: 1.0
86e716e
Content-Type: text/plain; charset=UTF-8
86e716e
Content-Transfer-Encoding: 8bit
86e716e
86e716e
If there is a width in fo:border{,-left,-right,-top,-bottom}, then
86e716e
it should not override the values from
86e716e
style:border-line-width{,-left,-right,-top,-bottom}, which are more
86e716e
specific in case of "double" borders.
86e716e
86e716e
Signed-off-by: C├ędric Bosdonnat <cedric.bosdonnat.ooo@free.fr>
86e716e
Signed-off-by: Noel Power <noel.power@novell.com>
86e716e
---
86e716e
 sw/source/filter/xml/xmlithlp.cxx |   37 +++++++++++++++++++++----------------
86e716e
 1 files changed, 21 insertions(+), 16 deletions(-)
86e716e
86e716e
diff --git a/sw/source/filter/xml/xmlithlp.cxx b/sw/source/filter/xml/xmlithlp.cxx
86e716e
index 7946b81..6fe9072 100644
86e716e
--- a/sw/source/filter/xml/xmlithlp.cxx
86e716e
+++ b/sw/source/filter/xml/xmlithlp.cxx
86e716e
@@ -198,23 +198,28 @@ sal_Bool lcl_frmitems_setXMLBorder( SvxBorderLine*& rpLine,
86e716e
        sal_Bool bDouble = (bHasWidth && API_LINE_DOUBLE == nStyle ) ||
86e716e
            rpLine->GetDistance();
86e716e
 
86e716e
-       // The width has to be changed
86e716e
-       if( bHasWidth && USHRT_MAX != nNamedWidth )
86e716e
+       // fdo#38542: for double borders, do not override the width
86e716e
+       // set via style:border-line-width{,-left,-right,-top,-bottom}
86e716e
+       if (!bDouble || !rpLine->GetWidth())
86e716e
        {
86e716e
-           if ( bDouble )
86e716e
-               rpLine->SetStyle( ::editeng::DOUBLE );
86e716e
-           rpLine->SetWidth( aBorderWidths[nNamedWidth] );
86e716e
-       }
86e716e
-       else
86e716e
-       {
86e716e
-           if( !bHasWidth )
86e716e
-               nWidth = rpLine->GetInWidth() + rpLine->GetDistance() +
86e716e
-                   rpLine->GetOutWidth();
86e716e
-
86e716e
-           rpLine->SetWidth( nWidth );
86e716e
-           if (bDouble)
86e716e
-           {   // fdo#38542: divide width by 3 for outer line, gap, inner line
86e716e
-               rpLine->ScaleMetrics(1, 3);
86e716e
+           // The width has to be changed
86e716e
+           if (bHasWidth && USHRT_MAX != nNamedWidth)
86e716e
+           {
86e716e
+               if (bDouble)
86e716e
+                   rpLine->SetStyle( ::editeng::DOUBLE );
86e716e
+               rpLine->SetWidth( aBorderWidths[nNamedWidth] );
86e716e
+           }
86e716e
+           else
86e716e
+           {
86e716e
+               if (!bHasWidth)
86e716e
+                   nWidth = rpLine->GetInWidth() + rpLine->GetDistance() +
86e716e
+                       rpLine->GetOutWidth();
86e716e
+
86e716e
+               rpLine->SetWidth( nWidth );
86e716e
+               if (bDouble)
86e716e
+               { // fdo#38542: divide width by 3 for outer line, gap, inner line
86e716e
+                   rpLine->ScaleMetrics(1, 3);
86e716e
+               }
86e716e
            }
86e716e
        }
86e716e
        lcl_frmitems_setXMLBorderStyle( *rpLine, nStyle );
86e716e
-- 
86e716e
1.7.7.6
86e716e