20 #undef SC_DLLIMPLEMENTATION
32 #include <globstr.hrc>
37 : GenericDialogController(pParent,
"modules/scalc/ui/insertsheet.ui",
"InsertSheetDialog")
38 , aBrowseTimer(
"ScInsertTableDlg aBrowseTimer")
40 , rDoc(rData.GetDocument())
41 , pDocShTables(nullptr)
44 , nTableCount(nTabCount)
45 , m_xBtnBefore(m_xBuilder->weld_radio_button(
"before"))
46 , m_xBtnBehind(m_xBuilder->weld_radio_button(
"after"))
47 , m_xBtnNew(m_xBuilder->weld_radio_button(
"new"))
48 , m_xBtnFromFile(m_xBuilder->weld_radio_button(
"fromfile"))
49 , m_xFtCount(m_xBuilder->weld_label(
"countft"))
50 , m_xNfCount(m_xBuilder->weld_spin_button(
"countnf"))
51 , m_xFtName(m_xBuilder->weld_label(
"nameft"))
52 , m_xEdName(m_xBuilder->weld_entry(
"nameed"))
53 , m_xLbTables(m_xBuilder->weld_tree_view(
"tables"))
54 , m_xFtPath(m_xBuilder->weld_label(
"path"))
55 , m_xBtnBrowse(m_xBuilder->weld_button(
"browse"))
56 , m_xBtnLink(m_xBuilder->weld_check_button(
"link"))
57 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
73 m_xLbTables->set_selection_mode(SelectionMode::Multiple);
100 if ( !bFromFile || bShared )
124 return GenericDialogController::run();
186 const OUString* pStr =
nullptr;
195 std::vector<int> aRows(
m_xLbTables->get_selected_rows());
214 std::vector<int> aRows(
m_xLbTables->get_selected_rows());
216 const OUString* pStr =
nullptr;
233 nTableCount =
static_cast<SCTAB>(m_xNfCount->get_value());
237 rDoc.CreateValidTabName( aName );
238 m_xEdName->set_text( aName );
239 m_xFtName->set_sensitive(
true);
240 m_xEdName->set_sensitive(
true);
244 m_xEdName->set_text(m_sSheetDotDotDot);
245 m_xFtName->set_sensitive(
false);
246 m_xEdName->set_sensitive(
false);
254 if (!rButton.get_active())
257 if ( m_xBtnNew->get_active() )
267 pDocInserter.reset();
268 pDocInserter.reset( new ::sfx2::DocumentInserter(
m_xDialog.get(), ScDocShell::Factory().GetFactoryName()) );
293 OUString aErrMsg (
ScResId( STR_INVALIDTABNAME ) );
295 VclButtonsType::Ok, aErrMsg));
303 BrowseHdl_Impl(*m_xBtnBrowse);
310 std::unique_ptr<SfxMedium> pMed = pDocInserter->CreateMedium();
317 pDocShTables->DoClose();
319 pMed->UseInteractionHandler(
true );
322 aDocShTablesRef = pDocShTables;
326 pDocShTables->DoLoad(pMed.release());
329 ErrCode nErr = pDocShTables->GetErrorCode();
333 if ( !pDocShTables->GetError() )
335 FillTables_Impl( &pDocShTables->GetDocument() );
340 pDocShTables->DoClose();
341 aDocShTablesRef.clear();
342 pDocShTables =
nullptr;
344 FillTables_Impl(
nullptr );
345 m_xFtPath->set_label(OUString());
351 else if ( bMustClose )
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(ScInsertTableDlg, CountHdl_Impl, weld::SpinButton &, void)
ScDocShell * GetDocShell() const
std::unique_ptr< weld::Button > m_xBtnBrowse
OUString ScResId(TranslateId aId)
std::unique_ptr< weld::Label > m_xFtPath
OUString m_sSheetDotDotDot
std::unique_ptr< weld::RadioButton > m_xBtnFromFile
ScInsertTableDlg(weld::Window *pParent, ScViewData &rViewData, SCTAB nTabCount, bool bFromFile)
std::unique_ptr< weld::RadioButton > m_xBtnBefore
const OUString * GetNextTable(sal_uInt16 *pN)
SC_DLLPUBLIC SCTAB GetTableCount() const
std::unique_ptr< weld::Label > m_xFtCount
std::unique_ptr< weld::RadioButton > m_xBtnNew
void Init_Impl(bool bFromFile)
virtual short run() override
#define SFX_TITLE_FULLNAME
#define ERRCTX_SFX_OPENDOC
void FillTables_Impl(const ScDocument *pSrcDoc)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
std::unique_ptr< weld::TreeView > m_xLbTables
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
virtual void Start(bool bStartTimer=true) override
std::unique_ptr< weld::Button > m_xBtnOk
ScDocShell * pDocShTables
std::unique_ptr< sfx2::DocumentInserter > pDocInserter
void SetTimeout(sal_uInt64 nTimeoutMs)
const OUString * GetFirstTable(sal_uInt16 *pN)
std::unique_ptr< weld::SpinButton > m_xNfCount
static SC_DLLPUBLIC bool ValidTabName(const OUString &rName)
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Entry > m_xEdName
virtual ~ScInsertTableDlg() override
void SetInvokeHandler(const Link< Timer *, void > &rLink)
std::unique_ptr< weld::CheckButton > m_xBtnLink
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
std::unique_ptr< weld::Label > m_xFtName
bool m_bDetectedRangeSegmentation false
IMPL_LINK(ScInsertTableDlg, ChoiceHdl_Impl, weld::Toggleable &, rButton, void)