diff options
Diffstat (limited to 'sc/source/ui/view/viewfunc.cxx')
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 8b7adf0c0f19..6e15f9b3e0f8 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -337,15 +337,21 @@ static bool lcl_AddFunction( ScAppOptions& rAppOpt, sal_uInt16 nOpCode ) namespace HelperNotifyChanges { - static void NotifyIfChangesListeners(const ScDocShell &rDocShell, ScMarkData& rMark, SCCOL nCol, SCROW nRow) + static void NotifyIfChangesListeners(const ScDocShell &rDocShell, ScMarkData& rMark, + SCCOL nCol, SCROW nRow, const OUString& rType = "cell-change") { - if (ScModelObj *pModelObj = getMustPropagateChangesModel(rDocShell)) - { - ScRangeList aChangeRanges; - for (const auto& rTab : rMark) - aChangeRanges.push_back( ScRange( nCol, nRow, rTab ) ); + ScModelObj* pModelObj = getModel(rDocShell); + + ScRangeList aChangeRanges; + for (const auto& rTab : rMark) + aChangeRanges.push_back( ScRange( nCol, nRow, rTab ) ); - HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "cell-change"); + if (getMustPropagateChangesModel(pModelObj)) + Notify(*pModelObj, aChangeRanges, rType); + else + { + Notify(*pModelObj, aChangeRanges, isDataAreaInvalidateType(rType) + ? OUString("data-area-invalidate") : OUString("data-area-extend")); } } } @@ -648,7 +654,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, pDocSh->UpdateOle(GetViewData()); - HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow); + const OUString aType(rString.isEmpty() ? u"delete-content" : u"cell-change"); + HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow, aType); if ( bRecord ) rFunc.EndListAction(); @@ -802,7 +809,10 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, pDocSh->UpdateOle(GetViewData()); - HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow); + bool bIsEmpty = rData.GetParagraphCount() == 0 + || (rData.GetParagraphCount() == 1 && rData.GetText(0).isEmpty()); + const OUString aType(bIsEmpty ? u"delete-content" : u"cell-change"); + HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, rMark, nCol, nRow, aType); aModificator.SetDocumentModified(); } @@ -1337,8 +1347,9 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor CellContentChanged(); } - ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh); - if (pModelObj) + ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh); + + if (HelperNotifyChanges::getMustPropagateChangesModel(pModelObj)) { css::uno::Sequence< css::beans::PropertyValue > aProperties; sal_Int32 nCount = 0; @@ -2097,7 +2108,7 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) pDocSh->UpdateOle(GetViewData()); - if (ScModelObj *pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh)) + if (ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh)) { ScRangeList aChangeRanges; if ( bSimple ) @@ -2108,7 +2119,11 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) { aFuncMark.FillRangeListWithMarks( &aChangeRanges, false ); } - HelperNotifyChanges::Notify(*pModelObj, aChangeRanges); + + if (HelperNotifyChanges::getMustPropagateChangesModel(pModelObj)) + HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "delete-content"); + else if (pModelObj) + HelperNotifyChanges::Notify(*pModelObj, aChangeRanges, "data-area-invalidate"); } CellContentChanged(); @@ -2428,8 +2443,9 @@ void ScViewFunc::SetWidthOrHeight( if ( !bWidth ) return; - ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh); - if (!pModelObj) + ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh); + + if (!HelperNotifyChanges::getMustPropagateChangesModel(pModelObj)) return; ScRangeList aChangeRanges; |