[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Dec 15 05:51:05 PST 2014


 sw/qa/extras/htmlexport/htmlexport.cxx        |    4 +-
 sw/qa/extras/rtfimport/data/fdo85179.rtf      |    4 ++
 sw/qa/extras/rtfimport/data/fdo86761.rtf      |   42 ++++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx          |    6 +++
 writerfilter/source/dmapper/GraphicImport.cxx |    3 +
 writerfilter/source/rtftok/rtfsdrimport.cxx   |    2 +
 6 files changed, 58 insertions(+), 3 deletions(-)

New commits:
commit cfb770dc619fc33796b98ca900eb3fd7f714139e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Dec 14 11:13:17 2014 +0100

    fdo#86761 RTF import: positive border width and fLine=0 means no border
    
    Regression from 01a32b7d074511bed24044dc94e1159aea62722b (fdo#85179 RTF
    filter: import image border, 2014-10-23), there were a number of
    problems here:
    
    - CppunitTest_sw_htmlexport: revert back to the old behavior, where in
      case there is no border, we don't set the color of it.
    - The testcase of the above commit omitted fLine=1 shape property, which
      is present in the original bugdoc, and only with that should we put a
      border around the shape.
    - Let fLine=1 explicitly change the line style from NONE.
    - dmapper: if line style is NONE, then don't bother setting the border
      color and width.
    
    (cherry picked from commit 4568d1d298bf4fc98dcd86384743a04587a2fe6f)
    
    Conflicts:
    	writerfilter/source/dmapper/GraphicImport.cxx
    
    Change-Id: Iffee41066d42822b699c478821645b9742df3f58
    Reviewed-on: https://gerrit.libreoffice.org/13470
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 15834fe..a377195 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -122,7 +122,7 @@ DECLARE_HTMLEXPORT_TEST(testExportOfImages, "textAndImage.docx")
     CPPUNIT_ASSERT(pDoc);
 
     assertXPath(pDoc, "/html/body", 1);
-    assertXPath(pDoc, "/html/body/p/font/img", 1);
+    assertXPath(pDoc, "/html/body/p/img", 1);
 }
 
 DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImageEnabled, "textAndImage.docx")
@@ -131,7 +131,7 @@ DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImageEnabled, "textAndImage.do
     CPPUNIT_ASSERT(pDoc);
 
     assertXPath(pDoc, "/html/body", 1);
-    assertXPath(pDoc, "/html/body/p/font/img", 0);
+    assertXPath(pDoc, "/html/body/p/img", 0);
 }
 
 DECLARE_HTMLEXPORT_TEST(testSkipImageEmbedded, "skipimage-embedded.doc")
diff --git a/sw/qa/extras/rtfimport/data/fdo85179.rtf b/sw/qa/extras/rtfimport/data/fdo85179.rtf
index fb9bcfa..8c69d31 100644
--- a/sw/qa/extras/rtfimport/data/fdo85179.rtf
+++ b/sw/qa/extras/rtfimport/data/fdo85179.rtf
@@ -15,6 +15,10 @@
 {\sn lineWidth}
 {\sv 50800}
 }
+{\sp
+{\sn fLine}
+{\sv 1}
+}
 }
 \picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw1806\pich1806\picwgoal1024\pichgoal1024\pngblip
 89504e470d0a1a0a0000000d49484452000000400000004008040000000060b9550000000467414d410000b18f0bfc6105000000017352474200aece1ce90000
diff --git a/sw/qa/extras/rtfimport/data/fdo86761.rtf b/sw/qa/extras/rtfimport/data/fdo86761.rtf
new file mode 100644
index 0000000..f22d836
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo86761.rtf
@@ -0,0 +1,42 @@
+{\rtf1
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid3346813 \hich\af31506\dbch\af31505\loch\f31506 Image with no border
+\par }
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid986338\charrsid3761114
+{\*\shppict
+{\pict
+{\*\picprop\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+{\sp
+{\sn fLockAgainstSelect}
+{\sv 0}
+}
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\sp
+{\sn wzName}
+{\sv Picture 1}
+}
+}
+\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0
+\picw3598\pich4233\picwgoal2040\pichgoal2400\jpegblip\bliptag-859510685
+{\*\blipuid ccc4e863fe2f64c0500a0ae3f1b81a42}
+89504e470d0a1a0a0000000d49484452000000400000004008040000000060b9550000000467414d410000b18f0bfc6105000000017352474200aece1ce90000
+00206348524d00007a26000080840000fa00000080e8000075300000ea6000003a98000017709cba513c00000002624b47440000aa8d2332000000096f464673
+0000000600000000000c7355d3000000097048597300000dd700000dd70142289b7800000009767041670000004c00000040009d31381b000001cd4944415468
+deedd93d4fc24018c0f17f89c6cdc44940e3e222be2c0e7e0417e3a8113571707632514012a320c6f84d34be2c2ec2b750f40be8e6e4a00113cfe14a5b69b108
+f4589ee71652eefafce0b9f42e3d7063822aaac3f641d173a75d3efee85b6582c0c8749c5eb7332cfb4e6f213d336ed29807304477b1c7a94db80ae9e9c934d0
+fcdd12e7ffcefcc9168f9a0059143b8cb0d2de581f609854073fbecc220f60b18722479d0d14abed8c8cb5d3293ce2949903b0d8a7047cb1c98541008cba840c
+a736e1d2200046b967567f740961d3b197008873cf74835002eaac7363100009ca0d4296121675d2dc1a0440d2256428625163ed2f42cf011e8245d621b42c44
+0400485261a699706d1000092fa100d4490713220240dc25e438b1090185880ca09f8ece5c28d9843b009e82471ca25069d5cb785529bd007fdbfb8541b65b2f
+531100947a51530d42c1d92f9829818e31ca4ce9421c70e427440e80712a7a89b7c8fb0906003046a5311df31cf501a01f4d0ee1b80f00bd4c398558ee0340ff
+0b939a30df17002459f05d330a080a0108400002108000042000010840000210800004200001f8ce0ddf798e30dd7b38e0ce7ea16d2abc25a819cbda225337c7
+f7ff69bf8eef7f0084e08d42bdf8a03e00000025744558746372656174652d6461746500323031302d31322d32305431373a30383a33362b30313a30307ae51b1c00000025744558746d6f646966792d6461746500323031302d31322d32305431373a30383a33372b30313a30308323669c0000000049454e44ae4260820a}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 416b01a..721fd73 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1986,6 +1986,12 @@ DECLARE_RTFIMPORT_TEST(testFdo85179, "fdo85179.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800/360), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth);
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo86761, "fdo86761.rtf")
+{
+    // This was 26, even if the picture should have no border, due to fLine=0.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth);
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo82859, "fdo82859.rtf")
 {
     // This was 0: "0xffffff" was converted to 0, i.e. the background was black instead of the default.
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index f53f7f3..e36f1b5 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/drawing/ColorMode.hpp>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/graphic/GraphicProvider.hpp>
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
@@ -1123,7 +1124,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                 if( m_pImpl->eGraphicImportType == IMPORT_AS_GRAPHIC || !nBorder )
                 {
                     GraphicBorderLine& rBorderLine = m_pImpl->aBorders[m_pImpl->eGraphicImportType == IMPORT_AS_SHAPE ? BORDER_TOP : static_cast<BorderPosition>(nBorder)];
-                    if (rBorderLine.isEmpty() && xShapeProps.is())
+                    if (rBorderLine.isEmpty() && xShapeProps.is() && xShapeProps->getPropertyValue("LineStyle").get<drawing::LineStyle>() != drawing::LineStyle_NONE)
                     {
                         // In case we got no border tokens and we have the
                         // original shape, then use its line properties as the
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index acbe6a2..1a5aeac 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -137,6 +137,8 @@ void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet
 {
     if (nFLine == 0)
         xPropertySet->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
+    else
+        xPropertySet->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_SOLID));
 }
 
 void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, const OUString& aKey, const OUString& aValue)


More information about the Libreoffice-commits mailing list