editeng/source/items/flditem.cxx | 26 +++++++++++++------------- editeng/source/uno/unofield.cxx | 16 ++++++++-------- include/editeng/flditem.hxx | 13 +++++++------ sc/source/core/tool/editutil.cxx | 2 +- sc/source/filter/excel/xehelper.cxx | 8 ++++---- sc/source/filter/excel/xihelper.cxx | 2 +- sc/source/ui/pagedlg/scuitphfedit.cxx | 8 ++++---- sc/source/ui/unoobj/fielduno.cxx | 18 +++++++++--------- 8 files changed, 47 insertions(+), 46 deletions(-)
New commits: commit 2b825fe7f525ac017966044a1400d9095c8b7986 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Sep 15 10:21:51 2017 +0200 convert SvxFileFormat to scoped enum Change-Id: Ia75c86a89c89bb22759e1d588ce603701cb7fad5 Reviewed-on: https://gerrit.libreoffice.org/42313 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index bf9baf91d4ce..b4cf848c0ef2 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -135,12 +135,12 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe xPropSet->getPropertyValue(UNO_TC_PROP_CURRENT_PRESENTATION) >>= aPresentation; xPropSet->getPropertyValue(UNO_TC_PROP_FILE_FORMAT) >>= nFmt; - SvxFileFormat eFmt = SVXFILEFORMAT_NAME_EXT; + SvxFileFormat eFmt = SvxFileFormat::NameAndExt; switch (nFmt) { - case text::FilenameDisplayFormat::FULL: eFmt = SVXFILEFORMAT_FULLPATH; break; - case text::FilenameDisplayFormat::PATH: eFmt = SVXFILEFORMAT_PATH; break; - case text::FilenameDisplayFormat::NAME: eFmt = SVXFILEFORMAT_NAME; break; + case text::FilenameDisplayFormat::FULL: eFmt = SvxFileFormat::PathFull; break; + case text::FilenameDisplayFormat::PATH: eFmt = SvxFileFormat::PathOnly; break; + case text::FilenameDisplayFormat::NAME: eFmt = SvxFileFormat::NameOnly; break; default:; } @@ -710,7 +710,7 @@ SV_IMPL_PERSIST1( SvxExtFileField ); SvxExtFileField::SvxExtFileField() { eType = SVXFILETYPE_VAR; - eFormat = SVXFILEFORMAT_FULLPATH; + eFormat = SvxFileFormat::PathFull; } @@ -767,22 +767,22 @@ OUString SvxExtFileField::GetFormatted() const { switch( eFormat ) { - case SVXFILEFORMAT_FULLPATH: + case SvxFileFormat::PathFull: aString = aURLObj.getFSysPath(FSysStyle::Detect); break; - case SVXFILEFORMAT_PATH: + case SvxFileFormat::PathOnly: aURLObj.removeSegment(INetURLObject::LAST_SEGMENT, false); // #101742# Leave trailing slash at the pathname aURLObj.setFinalSlash(); aString = aURLObj.getFSysPath(FSysStyle::Detect); break; - case SVXFILEFORMAT_NAME: + case SvxFileFormat::NameOnly: aString = aURLObj.getBase(INetURLObject::LAST_SEGMENT,true,INetURLObject::DecodeMechanism::Unambiguous); break; - case SVXFILEFORMAT_NAME_EXT: + case SvxFileFormat::NameAndExt: aString = aURLObj.getName(INetURLObject::LAST_SEGMENT,true,INetURLObject::DecodeMechanism::Unambiguous); break; } @@ -791,22 +791,22 @@ OUString SvxExtFileField::GetFormatted() const { switch( eFormat ) { - case SVXFILEFORMAT_FULLPATH: + case SvxFileFormat::PathFull: aString = aURLObj.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ); break; - case SVXFILEFORMAT_PATH: + case SvxFileFormat::PathOnly: aURLObj.removeSegment(INetURLObject::LAST_SEGMENT, false); // #101742# Leave trailing slash at the pathname aURLObj.setFinalSlash(); aString = aURLObj.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ); break; - case SVXFILEFORMAT_NAME: + case SvxFileFormat::NameOnly: aString = aURLObj.getBase(); break; - case SVXFILEFORMAT_NAME_EXT: + case SvxFileFormat::NameAndExt: aString = aURLObj.getName(); break; } diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index 94bef5cdae11..9416300a6fa7 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -154,10 +154,10 @@ static sal_Int16 getFileNameDisplayFormat( SvxFileFormat nFormat ) { switch( nFormat ) { - case SVXFILEFORMAT_NAME_EXT: return text::FilenameDisplayFormat::NAME_AND_EXT; - case SVXFILEFORMAT_FULLPATH: return text::FilenameDisplayFormat::FULL; - case SVXFILEFORMAT_PATH: return text::FilenameDisplayFormat::PATH; -// case SVXFILEFORMAT_NAME: + case SvxFileFormat::NameAndExt: return text::FilenameDisplayFormat::NAME_AND_EXT; + case SvxFileFormat::PathFull: return text::FilenameDisplayFormat::FULL; + case SvxFileFormat::PathOnly: return text::FilenameDisplayFormat::PATH; +// case SvxFileFormat::NameOnly: default: return text::FilenameDisplayFormat::NAME; } } @@ -166,12 +166,12 @@ static SvxFileFormat setFileNameDisplayFormat( sal_Int16 nFormat ) { switch( nFormat ) { - case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH; - case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH; - case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME; + case text::FilenameDisplayFormat::FULL: return SvxFileFormat::PathFull; + case text::FilenameDisplayFormat::PATH: return SvxFileFormat::PathOnly; + case text::FilenameDisplayFormat::NAME: return SvxFileFormat::NameOnly; // case text::FilenameDisplayFormat::NAME_AND_EXT: default: - return SVXFILEFORMAT_NAME_EXT; + return SvxFileFormat::NameAndExt; } } diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx index 50956528dcef..7d2d9cb689c3 100644 --- a/include/editeng/flditem.hxx +++ b/include/editeng/flditem.hxx @@ -290,11 +290,12 @@ public: enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR }; -enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT = 0, // File name with Extension - SVXFILEFORMAT_FULLPATH, // full path - SVXFILEFORMAT_PATH, // only path - SVXFILEFORMAT_NAME // only file name - }; +enum class SvxFileFormat { + NameAndExt = 0, // File name with Extension + PathFull, // full path + PathOnly, // only path + NameOnly // only file name +}; class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData @@ -309,7 +310,7 @@ public: SvxExtFileField(); explicit SvxExtFileField( const OUString& rString, SvxFileType eType = SVXFILETYPE_VAR, - SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH ); + SvxFileFormat eFormat = SvxFileFormat::PathFull ); const OUString& GetFile() const { return aFile; } void SetFile( const OUString& rString ) { aFile = rString; } diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 5d41664fc4e8..4035c4b6b9ee 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -824,7 +824,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField, { switch (static_cast<const SvxExtFileField*>(pFieldData)->GetFormat()) { - case SVXFILEFORMAT_FULLPATH : + case SvxFileFormat::PathFull : aRet = aData.aLongDocName; break; default: diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index a8317347e022..326e03f25ee8 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -822,14 +822,14 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico { switch( pFileField->GetFormat() ) { - case SVXFILEFORMAT_NAME_EXT: - case SVXFILEFORMAT_NAME: + case SvxFileFormat::NameAndExt: + case SvxFileFormat::NameOnly: aParaText += "&F"; break; - case SVXFILEFORMAT_PATH: + case SvxFileFormat::PathOnly: aParaText += "&Z"; break; - case SVXFILEFORMAT_FULLPATH: + case SvxFileFormat::PathFull: aParaText += "&Z&F"; break; default: diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index cc4c62147477..0f22e713be37 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_NAME_EXT ), 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 99443f2e45ae..ad51a27d77c7 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_FULLPATH ), 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_FULLPATH ), 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_NAME_EXT ), EE_FEATURE_FIELD ) ); + OUString(), SVXFILETYPE_VAR, SvxFileFormat::NameAndExt ), EE_FEATURE_FIELD ) ); } else if (sSelectedId == "pathname") { m_pEditFocus->InsertField( SvxFieldItem( SvxExtFileField( - OUString(), SVXFILETYPE_VAR, SVXFILEFORMAT_FULLPATH ), 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 23b908d4cf1e..101f7dd8c4d1 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -124,11 +124,11 @@ SvxFileFormat lcl_UnoToSvxFileFormat( sal_Int16 nUnoValue ) { switch( nUnoValue ) { - case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH; - case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH; - case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME; + case text::FilenameDisplayFormat::FULL: return SvxFileFormat::PathFull; + case text::FilenameDisplayFormat::PATH: return SvxFileFormat::PathOnly; + case text::FilenameDisplayFormat::NAME: return SvxFileFormat::NameOnly; default: - return SVXFILEFORMAT_NAME_EXT; + return SvxFileFormat::NameAndExt; } } @@ -136,9 +136,9 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue ) { switch( nSvxValue ) { - case SVXFILEFORMAT_NAME_EXT: return text::FilenameDisplayFormat::NAME_AND_EXT; - case SVXFILEFORMAT_FULLPATH: return text::FilenameDisplayFormat::FULL; - case SVXFILEFORMAT_PATH: return text::FilenameDisplayFormat::PATH; + case SvxFileFormat::NameAndExt: return text::FilenameDisplayFormat::NAME_AND_EXT; + case SvxFileFormat::PathFull: return text::FilenameDisplayFormat::FULL; + case SvxFileFormat::PathOnly: return text::FilenameDisplayFormat::PATH; default: return text::FilenameDisplayFormat::NAME; } @@ -592,7 +592,7 @@ SvxFieldData* ScEditFieldObj::getData() break; case text::textfield::Type::EXTENDED_FILE: mpData.reset( - new SvxExtFileField(OUString(), SVXFILETYPE_VAR, SVXFILEFORMAT_NAME_EXT)); + new SvxExtFileField(OUString(), SVXFILETYPE_VAR, SvxFileFormat::NameAndExt)); break; case text::textfield::Type::PAGE: mpData.reset(new SvxPageField); @@ -790,7 +790,7 @@ uno::Any ScEditFieldObj::getPropertyValueFile(const OUString& rName) uno::Any aRet; if (rName == SC_UNONAME_FILEFORM) { - SvxFileFormat eFormat = SVXFILEFORMAT_NAME_EXT; + SvxFileFormat eFormat = SvxFileFormat::NameAndExt; const SvxFieldData* pField = nullptr; if (mpEditSource) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits