20#undef SC_DLLIMPLEMENTATION
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_xBtnNew(m_xBuilder->weld_radio_button(
"new"))
47 , m_xBtnFromFile(m_xBuilder->weld_radio_button(
"fromfile"))
48 , m_xFtCount(m_xBuilder->weld_label(
"countft"))
49 , m_xNfCount(m_xBuilder->weld_spin_button(
"countnf"))
50 , m_xFtName(m_xBuilder->weld_label(
"nameft"))
51 , m_xEdName(m_xBuilder->weld_entry(
"nameed"))
52 , m_xLbTables(m_xBuilder->weld_tree_view(
"tables"))
53 , m_xFtPath(m_xBuilder->weld_label(
"path"))
54 , m_xBtnBrowse(m_xBuilder->weld_button(
"browse"))
55 , m_xBtnLink(m_xBuilder->weld_check_button(
"link"))
56 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
72 m_xLbTables->set_selection_mode(SelectionMode::Multiple);
99 if ( !bFromFile || bShared )
123 return GenericDialogController::run();
185 const OUString* pStr =
nullptr;
194 std::vector<int> aRows(
m_xLbTables->get_selected_rows());
213 std::vector<int> aRows(
m_xLbTables->get_selected_rows());
215 const OUString* pStr =
nullptr;
232 nTableCount =
static_cast<SCTAB>(m_xNfCount->get_value());
236 rDoc.CreateValidTabName(
aName );
237 m_xEdName->set_text(
aName );
238 m_xFtName->set_sensitive(
true);
239 m_xEdName->set_sensitive(
true);
243 m_xEdName->set_text(m_sSheetDotDotDot);
244 m_xFtName->set_sensitive(
false);
245 m_xEdName->set_sensitive(
false);
253 if (!rButton.get_active())
256 if ( m_xBtnNew->get_active() )
266 pDocInserter.reset();
267 pDocInserter.reset( new ::sfx2::DocumentInserter(
m_xDialog.get(), ScDocShell::Factory().GetFactoryName()) );
292 OUString aErrMsg (
ScResId( STR_INVALIDTABNAME ) );
294 VclButtonsType::Ok, aErrMsg));
302 BrowseHdl_Impl(*m_xBtnBrowse);
309 std::unique_ptr<SfxMedium> pMed = pDocInserter->CreateMedium();
316 pDocShTables->DoClose();
318 pMed->UseInteractionHandler(
true );
321 aDocShTablesRef = pDocShTables;
325 pDocShTables->DoLoad(pMed.release());
328 ErrCode nErr = pDocShTables->GetErrorCode();
332 if ( !pDocShTables->GetError() )
334 FillTables_Impl( &pDocShTables->GetDocument() );
339 pDocShTables->DoClose();
340 aDocShTablesRef.clear();
341 pDocShTables =
nullptr;
343 FillTables_Impl(
nullptr );
344 m_xFtPath->set_label(OUString());
350 else if ( bMustClose )
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
static SC_DLLPUBLIC bool ValidTabName(const OUString &rName)
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC SCTAB GetTableCount() const
std::unique_ptr< weld::Label > m_xFtPath
OUString m_sSheetDotDotDot
std::unique_ptr< weld::Entry > m_xEdName
std::unique_ptr< weld::Label > m_xFtCount
std::unique_ptr< weld::CheckButton > m_xBtnLink
std::unique_ptr< weld::RadioButton > m_xBtnNew
void Init_Impl(bool bFromFile)
std::unique_ptr< weld::TreeView > m_xLbTables
virtual ~ScInsertTableDlg() override
ScDocShell * pDocShTables
std::unique_ptr< sfx2::DocumentInserter > pDocInserter
std::unique_ptr< weld::Label > m_xFtName
std::unique_ptr< weld::Button > m_xBtnBrowse
virtual short run() override
std::unique_ptr< weld::Button > m_xBtnOk
std::unique_ptr< weld::RadioButton > m_xBtnBefore
const OUString * GetNextTable(sal_uInt16 *pN)
void FillTables_Impl(const ScDocument *pSrcDoc)
ScInsertTableDlg(weld::Window *pParent, ScViewData &rViewData, SCTAB nTabCount, bool bFromFile)
std::unique_ptr< weld::RadioButton > m_xBtnFromFile
const OUString * GetFirstTable(sal_uInt16 *pN)
std::unique_ptr< weld::SpinButton > m_xNfCount
ScDocShell * GetDocShell() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
IMPL_LINK(ScInsertTableDlg, ChoiceHdl_Impl, weld::Toggleable &, rButton, void)
IMPL_LINK_NOARG(ScInsertTableDlg, CountHdl_Impl, weld::SpinButton &, void)
#define LINK(Instance, Class, Member)
#define SFX_TITLE_FULLNAME
OUString ScResId(TranslateId aId)
#define ERRCTX_SFX_OPENDOC