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

Michael Stahl mstahl at redhat.com
Wed Jan 4 14:35:00 UTC 2017


 sw/inc/ftninfo.hxx             |    2 +-
 sw/source/ui/misc/docfnote.cxx |    8 ++++----
 sw/source/ui/misc/impfnote.hxx |    3 ++-
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit f240b1db88440297d0b1eef80e8974ee54590df1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jan 4 15:29:37 2017 +0100

    sw: remove the silly casting in SwEndNoteOptionPage
    
    ... by fixing the size of SwFootnoteNum so it can be forward declared.
    
    Change-Id: I1a9d32a1ec7e7201de1910407d32020b75fb7342

diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx
index d10ab32..df00db0 100644
--- a/sw/inc/ftninfo.hxx
+++ b/sw/inc/ftninfo.hxx
@@ -81,7 +81,7 @@ enum SwFootnotePos
     FTNPOS_CHAPTER = 8
 };
 
-enum SwFootnoteNum
+enum SwFootnoteNum : unsigned
 {
     FTNNUM_PAGE, FTNNUM_CHAPTER, FTNNUM_DOC
 };
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 9feb8a1..45ce954 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -273,10 +273,10 @@ void SwEndNoteOptionPage::SelectNumbering(int eNum)
     NumCountHdl(*m_pNumCountBox);
 }
 
-int SwEndNoteOptionPage::GetNumbering() const
+SwFootnoteNum SwEndNoteOptionPage::GetNumbering() const
 {
     const sal_Int32 nPos = m_pNumCountBox->GetSelectEntryPos();
-    return (int) bPosDoc? nPos + 2: nPos;
+    return static_cast<SwFootnoteNum>((bPosDoc) ? nPos + 2 : nPos);
 }
 
 void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell )
@@ -296,7 +296,7 @@ void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell )
 // all kinds of numbering can be used.
 IMPL_LINK_NOARG(SwEndNoteOptionPage, PosPageHdl, Button*, void)
 {
-    const SwFootnoteNum eNum = (const SwFootnoteNum)GetNumbering();
+    const SwFootnoteNum eNum = GetNumbering();
     bPosDoc = false;
     if(LISTBOX_ENTRY_NOTFOUND == m_pNumCountBox->GetEntryPos(aNumPage))
     {
@@ -396,7 +396,7 @@ bool SwEndNoteOptionPage::FillItemSet( SfxItemSet * )
     {
         SwFootnoteInfo *pI = static_cast<SwFootnoteInfo*>(pInf.get());
         pI->ePos = m_pPosPageBox->IsChecked() ? FTNPOS_PAGE : FTNPOS_CHAPTER;
-        pI->eNum = (SwFootnoteNum)GetNumbering();
+        pI->eNum = GetNumbering();
         pI->aQuoVadis = m_pContEdit->GetText();
         pI->aErgoSum = m_pContFromEdit->GetText();
         if ( !(*pI == pSh->GetFootnoteInfo()) )
diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx
index ac812c2..4fd2c95 100644
--- a/sw/source/ui/misc/impfnote.hxx
+++ b/sw/source/ui/misc/impfnote.hxx
@@ -26,6 +26,7 @@
 #include <vcl/field.hxx>
 #include <numberingtypelistbox.hxx>
 
+enum SwFootnoteNum : unsigned;
 class SwWrtShell;
 
 class SwEndNoteOptionPage : public SfxTabPage
@@ -60,7 +61,7 @@ class SwEndNoteOptionPage : public SfxTabPage
     bool    bEndNote;
 
     inline void SelectNumbering(int eNum);
-    int GetNumbering() const;
+    SwFootnoteNum GetNumbering() const;
 
     DECL_LINK(PosPageHdl, Button*, void);
     DECL_LINK(PosChapterHdl, Button*, void);


More information about the Libreoffice-commits mailing list