[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Sep 15 10:05:51 UTC 2017


 editeng/source/items/flditem.cxx      |    4 ++--
 editeng/source/uno/unofield.cxx       |    4 ++--
 include/editeng/flditem.hxx           |    7 +++++--
 sc/source/filter/excel/xihelper.cxx   |    2 +-
 sc/source/ui/pagedlg/scuitphfedit.cxx |    8 ++++----
 sc/source/ui/unoobj/fielduno.cxx      |    2 +-
 sd/source/ui/app/sdmod2.cxx           |    2 +-
 sd/source/ui/app/sdpopup.cxx          |    6 +++---
 sd/source/ui/dlg/dlgfield.cxx         |    6 +++---
 9 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit e45f61a5906cb84cdd895ef00648d5b7a6468ac5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Sep 15 10:26:42 2017 +0200

    convert SvxFileType to scoped enum
    
    Change-Id: Iec1c67f7f0f9b2244b1d6ef52921ddd09f944fbb
    Reviewed-on: https://gerrit.libreoffice.org/42314
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index b4cf848c0ef2..4c3f7f5d9f94 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -146,7 +146,7 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe
 
                     // pass fixed attribute to constructor
                     return new SvxExtFileField(
-                            aPresentation, bIsFixed ? SVXFILETYPE_FIX : SVXFILETYPE_VAR, eFmt);
+                            aPresentation, bIsFixed ? SvxFileType::Fix : SvxFileType::Var, eFmt);
                 }
             case text::textfield::Type::AUTHOR:
                 {
@@ -709,7 +709,7 @@ SV_IMPL_PERSIST1( SvxExtFileField );
 
 SvxExtFileField::SvxExtFileField()
 {
-    eType = SVXFILETYPE_VAR;
+    eType = SvxFileType::Var;
     eFormat = SvxFileFormat::PathFull;
 }
 
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 9416300a6fa7..ec4e45ad93f2 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -347,7 +347,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > const & xAn
 
             case text::textfield::Type::EXTENDED_FILE:
                 mpImpl->msString1 = static_cast<const SvxExtFileField*>(pData)->GetFile();
-                mpImpl->mbBoolean1 = static_cast<const SvxExtFileField*>(pData)->GetType() == SVXFILETYPE_FIX;
+                mpImpl->mbBoolean1 = static_cast<const SvxExtFileField*>(pData)->GetType() == SvxFileType::Fix;
                 mpImpl->mnInt16 = getFileNameDisplayFormat(static_cast<const SvxExtFileField*>(pData)->GetFormat());
                 break;
 
@@ -441,7 +441,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
     {
         // #92009# pass fixed attribute to constructor
         pData = new SvxExtFileField( mpImpl->msString1,
-                                     mpImpl->mbBoolean1 ? SVXFILETYPE_FIX : SVXFILETYPE_VAR,
+                                     mpImpl->mbBoolean1 ? SvxFileType::Fix : SvxFileType::Var,
                                      setFileNameDisplayFormat(mpImpl->mnInt16 ) );
         break;
     }
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
index 7d2d9cb689c3..faccf33224b9 100644
--- a/include/editeng/flditem.hxx
+++ b/include/editeng/flditem.hxx
@@ -289,7 +289,10 @@ public:
 };
 
 
-enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR };
+enum class SvxFileType {
+    Fix,
+    Var
+};
 enum class SvxFileFormat {
     NameAndExt = 0, // File name with Extension
     PathFull,       // full path
@@ -309,7 +312,7 @@ public:
     SV_DECL_PERSIST1( SvxExtFileField, css::text::textfield::Type::EXTENDED_FILE )
                             SvxExtFileField();
     explicit                SvxExtFileField( const OUString& rString,
-                                SvxFileType eType = SVXFILETYPE_VAR,
+                                SvxFileType eType = SvxFileType::Var,
                                 SvxFileFormat eFormat = SvxFileFormat::PathFull );
 
     const OUString&         GetFile() const { return aFile; }
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 0f22e713be37..3d6e2e49e749 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -354,7 +354,7 @@ void XclImpHFConverter::ParseString( const OUString& rHFString )
                         }
                     break;
                     case 'F':           // file name
-                        InsertField( SvxFieldItem( SvxExtFileField( EMPTY_OUSTRING, SVXFILETYPE_VAR, SvxFileFormat::NameAndExt ), EE_FEATURE_FIELD ) );
+                        InsertField( SvxFieldItem( SvxExtFileField( EMPTY_OUSTRING, SvxFileType::Var, SvxFileFormat::NameAndExt ), EE_FEATURE_FIELD ) );
                     break;
 
                     case 'U':           // underline
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx
index ad51a27d77c7..5965e048bb5e 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -649,7 +649,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
         case eExtFileNameEntry:
             ClearTextAreas();
             m_pWndCenter->InsertField( SvxFieldItem( SvxExtFileField(
-                EMPTY_OUSTRING, SVXFILETYPE_VAR, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
+                EMPTY_OUSTRING, SvxFileType::Var, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
             if(!bTravelling)
                 m_pWndCenter->GrabFocus();
         break;
@@ -702,7 +702,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
             m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
             m_pWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
             m_pWndRight->InsertField( SvxFieldItem( SvxExtFileField(
-                EMPTY_OUSTRING, SVXFILETYPE_VAR, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
+                EMPTY_OUSTRING, SvxFileType::Var, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
             if(!bTravelling)
                 m_pWndRight->GrabFocus();
         }
@@ -820,12 +820,12 @@ IMPL_LINK( ScHFEditPage, MenuHdl, ScExtIButton&, rBtn, void )
     else if (sSelectedId == "filename")
     {
         m_pEditFocus->InsertField( SvxFieldItem( SvxExtFileField(
-            OUString(), SVXFILETYPE_VAR, SvxFileFormat::NameAndExt ), EE_FEATURE_FIELD ) );
+            OUString(), SvxFileType::Var, SvxFileFormat::NameAndExt ), EE_FEATURE_FIELD ) );
     }
     else if (sSelectedId == "pathname")
     {
         m_pEditFocus->InsertField( SvxFieldItem( SvxExtFileField(
-            OUString(), SVXFILETYPE_VAR, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
+            OUString(), SvxFileType::Var, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
     }
 }
 
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 101f7dd8c4d1..d2f2154c6979 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -592,7 +592,7 @@ SvxFieldData* ScEditFieldObj::getData()
             break;
             case text::textfield::Type::EXTENDED_FILE:
                 mpData.reset(
-                    new SvxExtFileField(OUString(), SVXFILETYPE_VAR, SvxFileFormat::NameAndExt));
+                    new SvxExtFileField(OUString(), SvxFileType::Var, SvxFileFormat::NameAndExt));
             break;
             case text::textfield::Type::PAGE:
                 mpData.reset(new SvxPageField);
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 293f7672948f..e22d875fde2c 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -187,7 +187,7 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
     }
     else if( (pExtFileField = dynamic_cast< const SvxExtFileField * >(pField)) != nullptr )
     {
-        if( pDocShell && (pExtFileField->GetType() != SVXFILETYPE_FIX) )
+        if( pDocShell && (pExtFileField->GetType() != SvxFileType::Fix) )
         {
             OUString aName;
             if( pDocShell->HasName() )
diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx
index 7bb783418831..da39b3c0f688 100644
--- a/sd/source/ui/app/sdpopup.cxx
+++ b/sd/source/ui/app/sdpopup.cxx
@@ -126,7 +126,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
         const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField);
         //SvxExtFileField aFileField( *pFileField );
 
-        if( pFileField->GetType() == SVXFILETYPE_FIX )
+        if( pFileField->GetType() == SvxFileType::Fix )
             CheckItem( 1 );
         else
             CheckItem( 2 );
@@ -241,9 +241,9 @@ SvxFieldData* SdFieldPopup::GetField()
         sal_uInt16 i;
 
         if( IsItemChecked( 1 ) )
-            eType = SVXFILETYPE_FIX;
+            eType = SvxFileType::Fix;
         else
-            eType = SVXFILETYPE_VAR;
+            eType = SvxFileType::Var;
 
         for( i = 3; i <= nCount; i++ )
         {
diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx
index a824ed495866..dc7be8b9312e 100644
--- a/sd/source/ui/dlg/dlgfield.cxx
+++ b/sd/source/ui/dlg/dlgfield.cxx
@@ -121,9 +121,9 @@ SvxFieldData* SdModifyFieldDlg::GetField()
             SvxFileFormat eFormat;
 
             if( m_pRbtFix->IsChecked() )
-                eType = SVXFILETYPE_FIX;
+                eType = SvxFileType::Fix;
             else
-                eType = SVXFILETYPE_VAR;
+                eType = SvxFileType::Var;
 
             eFormat = (SvxFileFormat) ( m_pLbFormat->GetSelectEntryPos() );
 
@@ -284,7 +284,7 @@ void SdModifyFieldDlg::FillControls()
         const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField);
         SvxExtFileField aFileField( *pFileField );
 
-        if( pFileField->GetType() == SVXFILETYPE_FIX )
+        if( pFileField->GetType() == SvxFileType::Fix )
             m_pRbtFix->Check();
         else
             m_pRbtVar->Check();


More information about the Libreoffice-commits mailing list