summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-01-29 11:42:27 -0500
committerEike Rathke <erack@redhat.com>2014-01-30 23:15:36 +0000
commit383e5543593848cbd1458d5c5dad5e7b7b17ee09 (patch)
tree346954491f4713d441de26e2961f2e97e039f2fa
parent88eee0c3d591b210257298f3fd094727bd0dc05e (diff)
fdo#74014: More on broadcasting at appropriate places.
Also, call PostDataChanged() to re-paint re-calculated formula cells, and brodcast only when pasting, not during file import. (cherry picked from commit 8a36879eaf0977448b113c2239014d2e2b7ab258) (cherry picked from commit 3d869cda8db03820dea8c4ba463eb155d05e933b) Conflicts: sc/source/core/data/documen7.cxx sc/source/ui/undo/undobase.cxx sc/qa/unit/ucalc.cxx Change-Id: I63161329d4bfe937f754773fd68c37e3836c4950 Reviewed-on: https://gerrit.libreoffice.org/7727 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/source/core/data/documen7.cxx24
-rw-r--r--sc/source/ui/docshell/impex.cxx19
-rw-r--r--sc/source/ui/inc/impex.hxx2
-rw-r--r--sc/source/ui/undo/undobase.cxx20
-rw-r--r--sc/source/ui/view/viewfun5.cxx1
6 files changed, 45 insertions, 23 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 65d573f5de24..665fb3589a02 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1809,6 +1809,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 7dd9821fea56..210d87bd64d7 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -104,6 +104,30 @@ 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 )
{
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 1ca265e2c6be..5b58b4e73ecb 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -88,7 +88,7 @@ ScImportExport::ScImportExport( ScDocument* p )
bFormulas( false ), bIncludeFiltered( true ),
bAll( true ), bSingle( true ), bUndo( false ),
bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
- mbApi( true ), mExportTextOptions()
+ mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -104,7 +104,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt )
bFormulas( false ), bIncludeFiltered( true ),
bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ),
bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
- mbApi( true ), mExportTextOptions()
+ mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -121,7 +121,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScRange& r )
bFormulas( false ), bIncludeFiltered( true ),
bAll( false ), bSingle( false ), bUndo( pDocSh != NULL ),
bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
- mbApi( true ), mExportTextOptions()
+ mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -139,7 +139,7 @@ ScImportExport::ScImportExport( ScDocument* p, const OUString& rPos )
bFormulas( false ), bIncludeFiltered( true ),
bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ),
bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
- mbApi( true ), mExportTextOptions()
+ mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -946,6 +946,12 @@ bool ScImportExport::Text2Doc( SvStream& rStrm )
}
EndPaste();
+ if (bOk && mbImportBroadcast)
+ {
+ pDoc->BroadcastCells(aRange, SC_HINT_DATACHANGED);
+ pDocSh->PostDataChanged();
+ }
+
return bOk;
}
@@ -1483,6 +1489,11 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
if (bRangeIsDetermined)
EndPaste(false);
+ if (mbImportBroadcast)
+ {
+ pDoc->BroadcastCells(aRange, SC_HINT_DATACHANGED);
+ pDocSh->PostDataChanged();
+ }
return true;
}
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index 43561540d662..b21511d8ed2d 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -65,6 +65,7 @@ class ScImportExport
bool bOverflowCol; // too many columns
bool bOverflowCell; // too much data for a cell
bool mbApi;
+ bool mbImportBroadcast; // whether or not to broadcast after data import.
ScExportTextOptions mExportTextOptions;
ScAsciiOptions* pExtOptions; // extended options
@@ -151,6 +152,7 @@ public:
bool IsApi() const { return mbApi; }
void SetApi( bool bApi ) { mbApi = bApi; }
+ void SetImportBroadcast( bool b ) { mbImportBroadcast = b; }
const ScExportTextOptions& GetExportTextOptions() { return mExportTextOptions; }
void SetExportTextOptions( const ScExportTextOptions& options ) { mExportTextOptions = options; }
};
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 178ec573bb7d..77f83456e684 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -145,25 +145,7 @@ void ScSimpleUndo::EndRedo()
void ScSimpleUndo::BroadcastChanges( const ScRange& rRange )
{
ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->CellContentModified();
-
- 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 )
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 0d4c1311d8b5..7b22da5cac04 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -288,6 +288,7 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
{
ScAddress aCellPos( nPosX, nPosY, GetViewData()->GetTabNo() );
ScImportExport aObj( GetViewData()->GetDocument(), aCellPos );
+ aObj.SetImportBroadcast(true);
OUString aStr;
SotStorageStreamRef xStream;