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

Stephan Bergmann sbergman at redhat.com
Tue Mar 7 15:46:46 UTC 2017


 sw/inc/swtypes.hxx                |    2 +-
 sw/inc/viewopt.hxx                |   10 +++++-----
 sw/source/core/layout/layact.cxx  |    2 +-
 sw/source/core/layout/pagechg.cxx |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 04c7d5013b9b87709b913e26190fb347a4916566
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 7 16:44:47 2017 +0100

    Replace some constexpr functions with static data members
    
    (I leave the DOCUMENTBORDER TODO alone, as that one is of type long while
    defDocumentBorder is of type sal_uInt16, so cleaning that up likely is a little
    more effort.)
    
    Change-Id: Ie9972e2f38b0ca9812e09f1c9d9fbded1046fda0

diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 3c2110c..8fe0835 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -84,7 +84,7 @@ const SwTwips lMinBorder = 1134;
 
 // Margin left and above document.
 // Half of it is gap between the pages.
-//TODO: Replace with SwViewOption::GetDefDocumentBorder()
+//TODO: Replace with SwViewOption::defDocumentBorder
 #define DOCUMENTBORDER  284L
 
 // Constant strings.
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index b44dd1d..1bb138a 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -377,14 +377,14 @@ public:
     void  SetDivisionY( short n ){ m_nDivisionY = n; }
 
     // Default margin left and above document: 284 twips == 5.0 mm.
-    static constexpr sal_uInt16 GetDefDocumentBorder() { return 284; }
+    static constexpr sal_uInt16 defDocumentBorder = 284;
     // Default gap between pages: 284 twips == 5.0 mm.
-    static constexpr sal_uInt16 GetDefGapBetweenPages() { return 284; }
+    static constexpr sal_uInt16 defGapBetweenPages = 284;
     // Minimum edge-to-text distance: 22 twips == 0.4 mm.
-    static constexpr sal_uInt16 GetMinGapBetweenPages() { return 22; }
+    static constexpr sal_uInt16 minGapBetweenPages = 22;
 
-    sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? GetMinGapBetweenPages() : GetDefDocumentBorder(); }
-    sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? GetMinGapBetweenPages() : GetDefGapBetweenPages(); }
+    sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? minGapBetweenPages : defDocumentBorder; }
+    sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? minGapBetweenPages : defGapBetweenPages; }
 
     sal_uInt8  GetPagePrevRow() const      { return m_nPagePreviewRow; }
     void  SetPagePrevRow( sal_uInt8 n ) { m_nPagePreviewRow = n; }
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 666ea3c..33d5334 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1291,7 +1291,7 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrame *pLa
             {
                 const SwViewShell *pSh = pLay->getRootFrame()->GetCurrShell();
                 const SwTwips nHalfDocBorder = pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
-                                                   : SwViewOption::GetDefGapBetweenPages();
+                                                   : SwViewOption::defGapBetweenPages;
                 const bool bLeftToRightViewLayout = m_pRoot->IsLeftToRightViewLayout();
                 const bool bPrev = bLeftToRightViewLayout ? pLay->GetPrev() : pLay->GetNext();
                 const bool bNext = bLeftToRightViewLayout ? pLay->GetNext() : pLay->GetPrev();
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index bb859f5..1704283 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1965,7 +1965,7 @@ void SwRootFrame::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* p
     const long nVisWidth = mnViewWidth - 2 * nBorder;
     const long nGapBetweenPages = pViewOpt ? pViewOpt->GetGapBetweenPages()
                                            : (pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
-                                                  : SwViewOption::GetDefGapBetweenPages());
+                                                  : SwViewOption::defGapBetweenPages);
 
     // check how many pages fit into the first page layout row:
     SwPageFrame* pPageFrame = static_cast<SwPageFrame*>(Lower());


More information about the Libreoffice-commits mailing list