include/sfx2/lokhelper.hxx     |    3 +++
 sfx2/source/view/lokhelper.cxx |   20 +++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

New commits:
commit 93d0b3def82eef8dfd8a6dbd3297146019290d82
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Jul 23 16:46:41 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Jul 24 15:50:17 2025 +0200

    split ambiguous SfxLokHelper::getView into unambiguous parts
    
    keep the original for the moment
    
    Change-Id: I3832a1ebce9ac93f77fdf0d32fbdaae65538b5e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188276
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index feb8048331fb..ad3b35feee30 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -103,7 +103,10 @@ public:
     static void setEditMode(int nMode, vcl::ITiledRenderable* pDoc);
     /// Get view shell with id
     static SfxViewShell* getViewOfId(int nId);
+    /// Get view id of view shell
+    static int getView(const SfxViewShell& rViewShell);
     /// Get the currently active view.
+    static int getCurrentView();
     static int getView(const SfxViewShell* pViewShell = nullptr);
     /// Get the number of views of the current DocId.
     static std::size_t getViewsCount(int nDocId);
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index cc09eda66683..7de96cad8436 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -225,15 +225,25 @@ SfxViewShell* SfxLokHelper::getViewOfId(int nId)
     return nullptr;
 }
 
-int SfxLokHelper::getView(const SfxViewShell* pViewShell)
+int SfxLokHelper::getView(const SfxViewShell& rViewShell)
 {
-    if (!pViewShell)
-        pViewShell = SfxViewShell::Current();
-    // Still no valid view shell? Then no idea.
+    return static_cast<sal_Int32>(rViewShell.GetViewShellId());
+}
+
+int SfxLokHelper::getCurrentView()
+{
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    // No valid view shell? Then no idea.
     if (!pViewShell)
         return -1;
+    return SfxLokHelper::getView(*pViewShell);
+}
 
-    return static_cast<sal_Int32>(pViewShell->GetViewShellId());
+int SfxLokHelper::getView(const SfxViewShell* pViewShell)
+{
+    if (pViewShell)
+        return SfxLokHelper::getView(*pViewShell);
+    return SfxLokHelper::getCurrentView();
 }
 
 std::size_t SfxLokHelper::getViewsCount(int nDocId)

Reply via email to