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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 7 14:31:24 UTC 2021


 sw/source/filter/xml/xmlimp.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit b8d9334b9d4cc03a9b7d1e570a35e0ac6ca42338
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Thu Dec 31 17:45:39 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 7 15:30:44 2021 +0100

    tdf#138544 sw LoadUserSettings: default PrinterIndependentLayout
    
    I hope I understand this correctly.
    In Options - Load/Save - General, there is option
    "Load user-specific settings with the document" (default = true).
    
    Turning this off seems to simply mean, don't read the settings in
    Options - LibreOffice Writer - Compatibility from the document.
    The assumption I guess is that this would instead use system defaults.
    (Well, actually the user can "modify" these and "set as default".)
    
    Well, that wasn't quite true in a few cases, like this one.
    The general logic says "if the setting is not specified in the doc,
    set to some old behaviour". And that makes sense. Of course there
    is no setting in old documents - the concept didn't exist yet.
    
    But when we explicitly exclude these user-enforceable
    compat items, do we really want to force old behaviour
    instead of current behaviour? And if the user has actually modified
    these defaults, do we want to ignore the user's settings? I doubt it.
    
    So here is the first patch.
    
    When you start a new document, Writer compat setting
    "Use printer metrics for document formatting" is off.
    Now, when saving and reloading it with LoadUserSettings disabled,
    it is still the program default of "off", instead of "on".
    
    And if the user modifies it to always be on, it will still
    turn on - so no regression there.
    
    Change-Id: I13b236852da843ce72be16d79e2fdace1550523c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108545
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 956582987373..d0266ef31c28 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1296,7 +1296,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     };
 
     SvtSaveOptions aSaveOpt;
-    bool bIsUserSetting = aSaveOpt.IsLoadUserSettings();
+    bool bAreUserSettingsFromDocument = aSaveOpt.IsLoadUserSettings();
 
     // for some properties we don't want to use the application
     // default if they're missing. So we watch for them in the loop
@@ -1336,7 +1336,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     for( const PropertyValue& rValue : aConfigProps )
     {
         bool bSet = aExcludeAlways.find(rValue.Name) == aExcludeAlways.end();
-        if( bSet && !bIsUserSetting
+        if( bSet && !bAreUserSettingsFromDocument
             && (aExcludeWhenNotLoadingUserSettings.find(rValue.Name)
                 != aExcludeWhenNotLoadingUserSettings.end()) )
         {
@@ -1452,7 +1452,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     // introduce boolean, that indicates a document, written by version prior SO8.
     const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos;
 
-    if( ! bPrinterIndependentLayout )
+    // Use old behaviour if this setting didn't exist, but only if this setting is being read from the document.
+    // (Obviously the setting doesn't exist if we are explicitly ignoring it, so then stick with program/user defaults)
+    if(!bPrinterIndependentLayout && bAreUserSettingsFromDocument)
     {
         xProps->setPropertyValue( "PrinterIndependentLayout", Any(sal_Int16(document::PrinterIndependentLayout::DISABLED)) );
     }


More information about the Libreoffice-commits mailing list