From e1de94244c1b0419c1c3415c02381e8b7a87abe0 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 14 Dec 2014 11:13:17 +0100 Subject: 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. Change-Id: Iffee41066d42822b699c478821645b9742df3f58 (cherry picked from commit 4568d1d298bf4fc98dcd86384743a04587a2fe6f) --- 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(-) create mode 100644 sw/qa/extras/rtfimport/data/fdo86761.rtf diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index e454a40ae051..fd07c75ffe8d 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -120,7 +120,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") @@ -129,7 +129,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 fb9bcfa1207c..8c69d3145337 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 000000000000..f22d8361bbcd --- /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 1edf58cb43fa..61a386473c6e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2045,6 +2045,12 @@ DECLARE_RTFIMPORT_TEST(testFdo85179, "fdo85179.rtf") CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800/360), getProperty(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(0), getProperty(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 f7cb766ba845..58517994644a 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1160,7 +1161,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b //shapes have only one border table::BorderLine2 aBorderLine; GraphicBorderLine& rBorderLine = m_pImpl->aBorders[0]; - if (rBorderLine.isEmpty() && xShapeProps.is()) + if (rBorderLine.isEmpty() && xShapeProps.is() && xShapeProps->getPropertyValue("LineStyle").get() != 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 a123a3a2f89c..7969b0b881cf 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -133,6 +133,8 @@ void RTFSdrImport::resolveFLine(uno::Reference const& xProp { 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 const& xShape, const OUString& aKey, const OUString& aValue) -- cgit v1.2.3