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

Panos (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 29 20:38:55 UTC 2021


 sw/inc/format.hxx                   |    2 ++
 sw/source/core/attr/format.cxx      |   15 +++++++++++++++
 sw/source/core/unocore/unostyle.cxx |   11 +----------
 3 files changed, 18 insertions(+), 10 deletions(-)

New commits:
commit 6c241f991809dd9ab825baf400c6da77c1c130bd
Author:     Panos <panos1029 at gmail.com>
AuthorDate: Thu Mar 25 20:01:08 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Mar 29 22:38:13 2021 +0200

    tdf#98749 Move initialization of page defaults to writer core
    
    A function (SetPageFormatToDefault) was created
    at sw/source/core/attr/format.cxx
    for the SwFormat class containing some hardcoded PageDescs defaults.
    The double setting of left was replaced with left, right
    The lines affected in sw/source/core/unocore/unostyle.cxx were
    replaced with the function call.
    
    Change-Id: I4ea548145d42321b696233995f6dba323c72d078
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113104
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 29c3fab36033..c3d2aec20773 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -241,6 +241,8 @@ public:
     inline  const SwTableBoxFormula       &GetTableBoxFormula( bool = true ) const;
     inline  const SwTableBoxValue         &GetTableBoxValue( bool = true ) const;
 
+    void SetPageFormatToDefault();
+
     /** SwFormat::IsBackgroundTransparent
 
         Virtual method to determine, if background of format is transparent.
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index b668c8e24e6e..61149cae8d62 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -33,6 +33,7 @@
 #include <svx/unobrushitemhelper.hxx>
 #include <svx/xdef.hxx>
 #include <swcache.hxx>
+#include <GetMetricVal.hxx>
 
 using namespace com::sun::star;
 
@@ -690,6 +691,20 @@ void SwFormat::DelDiffs( const SfxItemSet& rSet )
         sw::ClientNotifyAttrChg(*this, m_aSet, aOld, aNew);
 }
 
+void SwFormat::SetPageFormatToDefault()
+{
+
+    SvxLRSpaceItem aLR(RES_LR_SPACE);
+    sal_Int32 nSize = GetMetricVal(CM_1) * 2;
+    aLR.SetLeft(nSize);
+    aLR.SetRight(nSize);
+    SvxULSpaceItem aUL(RES_UL_SPACE);
+    aUL.SetUpper(static_cast<sal_uInt16>(nSize));
+    aUL.SetLower(static_cast<sal_uInt16>(nSize));
+    SetFormatAttr(aLR);
+    SetFormatAttr(aUL);
+}
+
 /** SwFormat::IsBackgroundTransparent
 
     Virtual method to determine, if background of format is transparent.
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index e6ee4dac0e1b..9b3dc09f8e7a 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -85,7 +85,6 @@
 #include <com/sun/star/document/XEventsSupplier.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <istyleaccess.hxx>
-#include <GetMetricVal.hxx>
 #include <fmtfsize.hxx>
 #include <numrule.hxx>
 #include <tblafmt.hxx>
@@ -2687,15 +2686,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault()
         SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(nPgDscPos);
         rPageDesc.ResetAllMasterAttr();
 
-        SvxLRSpaceItem aLR(RES_LR_SPACE);
-        sal_Int32 nSize = GetMetricVal(CM_1) * 2;
-        aLR.SetLeft(nSize);
-        aLR.SetLeft(nSize);
-        SvxULSpaceItem aUL(RES_UL_SPACE);
-        aUL.SetUpper(static_cast<sal_uInt16>(nSize));
-        aUL.SetLower(static_cast<sal_uInt16>(nSize));
-        pPageFormat->SetFormatAttr(aLR);
-        pPageFormat->SetFormatAttr(aUL);
+        pPageFormat->SetPageFormatToDefault();
         SwPageDesc* pStdPgDsc = m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD);
         std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>(SwFrameSize::Fixed));
 


More information about the Libreoffice-commits mailing list