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

weld ScDataFormDlg

Change-Id: I656a11f5f9c55913cede710cf48543384132129d
Reviewed-on: https://gerrit.libreoffice.org/72199
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7cfacfd4
......@@ -110,6 +110,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/datafielddialog \
sc/uiconfig/scalc/ui/datafieldoptionsdialog \
sc/uiconfig/scalc/ui/dataform \
sc/uiconfig/scalc/ui/dataformfragment \
sc/uiconfig/scalc/ui/datastreams \
sc/uiconfig/scalc/ui/dataprovider \
sc/uiconfig/scalc/ui/dataproviderdlg \
......
......@@ -423,8 +423,7 @@ public:
virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove) = 0 ;
//for dataform
virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(vcl::Window* pParent,
ScTabViewShell* pTabViewShell) = 0;
virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(weld::Window* pParent, ScTabViewShell* pTabViewShell) = 0;
virtual VclPtr<AbstractScDeleteContentsDlg> CreateScDeleteContentsDlg(weld::Window* pParent) = 0;
virtual VclPtr<AbstractScFillSeriesDlg> CreateScFillSeriesDlg(weld::Window* pParent,
......
......@@ -217,7 +217,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
{
////FIXME: looks butt-ugly w/ empty file, move it elsewhere, where
////we actually have some data
pReturnDialog = mpFact->CreateScDataFormDlg(mpViewShell->GetDialogParent(), mpViewShell);
pReturnDialog = mpFact->CreateScDataFormDlg(mpViewShell->GetFrameWeld(), mpViewShell);
break;
}
......
......@@ -113,7 +113,10 @@ short AbstractScDeleteCellDlg_Impl::Execute()
}
//for dataform
IMPL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl);
short AbstractScDataFormDlg_Impl::Execute()
{
return m_xDlg->run();
}
short AbstractScDeleteContentsDlg_Impl::Execute()
{
......@@ -797,11 +800,10 @@ VclPtr<AbstractScDeleteCellDlg> ScAbstractDialogFactory_Impl::CreateScDeleteCell
return VclPtr<AbstractScDeleteCellDlg_Impl>::Create(std::make_unique<ScDeleteCellDlg>(pParent, bDisallowCellMove));
}
VclPtr<AbstractScDataFormDlg> ScAbstractDialogFactory_Impl::CreateScDataFormDlg(vcl::Window* pParent,
VclPtr<AbstractScDataFormDlg> ScAbstractDialogFactory_Impl::CreateScDataFormDlg(weld::Window* pParent,
ScTabViewShell* pTabViewShell)
{
VclPtr<ScDataFormDlg> pDlg = VclPtr<ScDataFormDlg>::Create(pParent, pTabViewShell);
return VclPtr<AbstractScDataFormDlg_Impl>::Create(pDlg);
return VclPtr<AbstractScDataFormDlg_Impl>::Create(std::make_unique<ScDataFormDlg>(pParent, pTabViewShell));
}
VclPtr<AbstractScDeleteContentsDlg> ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(weld::Window* pParent)
......
......@@ -204,7 +204,14 @@ public:
//for dataform
class AbstractScDataFormDlg_Impl : public AbstractScDataFormDlg
{
DECL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl,ScDataFormDlg);
std::unique_ptr<ScDataFormDlg> m_xDlg;
public:
explicit AbstractScDataFormDlg_Impl(std::unique_ptr<ScDataFormDlg> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
};
class AbstractScDeleteContentsDlg_Impl : public AbstractScDeleteContentsDlg
......@@ -612,8 +619,7 @@ public:
virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove ) override;
//for dataform
virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(vcl::Window* pParent,
ScTabViewShell* pTabViewShell) override;
virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(weld::Window* pParent, ScTabViewShell* pTabViewShell) override;
virtual VclPtr<AbstractScDeleteContentsDlg> CreateScDeleteContentsDlg(weld::Window* pParent) override;
......
......@@ -10,11 +10,9 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_DATAFDLG_HXX
#define INCLUDED_SC_SOURCE_UI_INC_DATAFDLG_HXX
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include <vcl/weld.hxx>
#include <types.hxx>
#include "viewfunc.hxx"
class ScTabViewShell;
class ScDocument;
......@@ -22,19 +20,9 @@ class ScDocument;
#define MAX_DATAFORM_COLS 256
#define MAX_DATAFORM_ROWS 32000
class ScDataFormDlg : public ModalDialog
class ScDataFormDlg : public weld::GenericDialogController
{
private:
VclPtr<PushButton> m_pBtnNew;
VclPtr<PushButton> m_pBtnDelete;
VclPtr<PushButton> m_pBtnRestore;
VclPtr<PushButton> m_pBtnPrev;
VclPtr<PushButton> m_pBtnNext;
VclPtr<PushButton> m_pBtnClose;
VclPtr<ScrollBar> m_pSlider;
VclPtr<VclGrid> m_pGrid;
VclPtr<FixedText> m_pFixedText;
OUString sNewRecord;
ScTabViewShell* pTabViewShell;
......@@ -47,13 +35,20 @@ private:
SCROW nEndRow;
SCTAB nTab;
std::vector<VclPtr<FixedText> > maFixedTexts;
std::vector<VclPtr<Edit> > maEdits;
std::unique_ptr<weld::Button> m_xBtnNew;
std::unique_ptr<weld::Button> m_xBtnDelete;
std::unique_ptr<weld::Button> m_xBtnRestore;
std::unique_ptr<weld::Button> m_xBtnPrev;
std::unique_ptr<weld::Button> m_xBtnNext;
std::unique_ptr<weld::Button> m_xBtnClose;
std::unique_ptr<weld::ScrolledWindow> m_xSlider;
std::unique_ptr<weld::Container> m_xGrid;
std::unique_ptr<weld::Label> m_xFixedText;
std::vector<std::unique_ptr<ScDataFormFragment>> m_aEntries;
public:
ScDataFormDlg( vcl::Window* pParent, ScTabViewShell* pTabViewShell);
ScDataFormDlg(weld::Window* pParent, ScTabViewShell* pTabViewShell);
virtual ~ScDataFormDlg() override;
virtual void dispose() override;
void FillCtrls();
private:
......@@ -61,16 +56,16 @@ private:
void SetButtonState();
// Handler:
DECL_LINK(Impl_NewHdl, Button*, void);
DECL_LINK(Impl_PrevHdl, Button*, void);
DECL_LINK(Impl_NextHdl, Button*, void);
DECL_LINK(Impl_NewHdl, weld::Button&, void);
DECL_LINK(Impl_PrevHdl, weld::Button&, void);
DECL_LINK(Impl_NextHdl, weld::Button&, void);
DECL_LINK(Impl_RestoreHdl, Button*, void);
DECL_LINK(Impl_DeleteHdl, Button*, void);
DECL_LINK(Impl_CloseHdl, Button*, void);
DECL_LINK(Impl_RestoreHdl, weld::Button&, void);
DECL_LINK(Impl_DeleteHdl, weld::Button&, void);
DECL_LINK(Impl_CloseHdl, weld::Button&, void);
DECL_LINK(Impl_ScrollHdl, ScrollBar*, void);
DECL_LINK(Impl_DataModifyHdl, Edit&, void);
DECL_LINK(Impl_ScrollHdl, weld::ScrolledWindow&, void);
DECL_LINK(Impl_DataModifyHdl, weld::Entry&, void);
};
#endif // INCLUDED_SC_SOURCE_UI_INC_DATAFDLG_HXX
......
......@@ -59,6 +59,15 @@ struct ColRowSpan;
namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
struct ScDataFormFragment
{
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Label> m_xLabel;
std::unique_ptr<weld::Entry> m_xEdit;
ScDataFormFragment(weld::Container* pGrid, int nLine);
};
class ScViewFunc : public ScTabView
{
private:
......@@ -320,11 +329,11 @@ public:
bool SelectionEditable( bool* pOnlyNotBecauseOfMatrix = nullptr );
SC_DLLPUBLIC void
DataFormPutData( SCROW nCurrentRow ,
SCROW nStartRow , SCCOL nStartCol ,
SCROW nEndRow , SCCOL nEndCol ,
std::vector<VclPtr<Edit> >& aEdits,
sal_uInt16 aColLength );
DataFormPutData(SCROW nCurrentRow ,
SCROW nStartRow , SCCOL nStartCol ,
SCROW nEndRow , SCCOL nEndCol ,
std::vector<std::unique_ptr<ScDataFormFragment>>& rEdits,
sal_uInt16 aColLength);
void UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAttr = nullptr );
void OnLOKInsertDeleteColumn(SCCOL nStartCol, long nOffset);
......
......@@ -887,7 +887,7 @@ ScVbaWorksheet::ShowDataForm( )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScDataFormDlg> pDlg(pFact->CreateScDataFormDlg(pTabViewShell->GetDialogParent(),
ScopedVclPtr<AbstractScDataFormDlg> pDlg(pFact->CreateScDataFormDlg(pTabViewShell->GetFrameWeld(),
pTabViewShell));
pDlg->Execute();
......
......@@ -362,7 +362,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScDataFormDlg> pDlg(pFact->CreateScDataFormDlg(
pTabViewShell->GetDialogParent(), pTabViewShell));
pTabViewShell->GetFrameWeld(), pTabViewShell));
pDlg->Execute();
......
......@@ -1934,7 +1934,7 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos )
void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
SCROW nStartRow , SCCOL nStartCol ,
SCROW nEndRow , SCCOL nEndCol ,
std::vector<VclPtr<Edit> >& aEdits,
std::vector<std::unique_ptr<ScDataFormFragment>>& rEdits,
sal_uInt16 aColLength )
{
ScDocument* pDoc = GetViewData().GetDocument();
......@@ -1975,9 +1975,9 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
for(sal_uInt16 i = 0; i < aColLength; i++)
{
if (aEdits[i] != nullptr)
if (rEdits[i] != nullptr)
{
OUString aFieldName=aEdits[i]->GetText();
OUString aFieldName = rEdits[i]->m_xEdit->get_text();
pDoc->SetString( nStartCol + i, nCurrentRow, nTab, aFieldName );
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
<property name="activates_default">True</property>
<property name="width_chars">32</property>
</object>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry</property>
<property name="xalign">0</property>
</object>
</interface>
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