diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 3b01edc59846..5af1561c6b83 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1512,6 +1512,8 @@ public: BOOL ContinueOnlineSpelling(); // TRUE = etwas gefunden + void RepaintRange( const ScRange& rRange ); + BOOL IsIdleDisabled() const { return bIdleDisabled; } void DisableIdle(BOOL bDo) { bIdleDisabled = bDo; } diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 14c9515dfacb..0c69950083cc 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -134,6 +134,8 @@ public: void AfterXMLLoading(sal_Bool bRet); ScSheetSaveData* GetSheetSaveData(); + void RepaintRange( const ScRange& rRange ); + bool HasChangesListeners() const; void NotifyChanges( const ::rtl::OUString& rOperation, const ScRangeList& rRanges, diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index b08838198477..3fff9faf2105 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1432,7 +1432,7 @@ void ScConditionalFormat::DoRepaint( const ScRange* pModified ) } } - pSh->Broadcast( ScPaintHint( aRange, PAINT_GRID ) ); + pDoc->RepaintRange( aRange ); } } } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 8fea4b8af2b9..7dbdee417165 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -169,8 +169,7 @@ void ScDocument::SetDBCollection( ScDBCollection* pNewDBCollection, BOOL bRemove RemoveFlagsTab( aOldRange.aStart.Col(), aOldRange.aStart.Row(), aOldRange.aEnd.Col(), aOldRange.aEnd.Row(), aOldRange.aStart.Tab(), SC_MF_AUTO ); - if (pShell) - pShell->Broadcast( ScPaintHint( aOldRange, PAINT_GRID ) ); + RepaintRange( aOldRange ); } } } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index e3c9d251fab7..9eb4bad7466d 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -94,6 +94,7 @@ #include "sc.hrc" #include "charthelper.hxx" #include "dpobject.hxx" +#include "docuno.hxx" #define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue() @@ -902,6 +903,16 @@ void ScDocument::RemoveAutoSpellObj() pTab[nTab]->RemoveAutoSpellObj(); } +void ScDocument::RepaintRange( const ScRange& rRange ) +{ + if ( bIsVisible && pShell ) + { + ScModelObj* pModel = ScModelObj::getImplementation( pShell->GetModel() ); + if ( pModel ) + pModel->RepaintRange( rRange ); // locked repaints are checked there + } +} + //------------------------------------------------------------------------ BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuchen diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index a3319eafd3fd..bfe3fa04a398 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -136,6 +136,13 @@ BOOL __EXPORT ScStyleSheet::SetParent( const String& rParentName ) { SfxItemSet& rParentSet = pStyle->GetItemSet(); GetItemSet().SetParent( &rParentSet ); + + // #i113491# Drag&Drop in the stylist's hierarchical view doesn't execute a slot, + // so the repaint has to come from here (after modifying the ItemSet). + // RepaintRange checks the document's IsVisible flag and locked repaints. + ScDocument* pDoc = static_cast(GetPool()).GetDocument(); + if (pDoc) + pDoc->RepaintRange( ScRange( 0,0,0, MAXCOL,MAXROW,MAXTAB ) ); } } diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index e534bb9dfb78..151478324ef7 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1267,11 +1267,7 @@ void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW { UpdatePageBreaks(NULL); - SfxObjectShell* pDocSh = pDocument->GetDocumentShell(); - if (pDocSh) - pDocSh->Broadcast( ScPaintHint( - ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), - PAINT_GRID ) ); + pDocument->RepaintRange( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab) ); } } } diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 59da2966cc60..60dc1bc7b115 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -53,6 +53,7 @@ class SfxItemSet; class SvxBorderLine; class SvxBoxItem; class SvxBoxInfoItem; +class SfxStyleSheetBase; class SfxStyleSheet; class SfxPoolItem; class EditTextObject; @@ -187,8 +188,8 @@ public: const SfxStyleSheet* GetStyleSheetFromMarked(); void SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, BOOL bRecord = TRUE ); - void RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet ); - void UpdateStyleSheetInUse( SfxStyleSheet* pStyleSheet ); + void RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ); + void UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ); void SetNumberFormat( short nFormatType, ULONG nAdd = 0 ); void SetNumFmtByStr( const String& rCode ); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 3d3f0f479601..d08e2cdc4bf5 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -449,6 +449,12 @@ ScSheetSaveData* ScModelObj::GetSheetSaveData() return NULL; } +void ScModelObj::RepaintRange( const ScRange& rRange ) +{ + if (pDocShell) + pDocShell->PostPaint( rRange, PAINT_GRID ); +} + uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) { diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 12a1bb87211b..3ff7222178f3 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -453,7 +453,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) { if ( pStyleSheet ) { - pTabViewShell->RemoveStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->RemoveStyleSheetInUse( pStyleSheet ); pStylePool->Remove( pStyleSheet ); pTabViewShell->InvalidateAttribs(); nRetMask = TRUE; @@ -556,7 +556,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // Attribute uebernehmen und Style anwenden pStyleSheet->GetItemSet().Put( aAttrSet ); - pTabViewShell->UpdateStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); // call SetStyleSheetToMarked after adding the ScUndoModifyStyle // (pStyleSheet pointer is used!) @@ -578,7 +578,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } pStyleSheet->GetItemSet().Put( aAttrSet ); - pTabViewShell->UpdateStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); // call SetStyleSheetToMarked after adding the ScUndoModifyStyle // (pStyleSheet pointer is used!) @@ -868,7 +868,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) (const SvxNumberInfoItem&) *(pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO)) ); - pTabViewShell->UpdateStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); pTabViewShell->InvalidateAttribs(); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 231eb4e67562..e0ebb8f3024f 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1545,7 +1545,7 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, BOOL bRecord } -void ScViewFunc::RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet ) +void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) { if ( !pStyleSheet) return; // ------------------------------------------------------------------- @@ -1572,7 +1572,7 @@ void ScViewFunc::RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet ) pHdl->ForgetLastPattern(); } -void ScViewFunc::UpdateStyleSheetInUse( SfxStyleSheet* pStyleSheet ) +void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) { if ( !pStyleSheet) return; // -------------------------------------------------------------------