22#include <sfx2/sfxsids.hrc>
23#include <com/sun/star/document/UpdateDocMode.hpp>
24#include <osl/file.hxx>
50#include <sfx2/strings.hrc>
53#include <com/sun/star/lang/XComponent.hpp>
54#include <com/sun/star/util/XCloseable.hpp>
56using ::com::sun::star::uno::UNO_QUERY;
57using ::com::sun::star::uno::Reference;
58using ::com::sun::star::lang::XComponent;
59using ::com::sun::star::util::XCloseable;
88 rTmp->SetLinkManager(
nullptr );
102 Reference<XCloseable> xCloseable(rxCachedComp, UNO_QUERY);
103 if (!xCloseable.is())
106 xCloseable->close(
true);
121 rTmp->SetLinkManager(
nullptr );
143 if (sal::static_int_cast<size_t>(
nPos + nCnt) >
aLinkTbl.size())
152 rTmp->SetLinkManager(
nullptr );
171 pLink->SetLinkManager(
this );
179 const OUString* pName )
182 pLink->SetObjType( nObjType );
185 pLink->SetUpdateMode( nUpdateMode );
190 const OUString& rServer,
191 std::u16string_view rTopic,
192 std::u16string_view rItem )
201 pLink->SetName( sCmd );
225 const OUString& sLNm(
pLink->GetLinkSourceName() );
226 if( !sLNm.isEmpty() )
228 switch(
pLink->GetObjType() )
243 *pFilter =
nPos == -1 ? OUString() : sLNm.copy(
nPos);
250 ? RID_SVXSTR_FILELINK
251 : RID_SVXSTR_GRAPHICLINK);
267 *pLinkStr = nTmp != -1 ? sLNm.copy(nTmp) : OUString();
281 bool bUpdateGrfLinks,
286 std::vector<SvBaseLink*> aTmpArr;
295 aTmpArr.push_back( rLink.
get() );
313 if( !
pLink->IsVisible() ||
319 OUString aMsg =
SfxResId(STR_QUERY_UPDATE_LINKS);
321 aMsg = aMsg.replaceFirst(
"%{filename}",
aURL.GetLastName());
324 VclMessageType::Question, VclButtonsType::YesNo, aMsg));
325 xQueryBox->set_default_response(
RET_YES);
327 int nRet = xQueryBox->run();
350 switch(
pLink->GetObjType() )
357 return new SvxInternalLink;
379void MakeLnkName( OUString& rName,
const OUString* pType, std::u16string_view rFile,
380 std::u16string_view rLink,
const OUString* pFilter )
409 size_t n = rLinks.size();
411 for (
size_t i = 0;
i <
n; ++
i)
414 OUString aType, aFile, aLink, aFilter;
418 if (aType !=
"soffice")
423 OUString
aURL = aFile;
424 if (osl::FileBase::getFileURLFromSystemPath(aFile, aTmp)
425 == osl::FileBase::E_None)
444 css::datatransfer::DataFlavor aFl;
448 &rLink, aFl.MimeType,
455 const OUString* pFilterNm,
const OUString* pRange)
460 OUStringBuffer
aBuf(64);
464 aBuf.append(*pRange);
471 OUString aCmd =
aBuf.makeStringAndClear();
481 for(
size_t n = rLnks.size();
n; )
487 pFileObj->CancelTransfers();
501 if( nFormat == SotClipboardFormatId::NONE )
504 "StatusInfo from SvxInternalLink");
510 const css::uno::Any & rValue,
516 if (!rValue.hasValue())
519 if (rValue.has<OUString>())
526 OUString sURL = rValue.get<OUString>();
534 else if (rValue.has<css::uno::Sequence<sal_Int8>>())
536 auto aSeq = rValue.get<css::uno::Sequence<sal_Int8>>();
544 case SotClipboardFormatId::SVXB:
551 case SotClipboardFormatId::GDIMETAFILE:
555 aReader.
Read( aMtf );
560 case SotClipboardFormatId::BITMAP:
578 if( INetProtocol::NotValid ==
aURL.GetProtocol() )
579 osl::FileBase::getFileURLFromSystemPath(rTopic, sRet);
588 sal_uInt16 nUpdateMode = css::document::UpdateDocMode::NO_UPDATE;
589 OUString sTopic, sItem, sReferer;
625 sTmp = aCC.lowercase( sTmp );
645 if( sTopic.isEmpty() )
653 css::datatransfer::DataFlavor aFl;
670 aURL.SetURL( sTopic );
671 if( INetProtocol::NotValid != eOld ||
672 INetProtocol::Http !=
aURL.GetProtocol() )
684 SfxBoolItem aDdeConnect(SID_DDE_RECONNECT_ONLOAD,
false);
691 aArgs.Put(aMinimized);
694 aArgs.Put(aReadOnly);
695 aArgs.Put(aDdeConnect);
698 if (xComp.is() && pFndShell && pLinkMgr)
700 pLinkMgr->InsertCachedComp(xComp);
SfxApplication * SfxGetpApp()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt16 GetValue() const
void setOriginURL(OUString const &rOriginURL)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
OUString GetBaseURL(bool bForSaving=false)
SfxItemSet & GetItemSet() const
const OUString & GetName() const
virtual ::sfx2::SvLinkSource * DdeCreateLinkSource(const OUString &rItem)
static css::uno::Reference< css::lang::XComponent > CreateAndLoadComponent(const SfxItemSet &rSet)
static SfxObjectShell * GetShellFromComponent(const css::uno::Reference< css::uno::XInterface > &xComp)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SfxMedium * GetMedium() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
virtual OUString getDocumentBaseURL() const override
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
static SotClipboardFormatId GetFormatIdFromMimeType(std::u16string_view rMimeType)
static SotClipboardFormatId RegisterFormatName(const OUString &rName)
SvStream & Read(GDIMetaFile &rMetaFile, ImplMetaReadData *pData=nullptr)
void readGraphic(Graphic &rGraphic)
void setUserAllowsLinkUpdate(bool bNew)
size_type erase(const Value &x)
std::pair< const_iterator, bool > insert(Value &&x)
SfxObjectShell * GetPersist() const
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
bool InsertLink(SvBaseLink *pLink, SvBaseLinkObjectType nObjType, SfxLinkUpdateMode nUpdateType, const OUString *pName)
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
bool InsertServer(SvLinkSource *rObj)
static SvLinkSourceRef CreateObj(SvBaseLink const *)
void InsertDDELink(SvBaseLink *, const OUString &rServer, std::u16string_view rTopic, std::u16string_view rItem)
SfxObjectShell * pPersist
static void LinkServerShell(const OUString &rPath, SfxObjectShell &rServer, ::sfx2::SvBaseLink &rLink)
Reconnect the server document shell to a DDE link object.
void InsertCachedComp(const css::uno::Reference< css::lang::XComponent > &xComp)
Insert a component loaded during link update, which needs to be closed when the update is complete.
bool Insert(SvBaseLink *pLink)
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
void RemoveServer(SvLinkSource *rObj)
static SotClipboardFormatId RegisterStatusInfoId()
void ReconnectDdeLink(SfxObjectShell &rServer)
LinkManager(SfxObjectShell *pCacheCont)
bool GetGraphicFromAny(std::u16string_view rMimeType, const css::uno::Any &rValue, Graphic &rGrf, weld::Window *pParentWin)
void Remove(SvBaseLink const *pLink)
const SvBaseLinks & GetLinks() const
SfxLinkUpdateMode GetUpdateMode() const
SotClipboardFormatId GetContentType() const
SvLinkSource * GetObj() const
void SetObj(SvLinkSource *pObj)
LinkManager * GetLinkManager()
SvBaseLinkObjectType GetObjType() const
void AddDataAdvise(SvBaseLink *, const OUString &rMimeType, sal_uInt16 nAdviceMode)
#define DBG_ASSERT(sCon, aError)
#define ADVISEMODE_ONLYONCE
Sequence< sal_Int8 > aSeq
bool isUntrustedReferer(OUString const &referer)
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
OString strip(const OString &rIn, char c)
const sal_Unicode cTokenSeparator
constexpr bool isClientFileType(SvBaseLinkObjectType t)
tools::SvRef< SvLinkSource > SvLinkSourceRef
std::vector< tools::SvRef< SvBaseLink > > SvBaseLinks
void MakeLnkName(OUString &rName, const OUString *pType, std::u16string_view rFile, std::u16string_view rLink, const OUString *pFilter)
constexpr bool isClientType(SvBaseLinkObjectType t)
static OUString lcl_DDE_RelToAbs(const OUString &rTopic, std::u16string_view rBaseURL)
Graphic loadFromURL(OUString const &rURL, weld::Window *pParentWin)
#define SFX_TITLE_FULLNAME
OUString SfxResId(TranslateId aId)