20#undef SC_DLLIMPLEMENTATION
40 : GenericDialogController(pParent,
"modules/scalc/ui/externaldata.ui",
"ExternalDataDialog")
41 , m_pSourceShell(nullptr)
42 , m_xCbUrl(new
SvtURLBox(m_xBuilder->weld_combo_box(
"url")))
43 , m_xBtnBrowse(m_xBuilder->weld_button(
"browse"))
44 , m_xLbRanges(m_xBuilder->weld_tree_view(
"ranges"))
45 , m_xBtnReload(m_xBuilder->weld_check_button(
"reload"))
46 , m_xNfDelay(m_xBuilder->weld_spin_button(
"delay"))
47 , m_xFtSeconds(m_xBuilder->weld_label(
"secondsft"))
48 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
50 m_xLbRanges->set_selection_mode(SelectionMode::Multiple);
76 OUString aEntered = m_xCbUrl->GetURL();
79 SfxMedium* pMed = m_pSourceShell->GetMedium();
80 if ( aEntered == pMed->
GetName() )
98 LoadDocument( aEntered, aFilter, aOptions );
100 UpdateSourceRanges();
116 if ( rFile.isEmpty() )
121 OUString aNewFilter = rFilter;
122 OUString aNewOptions = rOptions;
140 const OUString& rOptions, std::u16string_view rSource,
141 sal_Int32 nRefreshDelaySeconds )
150 m_xCbUrl->set_entry_text(OUString());
154 if (!rSource.empty())
164 bool bDoRefresh = (nRefreshDelaySeconds != 0);
187 std::unique_ptr<SfxMedium> pMed = m_xDocInserter->CreateMedium();
193 std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
196 std::shared_ptr<const SfxFilter> pNewFilter =
197 ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(
FILTERNAME_QUERY );
199 pMed->SetFilter( pNewFilter );
206 m_pSourceShell->DoClose();
208 pMed->UseInteractionHandler(
true );
211 aSourceRef = m_pSourceShell;
212 m_pSourceShell->
DoLoad( pMed.get() );
214 ErrCode nErr = m_pSourceShell->GetErrorCode();
218 if (!m_pSourceShell->GetError())
220 m_xCbUrl->set_entry_text(pMed->GetName());
224 m_pSourceShell->DoClose();
225 m_pSourceShell =
nullptr;
228 m_xCbUrl->set_entry_text(OUString());
233 UpdateSourceRanges();
237#undef FILTERNAME_HTML
238#undef FILTERNAME_QUERY
266 const auto& rNamedDBs = pDBs->getNamedDBs();
267 for (
const auto& rNamedDB : rNamedDBs)
308 return pMed->
GetFilter()->GetFilterName();
326 std::vector<OUString> aSelection =
m_xLbRanges->get_selected_rows_text();
327 for (
size_t i = 0;
i < aSelection.size(); ++
i)
331 aBuf.append(aSelection[
i]);
333 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 ScDBCollection * GetDBCollection() const
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