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

weld ScNameDefDlg

Change-Id: Ic5e46a0a9f03733c8e151e6dff55b7b4a3fcda34
Reviewed-on: https://gerrit.libreoffice.org/70588
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst e09bf826
......@@ -22,25 +22,9 @@ class ScDocument;
class ScDocShell;
class ScViewData;
class ScNameDefDlg : public ScAnyRefDlg
class ScNameDefDlg : public ScAnyRefDlgController
{
private:
VclPtr<Edit> m_pEdName;
VclPtr<formula::RefEdit> m_pEdRange;
VclPtr<formula::RefButton> m_pRbRange;
VclPtr<ListBox> m_pLbScope;
VclPtr<CheckBox> m_pBtnRowHeader;
VclPtr<CheckBox> m_pBtnColHeader;
VclPtr<CheckBox> m_pBtnPrintArea;
VclPtr<CheckBox> m_pBtnCriteria;
VclPtr<PushButton> m_pBtnAdd;
VclPtr<PushButton> m_pBtnCancel;
VclPtr<FixedText> m_pFtInfo;
bool const mbUndo; //if true we need to add an undo action after creating a range name
ScDocument* mpDoc;
ScDocShell* mpDocShell;
......@@ -58,33 +42,50 @@ private:
std::map<OUString, ScRangeName*> maRangeMap;
std::unique_ptr<weld::Entry> m_xEdName;
std::unique_ptr<formula::WeldRefEdit> m_xEdRange;
std::unique_ptr<formula::WeldRefButton> m_xRbRange;
std::unique_ptr<weld::ComboBox> m_xLbScope;
std::unique_ptr<weld::CheckButton> m_xBtnRowHeader;
std::unique_ptr<weld::CheckButton> m_xBtnColHeader;
std::unique_ptr<weld::CheckButton> m_xBtnPrintArea;
std::unique_ptr<weld::CheckButton> m_xBtnCriteria;
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnCancel;
std::unique_ptr<weld::Label> m_xFtInfo;
std::unique_ptr<weld::Expander> m_xExpander;
std::unique_ptr<weld::Label> m_xFtRange;
void CancelPushed();
void AddPushed();
bool IsNameValid();
bool IsFormulaValid();
DECL_LINK( CancelBtnHdl, Button*, void );
DECL_LINK( AddBtnHdl, Button*, void );
DECL_LINK( NameModifyHdl, Edit&, void );
DECL_LINK( AssignGetFocusHdl, Control&, void );
DECL_LINK( CancelBtnHdl, weld::Button&, void );
DECL_LINK( AddBtnHdl, weld::Button&, void );
DECL_LINK( NameModifyHdl, weld::Entry&, void );
DECL_LINK( AssignGetFocusHdl, formula::WeldRefEdit&, void );
protected:
virtual void RefInputDone( bool bForced = false ) override;
public:
ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
const ScViewData* pViewData, const std::map<OUString, ScRangeName*>& aRangeMap,
const ScAddress& aCursorPos, const bool bUndo);
virtual ~ScNameDefDlg() override;
virtual void dispose() override;
virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
virtual bool IsRefInputMode() const override;
virtual void SetActive() override;
virtual bool Close() override;
virtual void Close() override;
void GetNewData( OUString& rName, OUString& rScope );
};
......
......@@ -45,7 +45,7 @@
};
DECL_WRAPPER_WITHID_CONTROLLER(ScNameDlgWrapper)
DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
DECL_WRAPPER_WITHID_CONTROLLER(ScNameDefDlgWrapper)
DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScXMLSourceDlgWrapper)
......
......@@ -378,8 +378,7 @@ public:
const OUString DoAutoSum(bool& rRangeFinder, bool& rSubTotal);
// ugly hack to call Define Names from Manage Names
void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
void SwitchBetweenRefDialogControllers(SfxModelessDialogController* pDialog);
void SwitchBetweenRefDialogs(SfxModelessDialogController* pDialog);
// #i123629#
bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; }
void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; }
......
......@@ -303,7 +303,7 @@ void ScNameDlg::AddPushed()
{
mbCloseWithoutUndo = true;
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
pViewSh->SwitchBetweenRefDialogControllers(this);
pViewSh->SwitchBetweenRefDialogs(this);
}
void ScNameDlg::SetEntry(const OUString& rName, const OUString& rScope)
......
......@@ -33,7 +33,7 @@
#include <validate.hxx>
SFX_IMPL_CHILDWINDOW_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_CHILDWINDOW_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
SFX_IMPL_MODELESSDIALOG_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
......@@ -123,7 +123,7 @@ namespace
IMPL_CONTROLLER_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
IMPL_CONTROLLER_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
......
......@@ -89,7 +89,7 @@ void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew )
}
//ugly hack to call Define Name from Manage Names
void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog)
void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialogController* pDialog)
{
sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
if( nSlotId == FID_ADD_NAME )
......@@ -102,12 +102,7 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog)
SC_MOD()->SetRefDialog( nId, pWnd == nullptr );
}
}
void ScTabViewShell::SwitchBetweenRefDialogControllers(SfxModelessDialogController* pDialog)
{
sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
if (nSlotId == FID_DEFINE_NAME)
else if (nSlotId == FID_DEFINE_NAME)
{
mbInSwitch = true;
static_cast<ScNameDlg*>(pDialog)->GetRangeNames(m_RangeMap);
......@@ -149,32 +144,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
switch( nSlotId )
{
case FID_ADD_NAME:
{
if (!mbInSwitch)
{
std::map<OUString, ScRangeName*> aRangeMap;
pDoc->GetRangeNameMap(aRangeMap);
pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap,
ScAddress( GetViewData().GetCurX(),
GetViewData().GetCurY(),
GetViewData().GetTabNo() ), true );
}
else
{
std::map<OUString, ScRangeName*> aRangeMap;
for (auto const& itr : m_RangeMap)
{
aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr.first, itr.second.get()));
}
pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap,
ScAddress( GetViewData().GetCurX(),
GetViewData().GetCurY(),
GetViewData().GetTabNo() ), false );
}
}
break;
case SID_DEFINE_COLROWNAMERANGES:
{
pResult = VclPtr<ScColRowNameRangesDlg>::Create( pB, pCW, pParent, &GetViewData() );
......@@ -433,6 +402,8 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
if(pCW)
pCW->SetHideNotDelete(true);
ScDocument* pDoc = GetViewData().GetDocument();
switch( nSlotId )
{
case SID_CORRELATION_DIALOG:
......@@ -503,6 +474,31 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
}
break;
}
case FID_ADD_NAME:
{
if (!mbInSwitch)
{
std::map<OUString, ScRangeName*> aRangeMap;
pDoc->GetRangeNameMap(aRangeMap);
xResult.reset(new ScNameDefDlg(pB, pCW, pParent, &GetViewData(), aRangeMap,
ScAddress(GetViewData().GetCurX(),
GetViewData().GetCurY(),
GetViewData().GetTabNo()), true));
}
else
{
std::map<OUString, ScRangeName*> aRangeMap;
for (auto const& itr : m_RangeMap)
{
aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr.first, itr.second.get()));
}
xResult.reset(new ScNameDefDlg(pB, pCW, pParent, &GetViewData(), aRangeMap,
ScAddress(GetViewData().GetCurX(),
GetViewData().GetCurY(),
GetViewData().GetTabNo()), false));
}
break;
}
}
if (xResult)
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="DefineNameDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="definename|DefineNameDialog">Define Name</property>
<property name="resizable">False</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -85,10 +90,10 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="definename|label2">Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">edit</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -99,10 +104,10 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="definename|label3">Range or formula expression:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">range</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -113,10 +118,10 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="definename|label4">Scope:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">scope</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -127,6 +132,7 @@
<object class="GtkEntry" id="edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -139,10 +145,11 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="foruilo-RefEdit" id="range">
<object class="GtkEntry" id="range">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">50</property>
</object>
<packing>
......@@ -152,7 +159,7 @@
</packing>
</child>
<child>
<object class="foruilo-RefButton" id="refbutton">
<object class="GtkButton" id="refbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -184,8 +191,8 @@
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="definename|label">Define the name and range or formula expression.</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -300,9 +307,9 @@
</object>
</child>
<action-widgets>
<action-widget response="-11">help</action-widget>
<action-widget response="0">add</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>
</interface>
......@@ -71,6 +71,7 @@ sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='Source'] orpha
sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='Operations'] orphan-label
sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='invalid'] orphan-label
sc/uiconfig/scalc/ui/definename.ui://GtkLabel[@id='label'] orphan-label
sc/uiconfig/scalc/ui/definename.ui://GtkButton[@id='refbutton'] button-no-label
sc/uiconfig/scalc/ui/deletecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label
sc/uiconfig/scalc/ui/deletecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkGrid[@id='grid_details']/GtkLabel orphan-label
sc/uiconfig/scalc/ui/deletecolumnentry.ui://GtkEntry[@id='ed_columns'] no-labelled-by
......
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