summaryrefslogtreecommitdiff
path: root/starmath/source/document.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/source/document.cxx')
-rw-r--r--starmath/source/document.cxx36
1 files changed, 22 insertions, 14 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 49739af72972..ab1382b97879 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -131,9 +131,9 @@ void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&,
{
case HINT_FORMATCHANGED:
SetFormulaArranged(FALSE);
- nModifyCount++; //! merkwuerdig...
- // ohne dies wird die Grafik letztlich
- // nicht geupdatet
+
+ nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
+
Repaint();
break;
}
@@ -211,11 +211,19 @@ void SmDocShell::SetFormat(SmFormat& rFormat)
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::SetFormat" );
aFormat = rFormat;
- SetFormulaArranged(FALSE);
- SmViewShell *pViewSh = SmGetActiveView();
- if (pViewSh)
- pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_GAPHIC_SM);
- SetModified(TRUE);
+ SetFormulaArranged( FALSE );
+ SetModified( TRUE );
+
+ nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
+
+ // don't use SmGetActiveView since the view shell might not be active (0 pointer)
+ // if for example the Basic Macro dialog currently has the focus. Thus:
+ SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this );
+ while (pFrm)
+ {
+ pFrm->GetBindings().Invalidate(SID_GAPHIC_SM);
+ pFrm = SfxViewFrame::GetNext( *pFrm, this );
+ }
}
String SmDocShell::GetAccessibleText()
@@ -241,7 +249,7 @@ void SmDocShell::Parse()
delete pTree;
ReplaceBadChars();
pTree = aInterpreter.Parse(aText);
- nModifyCount++;
+ nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
SetFormulaArranged( FALSE );
}
@@ -1123,13 +1131,9 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_TEXT:
{
- const SfxStringItem& rItem =
- (const SfxStringItem&)rReq.GetArgs()->Get(SID_TEXT);
-
+ const SfxStringItem& rItem = (const SfxStringItem&)rReq.GetArgs()->Get(SID_TEXT);
if (GetText() != rItem.GetValue())
- {
SetText(rItem.GetValue());
- }
}
break;
@@ -1222,6 +1226,10 @@ void SmDocShell::GetState(SfxItemSet &rSet)
break;
case SID_GAPHIC_SM:
+ //! very old (pre UNO) and ugly hack to invalidate the SmGraphicWindow.
+ //! If nModifyCount gets changed then the call below will implicitly notify
+ //! SmGraphicController::StateChanged and there the window gets invalidated.
+ //! Thus all the 'nModifyCount++' before invalidating this slot.
rSet.Put(SfxInt16Item(SID_GAPHIC_SM, nModifyCount));
break;