[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/inc sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 9 16:09:38 UTC 2021


 sw/inc/IDocumentSettingAccess.hxx             |    1 +
 sw/source/core/doc/DocumentSettingManager.cxx |    8 +++++++-
 sw/source/core/inc/DocumentSettingManager.hxx |    2 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   16 ++++++++++++++++
 4 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 9cf6612438a478da3c42de2a2fb83d4b5fdc626e
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Feb 4 16:55:13 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 9 17:09:03 2021 +0100

    tdf#91920 sw page gutter margin, from top: add doc model & UNO API
    
    Do this per-doc, rather than per-page-desc, because Word doesn't support
    it per-section, so we would just create interop problems for ourselves
    with supporting it per-page-desc.
    
    (cherry picked from commit 97abf85bb152b8a665dff6fd8b65fffea5365dc8)
    
    Conflicts:
            sw/inc/IDocumentSettingAccess.hxx
            sw/source/core/doc/DocumentSettingManager.cxx
            sw/source/core/inc/DocumentSettingManager.hxx
            sw/source/uibase/uno/SwXDocumentSettings.cxx
    
    Change-Id: Id3c6aac7323deb8d27bab08675ff623f90a63cd9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110639
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 5b093bc0d08a..287a12604850 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -106,6 +106,7 @@ enum class DocumentSettingId
     APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
     CONTINUOUS_ENDNOTES,
     HEADER_SPACING_BELOW_LAST_PARA,
+    GUTTER_AT_TOP,
 };
 
  /** Provides access to settings of a document
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 5d6a0ba7df1c..d7af55649e62 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -93,7 +93,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
     mApplyParagraphMarkFormatToNumbering(false),
     mbLastBrowseMode( false ),
     mbDisableOffPagePositioning ( false ),
-    mbHeaderSpacingBelowLastPara(false)
+    mbHeaderSpacingBelowLastPara(false),
+    mbGutterAtTop(false)
 
     // COMPATIBILITY FLAGS END
 {
@@ -224,6 +225,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
         case DocumentSettingId::CONTINUOUS_ENDNOTES:
             return mbContinuousEndnotes;
         case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return mbHeaderSpacingBelowLastPara;
+        case DocumentSettingId::GUTTER_AT_TOP:
+            return mbGutterAtTop;
         default:
             OSL_FAIL("Invalid setting id");
     }
@@ -469,6 +472,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
         case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA:
             mbHeaderSpacingBelowLastPara = value;
             break;
+        case DocumentSettingId::GUTTER_AT_TOP:
+            mbGutterAtTop = value;
+            break;
         default:
             OSL_FAIL("Invalid setting id");
     }
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 5a19e930f664..6b65839259d7 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -164,6 +164,8 @@ class DocumentSettingManager :
     bool mbEmptyDbFieldHidesPara;
     bool mbContinuousEndnotes = false;
     bool mbHeaderSpacingBelowLastPara;
+    /// Gutter position: false means left (not a compatibility setting).
+    bool mbGutterAtTop;
 
 public:
 
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 1c437e021f93..b33be85354f2 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -147,6 +147,7 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
     HANDLE_CONTINUOUS_ENDNOTES,
     HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
+    HANDLE_GUTTER_AT_TOP,
 };
 
 static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -235,6 +236,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
         { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
         { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
         { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
+        { OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
 
 /*
  * As OS said, we don't have a view when we need to set this, so I have to
@@ -966,6 +968,15 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
             }
         }
         break;
+        case HANDLE_GUTTER_AT_TOP:
+        {
+            bool bTmp;
+            if (rValue >>= bTmp)
+            {
+                mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::GUTTER_AT_TOP, bTmp);
+            }
+        }
+        break;
         default:
             throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
     }
@@ -1444,6 +1455,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
                 DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA);
         }
         break;
+        case HANDLE_GUTTER_AT_TOP:
+        {
+            rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP);
+        }
+        break;
         default:
             throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
     }


More information about the Libreoffice-commits mailing list