summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2019-12-24 10:12:49 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-01-09 10:36:12 +0100
commit5c45b29f84c3421e1ad85c692ab8176cf15836a7 (patch)
treedb8666600cf47cc39bce32e04f2b269526aba405 /sw
parent1141f72f927068f700854c4f311993551587f608 (diff)
tdf#129522 ooxmlexport: allow char shadow_NONE override
Normally we would NOT want to write out nil borders or shadows. However, if these would be inherited, NILs needs to be written out. This already worked for paragraphs, so it was just a matter of identifying the character styles and testing against them. I couldn't find anything that clearly stated that ChpIter is the CharStyle properties, but it appears to act that way, since the first check is for ISet (which seems to be direct properties) and the second check is usually for styles, and the Internet also suggests Fkp's are for styles. This is the last patch in a series, and provides the unit test for a previous import fix. import depends on commit ccfccf4365362b5ba1d82b5816d5fc81a67de548 which depends on commit 4ca73073a0d7c62b12a7354f76f8f80adc5d98c1 and for export depends on commit f84b33275f6cce21e93e5dd20f3de5df84df0276. Change-Id: I5230adc52196b9b610d7863397bf33143682370c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85870 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx12
2 files changed, 12 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 9e277928a8fb..4ddfe28a71c0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -99,7 +99,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShado
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_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 684944b0311f..25a59b0aa79c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7214,7 +7214,17 @@ void DocxAttributeOutput::CharHidden( const SvxCharHiddenItem& rHidden )
void DocxAttributeOutput::CharBorder(
const SvxBorderLine* pAllBorder, const sal_uInt16 nDist, const bool bShadow )
{
- impl_borderLine( m_pSerializer, XML_bdr, pAllBorder, nDist, bShadow );
+ css::table::BorderLine2 rStyleBorder;
+ const SvxBoxItem* pInherited = nullptr;
+ if ( GetExport().m_bStyDef && GetExport().m_pCurrentStyle && GetExport().m_pCurrentStyle->DerivedFrom() )
+ pInherited = GetExport().m_pCurrentStyle->DerivedFrom()->GetAttrSet().GetItem<SvxBoxItem>(RES_CHRATR_BOX);
+ else if ( m_rExport.m_pChpIter ) // incredibly undocumented, but this is the character-style info, right?
+ pInherited = static_cast<const SvxBoxItem*>(GetExport().m_pChpIter->HasTextItem(RES_CHRATR_BOX));
+
+ if ( pInherited )
+ rStyleBorder = SvxBoxItem::SvxLineToLine(pInherited->GetRight(), false);
+
+ impl_borderLine( m_pSerializer, XML_bdr, pAllBorder, nDist, bShadow, &rStyleBorder );
}
void DocxAttributeOutput::CharHighlight( const SvxBrushItem& rHighlight )