sw/source/uibase/sidebar/PageMarginControl.cxx |   36 +++++++++++++++++++++++++
 sw/source/uibase/sidebar/PageMarginControl.hxx |    1 
 2 files changed, 37 insertions(+)

New commits:
commit e0e0f634987c52a040e1514825d239013b05e7b2
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Jan 20 13:51:56 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jan 20 15:56:06 2020 +0100

    StoreUserCustomValues should be used
    
    Change-Id: I64d41d297c55d36fc14f16945fa1369be990aa3e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87074
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx 
b/sw/source/uibase/sidebar/PageMarginControl.cxx
index a0fdef8959b6..258b5996d052 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -233,6 +233,7 @@ void PageMarginControl::GrabFocus()
 
 PageMarginControl::~PageMarginControl()
 {
+    StoreUserCustomValues();
 }
 
 void PageMarginControl::SetMetricFieldMaxValues( const Size& rPageSize )
@@ -545,6 +546,41 @@ bool PageMarginControl::GetUserCustomValues()
     return bUserCustomValuesAvailable;
 }
 
+void PageMarginControl::StoreUserCustomValues()
+{
+    if ( !m_bCustomValuesUsed )
+    {
+        return;
+    }
+
+    css::uno::Sequence < css::beans::NamedValue > aSeq( 1 );
+    SvtViewOptions aWinOpt( EViewType::Window, SWPAGE_LEFT_GVALUE );
+
+    aSeq[0].Name = "mnPageLeftMargin";
+    aSeq[0].Value <<= OUString::number( m_nPageLeftMargin );
+    aWinOpt.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt2( EViewType::Window, SWPAGE_RIGHT_GVALUE );
+    aSeq[0].Name = "mnPageRightMargin";
+    aSeq[0].Value <<= OUString::number( m_nPageRightMargin );
+    aWinOpt2.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt3( EViewType::Window, SWPAGE_TOP_GVALUE );
+    aSeq[0].Name = "mnPageTopMargin";
+    aSeq[0].Value <<= OUString::number( m_nPageTopMargin );
+    aWinOpt3.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt4( EViewType::Window, SWPAGE_DOWN_GVALUE );
+    aSeq[0].Name = "mnPageBottomMargin";
+    aSeq[0].Value <<= OUString::number( m_nPageBottomMargin );
+    aWinOpt4.SetUserData( aSeq );
+
+    SvtViewOptions aWinOpt5( EViewType::Window, SWPAGE_MIRROR_GVALUE );
+    aSeq[0].Name = "mbMirrored";
+    aSeq[0].Value <<= OUString::number( (m_bMirrored ? 1 : 0) );
+    aWinOpt5.SetUserData( aSeq );
+}
+
 } // end of namespace sw::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx 
b/sw/source/uibase/sidebar/PageMarginControl.hxx
index a549948926fe..83b98c0e244c 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.hxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.hxx
@@ -97,6 +97,7 @@ private:
     void SetMetricFieldMaxValues(const Size& rPageSize);
 
     bool GetUserCustomValues();
+    void StoreUserCustomValues();
 
     void FillHelpText( const bool bUserCustomValuesAvailable );
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to