sw/source/uibase/inc/navipi.hxx | 1 sw/source/uibase/utlui/content.cxx | 9 ++++-- sw/source/uibase/utlui/navipi.cxx | 52 ++++--------------------------------- 3 files changed, 13 insertions(+), 49 deletions(-)
New commits: commit d034a0da1a298bb129d7a7cecff460794649dea0 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Sun Dec 31 15:53:11 2023 -0900 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Wed Jan 24 08:16:45 2024 +0100 SwNavigator: status array no more What REGIONMODE_ARY has to do with the active, inactive, and hidden status of documents shown in the document list box is beyond me. This patch removes this strangeness and fixes the 'Active Window' entry so when selected the content tree shows the content of the document entry appended with (active), which is always the document in the view afaik. My guess at the idea for the 'Active Window' entry is to not have to search for the entry marked 'active'. Change-Id: I27a8183fb430e9d5ef465dae323319cdb397fc4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161510 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index f87474ab7cba..1d899f15acc5 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -72,7 +72,6 @@ class SwNavigationPI final : public PanelLayout std::unique_ptr<weld::ComboBox> m_xDocListBox; Idle m_aPageChgIdle; OUString m_sContentFileName; - OUString m_aStatusArr[4]; VclPtr<SfxNavigator> m_xNavigatorDlg; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index f753547173b4..86e94f754841 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -5318,11 +5318,14 @@ void SwContentTree::ShowHiddenShell() } // Mode Change: Show active view +// only called from IMPL_LINK(SwNavigationPI, DocListBoxSelectHdl, weld::ComboBox&, rBox, void) void SwContentTree::ShowActualView() { - m_eState = State::ACTIVE; - Display(true); - GetParentWindow()->UpdateListBox(); + if (SwView* pView = m_pDialog->GetCreateView()) + { + SetConstantShell(pView->GetWrtShellPtr()); + m_pDialog->UpdateListBox(); + } } IMPL_LINK_NOARG(SwContentTree, SelectHdl, weld::TreeView&, void) diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 3fd5b7f9b682..c3929875becc 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -487,17 +487,6 @@ void SwNavigationPI::ZoomIn() m_xContent6ToolBox->set_item_active("listbox", false); } -namespace { - -enum StatusIndex -{ - IDX_STR_HIDDEN = 0, - IDX_STR_ACTIVE = 1, - IDX_STR_INACTIVE = 2 -}; - -} - std::unique_ptr<PanelLayout> SwNavigationPI::Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -637,30 +626,6 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContent1ToolBox->set_item_visible("contenttoggle", false); } - const TranslateId REGIONNAME_ARY[] = - { - STR_HYPERLINK, - STR_LINK_REGION, - STR_COPY_REGION - }; - - const TranslateId REGIONMODE_ARY[] = - { - STR_HIDDEN, - STR_ACTIVE, - STR_INACTIVE - }; - - static_assert(SAL_N_ELEMENTS(REGIONNAME_ARY) == SAL_N_ELEMENTS(REGIONMODE_ARY), "### unexpected size!"); - static_assert(SAL_N_ELEMENTS(REGIONNAME_ARY) == static_cast<sal_uInt16>(RegionMode::EMBEDDED) + 1, "### unexpected size!"); - - for (sal_uInt16 i = 0; i <= static_cast<sal_uInt16>(RegionMode::EMBEDDED); ++i) - { - m_aStatusArr[i] = SwResId(REGIONMODE_ARY[i]); - } - - m_aStatusArr[3] = SwResId(STR_ACTIVE_VIEW); - bool bFloatingNavigator = ParentIsFloatingWindow(m_xNavigatorDlg); SetRegionDropMode(m_pConfig->GetRegionMode()); @@ -723,7 +688,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContentTree->set_accessible_name(SwResId(STR_ACCESS_TL_CONTENT)); m_xGlobalTree->set_accessible_name(SwResId(STR_ACCESS_TL_GLOBAL)); - m_xDocListBox->set_accessible_name(m_aStatusArr[3]); + m_xDocListBox->set_accessible_name(SwResId(STR_ACTIVE_VIEW)); m_aExpandedSize = m_xContainer->get_preferred_size(); @@ -930,10 +895,10 @@ void SwNavigationPI::UpdateListBox() if (pView == pActView) { nAct = nCount; - sEntry += m_aStatusArr[IDX_STR_ACTIVE]; + sEntry += SwResId(STR_ACTIVE); } else - sEntry += m_aStatusArr[IDX_STR_INACTIVE]; + sEntry += SwResId(STR_INACTIVE); sEntry += ")"; m_xDocListBox->append_text(sEntry); @@ -944,16 +909,13 @@ void SwNavigationPI::UpdateListBox() } pView = SwModule::GetNextView(pView); } - m_xDocListBox->append_text(m_aStatusArr[3]); // "Active Window" + m_xDocListBox->append_text(SwResId(STR_ACTIVE_VIEW)); // "Active Window" nCount++; - if(m_xContentTree->GetHiddenWrtShell()) + if (SwWrtShell* pHiddenWrtShell = m_xContentTree->GetHiddenWrtShell()) { - OUString sEntry = m_xContentTree->GetHiddenWrtShell()->GetView(). - GetDocShell()->GetTitle() + - " (" + - m_aStatusArr[IDX_STR_HIDDEN] + - ")"; + OUString sEntry = pHiddenWrtShell->GetView().GetDocShell()->GetTitle() + + " (" + SwResId(STR_HIDDEN) + ")"; m_xDocListBox->append_text(sEntry); bDisable = false; }