22#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
39 using namespace ::
svt;
42 : GenericDialogController(pParent,
"cui/ui/databaselinkdialog.ui",
"DatabaseLinkDialog")
43 , m_xBrowseFile(m_xBuilder->weld_button(
"browse"))
44 , m_xName(m_xBuilder->weld_entry(
"name"))
45 , m_xOK(m_xBuilder->weld_button(
"ok"))
46 , m_xAltTitle(m_xBuilder->weld_label(
"alttitle"))
47 , m_xURL(new
SvtURLBox(m_xBuilder->weld_combo_box(
"url")))
52 m_xURL->SetSmartProtocol(INetProtocol::File);
71 m_xURL->set_entry_text(rURL);
78 rURL =
m_xURL->get_active_text();
83 m_xOK->set_sensitive((!
m_xName->get_text().isEmpty()) && (!
m_xURL->get_active_text().isEmpty()));
89 OUString sURL = m_xURL->get_active_text();
90 OFileNotation aTransformer(sURL);
91 sURL = aTransformer.get(OFileNotation::N_URL);
94 bool bFileExists =
false;
107 OUString sMsg =
CuiResId(STR_LINKEDDOC_DOESNOTEXIST);
108 sMsg = sMsg.replaceFirst(
"$file$", m_xURL->get_active_text());
110 VclMessageType::Warning, VclButtonsType::Ok, sMsg));
115 if (
aURL.GetProtocol() != INetProtocol::File )
117 OUString sMsg =
CuiResId(STR_LINKEDDOC_NO_SYSTEM_FILE);
118 sMsg = sMsg.replaceFirst(
"$file$", m_xURL->get_active_text());
120 VclMessageType::Warning, VclButtonsType::Ok, sMsg));
125 OUString sCurrentText = m_xName->get_text();
126 if ( m_aNameValidator.IsSet() )
128 if ( !m_aNameValidator.Call( sCurrentText ) )
130 OUString sMsg =
CuiResId(STR_NAME_CONFLICT);
131 sMsg = sMsg.replaceFirst(
"$file$", sCurrentText);
133 VclMessageType::Info, VclButtonsType::Ok, sMsg));
136 m_xName->select_region(0, -1);
137 m_xName->grab_focus();
148 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE,
m_xDialog.get());
152 aFileDlg.
AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
156 OUString sPath = m_xURL->get_active_text();
157 if (!sPath.isEmpty())
159 OFileNotation aTransformer( sPath, OFileNotation::N_SYSTEM );
166 if (m_xName->get_text().isEmpty())
175 m_xName->select_region(0, -1);
176 m_xName->grab_focus();
179 m_xURL->grab_focus();
182 OFileNotation aTransformer(aFileDlg.
GetPath(), OFileNotation::N_URL);
183 m_xURL->set_entry_text(aTransformer.get(OFileNotation::N_SYSTEM));
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
void SetSmartProtocol(INetProtocol eTheSmartScheme)
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool SetSmartURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
static std::shared_ptr< const SfxFilter > GetFilterByName(const OUString &rName)
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
void SetDisplayDirectory(const OUString &rPath)
void SetCurrentFilter(const OUString &rFilter)
dialog for editing document links associated with data sources
ODocumentLinkDialog(weld::Window *pParent, bool bCreateNew)
void setLink(const OUString &_rName, const OUString &_rURL)
std::unique_ptr< weld::Label > m_xAltTitle
virtual ~ODocumentLinkDialog() override
std::unique_ptr< weld::Button > m_xBrowseFile
std::unique_ptr< SvtURLBox > m_xURL
std::unique_ptr< weld::Button > m_xOK
std::unique_ptr< weld::Entry > m_xName
void getLink(OUString &_rName, OUString &_rURL) const
std::shared_ptr< weld::Dialog > m_xDialog
OUString CuiResId(TranslateId aKey)
#define LINK(Instance, Class, Member)
Reference< XComponentContext > getProcessComponentContext()
IMPL_LINK_NOARG(ClassificationDialog, OnAsyncExpandHdl, void *, void)