20#undef SC_DLLIMPLEMENTATION
39 : GenericDialogController(pParent,
"modules/scalc/ui/externaldata.ui",
"ExternalDataDialog")
40 , m_pSourceShell(nullptr)
41 , m_xCbUrl(new
SvtURLBox(m_xBuilder->weld_combo_box(
"url")))
42 , m_xBtnBrowse(m_xBuilder->weld_button(
"browse"))
43 , m_xLbRanges(m_xBuilder->weld_tree_view(
"ranges"))
44 , m_xBtnReload(m_xBuilder->weld_check_button(
"reload"))
45 , m_xNfDelay(m_xBuilder->weld_spin_button(
"delay"))
46 , m_xFtSeconds(m_xBuilder->weld_label(
"secondsft"))
47 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
49 m_xLbRanges->set_selection_mode(SelectionMode::Multiple);
75 OUString aEntered = m_xCbUrl->GetURL();
78 SfxMedium* pMed = m_pSourceShell->GetMedium();
79 if ( aEntered == pMed->
GetName() )
97 LoadDocument( aEntered, aFilter, aOptions );
115 if ( rFile.isEmpty() )
120 OUString aNewFilter = rFilter;
121 OUString aNewOptions = rOptions;
139 const OUString& rOptions, std::u16string_view rSource,
140 sal_Int32 nRefreshDelaySeconds )
149 m_xCbUrl->set_entry_text(OUString());
153 if (!rSource.empty())
163 bool bDoRefresh = (nRefreshDelaySeconds != 0);
186 std::unique_ptr<SfxMedium> pMed = m_xDocInserter->CreateMedium();
192 std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
195 std::shared_ptr<const SfxFilter> pNewFilter =
196 ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(
FILTERNAME_QUERY );
198 pMed->SetFilter( pNewFilter );
205 m_pSourceShell->DoClose();
207 pMed->UseInteractionHandler(
true );
210 aSourceRef = m_pSourceShell;
211 m_pSourceShell->
DoLoad( pMed.get() );
213 ErrCode nErr = m_pSourceShell->GetErrorCode();
217 if (!m_pSourceShell->GetError())
219 m_xCbUrl->set_entry_text(pMed->GetName());
223 m_pSourceShell->DoClose();
224 m_pSourceShell =
nullptr;
227 m_xCbUrl->set_entry_text(OUString());
232 UpdateSourceRanges();
236#undef FILTERNAME_HTML
237#undef FILTERNAME_QUERY
300 return pMed->
GetFilter()->GetFilterName();
318 std::vector<OUString> aSelection =
m_xLbRanges->get_selected_rows_text();
319 for (
size_t i = 0;
i < aSelection.size(); ++
i)
323 aBuf.append(aSelection[
i]);
325 return aBuf.makeStringAndClear();
Reference< XExecutableDialog > m_xDialog
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
const ScDocument & GetDocument() const
static OUString GetOptions(const SfxMedium &rMedium)
static bool GetFilterName(const OUString &rFileName, OUString &rFilter, OUString &rOptions, bool bWithContent, bool bWithInteraction)
Returns the filter name and options from a file name.
ScDocShell * GetDocShell()
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
sal_Int32 GetRefreshDelaySeconds() const
ScLinkedAreaDlg(weld::Widget *pParent)
std::unique_ptr< weld::TreeView > m_xLbRanges
std::unique_ptr< weld::Label > m_xFtSeconds
void LoadDocument(const OUString &rFile, const OUString &rFilter, const OUString &rOptions)
std::unique_ptr< SvtURLBox > m_xCbUrl
std::unique_ptr< weld::CheckButton > m_xBtnReload
OUString GetSource() const
SfxObjectShellRef aSourceRef
ScDocShell * m_pSourceShell
std::unique_ptr< weld::Button > m_xBtnOk
void UpdateSourceRanges()
void InitFromOldLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, std::u16string_view rSource, sal_Int32 nRefreshDelaySeconds)
virtual ~ScLinkedAreaDlg() override
OUString GetFilter() const
std::unique_ptr< weld::SpinButton > m_xNfDelay
std::unique_ptr< weld::Button > m_xBtnBrowse
OUString GetOptions() const
SC_DLLPUBLIC ScRangeData * findByIndex(sal_uInt16 i) const
SC_DLLPUBLIC size_t index_size() const
const std::shared_ptr< const SfxFilter > & GetFilter() const
const OUString & GetName() const
ErrCode GetErrorCode() const
SfxMedium * GetMedium() const
bool DoLoad(SfxMedium *pMedium)
std::shared_ptr< weld::Dialog > m_xDialog
constexpr OUStringLiteral SC_TEXT_CSV_FILTER_NAME
#define LINK(Instance, Class, Member)
IMPL_LINK(ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void)
constexpr OUStringLiteral FILTERNAME_QUERY
constexpr OUStringLiteral FILTERNAME_HTML
IMPL_LINK_NOARG(ScLinkedAreaDlg, BrowseHdl, weld::Button &, void)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OUString ScResId(TranslateId aId)
#define ERRCTX_SFX_OPENDOC