[Libreoffice-commits] core.git: include/vcl sc/source sc/uiconfig solenv/sanitizers vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 11 07:58:52 UTC 2019
include/vcl/weld.hxx | 1
sc/source/ui/inc/namedlg.hxx | 76 +++---
sc/source/ui/inc/namemgrtable.hxx | 13 -
sc/source/ui/inc/reffact.hxx | 13 +
sc/source/ui/inc/tabvwsh.hxx | 1
sc/source/ui/namedlg/namedlg.cxx | 345 ++++++++++++++----------------
sc/source/ui/namedlg/namemgrtable.cxx | 38 +++
sc/source/ui/view/reffact.cxx | 28 ++
sc/source/ui/view/tabvwshc.cxx | 112 +++------
sc/uiconfig/scalc/ui/managenamesdialog.ui | 91 ++++++-
solenv/sanitizers/ui/modules/scalc.suppr | 1
vcl/source/app/salvtables.cxx | 8
vcl/unx/gtk3/gtk3gtkinst.cxx | 19 +
13 files changed, 441 insertions(+), 305 deletions(-)
New commits:
commit 565a254a814a06086ac067d5c64b4557e73c9666
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 10 15:50:49 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 11 09:58:26 2019 +0200
weld ScNameDlg
Change-Id: I7a00dd386a1cb52e046d0f57c77fe3fdf8252bb7
Reviewed-on: https://gerrit.libreoffice.org/70548
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 2a7511b419fc..4074df14b8c7 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1435,6 +1435,7 @@ public:
virtual void set_label(const OUString& rText) = 0;
virtual OUString get_label() const = 0;
virtual void set_mnemonic_widget(Widget* pTarget) = 0;
+ virtual void set_error(bool bShowError) = 0;
};
class VCL_DLLPUBLIC TextView : virtual public Container
diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx
index cf8192ba4196..2034cd26e918 100644
--- a/sc/source/ui/inc/namedlg.hxx
+++ b/sc/source/ui/inc/namedlg.hxx
@@ -33,28 +33,9 @@ class ScViewData;
class ScDocument;
//logic behind the manage names dialog
-class ScNameDlg : public ScAnyRefDlg, public ScRangeManagerTable::InitListener
+class ScNameDlg : public ScAnyRefDlgController
{
private:
- VclPtr<Edit> m_pEdName;
- VclPtr<formula::RefEdit> m_pEdAssign;
- VclPtr<formula::RefButton> m_pRbAssign;
- VclPtr<ListBox> m_pLbScope;
-
- VclPtr<CheckBox> m_pBtnPrintArea;
- VclPtr<CheckBox> m_pBtnColHeader;
- VclPtr<CheckBox> m_pBtnCriteria;
- VclPtr<CheckBox> m_pBtnRowHeader;
-
- VclPtr<PushButton> m_pBtnAdd;
- VclPtr<PushButton> m_pBtnDelete;
- VclPtr<PushButton> m_pBtnOk;
- VclPtr<PushButton> m_pBtnCancel;
-
- VclPtr<FixedText> m_pFtInfo;
-
- VclPtr<ScRangeManagerTable> m_pRangeManagerTable;
-
const OUString maGlobalNameStr;
const OUString maErrInvalidNameStr;
const OUString maErrNameInUse;
@@ -74,6 +55,28 @@ private:
RangeNameContainer m_RangeMap;
+ std::unique_ptr<weld::Entry> m_xEdName;
+ std::unique_ptr<weld::Label> m_xFtAssign;
+ std::unique_ptr<formula::WeldRefEdit> m_xEdAssign;
+ std::unique_ptr<formula::WeldRefButton> m_xRbAssign;
+ std::unique_ptr<weld::ComboBox> m_xLbScope;
+
+ std::unique_ptr<weld::CheckButton> m_xBtnPrintArea;
+ std::unique_ptr<weld::CheckButton> m_xBtnColHeader;
+ std::unique_ptr<weld::CheckButton> m_xBtnCriteria;
+ std::unique_ptr<weld::CheckButton> m_xBtnRowHeader;
+
+ std::unique_ptr<weld::Button> m_xBtnAdd;
+ std::unique_ptr<weld::Button> m_xBtnDelete;
+ std::unique_ptr<weld::Button> m_xBtnOk;
+ std::unique_ptr<weld::Button> m_xBtnCancel;
+
+ std::unique_ptr<weld::Label> m_xFtInfo;
+
+ std::unique_ptr<weld::Expander> m_xExpander;
+
+ std::unique_ptr<RangeManagerTable> m_xRangeManagerTable;
+
private:
void Init();
void UpdateChecks(const ScRangeData* pData);
@@ -87,41 +90,38 @@ private:
void AddPushed();
void RemovePushed();
- void CancelPushed();
void ScopeChanged();
void NameModified();
void SelectionChanged();
// Handler:
- DECL_LINK( OkBtnHdl, Button*, void );
- DECL_LINK( CancelBtnHdl, Button*, void );
- DECL_LINK( AddBtnHdl, Button*, void );
- DECL_LINK( RemoveBtnHdl, Button*, void );
- DECL_LINK( EdModifyHdl, Edit&, void );
- DECL_LINK( EdModifyCheckBoxHdl, CheckBox&, void );
- DECL_LINK( AssignGetFocusHdl, Control&, void );
- DECL_LINK( SelectionChangedHdl_Impl, SvTreeListBox*, void );
- DECL_LINK( ScopeChangedHdl, ListBox&, void );
+ DECL_LINK( OkBtnHdl, weld::Button&, void );
+ DECL_LINK( CancelBtnHdl, weld::Button&, void );
+ DECL_LINK( AddBtnHdl, weld::Button&, void );
+ DECL_LINK( RemoveBtnHdl, weld::Button&, void );
+ DECL_LINK( EdModifyHdl, weld::Entry&, void );
+ DECL_LINK( RefEdModifyHdl, formula::WeldRefEdit&, void );
+ DECL_LINK( EdModifyCheckBoxHdl, weld::ToggleButton&, void );
+ DECL_LINK( AssignGetFocusHdl, formula::WeldRefEdit&, void );
+ DECL_LINK( SelectionChangedHdl_Impl, weld::TreeView&, void );
+ DECL_LINK( ScopeChangedHdl, weld::ComboBox&, void );
protected:
virtual void RefInputDone( bool bForced = false ) override;
public:
- ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
- ScViewData* ptrViewData,
- const ScAddress& aCursorPos,
- std::map<OUString, std::unique_ptr<ScRangeName>>* pRangeMap = nullptr);
+ ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
+ ScViewData* ptrViewData,
+ const ScAddress& aCursorPos,
+ std::map<OUString, std::unique_ptr<ScRangeName>>* pRangeMap = nullptr);
virtual ~ScNameDlg() 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 tableInitialized() override;
+ virtual void Close() override;
void GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap);
void SetEntry(const OUString& rName, const OUString& rScope);
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index 623e0cf13c60..aab677f31f72 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -106,7 +106,6 @@ private:
void GetLine(ScRangeNameLine& aLine, weld::TreeIter& rEntry);
void Init();
- void CheckForFormulaString();
const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
DECL_LINK(SizeAllocHdl, const Size&, void);
@@ -117,9 +116,19 @@ public:
const std::map<OUString, std::unique_ptr<ScRangeName>>& rTabRangeNames,
const ScAddress& rPos);
+ void CheckForFormulaString();
+
int n_children() const { return m_xTreeView->n_children(); }
+ void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
+ void set_cursor(int nPos) { m_xTreeView->set_cursor(nPos); }
+
+ void addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry);
+ void DeleteSelectedEntries();
+ void SetEntry( const ScRangeNameLine& rLine );
- void addEntry(const ScRangeNameLine& rLine);
+ void GetCurrentLine(ScRangeNameLine& rLine);
+ bool IsMultiSelection();
+ bool HasSelection();
std::vector<ScRangeNameLine> GetSelectedEntries();
};
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index e5a6613220f5..b7ab53612a0b 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -33,7 +33,18 @@
SFX_DECL_CHILDWINDOW_WITHID(Class); \
};
-DECL_WRAPPER_WITHID(ScNameDlgWrapper)
+#define DECL_WRAPPER_WITHID_CONTROLLER(Class) \
+ class Class : public SfxChildWindow \
+ { \
+ public: \
+ Class( vcl::Window*, sal_uInt16, SfxBindings*, const SfxChildWinInfo* ); \
+ static std::unique_ptr<SfxChildWindow> CreateImpl(vcl::Window *pParent, sal_uInt16 nId, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
+ static void RegisterChildWindow (bool bVisible=false, SfxModule *pMod=nullptr, SfxChildWindowFlags nFlags=SfxChildWindowFlags::NONE); \
+ static sal_uInt16 GetChildWindowId ();\
+ };
+
+DECL_WRAPPER_WITHID_CONTROLLER(ScNameDlgWrapper)
DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index f2a260030206..4a2a142befef 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -379,6 +379,7 @@ public:
// ugly hack to call Define Names from Manage Names
void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
+ void SwitchBetweenRefDialogControllers(SfxModelessDialogController* pDialog);
// #i123629#
bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; }
void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; }
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 4be3d82a439f..ddbddcf91c56 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -40,11 +40,12 @@
//logic
-ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
+ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
ScViewData* ptrViewData,
const ScAddress& aCursorPos,
std::map<OUString, std::unique_ptr<ScRangeName>> *const pRangeMap)
- : ScAnyRefDlg(pB, pCW, pParent, "ManageNamesDialog", "modules/scalc/ui/managenamesdialog.ui")
+ : ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/managenamesdialog.ui",
+ "ManageNamesDialog")
, maGlobalNameStr(ScResId(STR_GLOBAL_SCOPE))
, maErrInvalidNameStr(ScResId(STR_ERR_NAME_INVALID))
@@ -57,24 +58,27 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent
, mbNeedUpdate(true)
, mbDataChanged(false)
, mbCloseWithoutUndo(false)
-{
- get(m_pEdName, "name");
- get(m_pEdAssign, "range");
- m_pEdAssign->SetReferences(this, m_pEdName);
- get(m_pRbAssign, "assign");
- m_pRbAssign->SetReferences(this, m_pEdAssign);
- get(m_pLbScope, "scope");
- get(m_pBtnPrintArea, "printrange");
- get(m_pBtnColHeader, "colheader");
- get(m_pBtnCriteria, "filter");
- get(m_pBtnRowHeader, "rowheader");
- get(m_pBtnAdd, "add");
- get(m_pBtnDelete, "delete");
- get(m_pBtnOk, "ok");
- get(m_pBtnCancel, "cancel");
- get(m_pFtInfo, "info");
- maStrInfoDefault = m_pFtInfo->GetText();
- m_pFtInfo->SetText(OUString());
+
+ , m_xEdName(m_xBuilder->weld_entry("name"))
+ , m_xFtAssign(m_xBuilder->weld_label("label3"))
+ , m_xEdAssign(new formula::WeldRefEdit(m_xBuilder->weld_entry("range")))
+ , m_xRbAssign(new formula::WeldRefButton(m_xBuilder->weld_button("assign")))
+ , m_xLbScope(m_xBuilder->weld_combo_box("scope"))
+ , m_xBtnPrintArea(m_xBuilder->weld_check_button("printrange"))
+ , m_xBtnColHeader(m_xBuilder->weld_check_button("colheader"))
+ , m_xBtnCriteria(m_xBuilder->weld_check_button("filter"))
+ , m_xBtnRowHeader(m_xBuilder->weld_check_button("rowheader"))
+ , m_xBtnAdd(m_xBuilder->weld_button("add"))
+ , m_xBtnDelete(m_xBuilder->weld_button("delete"))
+ , m_xBtnOk(m_xBuilder->weld_button("ok"))
+ , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
+ , m_xFtInfo(m_xBuilder->weld_label("info"))
+ , m_xExpander(m_xBuilder->weld_expander("more"))
+{
+ m_xEdAssign->SetReferences(this, m_xFtAssign.get());
+ m_xRbAssign->SetReferences(this, m_xEdAssign.get());
+ maStrInfoDefault = m_xFtInfo->get_label();
+ m_xFtInfo->set_label(OUString());
if (!pRangeMap)
{
@@ -94,26 +98,6 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent
ScNameDlg::~ScNameDlg()
{
- disposeOnce();
-}
-
-void ScNameDlg::dispose()
-{
- m_pRangeManagerTable.disposeAndClear();
- m_pEdName.clear();
- m_pEdAssign.clear();
- m_pRbAssign.clear();
- m_pLbScope.clear();
- m_pBtnPrintArea.clear();
- m_pBtnColHeader.clear();
- m_pBtnCriteria.clear();
- m_pBtnRowHeader.clear();
- m_pBtnAdd.clear();
- m_pBtnDelete.clear();
- m_pBtnOk.clear();
- m_pBtnCancel.clear();
- m_pFtInfo.clear();
- ScAnyRefDlg::dispose();
}
void ScNameDlg::Init()
@@ -121,38 +105,43 @@ void ScNameDlg::Init()
OSL_ENSURE( mpViewData && mpDoc, "ViewData or Document not found!" );
//init UI
- m_pFtInfo->SetStyle(WB_VCENTER);
-
- SvSimpleTableContainer *pCtrl = get<SvSimpleTableContainer>("names");
- pCtrl->set_height_request(pCtrl->GetTextHeight()*12);
-
- m_pRangeManagerTable = VclPtr<ScRangeManagerTable>::Create(*pCtrl, m_RangeMap, maCursorPos);
- m_pRangeManagerTable->setInitListener(this);
- m_pRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
- m_pRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
-
- m_pBtnOk->SetClickHdl ( LINK( this, ScNameDlg, OkBtnHdl ) );
- m_pBtnCancel->SetClickHdl ( LINK( this, ScNameDlg, CancelBtnHdl ) );
- m_pBtnAdd->SetClickHdl ( LINK( this, ScNameDlg, AddBtnHdl ) );
- m_pEdAssign->SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) );
- m_pEdAssign->SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) );
- m_pEdName->SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) );
- m_pLbScope->SetSelectHdl( LINK(this, ScNameDlg, ScopeChangedHdl) );
- m_pBtnDelete->SetClickHdl ( LINK( this, ScNameDlg, RemoveBtnHdl ) );
- m_pBtnPrintArea->SetToggleHdl( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
- m_pBtnCriteria->SetToggleHdl( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
- m_pBtnRowHeader->SetToggleHdl( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
- m_pBtnColHeader->SetToggleHdl( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
+
+ std::unique_ptr<weld::TreeView> xTreeView(m_xBuilder->weld_tree_view("names"));
+ xTreeView->set_size_request(xTreeView->get_approximate_digit_width() * 75,
+ xTreeView->get_height_rows(10));
+ m_xRangeManagerTable.reset(new RangeManagerTable(std::move(xTreeView), m_RangeMap, maCursorPos));
+
+ if (m_xRangeManagerTable->n_children())
+ {
+ m_xRangeManagerTable->set_cursor(0);
+ m_xRangeManagerTable->CheckForFormulaString();
+ SelectionChanged();
+ }
+
+ m_xRangeManagerTable->connect_changed( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
+
+ m_xBtnOk->connect_clicked( LINK( this, ScNameDlg, OkBtnHdl ) );
+ m_xBtnCancel->connect_clicked( LINK( this, ScNameDlg, CancelBtnHdl ) );
+ m_xBtnAdd->connect_clicked( LINK( this, ScNameDlg, AddBtnHdl ) );
+ m_xEdAssign->SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) );
+ m_xEdAssign->SetModifyHdl ( LINK( this, ScNameDlg, RefEdModifyHdl ) );
+ m_xEdName->connect_changed( LINK( this, ScNameDlg, EdModifyHdl ) );
+ m_xLbScope->connect_changed( LINK(this, ScNameDlg, ScopeChangedHdl) );
+ m_xBtnDelete->connect_clicked( LINK( this, ScNameDlg, RemoveBtnHdl ) );
+ m_xBtnPrintArea->connect_toggled( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
+ m_xBtnCriteria->connect_toggled( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
+ m_xBtnRowHeader->connect_toggled( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
+ m_xBtnColHeader->connect_toggled( LINK(this, ScNameDlg, EdModifyCheckBoxHdl ) );
// Initialize scope list.
- m_pLbScope->InsertEntry(maGlobalNameStr);
- m_pLbScope->SelectEntryPos(0);
+ m_xLbScope->append_text(maGlobalNameStr);
+ m_xLbScope->set_active(0);
SCTAB n = mpDoc->GetTableCount();
for (SCTAB i = 0; i < n; ++i)
{
OUString aTabName;
mpDoc->GetName(i, aTabName);
- m_pLbScope->InsertEntry(aTabName);
+ m_xLbScope->append_text(aTabName);
}
CheckForEmptyTable();
@@ -160,78 +149,67 @@ void ScNameDlg::Init()
bool ScNameDlg::IsRefInputMode() const
{
- return m_pEdAssign->IsEnabled();
+ return m_xEdAssign->GetWidget()->get_sensitive();
}
void ScNameDlg::RefInputDone( bool bForced)
{
- ScAnyRefDlg::RefInputDone(bForced);
- EdModifyHdl(*m_pEdAssign);
+ ScAnyRefDlgController::RefInputDone(bForced);
+ RefEdModifyHdl(*m_xEdAssign);
}
void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
- if ( m_pEdAssign->IsEnabled() )
+ if (m_xEdAssign->GetWidget()->get_sensitive())
{
if ( rRef.aStart != rRef.aEnd )
- RefInputStart(m_pEdAssign);
+ RefInputStart(m_xEdAssign.get());
OUString aRefStr(rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP,
ScAddress::Details(pDocP->GetAddressConvention(), 0, 0)));
- m_pEdAssign->SetRefString( aRefStr );
+ m_xEdAssign->SetRefString( aRefStr );
}
}
-bool ScNameDlg::Close()
+void ScNameDlg::Close()
{
if (mbDataChanged && !mbCloseWithoutUndo)
mpViewData->GetDocFunc().ModifyAllRangeNames(m_RangeMap);
- return DoClose( ScNameDlgWrapper::GetChildWindowId() );
-}
-
-void ScNameDlg::tableInitialized()
-{
- if (m_pRangeManagerTable->GetSelectionCount())
- SelectionChanged();
+ DoClose(ScNameDlgWrapper::GetChildWindowId());
}
void ScNameDlg::CheckForEmptyTable()
{
- if (!m_pRangeManagerTable->GetEntryCount())
+ if (!m_xRangeManagerTable->n_children())
{
- m_pBtnDelete->Disable();
- m_pEdAssign->Disable();
- m_pRbAssign->Disable();
- m_pEdName->Disable();
- m_pLbScope->Disable();
-
- m_pBtnCriteria->Disable();
- m_pBtnPrintArea->Disable();
- m_pBtnColHeader->Disable();
- m_pBtnRowHeader->Disable();
+ m_xBtnDelete->set_sensitive(false);
+ m_xEdAssign->GetWidget()->set_sensitive(false);
+ m_xRbAssign->GetWidget()->set_sensitive(false);
+ m_xEdName->set_sensitive(false);
+ m_xLbScope->set_sensitive(false);
+
+ m_xBtnCriteria->set_sensitive(false);
+ m_xBtnPrintArea->set_sensitive(false);
+ m_xBtnColHeader->set_sensitive(false);
+ m_xBtnRowHeader->set_sensitive(false);
}
else
{
- m_pBtnDelete->Enable();
- m_pEdAssign->Enable();
- m_pRbAssign->Enable();
- m_pEdName->Enable();
- m_pLbScope->Enable();
-
- m_pBtnCriteria->Enable();
- m_pBtnPrintArea->Enable();
- m_pBtnColHeader->Enable();
- m_pBtnRowHeader->Enable();
+ m_xBtnDelete->set_sensitive(true);
+ m_xEdAssign->GetWidget()->set_sensitive(true);
+ m_xRbAssign->GetWidget()->set_sensitive(true);
+ m_xEdName->set_sensitive(true);
+ m_xLbScope->set_sensitive(true);
+
+ m_xBtnCriteria->set_sensitive(true);
+ m_xBtnPrintArea->set_sensitive(true);
+ m_xBtnColHeader->set_sensitive(true);
+ m_xBtnRowHeader->set_sensitive(true);
}
}
-void ScNameDlg::CancelPushed()
-{
- DoClose( ScNameDlgWrapper::GetChildWindowId() );
-}
-
void ScNameDlg::SetActive()
{
- m_pEdAssign->GrabFocus();
+ m_xEdAssign->GrabFocus();
RefInputDone();
}
@@ -243,28 +221,28 @@ void ScNameDlg::UpdateChecks(const ScRangeData* pData)
// handlers, triggering handlers while already processing a handler can
// ( and does in this case ) corrupt the internal data
- m_pBtnCriteria->SetToggleHdl( Link<CheckBox&,void>() );
- m_pBtnPrintArea->SetToggleHdl( Link<CheckBox&,void>() );
- m_pBtnColHeader->SetToggleHdl( Link<CheckBox&,void>() );
- m_pBtnRowHeader->SetToggleHdl( Link<CheckBox&,void>() );
+ m_xBtnCriteria->connect_toggled( Link<weld::ToggleButton&,void>() );
+ m_xBtnPrintArea->connect_toggled( Link<weld::ToggleButton&,void>() );
+ m_xBtnColHeader->connect_toggled( Link<weld::ToggleButton&,void>() );
+ m_xBtnRowHeader->connect_toggled( Link<weld::ToggleButton&,void>() );
- m_pBtnCriteria->Check( pData->HasType( ScRangeData::Type::Criteria ) );
- m_pBtnPrintArea->Check( pData->HasType( ScRangeData::Type::PrintArea ) );
- m_pBtnColHeader->Check( pData->HasType( ScRangeData::Type::ColHeader ) );
- m_pBtnRowHeader->Check( pData->HasType( ScRangeData::Type::RowHeader ) );
+ m_xBtnCriteria->set_active( pData->HasType( ScRangeData::Type::Criteria ) );
+ m_xBtnPrintArea->set_active( pData->HasType( ScRangeData::Type::PrintArea ) );
+ m_xBtnColHeader->set_active( pData->HasType( ScRangeData::Type::ColHeader ) );
+ m_xBtnRowHeader->set_active( pData->HasType( ScRangeData::Type::RowHeader ) );
// Restore handlers so user input is processed again
- Link<CheckBox&,void> aToggleHandler = LINK( this, ScNameDlg, EdModifyCheckBoxHdl );
- m_pBtnCriteria->SetToggleHdl( aToggleHandler );
- m_pBtnPrintArea->SetToggleHdl( aToggleHandler );
- m_pBtnColHeader->SetToggleHdl( aToggleHandler );
- m_pBtnRowHeader->SetToggleHdl( aToggleHandler );
+ Link<weld::ToggleButton&,void> aToggleHandler = LINK( this, ScNameDlg, EdModifyCheckBoxHdl );
+ m_xBtnCriteria->connect_toggled( aToggleHandler );
+ m_xBtnPrintArea->connect_toggled( aToggleHandler );
+ m_xBtnColHeader->connect_toggled( aToggleHandler );
+ m_xBtnRowHeader->connect_toggled( aToggleHandler );
}
bool ScNameDlg::IsNameValid()
{
- OUString aScope = m_pLbScope->GetSelectedEntry();
- OUString aName = m_pEdName->GetText();
+ OUString aScope = m_xLbScope->get_active_text();
+ OUString aName = m_xEdName->get_text();
aName = aName.trim();
if (aName.isEmpty())
@@ -274,27 +252,27 @@ bool ScNameDlg::IsNameValid()
if (ScRangeData::IsNameValid( aName, mpDoc ) != ScRangeData::NAME_VALID)
{
- m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
- m_pFtInfo->SetText(maErrInvalidNameStr);
+ m_xFtInfo->set_error(true);
+ m_xFtInfo->set_label(maErrInvalidNameStr);
return false;
}
else if (pRangeName && pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(aName)))
{
- m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
- m_pFtInfo->SetText(maErrNameInUse);
+ m_xFtInfo->set_error(true);
+ m_xFtInfo->set_label(maErrNameInUse);
return false;
}
- m_pFtInfo->SetText( maStrInfoDefault );
+ m_xFtInfo->set_label( maStrInfoDefault );
return true;
}
bool ScNameDlg::IsFormulaValid()
{
ScCompiler aComp( mpDoc, maCursorPos, mpDoc->GetGrammar());
- std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_pEdAssign->GetText());
+ std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdAssign->GetText());
if (pCode->GetCodeError() != FormulaError::NONE)
{
- m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
+ m_xFtInfo->set_error(true);
return false;
}
else
@@ -325,7 +303,7 @@ void ScNameDlg::AddPushed()
{
mbCloseWithoutUndo = true;
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- pViewSh->SwitchBetweenRefDialogs(this);
+ pViewSh->SwitchBetweenRefDialogControllers(this);
}
void ScNameDlg::SetEntry(const OUString& rName, const OUString& rScope)
@@ -336,14 +314,14 @@ void ScNameDlg::SetEntry(const OUString& rName, const OUString& rScope)
ScRangeNameLine aLine;
aLine.aName = rName;
aLine.aScope = rScope;
- m_pRangeManagerTable->SetEntry(aLine);
+ m_xRangeManagerTable->SetEntry(aLine);
}
}
void ScNameDlg::RemovePushed()
{
- std::vector<ScRangeNameLine> aEntries = m_pRangeManagerTable->GetSelectedEntries();
- m_pRangeManagerTable->DeleteSelectedEntries();
+ std::vector<ScRangeNameLine> aEntries = m_xRangeManagerTable->GetSelectedEntries();
+ m_xRangeManagerTable->DeleteSelectedEntries();
for (const auto& rEntry : aEntries)
{
ScRangeName* pRangeName = GetRangeName(rEntry.aScope);
@@ -361,11 +339,11 @@ void ScNameDlg::RemovePushed()
void ScNameDlg::NameModified()
{
ScRangeNameLine aLine;
- m_pRangeManagerTable->GetCurrentLine(aLine);
+ m_xRangeManagerTable->GetCurrentLine(aLine);
OUString aOldName = aLine.aName;
- OUString aNewName = m_pEdName->GetText();
+ OUString aNewName = m_xEdName->get_text();
aNewName = aNewName.trim();
- m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
+ m_xFtInfo->set_error(false);
if (aNewName != aOldName)
{
if (!IsNameValid())
@@ -373,7 +351,7 @@ void ScNameDlg::NameModified()
}
else
{
- m_pFtInfo->SetText( maStrInfoDefault );
+ m_xFtInfo->set_label( maStrInfoDefault );
}
if (!IsFormulaValid())
@@ -386,8 +364,8 @@ void ScNameDlg::NameModified()
//empty table
if (aOldScope.isEmpty())
return;
- OUString aExpr = m_pEdAssign->GetText();
- OUString aNewScope = m_pLbScope->GetSelectedEntry();
+ OUString aExpr = m_xEdAssign->GetText();
+ OUString aNewScope = m_xLbScope->get_active_text();
ScRangeName* pOldRangeName = GetRangeName( aOldScope );
ScRangeData* pData = pOldRangeName->findByUpperName( ScGlobal::pCharClass->uppercase(aOldName) );
@@ -402,12 +380,12 @@ void ScNameDlg::NameModified()
pOldRangeName->erase(*pData);
mbNeedUpdate = false;
- m_pRangeManagerTable->DeleteSelectedEntries();
+ m_xRangeManagerTable->DeleteSelectedEntries();
ScRangeData::Type nType = ScRangeData::Type::Name;
- if ( m_pBtnRowHeader->IsChecked() ) nType |= ScRangeData::Type::RowHeader;
- if ( m_pBtnColHeader->IsChecked() ) nType |= ScRangeData::Type::ColHeader;
- if ( m_pBtnPrintArea->IsChecked() ) nType |= ScRangeData::Type::PrintArea;
- if ( m_pBtnCriteria->IsChecked() ) nType |= ScRangeData::Type::Criteria;
+ if ( m_xBtnRowHeader->get_active() ) nType |= ScRangeData::Type::RowHeader;
+ if ( m_xBtnColHeader->get_active() ) nType |= ScRangeData::Type::ColHeader;
+ if ( m_xBtnPrintArea->get_active() ) nType |= ScRangeData::Type::PrintArea;
+ if ( m_xBtnCriteria->get_active() ) nType |= ScRangeData::Type::Criteria;
ScRangeData* pNewEntry = new ScRangeData( mpDoc, aNewName, aExpr,
maCursorPos, nType);
@@ -416,7 +394,7 @@ void ScNameDlg::NameModified()
aLine.aName = aNewName;
aLine.aExpression = aExpr;
aLine.aScope = aNewScope;
- m_pRangeManagerTable->addEntry(aLine, true);
+ m_xRangeManagerTable->addEntry(aLine, true);
mbNeedUpdate = true;
mbDataChanged = true;
}
@@ -430,37 +408,37 @@ void ScNameDlg::SelectionChanged()
return;
}
- if (m_pRangeManagerTable->IsMultiSelection())
+ if (m_xRangeManagerTable->IsMultiSelection())
{
- m_pEdName->SetText(maStrMultiSelect);
- m_pEdAssign->SetText(maStrMultiSelect);
-
- m_pEdName->Disable();
- m_pEdAssign->Disable();
- m_pRbAssign->Disable();
- m_pLbScope->Disable();
- m_pBtnRowHeader->Disable();
- m_pBtnColHeader->Disable();
- m_pBtnPrintArea->Disable();
- m_pBtnCriteria->Disable();
+ m_xEdName->set_text(maStrMultiSelect);
+ m_xEdAssign->SetText(maStrMultiSelect);
+
+ m_xEdName->set_sensitive(false);
+ m_xEdAssign->GetWidget()->set_sensitive(false);
+ m_xRbAssign->GetWidget()->set_sensitive(false);
+ m_xLbScope->set_sensitive(false);
+ m_xBtnRowHeader->set_sensitive(false);
+ m_xBtnColHeader->set_sensitive(false);
+ m_xBtnPrintArea->set_sensitive(false);
+ m_xBtnCriteria->set_sensitive(false);
}
else
{
ScRangeNameLine aLine;
- m_pRangeManagerTable->GetCurrentLine(aLine);
- m_pEdAssign->SetText(aLine.aExpression);
- m_pEdName->SetText(aLine.aName);
- m_pLbScope->SelectEntry(aLine.aScope);
+ m_xRangeManagerTable->GetCurrentLine(aLine);
+ m_xEdAssign->SetText(aLine.aExpression);
+ m_xEdName->set_text(aLine.aName);
+ m_xLbScope->set_active_text(aLine.aScope);
ShowOptions(aLine);
- m_pBtnDelete->Enable();
- m_pEdName->Enable();
- m_pEdAssign->Enable();
- m_pRbAssign->Enable();
- m_pLbScope->Enable();
- m_pBtnRowHeader->Enable();
- m_pBtnColHeader->Enable();
- m_pBtnPrintArea->Enable();
- m_pBtnCriteria->Enable();
+ m_xBtnDelete->set_sensitive(true);
+ m_xEdName->set_sensitive(true);
+ m_xEdAssign->GetWidget()->set_sensitive(true);
+ m_xRbAssign->GetWidget()->set_sensitive(true);
+ m_xLbScope->set_sensitive(true);
+ m_xBtnRowHeader->set_sensitive(true);
+ m_xBtnColHeader->set_sensitive(true);
+ m_xBtnPrintArea->set_sensitive(true);
+ m_xBtnCriteria->set_sensitive(true);
}
}
@@ -474,47 +452,52 @@ void ScNameDlg::GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>&
m_RangeMap.swap(rRangeMap);
}
-IMPL_LINK_NOARG(ScNameDlg, OkBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScNameDlg, OkBtnHdl, weld::Button&, void)
{
- Close();
+ response(RET_OK);
}
-IMPL_LINK_NOARG(ScNameDlg, CancelBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScNameDlg, CancelBtnHdl, weld::Button&, void)
{
- CancelPushed();
+ response(RET_CANCEL);
}
-IMPL_LINK_NOARG(ScNameDlg, AddBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScNameDlg, AddBtnHdl, weld::Button&, void)
{
AddPushed();
}
-IMPL_LINK_NOARG(ScNameDlg, RemoveBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScNameDlg, RemoveBtnHdl, weld::Button&, void)
{
RemovePushed();
}
-IMPL_LINK_NOARG(ScNameDlg, EdModifyCheckBoxHdl, CheckBox&, void)
+IMPL_LINK_NOARG(ScNameDlg, EdModifyCheckBoxHdl, weld::ToggleButton&, void)
+{
+ NameModified();
+}
+
+IMPL_LINK_NOARG(ScNameDlg, EdModifyHdl, weld::Entry&, void)
{
NameModified();
}
-IMPL_LINK_NOARG(ScNameDlg, EdModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(ScNameDlg, RefEdModifyHdl, formula::WeldRefEdit&, void)
{
NameModified();
}
-IMPL_LINK_NOARG(ScNameDlg, AssignGetFocusHdl, Control&, void)
+IMPL_LINK_NOARG(ScNameDlg, AssignGetFocusHdl, formula::WeldRefEdit&, void)
{
- EdModifyHdl(*m_pEdAssign);
+ RefEdModifyHdl(*m_xEdAssign);
}
-IMPL_LINK_NOARG(ScNameDlg, SelectionChangedHdl_Impl, SvTreeListBox*, void)
+IMPL_LINK_NOARG(ScNameDlg, SelectionChangedHdl_Impl, weld::TreeView&, void)
{
SelectionChanged();
}
-IMPL_LINK_NOARG(ScNameDlg, ScopeChangedHdl, ListBox&, void)
+IMPL_LINK_NOARG(ScNameDlg, ScopeChangedHdl, weld::ComboBox&, void)
{
ScopeChanged();
}
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 5be7b4eea7e2..22bde43d02fc 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -134,6 +134,13 @@ void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine)
GetLine(rLine, pCurrentEntry);
}
+void RangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine)
+{
+ std::unique_ptr<weld::TreeIter> xCurrentEntry(m_xTreeView->make_iterator());
+ if (m_xTreeView->get_cursor(xCurrentEntry.get()))
+ GetLine(rLine, *xCurrentEntry);
+}
+
void ScRangeManagerTable::GetLine(ScRangeNameLine& rLine, SvTreeListEntry* pEntry)
{
rLine.aName = GetEntryText( pEntry, 0);
@@ -200,11 +207,24 @@ void ScRangeManagerTable::DeleteSelectedEntries()
RemoveSelection();
}
+void RangeManagerTable::DeleteSelectedEntries()
+{
+ std::vector<int> aRows = m_xTreeView->get_selected_rows();
+ std::sort(aRows.begin(), aRows.end());
+ for (auto it = aRows.rbegin(); it != aRows.rend(); ++it)
+ m_xTreeView->remove(*it);
+}
+
bool ScRangeManagerTable::IsMultiSelection()
{
return GetSelectionCount() > 1;
}
+bool RangeManagerTable::IsMultiSelection()
+{
+ return m_xTreeView->count_selected_rows() > 1;
+}
+
std::vector<ScRangeNameLine> ScRangeManagerTable::GetSelectedEntries()
{
std::vector<ScRangeNameLine> aSelectedEntries;
@@ -236,6 +256,18 @@ void ScRangeManagerTable::SetEntry(const ScRangeNameLine& rLine)
}
}
+void RangeManagerTable::SetEntry(const ScRangeNameLine& rLine)
+{
+ for (int i = 0, nEntryCount = m_xTreeView->n_children(); i < nEntryCount; ++i)
+ {
+ if (rLine.aName == m_xTreeView->get_text(i, 0) &&
+ rLine.aScope == m_xTreeView->get_text(i, 2))
+ {
+ m_xTreeView->set_cursor(i);
+ }
+ }
+}
+
namespace {
//ensure that the minimum column size is respected
@@ -367,7 +399,7 @@ IMPL_LINK_NOARG(RangeManagerTable, SizeAllocHdl, const Size&, void)
CheckForFormulaString();
}
-void RangeManagerTable::addEntry(const ScRangeNameLine& rLine)
+void RangeManagerTable::addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry)
{
int nRow = m_xTreeView->n_children();
m_xTreeView->append();
@@ -376,6 +408,8 @@ void RangeManagerTable::addEntry(const ScRangeNameLine& rLine)
m_xTreeView->set_text(nRow, rLine.aScope, 2);
// just unique to track which one has been cached by maCalculatedFormulaEntries
m_xTreeView->set_id(nRow, OUString::number(m_nId++));
+ if (bSetCurEntry)
+ m_xTreeView->set_cursor(nRow);
}
void RangeManagerTable::GetLine(ScRangeNameLine& rLine, weld::TreeIter& rEntry)
@@ -402,7 +436,7 @@ void RangeManagerTable::Init()
if (!rEntry.second->HasType(ScRangeData::Type::Database))
{
aLine.aName = rEntry.second->GetName();
- addEntry(aLine);
+ addEntry(aLine, false);
}
}
}
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 5b4a6044a217..483216905456 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -32,7 +32,7 @@
#include <scres.hrc>
#include <validate.hxx>
-SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME )
+SFX_IMPL_CHILDWINDOW_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
@@ -97,7 +97,31 @@ namespace
pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \
}
-IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
+#define IMPL_CONTROLLER_CHILD_CTOR(Class,sid) \
+ Class::Class( vcl::Window* pParentP, \
+ sal_uInt16 nId, \
+ SfxBindings* p, \
+ const SfxChildWinInfo* pInfo ) \
+ : SfxChildWindow(pParentP, nId) \
+ { \
+ /************************************************************************************/\
+ /* When a new document is creating, the SfxViewFrame may be ready, */\
+ /* But the ScTabViewShell may have not been activated yet. In this */\
+ /* situation, SfxViewShell::Current() does not get the correct shell, */\
+ /* and we should lcl_GetTabViewShell( p ) instead of SfxViewShell::Current() */\
+ /************************************************************************************/\
+ ScTabViewShell* pViewShell = lcl_GetTabViewShell( p ); \
+ if (!pViewShell) \
+ pViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); \
+ OSL_ENSURE( pViewShell, "missing view shell :-(" ); \
+ SetController( pViewShell ? \
+ pViewShell->CreateRefDialogController( p, this, pInfo, pParentP->GetFrameWeld(), sid ) : nullptr ); \
+ if (pViewShell && !GetController()) \
+ pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \
+ }
+
+
+IMPL_CONTROLLER_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index be7c460b9fc6..89d32bd4648f 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -92,22 +92,27 @@ void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew )
void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog)
{
sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
- if (nSlotId == FID_DEFINE_NAME)
+ if( nSlotId == FID_ADD_NAME )
{
- mbInSwitch = true;
- static_cast<ScNameDlg*>(pDialog)->GetRangeNames(m_RangeMap);
- static_cast<ScNameDlg*>(pDialog)->Close();
- sal_uInt16 nId = ScNameDefDlgWrapper::GetChildWindowId();
+ static_cast<ScNameDefDlg*>(pDialog)->GetNewData(maName, maScope);
+ static_cast<ScNameDefDlg*>(pDialog)->Close();
+ sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId();
SfxViewFrame* pViewFrm = GetViewFrame();
SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
SC_MOD()->SetRefDialog( nId, pWnd == nullptr );
}
- else if( nSlotId == FID_ADD_NAME )
+}
+
+void ScTabViewShell::SwitchBetweenRefDialogControllers(SfxModelessDialogController* pDialog)
+{
+ sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
+ if (nSlotId == FID_DEFINE_NAME)
{
- static_cast<ScNameDefDlg*>(pDialog)->GetNewData(maName, maScope);
+ mbInSwitch = true;
+ static_cast<ScNameDlg*>(pDialog)->GetRangeNames(m_RangeMap);
static_cast<ScNameDlg*>(pDialog)->Close();
- sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId();
+ sal_uInt16 nId = ScNameDefDlgWrapper::GetChildWindowId();
SfxViewFrame* pViewFrm = GetViewFrame();
SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
@@ -144,27 +149,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
switch( nSlotId )
{
- case FID_DEFINE_NAME:
- {
- if (!mbInSwitch)
- {
- pResult = VclPtr<ScNameDlg>::Create( pB, pCW, pParent, &GetViewData(),
- ScAddress( GetViewData().GetCurX(),
- GetViewData().GetCurY(),
- GetViewData().GetTabNo() ) );
- }
- else
- {
- pResult = VclPtr<ScNameDlg>::Create( pB, pCW, pParent, &GetViewData(),
- ScAddress( GetViewData().GetCurX(),
- GetViewData().GetCurY(),
- GetViewData().GetTabNo() ), &m_RangeMap);
- static_cast<ScNameDlg*>(pResult.get())->SetEntry( maName, maScope);
- mbInSwitch = false;
- }
- }
- break;
-
case FID_ADD_NAME:
{
if (!mbInSwitch)
@@ -462,70 +446,64 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
switch( nSlotId )
{
case SID_CORRELATION_DIALOG:
- {
xResult.reset(new ScCorrelationDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_SAMPLING_DIALOG:
- {
xResult.reset(new ScSamplingDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_DESCRIPTIVE_STATISTICS_DIALOG:
- {
xResult.reset(new ScDescriptiveStatisticsDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_ANALYSIS_OF_VARIANCE_DIALOG:
- {
xResult.reset(new ScAnalysisOfVarianceDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_COVARIANCE_DIALOG:
- {
xResult.reset(new ScCovarianceDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_EXPONENTIAL_SMOOTHING_DIALOG:
- {
xResult.reset(new ScExponentialSmoothingDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_MOVING_AVERAGE_DIALOG:
- {
xResult.reset(new ScMovingAverageDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_REGRESSION_DIALOG:
- {
xResult.reset(new ScRegressionDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_FTEST_DIALOG:
- {
xResult.reset(new ScFTestDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_TTEST_DIALOG:
- {
xResult.reset(new ScTTestDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_ZTEST_DIALOG:
- {
xResult.reset(new ScZTestDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_CHI_SQUARE_TEST_DIALOG:
- {
xResult.reset(new ScChiSquareTestDialog(pB, pCW, pParent, &GetViewData()));
- }
- break;
+ break;
case SID_FOURIER_ANALYSIS_DIALOG:
- {
xResult.reset(new ScFourierAnalysisDialog(pB, pCW, pParent, &GetViewData()));
+ break;
+ case FID_DEFINE_NAME:
+ {
+ if (!mbInSwitch)
+ {
+ xResult.reset(new ScNameDlg(pB, pCW, pParent, &GetViewData(),
+ ScAddress( GetViewData().GetCurX(),
+ GetViewData().GetCurY(),
+ GetViewData().GetTabNo() ) ));
+ }
+ else
+ {
+ xResult.reset(new ScNameDlg( pB, pCW, pParent, &GetViewData(),
+ ScAddress( GetViewData().GetCurX(),
+ GetViewData().GetCurY(),
+ GetViewData().GetTabNo() ), &m_RangeMap));
+ static_cast<ScNameDlg*>(xResult.get())->SetEntry(maName, maScope);
+ mbInSwitch = false;
+ }
+ break;
}
- break;
}
if (xResult)
diff --git a/sc/uiconfig/scalc/ui/managenamesdialog.ui b/sc/uiconfig/scalc/ui/managenamesdialog.ui
index b1270204a381..8e8dbf91a409 100644
--- a/sc/uiconfig/scalc/ui/managenamesdialog.ui
+++ b/sc/uiconfig/scalc/ui/managenamesdialog.ui
@@ -1,14 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
- <requires lib="0" version="0.0"/>
- <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name text2 -->
+ <column type="gchararray"/>
+ <!-- column-name text1 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="ManageNamesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="managenamesdialog|ManageNamesDialog">Manage Names</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,13 +101,65 @@
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="svtlo-SvSimpleTableContainer" id="names">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Simple Table Container-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="names">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="managenamesdialog|name">Name</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="managenamesdialog|expression">Range or formula expression</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="managenamesdialog|scope">Scope</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer3"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -174,10 +242,11 @@
<property name="hexpand">True</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">42</property>
</object>
<packing>
@@ -187,7 +256,7 @@
</packing>
</child>
<child>
- <object class="foruilo-RefButton" id="assign">
+ <object class="GtkButton" id="assign">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -224,6 +293,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -388,11 +458,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
- <child>
- <placeholder/>
- </child>
</object>
- <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <object class="GtkTreeViewColumn" id="treeviewcolumn4">
<property name="title" translatable="yes" context="managenamesdialog|treeviewcolumn1">column</property>
</object>
</interface>
diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr
index 3da60df759a8..6b0b1ddaf1ef 100644
--- a/solenv/sanitizers/ui/modules/scalc.suppr
+++ b/solenv/sanitizers/ui/modules/scalc.suppr
@@ -120,6 +120,7 @@ sc/uiconfig/scalc/ui/managenamesdialog.ui://svtlo-SvSimpleTableContainer[@id='na
sc/uiconfig/scalc/ui/managenamesdialog.ui://GtkLabel[@id='info'] orphan-label
sc/uiconfig/scalc/ui/managenamesdialog.ui://GtkLabel[@id='label2'] orphan-label
sc/uiconfig/scalc/ui/managenamesdialog.ui://GtkEntry[@id='name'] no-labelled-by
+sc/uiconfig/scalc/ui/managenamesdialog.ui://GtkButton[@id='assign'] button-no-label
sc/uiconfig/scalc/ui/mergecellsdialog.ui://GtkLabel[@id='label'] orphan-label
sc/uiconfig/scalc/ui/mergecellsdialog.ui://GtkImage[@id='imMergeFirstCell'] no-labelled-by
sc/uiconfig/scalc/ui/mergecellsdialog.ui://GtkImage[@id='imMergeKeepHidden'] no-labelled-by
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 74716b18aa35..431aa0c1904e 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3764,6 +3764,14 @@ public:
SalInstanceWidget* pTargetWidget = dynamic_cast<SalInstanceWidget*>(pTarget);
pLabel->set_mnemonic_widget(pTargetWidget ? pTargetWidget->getWidget() : nullptr);
}
+
+ virtual void set_error(bool bShowError) override
+ {
+ if (bShowError)
+ m_xLabel->SetControlBackground(m_xLabel->GetSettings().GetStyleSettings().GetHighlightColor());
+ else
+ m_xLabel->SetControlBackground();
+ }
};
class SalInstanceTextView : public SalInstanceContainer, public virtual weld::TextView
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f7d138f5f538..1747184c3ac1 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7519,6 +7519,25 @@ public:
GtkInstanceWidget* pTargetWidget = dynamic_cast<GtkInstanceWidget*>(pTarget);
gtk_label_set_mnemonic_widget(m_pLabel, pTargetWidget ? pTargetWidget->getWidget() : nullptr);
}
+
+ virtual void set_error(bool bShowError) override
+ {
+ if (bShowError)
+ {
+ Color aColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
+
+ guint16 nRed = aColor.GetRed() << 8;
+ guint16 nGreen = aColor.GetRed() << 8;
+ guint16 nBlue = aColor.GetBlue() << 8;
+
+ PangoAttrList* pAttrs = pango_attr_list_new();
+ pango_attr_list_insert(pAttrs, pango_attr_background_new(nRed, nGreen, nBlue));
+ gtk_label_set_attributes(m_pLabel, pAttrs);
+ pango_attr_list_unref(pAttrs);
+ }
+ else
+ gtk_label_set_attributes(m_pLabel, nullptr);
+ }
};
class GtkInstanceTextView : public GtkInstanceContainer, public virtual weld::TextView
More information about the Libreoffice-commits
mailing list