Kaydet (Commit) a0c15b39 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld ScInsertTableDlg

Change-Id: Ia3e00ccdc89aaf7b5546a0b346d174814fcea97d
Reviewed-on: https://gerrit.libreoffice.org/54518Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 767188fd
...@@ -447,7 +447,7 @@ public: ...@@ -447,7 +447,7 @@ public:
virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent, virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent,
const OUString* pStrTitle = nullptr) = 0; const OUString* pStrTitle = nullptr) = 0;
virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData, virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
SCTAB nTabCount, bool bFromFile) = 0; SCTAB nTabCount, bool bFromFile) = 0;
virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg ( vcl::Window* pParent, virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg ( vcl::Window* pParent,
......
...@@ -153,7 +153,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) ...@@ -153,7 +153,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
SCTAB nTabSelCount = rViewData.GetMarkData().GetSelectCount(); SCTAB nTabSelCount = rViewData.GetMarkData().GetSelectCount();
pReturnDialog = mpFact->CreateScInsertTableDlg( pReturnDialog = mpFact->CreateScInsertTableDlg(
mpViewShell->GetDialogParent(), rViewData, nTabSelCount, false); mpViewShell->GetFrameWeld(), rViewData, nTabSelCount, false);
break; break;
} }
......
...@@ -116,7 +116,11 @@ short AbstractScInsertContentsDlg_Impl::Execute() ...@@ -116,7 +116,11 @@ short AbstractScInsertContentsDlg_Impl::Execute()
return m_xDlg->run(); return m_xDlg->run();
} }
IMPL_ABSTDLG_BASE(AbstractScInsertTableDlg_Impl); short AbstractScInsertTableDlg_Impl::Execute()
{
return m_xDlg->execute();
}
IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl);
short AbstractScMetricInputDlg_Impl::Execute() short AbstractScMetricInputDlg_Impl::Execute()
...@@ -396,37 +400,37 @@ InsCellCmd AbstractScInsertContentsDlg_Impl::GetMoveMode() ...@@ -396,37 +400,37 @@ InsCellCmd AbstractScInsertContentsDlg_Impl::GetMoveMode()
bool AbstractScInsertTableDlg_Impl::GetTablesFromFile() bool AbstractScInsertTableDlg_Impl::GetTablesFromFile()
{ {
return pDlg->GetTablesFromFile(); return m_xDlg->GetTablesFromFile();
} }
bool AbstractScInsertTableDlg_Impl::GetTablesAsLink() bool AbstractScInsertTableDlg_Impl::GetTablesAsLink()
{ {
return pDlg->GetTablesAsLink(); return m_xDlg->GetTablesAsLink();
} }
const OUString* AbstractScInsertTableDlg_Impl::GetFirstTable( sal_uInt16* pN ) const OUString* AbstractScInsertTableDlg_Impl::GetFirstTable( sal_uInt16* pN )
{ {
return pDlg->GetFirstTable( pN ); return m_xDlg->GetFirstTable( pN );
} }
ScDocShell* AbstractScInsertTableDlg_Impl::GetDocShellTables() ScDocShell* AbstractScInsertTableDlg_Impl::GetDocShellTables()
{ {
return pDlg->GetDocShellTables(); return m_xDlg->GetDocShellTables();
} }
bool AbstractScInsertTableDlg_Impl::IsTableBefore() bool AbstractScInsertTableDlg_Impl::IsTableBefore()
{ {
return pDlg->IsTableBefore(); return m_xDlg->IsTableBefore();
} }
sal_uInt16 AbstractScInsertTableDlg_Impl::GetTableCount() sal_uInt16 AbstractScInsertTableDlg_Impl::GetTableCount()
{ {
return pDlg->GetTableCount(); return m_xDlg->GetTableCount();
} }
const OUString* AbstractScInsertTableDlg_Impl::GetNextTable( sal_uInt16* pN ) const OUString* AbstractScInsertTableDlg_Impl::GetNextTable( sal_uInt16* pN )
{ {
return pDlg->GetNextTable( pN ); return m_xDlg->GetNextTable( pN );
} }
OUString AbstractScSelEntryDlg_Impl::GetSelectedEntry() const OUString AbstractScSelEntryDlg_Impl::GetSelectedEntry() const
...@@ -761,11 +765,10 @@ VclPtr<AbstractScInsertContentsDlg> ScAbstractDialogFactory_Impl::CreateScInsert ...@@ -761,11 +765,10 @@ VclPtr<AbstractScInsertContentsDlg> ScAbstractDialogFactory_Impl::CreateScInsert
return VclPtr<AbstractScInsertContentsDlg_Impl>::Create(new ScInsertContentsDlg(pParent, InsertDeleteFlags::NONE, pStrTitle)); return VclPtr<AbstractScInsertContentsDlg_Impl>::Create(new ScInsertContentsDlg(pParent, InsertDeleteFlags::NONE, pStrTitle));
} }
VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData, VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
SCTAB nTabCount, bool bFromFile) SCTAB nTabCount, bool bFromFile)
{ {
VclPtr<ScInsertTableDlg> pDlg = VclPtr<ScInsertTableDlg>::Create( pParent, rViewData,nTabCount, bFromFile ); return VclPtr<AbstractScInsertTableDlg_Impl>::Create(new ScInsertTableDlg(pParent, rViewData,nTabCount, bFromFile));
return VclPtr<AbstractScInsertTableDlg_Impl>::Create( pDlg );
} }
VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg ( vcl::Window* pParent, VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg ( vcl::Window* pParent,
......
...@@ -257,7 +257,13 @@ public: ...@@ -257,7 +257,13 @@ public:
class AbstractScInsertTableDlg_Impl : public AbstractScInsertTableDlg class AbstractScInsertTableDlg_Impl : public AbstractScInsertTableDlg
{ {
DECL_ABSTDLG_BASE( AbstractScInsertTableDlg_Impl, ScInsertTableDlg) std::unique_ptr<ScInsertTableDlg> m_xDlg;
public:
explicit AbstractScInsertTableDlg_Impl(ScInsertTableDlg* p)
: m_xDlg(p)
{
}
virtual short Execute() override;
virtual bool GetTablesFromFile() override; virtual bool GetTablesFromFile() override;
virtual bool GetTablesAsLink() override; virtual bool GetTablesAsLink() override;
virtual const OUString* GetFirstTable( sal_uInt16* pN = nullptr ) override; virtual const OUString* GetFirstTable( sal_uInt16* pN = nullptr ) override;
...@@ -514,7 +520,7 @@ public: ...@@ -514,7 +520,7 @@ public:
virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent, virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent,
const OUString* pStrTitle = nullptr) override; const OUString* pStrTitle = nullptr) override;
virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData, virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
SCTAB nTabCount, bool bFromFile) override; SCTAB nTabCount, bool bFromFile) override;
virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg ( vcl::Window* pParent, virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg ( vcl::Window* pParent,
......
...@@ -20,17 +20,9 @@ ...@@ -20,17 +20,9 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_INSTBDLG_HXX #ifndef INCLUDED_SC_SOURCE_UI_INC_INSTBDLG_HXX
#define INCLUDED_SC_SOURCE_UI_INC_INSTBDLG_HXX #define INCLUDED_SC_SOURCE_UI_INC_INSTBDLG_HXX
#include <address.hxx>
#include <vcl/button.hxx>
#include <vcl/group.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/edit.hxx>
#include <vcl/fixed.hxx>
#include <vcl/dialog.hxx>
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <vcl/field.hxx> #include <vcl/weld.hxx>
#include <address.hxx>
class ScViewData; class ScViewData;
class ScDocument; class ScDocument;
...@@ -39,39 +31,24 @@ class ScDocShell; ...@@ -39,39 +31,24 @@ class ScDocShell;
namespace sfx2 { class DocumentInserter; } namespace sfx2 { class DocumentInserter; }
namespace sfx2 { class FileDialogHelper; } namespace sfx2 { class FileDialogHelper; }
class ScInsertTableDlg : public ModalDialog class ScInsertTableDlg : public weld::GenericDialogController
{ {
public: public:
ScInsertTableDlg( vcl::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile ); ScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile);
virtual ~ScInsertTableDlg() override; virtual ~ScInsertTableDlg() override;
virtual void dispose() override;
virtual short Execute() override; // override to set parent dialog short execute(); // override to set parent dialog
bool GetTablesFromFile() const { return m_pBtnFromFile->IsChecked(); } bool GetTablesFromFile() const { return m_xBtnFromFile->get_active(); }
bool GetTablesAsLink() const { return m_pBtnLink->IsChecked(); } bool GetTablesAsLink() const { return m_xBtnLink->get_active(); }
const OUString* GetFirstTable( sal_uInt16* pN ); const OUString* GetFirstTable( sal_uInt16* pN );
const OUString* GetNextTable( sal_uInt16* pN ); const OUString* GetNextTable( sal_uInt16* pN );
ScDocShell* GetDocShellTables() { return pDocShTables; } ScDocShell* GetDocShellTables() { return pDocShTables; }
bool IsTableBefore() const { return m_pBtnBefore->IsChecked(); } bool IsTableBefore() const { return m_xBtnBefore->get_active(); }
SCTAB GetTableCount() const { return nTableCount;} SCTAB GetTableCount() const { return nTableCount;}
private: private:
VclPtr<RadioButton> m_pBtnBefore;
VclPtr<RadioButton> m_pBtnBehind;
VclPtr<RadioButton> m_pBtnNew;
VclPtr<RadioButton> m_pBtnFromFile;
VclPtr<FixedText> m_pFtCount;
VclPtr<NumericField> m_pNfCount;
VclPtr<FixedText> m_pFtName;
VclPtr<Edit> m_pEdName;
VclPtr<ListBox> m_pLbTables;
VclPtr<FixedText> m_pFtPath;
VclPtr<PushButton> m_pBtnBrowse;
VclPtr<CheckBox> m_pBtnLink;
VclPtr<OKButton> m_pBtnOk;
Timer aBrowseTimer; Timer aBrowseTimer;
ScViewData& rViewData; ScViewData& rViewData;
ScDocument& rDoc; ScDocument& rDoc;
...@@ -85,17 +62,31 @@ private: ...@@ -85,17 +62,31 @@ private:
SCTAB nTableCount; SCTAB nTableCount;
OUString m_sSheetDotDotDot; OUString m_sSheetDotDotDot;
std::unique_ptr<weld::RadioButton> m_xBtnBefore;
std::unique_ptr<weld::RadioButton> m_xBtnBehind;
std::unique_ptr<weld::RadioButton> m_xBtnNew;
std::unique_ptr<weld::RadioButton> m_xBtnFromFile;
std::unique_ptr<weld::Label> m_xFtCount;
std::unique_ptr<weld::SpinButton> m_xNfCount;
std::unique_ptr<weld::Label> m_xFtName;
std::unique_ptr<weld::Entry> m_xEdName;
std::unique_ptr<weld::TreeView> m_xLbTables;
std::unique_ptr<weld::Label> m_xFtPath;
std::unique_ptr<weld::Button> m_xBtnBrowse;
std::unique_ptr<weld::CheckButton> m_xBtnLink;
std::unique_ptr<weld::Button> m_xBtnOk;
void Init_Impl( bool bFromFile ); void Init_Impl( bool bFromFile );
void SetNewTable_Impl(); void SetNewTable_Impl();
void SetFromTo_Impl(); void SetFromTo_Impl();
void FillTables_Impl( const ScDocument* pSrcDoc ); void FillTables_Impl( const ScDocument* pSrcDoc );
void DoEnable_Impl(); void DoEnable_Impl();
DECL_LINK( BrowseHdl_Impl, Button*, void ); DECL_LINK( BrowseHdl_Impl, weld::Button&, void );
DECL_LINK( ChoiceHdl_Impl, Button*, void ); DECL_LINK( ChoiceHdl_Impl, weld::Button&, void );
DECL_LINK( SelectHdl_Impl, ListBox&, void ); DECL_LINK( SelectHdl_Impl, weld::TreeView&, void );
DECL_LINK( CountHdl_Impl, Edit&, void ); DECL_LINK( CountHdl_Impl, weld::SpinButton&, void );
DECL_LINK( DoEnterHdl, Button*, void ); DECL_LINK( DoEnterHdl, weld::Button&, void );
DECL_LINK( BrowseTimeoutHdl, Timer *, void ); DECL_LINK( BrowseTimeoutHdl, Timer *, void );
DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void );
}; };
......
...@@ -218,7 +218,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ...@@ -218,7 +218,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
ScopedVclPtr<AbstractScInsertTableDlg> pDlg(pFact->CreateScInsertTableDlg(GetDialogParent(), rViewData, ScopedVclPtr<AbstractScInsertTableDlg> pDlg(pFact->CreateScInsertTableDlg(GetFrameWeld(), rViewData,
nTabSelCount, nSlot == FID_INS_TABLE_EXT)); nTabSelCount, nSlot == FID_INS_TABLE_EXT));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
if ( RET_OK == pDlg->Execute() ) if ( RET_OK == pDlg->Execute() )
......
...@@ -135,6 +135,7 @@ ...@@ -135,6 +135,7 @@
<object class="GtkTreeView" id="formatlb"> <object class="GtkTreeView" id="formatlb">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="model">liststore1</property> <property name="model">liststore1</property>
<property name="headers_visible">False</property> <property name="headers_visible">False</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment