sc/source/core/data/document10.cxx | 9 +++++++++ sc/source/ui/docshell/docsh.cxx | 7 +++++++ sc/source/ui/inc/docsh.hxx | 4 ++++ 3 files changed, 20 insertions(+)
New commits: commit a209ec58ff5893823ed0b7a11e8463c38df86739 Author: Eike Rathke <[email protected]> AuthorDate: Sun Mar 1 02:03:56 2020 +0100 Commit: Eike Rathke <[email protected]> CommitDate: Sun Mar 1 16:52:34 2020 +0100 Related: tdf#130371 Broadcast ScAreasChanged for created names ... to notify the Name Box to refresh its name list. Change-Id: I20fb461d59c0dd98698837d91e2a7ef9a8c5a4ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89768 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index 1afe7a378ac1..3b67bb6c3af1 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -26,6 +26,7 @@ #include <editeng/colritem.hxx> #include <scitems.hxx> #include <datamapper.hxx> +#include <docsh.hxx> // Add totally brand-new methods to this source file. @@ -884,7 +885,15 @@ bool ScDocument::CopyAdjustRangeName( SCTAB& rSheet, sal_uInt16& rIndex, ScRange rpRangeData = copyRangeName( pOldRangeData, rNewDoc, this, rNewPos, rOldPos, bGlobalNamesToLocal, nOldSheet, nNewSheet, bSameDoc); } + + if (rpRangeData && !rNewDoc.IsClipOrUndo()) + { + ScDocShell* pDocSh = static_cast<ScDocShell*>(rNewDoc.GetDocumentShell()); + if (pDocSh) + pDocSh->SetAreasChangedNeedBroadcast(); + } } + rSheet = nNewSheet; rIndex = rpRangeData ? rpRangeData->GetIndex() : 0; // 0 means not inserted return true; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index aee27cb1b13f..fe810fd164c4 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2743,6 +2743,7 @@ ScDocShell::ScDocShell( const SfxModelFlags i_nSfxCreationFlags ) : m_bDocumentModifiedPending( false ), m_bUpdateEnabled ( true ), m_bUcalcTest ( false ), + m_bAreasChangedNeedBroadcast( false ), m_nDocumentLock ( 0 ), m_nCanUpdate (css::document::UpdateDocMode::ACCORDING_TO_CONFIG) { @@ -2863,6 +2864,12 @@ void ScDocShell::SetDocumentModified() m_aDocument.SetDetectiveDirty(false); // always reset, also if not refreshed } + if (m_bAreasChangedNeedBroadcast) + { + m_bAreasChangedNeedBroadcast = false; + SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreasChanged)); + } + // notify UNO objects after BCA_BRDCST_ALWAYS etc. m_aDocument.BroadcastUno( SfxHint( SfxHintId::DataChanged ) ); } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 30056ed5bb75..b06c121e25e5 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -99,6 +99,7 @@ class SC_DLLPUBLIC ScDocShell final: public SfxObjectShell, public SfxListener bool m_bDocumentModifiedPending:1; bool m_bUpdateEnabled:1; bool m_bUcalcTest:1; // avoid loading the styles in the ucalc test + bool m_bAreasChangedNeedBroadcast:1; sal_uInt16 m_nDocumentLock; sal_Int16 m_nCanUpdate; // stores the UpdateDocMode from loading a document till update links @@ -385,6 +386,9 @@ public: void SetUpdateEnabled(bool bValue) { m_bUpdateEnabled = bValue; } + void SetAreasChangedNeedBroadcast() + { m_bAreasChangedNeedBroadcast = true; } + OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice... static ScViewData* GetViewData(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
