diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-29 11:42:27 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-29 15:46:05 -0500 |
commit | 8a36879eaf0977448b113c2239014d2e2b7ab258 (patch) | |
tree | b74c0651240d114164b8af68821272aef0c885e9 | |
parent | 76599f3ca36810379a2dda7826aa3cd0f4441cfb (diff) |
fdo#74014: More on broadcasting at appropriate places.
Also, call PostDataChanged() to re-paint re-calculated formula cells.
Change-Id: I63161329d4bfe937f754773fd68c37e3836c4950
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen7.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/undo/undobase.cxx | 22 |
4 files changed, 36 insertions, 21 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6a980ab298f2..5fb5f6d0c236 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1808,6 +1808,8 @@ public: */ void Broadcast( const ScHint& rHint ); + void BroadcastCells( const ScRange& rRange, sal_uLong nHint ); + /// only area, no cell broadcast void AreaBroadcast( const ScHint& rHint ); /// only areas in range, no cell broadcasts diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index b8f691b91a00..210d87bd64d7 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -104,6 +104,31 @@ void ScDocument::Broadcast( const ScHint& rHint ) } } +void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint ) +{ + CellContentModified(); + + ScBulkBroadcast aBulkBroadcast(pBASM); + + ScHint aHint(nHint, ScAddress()); + ScAddress& rPos = aHint.GetAddress(); + for (SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); ++nTab) + { + rPos.SetTab(nTab); + for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol) + { + rPos.SetCol(nCol); + for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow) + { + rPos.SetRow(nRow); + Broadcast(aHint); + } + } + } + + BroadcastUno(SfxSimpleHint(SC_HINT_DATACHANGED)); +} + void ScDocument::AreaBroadcast( const ScHint& rHint ) { if ( !pBASM ) diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index c6ebff140c34..bf1c0483d852 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -947,6 +947,12 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) } EndPaste(); + if (bOk) + { + pDoc->BroadcastCells(aRange, SC_HINT_DATACHANGED); + pDocSh->PostDataChanged(); + } + return bOk; } @@ -1484,6 +1490,8 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) if (bRangeIsDetermined) EndPaste(false); + pDoc->BroadcastCells(aRange, SC_HINT_DATACHANGED); + pDocSh->PostDataChanged(); return true; } diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index fdb2cfc5d478..16cabf6fc2c1 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -146,27 +146,7 @@ void ScSimpleUndo::EndRedo() void ScSimpleUndo::BroadcastChanges( const ScRange& rRange ) { ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->CellContentModified(); - - ScBulkBroadcast aBulkBroadcast( pDoc->GetBASM()); - - ScHint aHint(SC_HINT_DATACHANGED, ScAddress()); - ScAddress& rPos = aHint.GetAddress(); - for (SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); ++nTab) - { - rPos.SetTab(nTab); - for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol) - { - rPos.SetCol(nCol); - for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow) - { - rPos.SetRow(nRow); - pDoc->Broadcast(aHint); - } - } - } - - pDoc->BroadcastUno(SfxSimpleHint(SC_HINT_DATACHANGED)); + pDoc->BroadcastCells(rRange, SC_HINT_DATACHANGED); } void ScSimpleUndo::ShowTable( SCTAB nTab ) |