[Libreoffice-commits] .: 3 commits - editeng/inc editeng/source sw/source writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 9 09:04:47 PDT 2012


 editeng/inc/editeng/borderline.hxx               |    5 +
 editeng/source/items/borderline.cxx              |   89 ++++++++++++++++++++++-
 sw/source/filter/ww8/wrtw8esh.cxx                |    4 +
 sw/source/filter/ww8/ww8par6.cxx                 |   76 -------------------
 writerfilter/source/dmapper/ConversionHelper.cxx |   69 +----------------
 5 files changed, 103 insertions(+), 140 deletions(-)

New commits:
commit 59ab112fe93cbf4e2b052f4e8bafbdb4e6738bef
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 9 17:56:21 2012 +0200

    fdo#55526: fix import of RTF \brdrhair:
    
    This is a hairline border that should be mapped to a non-zero width
    border given that LO doesn't have hairline borders as such.
    
    Change-Id: I4a2d2f983ac8e016b2ddb6b38435f5562e545c72

diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index f81493a..610bafe 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -126,7 +126,7 @@ ConvertBorderStyleFromWord(int const nWordLineStyle)
         // First the single lines
         case  1:
         case  2: // thick line
-        case  5:
+        case  5: // hairline
         // and the unsupported special cases which we map to a single line
         case  8:
         case  9:
@@ -208,9 +208,23 @@ ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth,
     {
         // Single lines
         case SOLID:
+            switch (nWordLineStyle)
+            {
+                case 2:
+                    return (fWidth * 2.0); // thick
+                    break;
+                case 5: // fdo#55526: map 0 hairline width to > 0
+                    return (fWidth > 1.0) ? fWidth : 1.0;
+                    break;
+                default:
+                    return fWidth;
+                    break;
+            }
+            break;
+
         case DOTTED:
         case DASHED:
-            return (2 == nWordLineStyle) ? (fWidth * 2.0) : fWidth;
+            return fWidth;
             break;
 
         // Double lines
commit ecd70a727d7f559ebda1dd726cea1be472948270
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 9 17:27:52 2012 +0200

    add editeng::ConvertBorderWidthFromWord:
    
    Replace the 2 duplicate implementations of this in ww8 and writerfilter
    with a common one.  Differences were:
     2) ww8 doubles the with, writerfilter does not
    13) unsupported, mapped to THINTHICK_SMALLGAP vs. THICKTHIN_SMALLGAP
    22) unsupported, mapped to DASHED vs. SOLID
    26) INSET not supported in writerfilter
    27) OUTSET not supported in writerfilter
    
    Change-Id: I533b77394388e736f38d70284a6a11061d81e813

diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx
index 7d18587..4bb4388 100644
--- a/editeng/inc/editeng/borderline.hxx
+++ b/editeng/inc/editeng/borderline.hxx
@@ -52,9 +52,12 @@ namespace editeng {
     // values from ::com::sun::star::table::BorderLineStyle
     typedef sal_Int16 SvxBorderStyle;
 
+    // convert border style between Word formats and LO
+    SvxBorderStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int);
     /// convert border width in twips between Word formats and LO
     double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderStyle, double);
-    double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle, double);
+    double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle,
+            double, int);
 
     class EDITENG_DLLPUBLIC SvxBorderLine
     {
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 704bbfa..f81493a 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -117,6 +117,78 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth,
         aColor = *pCol;
 }
 
+
+SvxBorderStyle
+ConvertBorderStyleFromWord(int const nWordLineStyle)
+{
+    switch (nWordLineStyle)
+    {
+        // First the single lines
+        case  1:
+        case  2: // thick line
+        case  5:
+        // and the unsupported special cases which we map to a single line
+        case  8:
+        case  9:
+        case 20:
+            return SOLID;
+            break;
+        case  6:
+            return DOTTED;
+            break;
+        case  7:
+        case 22:
+            return DASHED;
+            break;
+        // then the shading beams which we represent by a double line
+        case 23:
+            return DOUBLE;
+            break;
+        // then the double lines, for which we have good matches
+        case  3:
+        case 10: // Don't have triple so use double
+        case 21: // Don't have double wave: use double instead
+            return DOUBLE;
+            break;
+        case 11:
+            return THINTHICK_SMALLGAP;
+            break;
+        case 12:
+        case 13: // Don't have thin thick thin, so use thick thin
+            return THICKTHIN_SMALLGAP;
+            break;
+        case 14:
+            return THINTHICK_MEDIUMGAP;
+            break;
+        case 15:
+        case 16: // Don't have thin thick thin, so use thick thin
+            return THICKTHIN_MEDIUMGAP;
+            break;
+        case 17:
+            return THINTHICK_LARGEGAP;
+            break;
+        case 18:
+        case 19: // Don't have thin thick thin, so use thick thin
+            return THICKTHIN_LARGEGAP;
+            break;
+        case 24:
+            return EMBOSSED;
+            break;
+        case 25:
+            return ENGRAVED;
+            break;
+        case 26:
+            return OUTSET;
+            break;
+        case 27:
+            return INSET;
+            break;
+        default:
+            return NONE;
+            break;
+    }
+}
+
 static const double THINTHICK_SMALLGAP_line2 = 15.0;
 static const double THINTHICK_SMALLGAP_gap   = 15.0;
 static const double THINTHICK_LARGEGAP_line1 = 30.0;
@@ -129,7 +201,8 @@ static const double OUTSET_line1 = 15.0;
 static const double INSET_line2  = 15.0;
 
 double
-ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth)
+ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth,
+        int const nWordLineStyle)
 {
     switch (eStyle)
     {
@@ -137,7 +210,7 @@ ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth)
         case SOLID:
         case DOTTED:
         case DASHED:
-            return fWidth;
+            return (2 == nWordLineStyle) ? (fWidth * 2.0) : fWidth;
             break;
 
         // Double lines
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 3b6503b..31ebaa8 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -1280,83 +1280,13 @@ sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPap,
 void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt8 nCol, short nIdx,
     sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize=0)
 {
-    ::editeng::SvxBorderStyle eStyle = table::BorderLineStyle::SOLID;
-    switch (nIdx)
-    {
-        // First the single lines
-        case  1:
-        case  5:
-        // and the unsupported special cases which we map to a single line
-        case  8:
-        case  9:
-        case 20:
-        case 22:
-            eStyle = table::BorderLineStyle::SOLID;
-            break;
-        case  2:
-            {
-                eStyle = table::BorderLineStyle::SOLID;
-                nLineThickness *= 2;
-            }
-            break;
-        case  6:
-            eStyle = table::BorderLineStyle::DOTTED;
-            break;
-        case  7:
-            eStyle = table::BorderLineStyle::DASHED;
-            break;
-        // then the shading beams which we represent by a double line
-        case 23:
-            eStyle = table::BorderLineStyle::DOUBLE;
-            break;
-        // then the double lines, for which we have good matches
-        case  3:
-        case 10: //Don't have tripple so use double
-        case 21: //Don't have double wave: use double instead
-            eStyle = table::BorderLineStyle::DOUBLE;
-            break;
-        case 11:
-            eStyle = table::BorderLineStyle::THINTHICK_SMALLGAP;
-            break;
-        case 12:
-        case 13: //Don't have thin thick thin, so use thick thin
-            eStyle = table::BorderLineStyle::THICKTHIN_SMALLGAP;
-            break;
-        case 14:
-            eStyle = table::BorderLineStyle::THINTHICK_MEDIUMGAP;
-            break;
-        case 15:
-        case 16: //Don't have thin thick thin, so use thick thin
-            eStyle = table::BorderLineStyle::THICKTHIN_MEDIUMGAP;
-            break;
-        case 17:
-            eStyle = table::BorderLineStyle::THINTHICK_LARGEGAP;
-            break;
-        case 18:
-        case 19: //Don't have thin thick thin, so use thick thin
-            eStyle = table::BorderLineStyle::THICKTHIN_LARGEGAP;
-            break;
-        case 24:
-            eStyle = table::BorderLineStyle::EMBOSSED;
-            break;
-        case 25:
-            eStyle = table::BorderLineStyle::ENGRAVED;
-            break;
-        case 26:
-            eStyle = table::BorderLineStyle::OUTSET;
-            break;
-        case 27:
-            eStyle = table::BorderLineStyle::INSET;
-            break;
-        default:
-            eStyle = table::BorderLineStyle::NONE;
-            break;
-    }
+    ::editeng::SvxBorderStyle const eStyle(
+            ::editeng::ConvertBorderStyleFromWord(nIdx));
 
     ::editeng::SvxBorderLine aLine;
     aLine.SetBorderLineStyle( eStyle );
     double const fConverted( (table::BorderLineStyle::NONE == eStyle) ? 0.0 :
-            ::editeng::ConvertBorderWidthFromWord(eStyle, nLineThickness));
+        ::editeng::ConvertBorderWidthFromWord(eStyle, nLineThickness, nIdx));
     aLine.SetWidth(fConverted);
 
     //No AUTO for borders as yet, so if AUTO, use BLACK
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index d428fc1..40ea9bd 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -133,77 +133,16 @@ void MakeBorderLine( sal_Int32 nLineThickness,   sal_Int32 nLineType,
     if(!bIsOOXML && sal::static_int_cast<sal_uInt32>(nLineColor) < SAL_N_ELEMENTS(aBorderDefColor))
         nLineColor = aBorderDefColor[nLineColor];
 
-    sal_Int16 nLineStyle = NONE;
     // Map to our border types, we should use of one equal line
     // thickness, or one of smaller thickness. If too small we
     // can make the defecit up in additional white space or
     // object size
-    switch(nLineType)
-    {
-        // First the single lines
-        case  1:
-        case  2:
-        case  5:
-            nLineStyle = SOLID;
-            break;
-        // Dotted and dashed lines
-        case  6:
-            nLineStyle = DOTTED;
-            break;
-        case  7:
-        case 22:
-            nLineStyle = DASHED;
-            break;
-        // and the unsupported special cases which we map to a single line
-        case  8:
-        case  9:
-        case 20:
-            nLineStyle = SOLID;
-            break;
-        // Double line
-        case 3:
-        case 10: //Don't have tripple so use double
-        case 21:
-        case 23:
-            nLineStyle = DOUBLE;
-            break;
-        case 11:
-        case 13: //Don't have thin thick thin, so use thick thin
-            nLineStyle = THINTHICK_SMALLGAP;
-            break;
-        case 12:
-            nLineStyle = THICKTHIN_SMALLGAP;
-            break;
-        case 14:
-            nLineStyle = THINTHICK_MEDIUMGAP;
-            break;
-        case 15:
-        case 16: //Don't have thin thick thin, so use thick thin
-            nLineStyle = THICKTHIN_MEDIUMGAP;
-            break;
-        case 17:
-            nLineStyle = THINTHICK_LARGEGAP;
-            break;
-        case 18:
-        case 19: //Don't have thin thick thin, so use thick thin
-            nLineStyle = THICKTHIN_LARGEGAP;
-            break;
-        // Embossed and engraved lines
-        case 24:
-            nLineStyle = EMBOSSED;
-            break;
-        case 25:
-            nLineStyle = ENGRAVED;
-            break;
-        case 0:
-        case 255:
-        default:
-            break;
-    }
-
+    ::editeng::SvxBorderStyle const nLineStyle(
+            ::editeng::ConvertBorderStyleFromWord(nLineType));
     rToFill.LineStyle = nLineStyle;
     double const fConverted( (NONE == nLineStyle) ? 0.0 :
-        ::editeng::ConvertBorderWidthFromWord(nLineStyle, nLineThickness));
+        ::editeng::ConvertBorderWidthFromWord(nLineStyle, nLineThickness,
+            nLineType));
     rToFill.LineWidth = convertTwipToMM100(fConverted);
     rToFill.Color = nLineColor;
 }
commit c1d2eed375293d7c27bb885f344cc24ec0cd40ca
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 9 13:32:15 2012 +0200

    fdo#54648: WW8 export: test that FlyFrm actually has layout frm
    
    The bugdoc has 2 "hidden" drawing objects that are invisible.
    
    Change-Id: I58179f2e620348db5357b38f834e1edca1f20ae2

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index c71bae9..6d88668 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1648,6 +1648,10 @@ bool lcl_isInHeader(const SwFrmFmt& rFmt)
     if (!pFlyFrmFmt)
         return false;
     SwFlyFrm* pFlyFrm = const_cast<SwFlyFrm*>(pFlyFrmFmt->GetFrm());
+    if (!pFlyFrm) // fdo#54648: "hidden" drawing object has no layout frame
+    {
+        return false;
+    }
     SwPageFrm* pPageFrm = pFlyFrm->FindPageFrmOfAnchor();
     SwFrm* pHeader = pPageFrm->Lower();
     if (pHeader->GetType() == FRM_HEADER)


More information about the Libreoffice-commits mailing list