summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2013-09-28 14:48:59 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-10-15 13:26:10 +0100
commita1077b3cbdb847a452fccd15d9b834bc262cfb62 (patch)
tree68b006b881ac12da5b8faf2151bab0d02db8598d
parent8552e5fa1c56bb3ed7c86ef3c4922635e4178ebc (diff)
fdo#47958: gross cut/paste signal emission nonsense
Change-Id: I60b7a4c5b80410429e5489ee6517bbda8cf328dd
-rw-r--r--sc/source/ui/inc/docsh.hxx30
-rw-r--r--sc/source/ui/undo/undoblk3.cxx20
-rw-r--r--sc/source/ui/undo/undocell.cxx16
-rw-r--r--sc/source/ui/view/viewfun2.cxx20
-rw-r--r--sc/source/ui/view/viewfun3.cxx26
-rw-r--r--sc/source/ui/view/viewfunc.cxx74
6 files changed, 93 insertions, 93 deletions
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 964c3ee868c9..4159dd583c9e 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -35,6 +35,7 @@
#include "shellids.hxx"
#include "refreshtimer.hxx"
#include "optutil.hxx"
+#include "docuno.hxx"
#include <boost/unordered_map.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -62,6 +63,7 @@ class ScDocShellModificator;
class ScOptSolverSave;
class ScSheetSaveData;
class ScFlatBoolRowSegments;
+class HelperModelObj;
struct ScColWidthParam;
#if ENABLE_TELEPATHY
class ScCollaboration;
@@ -473,6 +475,34 @@ public:
void SetDocumentModified();
};
+class HelperNotifyChanges
+{
+ private:
+ ScModelObj* pModelObj;
+ bool mbMustPropagateChanges;
+ ScRangeList* mpChangeRanges;
+ OUString mpOperation;
+
+ public:
+ HelperNotifyChanges(ScRangeList* pChangeRanges, const OUString& pOperation)
+ {
+ mpChangeRanges = pChangeRanges;
+ mpOperation = pOperation;
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ mbMustPropagateChanges = true;
+ }
+ ~HelperNotifyChanges()
+ {
+ if (mbMustPropagateChanges && mpChangeRanges)
+ {
+ pModelObj->NotifyChanges(mpOperation, *mpChangeRanges);
+ }
+ }
+ bool getMustPropagateChanges()
+ {
+ return mbMustPropagateChanges;
+ }
+};
#endif
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 00ae959cc6c1..785a253bc5bb 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -182,13 +182,11 @@ void ScUndoDeleteContents::Undo()
DoChange( sal_True );
EndUndo();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
- aChangeRanges.Append( aRange );
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
+ aChangeRanges.Append(aRange);
}
}
@@ -198,13 +196,11 @@ void ScUndoDeleteContents::Redo()
DoChange( false );
EndRedo();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
- aChangeRanges.Append( aRange );
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
+ aChangeRanges.Append(aRange);
}
}
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 24f27a9ef637..710105601dc5 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -260,16 +260,14 @@ void ScUndoEnterData::Undo()
DoChange();
EndUndo();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
for (size_t i = 0, n = maOldValues.size(); i < n; ++i)
{
aChangeRanges.Append( ScRange(maPos.Col(), maPos.Row(), maOldValues[i].mnTab));
}
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
}
}
@@ -299,16 +297,14 @@ void ScUndoEnterData::Redo()
DoChange();
EndRedo();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
for (size_t i = 0, n = maOldValues.size(); i < n; ++i)
{
aChangeRanges.Append(ScRange(maPos.Col(), maPos.Row(), maOldValues[i].mnTab));
}
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
}
}
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index c848d08ebc62..2d03320bc918 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1284,13 +1284,11 @@ void ScViewFunc::FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd,
pDocSh->UpdateOle(GetViewData());
UpdateScrollBars();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
- aChangeRanges.Append( aRange );
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
+ aChangeRanges.Append(aRange);
}
}
}
@@ -1316,11 +1314,10 @@ void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
pDocSh->UpdateOle(GetViewData());
UpdateScrollBars();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
ScRange aChangeRange( aRange );
switch ( eDir )
{
@@ -1350,8 +1347,7 @@ void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
}
break;
}
- aChangeRanges.Append( aChangeRange );
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
+ aChangeRanges.Append(aChangeRange);
}
}
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 4d2ba297f072..6698164fca99 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1703,25 +1703,23 @@ void ScViewFunc::PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMark
SelectionChanged();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if (!pModelObj || !pModelObj->HasChangesListeners())
- return;
-
ScRangeList aChangeRanges;
- for (size_t i = 0, n = rPasteRanges.size(); i < n; ++i)
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- const ScRange& r = *rPasteRanges[i];
- ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
- for (; itr != itrEnd; ++itr)
+ for (size_t i = 0, n = rPasteRanges.size(); i < n; ++i)
{
- ScRange aChangeRange(r);
- aChangeRange.aStart.SetTab(*itr);
- aChangeRange.aEnd.SetTab(*itr);
- aChangeRanges.Append(aChangeRange);
+ const ScRange& r = *rPasteRanges[i];
+ ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
+ for (; itr != itrEnd; ++itr)
+ {
+ ScRange aChangeRange(r);
+ aChangeRange.aStart.SetTab(*itr);
+ aChangeRange.aEnd.SetTab(*itr);
+ aChangeRanges.Append(aChangeRange);
+ }
}
}
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index c5493cd38de9..1bf2741d65cf 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -551,16 +551,13 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
pDocSh->UpdateOle(GetViewData());
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd; ++itr)
aChangeRanges.Append( ScRange( nCol, nRow, *itr ) );
-
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
}
if ( bRecord )
@@ -728,19 +725,16 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
pDocSh->UpdateOle(GetViewData());
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
itr = rMark.begin();
for (; itr != itrEnd; ++itr)
{
aChangeRanges.Append( ScRange( nCol, nRow, *itr ) );
}
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
}
-
aModificator.SetDocumentModified();
}
lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
@@ -1246,9 +1240,8 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
CellContentChanged();
}
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "attribute");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aProperties;
sal_Int32 nCount = 0;
@@ -1275,9 +1268,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
}
}
}
- pModelObj->NotifyChanges( OUString( "attribute" ), aChangeRanges, aProperties );
}
-
StartFormatArea();
}
@@ -1490,18 +1481,16 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste )
CellContentChanged();
ResetAutoSpell();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
{
- if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
+ OUString aOperation = ( eCmd == INS_INSROWS) ?
+ OUString("insert-rows"):
+ OUString("insert-columns");
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, aOperation);
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
aChangeRanges.Append( aRange );
- OUString aOperation = ( eCmd == INS_INSROWS ?
- OUString( "insert-rows" ) :
- OUString( "insert-columns" ) );
- pModelObj->NotifyChanges( aOperation, aChangeRanges );
}
}
}
@@ -1554,18 +1543,16 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, bool bRecord )
CellContentChanged();
ResetAutoSpell();
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ if ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS )
{
- if ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS )
+ ScRangeList aChangeRanges;
+ OUString aOperation = ( eCmd == DEL_DELROWS) ?
+ OUString("delete-rows"):
+ OUString("delete-columns");
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, aOperation);
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
- aChangeRanges.Append( aRange );
- OUString aOperation = ( eCmd == DEL_DELROWS ?
- OUString( "delete-rows" ) :
- OUString( "delete-columns" ) );
- pModelObj->NotifyChanges( aOperation, aChangeRanges );
+ aChangeRanges.Append(aRange);
}
}
@@ -1924,11 +1911,10 @@ void ScViewFunc::DeleteContents( sal_uInt16 nFlags, bool bRecord )
pDocSh->UpdateOle(GetViewData());
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "cell-change");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
if ( bSimple )
{
aChangeRanges.Append( aMarkRange );
@@ -1937,7 +1923,6 @@ void ScViewFunc::DeleteContents( sal_uInt16 nFlags, bool bRecord )
{
aFuncMark.FillRangeListWithMarks( &aChangeRanges, false );
}
- pModelObj->NotifyChanges( OUString( "cell-change" ), aChangeRanges );
}
aModificator.SetDocumentModified();
@@ -2222,10 +2207,10 @@ void ScViewFunc::SetWidthOrHeight( bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
// #i97876# Spreadsheet data changes are not notified
if ( bWidth )
{
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
- if ( pModelObj && pModelObj->HasChangesListeners() )
+ ScRangeList aChangeRanges;
+ HelperNotifyChanges aHelperNotifyChanges(&aChangeRanges, "column-resize");
+ if (aHelperNotifyChanges.getMustPropagateChanges())
{
- ScRangeList aChangeRanges;
itr = pMarkData->begin();
for (; itr != itrEnd; ++itr)
{
@@ -2241,7 +2226,6 @@ void ScViewFunc::SetWidthOrHeight( bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
}
}
}
- pModelObj->NotifyChanges( OUString( "column-resize" ), aChangeRanges );
}
}
}