diff options
28 files changed, 119 insertions, 120 deletions
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index c70fa676a315..6a830e5580c1 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -41,8 +41,6 @@ #include <dialmgr.hxx> -#define FILEOBJECT ( OBJECT_CLIENT_FILE & ~OBJECT_CLIENT_SO ) - using namespace sfx2; using namespace ::com::sun::star; @@ -149,8 +147,8 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* pSvTabListBox) // possibly deselect old entries in case of multi-selection int nSelEntry = pSvTabListBox->get_selected_index(); SvBaseLink* pLink = reinterpret_cast<SvBaseLink*>(pSvTabListBox->get_id(nSelEntry).toInt64()); - sal_uInt16 nObjectType = pLink->GetObjType(); - if((OBJECT_CLIENT_FILE & nObjectType) != OBJECT_CLIENT_FILE) + SvBaseLinkObjectType nObjectType = pLink->GetObjType(); + if(!isClientFileType(nObjectType)) { pSvTabListBox->unselect_all(); pSvTabListBox->select(nSelEntry); @@ -164,7 +162,7 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* pSvTabListBox) DBG_ASSERT(pLink, "Where is the Link?"); if (!pLink) continue; - if( (OBJECT_CLIENT_FILE & pLink->GetObjType()) != OBJECT_CLIENT_FILE ) + if( !isClientFileType(pLink->GetObjType()) ) pSvTabListBox->unselect(nEntry); } } @@ -186,12 +184,12 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* pSvTabListBox) OUString sType, sLink; OUString *pLinkNm = &sLink, *pFilter = nullptr; - if( FILEOBJECT & pLink->GetObjType() ) + if( isClientType(pLink->GetObjType()) ) { m_xRbAutomatic->set_sensitive(false); m_xRbManual->set_active(true); m_xRbManual->set_sensitive(false); - if( OBJECT_CLIENT_GRF == pLink->GetObjType() ) + if( SvBaseLinkObjectType::ClientGraphic == pLink->GetObjType() ) { pLinkNm = nullptr; pFilter = &sLink; @@ -228,7 +226,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, AutomaticClickHdl, weld::Button&, void ) { int nPos; SvBaseLink* pLink = GetSelEntry( &nPos ); - if( pLink && !( FILEOBJECT & pLink->GetObjType() ) && + if( pLink && !isClientType( pLink->GetObjType() ) && SfxLinkUpdateMode::ALWAYS != pLink->GetUpdateMode() ) SetType( *pLink, nPos, SfxLinkUpdateMode::ALWAYS ); } @@ -237,7 +235,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, ManualClickHdl, weld::Button&, void ) { int nPos; SvBaseLink* pLink = GetSelEntry( &nPos ); - if( pLink && !( FILEOBJECT & pLink->GetObjType() ) && + if( pLink && !isClientType( pLink->GetObjType() ) && SfxLinkUpdateMode::ONCALL != pLink->GetUpdateMode()) SetType( *pLink, nPos, SfxLinkUpdateMode::ONCALL ); } @@ -371,7 +369,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, weld::Button&, void ) m_xTbLinks->remove(nPos); // close object, if it's still existing - bool bNewLnkMgr = OBJECT_CLIENT_FILE == xLink->GetObjType(); + bool bNewLnkMgr = SvBaseLinkObjectType::ClientFile == xLink->GetObjType(); // tell the link that it will be resolved! xLink->Closed(); @@ -578,7 +576,7 @@ void SvBaseLinksDlg::InsertEntry(const SvBaseLink& rLink, int nPos, bool bSelect m_xTbLinks->insert(nPos); m_xTbLinks->set_text(nPos, aTxt, 0); m_xTbLinks->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(&rLink))); - if( OBJECT_CLIENT_GRF == rLink.GetObjType() ) + if( SvBaseLinkObjectType::ClientGraphic == rLink.GetObjType() ) m_xTbLinks->set_text(nPos, sFilter, 1); else m_xTbLinks->set_text(nPos, sLinkNm, 1); diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx index c12b453f56c5..3648f0f1f7b2 100644 --- a/include/sfx2/linkmgr.hxx +++ b/include/sfx2/linkmgr.hxx @@ -60,7 +60,7 @@ class SFX2_DLLPUBLIC LinkManager SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell protected: - bool InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, SfxLinkUpdateMode nUpdateType, + bool InsertLink( SvBaseLink* pLink, SvBaseLinkObjectType nObjType, SfxLinkUpdateMode nUpdateType, const OUString* pName ); public: @@ -102,7 +102,7 @@ public: // Connect the links to a pseudo-object and add to the list void InsertFileLink( sfx2::SvBaseLink&, - sal_uInt16 nFileType, + SvBaseLinkObjectType nFileType, const OUString& rFileNm, const OUString* pFilterNm = nullptr, const OUString* pRange = nullptr ); diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx index b12c90c93683..c3b981afebfe 100644 --- a/include/sfx2/lnkbase.hxx +++ b/include/sfx2/lnkbase.hxx @@ -49,19 +49,24 @@ struct ImplBaseLinkData; class LinkManager; class FileDialogHelper; -#ifndef OBJECT_DDE_EXTERN -#define OBJECT_INTERN 0x00 -//#define OBJECT_SO_EXTERN 0x01 -#define OBJECT_DDE_EXTERN 0x02 -#endif +enum class SvBaseLinkObjectType { + Internal = 0x00, + DdeExternal = 0x02, + ClientSo = 0x80, // a Link + ClientDde = 0x81, + ClientFile = 0x90, + ClientGraphic = 0x91, + ClientOle = 0x92 // embedded link +}; -#define OBJECT_CLIENT_SO 0x80 // a Link -#define OBJECT_CLIENT_DDE 0x81 -//#define OBJECT_CLIENT_OLE 0x82 // an Ole-Link -//#define OBJECT_CLIENT_OLE_CACHE 0x83 // an Ole-Link with SvEmbeddedObject -#define OBJECT_CLIENT_FILE 0x90 -#define OBJECT_CLIENT_GRF 0x91 -#define OBJECT_CLIENT_OLE 0x92 // embedded link +constexpr bool isClientType(SvBaseLinkObjectType t) +{ + return static_cast<int>(t) & static_cast<int>(SvBaseLinkObjectType::ClientSo); +} +constexpr bool isClientFileType(SvBaseLinkObjectType t) +{ + return static_cast<int>(t) & static_cast<int>(SvBaseLinkObjectType::ClientFile); +} struct BaseLink_Impl; @@ -74,7 +79,7 @@ private: SvLinkSourceRef xObj; OUString aLinkName; std::unique_ptr<BaseLink_Impl> pImpl; - sal_uInt16 nObjType; + SvBaseLinkObjectType mnObjType; bool bVisible : 1; bool bSynchron : 1; bool bWasLastEditOK : 1; @@ -84,7 +89,7 @@ private: bool ExecuteEdit( const OUString& _rNewName ); protected: - void SetObjType( sal_uInt16 ); + void SetObjType( SvBaseLinkObjectType ); // Set LinkSourceName without action void SetName( const OUString & rLn ); @@ -113,11 +118,11 @@ public: virtual void Closed(); #if defined(_WIN32) - SvBaseLink( const OUString& rNm, sal_uInt16 nObjectType, + SvBaseLink( const OUString& rNm, SvBaseLinkObjectType nObjectType, SvLinkSource* ); #endif - sal_uInt16 GetObjType() const { return nObjType; } + SvBaseLinkObjectType GetObjType() const { return mnObjType; } void SetObj( SvLinkSource * pObj ); SvLinkSource* GetObj() const { return xObj.get(); } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 783bac66f2fd..83a80871e9ef 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -592,7 +592,7 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const OUString& aDocTab, ScTableLink* pLink = new ScTableLink( mpShell, aFileName, aFilterName, aOptions, nRefreshDelay ); pLink->SetInCreate( true ); OUString aFilName = aFilterName; - GetLinkManager()->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName, &aFilName ); + GetLinkManager()->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, aFileName, &aFilName ); pLink->Update(); pLink->SetInCreate( false ); SfxBindings* pBindings = GetViewBindings(); diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index 902cc717aff2..aa3461434570 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -326,7 +326,7 @@ void ScInterpreter::ScWebservice() if (!pLink) { pLink = new ScWebServiceLink(pDok, aURI); - mpLinkManager->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, aURI); + mpLinkManager->InsertFileLink(*pLink, sfx2::SvBaseLinkObjectType::ClientFile, aURI); if ( mpLinkManager->GetLinks().size() == 1 ) // the first one? { SfxBindings* pBindings = pDok->GetViewBindings(); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index d37b40628be0..b7775bf24cc0 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1017,7 +1017,7 @@ void XclImpWebQuery::Apply( ScDocument& rDoc, const OUString& rFilterName ) { ScAreaLink* pLink = new ScAreaLink( rDoc.GetDocumentShell(), maURL, rFilterName, EMPTY_OUSTRING, maTables, maDestRange, mnRefresh * 60UL ); - rDoc.GetLinkManager()->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, + rDoc.GetLinkManager()->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, maURL, &rFilterName, &maTables ); } } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index e80cacd3bb6b..b22fb78865dc 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -981,7 +981,7 @@ void ScXMLTableRowCellContext::SetCellRangeSource( const ScAddress& rPosition ) ScAreaLink* pLink = new ScAreaLink( pDoc->GetDocumentShell(), pCellRangeSource->sURL, sFilterName, pCellRangeSource->sFilterOptions, sSourceStr, aDestRange, pCellRangeSource->nRefresh ); sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, pCellRangeSource->sURL, &sFilterName, &sSourceStr ); + pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, pCellRangeSource->sURL, &sFilterName, &sSourceStr ); } } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 7217177a1bf4..c66ddeb06a9e 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5542,7 +5542,7 @@ void ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter, ScAreaLink* pLink = new ScAreaLink( &rDocShell, rFile, aFilterName, aNewOptions, rSource, rDestRange, nRefresh ); OUString aTmp = aFilterName; - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, rFile, &aTmp, &rSource ); + pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, rFile, &aTmp, &rSource ); // Undo for an empty link diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 35b484a2110d..9cd7b72474d2 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -380,7 +380,7 @@ void ScDocShell::UpdateLinks() { ScTableLink* pLink = new ScTableLink( this, aDocName, aFltName, aOptions, nRefresh ); pLink->SetInCreate(true); - pLinkManager->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, aDocName, &aFltName); + pLinkManager->InsertFileLink(*pLink, sfx2::SvBaseLinkObjectType::ClientFile, aDocName, &aFltName); pLink->Update(); pLink->SetInCreate(false); } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 53f229cd3ea1..cc3933eaa34f 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2622,7 +2622,7 @@ void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDefe } ScExternalRefLink* pLink = new ScExternalRefLink(mpDoc, nFileId); OSL_ENSURE(pFileName, "ScExternalRefManager::maybeLinkExternalFile: file name pointer is NULL"); - pLinkMgr->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, *pFileName, + pLinkMgr->InsertFileLink(*pLink, sfx2::SvBaseLinkObjectType::ClientFile, *pFileName, (aFilter.isEmpty() && bDeferFilterDetection ? nullptr : &aFilter)); pLink->SetDoReferesh(false); diff --git a/sc/source/ui/undo/areasave.cxx b/sc/source/ui/undo/areasave.cxx index 998032371892..361084ad7739 100644 --- a/sc/source/ui/undo/areasave.cxx +++ b/sc/source/ui/undo/areasave.cxx @@ -68,7 +68,7 @@ void ScAreaLinkSaver::InsertNewLink( ScDocument* pDoc ) pLink->SetInCreate( true ); pLink->SetDestArea( aDestArea ); OUString aTmp1(aFilterName), aTmp2(aSourceArea); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName, &aTmp1, &aTmp2 ); + pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, aFileName, &aTmp1, &aTmp2 ); pLink->Update(); pLink->SetInCreate( false ); } diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 68aeede027ef..a386cbd6db0e 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -1525,7 +1525,7 @@ void ScUndoInsertAreaLink::Redo() aAreaName, aRange.aStart, nRefreshDelay ); pLink->SetInCreate( true ); pLink->SetDestArea( aRange ); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aDocName, &aFltName, &aAreaName ); + pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, aDocName, &aFltName, &aAreaName ); pLink->Update(); pLink->SetInCreate( false ); @@ -1574,7 +1574,7 @@ void ScUndoRemoveAreaLink::Undo() aAreaName, aRange.aStart, nRefreshDelay ); pLink->SetInCreate( true ); pLink->SetDestArea( aRange ); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aDocName, &aFltName, &aAreaName ); + pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, aDocName, &aFltName, &aAreaName ); pLink->Update(); pLink->SetInCreate( false ); diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index dfd7aec9578a..697b8ae19736 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2703,7 +2703,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, { ScTableLink* pLink = new ScTableLink( pDocSh, aFileName, aFilterName, aOptions, nRefresh ); pLink->SetInCreate( true ); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName, &aFilterName ); + pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, aFileName, &aFilterName ); pLink->Update(); pLink->SetInCreate( false ); diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 077023df9dc7..35dd423e2372 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -306,7 +306,7 @@ void SdPage::ConnectLink() // No links to document owned pages! mpPageLink = new SdPageLink(this, maFileName, maBookmarkName); OUString aFilterName(SdResId(STR_IMPRESS)); - pLinkManager->InsertFileLink(*mpPageLink, OBJECT_CLIENT_FILE, + pLinkManager->InsertFileLink(*mpPageLink, sfx2::SvBaseLinkObjectType::ClientFile, maFileName, &aFilterName, &maBookmarkName); mpPageLink->Connect(); } diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index e3cfa2494adf..9c2e21dcc426 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -556,7 +556,7 @@ bool SfxDdeDocTopic_Impl::StartAdviseLoop() // then we also establish a corresponding SvBaseLink OUString sNm, sTmp( Application::GetAppName() ); ::sfx2::MakeLnkName( sNm, &sTmp, pSh->GetTitle(SFX_TITLE_FULLNAME), GetCurItem() ); - new ::sfx2::SvBaseLink( sNm, OBJECT_DDE_EXTERN, pNewObj ); + new ::sfx2::SvBaseLink( sNm, sfx2::SvBaseLinkObjectType::DdeExternal, pNewObj ); bRet = true; } return bRet; diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index 14b5d4caf9f2..ebfe57edf2a3 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -111,7 +111,7 @@ bool SvFileObject::Connect( sfx2::SvBaseLink* pLink ) // Test if not another link of the same connection already exists sfx2::LinkManager::GetDisplayNames( pLink, nullptr, &sFileNm, nullptr, &sFilter ); - if( OBJECT_CLIENT_GRF == pLink->GetObjType() ) + if( sfx2::SvBaseLinkObjectType::ClientGraphic == pLink->GetObjType() ) { SfxObjectShellRef pShell = pLink->GetLinkManager()->GetPersist(); if( pShell.is() ) @@ -126,16 +126,16 @@ bool SvFileObject::Connect( sfx2::SvBaseLink* pLink ) switch( pLink->GetObjType() ) { - case OBJECT_CLIENT_GRF: + case sfx2::SvBaseLinkObjectType::ClientGraphic: nType = SvFileObjectType::Graphic; bSynchron = pLink->IsSynchron(); break; - case OBJECT_CLIENT_FILE: + case sfx2::SvBaseLinkObjectType::ClientFile: nType = SvFileObjectType::Text; break; - case OBJECT_CLIENT_OLE: + case sfx2::SvBaseLinkObjectType::ClientOle: nType = SvFileObjectType::Object; // TODO/LATER: introduce own type to be used for exchanging break; @@ -263,7 +263,7 @@ void SvFileObject::Edit(weld::Window* pParent, sfx2::SvBaseLink* pLink, const Li switch( pLink->GetObjType() ) { - case OBJECT_CLIENT_GRF: + case sfx2::SvBaseLinkObjectType::ClientGraphic: { nType = SvFileObjectType::Graphic; // If not set already @@ -286,7 +286,7 @@ void SvFileObject::Edit(weld::Window* pParent, sfx2::SvBaseLink* pLink, const Li } break; - case OBJECT_CLIENT_OLE: + case sfx2::SvBaseLinkObjectType::ClientOle: { nType = SvFileObjectType::Object; // if not set already @@ -297,7 +297,7 @@ void SvFileObject::Edit(weld::Window* pParent, sfx2::SvBaseLink* pLink, const Li } break; - case OBJECT_CLIENT_FILE: + case sfx2::SvBaseLinkObjectType::ClientFile: { nType = SvFileObjectType::Text; // if not set already diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 03d01eb900af..ca9cde51e17f 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -172,7 +172,7 @@ bool LinkManager::Insert( SvBaseLink* pLink ) } bool LinkManager::InsertLink( SvBaseLink * pLink, - sal_uInt16 nObjType, + SvBaseLinkObjectType nObjType, SfxLinkUpdateMode nUpdateMode, const OUString* pName ) { @@ -189,25 +189,25 @@ void LinkManager::InsertDDELink( SvBaseLink * pLink, const OUString& rTopic, const OUString& rItem ) { - if( !( OBJECT_CLIENT_SO & pLink->GetObjType() ) ) + if( !isClientType( pLink->GetObjType() ) ) return; OUString sCmd; ::sfx2::MakeLnkName( sCmd, &rServer, rTopic, rItem ); - pLink->SetObjType( OBJECT_CLIENT_DDE ); + pLink->SetObjType( SvBaseLinkObjectType::ClientDde ); pLink->SetName( sCmd ); Insert( pLink ); } void LinkManager::InsertDDELink( SvBaseLink * pLink ) { - DBG_ASSERT( OBJECT_CLIENT_SO & pLink->GetObjType(), "no OBJECT_CLIENT_SO" ); - if( !( OBJECT_CLIENT_SO & pLink->GetObjType() ) ) + DBG_ASSERT( isClientType(pLink->GetObjType()), "no OBJECT_CLIENT_SO" ); + if( !isClientType( pLink->GetObjType() ) ) return; - if( pLink->GetObjType() == OBJECT_CLIENT_SO ) - pLink->SetObjType( OBJECT_CLIENT_DDE ); + if( pLink->GetObjType() == SvBaseLinkObjectType::ClientSo ) + pLink->SetObjType( SvBaseLinkObjectType::ClientDde ); Insert( pLink ); } @@ -225,9 +225,9 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, { switch( pLink->GetObjType() ) { - case OBJECT_CLIENT_FILE: - case OBJECT_CLIENT_GRF: - case OBJECT_CLIENT_OLE: + case SvBaseLinkObjectType::ClientFile: + case SvBaseLinkObjectType::ClientGraphic: + case SvBaseLinkObjectType::ClientOle: { sal_Int32 nPos = 0; OUString sFile( sLNm.getToken( 0, ::sfx2::cTokenSeparator, nPos ) ); @@ -242,16 +242,16 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, if( pType ) { - sal_uInt16 nObjType = pLink->GetObjType(); + SvBaseLinkObjectType nObjType = pLink->GetObjType(); *pType = SfxResId( - ( OBJECT_CLIENT_FILE == nObjType || OBJECT_CLIENT_OLE == nObjType ) + ( SvBaseLinkObjectType::ClientFile == nObjType || SvBaseLinkObjectType::ClientOle == nObjType ) ? RID_SVXSTR_FILELINK : RID_SVXSTR_GRAFIKLINK); } bRet = true; } break; - case OBJECT_CLIENT_DDE: + case SvBaseLinkObjectType::ClientDde: { sal_Int32 nTmp = 0; OUString sServer( sLNm.getToken( 0, cTokenSeparator, nTmp ) ); @@ -309,7 +309,7 @@ void LinkManager::UpdateAllLinks( // Graphic-Links not to update yet if( !pLink->IsVisible() || - ( !bUpdateGrfLinks && OBJECT_CLIENT_GRF == pLink->GetObjType() )) + ( !bUpdateGrfLinks && SvBaseLinkObjectType::ClientGraphic == pLink->GetObjType() )) continue; if( bAskUpdate ) @@ -347,13 +347,13 @@ SvLinkSourceRef LinkManager::CreateObj( SvBaseLink const * pLink ) { switch( pLink->GetObjType() ) { - case OBJECT_CLIENT_FILE: - case OBJECT_CLIENT_GRF: - case OBJECT_CLIENT_OLE: + case SvBaseLinkObjectType::ClientFile: + case SvBaseLinkObjectType::ClientGraphic: + case SvBaseLinkObjectType::ClientOle: return new SvFileObject; - case OBJECT_INTERN: + case SvBaseLinkObjectType::Internal: return new SvxInternalLink; - case OBJECT_CLIENT_DDE: + case SvBaseLinkObjectType::ClientDde: return new SvDDEObject; default: return SvLinkSourceRef(); @@ -449,10 +449,10 @@ void LinkManager::LinkServerShell(const OUString& rPath, SfxObjectShell& rServer } void LinkManager::InsertFileLink( - sfx2::SvBaseLink& rLink, sal_uInt16 nFileType, const OUString& rFileNm, + sfx2::SvBaseLink& rLink, SvBaseLinkObjectType nFileType, const OUString& rFileNm, const OUString* pFilterNm, const OUString* pRange) { - if (!(OBJECT_CLIENT_SO & rLink.GetObjType())) + if (!isClientType(rLink.GetObjType())) return; OUStringBuffer aBuf(64); @@ -482,7 +482,7 @@ void LinkManager::CancelTransfers() for( size_t n = rLnks.size(); n; ) { const sfx2::SvBaseLink& rLnk = *rLnks[--n]; - if (OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & rLnk.GetObjType()) + if (isClientFileType(rLnk.GetObjType()) && nullptr != (pFileObj = static_cast<SvFileObject*>(rLnk.GetObj()))) pFileObj->CancelTransfers(); } diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index ab0119053021..8df00b9bd788 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -129,7 +129,7 @@ SvBaseLink::SvBaseLink() : pImpl ( new BaseLink_Impl ), m_bIsReadOnly(false) { - nObjType = OBJECT_CLIENT_SO; + mnObjType = SvBaseLinkObjectType::ClientSo; pImplData.reset( new ImplBaseLinkData ); bVisible = bSynchron = true; bWasLastEditOK = false; @@ -140,7 +140,7 @@ SvBaseLink::SvBaseLink( SfxLinkUpdateMode nUpdateMode, SotClipboardFormatId nCon : pImpl( new BaseLink_Impl ), m_bIsReadOnly(false) { - nObjType = OBJECT_CLIENT_SO; + mnObjType = SvBaseLinkObjectType::ClientSo; pImplData.reset( new ImplBaseLinkData ); bVisible = bSynchron = true; bWasLastEditOK = false; @@ -183,7 +183,7 @@ static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt ) return nullptr; } -SvBaseLink::SvBaseLink( const OUString& rLinkName, sal_uInt16 nObjectType, SvLinkSource* pObj ) +SvBaseLink::SvBaseLink( const OUString& rLinkName, SvBaseLinkObjectType nObjectType, SvLinkSource* pObj ) : pImpl() , m_bIsReadOnly(false) { @@ -191,7 +191,7 @@ SvBaseLink::SvBaseLink( const OUString& rLinkName, sal_uInt16 nObjectType, SvLin bWasLastEditOK = false; aLinkName = rLinkName; pImplData.reset( new ImplBaseLinkData ); - nObjType = nObjectType; + mnObjType = nObjectType; if( !pObj ) { @@ -199,7 +199,7 @@ SvBaseLink::SvBaseLink( const OUString& rLinkName, sal_uInt16 nObjectType, SvLin return; } - if( OBJECT_DDE_EXTERN == nObjType ) + if( SvBaseLinkObjectType::DdeExternal == mnObjType ) { sal_uInt16 nItemStt = 0; DdeTopic* pTopic = FindTopic( aLinkName, &nItemStt ); @@ -226,12 +226,10 @@ SvBaseLink::~SvBaseLink() { Disconnect(); - switch( nObjType ) + if( mnObjType == SvBaseLinkObjectType::DdeExternal ) { - case OBJECT_DDE_EXTERN: if( !pImplData->DDEType.pItem->IsInDTOR() ) delete pImplData->DDEType.pItem; - break; } pImplData.reset(); @@ -247,12 +245,12 @@ IMPL_LINK( SvBaseLink, EndEditHdl, const OUString&, _rNewName, void ) } -void SvBaseLink::SetObjType( sal_uInt16 nObjTypeP ) +void SvBaseLink::SetObjType( SvBaseLinkObjectType mnObjTypeP ) { - DBG_ASSERT( nObjType != OBJECT_CLIENT_DDE, "type already set" ); + DBG_ASSERT( mnObjType != SvBaseLinkObjectType::ClientDde, "type already set" ); DBG_ASSERT( !xObj.is(), "object exist" ); - nObjType = nObjTypeP; + mnObjType = mnObjTypeP; } @@ -264,9 +262,9 @@ void SvBaseLink::SetName( const OUString & rNm ) void SvBaseLink::SetObj( SvLinkSource * pObj ) { - DBG_ASSERT( (nObjType & OBJECT_CLIENT_SO && - pImplData->ClientType.bIntrnlLnk) || - nObjType == OBJECT_CLIENT_GRF, + DBG_ASSERT( (isClientType(mnObjType) && + pImplData->ClientType.bIntrnlLnk) || + mnObjType == SvBaseLinkObjectType::ClientGraphic, "no intern link" ); xObj = pObj; } @@ -291,7 +289,7 @@ void SvBaseLink::SetLinkSourceName( const OUString & rLnkNm ) void SvBaseLink::SetUpdateMode( SfxLinkUpdateMode nMode ) { - if( ( OBJECT_CLIENT_SO & nObjType ) && + if( isClientType(mnObjType) && pImplData->ClientType.nUpdateMode != nMode ) { AddNextRef(); @@ -315,7 +313,7 @@ void SvBaseLink::clearStreamToLoadFrom() bool SvBaseLink::Update() { - if( OBJECT_CLIENT_SO & nObjType ) + if( isClientType(mnObjType) ) { AddNextRef(); Disconnect(); @@ -334,7 +332,7 @@ bool SvBaseLink::Update() UpdateResult eRes = DataChanged(sMimeType, aData); bool bSuccess = eRes == SUCCESS; //for manual Updates there is no need to hold the ServerObject - if( OBJECT_CLIENT_DDE == nObjType && + if( SvBaseLinkObjectType::ClientDde == mnObjType && SfxLinkUpdateMode::ONCALL == GetUpdateMode() && xObj.is() ) xObj->RemoveAllDataAdvise( this ); return bSuccess; @@ -358,7 +356,7 @@ bool SvBaseLink::Update() SfxLinkUpdateMode SvBaseLink::GetUpdateMode() const { - return ( OBJECT_CLIENT_SO & nObjType ) + return isClientType(mnObjType) ? pImplData->ClientType.nUpdateMode : SfxLinkUpdateMode::ONCALL; } @@ -371,18 +369,18 @@ void SvBaseLink::GetRealObject_( bool bConnect) DBG_ASSERT( !xObj.is(), "object already exist" ); - if( OBJECT_CLIENT_DDE == nObjType ) + if( SvBaseLinkObjectType::ClientDde == mnObjType ) { OUString sServer; if( sfx2::LinkManager::GetDisplayNames( this, &sServer ) && sServer == Application::GetAppName() ) // internal Link !!! { // so that the Internal link can be created! - nObjType = OBJECT_INTERN; + mnObjType = SvBaseLinkObjectType::Internal; xObj = sfx2::LinkManager::CreateObj( this ); pImplData->ClientType.bIntrnlLnk = true; - nObjType = OBJECT_CLIENT_DDE; // so we know what it once was! + mnObjType = SvBaseLinkObjectType::ClientDde; // so we know what it once was! } else { @@ -390,7 +388,7 @@ void SvBaseLink::GetRealObject_( bool bConnect) xObj = sfx2::LinkManager::CreateObj( this ); } } - else if( OBJECT_CLIENT_SO & nObjType ) + else if( isClientType(mnObjType) ) xObj = sfx2::LinkManager::CreateObj( this ); if( bConnect && ( !xObj.is() || !xObj->Connect( this ) ) ) @@ -399,7 +397,7 @@ void SvBaseLink::GetRealObject_( bool bConnect) SotClipboardFormatId SvBaseLink::GetContentType() const { - if( OBJECT_CLIENT_SO & nObjType ) + if( isClientType(mnObjType) ) return pImplData->ClientType.nCntntType; return SotClipboardFormatId::NONE; // all Formats ? @@ -408,7 +406,7 @@ SotClipboardFormatId SvBaseLink::GetContentType() const void SvBaseLink::SetContentType( SotClipboardFormatId nType ) { - if( OBJECT_CLIENT_SO & nObjType ) + if( isClientType(mnObjType) ) { pImplData->ClientType.nCntntType = nType; } @@ -441,12 +439,10 @@ void SvBaseLink::Disconnect() SvBaseLink::UpdateResult SvBaseLink::DataChanged( const OUString &, const css::uno::Any & ) { - switch( nObjType ) + if ( mnObjType == SvBaseLinkObjectType::DdeExternal ) { - case OBJECT_DDE_EXTERN: if( pImplData->DDEType.pItem ) pImplData->DDEType.pItem->Notify(); - break; } return SUCCESS; } @@ -462,7 +458,7 @@ void SvBaseLink::Edit(weld::Window* pParent, const Link<SvBaseLink&,void>& rEndE bool bAsync = false; Link<const OUString&, void> aLink = LINK( this, SvBaseLink, EndEditHdl ); - if( OBJECT_CLIENT_SO & nObjType && pImplData->ClientType.bIntrnlLnk ) + if( isClientType(mnObjType) && pImplData->ClientType.bIntrnlLnk ) { if( pImpl->m_pLinkMgr ) { @@ -497,7 +493,7 @@ bool SvBaseLink::ExecuteEdit( const OUString& _rNewName ) { OUString sApp, sTopic, sItem, sError; sfx2::LinkManager::GetDisplayNames( this, &sApp, &sTopic, &sItem ); - if( nObjType == OBJECT_CLIENT_DDE ) + if( mnObjType == SvBaseLinkObjectType::ClientDde ) { sError = SfxResId(STR_DDE_ERROR); @@ -596,7 +592,7 @@ void ImplDdeItem::AdviseLoop( bool bOpen ) if( bOpen ) { // A connection is re-established - if( OBJECT_DDE_EXTERN == pLink->GetObjType() ) + if( SvBaseLinkObjectType::DdeExternal == pLink->GetObjType() ) { pLink->GetObj()->AddDataAdvise( pLink, "text/plain;charset=utf-16", ADVISEMODE_NODATA ); pLink->GetObj()->AddConnectAdvise( pLink ); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 0d298e27bd30..49c4c3175dd6 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -468,7 +468,7 @@ void SdrGrafObj::ImpRegisterLink() { pGraphicLink = new SdrGraphicLink( *this ); pLinkManager->InsertFileLink( - *pGraphicLink, OBJECT_CLIENT_GRF, aFileName, (aFilterName.isEmpty() ? nullptr : &aFilterName)); + *pGraphicLink, sfx2::SvBaseLinkObjectType::ClientGraphic, aFileName, (aFilterName.isEmpty() ? nullptr : &aFilterName)); pGraphicLink->Connect(); } } diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 8ff2f6a66aef..50afc8fcbd36 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -934,7 +934,7 @@ void SdrOle2Obj::CheckFileLink_Impl() { mpImpl->mpObjectLink = new SdrEmbedObjectLink( this ); mpImpl->maLinkURL = aLinkURL; - pLinkManager->InsertFileLink( *mpImpl->mpObjectLink, OBJECT_CLIENT_OLE, aLinkURL ); + pLinkManager->InsertFileLink( *mpImpl->mpObjectLink, sfx2::SvBaseLinkObjectType::ClientOle, aLinkURL ); mpImpl->mpObjectLink->Connect(); } } diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx index 8af1d8647abe..01055b45afb6 100644 --- a/svx/source/svdraw/svdotxln.cxx +++ b/svx/source/svdraw/svdotxln.cxx @@ -257,7 +257,7 @@ void SdrTextObj::ImpRegisterLink() sfx2::LinkManager* pLinkManager(getSdrModelFromSdrObject().GetLinkManager()); if (pLinkManager!=nullptr && pData!=nullptr && pData->pLink==nullptr) { // don't register twice pData->pLink = new ImpSdrObjTextLink(this); - pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName, + pLinkManager->InsertFileLink(*pData->pLink,sfx2::SvBaseLinkObjectType::ClientFile,pData->aFileName, !pData->aFilterName.isEmpty() ? &pData->aFilterName : nullptr); } diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 25b184cbd09f..c208552f23ff 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -162,12 +162,12 @@ inline const SwGrfNode *SwNode::GetGrfNode() const inline bool SwGrfNode::IsLinkedFile() const { - return mxLink.is() && OBJECT_CLIENT_GRF == mxLink->GetObjType(); + return mxLink.is() && sfx2::SvBaseLinkObjectType::ClientGraphic == mxLink->GetObjType(); } inline bool SwGrfNode::IsLinkedDDE() const { - return mxLink.is() && OBJECT_CLIENT_DDE == mxLink->GetObjType(); + return mxLink.is() && sfx2::SvBaseLinkObjectType::ClientDde == mxLink->GetObjType(); } #endif diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index f911923ab41a..2b52eb6332cb 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -46,8 +46,8 @@ typedef std::vector<SwSection*> SwSections; enum class SectionType { Content, ToxHeader, ToxContent, - DdeLink = OBJECT_CLIENT_DDE, - FileLink = OBJECT_CLIENT_FILE + DdeLink = static_cast<int>(sfx2::SvBaseLinkObjectType::ClientDde), + FileLink = static_cast<int>(sfx2::SvBaseLinkObjectType::ClientFile) }; enum class LinkCreateType diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index c5ad43e69bcc..83a1e8f81f8d 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -67,7 +67,7 @@ namespace for (const auto& rLinkIter : rLinks) { ::sfx2::SvBaseLink& rLnk = *rLinkIter; - if ((OBJECT_CLIENT_GRF == rLnk.GetObjType() || OBJECT_CLIENT_FILE == rLnk.GetObjType()) + if ((sfx2::SvBaseLinkObjectType::ClientGraphic == rLnk.GetObjType() || sfx2::SvBaseLinkObjectType::ClientFile == rLnk.GetObjType()) && dynamic_cast<const SwBaseLink*>(&rLnk) != nullptr) { tools::SvRef<sfx2::SvBaseLink> xLink(&rLnk); diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index bae7ae799856..95b3982ea860 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -224,7 +224,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const for( size_t n = rLnks.size(); n; ) { const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); - if (OBJECT_CLIENT_GRF != pLnk->GetObjType() && + if (sfx2::SvBaseLinkObjectType::ClientGraphic != pLnk->GetObjType() && dynamic_cast<const SwBaseLink*>( pLnk) != nullptr && !static_cast<const SwBaseLink*>(pLnk)->IsNoDataFlag() && static_cast<const SwBaseLink*>(pLnk)->IsInRange( nSttNd, nEndNd )) diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 180b7b98c904..cf5b00a576ae 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1141,7 +1141,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk != &rUpdLnk && - OBJECT_CLIENT_FILE == pLnk->GetObjType() && + sfx2::SvBaseLinkObjectType::ClientFile == pLnk->GetObjType() && dynamic_cast< const SwBaseLink *>( pLnk ) != nullptr && ( pBLink = static_cast<SwBaseLink*>(pLnk) )->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) ) @@ -1526,7 +1526,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) const OUString sFltr(sCmd.getToken( 0, sfx2::cTokenSeparator, nIndex )); const OUString sRange(sCmd.getToken( 0, sfx2::cTokenSeparator, nIndex )); pFormat->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().InsertFileLink( *pLnk, - static_cast<sal_uInt16>(m_Data.GetType()), + static_cast<sfx2::SvBaseLinkObjectType>(m_Data.GetType()), sFile, ( !sFltr.isEmpty() ? &sFltr : nullptr ), ( !sRange.isEmpty() ? &sRange : nullptr ) ); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index ab9dec20c19d..6e042765ab7c 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -162,13 +162,13 @@ bool SwGrfNode::ReRead( OUString sCmd( sURLLink ); if( !rFltName.isEmpty() ) { - sal_uInt16 nNewType; + sfx2::SvBaseLinkObjectType nNewType; if( rFltName == "DDE" ) - nNewType = OBJECT_CLIENT_DDE; + nNewType = sfx2::SvBaseLinkObjectType::ClientDde; else { sfx2::MakeLnkName( sCmd, nullptr, sURLLink, OUString(), &rFltName ); - nNewType = OBJECT_CLIENT_GRF; + nNewType = sfx2::SvBaseLinkObjectType::ClientGraphic; } if( nNewType != mxLink->GetObjType() ) @@ -485,11 +485,11 @@ bool SwGrfNode::GetFileFilterNms( OUString* pFileNm, OUString* pFilterNm ) const bool bRet = false; if( mxLink.is() && mxLink->GetLinkManager() ) { - sal_uInt16 nType = mxLink->GetObjType(); - if( OBJECT_CLIENT_GRF == nType ) + sfx2::SvBaseLinkObjectType nType = mxLink->GetObjType(); + if( sfx2::SvBaseLinkObjectType::ClientGraphic == nType ) bRet = sfx2::LinkManager::GetDisplayNames( mxLink.get(), nullptr, pFileNm, nullptr, pFilterNm ); - else if( OBJECT_CLIENT_DDE == nType && pFileNm && pFilterNm ) + else if( sfx2::SvBaseLinkObjectType::ClientDde == nType && pFileNm && pFilterNm ) { OUString sApp; OUString sTopic; @@ -576,7 +576,7 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) mxLink->SetContentType( SotClipboardFormatId::SVXB ); rIDLA.GetLinkManager().InsertFileLink( *mxLink, - OBJECT_CLIENT_GRF, rGrfName, + sfx2::SvBaseLinkObjectType::ClientGraphic, rGrfName, (!bSync && !rFltName.isEmpty() ? &rFltName : nullptr) ); } } diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index e568c9159945..1927872ed0d9 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -614,7 +614,7 @@ void SwOLENode::CheckFileLink_Impl() // this is a file link so the model link manager should handle it mpObjectLink = new SwEmbedObjectLink( this ); maLinkURL = aLinkURL; - GetDoc()->getIDocumentLinksAdministration().GetLinkManager().InsertFileLink( *mpObjectLink, OBJECT_CLIENT_OLE, aLinkURL ); + GetDoc()->getIDocumentLinksAdministration().GetLinkManager().InsertFileLink( *mpObjectLink, sfx2::SvBaseLinkObjectType::ClientOle, aLinkURL ); mpObjectLink->Connect(); } } |