summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-18 12:45:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-18 19:55:41 +0200
commit78c255519aac33b14c6d46fb963f8ecbbb80e67c (patch)
treedec5fd4991e3c487a35c70483a02a8b99ff21b43 /sc
parentb3f2fd983f0728893505d7ae12e3def924ab520f (diff)
ScViewData may not be available in ScNavigatorDlg ctor
e.g. launching the floating navigator before a document has been loaded. probably a problem since... commit 94512c499d678e9eeca05e84361d846bbd3b6950 Date: Tue May 26 21:03:25 2020 +0200 sc: rowcol: convert more use of MAXROWCOUNT Change-Id: I9f987c66b5a89f23e0ca02775d3bdb7b4dbf553a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103002 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/navipi.hxx1
-rw-r--r--sc/source/ui/navipi/navipi.cxx18
2 files changed, 14 insertions, 5 deletions
diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx
index 903b8a7f483e..43d48dc74f59 100644
--- a/sc/source/ui/inc/navipi.hxx
+++ b/sc/source/ui/inc/navipi.hxx
@@ -147,6 +147,7 @@ private:
static ScNavigatorSettings* GetNavigatorSettings();
ScViewData* GetViewData();
+ void UpdateSheetLimits();
void UpdateColumn ( const SCCOL* pCol = nullptr );
void UpdateRow ( const SCROW* pRow = nullptr );
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 1ff33a64cfd4..64b12b05902f 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -346,15 +346,11 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent)
{
set_id("NavigatorPanelParent"); // for uitests
- GetViewData();
- ScDocument& rDoc = pViewData->GetDocument();
- m_xEdRow->set_range(1, SCNAV_MAXROW(rDoc.GetSheetLimits()));
+ UpdateSheetLimits();
m_xEdRow->set_width_chars(5);
//max rows is 1,000,000, which is too long for typical use
m_xEdRow->connect_activate(LINK(this, ScNavigatorDlg, ExecuteRowHdl));
- m_xEdCol->set_range(1, SCNAV_MAXCOL(rDoc.GetSheetLimits()));
- m_xEdCol->set_width_chars(SCNAV_COLDIGITS(rDoc.GetSheetLimits())); // 1...256...18278 or A...IV...ZZZ
m_xEdCol->connect_activate(LINK(this, ScNavigatorDlg, ExecuteColHdl));
m_xEdCol->connect_output(LINK(this, ScNavigatorDlg, FormatRowOutputHdl));
m_xEdCol->connect_input(LINK(this, ScNavigatorDlg, ParseRowInputHdl));
@@ -423,6 +419,17 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent)
aExpandedSize = GetOptimalSize();
}
+void ScNavigatorDlg::UpdateSheetLimits()
+{
+ if (ScViewData* pData = GetViewData())
+ {
+ ScDocument& rDoc = pData->GetDocument();
+ m_xEdRow->set_range(1, SCNAV_MAXROW(rDoc.GetSheetLimits()));
+ m_xEdCol->set_range(1, SCNAV_MAXCOL(rDoc.GetSheetLimits()));
+ m_xEdCol->set_width_chars(SCNAV_COLDIGITS(rDoc.GetSheetLimits())); // 1...256...18278 or A...IV...ZZZ
+ }
+}
+
void ScNavigatorDlg::StateChanged(StateChangedType nStateChange)
{
PanelLayout::StateChanged(nStateChange);
@@ -474,6 +481,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if (pHint->GetEventId() == SfxEventHintId::ActivateDoc)
{
+ UpdateSheetLimits();
m_xLbEntries->ActiveDocChanged();
UpdateAll();
}