sc/inc/strings.hrc | 1 sc/source/ui/inc/content.hxx | 3 - sc/source/ui/inc/navipi.hxx | 1 sc/source/ui/navipi/content.cxx | 95 ++++++++++------------------------------ sc/source/ui/navipi/navipi.cxx | 1 5 files changed, 26 insertions(+), 75 deletions(-)
New commits: commit c76fb134281a3d1fd56f8a6d07ad7111c85e17b9 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Oct 6 15:45:13 2023 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Oct 6 21:32:38 2023 +0200 bHiddenDoc is always false and aHiddenName is always empty Change-Id: I05259fb648f9e1e96ac5b0f0a4d68ba9a68b89b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157652 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index 5a14cb48b4a4..2e8c6757e202 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -49,9 +49,6 @@ class ScContentTree o3tl::enumarray<ScContentId, std::unique_ptr<weld::TreeIter>> m_aRootNodes; ScContentId nRootType; // set as Root OUString aManualDoc; // Switched in Navigator (Title) - bool bHiddenDoc; // Hidden active? - OUString aHiddenName; // URL to load - ScDocument* pHiddenDocument; // temporary bool bIsInNavigatorDlg; bool m_bFreeze; ImplSVEvent* m_nAsyncMouseReleaseId; diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 1af85b31d051..58bb28668b4d 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -124,8 +124,6 @@ ScContentTree::ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNaviga , m_xTransferObj(new ScLinkTransferObj) , pParentWindow(pNavigatorDlg) , nRootType(ScContentId::ROOT) - , bHiddenDoc(false) - , pHiddenDocument(nullptr) , bIsInNavigatorDlg(false) , m_bFreeze(false) , m_nAsyncMouseReleaseId(nullptr) @@ -326,9 +324,6 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, weld::TreeView&, bool) if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD)) { - if ( bHiddenDoc ) - return false; //! later... - OUString aText(m_xTreeView->get_text(*xEntry)); if ( !aManualDoc.isEmpty() ) @@ -471,8 +466,6 @@ IMPL_LINK(ScContentTree, KeyInputHdl, const KeyEvent&, rKEvt, bool) if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD)) { - if ( bHiddenDoc ) - return true; //! later... OUString aText(m_xTreeView->get_text(*xEntry)); if (!aManualDoc.isEmpty()) pParentWindow->SetCurrentDoc( aManualDoc ); @@ -575,7 +568,7 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) ++i; sId = "document" + OUString::number(i); xDocMenu->append_radio(sId, aEntry); - if ( !bHiddenDoc && aName == aManualDoc ) + if (aName == aManualDoc) sActive = sId; } pSh = SfxObjectShell::GetNext( *pSh ); @@ -584,7 +577,7 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) ++i; sId = "document" + OUString::number(i); xDocMenu->append_radio(sId, pParentWindow->aStrActiveWin); - if (!bHiddenDoc && aManualDoc.isEmpty()) + if (aManualDoc.isEmpty()) sActive = sId; xDocMenu->set_active(sActive, true); @@ -643,25 +636,15 @@ IMPL_LINK(ScContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin ScDocument* ScContentTree::GetSourceDocument() { - if (bHiddenDoc) - return pHiddenDocument; - else - { - ScDocShell* pSh = GetManualOrCurrent(); - if (pSh) - return &pSh->GetDocument(); - - } + ScDocShell* pSh = GetManualOrCurrent(); + if (pSh) + return &pSh->GetDocument(); return nullptr; } void ScContentTree::Refresh( ScContentId nType ) { - if ( bHiddenDoc && !pHiddenDocument ) - return; // other document displayed - // if nothing has changed the cancel right away (against flicker) - if ( nType == ScContentId::NOTE ) if (!NoteStringsChanged()) return; @@ -1189,8 +1172,6 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) bool bDisallow = true; - std::unique_ptr<ScDocumentLoader> pDocLoader; - ScModule* pScMod = SC_MOD(); ScContentId nType; @@ -1212,18 +1193,13 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) ScDocument* pLocalDoc = nullptr; // for URL drop OUString aDocName; - if (bHiddenDoc) - aDocName = aHiddenName; - else + ScDocShell* pDocSh = GetManualOrCurrent(); + if (pDocSh) { - ScDocShell* pDocSh = GetManualOrCurrent(); - if (pDocSh) - { - if (pDocSh->HasName()) - aDocName = pDocSh->GetMedium()->GetName(); - else - pLocalDoc = &pDocSh->GetDocument(); // drop only in this document - } + if (pDocSh->HasName()) + aDocName = pDocSh->GetMedium()->GetName(); + else + pLocalDoc = &pDocSh->GetDocument(); // drop only in this document } bool bDoLinkTrans = false; // use ScLinkTransferObj @@ -1276,18 +1252,7 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) break; case SC_DROPMODE_COPY: { - ScDocShell* pSrcShell = nullptr; - if ( bHiddenDoc ) - { - OUString aFilter, aOptions; - OUString aURL = aHiddenName; - pDocLoader.reset(new ScDocumentLoader( aURL, aFilter, aOptions )); - if (!pDocLoader->IsError()) - pSrcShell = pDocLoader->GetDocShell(); - } - else - pSrcShell = GetManualOrCurrent(); - + ScDocShell* pSrcShell = GetManualOrCurrent(); if ( pSrcShell ) { ScDocument& rSrcDoc = pSrcShell->GetDocument(); @@ -1379,7 +1344,6 @@ void ScContentTree::ToggleRoot() // after selection void ScContentTree::ResetManualDoc() { aManualDoc.clear(); - bHiddenDoc = false; ActiveDocChanged(); } @@ -1388,7 +1352,7 @@ bool ScContentTree::ActiveDocChanged() { bool bRefreshed = false; - if ( !bHiddenDoc && aManualDoc.isEmpty() ) + if (aManualDoc.isEmpty()) { Refresh(); // content only if automatic bRefreshed = true; @@ -1397,25 +1361,22 @@ bool ScContentTree::ActiveDocChanged() // if flag active Listbox must be updated OUString aCurrent; - if ( bHiddenDoc ) - aCurrent = OUString(); + + ScDocShell* pSh = GetManualOrCurrent(); + if (pSh) + aCurrent = pSh->GetTitle(); else { - ScDocShell* pSh = GetManualOrCurrent(); + // document is no longer available + + aManualDoc.clear(); // again automatically + Refresh(); + bRefreshed = true; + pSh = GetManualOrCurrent(); // should be active now if (pSh) aCurrent = pSh->GetTitle(); - else - { - // document is no longer available - - aManualDoc.clear(); // again automatically - Refresh(); - bRefreshed = true; - pSh = GetManualOrCurrent(); // should be active now - if (pSh) - aCurrent = pSh->GetTitle(); - } } + pParentWindow->GetDocNames( &aCurrent ); // select return bRefreshed; @@ -1424,11 +1385,8 @@ bool ScContentTree::ActiveDocChanged() void ScContentTree::SetManualDoc(const OUString& rName) { aManualDoc = rName; - if (!bHiddenDoc) - { - Refresh(); - pParentWindow->GetDocNames( &aManualDoc ); // select - } + Refresh(); + pParentWindow->GetDocNames( &aManualDoc ); // select } void ScContentTree::SelectDoc(const OUString& rName) // rName like shown in Menu/Listbox @@ -1465,7 +1423,6 @@ void ScContentTree::SelectDoc(const OUString& rName) // rName like shown in if (bLoaded) { - bHiddenDoc = false; SetManualDoc(aRealName); } else commit 9748e84e17f05f4345f3e2f1d20478389666e469 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Oct 6 15:40:31 2023 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Oct 6 21:32:31 2023 +0200 aStrHidden and SCSTR_HIDDEN are unused Change-Id: Ieac2d95be89da53a2dc0971df4700b222191b419 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157651 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index cfc1eae6f7c2..7767da4abd6a 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -170,7 +170,6 @@ #define SCSTR_CONTENT_DRAWING NC_("SCSTR_CONTENT_DRAWING", "Drawing objects") #define SCSTR_ACTIVE NC_("SCSTR_ACTIVE", "active" ) #define SCSTR_NOTACTIVE NC_("SCSTR_NOTACTIVE", "inactive" ) -#define SCSTR_HIDDEN NC_("SCSTR_HIDDEN", "hidden" ) #define SCSTR_ACTIVEWIN NC_("SCSTR_ACTIVEWIN", "Active Window" ) #define SCSTR_QHLP_SCEN_LISTBOX NC_("SCSTR_QHLP_SCEN_LISTBOX", "Scenario Name") #define SCSTR_QHLP_SCEN_COMMENT NC_("SCSTR_QHLP_SCEN_COMMENT", "Comment") diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 5a1ae392e403..dbaae24657b6 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -111,7 +111,6 @@ private: OUString aStrActive; OUString aStrNotActive; - OUString aStrHidden; OUString aStrActiveWin; std::optional<ScArea> moMarkArea; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index ad5e149e9028..5fc6fee82122 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -382,7 +382,6 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNaviga m_xLbDocuments->connect_changed(LINK(this, ScNavigatorDlg, DocumentSelectHdl)); aStrActive = " (" + ScResId(SCSTR_ACTIVE) + ")"; // " (active)" aStrNotActive = " (" + ScResId(SCSTR_NOTACTIVE) + ")"; // " (not active)" - aStrHidden = " (" + ScResId(SCSTR_HIDDEN) + ")"; // " (hidden)" rBindings.ENTERREGISTRATIONS();