Kaydet (Commit) 961908dd authored tarafından Justin Luth's avatar Justin Luth

related tdf#82175 writerfilter: use docDefault, not w:default

Commit b8fa3952 for tdf#104713, added this w:default test to only
override style inheritance on well-formed documents (i.e. all default
values have been specified in the document. Otherwise the document
will have no defaults at all).

However, checking on w:default is not the best test of a well-formed
document. W:default had no impact on inheritance anyway, so it was a
bad test, and if we used that, shouldn't we setParent to
the default style instead of assuming it is "Standard"?
Besides, FindDefaultParaStyle() already exists, so a
separate boolean value wasn't necessary in that scenario.

So lots of reasons to tweak my old commit. It is prep work
for setting the parent to -none- instead of "Standard".

Change-Id: I0846c09775c9a86b506f13e3588aab437a9a93cc
Reviewed-on: https://gerrit.libreoffice.org/56824
Tested-by: Jenkins
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst 54d76f52
......@@ -258,7 +258,7 @@ struct StyleSheetTable_Impl
/// Style names which should not be used without a " (user)" suffix.
std::set<OUString> m_aReservedStyleNames;
ListCharStylePropertyVector_t m_aListCharStylePropertyVector;
bool m_bHasImportedDefaultParaStyle;
bool m_bHasImportedDefaultParaProps;
bool m_bIsNewDoc;
StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
......@@ -281,7 +281,7 @@ StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper,
m_pCurrentEntry(),
m_pDefaultParaProps(new PropertyMap),
m_pDefaultCharProps(new PropertyMap),
m_bHasImportedDefaultParaStyle(false),
m_bHasImportedDefaultParaProps(false),
m_bIsNewDoc(bIsNewDoc)
{
//set font height default to 10pt
......@@ -452,8 +452,6 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
break;
case NS_ooxml::LN_CT_Style_default:
m_pImpl->m_pCurrentEntry->bIsDefaultStyle = (nIntValue != 0);
if (m_pImpl->m_pCurrentEntry->bIsDefaultStyle && m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA)
m_pImpl->m_bHasImportedDefaultParaStyle = true;
if (m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN)
{
......@@ -678,6 +676,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
resolveSprmProps( m_pImpl->m_rDMapper, rSprm );
m_pImpl->m_rDMapper.PopStyleSheetProperties();
applyDefaults( true );
m_pImpl->m_bHasImportedDefaultParaProps = true;
break;
case NS_ooxml::LN_CT_RPrDefault_rPr:
case NS_ooxml::LN_CT_DocDefaults_rPrDefault:
......@@ -933,10 +932,10 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
{
StyleSheetTable_Impl::SetPropertiesToDefault(xStyle);
// resolve import conflicts with built-in styles (only if normal style has been defined)
if( m_pImpl->m_bHasImportedDefaultParaStyle
&& pEntry->sBaseStyleIdentifier.isEmpty()
&& !xStyle->getParentStyle().isEmpty() )
// resolve import conflicts with built-in styles (only if defaults have been defined)
if ( m_pImpl->m_bHasImportedDefaultParaProps
&& pEntry->sBaseStyleIdentifier.isEmpty() //imported style has no inheritance
&& !xStyle->getParentStyle().isEmpty() ) //built-in style has a default inheritance
{
xStyle->setParentStyle( "" );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment