sc/source/ui/inc/xmlsourcedlg.hxx       |    4 ++--
 sc/source/ui/view/tabvwshc.cxx          |    2 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |   12 ++++++------
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 829b1ec454aeb6d9c84c7b09afc893663d011f38
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Jun 25 12:23:43 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Jun 25 16:44:23 2025 +0200

    ScXMLSourceDlg: pass ScDocument by ref
    
    Change-Id: I00dc0cfa8f9001807b0c7c7d69b20fa7d3537a22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186966
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx 
b/sc/source/ui/inc/xmlsourcedlg.hxx
index bc639d4a47f3..e5e7acf5a38b 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -40,7 +40,7 @@ class ScXMLSourceDlg : public ScAnyRefDlgController
     std::unique_ptr<weld::TreeIter> mxCurRefEntry;
     std::unique_ptr<ScOrcusXMLContext> mpXMLContext;
 
-    ScDocument* mpDoc;
+    ScDocument& mrDoc;
     bool mbDlgLostFocus;
 
     formula::RefEdit* mpActiveEdit;
@@ -62,7 +62,7 @@ class ScXMLSourceDlg : public ScAnyRefDlgController
     std::set<std::unique_ptr<weld::TreeIter>, CustomCompare> maRangeLinks;
 
 public:
-    ScXMLSourceDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* 
pParent, ScDocument* pDoc);
+    ScXMLSourceDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* 
pParent, ScDocument& rDoc);
     virtual ~ScXMLSourceDlg() override;
 
     virtual bool IsRefInputMode() const override;
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 8aceaab2f36b..4cff2bdcadc2 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -395,7 +395,7 @@ std::shared_ptr<SfxModelessDialogController> 
ScTabViewShell::CreateRefDialogCont
         }
         case SID_MANAGE_XML_SOURCE:
         {
-            xResult = std::make_shared<ScXMLSourceDlg>(pB, pCW, pParent, 
&rDoc);
+            xResult = std::make_shared<ScXMLSourceDlg>(pB, pCW, pParent, rDoc);
             break;
         }
         case SID_OPENDLG_PIVOTTABLE:
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 65047b7e0e4b..fd29d13f93ea 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -63,9 +63,9 @@ OUString getXPath(
 }
 
 ScXMLSourceDlg::ScXMLSourceDlg(
-    SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScDocument* 
pDoc)
+    SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScDocument& 
rDoc)
     : ScAnyRefDlgController(pB, pCW, pParent, 
u"modules/scalc/ui/xmlsourcedialog.ui"_ustr, u"XMLSourceDialog"_ustr)
-    , mpDoc(pDoc)
+    , mrDoc(rDoc)
     , mbDlgLostFocus(false)
     , mxBtnSelectSource(m_xBuilder->weld_button(u"selectsource"_ustr))
     , mxFtSourceFile(m_xBuilder->weld_label(u"sourcefile"_ustr))
@@ -192,7 +192,7 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const 
OUString& rPath)
     if (!pOrcus)
         return;
 
-    mpXMLContext = pOrcus->createXMLContext(*mpDoc, rPath);
+    mpXMLContext = pOrcus->createXMLContext(mrDoc, rPath);
     if (!mpXMLContext)
         return;
 
@@ -250,7 +250,7 @@ void ScXMLSourceDlg::TreeItemSelected()
     const ScAddress& rPos = pUserData->maLinkedPos;
     if (rPos.IsValid())
     {
-        OUString aStr(rPos.Format(ScRefFlags::ADDR_ABS_3D, mpDoc, 
mpDoc->GetAddressConvention()));
+        OUString aStr(rPos.Format(ScRefFlags::ADDR_ABS_3D, &mrDoc, 
mrDoc.GetAddressConvention()));
         mxRefEdit->SetRefString(aStr);
     }
     else
@@ -532,7 +532,7 @@ void ScXMLSourceDlg::OkPressed()
     mpXMLContext->importXML(aParam);
 
     // Don't forget to broadcast the change.
-    ScDocShell* pShell = mpDoc->GetDocumentShell();
+    ScDocShell* pShell = mrDoc.GetDocumentShell();
     pShell->Broadcast(SfxHint(SfxHintId::ScDataChanged));
 
     // Repaint the grid to force repaint the cell values.
@@ -556,7 +556,7 @@ void ScXMLSourceDlg::RefEditModified()
     // Preset current sheet in case only address was entered.
     ScAddress aLinkedPos;
     aLinkedPos.SetTab( ScDocShell::GetCurTab());
-    ScRefFlags nRes = aLinkedPos.Parse(aRefStr, *mpDoc, 
mpDoc->GetAddressConvention());
+    ScRefFlags nRes = aLinkedPos.Parse(aRefStr, mrDoc, 
mrDoc.GetAddressConvention());
     bool bValid = ( (nRes & ScRefFlags::VALID) == ScRefFlags::VALID );
 
     // TODO: For some unknown reason, setting the ref invalid will hide the 
text altogether.

Reply via email to