summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2020-03-01 02:03:56 +0100
committerEike Rathke <erack@redhat.com>2020-03-01 16:52:34 +0100
commita209ec58ff5893823ed0b7a11e8463c38df86739 (patch)
treee2430949686b8c6d063591c4f457909277436f2c /sc
parent4c483204edc5ab5da4b40eb92fd69c6d87d11505 (diff)
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 <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/document10.cxx9
-rw-r--r--sc/source/ui/docshell/docsh.cxx7
-rw-r--r--sc/source/ui/inc/docsh.hxx4
3 files changed, 20 insertions, 0 deletions
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();