From 553fc0770ede2d5a95f72fb28d21a92bfdb3a38a Mon Sep 17 00:00:00 2001 From: Zolnai Tamás Date: Sun, 13 Jul 2014 19:29:29 +0200 Subject: fdo#80333: .doc has large black rectangles between paragraphs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These black rectangles are character border shadows, because checking whether there is a border at all was missing. In Word there is no shadow without a border. Regression from aa2faee4b3954b57a613963b501ecf611b3a14ca (cherry picked from commit c2e708d61746a259888c0e5fb1d3e9a43e3ca696) Conflicts: sw/qa/extras/ww8import/ww8import.cxx Change-Id: Ib3cb4e904fdd33f215c81d7c02762a196f484b1b Reviewed-on: https://gerrit.libreoffice.org/10268 Reviewed-by: Andras Timar Tested-by: Andras Timar Reviewed-by: Michael Stahl Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/qa/extras/ww8import/data/fdo80333.doc | Bin 0 -> 24064 bytes sw/qa/extras/ww8import/ww8import.cxx | 9 +++++++++ sw/source/filter/ww8/ww8par6.cxx | 24 ++++++++++++++---------- 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 sw/qa/extras/ww8import/data/fdo80333.doc diff --git a/sw/qa/extras/ww8import/data/fdo80333.doc b/sw/qa/extras/ww8import/data/fdo80333.doc new file mode 100644 index 000000000000..773a922bad08 Binary files /dev/null and b/sw/qa/extras/ww8import/data/fdo80333.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 147fb882f19e..7cd6153f42e3 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -462,6 +463,14 @@ DECLARE_WW8IMPORT_TEST(testFdo77844, "fdo77844.doc") #endif } +DECLARE_WW8IMPORT_TEST(testFdp80333, "fdo80333.doc") +{ + // Despite there is no character border, border shadow was imported + uno::Reference xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); + const table::ShadowFormat aShadow = getProperty(xRun, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 1ab57d53d25e..e0100ae819b4 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4761,16 +4761,20 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh _SetWW8_BRC(nBrcVer, aBrc, pData); - Set1Border(aBoxItem, aBrc, BOX_LINE_TOP, 0, 0, true); - Set1Border(aBoxItem, aBrc, BOX_LINE_BOTTOM, 0, 0, true); - Set1Border(aBoxItem, aBrc, BOX_LINE_LEFT, 0, 0, true); - Set1Border(aBoxItem, aBrc, BOX_LINE_RIGHT, 0, 0, true); - NewAttr( aBoxItem ); - - short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1; - SvxShadowItem aShadowItem(RES_CHRATR_SHADOW); - if( SetShadow( aShadowItem, &aSizeArray[0], aBrc ) ) - NewAttr( aShadowItem ); + // Border style is none -> no border, no shadow + if( editeng::ConvertBorderStyleFromWord(aBrc.brcType()) != table::BorderLineStyle::NONE ) + { + Set1Border(aBoxItem, aBrc, BOX_LINE_TOP, 0, 0, true); + Set1Border(aBoxItem, aBrc, BOX_LINE_BOTTOM, 0, 0, true); + Set1Border(aBoxItem, aBrc, BOX_LINE_LEFT, 0, 0, true); + Set1Border(aBoxItem, aBrc, BOX_LINE_RIGHT, 0, 0, true); + NewAttr( aBoxItem ); + + short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1; + SvxShadowItem aShadowItem(RES_CHRATR_SHADOW); + if( SetShadow( aShadowItem, &aSizeArray[0], aBrc ) ) + NewAttr( aShadowItem ); + } } } -- cgit v1.2.3