[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 4 14:38:40 UTC 2020


 sw/qa/extras/ww8export/ww8export3.cxx       |    2 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx |    2 +-
 sw/source/filter/ww8/ww8atr.cxx             |    5 +++--
 sw/source/filter/ww8/ww8par6.cxx            |    8 ++++----
 4 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit f84b33275f6cce21e93e5dd20f3de5df84df0276
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Mon Dec 23 18:06:17 2019 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Sat Jan 4 15:38:06 2020 +0100

    tdf#129522 ww8import/export: allow char shadow_NONE overrides
    
    An earlier patch did this for paragraphs. The same is needed
    for character properties.
    
    This also applies to borders - where a non-border needs to be
    processed in order to override a style-defined border.
    
    This export change doesn't affect DOCX immediately, because
    DOCX will do nothing with a NONE-border/shadow until style
    information is provided to it. So this change is safe to make
    on it's own as far as DOCX is concerned.
    
    RTF just exports the border, but since it doesn't do any of
    this well, add in the logic so that RTF is unaffected...
    
    Change-Id: Ia857dc0db7d7efc83145a14e4fe4052d32b539ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85760
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 231aaabe58ad..103476d25407 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -305,7 +305,7 @@ DECLARE_WW8EXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowS
 
     xStyleProps.set(characterStyles->getByName("CharShadow-removed"), uno::UNO_QUERY_THROW);
     aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat");
-    //CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location);
+    CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location);
 }
 
 DECLARE_WW8EXPORT_TEST(testBtlrCell, "btlr-cell.doc")
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 152f5141e1d6..58b2e2c1627c 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -101,7 +101,7 @@ static OString OutTBLBorderLine(RtfExport const& rExport, const editeng::SvxBord
                                 const char* pStr)
 {
     OStringBuffer aRet;
-    if (!pLine->isEmpty())
+    if (pLine && !pLine->isEmpty())
     {
         aRet.append(pStr);
         // single line
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 1cd428abc422..41a2d9c5fb3e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5508,11 +5508,12 @@ void AttributeOutputBase::FormatCharBorder( const SvxBoxItem& rBox )
        nDist = rBox.GetDistance( SvxBoxItemLine::RIGHT );
     }
 
-    if( pBorderLine )
+    // RTF: avoid regressions since RTF doesn't know how to export a border_NONE style-override
+    if( pBorderLine || GetExport().GetExportFormat() != MSWordExportBase::ExportFormat::RTF )
     {
         const SfxPoolItem* pItem = GetExport().HasItem( RES_CHRATR_SHADOW );
         const SvxShadowItem* pShadowItem = static_cast<const SvxShadowItem*>(pItem);
-        const bool bShadow =
+        const bool bShadow = pBorderLine &&
             pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE &&
             pShadowItem->GetWidth() > 0;
 
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index c40215422bfd..e33a691f7c7d 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -5056,8 +5056,6 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh
 
             SetWW8_BRC(nBrcVer, aBrc, pData, nLen);
 
-            // Border style is none -> no border, no shadow
-            if( editeng::ConvertBorderStyleFromWord(aBrc.brcType()) != SvxBorderLineStyle::NONE )
             {
                 Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::TOP, 0, nullptr, true);
                 Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::BOTTOM, 0, nullptr, true);
@@ -5067,8 +5065,10 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh
 
                 short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1;
                 SvxShadowItem aShadowItem(RES_CHRATR_SHADOW);
-                if( SetShadow( aShadowItem, &aSizeArray[0], aBrc ) )
-                    NewAttr( aShadowItem );
+                // Word only allows shadows on visible borders
+                if ( aBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT ) )
+                   SetShadow( aShadowItem, &aSizeArray[0], aBrc );
+                NewAttr( aShadowItem );
             }
         }
     }


More information about the Libreoffice-commits mailing list