summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-12-16 19:51:55 +0300
committerJustin Luth <justin_luth@sil.org>2016-12-19 11:35:25 +0000
commitb8179d0add55f4df6b0611154bbe35d34e0b81a1 (patch)
tree2df423cf55f052f21d0459156cf1dd8853f0c121 /writerfilter
parentadff04ce5149f5b4e9de235c19f5cc0d30a7d4e8 (diff)
tdf#104713 writerfilter: parentless styles - only if default defined
LibreOffice's default paragraph style is very different from Word's normal style? Anyway, if normal is not defined in styles.xml, then don't re-assign any other automatic styles to be based off of it, since that indicates that the style information being imported is not complete. avoids regression from commit b79b5e0df6dc5a0ba18054b0503d6fa804b69f02 Change-Id: I1bfa8505d6b89b2bba255ad727ebadbacc8d3651 Reviewed-on: https://gerrit.libreoffice.org/32103 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit b8fa395288a1f3a24a4fca392afdf3a9b58373ea) Reviewed-on: https://gerrit.libreoffice.org/32173 Tested-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index c9ef06025378..e2ee7b6c9fd0 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -267,6 +267,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_bIsNewDoc;
StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
@@ -289,6 +290,7 @@ StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper,
m_pCurrentEntry(),
m_pDefaultParaProps(new PropertyMap),
m_pDefaultCharProps(new PropertyMap),
+ m_bHasImportedDefaultParaStyle(false),
m_bIsNewDoc(bIsNewDoc)
{
//set font height default to 10pt
@@ -456,6 +458,9 @@ 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)
{
beans::PropertyValue aValue;
@@ -946,9 +951,13 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
{
StyleSheetTable_Impl::SetPropertiesToDefault(xStyle);
- // resolve import conflicts with built-in styles
- if( pEntry->sBaseStyleIdentifier.isEmpty() && !xStyle->getParentStyle().isEmpty() )
+ // 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() )
+ {
xStyle->setParentStyle( "Standard" );
+ }
}
}
else