24#include <com/sun/star/uno/Any.hxx>
25#include <com/sun/star/uno/Sequence.hxx>
26#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
30#include <sfx2/strings.hrc>
35#include <osl/diagnose.h>
88 ImplDdeItem( SvBaseLink& rLink,
const OUString& rStr )
93 virtual ~ImplDdeItem()
override;
97 virtual void AdviseLoop(
bool )
override;
105 bool IsInDTOR()
const {
return bIsInDTOR; }
111 : m_pLinkMgr( nullptr )
112 , m_pParentWin( nullptr )
113 , m_bIsConnect( false )
114 , m_bIsReadOnly(false)
124 : m_pLinkMgr( nullptr )
125 , m_pParentWin( nullptr )
126 , m_bIsConnect( false )
127 , m_bIsReadOnly(false)
135 pImplData->ClientType.nUpdateMode = nUpdateMode;
136 pImplData->ClientType.nCntntType = nContentType;
137 pImplData->ClientType.bIntrnlLnk =
false;
142static DdeTopic* FindTopic(
const OUString & rLinkName, sal_uInt16* pItemStt )
144 if( rLinkName.isEmpty() )
147 OUString sNm( rLinkName );
148 sal_Int32 nTokenPos = 0;
152 for (
auto const& elem : rSvc)
154 if(elem->GetName() == sService)
159 *pItemStt = nTokenPos;
161 std::vector<DdeTopic*>& rTopics = elem->GetTopics();
163 for (
auto const& topic : rTopics)
164 if( topic->GetName() == sTopic )
173 : m_pLinkMgr( nullptr )
174 , m_pParentWin( nullptr )
175 , m_bIsConnect( false )
176 , m_bIsReadOnly(false)
186 DBG_ASSERT( pObj,
"Where is my left-most object" );
192 sal_uInt16 nItemStt = 0;
207 else if( pObj->Connect(
this ) )
219 if( !
pImplData->DDEType.pItem->IsInDTOR() )
228 OUString sNewName = _rNewName;
229 if ( !ExecuteEdit( sNewName ) )
231 bWasLastEditOK = !sNewName.isEmpty();
232 m_aEndEditLink.Call( *
this );
281 pImplData->ClientType.nUpdateMode != nMode )
286 pImplData->ClientType.nUpdateMode = nMode;
298 xObj->clearStreamToLoadFrom();
321 bool bSuccess = eRes ==
SUCCESS;
325 xObj->RemoveAllDataAdvise(
this );
331 if(
xObj->IsPending() )
375 pImplData->ClientType.bIntrnlLnk =
false;
382 if( bConnect && ( !
xObj.
is() || !
xObj->Connect(
this ) ) )
391 return SotClipboardFormatId::NONE;
422 xObj->RemoveAllDataAdvise(
this );
423 xObj->RemoveConnectAdvise(
this );
456 ref->Edit( pParent,
this, aLink );
463 xObj->Edit( pParent,
this, aLink );
477 if( !_rNewName.isEmpty() )
482 OUString sApp, sTopic, sItem, sError;
488 sal_Int32 nFndPos = sError.indexOf(
"%1" );
491 sError = sError.replaceAt( nFndPos, 2, sApp );
492 nFndPos = nFndPos + sApp.getLength();
494 if( -1 != ( nFndPos = sError.indexOf(
"%2", nFndPos )))
496 sError = sError.replaceAt( nFndPos, 2, sTopic );
497 nFndPos = nFndPos + sTopic.getLength();
499 if( -1 != ( nFndPos = sError.indexOf(
"%3", nFndPos )))
500 sError = sError.replaceAt( nFndPos, 2, sItem );
508 VclMessageType::Warning, VclButtonsType::Ok, sError));
521 xObj->RemoveAllDataAdvise(
this );
527 ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
532ImplDdeItem::~ImplDdeItem()
552 if( aValue >>=
aSeq )
567bool ImplDdeItem::Put(
const DdeData* )
569 OSL_FAIL(
"ImplDdeItem::Put not implemented" );
574void ImplDdeItem::AdviseLoop(
bool bOpen )
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static OUString GetAppName()
SotClipboardFormatId GetFormat() const
static DdeServices & GetServices()
void InsertItem(DdeItem *)
static OUString GetFormatMimeType(SotClipboardFormatId nFormat)
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
static SvLinkSourceRef CreateObj(SvBaseLink const *)
void SetUpdateMode(SfxLinkUpdateMode)
FileDialogHelper & GetInsertFileDialog(const OUString &rFactory)
void SetLinkManager(LinkManager *_pMgr)
SfxLinkUpdateMode GetUpdateMode() const
void SetName(const OUString &rLn)
void SetContentType(SotClipboardFormatId nType)
Link< SvBaseLink &, void > m_aEndEditLink
virtual ~SvBaseLink() override
void clearStreamToLoadFrom()
void SetLinkSourceName(const OUString &rName)
virtual UpdateResult DataChanged(const OUString &rMimeType, const css::uno::Any &rValue)
SotClipboardFormatId GetContentType() const
void SetObjType(SvBaseLinkObjectType)
virtual void Edit(weld::Window *, const Link< SvBaseLink &, void > &rEndEditHdl)
css::uno::Reference< css::io::XInputStream > m_xInputStreamToLoadFrom
weld::Window * m_pParentWin
SvBaseLinkObjectType mnObjType
std::unique_ptr< ImplBaseLinkData > pImplData
bool ExecuteEdit(const OUString &_rNewName)
SvLinkSource * GetObj() const
void SetObj(SvLinkSource *pObj)
void GetRealObject_(bool bConnect=true)
std::unique_ptr< FileDialogHelper > m_pFileDlg
LinkManager * GetLinkManager()
SvBaseLinkObjectType GetObjType() const
virtual bool GetData(css::uno::Any &rData, const OUString &rMimeType, bool bSynchron=false)
void AddDataAdvise(SvBaseLink *, const OUString &rMimeType, sal_uInt16 nAdviceMode)
void AddConnectAdvise(SvBaseLink *)
#define DBG_ASSERT(sCon, aError)
#define LINK(Instance, Class, Member)
#define ADVISEMODE_NODATA
Sequence< sal_Int8 > aSeq
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
const sal_Unicode cTokenSeparator
IMPL_LINK(SvDDEObject, ImplGetDDEData, const DdeData *, pData, void)
constexpr bool isClientType(SvBaseLinkObjectType t)
OUString SfxResId(TranslateId aId)
SfxLinkUpdateMode nUpdateMode
SotClipboardFormatId nCntntType
::std::vector< DdeService * > DdeServices