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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 6 05:30:00 UTC 2018


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

New commits:
commit 46780892cd3c49c27fdeb4566b7407602901e98f
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Tue Jul 24 20:05:25 2018 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Mon Aug 6 07:29:38 2018 +0200

    related tdf#103961 writerfilter: DocDefaults -> defaults
    
    Effectively should be an NonFunctional Change.
    
    Both LO and .docx format have an ability to specify
    document-wide properties. However, on import the defaults
    are being directly applied to the styles, and no internal
    defaults were being set.
    
    This patch changes it so that the style:default-style
    for the paragraph family gets the DocDefaults. Now
    "Standard" is treated just like any other style.
    
    This just opens up more possibilities for the future.
    Currently, the lack of export support hinders doing
    anything further. Thus the defaults are still being
    directly applied to the styles.
    
    Change-Id: Ibd1225c5a2dd021b4ce2e57241f0ee99969a0c68
    Reviewed-on: https://gerrit.libreoffice.org/57932
    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 95d645a08bb1..2e1a2732063f 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -958,8 +958,6 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                         }
                         xStyles->getByName( sConvertedStyleName ) >>= xStyle;
 
-                        // Standard is handled already in applyDefaults().
-                        if (sConvertedStyleName != "Standard")
                         {
                             StyleSheetTable_Impl::SetPropertiesToDefault(xStyle);
 
@@ -1024,8 +1022,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                     else if( bParaStyle )
                     {
                         // Paragraph styles that don't inherit from some parent need to apply the DocDefaults
-                        if ( sConvertedStyleName != "Standard" )
-                            pEntry->pProperties->InsertProps( m_pImpl->m_pDefaultParaProps, /*bAllowOverwrite=*/false );
+                        pEntry->pProperties->InsertProps( m_pImpl->m_pDefaultParaProps, /*bAllowOverwrite=*/false );
 
                         //now it's time to set the default parameters - for paragraph styles
                         //Fonts: Western first entry in font table
@@ -1532,18 +1529,16 @@ void StyleSheetTable::applyDefaults(bool bParaProperties)
             uno::Reference<container::XNameAccess> xStyleFamilies = xStylesSupplier->getStyleFamilies();
             uno::Reference<container::XNameAccess> xParagraphStyles;
             xStyleFamilies->getByName("ParagraphStyles") >>= xParagraphStyles;
-            uno::Reference<beans::XPropertySet> xStandard;
-            xParagraphStyles->getByName("Standard") >>= xStandard;
-
-            uno::Reference<style::XStyle> xStyle(xStandard, uno::UNO_QUERY);
-            StyleSheetTable_Impl::SetPropertiesToDefault(xStyle);
+            uno::Reference<beans::XPropertySet> xDefault;
+            // This is the built-in default style that every style inherits from
+            xParagraphStyles->getByName("Paragraph style") >>= xDefault;
 
             uno::Sequence< beans::PropertyValue > aPropValues = m_pImpl->m_pDefaultParaProps->GetPropertyValues();
             for( sal_Int32 i = 0; i < aPropValues.getLength(); ++i )
             {
                 try
                 {
-                    xStandard->setPropertyValue(aPropValues[i].Name, aPropValues[i].Value);
+                    xDefault->setPropertyValue(aPropValues[i].Name, aPropValues[i].Value);
                 }
                 catch( const uno::Exception& )
                 {


More information about the Libreoffice-commits mailing list