summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2019-12-23 18:06:17 +0300
committerJustin Luth <justin_luth@sil.org>2020-01-04 15:38:06 +0100
commitf84b33275f6cce21e93e5dd20f3de5df84df0276 (patch)
tree7c48475c1364cc5607af50ba9da4d13d9681acc2 /sw/source
parent354d7ec99900ef5c17ac340e54b815c395dfb0a4 (diff)
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@sil.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx8
3 files changed, 8 insertions, 7 deletions
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 );
}
}
}