From 70e552065339f1f7ab14f991f3e840b5461e609e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 15 Sep 2017 10:34:59 +0200 Subject: convert SvxURLFormat to scoped enum Change-Id: Ie2199cf0bcfb6d649f8aa33325ab645b18e7c000 Reviewed-on: https://gerrit.libreoffice.org/42343 Tested-by: Jenkins Reviewed-by: Noel Grandin --- editeng/qa/unit/core-test.cxx | 12 ++++++------ editeng/source/editeng/edtspell.cxx | 2 +- editeng/source/editeng/eehtml.cxx | 2 +- editeng/source/editeng/eertfpar.cxx | 2 +- editeng/source/items/flditem.cxx | 7 ++++--- editeng/source/uno/unofield.cxx | 7 ++++--- 6 files changed, 17 insertions(+), 15 deletions(-) (limited to 'editeng') diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 6345473d4257..9cf295b45d82 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -442,14 +442,14 @@ IMPL_STATIC_LINK( Test, CalcFieldValueHdl, EditFieldInfo*, pInfo, void ) OUString aURL = pURLField->GetURL(); switch ( pURLField->GetFormat() ) { - case SVXURLFORMAT_APPDEFAULT: - case SVXURLFORMAT_REPR: + case SvxURLFormat::AppDefault: + case SvxURLFormat::Repr: { pInfo->SetRepresentation( pURLField->GetRepresentation() ); } break; - case SVXURLFORMAT_URL: + case SvxURLFormat::Url: { pInfo->SetRepresentation( aURL ); } @@ -484,12 +484,12 @@ void Test::testHyperlinkCopyPaste() // URL 1 OUString aURL1 = "mailto:///user@example.com"; OUString aRepres1 = "user@example.com"; - SvxURLField aURLField1( aURL1, aRepres1, SVXURLFORMAT_REPR ); + SvxURLField aURLField1( aURL1, aRepres1, SvxURLFormat::Repr ); SvxFieldItem aField1( aURLField1, EE_FEATURE_FIELD ); // URL 2 OUString aURL2 = "mailto:///example@domain.com"; OUString aRepres2 = "example@domain.com"; - SvxURLField aURLField2( aURL2, aRepres2, SVXURLFORMAT_REPR ); + SvxURLField aURLField2( aURL2, aRepres2, SvxURLFormat::Repr ); SvxFieldItem aField2( aURLField2, EE_FEATURE_FIELD ); // Insert initial text @@ -741,7 +741,7 @@ void Test::testHyperlinkSearch() ContentNode *pNode = rDoc.GetObject(0); EditSelection aSel(EditPaM(pNode, 22), EditPaM(pNode, 22)); SvxURLField aURLField("mailto:///jim@bob.com", "jim@bob.com", - SVXURLFORMAT_REPR); + SvxURLFormat::Repr); SvxFieldItem aField(aURLField, EE_FEATURE_FIELD); aEngine.InsertField(aSel, aField); diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 47603ca1a039..c6861a11d32e 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -628,7 +628,7 @@ bool EdtAutoCorrDoc::SetINetAttr(sal_Int32 nStt, sal_Int32 nEnd, SAL_WARN_IF(nCursor < nEnd, "editeng", "Cursor in the heart of the action?!"); nCursor -= ( nEnd-nStt ); - SvxFieldItem aField( SvxURLField( rURL, aText, SVXURLFORMAT_REPR ), + SvxFieldItem aField( SvxURLField( rURL, aText, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); mpEditEngine->InsertField(aSel, aField); nCursor++; diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 4c38b5234610..18b556424321 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -779,7 +779,7 @@ void EditHTMLParser::AnchorEnd() if ( pCurAnchor ) { // Insert as URL-Field... - SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); + SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); aCurSel = mpEditEngine->InsertField(aCurSel, aFld); bFieldsInserted = true; pCurAnchor.reset(); diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 97b0ce9a38f8..84ec72924b16 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -568,7 +568,7 @@ void EditRTFParser::ReadField() if ( aFldRslt.isEmpty() ) aFldRslt = aFldInst; - SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); + SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); aCurSel = mpEditEngine->InsertField(aCurSel, aField); mpEditEngine->UpdateFieldsOnly(); bLastActionInsertParaBreak = false; diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 4c3f7f5d9f94..d6d2bda1a29b 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -105,9 +105,10 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference& xTe xPropSet->getPropertyValue(UNO_TC_PROP_URL_TARGET) >>= aTarget; xPropSet->getPropertyValue(UNO_TC_PROP_URL) >>= aURL; xPropSet->getPropertyValue(UNO_TC_PROP_URL_FORMAT) >>= nFmt; - SvxURLField* pData = new SvxURLField(aURL, aRep, aRep.isEmpty() ? SVXURLFORMAT_URL : SVXURLFORMAT_REPR); + SvxURLField* pData = new SvxURLField(aURL, aRep, aRep.isEmpty() ? SvxURLFormat::Url : SvxURLFormat::Repr); pData->SetTargetFrame(aTarget); - if (nFmt >= SVXURLFORMAT_APPDEFAULT && nFmt <= SVXURLFORMAT_REPR) + if (static_cast(nFmt) >= SvxURLFormat::AppDefault && + static_cast(nFmt) <= SvxURLFormat::Repr) pData->SetFormat(static_cast(nFmt)); return pData; @@ -424,7 +425,7 @@ SV_IMPL_PERSIST1( SvxURLField ); SvxURLField::SvxURLField() { - eFormat = SVXURLFORMAT_URL; + eFormat = SvxURLFormat::Url; } diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index ec4e45ad93f2..5642daf850e8 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -263,7 +263,7 @@ SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw() break; case text::textfield::Type::URL: - mpImpl->mnInt16 = SVXURLFORMAT_REPR; + mpImpl->mnInt16 = static_cast(SvxURLFormat::Repr); break; case text::textfield::Type::EXTENDED_FILE: @@ -415,9 +415,10 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw() break; case text::textfield::Type::URL: - pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, !mpImpl->msString1.isEmpty() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL ); + pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, !mpImpl->msString1.isEmpty() ? SvxURLFormat::Repr : SvxURLFormat::Url ); static_cast(pData)->SetTargetFrame( mpImpl->msString2 ); - if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR ) + if( static_cast(mpImpl->mnInt16) >= SvxURLFormat::AppDefault && + static_cast(mpImpl->mnInt16) <= SvxURLFormat::Repr ) static_cast(pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 ); break; -- cgit