24#include <osl/file.hxx>
30#include <sfx2/sfxsids.hrc>
39#include <bitmaps.hlst>
45OUString CreateUiNameFromURL(
const OUString& aStrURL )
50 switch(aURLObj.GetProtocol())
52 case INetProtocol::File:
55 case INetProtocol::Ftp :
68 if(aStrUiURL.isEmpty())
78 , DropTargetHelper(getWidget()->get_drop_target())
94 if( aDataHelper.
GetString( SotClipboardFormatId::STRING, aString ) )
107 const OUString& rUIXMLDescription,
111 , mxCbbFrame(xBuilder->weld_combo_box(
"frame"))
112 , mxLbForm(xBuilder->weld_combo_box(
"form"))
113 , mxEdIndication(xBuilder->weld_entry(
"indication"))
114 , mxEdText(xBuilder->weld_entry(
"name"))
115 , mxBtScript(xBuilder->weld_button(
"script"))
116 , mxFormLabel(xBuilder->weld_label(
"form_label"))
117 , mxFrameLabel(xBuilder->weld_label(
"frame_label"))
118 , mbIsCloseDisabled( false )
120 , mbStdControlsInit( false )
121 , maTimer(
"cui SvxHyperlinkTabPageBase maTimer")
151 size_t nCount = aList.size();
160 mxBtScript->set_from_icon_name(RID_SVXBMP_SCRIPT);
185 mxMarkWnd = std::make_shared<SvxHlinkDlgMarkWnd>(pDialog,
this);
195 Size aExtraWndSize(
mxMarkWnd->getDialog()->get_preferred_size());
198 if( aDlgPos.
X()+(1.05*aDlgSize.
Width())+aExtraWndSize.
Width() > aScreen.
Right() )
200 if( aDlgPos.
X() - ( 0.05*aDlgSize.
Width() ) - aExtraWndSize.
Width() < 0 )
243 OUString aStrFormText =
CuiResId( RID_CUISTR_HYPERDLG_FROM_TEXT );
245 OUString aStrFormButton =
CuiResId( RID_CUISTR_HYPERDLG_FORM_BUTTON );
250 mxLbForm->append_text( aStrFormText );
256 mxLbForm->append_text( aStrFormText );
257 mxLbForm->append_text( aStrFormButton );
328 if (!pHyperlinkItem || pHyperlinkItem->
GetMacroEvents() == HyperDialogEvent::NONE)
339 aItemSet.
Put ( aItem );
341 DisableClose(
true );
348 if ( pHyperlinkItem->
GetMacroEvents() & HyperDialogEvent::MouseOverObject )
350 SvMacroItemId::OnMouseOver );
351 if ( pHyperlinkItem->
GetMacroEvents() & HyperDialogEvent::MouseClickObject )
353 SvMacroItemId::OnClick);
354 if ( pHyperlinkItem->
GetMacroEvents() & HyperDialogEvent::MouseOutObject )
356 SvMacroItemId::OnMouseOut);
358 short nRet = aDlg.run();
359 DisableClose(
false );
364 if( SfxItemState::SET == pOutSet->
GetItemState( SID_ATTR_MACROITEM,
false, &pItem ))
398 if ( aProtocol == INetProtocol::NotValid )
423 OUString& aStrIntName, OUString& aStrFrame,
449 rItemSet.
GetItem (SID_HYPERLINK_GETLINK);
451 if ( pHyperlinkItem )
454 OUString aStrURL(pHyperlinkItem->
GetURL());
457 if (aStrURL.isEmpty())
461 if (
auto xTransferable = xClipboard->getContents())
463 css::datatransfer::DataFlavor aFlavor;
465 if (xTransferable->isDataFlavorSupported(aFlavor))
467 OUString aClipBoardConentent;
468 if (xTransferable->getTransferData(aFlavor) >>= aClipBoardConentent)
471 aURL.SetSmartURL(aClipBoardConentent);
472 if (!
aURL.HasError())
492 OUString aStrURL, aStrName, aStrIntName, aStrFrame;
496 if ( aStrName.isEmpty() )
497 aStrName = CreateUiNameFromURL(aStrURL);
502 SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK, aStrName, aStrURL, aStrFrame,
503 aStrIntName,
eMode, nEvents, pTable );
515 rItemSet.
GetItem (SID_HYPERLINK_GETLINK);
517 if ( pHyperlinkItem )
535 OUString aStrURL, aStrName, aStrIntName, aStrFrame;
545 SvxHyperlinkItem aItem( SID_HYPERLINK_GETLINK, aStrName, aStrURL, aStrFrame,
546 aStrIntName,
eMode, nEvents, pTable );
550 return DeactivateRC::LeavePage;
SfxApplication * SfxGetpApp()
static OUString GetScheme(INetProtocol eTheScheme)
const SfxItemSet & GetItemSet() const
std::unique_ptr< weld::Container > xContainer
constexpr tools::Long X() const
SfxViewFrame * GetFrame() const
static void GetDefaultTargetList(TargetList &)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxMacroTabPage * GetTabPage()
void AddEvent(const OUString &rEventName, SvMacroItemId nEventId)
const SfxItemSet * GetOutputItemSet() const
SfxFrame & GetFrame() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
void set_entry_text(const OUString &rStr)
void SetSmartProtocol(INetProtocol eProt)
SfxDispatcher * GetDispatcher() const
SvxHyperURLBox(std::unique_ptr< weld::ComboBox > xWidget)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
HyperDialogEvent GetMacroEvents() const
SvxLinkInsertMode GetInsertMode() const
void SetMacroTable(const SvxMacroTableDtor &rTbl)
const OUString & GetName() const
const OUString & GetURL() const
const OUString & GetIntName() const
const SvxMacroTableDtor * GetMacroTable() const
const OUString & GetTargetFrame() const
SfxDispatcher * GetDispatcher() const
static OUString GetSchemeFromURL(const OUString &rStrURL)
std::unique_ptr< weld::Button > mxBtScript
std::unique_ptr< weld::Label > mxFormLabel
virtual ~SvxHyperlinkTabPageBase() override
bool IsMarkWndVisible() const
void DisableClose(bool _bDisable)
virtual void Reset(const SfxItemSet &) override
SvxHyperlinkTabPageBase(weld::Container *pParent, SvxHpLinkDlg *pDlg, const OUString &rUIXMLDescription, const OUString &rID, const SfxItemSet *pItemSet)
std::shared_ptr< SvxHlinkDlgMarkWnd > mxMarkWnd
std::unique_ptr< weld::Entry > mxEdText
std::unique_ptr< weld::Entry > mxEdIndication
std::unique_ptr< weld::Label > mxFrameLabel
std::unique_ptr< weld::ComboBox > mxLbForm
void MoveToExtraWnd(Point aNewPos)
void FillStandardDlgFields(const SvxHyperlinkItem *pHyperlinkItem)
virtual bool FillItemSet(SfxItemSet *) override
virtual bool ShouldOpenMarkWnd()
SvxMacroTableDtor * GetMacroTable()
virtual void ActivatePage(const SfxItemSet &rItemSet) override
virtual bool QueryClose() override
std::unique_ptr< weld::ComboBox > mxCbbFrame
virtual void SetMarkWndShouldOpen(bool bOpen)
virtual void FillDlgFields(const OUString &rStrURL)=0
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
TopLevelWindowLocker maBusy
void GetDataFromCommonFields(OUString &aStrName, OUString &aStrIntName, OUString &aStrFrame, SvxLinkInsertMode &eMode)
virtual void GetCurrentItemData(OUString &rStrURL, OUString &aStrName, OUString &aStrIntName, OUString &aStrFrame, SvxLinkInsertMode &eMode)=0
HyperDialogEvent GetMacroEvents() const
virtual void SetMarkStr(const OUString &aStrMark)
virtual void SetInitFocus()
void SetMacroTable(const SvxMacroTableDtor &rTbl)
void incBusy(const weld::Widget *pIgnore)
bool GetString(SotClipboardFormatId nFormat, OUString &rStr) const
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
virtual Point get_position() const=0
virtual tools::Rectangle get_monitor_workarea() const=0
virtual Size get_size() const=0
OUString CuiResId(TranslateId aKey)
IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button &, void)
::std::vector< OUString > TargetList
#define LINK(Instance, Class, Member)
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
css::uno::Reference< css::datatransfer::clipboard::XClipboard > VCL_DLLPUBLIC GetSystemClipboard()
constexpr OUStringLiteral INET_MAILTO_SCHEME
constexpr OUStringLiteral INET_HTTP_SCHEME
constexpr OUStringLiteral INET_HTTPS_SCHEME
constexpr OUStringLiteral INET_FTP_SCHEME