[Libreoffice-commits] core.git: writerfilter/source

Justin Luth justin_luth at sil.org
Thu Jul 5 04:23:14 UTC 2018


 writerfilter/source/dmapper/StyleSheetTable.cxx |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 961908dde51e44b93567cb59bd398778fe1ece10
Author: Justin Luth <justin_luth at sil.org>
Date:   Wed Jul 4 07:26:36 2018 +0300

    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: Justin Luth <justin_luth at sil.org>

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 7bb43fe5c6de..5d65e9339a28 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -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( "" );
                             }


More information about the Libreoffice-commits mailing list