diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-11-03 15:50:00 +0100 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-11-03 15:50:00 +0100 |
commit | efc013d327e4268fc2258bebf9bab0f298679251 (patch) | |
tree | bf915aa08dbc93db68d2e4d5bf65b76f2465e4eb /starmath | |
parent | cf71abf8511eb5348233fc0022c9a5a2159f7ea4 (diff) |
cws tlmath01: #i972# Math baseline alignment
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/node.hxx | 5 | ||||
-rw-r--r-- | starmath/source/document.cxx | 9 | ||||
-rwxr-xr-x | starmath/source/node.cxx | 20 |
3 files changed, 28 insertions, 6 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 2f2d0f770af1..e2a21238064d 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -180,8 +180,9 @@ public: const SmNode * FindTokenAt(USHORT nRow, USHORT nCol) const; const SmNode * FindRectClosestTo(const Point &rPoint) const; + // --> 4.7.2010 #i972# - virtual long GetFormulaBaseline() const { return (long)0; } //dummy, used in SmTableNode + virtual long GetFormulaBaseline() const; // <-- }; @@ -471,7 +472,7 @@ public: virtual SmNode * GetLeftMost(); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); - long GetFormulaBaseline() const { return nFormulaBaseline; } + virtual long GetFormulaBaseline() const; }; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ab1382b97879..243e16fb6504 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -38,6 +38,8 @@ #include <comphelper/storagehelper.hxx> #include <rtl/logfile.hxx> #include <rtl/ustring.hxx> +#include <unotools/eventcfg.hxx> +#include <sfx2/event.hxx> #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> @@ -180,7 +182,14 @@ void SmDocShell::SetText(const String& rBuffer) { pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_TEXT); if ( SFX_CREATE_MODE_EMBEDDED == GetCreateMode() ) + { + // have SwOleClient::FormatChanged() to align the modified formula properly + // even if the vis area does not change (e.g. when formula text changes from + // "{a over b + c} over d" to "d over {a over b + c}" + SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); + Repaint(); + } else pViewSh->GetGraphicWindow().Invalidate(); } diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index f3e88229b082..b1d7d9e69210 100755 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -573,6 +573,13 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const return pResult; } + +long SmNode::GetFormulaBaseline() const +{ + DBG_ASSERT( 0, "This dummy implementation should not have been called." ); + return 0; +} + /////////////////////////////////////////////////////////////////////////// SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) : @@ -792,7 +799,7 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) nFormulaBaseline = GetAlignM(); // move from middle position by constant - distance // between middle and baseline for single letter - nFormulaBaseline+= aRect.GetBaseline() - aRect.GetAlignM(); + nFormulaBaseline += aRect.GetBaseline() - aRect.GetAlignM(); } // <-- } @@ -804,6 +811,12 @@ SmNode * SmTableNode::GetLeftMost() } +long SmTableNode::GetFormulaBaseline() const +{ + return nFormulaBaseline; +} + + /**************************************************************************/ @@ -865,9 +878,8 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { aPos = pNode->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE); - // no horizontal space before first node - if (i) - aPos.X() += nDist; + // add horizontal space to the left for each but the first sub node + aPos.X() += nDist; pNode->MoveTo(aPos); ExtendBy( *pNode, RCP_XOR ); |